@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
|
@@ -15,41 +15,50 @@ var _core = require("@formily/core");
|
|
|
15
15
|
|
|
16
16
|
var _react = require("@formily/react");
|
|
17
17
|
|
|
18
|
+
var _lodash = _interopRequireWildcard(require("lodash"));
|
|
19
|
+
|
|
18
20
|
var _shared = require("@formily/shared");
|
|
19
21
|
|
|
20
22
|
var _antd2 = require("antd");
|
|
21
23
|
|
|
22
24
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
23
25
|
|
|
24
|
-
var _lodash = require("lodash");
|
|
25
|
-
|
|
26
26
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
27
27
|
|
|
28
28
|
var _reactDom = require("react-dom");
|
|
29
29
|
|
|
30
30
|
var _reactI18next = require("react-i18next");
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _2 = require("..");
|
|
33
33
|
|
|
34
34
|
var _schemaTemplates = require("../schema-templates");
|
|
35
35
|
|
|
36
36
|
var _BlockTemplate = require("../schema-templates/BlockTemplate");
|
|
37
37
|
|
|
38
|
+
var _LinkageRules = require("./LinkageRules");
|
|
39
|
+
|
|
40
|
+
var _actionHooks = require("./LinkageRules/action-hooks");
|
|
41
|
+
|
|
42
|
+
var _EnableChildCollections = require("./EnableChildCollections");
|
|
43
|
+
|
|
38
44
|
var _templateObject;
|
|
39
45
|
|
|
40
46
|
var _excluded = ["children", "fieldSchema"],
|
|
41
47
|
_excluded2 = ["title", "dn"],
|
|
42
48
|
_excluded3 = ["title", "options", "value", "onChange"],
|
|
43
|
-
_excluded4 = ["title", "onChange"],
|
|
44
|
-
_excluded5 = ["
|
|
45
|
-
_excluded6 = ["
|
|
46
|
-
_excluded7 = ["
|
|
49
|
+
_excluded4 = ["title", "options", "value", "onChange"],
|
|
50
|
+
_excluded5 = ["title", "onChange"],
|
|
51
|
+
_excluded6 = ["schema"],
|
|
52
|
+
_excluded7 = ["title", "onSubmit", "initialValues", "initialSchema", "schema", "modalTip", "components"],
|
|
53
|
+
_excluded8 = ["hidden", "title", "components", "scope", "effects", "schema", "onSubmit", "asyncGetInitialValues", "initialValues", "width"];
|
|
54
|
+
|
|
55
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
47
56
|
|
|
48
57
|
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); }
|
|
49
58
|
|
|
50
59
|
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; }
|
|
51
60
|
|
|
52
|
-
function
|
|
61
|
+
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(_e2) { throw _e2; }, 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(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
53
62
|
|
|
54
63
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
55
64
|
|
|
@@ -95,7 +104,7 @@ var SchemaSettingsProvider = function SchemaSettingsProvider(props) {
|
|
|
95
104
|
var _useSchemaTemplateMan = (0, _schemaTemplates.useSchemaTemplateManager)(),
|
|
96
105
|
getTemplateBySchema = _useSchemaTemplateMan.getTemplateBySchema;
|
|
97
106
|
|
|
98
|
-
var _useCollection = (0,
|
|
107
|
+
var _useCollection = (0, _2.useCollection)(),
|
|
99
108
|
name = _useCollection.name;
|
|
100
109
|
|
|
101
110
|
var template = getTemplateBySchema(fieldSchema);
|
|
@@ -150,13 +159,17 @@ SchemaSettings.Template = function (props) {
|
|
|
150
159
|
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
151
160
|
t = _useTranslation.t;
|
|
152
161
|
|
|
162
|
+
var _useCollectionManager = (0, _2.useCollectionManager)(),
|
|
163
|
+
getCollection = _useCollectionManager.getCollection;
|
|
164
|
+
|
|
153
165
|
var _useSchemaSettings = useSchemaSettings(),
|
|
154
166
|
dn = _useSchemaSettings.dn,
|
|
155
167
|
setVisible = _useSchemaSettings.setVisible,
|
|
156
168
|
template = _useSchemaSettings.template,
|
|
157
169
|
fieldSchema = _useSchemaSettings.fieldSchema;
|
|
158
170
|
|
|
159
|
-
var
|
|
171
|
+
var compile = (0, _2.useCompile)();
|
|
172
|
+
var api = (0, _2.useAPIClient)();
|
|
160
173
|
|
|
161
174
|
var _useBlockTemplateCont = (0, _BlockTemplate.useBlockTemplateContext)(),
|
|
162
175
|
tdn = _useBlockTemplateCont.dn;
|
|
@@ -226,18 +239,19 @@ SchemaSettings.Template = function (props) {
|
|
|
226
239
|
return /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, {
|
|
227
240
|
onClick: function () {
|
|
228
241
|
var _onClick2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
229
|
-
var values, sdn, _yield$saveAsTemplate, key;
|
|
242
|
+
var _getCollection, title, values, sdn, _yield$saveAsTemplate, key;
|
|
230
243
|
|
|
231
244
|
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
232
245
|
while (1) {
|
|
233
246
|
switch (_context3.prev = _context3.next) {
|
|
234
247
|
case 0:
|
|
235
248
|
setVisible(false);
|
|
236
|
-
|
|
249
|
+
_getCollection = getCollection(collectionName), title = _getCollection.title;
|
|
250
|
+
_context3.next = 4;
|
|
237
251
|
return (0, _antd.FormDialog)(t('Save as template'), function () {
|
|
238
252
|
return /*#__PURE__*/_react2.default.createElement(_antd.FormLayout, {
|
|
239
253
|
layout: 'vertical'
|
|
240
|
-
}, /*#__PURE__*/_react2.default.createElement(
|
|
254
|
+
}, /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
|
|
241
255
|
components: {
|
|
242
256
|
Input: _antd.Input,
|
|
243
257
|
FormItem: _antd.FormItem
|
|
@@ -248,6 +262,7 @@ SchemaSettings.Template = function (props) {
|
|
|
248
262
|
name: {
|
|
249
263
|
title: t('Template name'),
|
|
250
264
|
required: true,
|
|
265
|
+
default: "".concat(compile(title), "_").concat(t(componentName)),
|
|
251
266
|
'x-decorator': 'FormItem',
|
|
252
267
|
'x-component': 'Input'
|
|
253
268
|
}
|
|
@@ -256,16 +271,16 @@ SchemaSettings.Template = function (props) {
|
|
|
256
271
|
}));
|
|
257
272
|
}).open({});
|
|
258
273
|
|
|
259
|
-
case
|
|
274
|
+
case 4:
|
|
260
275
|
values = _context3.sent;
|
|
261
|
-
sdn = (0,
|
|
276
|
+
sdn = (0, _2.createDesignable)({
|
|
262
277
|
t: t,
|
|
263
278
|
api: api,
|
|
264
279
|
refresh: dn.refresh.bind(dn),
|
|
265
280
|
current: fieldSchema.parent
|
|
266
281
|
});
|
|
267
282
|
sdn.loadAPIClientEvents();
|
|
268
|
-
_context3.next =
|
|
283
|
+
_context3.next = 9;
|
|
269
284
|
return saveAsTemplate({
|
|
270
285
|
collectionName: collectionName,
|
|
271
286
|
resourceName: resourceName,
|
|
@@ -274,7 +289,7 @@ SchemaSettings.Template = function (props) {
|
|
|
274
289
|
uid: fieldSchema['x-uid']
|
|
275
290
|
});
|
|
276
291
|
|
|
277
|
-
case
|
|
292
|
+
case 9:
|
|
278
293
|
_yield$saveAsTemplate = _context3.sent;
|
|
279
294
|
key = _yield$saveAsTemplate.key;
|
|
280
295
|
sdn.removeWithoutEmit(fieldSchema);
|
|
@@ -286,7 +301,7 @@ SchemaSettings.Template = function (props) {
|
|
|
286
301
|
}
|
|
287
302
|
});
|
|
288
303
|
|
|
289
|
-
case
|
|
304
|
+
case 13:
|
|
290
305
|
case "end":
|
|
291
306
|
return _context3.stop();
|
|
292
307
|
}
|
|
@@ -307,7 +322,7 @@ var findGridSchema = function findGridSchema(fieldSchema) {
|
|
|
307
322
|
return fieldSchema.reduceProperties(function (buf, s) {
|
|
308
323
|
if (s['x-component'] === 'FormV2') {
|
|
309
324
|
var f = s.reduceProperties(function (buf, s) {
|
|
310
|
-
if (s['x-component'] === 'Grid') {
|
|
325
|
+
if (s['x-component'] === 'Grid' || s['x-component'] === 'BlockTemplate') {
|
|
311
326
|
return s;
|
|
312
327
|
}
|
|
313
328
|
|
|
@@ -353,13 +368,18 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
353
368
|
var _useTranslation2 = (0, _reactI18next.useTranslation)(),
|
|
354
369
|
t = _useTranslation2.t;
|
|
355
370
|
|
|
371
|
+
var compile = (0, _2.useCompile)();
|
|
372
|
+
|
|
373
|
+
var _useCollectionManager2 = (0, _2.useCollectionManager)(),
|
|
374
|
+
getCollection = _useCollectionManager2.getCollection;
|
|
375
|
+
|
|
356
376
|
var _useSchemaSettings2 = useSchemaSettings(),
|
|
357
377
|
dn = _useSchemaSettings2.dn,
|
|
358
378
|
setVisible = _useSchemaSettings2.setVisible,
|
|
359
379
|
template = _useSchemaSettings2.template,
|
|
360
380
|
fieldSchema = _useSchemaSettings2.fieldSchema;
|
|
361
381
|
|
|
362
|
-
var api = (0,
|
|
382
|
+
var api = (0, _2.useAPIClient)();
|
|
363
383
|
|
|
364
384
|
var _useSchemaTemplateMan3 = (0, _schemaTemplates.useSchemaTemplateManager)(),
|
|
365
385
|
saveAsTemplate = _useSchemaTemplateMan3.saveAsTemplate,
|
|
@@ -384,7 +404,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
384
404
|
case 2:
|
|
385
405
|
schema = _context5.sent;
|
|
386
406
|
templateSchema = findBlockTemplateSchema(fieldSchema);
|
|
387
|
-
sdn = (0,
|
|
407
|
+
sdn = (0, _2.createDesignable)({
|
|
388
408
|
t: t,
|
|
389
409
|
api: api,
|
|
390
410
|
refresh: dn.refresh.bind(dn),
|
|
@@ -447,19 +467,24 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
447
467
|
return /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, {
|
|
448
468
|
onClick: function () {
|
|
449
469
|
var _onClick4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
|
|
450
|
-
var gridSchema, values, sdn, _yield$saveAsTemplate2, key;
|
|
470
|
+
var _getCollection2, title, gridSchema, values, sdn, _yield$saveAsTemplate2, key;
|
|
451
471
|
|
|
452
472
|
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
453
473
|
while (1) {
|
|
454
474
|
switch (_context6.prev = _context6.next) {
|
|
455
475
|
case 0:
|
|
456
476
|
setVisible(false);
|
|
477
|
+
_getCollection2 = getCollection(collectionName), title = _getCollection2.title;
|
|
457
478
|
gridSchema = findGridSchema(fieldSchema);
|
|
458
|
-
_context6.next =
|
|
479
|
+
_context6.next = 5;
|
|
459
480
|
return (0, _antd.FormDialog)(t('Save as template'), function () {
|
|
481
|
+
var componentTitle = {
|
|
482
|
+
FormItem: t('Form'),
|
|
483
|
+
ReadPrettyFormItem: t('Details')
|
|
484
|
+
};
|
|
460
485
|
return /*#__PURE__*/_react2.default.createElement(_antd.FormLayout, {
|
|
461
486
|
layout: 'vertical'
|
|
462
|
-
}, /*#__PURE__*/_react2.default.createElement(
|
|
487
|
+
}, /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
|
|
463
488
|
components: {
|
|
464
489
|
Input: _antd.Input,
|
|
465
490
|
FormItem: _antd.FormItem
|
|
@@ -470,6 +495,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
470
495
|
name: {
|
|
471
496
|
title: t('Template name'),
|
|
472
497
|
required: true,
|
|
498
|
+
default: "".concat(compile(title), "_").concat(componentTitle[componentName] || componentName),
|
|
473
499
|
'x-decorator': 'FormItem',
|
|
474
500
|
'x-component': 'Input'
|
|
475
501
|
}
|
|
@@ -478,16 +504,16 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
478
504
|
}));
|
|
479
505
|
}).open({});
|
|
480
506
|
|
|
481
|
-
case
|
|
507
|
+
case 5:
|
|
482
508
|
values = _context6.sent;
|
|
483
|
-
sdn = (0,
|
|
509
|
+
sdn = (0, _2.createDesignable)({
|
|
484
510
|
t: t,
|
|
485
511
|
api: api,
|
|
486
512
|
refresh: dn.refresh.bind(dn),
|
|
487
513
|
current: gridSchema.parent
|
|
488
514
|
});
|
|
489
515
|
sdn.loadAPIClientEvents();
|
|
490
|
-
_context6.next =
|
|
516
|
+
_context6.next = 10;
|
|
491
517
|
return saveAsTemplate({
|
|
492
518
|
collectionName: collectionName,
|
|
493
519
|
resourceName: resourceName,
|
|
@@ -496,7 +522,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
496
522
|
uid: gridSchema['x-uid']
|
|
497
523
|
});
|
|
498
524
|
|
|
499
|
-
case
|
|
525
|
+
case 10:
|
|
500
526
|
_yield$saveAsTemplate2 = _context6.sent;
|
|
501
527
|
key = _yield$saveAsTemplate2.key;
|
|
502
528
|
sdn.removeWithoutEmit(gridSchema);
|
|
@@ -508,7 +534,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
508
534
|
}
|
|
509
535
|
});
|
|
510
536
|
fieldSchema['x-template-key'] = key;
|
|
511
|
-
_context6.next =
|
|
537
|
+
_context6.next = 17;
|
|
512
538
|
return api.request({
|
|
513
539
|
url: "uiSchemas:patch",
|
|
514
540
|
method: 'post',
|
|
@@ -518,7 +544,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
518
544
|
}
|
|
519
545
|
});
|
|
520
546
|
|
|
521
|
-
case
|
|
547
|
+
case 17:
|
|
522
548
|
case "end":
|
|
523
549
|
return _context6.stop();
|
|
524
550
|
}
|
|
@@ -641,11 +667,36 @@ SchemaSettings.SelectItem = function (props) {
|
|
|
641
667
|
})));
|
|
642
668
|
};
|
|
643
669
|
|
|
644
|
-
SchemaSettings.
|
|
670
|
+
SchemaSettings.CascaderItem = function (props) {
|
|
645
671
|
var title = props.title,
|
|
672
|
+
options = props.options,
|
|
673
|
+
value = props.value,
|
|
646
674
|
onChange = props.onChange,
|
|
647
675
|
others = _objectWithoutProperties(props, _excluded4);
|
|
648
676
|
|
|
677
|
+
return /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, _objectSpread({}, others), /*#__PURE__*/_react2.default.createElement("div", {
|
|
678
|
+
style: {
|
|
679
|
+
alignItems: 'center',
|
|
680
|
+
display: 'flex',
|
|
681
|
+
justifyContent: 'space-between'
|
|
682
|
+
}
|
|
683
|
+
}, title, /*#__PURE__*/_react2.default.createElement(_antd2.Cascader, {
|
|
684
|
+
bordered: false,
|
|
685
|
+
defaultValue: value,
|
|
686
|
+
onChange: onChange,
|
|
687
|
+
options: options,
|
|
688
|
+
style: {
|
|
689
|
+
textAlign: 'right',
|
|
690
|
+
minWidth: 100
|
|
691
|
+
}
|
|
692
|
+
})));
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
SchemaSettings.SwitchItem = function (props) {
|
|
696
|
+
var title = props.title,
|
|
697
|
+
onChange = props.onChange,
|
|
698
|
+
others = _objectWithoutProperties(props, _excluded5);
|
|
699
|
+
|
|
649
700
|
var _useState3 = (0, _react2.useState)(!!props.checked),
|
|
650
701
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
651
702
|
checked = _useState4[0],
|
|
@@ -673,7 +724,7 @@ SchemaSettings.SwitchItem = function (props) {
|
|
|
673
724
|
|
|
674
725
|
SchemaSettings.PopupItem = function (props) {
|
|
675
726
|
var schema = props.schema,
|
|
676
|
-
others = _objectWithoutProperties(props,
|
|
727
|
+
others = _objectWithoutProperties(props, _excluded6);
|
|
677
728
|
|
|
678
729
|
var _useState5 = (0, _react2.useState)(false),
|
|
679
730
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
@@ -681,8 +732,8 @@ SchemaSettings.PopupItem = function (props) {
|
|
|
681
732
|
setVisible = _useState6[1];
|
|
682
733
|
|
|
683
734
|
var ctx = (0, _react2.useContext)(SchemaSettingsContext);
|
|
684
|
-
var actx = (0,
|
|
685
|
-
return /*#__PURE__*/_react2.default.createElement(
|
|
735
|
+
var actx = (0, _2.useActionContext)();
|
|
736
|
+
return /*#__PURE__*/_react2.default.createElement(_2.ActionContext.Provider, {
|
|
686
737
|
value: {
|
|
687
738
|
visible: visible,
|
|
688
739
|
setVisible: setVisible
|
|
@@ -693,7 +744,7 @@ SchemaSettings.PopupItem = function (props) {
|
|
|
693
744
|
ctx.setVisible(false);
|
|
694
745
|
setVisible(true);
|
|
695
746
|
}
|
|
696
|
-
}), props.children || props.title), /*#__PURE__*/_react2.default.createElement(
|
|
747
|
+
}), props.children || props.title), /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
|
|
697
748
|
schema: _objectSpread({
|
|
698
749
|
name: (0, _shared.uid)()
|
|
699
750
|
}, schema)
|
|
@@ -708,7 +759,7 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
|
|
|
708
759
|
schema = props.schema,
|
|
709
760
|
modalTip = props.modalTip,
|
|
710
761
|
components = props.components,
|
|
711
|
-
others = _objectWithoutProperties(props,
|
|
762
|
+
others = _objectWithoutProperties(props, _excluded7);
|
|
712
763
|
|
|
713
764
|
var _useState7 = (0, _react2.useState)(false),
|
|
714
765
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
@@ -729,8 +780,8 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
|
|
|
729
780
|
var _useSchemaSettings4 = useSchemaSettings(),
|
|
730
781
|
dn = _useSchemaSettings4.dn;
|
|
731
782
|
|
|
732
|
-
var compile = (0,
|
|
733
|
-
var api = (0,
|
|
783
|
+
var compile = (0, _2.useCompile)();
|
|
784
|
+
var api = (0, _2.useAPIClient)();
|
|
734
785
|
var form = (0, _react2.useMemo)(function () {
|
|
735
786
|
return (0, _core.createForm)({
|
|
736
787
|
initialValues: (0, _lodash.cloneDeep)(initialValues),
|
|
@@ -833,17 +884,17 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
|
|
|
833
884
|
type: "primary",
|
|
834
885
|
onClick: submitHandler
|
|
835
886
|
}, t('Submit')))
|
|
836
|
-
}), /*#__PURE__*/_react2.default.createElement(
|
|
887
|
+
}), /*#__PURE__*/_react2.default.createElement(_2.FormProvider, {
|
|
837
888
|
form: form
|
|
838
889
|
}, /*#__PURE__*/_react2.default.createElement(_antd.FormLayout, {
|
|
839
890
|
layout: 'vertical'
|
|
840
891
|
}, modalTip && /*#__PURE__*/_react2.default.createElement(_antd2.Alert, {
|
|
841
892
|
message: modalTip
|
|
842
|
-
}), modalTip && /*#__PURE__*/_react2.default.createElement("br", null), visible && schemaUid && /*#__PURE__*/_react2.default.createElement(
|
|
893
|
+
}), modalTip && /*#__PURE__*/_react2.default.createElement("br", null), visible && schemaUid && /*#__PURE__*/_react2.default.createElement(_2.RemoteSchemaComponent, {
|
|
843
894
|
noForm: true,
|
|
844
895
|
components: components,
|
|
845
896
|
uid: schemaUid
|
|
846
|
-
}), visible && schema && /*#__PURE__*/_react2.default.createElement(
|
|
897
|
+
}), visible && schema && /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
|
|
847
898
|
components: components,
|
|
848
899
|
schema: schema
|
|
849
900
|
}))))), document.body));
|
|
@@ -859,10 +910,11 @@ SchemaSettings.ModalItem = function (props) {
|
|
|
859
910
|
onSubmit = props.onSubmit,
|
|
860
911
|
asyncGetInitialValues = props.asyncGetInitialValues,
|
|
861
912
|
initialValues = props.initialValues,
|
|
862
|
-
|
|
913
|
+
width = props.width,
|
|
914
|
+
others = _objectWithoutProperties(props, _excluded8);
|
|
863
915
|
|
|
864
916
|
var options = (0, _react2.useContext)(_react.SchemaOptionsContext);
|
|
865
|
-
var cm = (0, _react2.useContext)(
|
|
917
|
+
var cm = (0, _react2.useContext)(_2.CollectionManagerContext);
|
|
866
918
|
|
|
867
919
|
if (hidden) {
|
|
868
920
|
return null;
|
|
@@ -894,15 +946,18 @@ SchemaSettings.ModalItem = function (props) {
|
|
|
894
946
|
|
|
895
947
|
case 7:
|
|
896
948
|
values = _context9.t0;
|
|
897
|
-
(0, _antd.FormDialog)(
|
|
898
|
-
|
|
949
|
+
(0, _antd.FormDialog)({
|
|
950
|
+
title: schema.title || title,
|
|
951
|
+
width: width
|
|
952
|
+
}, function () {
|
|
953
|
+
return /*#__PURE__*/_react2.default.createElement(_2.CollectionManagerContext.Provider, {
|
|
899
954
|
value: cm
|
|
900
|
-
}, /*#__PURE__*/_react2.default.createElement(
|
|
955
|
+
}, /*#__PURE__*/_react2.default.createElement(_2.SchemaComponentOptions, {
|
|
901
956
|
scope: options.scope,
|
|
902
957
|
components: options.components
|
|
903
958
|
}, /*#__PURE__*/_react2.default.createElement(_antd.FormLayout, {
|
|
904
959
|
layout: 'vertical'
|
|
905
|
-
}, /*#__PURE__*/_react2.default.createElement(
|
|
960
|
+
}, /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
|
|
906
961
|
components: components,
|
|
907
962
|
scope: scope,
|
|
908
963
|
schema: schema
|
|
@@ -937,7 +992,7 @@ SchemaSettings.BlockTitleItem = function () {
|
|
|
937
992
|
var field = (0, _react.useField)();
|
|
938
993
|
var fieldSchema = (0, _react.useFieldSchema)();
|
|
939
994
|
|
|
940
|
-
var _useDesignable = (0,
|
|
995
|
+
var _useDesignable = (0, _2.useDesignable)(),
|
|
941
996
|
dn = _useDesignable.dn;
|
|
942
997
|
|
|
943
998
|
var _useTranslation5 = (0, _reactI18next.useTranslation)(),
|
|
@@ -972,4 +1027,144 @@ SchemaSettings.BlockTitleItem = function () {
|
|
|
972
1027
|
dn.refresh();
|
|
973
1028
|
}
|
|
974
1029
|
});
|
|
1030
|
+
};
|
|
1031
|
+
|
|
1032
|
+
SchemaSettings.LinkageRules = function (props) {
|
|
1033
|
+
var collectionName = props.collectionName;
|
|
1034
|
+
var fieldSchema = (0, _react.useFieldSchema)();
|
|
1035
|
+
|
|
1036
|
+
var _useDesignable2 = (0, _2.useDesignable)(),
|
|
1037
|
+
dn = _useDesignable2.dn;
|
|
1038
|
+
|
|
1039
|
+
var _useTranslation6 = (0, _reactI18next.useTranslation)(),
|
|
1040
|
+
t = _useTranslation6.t;
|
|
1041
|
+
|
|
1042
|
+
var _useSchemaTemplateMan4 = (0, _schemaTemplates.useSchemaTemplateManager)(),
|
|
1043
|
+
getTemplateById = _useSchemaTemplateMan4.getTemplateById;
|
|
1044
|
+
|
|
1045
|
+
var type = fieldSchema['x-component'] === 'Action' ? 'button' : 'field';
|
|
1046
|
+
var gridSchema = findGridSchema(fieldSchema) || fieldSchema;
|
|
1047
|
+
return /*#__PURE__*/_react2.default.createElement(SchemaSettings.ModalItem, {
|
|
1048
|
+
title: t('Linkage rules'),
|
|
1049
|
+
components: {
|
|
1050
|
+
ArrayCollapse: _antd.ArrayCollapse,
|
|
1051
|
+
FormLayout: _antd.FormLayout
|
|
1052
|
+
},
|
|
1053
|
+
width: 750,
|
|
1054
|
+
schema: {
|
|
1055
|
+
type: 'object',
|
|
1056
|
+
title: t('Linkage rules'),
|
|
1057
|
+
properties: {
|
|
1058
|
+
fieldReaction: {
|
|
1059
|
+
'x-component': _LinkageRules.FormLinkageRules,
|
|
1060
|
+
'x-component-props': {
|
|
1061
|
+
useProps: function useProps() {
|
|
1062
|
+
var options = (0, _2.useCollectionFilterOptions)(collectionName);
|
|
1063
|
+
return {
|
|
1064
|
+
options: options,
|
|
1065
|
+
defaultValues: (gridSchema === null || gridSchema === void 0 ? void 0 : gridSchema['x-linkage-rules']) || (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-linkage-rules']),
|
|
1066
|
+
type: type,
|
|
1067
|
+
linkageOptions: (0, _actionHooks.useLinkageCollectionFieldOptions)(collectionName),
|
|
1068
|
+
collectionName: collectionName
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
},
|
|
1075
|
+
onSubmit: function onSubmit(v) {
|
|
1076
|
+
var rules = [];
|
|
1077
|
+
|
|
1078
|
+
var _iterator = _createForOfIteratorHelper(v.fieldReaction.rules),
|
|
1079
|
+
_step;
|
|
1080
|
+
|
|
1081
|
+
try {
|
|
1082
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1083
|
+
var rule = _step.value;
|
|
1084
|
+
rules.push(_lodash.default.pickBy(rule, _lodash.default.identity));
|
|
1085
|
+
}
|
|
1086
|
+
} catch (err) {
|
|
1087
|
+
_iterator.e(err);
|
|
1088
|
+
} finally {
|
|
1089
|
+
_iterator.f();
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
var templateId = gridSchema['x-component'] === 'BlockTemplate' && gridSchema['x-component-props'].templateId;
|
|
1093
|
+
var uid = templateId && getTemplateById(templateId).uid || gridSchema['x-uid'];
|
|
1094
|
+
|
|
1095
|
+
var schema = _defineProperty({}, 'x-uid', uid);
|
|
1096
|
+
|
|
1097
|
+
gridSchema['x-linkage-rules'] = rules;
|
|
1098
|
+
schema['x-linkage-rules'] = rules;
|
|
1099
|
+
dn.emit('patch', {
|
|
1100
|
+
schema: schema
|
|
1101
|
+
});
|
|
1102
|
+
dn.refresh();
|
|
1103
|
+
}
|
|
1104
|
+
});
|
|
1105
|
+
};
|
|
1106
|
+
|
|
1107
|
+
SchemaSettings.EnableChildCollections = function (props) {
|
|
1108
|
+
var collectionName = props.collectionName;
|
|
1109
|
+
var fieldSchema = (0, _react.useFieldSchema)();
|
|
1110
|
+
|
|
1111
|
+
var _useDesignable3 = (0, _2.useDesignable)(),
|
|
1112
|
+
dn = _useDesignable3.dn;
|
|
1113
|
+
|
|
1114
|
+
var _useTranslation7 = (0, _reactI18next.useTranslation)(),
|
|
1115
|
+
t = _useTranslation7.t;
|
|
1116
|
+
|
|
1117
|
+
return /*#__PURE__*/_react2.default.createElement(SchemaSettings.ModalItem, {
|
|
1118
|
+
title: t('Enable child collections'),
|
|
1119
|
+
components: {
|
|
1120
|
+
ArrayItems: _antd.ArrayItems,
|
|
1121
|
+
FormLayout: _antd.FormLayout
|
|
1122
|
+
},
|
|
1123
|
+
width: 600,
|
|
1124
|
+
schema: {
|
|
1125
|
+
type: 'object',
|
|
1126
|
+
title: t('Enable child collections'),
|
|
1127
|
+
properties: {
|
|
1128
|
+
enableChildren: {
|
|
1129
|
+
'x-component': _EnableChildCollections.EnableChildCollections,
|
|
1130
|
+
'x-component-props': {
|
|
1131
|
+
useProps: function useProps() {
|
|
1132
|
+
return {
|
|
1133
|
+
defaultValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-enable-children'],
|
|
1134
|
+
collectionName: collectionName
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
},
|
|
1141
|
+
onSubmit: function onSubmit(v) {
|
|
1142
|
+
var enableChildren = [];
|
|
1143
|
+
|
|
1144
|
+
var _iterator2 = _createForOfIteratorHelper(v.enableChildren.childrenCollections),
|
|
1145
|
+
_step2;
|
|
1146
|
+
|
|
1147
|
+
try {
|
|
1148
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1149
|
+
var item = _step2.value;
|
|
1150
|
+
enableChildren.push(_lodash.default.pickBy(item, _lodash.default.identity));
|
|
1151
|
+
}
|
|
1152
|
+
} catch (err) {
|
|
1153
|
+
_iterator2.e(err);
|
|
1154
|
+
} finally {
|
|
1155
|
+
_iterator2.f();
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
var uid = fieldSchema['x-uid'];
|
|
1159
|
+
|
|
1160
|
+
var schema = _defineProperty({}, 'x-uid', uid);
|
|
1161
|
+
|
|
1162
|
+
fieldSchema['x-enable-children'] = enableChildren;
|
|
1163
|
+
schema['x-enable-children'] = enableChildren;
|
|
1164
|
+
dn.emit('patch', {
|
|
1165
|
+
schema: schema
|
|
1166
|
+
});
|
|
1167
|
+
dn.refresh();
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
975
1170
|
};
|
|
@@ -46,6 +46,13 @@ var BlockTemplate = (0, _react.observer)(function (props) {
|
|
|
46
46
|
var template = (0, _react2.useMemo)(function () {
|
|
47
47
|
return getTemplateById(templateId);
|
|
48
48
|
}, [templateId]);
|
|
49
|
+
|
|
50
|
+
var onSuccess = function onSuccess(data) {
|
|
51
|
+
var _data$data;
|
|
52
|
+
|
|
53
|
+
fieldSchema['x-linkage-rules'] = (data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data['x-linkage-rules']) || [];
|
|
54
|
+
};
|
|
55
|
+
|
|
49
56
|
return template ? /*#__PURE__*/_react2.default.createElement(BlockTemplateContext.Provider, {
|
|
50
57
|
value: {
|
|
51
58
|
dn: dn,
|
|
@@ -55,7 +62,8 @@ var BlockTemplate = (0, _react.observer)(function (props) {
|
|
|
55
62
|
}
|
|
56
63
|
}, /*#__PURE__*/_react2.default.createElement(_.RemoteSchemaComponent, {
|
|
57
64
|
noForm: true,
|
|
58
|
-
uid: template === null || template === void 0 ? void 0 : template.uid
|
|
65
|
+
uid: template === null || template === void 0 ? void 0 : template.uid,
|
|
66
|
+
onSuccess: onSuccess
|
|
59
67
|
})) : null;
|
|
60
68
|
});
|
|
61
69
|
exports.BlockTemplate = BlockTemplate;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/client",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1-alpha.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "lib",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"@formily/antd": "2.0.20",
|
|
14
14
|
"@formily/core": "2.0.20",
|
|
15
15
|
"@formily/react": "2.0.20",
|
|
16
|
-
"@nocobase/sdk": "0.9.
|
|
17
|
-
"@nocobase/utils": "0.9.
|
|
16
|
+
"@nocobase/sdk": "0.9.1-alpha.2",
|
|
17
|
+
"@nocobase/utils": "0.9.1-alpha.2",
|
|
18
18
|
"ahooks": "^3.7.2",
|
|
19
19
|
"antd": "4.22.8",
|
|
20
20
|
"axios": "^0.26.1",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"@types/marked": "^4.0.1",
|
|
56
56
|
"axios-mock-adapter": "^1.20.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "d588a68eca4feed4642a4cb317301011266fe5c9"
|
|
59
59
|
}
|