mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 06:55:50 +00:00
Merge branch 'main' into next
This commit is contained in:
commit
ba46b69ff3
@ -13,6 +13,6 @@ export * from './FixedBlockDesignerItem';
|
|||||||
export * from './Page';
|
export * from './Page';
|
||||||
export * from './Page.Settings';
|
export * from './Page.Settings';
|
||||||
export { PagePopups } from './PagePopups';
|
export { PagePopups } from './PagePopups';
|
||||||
export { storePopupContext, withSearchParams, getPopupPathFromParams } from './pagePopupUtils';
|
export { storePopupContext, getStoredPopupContext, withSearchParams, getPopupPathFromParams } from './pagePopupUtils';
|
||||||
export * from './PageTab.Settings';
|
export * from './PageTab.Settings';
|
||||||
export { PopupSettingsProvider } from './PopupSettingsProvider';
|
export { PopupSettingsProvider } from './PopupSettingsProvider';
|
||||||
|
@ -30,6 +30,7 @@ const interfaces = {
|
|||||||
multipleSelect: MultipleSelectInterface,
|
multipleSelect: MultipleSelectInterface,
|
||||||
checkboxes: MultipleSelectInterface,
|
checkboxes: MultipleSelectInterface,
|
||||||
checkboxGroup: MultipleSelectInterface,
|
checkboxGroup: MultipleSelectInterface,
|
||||||
|
checkbox: BooleanInterface,
|
||||||
select: SelectInterface,
|
select: SelectInterface,
|
||||||
radio: SelectInterface,
|
radio: SelectInterface,
|
||||||
radioGroup: SelectInterface,
|
radioGroup: SelectInterface,
|
||||||
|
@ -41,6 +41,7 @@ const localizer = dayjsLocalizer(dayjs);
|
|||||||
|
|
||||||
export const DeleteEventContext = React.createContext({
|
export const DeleteEventContext = React.createContext({
|
||||||
close: () => {},
|
close: () => {},
|
||||||
|
allowDeleteEvent: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
function Toolbar(props: ToolbarProps) {
|
function Toolbar(props: ToolbarProps) {
|
||||||
@ -107,7 +108,6 @@ const useEvents = (dataSource: any, fieldNames: any, date: Date, view: (typeof W
|
|||||||
return eventStart.isSame(d);
|
return eventStart.isSame(d);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(99);
|
|
||||||
if (res) return out;
|
if (res) return out;
|
||||||
const title = getLabelFormatValue(labelUiSchema, get(item, fieldNames.title), true);
|
const title = getLabelFormatValue(labelUiSchema, get(item, fieldNames.title), true);
|
||||||
const event = {
|
const event = {
|
||||||
@ -216,7 +216,6 @@ export const Calendar: any = withDynamicSchemaProps(
|
|||||||
noEventsInRange: i18nt('None'),
|
noEventsInRange: i18nt('None'),
|
||||||
showMore: (count) => i18nt('{{count}} more items', { count }),
|
showMore: (count) => i18nt('{{count}} more items', { count }),
|
||||||
};
|
};
|
||||||
console.log(events, dataSource, fieldNames, date, view);
|
|
||||||
return wrapSSR(
|
return wrapSSR(
|
||||||
<div className={`${hashId} ${containerClassName}`} style={{ height: height || 700 }}>
|
<div className={`${hashId} ${containerClassName}`} style={{ height: height || 700 }}>
|
||||||
<PopupContextProvider visible={visible} setVisible={setVisible}>
|
<PopupContextProvider visible={visible} setVisible={setVisible}>
|
||||||
|
@ -10,23 +10,38 @@
|
|||||||
import { observer } from '@formily/react';
|
import { observer } from '@formily/react';
|
||||||
import { Modal, Radio, Space, Typography } from 'antd';
|
import { Modal, Radio, Space, Typography } from 'antd';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import React, { useContext, useState } from 'react';
|
import React, { useContext, useState, useMemo } from 'react';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
import { DeleteEventContext } from './Calendar';
|
import { DeleteEventContext } from './Calendar';
|
||||||
import { formatDate } from './utils';
|
import { formatDate } from './utils';
|
||||||
import { useActionContext, useRecord, useFilterByTk, useBlockRequestContext } from '@nocobase/client';
|
import {
|
||||||
|
useActionContext,
|
||||||
|
useRecord,
|
||||||
|
useFilterByTk,
|
||||||
|
useBlockRequestContext,
|
||||||
|
getStoredPopupContext,
|
||||||
|
usePopupUtils,
|
||||||
|
} from '@nocobase/client';
|
||||||
import { useTranslation } from '../../locale';
|
import { useTranslation } from '../../locale';
|
||||||
const { Text } = Typography;
|
const { Text } = Typography;
|
||||||
|
|
||||||
export const DeleteEvent = observer(
|
export const DeleteEvent = observer(
|
||||||
() => {
|
() => {
|
||||||
const { visible, setVisible } = useActionContext();
|
const { visible, setVisible, setSubmitted } = useActionContext();
|
||||||
const { exclude = [], cron, ...record } = useRecord();
|
const { exclude = [], cron, ...record } = useRecord();
|
||||||
const { close } = useContext(DeleteEventContext);
|
const { close } = useContext(DeleteEventContext);
|
||||||
const startDate = formatDate(dayjs(record.__parent?.__event.start));
|
const { context: popUpCtx, closePopup } = usePopupUtils();
|
||||||
|
const parentXUid = popUpCtx?.params?.popupuid || '';
|
||||||
|
const eventData = getStoredPopupContext(parentXUid) || { record: null, service: null };
|
||||||
|
const startDate = useMemo(
|
||||||
|
() => formatDate(dayjs(eventData.record?.data?.__event.start)),
|
||||||
|
[eventData.record?.data?.__event.start],
|
||||||
|
);
|
||||||
|
// directly access popup can only del all, for we have no event detail
|
||||||
|
const disableDelPart = eventData.record ? false : true;
|
||||||
const filterByTk = useFilterByTk();
|
const filterByTk = useFilterByTk();
|
||||||
const { resource, service, __parent } = useBlockRequestContext();
|
const { resource, service, __parent } = useBlockRequestContext();
|
||||||
const [value, onChange] = useState(startDate);
|
const [value, onChange] = useState(disableDelPart ? 'all' : startDate);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const onOk = async () => {
|
const onOk = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@ -47,6 +62,7 @@ export const DeleteEvent = observer(
|
|||||||
service?.refresh?.();
|
service?.refresh?.();
|
||||||
setVisible?.(false, true);
|
setVisible?.(false, true);
|
||||||
close();
|
close();
|
||||||
|
setSubmitted?.(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@ -61,8 +77,12 @@ export const DeleteEvent = observer(
|
|||||||
{cron ? (
|
{cron ? (
|
||||||
<Radio.Group value={value} onChange={(event) => onChange(event.target.value)}>
|
<Radio.Group value={value} onChange={(event) => onChange(event.target.value)}>
|
||||||
<Space direction="vertical">
|
<Space direction="vertical">
|
||||||
<Radio value={startDate}>{t('This event')}</Radio>
|
<Radio value={startDate} disabled={disableDelPart}>
|
||||||
<Radio value={`${startDate}_after`}>{t('This and following events')}</Radio>
|
{t('This event')}
|
||||||
|
</Radio>
|
||||||
|
<Radio value={`${startDate}_after`} disabled={disableDelPart}>
|
||||||
|
{t('This and following events')}
|
||||||
|
</Radio>
|
||||||
<Radio value="all">{t('All events')}</Radio>
|
<Radio value="all">{t('All events')}</Radio>
|
||||||
</Space>
|
</Space>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
|
@ -27,10 +27,9 @@ export const Event = observer(
|
|||||||
const close = useCallback(() => {
|
const close = useCallback(() => {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}, [setVisible]);
|
}, [setVisible]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PopupContextProvider visible={visible} setVisible={setVisible}>
|
<PopupContextProvider visible={visible} setVisible={setVisible}>
|
||||||
<DeleteEventContext.Provider value={{ close }}>
|
<DeleteEventContext.Provider value={{ close, allowDeleteEvent: true }}>
|
||||||
<VariablePopupRecordProvider recordData={recordData} collection={collection}>
|
<VariablePopupRecordProvider recordData={recordData} collection={collection}>
|
||||||
{props.children}
|
{props.children}
|
||||||
</VariablePopupRecordProvider>
|
</VariablePopupRecordProvider>
|
||||||
|
@ -7,14 +7,17 @@
|
|||||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { useFieldSchema } from '@formily/react';
|
||||||
import {
|
import {
|
||||||
SchemaInitializer,
|
SchemaInitializer,
|
||||||
SchemaInitializerItemType,
|
SchemaInitializerItemType,
|
||||||
useCollection_deprecated,
|
useCollection_deprecated,
|
||||||
useActionAvailable,
|
useActionAvailable,
|
||||||
} from '@nocobase/client';
|
} from '@nocobase/client';
|
||||||
|
import { useContext } from 'react';
|
||||||
import { generateNTemplate } from '../../../locale';
|
import { generateNTemplate } from '../../../locale';
|
||||||
import { DeleteEventActionInitializer } from '../items/DeleteEventActionInitializer';
|
import { DeleteEventActionInitializer } from '../items/DeleteEventActionInitializer';
|
||||||
|
import { DeleteEventContext } from '../../calendar/Calendar';
|
||||||
export const deleteEventActionInitializer: SchemaInitializerItemType<any> = {
|
export const deleteEventActionInitializer: SchemaInitializerItemType<any> = {
|
||||||
name: 'deleteEvent',
|
name: 'deleteEvent',
|
||||||
title: generateNTemplate('Delete Event'),
|
title: generateNTemplate('Delete Event'),
|
||||||
@ -24,8 +27,9 @@ export const deleteEventActionInitializer: SchemaInitializerItemType<any> = {
|
|||||||
'x-decorator': 'ACLActionProvider',
|
'x-decorator': 'ACLActionProvider',
|
||||||
},
|
},
|
||||||
useVisible() {
|
useVisible() {
|
||||||
|
const { allowDeleteEvent } = useContext(DeleteEventContext);
|
||||||
const collection = useCollection_deprecated();
|
const collection = useCollection_deprecated();
|
||||||
return collection.template === 'calendar';
|
return collection.template === 'calendar' && allowDeleteEvent;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
"name": "@nocobase/plugin-data-source-main",
|
"name": "@nocobase/plugin-data-source-main",
|
||||||
"displayName": "Data source: Main",
|
"displayName": "Data source: Main",
|
||||||
"displayName.zh-CN": "数据源:主数据库",
|
"displayName.zh-CN": "数据源:主数据库",
|
||||||
"description": "NocoBase main database, supports relational databases such as MySQL, PostgreSQL, SQLite and so on.",
|
"description": "NocoBase main database, supports relational databases such as PostgreSQL, MySQL, MariaDB and so on.",
|
||||||
"description.zh-CN": "NocoBase 主数据库,支持 MySQL、PostgreSQL、SQLite 等关系型数据库。",
|
"description.zh-CN": "NocoBase 主数据库,支持 PostgreSQL、MySQL、MariaDB 等关系型数据库。",
|
||||||
"version": "1.4.0-alpha",
|
"version": "1.4.0-alpha",
|
||||||
"main": "./dist/server/index.js",
|
"main": "./dist/server/index.js",
|
||||||
"homepage": "https://docs.nocobase.com/handbook/data-source-main",
|
"homepage": "https://docs.nocobase.com/handbook/data-source-main",
|
||||||
|
Loading…
Reference in New Issue
Block a user