@nocobase/client 0.9.0-alpha.2 → 0.9.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/acl/ACLProvider.js +4 -7
- package/es/api-client/APIClient.js +6 -0
- package/es/block-provider/BlockProvider.js +9 -6
- package/es/block-provider/FormBlockProvider.js +3 -1
- package/es/block-provider/KanbanBlockProvider.js +1 -1
- package/es/block-provider/SharedFilterProvider.js +9 -1
- package/es/block-provider/TableBlockProvider.js +1 -1
- package/es/block-provider/TableSelectorProvider.js +2 -2
- package/es/block-provider/hooks/index.js +22 -7
- package/es/collection-manager/CollectionManagerProvider.d.ts +1 -0
- package/es/collection-manager/CollectionManagerProvider.js +71 -9
- package/es/collection-manager/CollectionManagerShortcut.js +36 -23
- package/es/collection-manager/Configuration/AddCategoryAction.d.ts +2 -0
- package/es/collection-manager/Configuration/AddCategoryAction.js +117 -0
- package/es/collection-manager/Configuration/AddCollectionAction.js +8 -3
- package/es/collection-manager/Configuration/AddFieldAction.js +1 -0
- package/es/collection-manager/Configuration/ConfigurationTable.js +33 -4
- package/es/collection-manager/Configuration/ConfigurationTabs.d.ts +1 -0
- package/es/collection-manager/Configuration/ConfigurationTabs.js +381 -0
- package/es/collection-manager/Configuration/EditCategoryAction.d.ts +2 -0
- package/es/collection-manager/Configuration/EditCategoryAction.js +150 -0
- package/es/collection-manager/Configuration/EditCollectionAction.js +6 -2
- package/es/collection-manager/Configuration/OverridingCollectionField.js +17 -8
- package/es/collection-manager/Configuration/components/CollectionCategory.d.ts +2 -0
- package/es/collection-manager/Configuration/components/CollectionCategory.js +13 -0
- package/es/collection-manager/Configuration/index.d.ts +3 -0
- package/es/collection-manager/Configuration/index.js +3 -0
- package/es/collection-manager/Configuration/schemas/collections.d.ts +3 -0
- package/es/collection-manager/Configuration/schemas/collections.js +309 -176
- package/es/collection-manager/Configuration/templates.d.ts +1 -0
- package/es/collection-manager/Configuration/templates.js +1 -1
- package/es/collection-manager/action-hooks.js +3 -1
- package/es/collection-manager/context.d.ts +4 -0
- package/es/collection-manager/context.js +5 -1
- package/es/collection-manager/hooks/useCollectionManager.d.ts +7 -0
- package/es/collection-manager/hooks/useCollectionManager.js +51 -6
- package/es/collection-manager/interfaces/m2m.js +2 -2
- package/es/collection-manager/interfaces/properties/index.d.ts +0 -56
- package/es/collection-manager/interfaces/properties/index.js +1 -2
- package/es/collection-manager/templates/calendar.js +1 -1
- package/es/collection-manager/templates/general.js +1 -1
- package/es/collection-manager/templates/properties/index.d.ts +12 -1
- package/es/collection-manager/templates/properties/index.js +11 -0
- package/es/i18n/i18n.js +3 -1
- package/es/locale/en_US.d.ts +23 -0
- package/es/locale/en_US.js +23 -0
- package/es/locale/ja_JP.d.ts +23 -0
- package/es/locale/ja_JP.js +24 -1
- package/es/locale/ru_RU.d.ts +1 -0
- package/es/locale/ru_RU.js +1 -0
- package/es/locale/zh_CN.d.ts +43 -4
- package/es/locale/zh_CN.js +44 -5
- package/es/route-switch/antd/admin-layout/index.js +13 -33
- package/es/schema-component/antd/action/Action.Designer.js +22 -15
- package/es/schema-component/antd/action/Action.js +25 -3
- package/es/schema-component/antd/action/utils.d.ts +1 -0
- package/es/schema-component/antd/action/utils.js +49 -0
- package/es/schema-component/antd/association-filter/AssociationFilter.js +4 -4
- package/es/schema-component/antd/association-select/AssociationSelect.d.ts +2 -2
- package/es/schema-component/antd/association-select/useServiceOptions.js +47 -6
- package/es/schema-component/antd/calendar/Calendar.Designer.js +17 -36
- package/es/schema-component/antd/checkbox/Checkbox.js +9 -8
- package/es/schema-component/antd/date-picker/util.d.ts +1 -1
- package/es/schema-component/antd/date-picker/util.js +1 -1
- package/es/schema-component/antd/filter/DynamicComponent.js +3 -1
- package/es/schema-component/antd/filter/Filter.js +2 -1
- package/es/schema-component/antd/filter/FilterGroup.js +7 -4
- package/es/schema-component/antd/filter/FilterItem.js +3 -2
- package/es/schema-component/antd/filter/context.d.ts +1 -0
- package/es/schema-component/antd/filter/useValues.js +14 -11
- package/es/schema-component/antd/form/Form.js +11 -5
- package/es/schema-component/antd/form-item/FormItem.js +17 -8
- package/es/schema-component/antd/form-v2/Form.Designer.js +2 -0
- package/es/schema-component/antd/form-v2/Form.js +90 -7
- package/es/schema-component/antd/form-v2/utils.d.ts +5 -0
- package/es/schema-component/antd/form-v2/utils.js +161 -0
- package/es/schema-component/antd/grid/Grid.js +10 -5
- package/es/schema-component/antd/icon-picker/IconPicker.js +1 -0
- package/es/schema-component/antd/index.d.ts +1 -0
- package/es/schema-component/antd/index.js +1 -0
- package/es/schema-component/antd/input/Input.d.ts +2 -1
- package/es/schema-component/antd/input/Json.d.ts +5 -3
- package/es/schema-component/antd/input/Json.js +3 -2
- package/es/schema-component/antd/input-number/InputNumber.js +3 -1
- package/es/schema-component/antd/page/FixedBlock.js +3 -1
- package/es/schema-component/antd/page/Page.js +11 -5
- package/es/schema-component/antd/page/PageTabDesigner.js +3 -3
- package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
- package/es/schema-component/antd/record-picker/RecordPicker.js +1 -2
- package/es/schema-component/antd/record-picker/util.js +7 -0
- package/es/schema-component/antd/remote-select/RemoteSelect.js +76 -36
- package/es/schema-component/antd/rich-text/RichText.js +4 -2
- package/es/schema-component/antd/select/Select.js +14 -4
- package/es/schema-component/antd/table/Table.Array.js +10 -3
- package/es/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
- package/es/schema-component/antd/table-v2/TableBlockDesigner.js +3 -2
- package/es/schema-component/antd/tabs/Tabs.Designer.js +1 -0
- package/es/schema-component/antd/time-picker/TimePicker.js +1 -1
- package/es/schema-component/antd/variable/Input.d.ts +2 -0
- package/es/schema-component/antd/variable/Input.js +244 -0
- package/es/schema-component/antd/variable/JSONInput.d.ts +2 -0
- package/es/schema-component/antd/variable/JSONInput.js +82 -0
- package/es/schema-component/antd/variable/TextArea.d.ts +2 -0
- package/es/schema-component/antd/variable/TextArea.js +322 -0
- package/es/schema-component/antd/variable/Variable.d.ts +8 -0
- package/es/schema-component/antd/variable/Variable.js +11 -0
- package/es/schema-component/antd/variable/index.d.ts +1 -0
- package/es/schema-component/antd/variable/index.js +1 -0
- package/es/schema-component/common/sortable-item/SortableItem.js +36 -6
- package/es/schema-component/common/utils/logic.js +523 -0
- package/es/schema-component/common/utils/uitls.d.ts +1 -0
- package/es/schema-component/common/utils/uitls.js +89 -0
- package/es/schema-initializer/SchemaInitializer.js +0 -1
- package/es/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
- package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -3
- package/es/schema-initializer/index.d.ts +2 -1
- package/es/schema-initializer/index.js +2 -1
- package/es/schema-initializer/items/CalendarBlockInitializer.js +24 -41
- package/es/schema-initializer/utils.js +22 -7
- package/es/schema-settings/LinkageRules/DynamicComponent.d.ts +1 -0
- package/es/schema-settings/LinkageRules/DynamicComponent.js +113 -0
- package/es/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +2 -0
- package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +15 -0
- package/es/schema-settings/LinkageRules/LinkageRuleAction.d.ts +3 -0
- package/es/schema-settings/LinkageRules/LinkageRuleAction.js +162 -0
- package/es/schema-settings/LinkageRules/LinkageRuleActionGroup.d.ts +3 -0
- package/es/schema-settings/LinkageRules/LinkageRuleActionGroup.js +71 -0
- package/es/schema-settings/LinkageRules/ValueDynamicComponent.d.ts +1 -0
- package/es/schema-settings/LinkageRules/ValueDynamicComponent.js +82 -0
- package/es/schema-settings/LinkageRules/Variables.d.ts +7 -0
- package/es/schema-settings/LinkageRules/Variables.js +115 -0
- package/es/schema-settings/LinkageRules/action-hooks.d.ts +1 -0
- package/es/schema-settings/LinkageRules/action-hooks.js +115 -0
- package/es/schema-settings/LinkageRules/context.d.ts +13 -0
- package/es/schema-settings/LinkageRules/context.js +4 -0
- package/es/schema-settings/LinkageRules/index.d.ts +2 -0
- package/es/schema-settings/LinkageRules/index.js +132 -0
- package/es/schema-settings/LinkageRules/type.d.ts +13 -0
- package/es/schema-settings/LinkageRules/type.js +15 -0
- package/es/schema-settings/LinkageRules/useValues.d.ts +1 -0
- package/es/schema-settings/LinkageRules/useValues.js +84 -0
- package/es/schema-settings/SchemaSettings.d.ts +4 -1
- package/es/schema-settings/SchemaSettings.js +153 -26
- package/es/schema-templates/BlockTemplate.js +9 -1
- package/es/system-settings/SystemSettingsShortcut.js +1 -1
- package/lib/acl/ACLProvider.js +4 -7
- package/lib/api-client/APIClient.js +6 -0
- package/lib/block-provider/BlockProvider.js +9 -6
- package/lib/block-provider/FormBlockProvider.js +3 -1
- package/lib/block-provider/KanbanBlockProvider.js +1 -1
- package/lib/block-provider/SharedFilterProvider.js +9 -3
- package/lib/block-provider/TableBlockProvider.js +1 -1
- package/lib/block-provider/TableSelectorProvider.js +2 -2
- package/lib/block-provider/hooks/index.js +23 -7
- package/lib/collection-manager/CollectionManagerProvider.d.ts +1 -0
- package/lib/collection-manager/CollectionManagerProvider.js +81 -16
- package/lib/collection-manager/CollectionManagerShortcut.js +36 -23
- package/lib/collection-manager/Configuration/AddCategoryAction.d.ts +2 -0
- package/lib/collection-manager/Configuration/AddCategoryAction.js +145 -0
- package/lib/collection-manager/Configuration/AddCollectionAction.js +8 -3
- package/lib/collection-manager/Configuration/AddFieldAction.js +1 -0
- package/lib/collection-manager/Configuration/ConfigurationTable.js +34 -4
- package/lib/collection-manager/Configuration/ConfigurationTabs.d.ts +1 -0
- package/lib/collection-manager/Configuration/ConfigurationTabs.js +407 -0
- package/lib/collection-manager/Configuration/EditCategoryAction.d.ts +2 -0
- package/lib/collection-manager/Configuration/EditCategoryAction.js +178 -0
- package/lib/collection-manager/Configuration/EditCollectionAction.js +6 -2
- package/lib/collection-manager/Configuration/OverridingCollectionField.js +17 -8
- package/lib/collection-manager/Configuration/components/CollectionCategory.d.ts +2 -0
- package/lib/collection-manager/Configuration/components/CollectionCategory.js +27 -0
- package/lib/collection-manager/Configuration/index.d.ts +3 -0
- package/lib/collection-manager/Configuration/index.js +39 -0
- package/lib/collection-manager/Configuration/schemas/collections.d.ts +3 -0
- package/lib/collection-manager/Configuration/schemas/collections.js +316 -178
- package/lib/collection-manager/Configuration/templates.d.ts +1 -0
- package/lib/collection-manager/Configuration/templates.js +2 -0
- package/lib/collection-manager/action-hooks.js +3 -1
- package/lib/collection-manager/context.d.ts +4 -0
- package/lib/collection-manager/context.js +7 -2
- package/lib/collection-manager/hooks/useCollectionManager.d.ts +7 -0
- package/lib/collection-manager/hooks/useCollectionManager.js +52 -6
- package/lib/collection-manager/interfaces/m2m.js +2 -2
- package/lib/collection-manager/interfaces/properties/index.d.ts +0 -56
- package/lib/collection-manager/interfaces/properties/index.js +1 -2
- package/lib/collection-manager/templates/calendar.js +1 -1
- package/lib/collection-manager/templates/general.js +1 -1
- package/lib/collection-manager/templates/properties/index.d.ts +12 -1
- package/lib/collection-manager/templates/properties/index.js +11 -0
- package/lib/i18n/i18n.js +3 -1
- package/lib/locale/en_US.d.ts +23 -0
- package/lib/locale/en_US.js +23 -0
- package/lib/locale/ja_JP.d.ts +23 -0
- package/lib/locale/ja_JP.js +24 -1
- package/lib/locale/ru_RU.d.ts +1 -0
- package/lib/locale/ru_RU.js +1 -0
- package/lib/locale/zh_CN.d.ts +43 -4
- package/lib/locale/zh_CN.js +44 -5
- package/lib/route-switch/antd/admin-layout/index.js +13 -33
- package/lib/schema-component/antd/action/Action.Designer.js +24 -14
- package/lib/schema-component/antd/action/Action.js +27 -2
- package/lib/schema-component/antd/action/utils.d.ts +1 -0
- package/lib/schema-component/antd/action/utils.js +58 -2
- package/lib/schema-component/antd/association-filter/AssociationFilter.js +3 -3
- package/lib/schema-component/antd/association-select/AssociationSelect.d.ts +2 -2
- package/lib/schema-component/antd/association-select/useServiceOptions.js +47 -4
- package/lib/schema-component/antd/calendar/Calendar.Designer.js +15 -33
- package/lib/schema-component/antd/checkbox/Checkbox.js +8 -7
- package/lib/schema-component/antd/date-picker/util.d.ts +1 -1
- package/lib/schema-component/antd/date-picker/util.js +1 -1
- package/lib/schema-component/antd/filter/DynamicComponent.js +3 -1
- package/lib/schema-component/antd/filter/Filter.js +2 -1
- package/lib/schema-component/antd/filter/FilterGroup.js +7 -4
- package/lib/schema-component/antd/filter/FilterItem.js +3 -2
- package/lib/schema-component/antd/filter/context.d.ts +1 -0
- package/lib/schema-component/antd/filter/useValues.js +15 -11
- package/lib/schema-component/antd/form/Form.js +9 -3
- package/lib/schema-component/antd/form-item/FormItem.js +21 -7
- package/lib/schema-component/antd/form-v2/Form.Designer.js +2 -0
- package/lib/schema-component/antd/form-v2/Form.js +89 -5
- package/lib/schema-component/antd/form-v2/utils.d.ts +5 -0
- package/lib/schema-component/antd/form-v2/utils.js +181 -0
- package/lib/schema-component/antd/grid/Grid.js +10 -5
- package/lib/schema-component/antd/icon-picker/IconPicker.js +1 -0
- package/lib/schema-component/antd/index.d.ts +1 -0
- package/lib/schema-component/antd/index.js +13 -0
- package/lib/schema-component/antd/input/Input.d.ts +2 -1
- package/lib/schema-component/antd/input/Json.d.ts +5 -3
- package/lib/schema-component/antd/input/Json.js +6 -3
- package/lib/schema-component/antd/input-number/InputNumber.js +2 -0
- package/lib/schema-component/antd/page/FixedBlock.js +3 -1
- package/lib/schema-component/antd/page/Page.js +14 -5
- package/lib/schema-component/antd/page/PageTabDesigner.js +1 -1
- package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
- package/lib/schema-component/antd/record-picker/RecordPicker.js +1 -2
- package/lib/schema-component/antd/record-picker/util.js +7 -0
- package/lib/schema-component/antd/remote-select/RemoteSelect.js +76 -37
- package/lib/schema-component/antd/rich-text/RichText.js +4 -2
- package/lib/schema-component/antd/select/Select.js +14 -4
- package/lib/schema-component/antd/table/Table.Array.js +8 -1
- package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
- package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +3 -2
- package/lib/schema-component/antd/tabs/Tabs.Designer.js +1 -0
- package/lib/schema-component/antd/time-picker/TimePicker.js +1 -1
- package/lib/schema-component/antd/variable/Input.d.ts +2 -0
- package/lib/schema-component/antd/variable/Input.js +262 -0
- package/lib/schema-component/antd/variable/JSONInput.d.ts +2 -0
- package/lib/schema-component/antd/variable/JSONInput.js +100 -0
- package/lib/schema-component/antd/variable/TextArea.d.ts +2 -0
- package/lib/schema-component/antd/variable/TextArea.js +341 -0
- package/lib/schema-component/antd/variable/Variable.d.ts +8 -0
- package/lib/schema-component/antd/variable/Variable.js +25 -0
- package/lib/schema-component/antd/variable/index.d.ts +1 -0
- package/lib/schema-component/antd/variable/index.js +18 -0
- package/lib/schema-component/common/sortable-item/SortableItem.js +36 -6
- package/lib/schema-component/common/utils/logic.js +525 -0
- package/lib/schema-component/common/utils/uitls.d.ts +1 -0
- package/lib/schema-component/common/utils/uitls.js +103 -0
- package/lib/schema-initializer/SchemaInitializer.js +0 -1
- package/lib/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
- package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +3 -1
- package/lib/schema-initializer/index.d.ts +2 -1
- package/lib/schema-initializer/index.js +51 -2
- package/lib/schema-initializer/items/CalendarBlockInitializer.js +16 -33
- package/lib/schema-initializer/utils.js +22 -6
- package/lib/schema-settings/LinkageRules/DynamicComponent.d.ts +1 -0
- package/lib/schema-settings/LinkageRules/DynamicComponent.js +139 -0
- package/lib/schema-settings/LinkageRules/FilterDynamicComponent.d.ts +2 -0
- package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +27 -0
- package/lib/schema-settings/LinkageRules/LinkageRuleAction.d.ts +3 -0
- package/lib/schema-settings/LinkageRules/LinkageRuleAction.js +190 -0
- package/lib/schema-settings/LinkageRules/LinkageRuleActionGroup.d.ts +3 -0
- package/lib/schema-settings/LinkageRules/LinkageRuleActionGroup.js +90 -0
- package/lib/schema-settings/LinkageRules/ValueDynamicComponent.d.ts +1 -0
- package/lib/schema-settings/LinkageRules/ValueDynamicComponent.js +104 -0
- package/lib/schema-settings/LinkageRules/Variables.d.ts +7 -0
- package/lib/schema-settings/LinkageRules/Variables.js +124 -0
- package/lib/schema-settings/LinkageRules/action-hooks.d.ts +1 -0
- package/lib/schema-settings/LinkageRules/action-hooks.js +127 -0
- package/lib/schema-settings/LinkageRules/context.d.ts +13 -0
- package/lib/schema-settings/LinkageRules/context.js +15 -0
- package/lib/schema-settings/LinkageRules/index.d.ts +2 -0
- package/lib/schema-settings/LinkageRules/index.js +149 -0
- package/lib/schema-settings/LinkageRules/type.d.ts +13 -0
- package/lib/schema-settings/LinkageRules/type.js +22 -0
- package/lib/schema-settings/LinkageRules/useValues.d.ts +1 -0
- package/lib/schema-settings/LinkageRules/useValues.js +95 -0
- package/lib/schema-settings/SchemaSettings.d.ts +4 -1
- package/lib/schema-settings/SchemaSettings.js +176 -48
- package/lib/schema-templates/BlockTemplate.js +9 -1
- package/lib/system-settings/SystemSettingsShortcut.js +1 -1
- package/package.json +4 -4
|
@@ -2,4 +2,5 @@ export * from './SchemaInitializer';
|
|
|
2
2
|
export * from './SchemaInitializerProvider';
|
|
3
3
|
export * from './types';
|
|
4
4
|
export * from './items';
|
|
5
|
-
export { gridRowColWrap, useRecordCollectionDataSourceItems } from './utils';
|
|
5
|
+
export { gridRowColWrap, useRecordCollectionDataSourceItems, createTableBlockSchema, useAssociatedTableColumnInitializerFields, useInheritsTableColumnInitializerFields, useTableColumnInitializerFields, itemsMerge, } from './utils';
|
|
6
|
+
export * from './buttons';
|
|
@@ -2,4 +2,5 @@ export * from './SchemaInitializer';
|
|
|
2
2
|
export * from './SchemaInitializerProvider';
|
|
3
3
|
export * from './types';
|
|
4
4
|
export * from './items';
|
|
5
|
-
export { gridRowColWrap, useRecordCollectionDataSourceItems } from './utils';
|
|
5
|
+
export { gridRowColWrap, useRecordCollectionDataSourceItems, createTableBlockSchema, useAssociatedTableColumnInitializerFields, useInheritsTableColumnInitializerFields, useTableColumnInitializerFields, itemsMerge } from './utils';
|
|
6
|
+
export * from './buttons';
|
|
@@ -8,15 +8,15 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
8
8
|
|
|
9
9
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
10
|
|
|
11
|
-
import React, { useContext } from
|
|
12
|
-
import { FormDialog, FormLayout } from
|
|
11
|
+
import React, { useContext } from 'react';
|
|
12
|
+
import { FormDialog, FormLayout } from '@formily/antd';
|
|
13
13
|
import { FormOutlined } from '@ant-design/icons';
|
|
14
|
-
import { SchemaOptionsContext } from
|
|
15
|
-
import { useTranslation } from
|
|
16
|
-
import { useCollectionManager } from
|
|
17
|
-
import { SchemaComponent, SchemaComponentOptions } from
|
|
18
|
-
import { createCalendarBlockSchema } from
|
|
19
|
-
import { DataBlockInitializer } from
|
|
14
|
+
import { SchemaOptionsContext } from '@formily/react';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { useCollectionManager } from '../../collection-manager';
|
|
17
|
+
import { SchemaComponent, SchemaComponentOptions } from '../../schema-component';
|
|
18
|
+
import { createCalendarBlockSchema } from '../utils';
|
|
19
|
+
import { DataBlockInitializer } from './DataBlockInitializer';
|
|
20
20
|
export var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
|
|
21
21
|
var insert = props.insert;
|
|
22
22
|
|
|
@@ -24,44 +24,27 @@ export var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
|
|
|
24
24
|
t = _useTranslation.t;
|
|
25
25
|
|
|
26
26
|
var _useCollectionManager = useCollectionManager(),
|
|
27
|
-
|
|
27
|
+
getCollectionField = _useCollectionManager.getCollectionField,
|
|
28
|
+
getCollectionFieldsOptions = _useCollectionManager.getCollectionFieldsOptions;
|
|
28
29
|
|
|
30
|
+
useCollectionManager;
|
|
29
31
|
var options = useContext(SchemaOptionsContext);
|
|
30
32
|
return /*#__PURE__*/React.createElement(DataBlockInitializer, _objectSpread(_objectSpread({}, props), {}, {
|
|
31
33
|
componentType: 'Calendar',
|
|
32
34
|
icon: /*#__PURE__*/React.createElement(FormOutlined, null),
|
|
33
35
|
onCreateBlockSchema: function () {
|
|
34
36
|
var _onCreateBlockSchema = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
var item, collectionFields, stringFields, dateFields, values;
|
|
37
|
+
var item, stringFieldsOptions, dateFieldsOptions, values;
|
|
38
38
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
39
39
|
while (1) {
|
|
40
40
|
switch (_context.prev = _context.next) {
|
|
41
41
|
case 0:
|
|
42
42
|
item = _ref.item;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})) === null || _collectionFields$fil === void 0 ? void 0 : _collectionFields$fil.map(function (field) {
|
|
47
|
-
var _field$uiSchema;
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
label: field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title,
|
|
51
|
-
value: field.name
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
dateFields = collectionFields === null || collectionFields === void 0 ? void 0 : (_collectionFields$fil2 = collectionFields.filter(function (field) {
|
|
55
|
-
return field.type === 'date';
|
|
56
|
-
})) === null || _collectionFields$fil2 === void 0 ? void 0 : _collectionFields$fil2.map(function (field) {
|
|
57
|
-
var _field$uiSchema2;
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
label: field === null || field === void 0 ? void 0 : (_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.title,
|
|
61
|
-
value: field.name
|
|
62
|
-
};
|
|
43
|
+
stringFieldsOptions = getCollectionFieldsOptions(item.name, 'string');
|
|
44
|
+
dateFieldsOptions = getCollectionFieldsOptions(item.name, 'date', {
|
|
45
|
+
association: ['o2o', 'obo', 'oho', 'm2o']
|
|
63
46
|
});
|
|
64
|
-
_context.next =
|
|
47
|
+
_context.next = 5;
|
|
65
48
|
return FormDialog(t('Create calendar block'), function () {
|
|
66
49
|
return /*#__PURE__*/React.createElement(SchemaComponentOptions, {
|
|
67
50
|
scope: options.scope,
|
|
@@ -73,23 +56,23 @@ export var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
|
|
|
73
56
|
properties: {
|
|
74
57
|
title: {
|
|
75
58
|
title: t('Title field'),
|
|
76
|
-
enum:
|
|
59
|
+
enum: stringFieldsOptions,
|
|
77
60
|
required: true,
|
|
78
61
|
'x-component': 'Select',
|
|
79
62
|
'x-decorator': 'FormItem'
|
|
80
63
|
},
|
|
81
64
|
start: {
|
|
82
65
|
title: t('Start date field'),
|
|
83
|
-
enum:
|
|
66
|
+
enum: dateFieldsOptions,
|
|
84
67
|
required: true,
|
|
85
|
-
default: 'createdAt',
|
|
86
|
-
'x-component': '
|
|
68
|
+
default: getCollectionField("".concat(item.name, ".createdAt")) ? 'createdAt' : null,
|
|
69
|
+
'x-component': 'Cascader',
|
|
87
70
|
'x-decorator': 'FormItem'
|
|
88
71
|
},
|
|
89
72
|
end: {
|
|
90
73
|
title: t('End date field'),
|
|
91
|
-
enum:
|
|
92
|
-
'x-component': '
|
|
74
|
+
enum: dateFieldsOptions,
|
|
75
|
+
'x-component': 'Cascader',
|
|
93
76
|
'x-decorator': 'FormItem'
|
|
94
77
|
}
|
|
95
78
|
}
|
|
@@ -99,14 +82,14 @@ export var CalendarBlockInitializer = function CalendarBlockInitializer(props) {
|
|
|
99
82
|
initialValues: {}
|
|
100
83
|
});
|
|
101
84
|
|
|
102
|
-
case
|
|
85
|
+
case 5:
|
|
103
86
|
values = _context.sent;
|
|
104
87
|
insert(createCalendarBlockSchema({
|
|
105
88
|
collection: item.name,
|
|
106
89
|
fieldNames: _objectSpread({}, values)
|
|
107
90
|
}));
|
|
108
91
|
|
|
109
|
-
case
|
|
92
|
+
case 7:
|
|
110
93
|
case "end":
|
|
111
94
|
return _context.stop();
|
|
112
95
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["formItemInitializers", "actionInitializers", "collection", "association", "resource", "template"],
|
|
2
2
|
_excluded2 = ["formItemInitializers", "actionInitializers", "collection", "resource", "association", "action", "template"],
|
|
3
3
|
_excluded3 = ["formItemInitializers", "actionInitializers", "collection", "association", "resource", "template"],
|
|
4
|
-
_excluded4 = ["collection", "resource", "rowKey"],
|
|
4
|
+
_excluded4 = ["collection", "resource", "rowKey", "tableActionInitializers", "tableColumnInitializers", "tableActionColumnInitializers", "tableBlockProvider", "disableTemplate"],
|
|
5
5
|
_excluded5 = ["collection", "resource", "rowKey"],
|
|
6
6
|
_excluded6 = ["collection", "resource", "fieldNames"],
|
|
7
7
|
_excluded7 = ["collection", "resource", "groupField"];
|
|
@@ -30,8 +30,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
30
30
|
|
|
31
31
|
import { Schema, useFieldSchema, useForm } from '@formily/react';
|
|
32
32
|
import { uid } from '@formily/shared';
|
|
33
|
-
import React, { useState } from 'react';
|
|
33
|
+
import React, { useContext, useState } from 'react';
|
|
34
34
|
import { useTranslation } from 'react-i18next';
|
|
35
|
+
import { BlockRequestContext } from '../';
|
|
35
36
|
import { useCollection, useCollectionManager } from '../collection-manager';
|
|
36
37
|
import { useActionContext, useDesignable } from '../schema-component';
|
|
37
38
|
import { useSchemaTemplateManager } from '../schema-templates';
|
|
@@ -607,10 +608,18 @@ export var useCurrentSchema = function useCurrentSchema(action, key) {
|
|
|
607
608
|
_remove = _useDesignable.remove;
|
|
608
609
|
|
|
609
610
|
var schema = find(fieldSchema, key, action);
|
|
611
|
+
var ctx = useContext(BlockRequestContext);
|
|
612
|
+
var exists = !!schema;
|
|
610
613
|
return {
|
|
611
614
|
schema: schema,
|
|
612
615
|
exists: !!schema,
|
|
613
616
|
remove: function remove() {
|
|
617
|
+
if (ctx.field) {
|
|
618
|
+
ctx.field.data = ctx.field.data || {};
|
|
619
|
+
ctx.field.data.activeFields = ctx.field.data.activeFields || new Set();
|
|
620
|
+
ctx.field.data.activeFields.delete(schema.name);
|
|
621
|
+
}
|
|
622
|
+
|
|
614
623
|
schema && rm(schema, _remove);
|
|
615
624
|
}
|
|
616
625
|
};
|
|
@@ -979,11 +988,16 @@ export var createTableBlockSchema = function createTableBlockSchema(options) {
|
|
|
979
988
|
var collection = options.collection,
|
|
980
989
|
resource = options.resource,
|
|
981
990
|
rowKey = options.rowKey,
|
|
991
|
+
tableActionInitializers = options.tableActionInitializers,
|
|
992
|
+
tableColumnInitializers = options.tableColumnInitializers,
|
|
993
|
+
tableActionColumnInitializers = options.tableActionColumnInitializers,
|
|
994
|
+
tableBlockProvider = options.tableBlockProvider,
|
|
995
|
+
disableTemplate = options.disableTemplate,
|
|
982
996
|
others = _objectWithoutProperties(options, _excluded4);
|
|
983
997
|
|
|
984
998
|
var schema = {
|
|
985
999
|
type: 'void',
|
|
986
|
-
'x-decorator': 'TableBlockProvider',
|
|
1000
|
+
'x-decorator': tableBlockProvider !== null && tableBlockProvider !== void 0 ? tableBlockProvider : 'TableBlockProvider',
|
|
987
1001
|
'x-acl-action': "".concat(resource || collection, ":list"),
|
|
988
1002
|
'x-decorator-props': _objectSpread({
|
|
989
1003
|
collection: collection,
|
|
@@ -994,14 +1008,15 @@ export var createTableBlockSchema = function createTableBlockSchema(options) {
|
|
|
994
1008
|
},
|
|
995
1009
|
rowKey: rowKey,
|
|
996
1010
|
showIndex: true,
|
|
997
|
-
dragSort: false
|
|
1011
|
+
dragSort: false,
|
|
1012
|
+
disableTemplate: disableTemplate !== null && disableTemplate !== void 0 ? disableTemplate : false
|
|
998
1013
|
}, others),
|
|
999
1014
|
'x-designer': 'TableBlockDesigner',
|
|
1000
1015
|
'x-component': 'CardItem',
|
|
1001
1016
|
properties: _defineProperty({
|
|
1002
1017
|
actions: {
|
|
1003
1018
|
type: 'void',
|
|
1004
|
-
'x-initializer': 'TableActionInitializers',
|
|
1019
|
+
'x-initializer': tableActionInitializers !== null && tableActionInitializers !== void 0 ? tableActionInitializers : 'TableActionInitializers',
|
|
1005
1020
|
'x-component': 'ActionBar',
|
|
1006
1021
|
'x-component-props': {
|
|
1007
1022
|
style: {
|
|
@@ -1012,7 +1027,7 @@ export var createTableBlockSchema = function createTableBlockSchema(options) {
|
|
|
1012
1027
|
}
|
|
1013
1028
|
}, uid(), {
|
|
1014
1029
|
type: 'array',
|
|
1015
|
-
'x-initializer': 'TableColumnInitializers',
|
|
1030
|
+
'x-initializer': tableColumnInitializers !== null && tableColumnInitializers !== void 0 ? tableColumnInitializers : 'TableColumnInitializers',
|
|
1016
1031
|
'x-component': 'TableV2',
|
|
1017
1032
|
'x-component-props': {
|
|
1018
1033
|
rowKey: 'id',
|
|
@@ -1029,7 +1044,7 @@ export var createTableBlockSchema = function createTableBlockSchema(options) {
|
|
|
1029
1044
|
'x-decorator': 'TableV2.Column.ActionBar',
|
|
1030
1045
|
'x-component': 'TableV2.Column',
|
|
1031
1046
|
'x-designer': 'TableV2.ActionColumnDesigner',
|
|
1032
|
-
'x-initializer': 'TableActionColumnInitializers',
|
|
1047
|
+
'x-initializer': tableActionColumnInitializers !== null && tableActionColumnInitializers !== void 0 ? tableActionColumnInitializers : 'TableActionColumnInitializers',
|
|
1033
1048
|
properties: {
|
|
1034
1049
|
actions: {
|
|
1035
1050
|
type: 'void',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DynamicComponent: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
var _templateObject;
|
|
2
|
+
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
|
|
7
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
|
|
9
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
10
|
+
|
|
11
|
+
import { css } from '@emotion/css';
|
|
12
|
+
import { createForm, onFieldValueChange } from '@formily/core';
|
|
13
|
+
import { connect, FieldContext, FormContext } from '@formily/react';
|
|
14
|
+
import { merge } from '@formily/shared';
|
|
15
|
+
import { Cascader } from 'antd';
|
|
16
|
+
import React, { useContext, useMemo } from 'react';
|
|
17
|
+
import { SchemaComponent } from '../../schema-component/core';
|
|
18
|
+
import { useCompile, useComponent } from '../../schema-component/hooks';
|
|
19
|
+
import { FilterContext } from './context';
|
|
20
|
+
import { useFilterOptions } from '../../schema-component/antd/filter/useFilterActionProps';
|
|
21
|
+
var VariableCascader = connect(function (props) {
|
|
22
|
+
var fields = useFilterOptions('users');
|
|
23
|
+
var compile = useCompile();
|
|
24
|
+
var value = props.value,
|
|
25
|
+
_onChange = props.onChange;
|
|
26
|
+
return /*#__PURE__*/React.createElement(Cascader, {
|
|
27
|
+
className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 160px;\n "]))),
|
|
28
|
+
value: value ? value.split('.') : [],
|
|
29
|
+
fieldNames: {
|
|
30
|
+
label: 'title',
|
|
31
|
+
value: 'name',
|
|
32
|
+
children: 'children'
|
|
33
|
+
},
|
|
34
|
+
onChange: function onChange(value) {
|
|
35
|
+
_onChange(value ? value.join('.') : null);
|
|
36
|
+
},
|
|
37
|
+
options: compile([{
|
|
38
|
+
title: '{{t("Current user")}}',
|
|
39
|
+
name: 'currentUser',
|
|
40
|
+
children: fields.filter(function (field) {
|
|
41
|
+
if (!field.target) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return field.type === 'belongsTo';
|
|
46
|
+
}).map(function (field) {
|
|
47
|
+
if (field.children) {
|
|
48
|
+
field.children = field.children.filter(function (child) {
|
|
49
|
+
return !child.target;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return field;
|
|
54
|
+
})
|
|
55
|
+
}])
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
export var DynamicComponent = function DynamicComponent(props) {
|
|
59
|
+
var _ref = useContext(FilterContext) || {},
|
|
60
|
+
dynamicComponent = _ref.dynamicComponent,
|
|
61
|
+
disabled = _ref.disabled;
|
|
62
|
+
|
|
63
|
+
var component = useComponent(dynamicComponent);
|
|
64
|
+
var form = useMemo(function () {
|
|
65
|
+
return createForm({
|
|
66
|
+
values: {
|
|
67
|
+
value: props.value
|
|
68
|
+
},
|
|
69
|
+
disabled: disabled,
|
|
70
|
+
effects: function effects() {
|
|
71
|
+
onFieldValueChange('value', function (field) {
|
|
72
|
+
var _props$onChange;
|
|
73
|
+
|
|
74
|
+
props === null || props === void 0 ? void 0 : (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, field.value);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}, [JSON.stringify(props.schema), JSON.stringify(props.value)]);
|
|
79
|
+
|
|
80
|
+
var renderSchemaComponent = function renderSchemaComponent() {
|
|
81
|
+
var _props$schema;
|
|
82
|
+
|
|
83
|
+
return /*#__PURE__*/React.createElement(FieldContext.Provider, {
|
|
84
|
+
value: null
|
|
85
|
+
}, /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
86
|
+
schema: _objectSpread(_objectSpread({
|
|
87
|
+
'x-component': 'Input'
|
|
88
|
+
}, props.schema), {}, {
|
|
89
|
+
'x-component-props': merge((props === null || props === void 0 ? void 0 : (_props$schema = props.schema) === null || _props$schema === void 0 ? void 0 : _props$schema['x-component-props']) || {}, {
|
|
90
|
+
style: {
|
|
91
|
+
minWidth: 150,
|
|
92
|
+
width: '100%'
|
|
93
|
+
}
|
|
94
|
+
}),
|
|
95
|
+
name: 'value',
|
|
96
|
+
'x-read-pretty': false,
|
|
97
|
+
'x-validator': undefined,
|
|
98
|
+
'x-decorator': undefined
|
|
99
|
+
}),
|
|
100
|
+
components: {
|
|
101
|
+
VariableCascader: VariableCascader
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return /*#__PURE__*/React.createElement(FormContext.Provider, {
|
|
107
|
+
value: form
|
|
108
|
+
}, component ? /*#__PURE__*/React.createElement(component, {
|
|
109
|
+
value: props.value,
|
|
110
|
+
onChange: props === null || props === void 0 ? void 0 : props.onChange,
|
|
111
|
+
renderSchemaComponent: renderSchemaComponent
|
|
112
|
+
}) : renderSchemaComponent());
|
|
113
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Variable } from '../../schema-component';
|
|
3
|
+
import { useVariableOptions } from './Variables';
|
|
4
|
+
export function FilterDynamicComponent(props) {
|
|
5
|
+
var value = props.value,
|
|
6
|
+
onChange = props.onChange,
|
|
7
|
+
renderSchemaComponent = props.renderSchemaComponent,
|
|
8
|
+
collectionName = props.collectionName;
|
|
9
|
+
var scope = useVariableOptions(collectionName);
|
|
10
|
+
return /*#__PURE__*/React.createElement(Variable.Input, {
|
|
11
|
+
value: value,
|
|
12
|
+
onChange: onChange,
|
|
13
|
+
scope: scope
|
|
14
|
+
}, renderSchemaComponent());
|
|
15
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const FormFieldLinkageRuleAction: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;
|
|
3
|
+
export declare const FormButtonLinkageRuleAction: React.MemoExoticComponent<React.FunctionComponent<Pick<any, string | number | symbol>>>;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
+
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
+
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
|
|
15
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
16
|
+
|
|
17
|
+
import { CloseCircleOutlined } from '@ant-design/icons';
|
|
18
|
+
import { css } from '@emotion/css';
|
|
19
|
+
import { observer } from '@formily/react';
|
|
20
|
+
import { TreeSelect } from '@formily/antd';
|
|
21
|
+
import { Select, Space } from 'antd';
|
|
22
|
+
import React, { useContext, useState } from 'react';
|
|
23
|
+
import { useTranslation } from 'react-i18next';
|
|
24
|
+
import { useCompile } from '../..';
|
|
25
|
+
import { RemoveActionContext } from './context';
|
|
26
|
+
import { DynamicComponent } from './DynamicComponent';
|
|
27
|
+
import { useValues } from './useValues';
|
|
28
|
+
import { ActionType } from './type';
|
|
29
|
+
import { ValueDynamicComponent } from './ValueDynamicComponent';
|
|
30
|
+
export var FormFieldLinkageRuleAction = observer(function (props) {
|
|
31
|
+
var value = props.value,
|
|
32
|
+
options = props.options,
|
|
33
|
+
collectionName = props.collectionName;
|
|
34
|
+
|
|
35
|
+
var _useTranslation = useTranslation(),
|
|
36
|
+
t = _useTranslation.t;
|
|
37
|
+
|
|
38
|
+
var compile = useCompile();
|
|
39
|
+
var remove = useContext(RemoveActionContext);
|
|
40
|
+
|
|
41
|
+
var _useValues = useValues(options),
|
|
42
|
+
schema = _useValues.schema,
|
|
43
|
+
fields = _useValues.fields,
|
|
44
|
+
operator = _useValues.operator,
|
|
45
|
+
setDataIndex = _useValues.setDataIndex,
|
|
46
|
+
setOperator = _useValues.setOperator,
|
|
47
|
+
setValue = _useValues.setValue,
|
|
48
|
+
fieldValue = _useValues.value,
|
|
49
|
+
operators = _useValues.operators;
|
|
50
|
+
|
|
51
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
style: {
|
|
53
|
+
marginBottom: 8
|
|
54
|
+
}
|
|
55
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
56
|
+
className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-space-item {\n max-width: 95%;\n }\n "])))
|
|
57
|
+
}, /*#__PURE__*/React.createElement(TreeSelect, {
|
|
58
|
+
className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 160px;\n "]))),
|
|
59
|
+
fieldNames: {
|
|
60
|
+
label: 'title',
|
|
61
|
+
value: 'name',
|
|
62
|
+
children: 'children'
|
|
63
|
+
},
|
|
64
|
+
treeCheckable: true,
|
|
65
|
+
value: value === null || value === void 0 ? void 0 : value.targetFields,
|
|
66
|
+
multiple: true,
|
|
67
|
+
allowClear: true,
|
|
68
|
+
treeData: compile(fields),
|
|
69
|
+
onChange: function onChange(value) {
|
|
70
|
+
console.log(value);
|
|
71
|
+
setDataIndex(value);
|
|
72
|
+
},
|
|
73
|
+
placeholder: t('Select Field')
|
|
74
|
+
}), /*#__PURE__*/React.createElement(Select, {
|
|
75
|
+
value: operator,
|
|
76
|
+
className: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n min-width: 120px;\n "]))),
|
|
77
|
+
options: compile(operators),
|
|
78
|
+
onChange: function onChange(value) {
|
|
79
|
+
setOperator(value);
|
|
80
|
+
},
|
|
81
|
+
placeholder: t('action')
|
|
82
|
+
}), [ActionType.Value].includes(operator) && /*#__PURE__*/React.createElement(ValueDynamicComponent, {
|
|
83
|
+
fieldValue: fieldValue,
|
|
84
|
+
schema: schema,
|
|
85
|
+
setValue: setValue,
|
|
86
|
+
collectionName: collectionName
|
|
87
|
+
}), !props.disabled && /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(CloseCircleOutlined, {
|
|
88
|
+
onClick: function onClick() {
|
|
89
|
+
return remove();
|
|
90
|
+
},
|
|
91
|
+
style: {
|
|
92
|
+
color: '#bfbfbf'
|
|
93
|
+
}
|
|
94
|
+
}))));
|
|
95
|
+
});
|
|
96
|
+
export var FormButtonLinkageRuleAction = observer(function (props) {
|
|
97
|
+
var value = props.value,
|
|
98
|
+
options = props.options;
|
|
99
|
+
|
|
100
|
+
var _useTranslation2 = useTranslation(),
|
|
101
|
+
t = _useTranslation2.t;
|
|
102
|
+
|
|
103
|
+
var compile = useCompile();
|
|
104
|
+
|
|
105
|
+
var _useState = useState(false),
|
|
106
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
107
|
+
editFalg = _useState2[0],
|
|
108
|
+
setEditFlag = _useState2[1];
|
|
109
|
+
|
|
110
|
+
var remove = useContext(RemoveActionContext);
|
|
111
|
+
|
|
112
|
+
var _useValues2 = useValues(options),
|
|
113
|
+
schema = _useValues2.schema,
|
|
114
|
+
operator = _useValues2.operator,
|
|
115
|
+
setOperator = _useValues2.setOperator,
|
|
116
|
+
setValue = _useValues2.setValue;
|
|
117
|
+
|
|
118
|
+
var operators = [{
|
|
119
|
+
label: t('Visible'),
|
|
120
|
+
value: ActionType.Visible,
|
|
121
|
+
schema: {}
|
|
122
|
+
}, {
|
|
123
|
+
label: t('Hidden'),
|
|
124
|
+
value: ActionType.Hidden,
|
|
125
|
+
schema: {}
|
|
126
|
+
}, {
|
|
127
|
+
label: t('Disabled'),
|
|
128
|
+
value: ActionType.Disabled,
|
|
129
|
+
schema: {}
|
|
130
|
+
}, {
|
|
131
|
+
label: t('Enabled'),
|
|
132
|
+
value: ActionType.Active,
|
|
133
|
+
schema: {}
|
|
134
|
+
}];
|
|
135
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
136
|
+
style: {
|
|
137
|
+
marginBottom: 8
|
|
138
|
+
}
|
|
139
|
+
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Select, {
|
|
140
|
+
value: operator,
|
|
141
|
+
options: compile(operators),
|
|
142
|
+
onChange: function onChange(value) {
|
|
143
|
+
var flag = [ActionType.Value].includes(value);
|
|
144
|
+
setEditFlag(flag);
|
|
145
|
+
setOperator(value);
|
|
146
|
+
},
|
|
147
|
+
placeholder: t('action')
|
|
148
|
+
}), editFalg && /*#__PURE__*/React.createElement(DynamicComponent, {
|
|
149
|
+
value: value,
|
|
150
|
+
schema: schema,
|
|
151
|
+
onChange: function onChange(value) {
|
|
152
|
+
setValue(value);
|
|
153
|
+
}
|
|
154
|
+
}), !props.disabled && /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(CloseCircleOutlined, {
|
|
155
|
+
onClick: function onClick() {
|
|
156
|
+
return remove();
|
|
157
|
+
},
|
|
158
|
+
style: {
|
|
159
|
+
color: '#bfbfbf'
|
|
160
|
+
}
|
|
161
|
+
}))));
|
|
162
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
import { ArrayField, ObjectField, observer, useField } from '@formily/react';
|
|
8
|
+
import { Space } from 'antd';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { useTranslation } from 'react-i18next';
|
|
11
|
+
import { RemoveActionContext } from './context';
|
|
12
|
+
import { FormButtonLinkageRuleAction, FormFieldLinkageRuleAction } from './LinkageRuleAction';
|
|
13
|
+
export var LinkageRuleActions = observer(function (props) {
|
|
14
|
+
var _field$value;
|
|
15
|
+
|
|
16
|
+
var type = props.type,
|
|
17
|
+
linkageOptions = props.linkageOptions;
|
|
18
|
+
var field = useField();
|
|
19
|
+
return field === null || field === void 0 ? void 0 : (_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value.map(function (item, index) {
|
|
20
|
+
return /*#__PURE__*/React.createElement(RemoveActionContext.Provider, {
|
|
21
|
+
key: index,
|
|
22
|
+
value: function value() {
|
|
23
|
+
return field.remove(index);
|
|
24
|
+
}
|
|
25
|
+
}, /*#__PURE__*/React.createElement(ObjectField, {
|
|
26
|
+
name: index,
|
|
27
|
+
component: [type === 'button' ? FormButtonLinkageRuleAction : FormFieldLinkageRuleAction, _objectSpread(_objectSpread({}, props), {}, {
|
|
28
|
+
options: linkageOptions
|
|
29
|
+
})]
|
|
30
|
+
}));
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
export var LinkageRuleActionGroup = function LinkageRuleActionGroup(props) {
|
|
34
|
+
var _useTranslation = useTranslation(),
|
|
35
|
+
t = _useTranslation.t;
|
|
36
|
+
|
|
37
|
+
var field = useField();
|
|
38
|
+
var logic = 'actions';
|
|
39
|
+
|
|
40
|
+
var _props$useProps = props === null || props === void 0 ? void 0 : props.useProps(),
|
|
41
|
+
type = _props$useProps.type,
|
|
42
|
+
linkageOptions = _props$useProps.linkageOptions,
|
|
43
|
+
collectionName = _props$useProps.collectionName;
|
|
44
|
+
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
style: {
|
|
47
|
+
marginLeft: 10
|
|
48
|
+
}
|
|
49
|
+
}, /*#__PURE__*/React.createElement(ArrayField, {
|
|
50
|
+
name: logic,
|
|
51
|
+
component: [LinkageRuleActions, {
|
|
52
|
+
type: type,
|
|
53
|
+
linkageOptions: linkageOptions,
|
|
54
|
+
collectionName: collectionName
|
|
55
|
+
}],
|
|
56
|
+
disabled: false
|
|
57
|
+
}), /*#__PURE__*/React.createElement(Space, {
|
|
58
|
+
size: 16,
|
|
59
|
+
style: {
|
|
60
|
+
marginTop: 8,
|
|
61
|
+
marginBottom: 8
|
|
62
|
+
}
|
|
63
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
64
|
+
onClick: function onClick() {
|
|
65
|
+
var f = field.query('.actions').take();
|
|
66
|
+
var items = f.value || [];
|
|
67
|
+
items.push({});
|
|
68
|
+
f.value = items;
|
|
69
|
+
}
|
|
70
|
+
}, t('Add property'))));
|
|
71
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ValueDynamicComponent: (props: any) => JSX.Element;
|