@nocobase/client 0.9.0-alpha.2 → 0.9.1-alpha.2
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 +7 -8
- package/es/api-client/APIClient.js +6 -0
- package/es/block-provider/BlockProvider.js +9 -6
- package/es/block-provider/FormBlockProvider.js +18 -9
- 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.d.ts +4 -0
- package/es/collection-manager/action-hooks.js +26 -12
- 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 +52 -7
- 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 +28 -15
- package/es/schema-component/antd/action/Action.js +28 -5
- 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 +94 -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/g2plot/G2Plot.js +3 -1
- 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/ReadPretty.js +1 -1
- 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.d.ts +2 -0
- package/es/schema-component/antd/remote-select/RemoteSelect.js +78 -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/tabs/Tabs.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 +9 -4
- package/es/schema-initializer/buttons/BlockInitializers.d.ts +2 -184
- package/es/schema-initializer/buttons/BlockInitializers.js +1 -102
- package/es/schema-initializer/buttons/RecordBlockInitializers.js +72 -16
- package/es/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
- package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -3
- package/es/schema-initializer/components/CreateRecordAction.d.ts +3 -0
- package/es/schema-initializer/components/CreateRecordAction.js +174 -0
- package/es/schema-initializer/components/index.d.ts +1 -0
- package/es/schema-initializer/components/index.js +2 -1
- 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/items/CreateActionInitializer.js +3 -3
- package/es/schema-initializer/items/RecordFormBlockInitializer.js +9 -9
- package/es/schema-initializer/items/index.d.ts +4 -4
- package/es/schema-initializer/items/index.js +6 -6
- package/es/schema-initializer/utils.js +22 -7
- package/es/schema-settings/EnableChildCollections/index.d.ts +2 -0
- package/es/schema-settings/EnableChildCollections/index.js +141 -0
- 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 +219 -26
- package/es/schema-templates/BlockTemplate.js +9 -1
- package/es/system-settings/SystemSettingsShortcut.js +1 -1
- package/lib/acl/ACLProvider.js +7 -8
- package/lib/api-client/APIClient.js +6 -0
- package/lib/block-provider/BlockProvider.js +9 -6
- package/lib/block-provider/FormBlockProvider.js +17 -8
- 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.d.ts +4 -0
- package/lib/collection-manager/action-hooks.js +30 -13
- 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 +30 -14
- package/lib/schema-component/antd/action/Action.js +29 -3
- 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 +93 -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/g2plot/G2Plot.js +3 -1
- 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/ReadPretty.js +1 -1
- 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.d.ts +2 -0
- package/lib/schema-component/antd/remote-select/RemoteSelect.js +78 -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/tabs/Tabs.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 +9 -4
- package/lib/schema-initializer/buttons/BlockInitializers.d.ts +2 -184
- package/lib/schema-initializer/buttons/BlockInitializers.js +0 -108
- package/lib/schema-initializer/buttons/RecordBlockInitializers.js +72 -16
- package/lib/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
- package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +3 -1
- package/lib/schema-initializer/components/CreateRecordAction.d.ts +3 -0
- package/lib/schema-initializer/components/CreateRecordAction.js +199 -0
- package/lib/schema-initializer/components/index.d.ts +1 -0
- package/lib/schema-initializer/components/index.js +13 -0
- 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/items/CreateActionInitializer.js +3 -3
- package/lib/schema-initializer/items/RecordFormBlockInitializer.js +3 -3
- package/lib/schema-initializer/items/index.d.ts +4 -4
- package/lib/schema-initializer/items/index.js +52 -52
- package/lib/schema-initializer/utils.js +22 -6
- package/lib/schema-settings/EnableChildCollections/index.d.ts +2 -0
- package/lib/schema-settings/EnableChildCollections/index.js +156 -0
- 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 +243 -48
- package/lib/schema-templates/BlockTemplate.js +9 -1
- package/lib/system-settings/SystemSettingsShortcut.js +1 -1
- package/package.json +4 -4
|
@@ -31,38 +31,18 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
31
31
|
|
|
32
32
|
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; }
|
|
33
33
|
|
|
34
|
-
var useOptions = function useOptions() {
|
|
35
|
-
var _fields$filter;
|
|
36
|
-
|
|
37
|
-
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'string';
|
|
38
|
-
var compile = (0, _.useCompile)();
|
|
39
|
-
|
|
40
|
-
var _useCollection = (0, _collectionManager.useCollection)(),
|
|
41
|
-
fields = _useCollection.fields;
|
|
42
|
-
|
|
43
|
-
var options = fields === null || fields === void 0 ? void 0 : (_fields$filter = fields.filter(function (field) {
|
|
44
|
-
return field.type === type;
|
|
45
|
-
})) === null || _fields$filter === void 0 ? void 0 : _fields$filter.map(function (field) {
|
|
46
|
-
var _field$uiSchema;
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
value: field.name,
|
|
50
|
-
label: compile(field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title)
|
|
51
|
-
};
|
|
52
|
-
});
|
|
53
|
-
return options;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
34
|
var CalendarDesigner = function CalendarDesigner() {
|
|
57
35
|
var _fieldSchema$xDecora, _fieldSchema$xDecora$, _fieldSchema$xDecora2, _fieldSchema$xDecora3;
|
|
58
36
|
|
|
59
37
|
var field = (0, _react.useField)();
|
|
60
38
|
var fieldSchema = (0, _react.useFieldSchema)();
|
|
61
39
|
|
|
62
|
-
var
|
|
63
|
-
name =
|
|
64
|
-
title =
|
|
65
|
-
|
|
40
|
+
var _useCollection = (0, _collectionManager.useCollection)(),
|
|
41
|
+
name = _useCollection.name,
|
|
42
|
+
title = _useCollection.title;
|
|
43
|
+
|
|
44
|
+
var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
|
|
45
|
+
getCollectionFieldsOptions = _useCollectionManager.getCollectionFieldsOptions;
|
|
66
46
|
|
|
67
47
|
var dataSource = (0, _actionHooks.useCollectionFilterOptions)(name);
|
|
68
48
|
|
|
@@ -72,8 +52,6 @@ var CalendarDesigner = function CalendarDesigner() {
|
|
|
72
52
|
var _useDesignable = (0, _.useDesignable)(),
|
|
73
53
|
dn = _useDesignable.dn;
|
|
74
54
|
|
|
75
|
-
var compile = (0, _.useCompile)();
|
|
76
|
-
|
|
77
55
|
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
78
56
|
t = _useTranslation.t;
|
|
79
57
|
|
|
@@ -87,7 +65,7 @@ var CalendarDesigner = function CalendarDesigner() {
|
|
|
87
65
|
}, /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.BlockTitleItem, null), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
|
|
88
66
|
title: t('Title field'),
|
|
89
67
|
value: fieldNames.title,
|
|
90
|
-
options:
|
|
68
|
+
options: getCollectionFieldsOptions(name, 'string'),
|
|
91
69
|
onChange: function onChange(title) {
|
|
92
70
|
var _schema;
|
|
93
71
|
|
|
@@ -116,10 +94,12 @@ var CalendarDesigner = function CalendarDesigner() {
|
|
|
116
94
|
});
|
|
117
95
|
dn.refresh();
|
|
118
96
|
}
|
|
119
|
-
}), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.
|
|
97
|
+
}), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.CascaderItem, {
|
|
120
98
|
title: t('Start date field'),
|
|
121
99
|
value: fieldNames.start,
|
|
122
|
-
options:
|
|
100
|
+
options: getCollectionFieldsOptions(name, 'date', {
|
|
101
|
+
association: ['o2o', 'obo', 'oho', 'm2o']
|
|
102
|
+
}),
|
|
123
103
|
onChange: function onChange(start) {
|
|
124
104
|
var _schema3;
|
|
125
105
|
|
|
@@ -133,10 +113,12 @@ var CalendarDesigner = function CalendarDesigner() {
|
|
|
133
113
|
});
|
|
134
114
|
dn.refresh();
|
|
135
115
|
}
|
|
136
|
-
}), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.
|
|
116
|
+
}), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.CascaderItem, {
|
|
137
117
|
title: t('End date field'),
|
|
138
118
|
value: fieldNames.end,
|
|
139
|
-
options:
|
|
119
|
+
options: getCollectionFieldsOptions(name, 'date', {
|
|
120
|
+
association: ['o2o', 'obo', 'oho', 'm2o']
|
|
121
|
+
}),
|
|
140
122
|
onChange: function onChange(end) {
|
|
141
123
|
var _schema4;
|
|
142
124
|
|
|
@@ -36,17 +36,18 @@ var Checkbox = (0, _react.connect)(function (props) {
|
|
|
36
36
|
}, (0, _react.mapProps)({
|
|
37
37
|
value: 'checked',
|
|
38
38
|
onInput: 'onChange'
|
|
39
|
-
}, function (props, field) {
|
|
40
|
-
// console.log({ props, field });
|
|
41
|
-
return _objectSpread({}, props);
|
|
42
39
|
}), (0, _react.mapReadPretty)(function (props) {
|
|
43
|
-
if (
|
|
44
|
-
return
|
|
40
|
+
if (props.value) {
|
|
41
|
+
return /*#__PURE__*/_react2.default.createElement(_icons.CheckOutlined, {
|
|
42
|
+
style: {
|
|
43
|
+
color: '#52c41a'
|
|
44
|
+
}
|
|
45
|
+
});
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
return props.
|
|
48
|
+
return props.showUnchecked ? /*#__PURE__*/_react2.default.createElement(_icons.CloseOutlined, {
|
|
48
49
|
style: {
|
|
49
|
-
color: '#
|
|
50
|
+
color: '#ff4d4f'
|
|
50
51
|
}
|
|
51
52
|
}) : null;
|
|
52
53
|
}));
|
|
@@ -5,4 +5,4 @@ export interface Moment2strOptions {
|
|
|
5
5
|
picker?: 'year' | 'month' | 'week' | 'quarter';
|
|
6
6
|
}
|
|
7
7
|
export declare const moment2str: (value?: moment.Moment | moment.Moment[], options?: Moment2strOptions) => string | string[] | moment.Moment | moment.Moment[];
|
|
8
|
-
export declare const mapDateFormat: () => (props: any) => any;
|
|
8
|
+
export declare const mapDateFormat: () => (props: any, field: any) => any;
|
|
@@ -73,7 +73,7 @@ var moment2str = function moment2str(value) {
|
|
|
73
73
|
exports.moment2str = moment2str;
|
|
74
74
|
|
|
75
75
|
var mapDateFormat = function mapDateFormat() {
|
|
76
|
-
return function (props) {
|
|
76
|
+
return function (props, field) {
|
|
77
77
|
var format = (0, _client.getDefaultFormat)(props);
|
|
78
78
|
var _onChange = props.onChange;
|
|
79
79
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -81,7 +81,8 @@ var VariableCascader = (0, _react.connect)(function (props) {
|
|
|
81
81
|
|
|
82
82
|
var DynamicComponent = function DynamicComponent(props) {
|
|
83
83
|
var _useContext = (0, _react2.useContext)(_context.FilterContext),
|
|
84
|
-
dynamicComponent = _useContext.dynamicComponent
|
|
84
|
+
dynamicComponent = _useContext.dynamicComponent,
|
|
85
|
+
disabled = _useContext.disabled;
|
|
85
86
|
|
|
86
87
|
var component = (0, _hooks.useComponent)(dynamicComponent);
|
|
87
88
|
var form = (0, _react2.useMemo)(function () {
|
|
@@ -89,6 +90,7 @@ var DynamicComponent = function DynamicComponent(props) {
|
|
|
89
90
|
values: {
|
|
90
91
|
value: props.value
|
|
91
92
|
},
|
|
93
|
+
disabled: disabled,
|
|
92
94
|
effects: function effects() {
|
|
93
95
|
(0, _core.onFieldValueChange)('value', function (field) {
|
|
94
96
|
var _props$onChange;
|
|
@@ -63,7 +63,8 @@ var Filter = (0, _react.observer)(function (props) {
|
|
|
63
63
|
field: field,
|
|
64
64
|
fieldSchema: fieldSchema,
|
|
65
65
|
dynamicComponent: dynamicComponent,
|
|
66
|
-
options: options || field.dataSource || []
|
|
66
|
+
options: options || field.dataSource || [],
|
|
67
|
+
disabled: props.disabled
|
|
67
68
|
}
|
|
68
69
|
}, /*#__PURE__*/_react2.default.createElement(_FilterGroup.FilterGroup, _objectSpread(_objectSpread({}, props), {}, {
|
|
69
70
|
bordered: false
|
|
@@ -41,7 +41,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
41
41
|
|
|
42
42
|
var FilterGroup = (0, _react.connect)(function (props) {
|
|
43
43
|
var _props$bordered = props.bordered,
|
|
44
|
-
bordered = _props$bordered === void 0 ? true : _props$bordered
|
|
44
|
+
bordered = _props$bordered === void 0 ? true : _props$bordered,
|
|
45
|
+
disabled = props.disabled;
|
|
45
46
|
var field = (0, _react.useField)();
|
|
46
47
|
var remove = (0, _react2.useContext)(_context.RemoveConditionContext);
|
|
47
48
|
|
|
@@ -56,6 +57,7 @@ var FilterGroup = (0, _react.connect)(function (props) {
|
|
|
56
57
|
field.value = _defineProperty({}, value, _toConsumableArray(obj[logic] || []));
|
|
57
58
|
};
|
|
58
59
|
|
|
60
|
+
var mergedDisabled = disabled || field.disabled;
|
|
59
61
|
return /*#__PURE__*/_react2.default.createElement(_context.FilterLogicContext.Provider, {
|
|
60
62
|
value: logic
|
|
61
63
|
}, /*#__PURE__*/_react2.default.createElement("div", {
|
|
@@ -68,7 +70,7 @@ var FilterGroup = (0, _react.connect)(function (props) {
|
|
|
68
70
|
position: 'relative',
|
|
69
71
|
marginBottom: 8
|
|
70
72
|
}
|
|
71
|
-
}, remove && /*#__PURE__*/_react2.default.createElement("a", null, /*#__PURE__*/_react2.default.createElement(_icons.CloseCircleOutlined, {
|
|
73
|
+
}, remove && !mergedDisabled && /*#__PURE__*/_react2.default.createElement("a", null, /*#__PURE__*/_react2.default.createElement(_icons.CloseCircleOutlined, {
|
|
72
74
|
style: {
|
|
73
75
|
position: 'absolute',
|
|
74
76
|
right: 10,
|
|
@@ -96,8 +98,9 @@ var FilterGroup = (0, _react.connect)(function (props) {
|
|
|
96
98
|
value: '$or'
|
|
97
99
|
}, "Any")), ' conditions in the group')), /*#__PURE__*/_react2.default.createElement("div", null, /*#__PURE__*/_react2.default.createElement(_react.ArrayField, {
|
|
98
100
|
name: logic,
|
|
99
|
-
component: [_FilterItems.FilterItems]
|
|
100
|
-
|
|
101
|
+
component: [_FilterItems.FilterItems],
|
|
102
|
+
disabled: mergedDisabled
|
|
103
|
+
})), !mergedDisabled && /*#__PURE__*/_react2.default.createElement(_antd.Space, {
|
|
101
104
|
size: 16,
|
|
102
105
|
style: {
|
|
103
106
|
marginTop: 8,
|
|
@@ -27,7 +27,7 @@ var _DynamicComponent = require("./DynamicComponent");
|
|
|
27
27
|
|
|
28
28
|
var _useValues2 = require("./useValues");
|
|
29
29
|
|
|
30
|
-
var _templateObject;
|
|
30
|
+
var _templateObject, _templateObject2;
|
|
31
31
|
|
|
32
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
33
|
|
|
@@ -72,6 +72,7 @@ var FilterItem = (0, _react.observer)(function (props) {
|
|
|
72
72
|
},
|
|
73
73
|
placeholder: t('Select Field')
|
|
74
74
|
}), /*#__PURE__*/_react2.default.createElement(_antd.Select, {
|
|
75
|
+
className: (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 110px;\n "]))),
|
|
75
76
|
value: operator === null || operator === void 0 ? void 0 : operator.value,
|
|
76
77
|
options: compile(operators),
|
|
77
78
|
onChange: function onChange(value) {
|
|
@@ -84,7 +85,7 @@ var FilterItem = (0, _react.observer)(function (props) {
|
|
|
84
85
|
onChange: function onChange(value) {
|
|
85
86
|
setValue(value);
|
|
86
87
|
}
|
|
87
|
-
}), /*#__PURE__*/_react2.default.createElement("a", null, /*#__PURE__*/_react2.default.createElement(_icons.CloseCircleOutlined, {
|
|
88
|
+
}), !props.disabled && /*#__PURE__*/_react2.default.createElement("a", null, /*#__PURE__*/_react2.default.createElement(_icons.CloseCircleOutlined, {
|
|
88
89
|
onClick: function onClick() {
|
|
89
90
|
return remove();
|
|
90
91
|
},
|
|
@@ -6,6 +6,7 @@ export interface FilterContextProps {
|
|
|
6
6
|
fieldSchema?: Schema;
|
|
7
7
|
dynamicComponent?: any;
|
|
8
8
|
options?: any[];
|
|
9
|
+
disabled?: boolean;
|
|
9
10
|
}
|
|
10
11
|
export declare const RemoveConditionContext: import("react").Context<any>;
|
|
11
12
|
export declare const FilterContext: import("react").Context<FilterContextProps>;
|
|
@@ -11,6 +11,8 @@ var _shared = require("@formily/shared");
|
|
|
11
11
|
|
|
12
12
|
var _flat = _interopRequireDefault(require("flat"));
|
|
13
13
|
|
|
14
|
+
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
15
|
+
|
|
14
16
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
15
17
|
|
|
16
18
|
var _react2 = require("react");
|
|
@@ -75,6 +77,7 @@ var useValues = function useValues() {
|
|
|
75
77
|
var value2data = function value2data() {
|
|
76
78
|
var _operators$find;
|
|
77
79
|
|
|
80
|
+
field.data = field.data || {};
|
|
78
81
|
var values = (0, _flat.default)(field.value);
|
|
79
82
|
var path = Object.keys(values).shift() || '';
|
|
80
83
|
|
|
@@ -84,8 +87,10 @@ var useValues = function useValues() {
|
|
|
84
87
|
|
|
85
88
|
var _path$split = path.split('.$'),
|
|
86
89
|
_path$split2 = _slicedToArray(_path$split, 2),
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
_path$split2$ = _path$split2[0],
|
|
91
|
+
fieldPath = _path$split2$ === void 0 ? '' : _path$split2$,
|
|
92
|
+
_path$split2$2 = _path$split2[1],
|
|
93
|
+
otherPath = _path$split2$2 === void 0 ? '' : _path$split2$2;
|
|
89
94
|
|
|
90
95
|
var _otherPath$split = otherPath.split('.', 2),
|
|
91
96
|
_otherPath$split2 = _slicedToArray(_otherPath$split, 1),
|
|
@@ -97,7 +102,6 @@ var useValues = function useValues() {
|
|
|
97
102
|
var operator = operators === null || operators === void 0 ? void 0 : (_operators$find = operators.find) === null || _operators$find === void 0 ? void 0 : _operators$find.call(operators, function (item) {
|
|
98
103
|
return item.value === "$".concat(operatorValue);
|
|
99
104
|
});
|
|
100
|
-
field.data = field.data || {};
|
|
101
105
|
field.data.dataIndex = dataIndex;
|
|
102
106
|
field.data.operators = operators;
|
|
103
107
|
field.data.operator = operator;
|
|
@@ -105,9 +109,7 @@ var useValues = function useValues() {
|
|
|
105
109
|
field.data.value = (0, _get.default)(field.value, "".concat(fieldPath, ".$").concat(operatorValue));
|
|
106
110
|
};
|
|
107
111
|
|
|
108
|
-
(0, _react2.useEffect)(
|
|
109
|
-
value2data();
|
|
110
|
-
}, [logic]);
|
|
112
|
+
(0, _react2.useEffect)(value2data, [logic]);
|
|
111
113
|
return _objectSpread(_objectSpread({
|
|
112
114
|
fields: options
|
|
113
115
|
}, field.data), {}, {
|
|
@@ -119,11 +121,12 @@ var useValues = function useValues() {
|
|
|
119
121
|
field.data = field.data || {};
|
|
120
122
|
field.data.operators = option === null || option === void 0 ? void 0 : option.operators;
|
|
121
123
|
field.data.operator = operator;
|
|
122
|
-
|
|
124
|
+
var s1 = (0, _cloneDeep.default)(option === null || option === void 0 ? void 0 : option.schema);
|
|
125
|
+
var s2 = (0, _cloneDeep.default)(operator === null || operator === void 0 ? void 0 : operator.schema);
|
|
126
|
+
field.data.schema = (0, _shared.merge)(s1, s2);
|
|
123
127
|
field.data.dataIndex = dataIndex;
|
|
124
128
|
field.data.value = null;
|
|
125
129
|
data2value();
|
|
126
|
-
console.log('setDataIndex', field.data);
|
|
127
130
|
},
|
|
128
131
|
setOperator: function setOperator(operatorValue) {
|
|
129
132
|
var _field$data3, _field$data3$operator, _field$data3$operator2;
|
|
@@ -132,15 +135,16 @@ var useValues = function useValues() {
|
|
|
132
135
|
return item.value === operatorValue;
|
|
133
136
|
});
|
|
134
137
|
field.data.operator = operator;
|
|
135
|
-
|
|
138
|
+
var option = findOption(field.data.dataIndex, options);
|
|
139
|
+
var s1 = (0, _cloneDeep.default)(option === null || option === void 0 ? void 0 : option.schema);
|
|
140
|
+
var s2 = (0, _cloneDeep.default)(operator === null || operator === void 0 ? void 0 : operator.schema);
|
|
141
|
+
field.data.schema = (0, _shared.merge)(s1, s2);
|
|
136
142
|
field.data.value = operator.noValue ? operator.default || true : null;
|
|
137
143
|
data2value();
|
|
138
|
-
console.log('setOperator', field.data);
|
|
139
144
|
},
|
|
140
145
|
setValue: function setValue(value) {
|
|
141
146
|
field.data.value = value;
|
|
142
147
|
data2value();
|
|
143
|
-
console.log('setValue', field.data);
|
|
144
148
|
}
|
|
145
149
|
});
|
|
146
150
|
};
|
|
@@ -28,7 +28,7 @@ var _schemaSettings = require("../../../schema-settings");
|
|
|
28
28
|
var _schemaTemplates = require("../../../schema-templates");
|
|
29
29
|
|
|
30
30
|
var _excluded = ["form", "children"],
|
|
31
|
-
_excluded2 = ["form", "children"],
|
|
31
|
+
_excluded2 = ["form", "children", "disabled"],
|
|
32
32
|
_excluded3 = ["request", "effects", "initialValue", "useValues"];
|
|
33
33
|
|
|
34
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -80,6 +80,7 @@ var Def = function Def(props) {
|
|
|
80
80
|
var FormDecorator = function FormDecorator(props) {
|
|
81
81
|
var form = props.form,
|
|
82
82
|
children = props.children,
|
|
83
|
+
disabled = props.disabled,
|
|
83
84
|
others = _objectWithoutProperties(props, _excluded2);
|
|
84
85
|
|
|
85
86
|
var field = (0, _react.useField)();
|
|
@@ -89,7 +90,12 @@ var FormDecorator = function FormDecorator(props) {
|
|
|
89
90
|
basePath: ''
|
|
90
91
|
})));
|
|
91
92
|
var Component = (0, _.useComponent)(fieldSchema['x-component'], Def);
|
|
92
|
-
|
|
93
|
+
(0, _react2.useEffect)(function () {
|
|
94
|
+
form.disabled = disabled || field.disabled;
|
|
95
|
+
}, [disabled, field.disabled]);
|
|
96
|
+
return /*#__PURE__*/_react2.default.createElement(_antd2.ConfigProvider, {
|
|
97
|
+
componentDisabled: disabled
|
|
98
|
+
}, /*#__PURE__*/_react2.default.createElement(_react.FieldContext.Provider, {
|
|
93
99
|
value: undefined
|
|
94
100
|
}, /*#__PURE__*/_react2.default.createElement(_react.FormContext.Provider, {
|
|
95
101
|
value: form
|
|
@@ -101,7 +107,7 @@ var FormDecorator = function FormDecorator(props) {
|
|
|
101
107
|
basePath: f.address,
|
|
102
108
|
schema: fieldSchema,
|
|
103
109
|
onlyRenderProperties: true
|
|
104
|
-
}))))));
|
|
110
|
+
})))))));
|
|
105
111
|
};
|
|
106
112
|
|
|
107
113
|
var useRequestProps = function useRequestProps(props) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -15,7 +17,7 @@ var _shared = require("@formily/shared");
|
|
|
15
17
|
|
|
16
18
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
17
19
|
|
|
18
|
-
var _react2 =
|
|
20
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
19
21
|
|
|
20
22
|
var _reactI18next = require("react-i18next");
|
|
21
23
|
|
|
@@ -35,6 +37,10 @@ var _shared2 = require("../input/shared");
|
|
|
35
37
|
|
|
36
38
|
var _templateObject;
|
|
37
39
|
|
|
40
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
41
|
+
|
|
42
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
43
|
+
|
|
38
44
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
45
|
|
|
40
46
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
@@ -59,8 +65,17 @@ var divWrap = function divWrap(schema) {
|
|
|
59
65
|
};
|
|
60
66
|
};
|
|
61
67
|
|
|
62
|
-
var FormItem = function
|
|
68
|
+
var FormItem = (0, _react.observer)(function (props) {
|
|
63
69
|
var field = (0, _react.useField)();
|
|
70
|
+
var ctx = (0, _react2.useContext)(_blockProvider.BlockRequestContext);
|
|
71
|
+
var schema = (0, _react.useFieldSchema)();
|
|
72
|
+
(0, _react2.useEffect)(function () {
|
|
73
|
+
if ((ctx === null || ctx === void 0 ? void 0 : ctx.block) === 'form') {
|
|
74
|
+
ctx.field.data = ctx.field.data || {};
|
|
75
|
+
ctx.field.data.activeFields = ctx.field.data.activeFields || new Set();
|
|
76
|
+
ctx.field.data.activeFields.add(schema.name);
|
|
77
|
+
}
|
|
78
|
+
}, []);
|
|
64
79
|
return /*#__PURE__*/_react2.default.createElement(_ACLProvider.ACLCollectionFieldProvider, null, /*#__PURE__*/_react2.default.createElement(_blockItem.BlockItem, {
|
|
65
80
|
className: 'nb-form-item'
|
|
66
81
|
}, /*#__PURE__*/_react2.default.createElement(_antd.FormItem, _objectSpread(_objectSpread({
|
|
@@ -72,12 +87,11 @@ var FormItem = function FormItem(props) {
|
|
|
72
87
|
}
|
|
73
88
|
}) : field.description
|
|
74
89
|
}))));
|
|
75
|
-
};
|
|
76
|
-
|
|
90
|
+
});
|
|
77
91
|
exports.FormItem = FormItem;
|
|
78
92
|
|
|
79
93
|
FormItem.Designer = function (props) {
|
|
80
|
-
var _interfaceConfig$vali, _collectionField$uiSc, _collectionField$uiSc2, _fieldSchema$xDecora, _collectionField$uiSc4, _fieldSchema$xCompon, _field$componentProps, _field$componentProps2;
|
|
94
|
+
var _interfaceConfig$vali, _collectionField$uiSc, _getCollectionFields, _collectionField$uiSc2, _fieldSchema$xDecora, _collectionField$uiSc4, _fieldSchema$xCompon, _field$componentProps, _field$componentProps2;
|
|
81
95
|
|
|
82
96
|
var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
|
|
83
97
|
getCollectionFields = _useCollectionManager.getCollectionFields,
|
|
@@ -109,7 +123,7 @@ FormItem.Designer = function (props) {
|
|
|
109
123
|
var interfaceConfig = getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
|
|
110
124
|
var validateSchema = interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$vali = interfaceConfig['validateSchema']) === null || _interfaceConfig$vali === void 0 ? void 0 : _interfaceConfig$vali.call(interfaceConfig, fieldSchema);
|
|
111
125
|
var originalTitle = collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc = collectionField.uiSchema) === null || _collectionField$uiSc === void 0 ? void 0 : _collectionField$uiSc.title;
|
|
112
|
-
var targetFields = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? getCollectionFields(collectionField.target) : [];
|
|
126
|
+
var targetFields = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? getCollectionFields(collectionField.target) : (_getCollectionFields = getCollectionFields(collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetCollection)) !== null && _getCollectionFields !== void 0 ? _getCollectionFields : [];
|
|
113
127
|
var fieldComponentOptions = (0, _hooks.useFieldComponentOptions)();
|
|
114
128
|
var isSubFormAssocitionField = field.address.segments.includes('__form_grid');
|
|
115
129
|
var initialValue = {
|
|
@@ -515,7 +529,7 @@ FormItem.Designer = function (props) {
|
|
|
515
529
|
});
|
|
516
530
|
dn.refresh();
|
|
517
531
|
}
|
|
518
|
-
}),
|
|
532
|
+
}), options.length > 0 && fieldSchema['x-component'] === 'CollectionField' && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
|
|
519
533
|
key: "title-field",
|
|
520
534
|
title: t('Title field'),
|
|
521
535
|
options: options,
|
|
@@ -66,6 +66,8 @@ var FormDesigner = function FormDesigner() {
|
|
|
66
66
|
componentName: 'FormItem',
|
|
67
67
|
collectionName: name,
|
|
68
68
|
resourceName: defaultResource
|
|
69
|
+
}), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.LinkageRules, {
|
|
70
|
+
collectionName: name
|
|
69
71
|
}), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.Divider, null), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.Remove, {
|
|
70
72
|
removeParentsIfNoChildren: true,
|
|
71
73
|
breakRemoveOn: {
|
|
@@ -25,9 +25,11 @@ var _2 = require("../..");
|
|
|
25
25
|
|
|
26
26
|
var _useProps2 = require("../../hooks/useProps");
|
|
27
27
|
|
|
28
|
+
var _utils = require("./utils");
|
|
29
|
+
|
|
28
30
|
var _excluded = ["form", "children"],
|
|
29
|
-
_excluded2 = ["form", "children"],
|
|
30
|
-
_excluded3 = ["form"];
|
|
31
|
+
_excluded2 = ["form", "children", "disabled"],
|
|
32
|
+
_excluded3 = ["form", "disabled"];
|
|
31
33
|
|
|
32
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
35
|
|
|
@@ -74,6 +76,7 @@ var Def = function Def(props) {
|
|
|
74
76
|
var FormDecorator = function FormDecorator(props) {
|
|
75
77
|
var form = props.form,
|
|
76
78
|
children = props.children,
|
|
79
|
+
disabled = props.disabled,
|
|
77
80
|
others = _objectWithoutProperties(props, _excluded2);
|
|
78
81
|
|
|
79
82
|
var field = (0, _react.useField)();
|
|
@@ -98,13 +101,26 @@ var FormDecorator = function FormDecorator(props) {
|
|
|
98
101
|
}))))));
|
|
99
102
|
};
|
|
100
103
|
|
|
104
|
+
var getLinkageRules = function getLinkageRules(fieldSchema) {
|
|
105
|
+
var linkageRules = null;
|
|
106
|
+
fieldSchema.mapProperties(function (schema) {
|
|
107
|
+
if (schema['x-linkage-rules']) {
|
|
108
|
+
linkageRules = schema['x-linkage-rules'];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return linkageRules;
|
|
112
|
+
};
|
|
113
|
+
|
|
101
114
|
var WithForm = function WithForm(props) {
|
|
115
|
+
var _fieldSchema$parent;
|
|
116
|
+
|
|
102
117
|
var form = props.form;
|
|
103
118
|
var fieldSchema = (0, _react.useFieldSchema)();
|
|
104
119
|
|
|
105
120
|
var _useActionContext = (0, _.useActionContext)(),
|
|
106
121
|
setFormValueChanged = _useActionContext.setFormValueChanged;
|
|
107
122
|
|
|
123
|
+
var linkageRules = getLinkageRules(fieldSchema) || ((_fieldSchema$parent = fieldSchema.parent) === null || _fieldSchema$parent === void 0 ? void 0 : _fieldSchema$parent['x-linkage-rules']) || [];
|
|
108
124
|
(0, _react2.useEffect)(function () {
|
|
109
125
|
var id = (0, _shared.uid)();
|
|
110
126
|
form.addEffects(id, function () {
|
|
@@ -112,10 +128,73 @@ var WithForm = function WithForm(props) {
|
|
|
112
128
|
setFormValueChanged === null || setFormValueChanged === void 0 ? void 0 : setFormValueChanged(true);
|
|
113
129
|
});
|
|
114
130
|
});
|
|
131
|
+
|
|
132
|
+
if (props.disabled) {
|
|
133
|
+
form.disabled = props.disabled;
|
|
134
|
+
}
|
|
135
|
+
|
|
115
136
|
return function () {
|
|
116
137
|
form.removeEffects(id);
|
|
117
138
|
};
|
|
118
139
|
}, []);
|
|
140
|
+
(0, _react2.useEffect)(function () {
|
|
141
|
+
var id = (0, _shared.uid)();
|
|
142
|
+
form.addEffects(id, function () {
|
|
143
|
+
return linkageRules.map(function (v) {
|
|
144
|
+
var _v$actions;
|
|
145
|
+
|
|
146
|
+
return (_v$actions = v.actions) === null || _v$actions === void 0 ? void 0 : _v$actions.map(function (h) {
|
|
147
|
+
if (h.targetFields) {
|
|
148
|
+
var fields = h.targetFields.join(',');
|
|
149
|
+
(0, _core.onFieldInit)("*(".concat(fields, ")"), function (field, form) {
|
|
150
|
+
field['initProperty'] = {
|
|
151
|
+
display: field.display,
|
|
152
|
+
required: field.required,
|
|
153
|
+
pattern: field.pattern,
|
|
154
|
+
value: field.value || field.initialValue
|
|
155
|
+
};
|
|
156
|
+
});
|
|
157
|
+
(0, _core.onFieldChange)("*(".concat(fields, ")"), ['value', 'required', 'pattern', 'display'], function (field) {
|
|
158
|
+
field.linkageProperty = {};
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
return function () {
|
|
165
|
+
form.removeEffects(id);
|
|
166
|
+
};
|
|
167
|
+
}, []);
|
|
168
|
+
(0, _react2.useEffect)(function () {
|
|
169
|
+
var id = (0, _shared.uid)();
|
|
170
|
+
form.addEffects(id, function () {
|
|
171
|
+
var linkagefields = [];
|
|
172
|
+
return linkageRules.map(function (v, index) {
|
|
173
|
+
var _v$actions2;
|
|
174
|
+
|
|
175
|
+
return (_v$actions2 = v.actions) === null || _v$actions2 === void 0 ? void 0 : _v$actions2.map(function (h) {
|
|
176
|
+
if (h.targetFields) {
|
|
177
|
+
var fields = h.targetFields.join(',');
|
|
178
|
+
return (0, _core.onFieldReact)("*(".concat(fields, ")"), function (field, form) {
|
|
179
|
+
linkagefields.push(field);
|
|
180
|
+
(0, _utils.linkageMergeAction)(h, field, v.condition, form === null || form === void 0 ? void 0 : form.values);
|
|
181
|
+
|
|
182
|
+
if (index === linkageRules.length - 1) {
|
|
183
|
+
setTimeout(function () {
|
|
184
|
+
return linkagefields.map(function (v) {
|
|
185
|
+
v.linkageProperty = {};
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
return function () {
|
|
195
|
+
form.removeEffects(id);
|
|
196
|
+
};
|
|
197
|
+
}, [linkageRules]);
|
|
119
198
|
return fieldSchema['x-decorator'] === 'Form' ? /*#__PURE__*/_react2.default.createElement(FormDecorator, _objectSpread({}, props)) : /*#__PURE__*/_react2.default.createElement(FormComponent, _objectSpread({}, props));
|
|
120
199
|
};
|
|
121
200
|
|
|
@@ -127,6 +206,7 @@ var WithoutForm = function WithoutForm(props) {
|
|
|
127
206
|
|
|
128
207
|
var form = (0, _react2.useMemo)(function () {
|
|
129
208
|
return (0, _core.createForm)({
|
|
209
|
+
disabled: props.disabled,
|
|
130
210
|
effects: function effects() {
|
|
131
211
|
(0, _core.onFormInputChange)(function (form) {
|
|
132
212
|
setFormValueChanged === null || setFormValueChanged === void 0 ? void 0 : setFormValueChanged(true);
|
|
@@ -146,12 +226,20 @@ var Form = (0, _react.observer)(function (props) {
|
|
|
146
226
|
|
|
147
227
|
var _useProps = (0, _useProps2.useProps)(props),
|
|
148
228
|
form = _useProps.form,
|
|
229
|
+
disabled = _useProps.disabled,
|
|
149
230
|
others = _objectWithoutProperties(_useProps, _excluded3);
|
|
150
231
|
|
|
151
|
-
|
|
232
|
+
var formDisabled = disabled || field.disabled;
|
|
233
|
+
return /*#__PURE__*/_react2.default.createElement(_antd2.ConfigProvider, {
|
|
234
|
+
componentDisabled: formDisabled
|
|
235
|
+
}, /*#__PURE__*/_react2.default.createElement("form", null, /*#__PURE__*/_react2.default.createElement(_antd2.Spin, {
|
|
152
236
|
spinning: field.loading || false
|
|
153
|
-
}, form ? /*#__PURE__*/_react2.default.createElement(WithForm, _objectSpread({
|
|
237
|
+
}, form ? /*#__PURE__*/_react2.default.createElement(WithForm, _objectSpread(_objectSpread({
|
|
154
238
|
form: form
|
|
155
|
-
}, others)
|
|
239
|
+
}, others), {}, {
|
|
240
|
+
disabled: formDisabled
|
|
241
|
+
})) : /*#__PURE__*/_react2.default.createElement(WithoutForm, _objectSpread(_objectSpread({}, others), {}, {
|
|
242
|
+
disabled: formDisabled
|
|
243
|
+
})))));
|
|
156
244
|
});
|
|
157
245
|
exports.Form = Form;
|