@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
|
@@ -3,10 +3,13 @@ var _templateObject;
|
|
|
3
3
|
var _excluded = ["children", "fieldSchema"],
|
|
4
4
|
_excluded2 = ["title", "dn"],
|
|
5
5
|
_excluded3 = ["title", "options", "value", "onChange"],
|
|
6
|
-
_excluded4 = ["title", "onChange"],
|
|
7
|
-
_excluded5 = ["
|
|
8
|
-
_excluded6 = ["
|
|
9
|
-
_excluded7 = ["
|
|
6
|
+
_excluded4 = ["title", "options", "value", "onChange"],
|
|
7
|
+
_excluded5 = ["title", "onChange"],
|
|
8
|
+
_excluded6 = ["schema"],
|
|
9
|
+
_excluded7 = ["title", "onSubmit", "initialValues", "initialSchema", "schema", "modalTip", "components"],
|
|
10
|
+
_excluded8 = ["hidden", "title", "components", "scope", "effects", "schema", "onSubmit", "asyncGetInitialValues", "initialValues", "width"];
|
|
11
|
+
|
|
12
|
+
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; } } }; }
|
|
10
13
|
|
|
11
14
|
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); } }
|
|
12
15
|
|
|
@@ -37,19 +40,23 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
37
40
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
38
41
|
|
|
39
42
|
import { css } from '@emotion/css';
|
|
40
|
-
import { FormDialog, FormItem, FormLayout, Input } from '@formily/antd';
|
|
43
|
+
import { FormDialog, FormItem, FormLayout, Input, ArrayCollapse, ArrayItems } from '@formily/antd';
|
|
41
44
|
import { createForm } from '@formily/core';
|
|
42
45
|
import { SchemaOptionsContext, useField, useFieldSchema, useForm } from '@formily/react';
|
|
46
|
+
import _ from 'lodash';
|
|
43
47
|
import { uid } from '@formily/shared';
|
|
44
|
-
import { Alert, Button, Dropdown, Menu, Modal, Select, Space, Switch } from 'antd';
|
|
48
|
+
import { Alert, Button, Cascader, Dropdown, Menu, Modal, Select, Space, Switch } from 'antd';
|
|
45
49
|
import classNames from 'classnames';
|
|
46
50
|
import { cloneDeep } from 'lodash';
|
|
47
51
|
import React, { createContext, useContext, useMemo, useState } from 'react';
|
|
48
52
|
import { createPortal } from 'react-dom';
|
|
49
53
|
import { useTranslation } from 'react-i18next';
|
|
50
|
-
import { ActionContext, CollectionManagerContext, createDesignable, FormProvider, RemoteSchemaComponent, SchemaComponent, SchemaComponentOptions, useActionContext, useAPIClient, useCollection, useCompile, useDesignable } from '..';
|
|
54
|
+
import { ActionContext, CollectionManagerContext, createDesignable, FormProvider, RemoteSchemaComponent, SchemaComponent, SchemaComponentOptions, useActionContext, useAPIClient, useCollection, useCollectionManager, useCompile, useDesignable, useCollectionFilterOptions } from '..';
|
|
51
55
|
import { useSchemaTemplateManager } from '../schema-templates';
|
|
52
56
|
import { useBlockTemplateContext } from '../schema-templates/BlockTemplate';
|
|
57
|
+
import { FormLinkageRules } from './LinkageRules';
|
|
58
|
+
import { useLinkageCollectionFieldOptions } from './LinkageRules/action-hooks';
|
|
59
|
+
import { EnableChildCollections } from './EnableChildCollections';
|
|
53
60
|
var SchemaSettingsContext = /*#__PURE__*/createContext(null);
|
|
54
61
|
export var useSchemaSettings = function useSchemaSettings() {
|
|
55
62
|
return useContext(SchemaSettingsContext);
|
|
@@ -112,12 +119,16 @@ SchemaSettings.Template = function (props) {
|
|
|
112
119
|
var _useTranslation = useTranslation(),
|
|
113
120
|
t = _useTranslation.t;
|
|
114
121
|
|
|
122
|
+
var _useCollectionManager = useCollectionManager(),
|
|
123
|
+
getCollection = _useCollectionManager.getCollection;
|
|
124
|
+
|
|
115
125
|
var _useSchemaSettings = useSchemaSettings(),
|
|
116
126
|
dn = _useSchemaSettings.dn,
|
|
117
127
|
setVisible = _useSchemaSettings.setVisible,
|
|
118
128
|
template = _useSchemaSettings.template,
|
|
119
129
|
fieldSchema = _useSchemaSettings.fieldSchema;
|
|
120
130
|
|
|
131
|
+
var compile = useCompile();
|
|
121
132
|
var api = useAPIClient();
|
|
122
133
|
|
|
123
134
|
var _useBlockTemplateCont = useBlockTemplateContext(),
|
|
@@ -188,14 +199,15 @@ SchemaSettings.Template = function (props) {
|
|
|
188
199
|
return /*#__PURE__*/React.createElement(SchemaSettings.Item, {
|
|
189
200
|
onClick: function () {
|
|
190
201
|
var _onClick2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
191
|
-
var values, sdn, _yield$saveAsTemplate, key;
|
|
202
|
+
var _getCollection, title, values, sdn, _yield$saveAsTemplate, key;
|
|
192
203
|
|
|
193
204
|
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
194
205
|
while (1) {
|
|
195
206
|
switch (_context3.prev = _context3.next) {
|
|
196
207
|
case 0:
|
|
197
208
|
setVisible(false);
|
|
198
|
-
|
|
209
|
+
_getCollection = getCollection(collectionName), title = _getCollection.title;
|
|
210
|
+
_context3.next = 4;
|
|
199
211
|
return FormDialog(t('Save as template'), function () {
|
|
200
212
|
return /*#__PURE__*/React.createElement(FormLayout, {
|
|
201
213
|
layout: 'vertical'
|
|
@@ -210,6 +222,7 @@ SchemaSettings.Template = function (props) {
|
|
|
210
222
|
name: {
|
|
211
223
|
title: t('Template name'),
|
|
212
224
|
required: true,
|
|
225
|
+
default: "".concat(compile(title), "_").concat(t(componentName)),
|
|
213
226
|
'x-decorator': 'FormItem',
|
|
214
227
|
'x-component': 'Input'
|
|
215
228
|
}
|
|
@@ -218,7 +231,7 @@ SchemaSettings.Template = function (props) {
|
|
|
218
231
|
}));
|
|
219
232
|
}).open({});
|
|
220
233
|
|
|
221
|
-
case
|
|
234
|
+
case 4:
|
|
222
235
|
values = _context3.sent;
|
|
223
236
|
sdn = createDesignable({
|
|
224
237
|
t: t,
|
|
@@ -227,7 +240,7 @@ SchemaSettings.Template = function (props) {
|
|
|
227
240
|
current: fieldSchema.parent
|
|
228
241
|
});
|
|
229
242
|
sdn.loadAPIClientEvents();
|
|
230
|
-
_context3.next =
|
|
243
|
+
_context3.next = 9;
|
|
231
244
|
return saveAsTemplate({
|
|
232
245
|
collectionName: collectionName,
|
|
233
246
|
resourceName: resourceName,
|
|
@@ -236,7 +249,7 @@ SchemaSettings.Template = function (props) {
|
|
|
236
249
|
uid: fieldSchema['x-uid']
|
|
237
250
|
});
|
|
238
251
|
|
|
239
|
-
case
|
|
252
|
+
case 9:
|
|
240
253
|
_yield$saveAsTemplate = _context3.sent;
|
|
241
254
|
key = _yield$saveAsTemplate.key;
|
|
242
255
|
sdn.removeWithoutEmit(fieldSchema);
|
|
@@ -248,7 +261,7 @@ SchemaSettings.Template = function (props) {
|
|
|
248
261
|
}
|
|
249
262
|
});
|
|
250
263
|
|
|
251
|
-
case
|
|
264
|
+
case 13:
|
|
252
265
|
case "end":
|
|
253
266
|
return _context3.stop();
|
|
254
267
|
}
|
|
@@ -269,7 +282,7 @@ var findGridSchema = function findGridSchema(fieldSchema) {
|
|
|
269
282
|
return fieldSchema.reduceProperties(function (buf, s) {
|
|
270
283
|
if (s['x-component'] === 'FormV2') {
|
|
271
284
|
var f = s.reduceProperties(function (buf, s) {
|
|
272
|
-
if (s['x-component'] === 'Grid') {
|
|
285
|
+
if (s['x-component'] === 'Grid' || s['x-component'] === 'BlockTemplate') {
|
|
273
286
|
return s;
|
|
274
287
|
}
|
|
275
288
|
|
|
@@ -315,6 +328,11 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
315
328
|
var _useTranslation2 = useTranslation(),
|
|
316
329
|
t = _useTranslation2.t;
|
|
317
330
|
|
|
331
|
+
var compile = useCompile();
|
|
332
|
+
|
|
333
|
+
var _useCollectionManager2 = useCollectionManager(),
|
|
334
|
+
getCollection = _useCollectionManager2.getCollection;
|
|
335
|
+
|
|
318
336
|
var _useSchemaSettings2 = useSchemaSettings(),
|
|
319
337
|
dn = _useSchemaSettings2.dn,
|
|
320
338
|
setVisible = _useSchemaSettings2.setVisible,
|
|
@@ -409,16 +427,21 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
409
427
|
return /*#__PURE__*/React.createElement(SchemaSettings.Item, {
|
|
410
428
|
onClick: function () {
|
|
411
429
|
var _onClick4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
|
|
412
|
-
var gridSchema, values, sdn, _yield$saveAsTemplate2, key;
|
|
430
|
+
var _getCollection2, title, gridSchema, values, sdn, _yield$saveAsTemplate2, key;
|
|
413
431
|
|
|
414
432
|
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
415
433
|
while (1) {
|
|
416
434
|
switch (_context6.prev = _context6.next) {
|
|
417
435
|
case 0:
|
|
418
436
|
setVisible(false);
|
|
437
|
+
_getCollection2 = getCollection(collectionName), title = _getCollection2.title;
|
|
419
438
|
gridSchema = findGridSchema(fieldSchema);
|
|
420
|
-
_context6.next =
|
|
439
|
+
_context6.next = 5;
|
|
421
440
|
return FormDialog(t('Save as template'), function () {
|
|
441
|
+
var componentTitle = {
|
|
442
|
+
FormItem: t('Form'),
|
|
443
|
+
ReadPrettyFormItem: t('Details')
|
|
444
|
+
};
|
|
422
445
|
return /*#__PURE__*/React.createElement(FormLayout, {
|
|
423
446
|
layout: 'vertical'
|
|
424
447
|
}, /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
@@ -432,6 +455,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
432
455
|
name: {
|
|
433
456
|
title: t('Template name'),
|
|
434
457
|
required: true,
|
|
458
|
+
default: "".concat(compile(title), "_").concat(componentTitle[componentName] || componentName),
|
|
435
459
|
'x-decorator': 'FormItem',
|
|
436
460
|
'x-component': 'Input'
|
|
437
461
|
}
|
|
@@ -440,7 +464,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
440
464
|
}));
|
|
441
465
|
}).open({});
|
|
442
466
|
|
|
443
|
-
case
|
|
467
|
+
case 5:
|
|
444
468
|
values = _context6.sent;
|
|
445
469
|
sdn = createDesignable({
|
|
446
470
|
t: t,
|
|
@@ -449,7 +473,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
449
473
|
current: gridSchema.parent
|
|
450
474
|
});
|
|
451
475
|
sdn.loadAPIClientEvents();
|
|
452
|
-
_context6.next =
|
|
476
|
+
_context6.next = 10;
|
|
453
477
|
return saveAsTemplate({
|
|
454
478
|
collectionName: collectionName,
|
|
455
479
|
resourceName: resourceName,
|
|
@@ -458,7 +482,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
458
482
|
uid: gridSchema['x-uid']
|
|
459
483
|
});
|
|
460
484
|
|
|
461
|
-
case
|
|
485
|
+
case 10:
|
|
462
486
|
_yield$saveAsTemplate2 = _context6.sent;
|
|
463
487
|
key = _yield$saveAsTemplate2.key;
|
|
464
488
|
sdn.removeWithoutEmit(gridSchema);
|
|
@@ -470,7 +494,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
470
494
|
}
|
|
471
495
|
});
|
|
472
496
|
fieldSchema['x-template-key'] = key;
|
|
473
|
-
_context6.next =
|
|
497
|
+
_context6.next = 17;
|
|
474
498
|
return api.request({
|
|
475
499
|
url: "uiSchemas:patch",
|
|
476
500
|
method: 'post',
|
|
@@ -480,7 +504,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
480
504
|
}
|
|
481
505
|
});
|
|
482
506
|
|
|
483
|
-
case
|
|
507
|
+
case 17:
|
|
484
508
|
case "end":
|
|
485
509
|
return _context6.stop();
|
|
486
510
|
}
|
|
@@ -603,11 +627,36 @@ SchemaSettings.SelectItem = function (props) {
|
|
|
603
627
|
})));
|
|
604
628
|
};
|
|
605
629
|
|
|
606
|
-
SchemaSettings.
|
|
630
|
+
SchemaSettings.CascaderItem = function (props) {
|
|
607
631
|
var title = props.title,
|
|
632
|
+
options = props.options,
|
|
633
|
+
value = props.value,
|
|
608
634
|
onChange = props.onChange,
|
|
609
635
|
others = _objectWithoutProperties(props, _excluded4);
|
|
610
636
|
|
|
637
|
+
return /*#__PURE__*/React.createElement(SchemaSettings.Item, _objectSpread({}, others), /*#__PURE__*/React.createElement("div", {
|
|
638
|
+
style: {
|
|
639
|
+
alignItems: 'center',
|
|
640
|
+
display: 'flex',
|
|
641
|
+
justifyContent: 'space-between'
|
|
642
|
+
}
|
|
643
|
+
}, title, /*#__PURE__*/React.createElement(Cascader, {
|
|
644
|
+
bordered: false,
|
|
645
|
+
defaultValue: value,
|
|
646
|
+
onChange: onChange,
|
|
647
|
+
options: options,
|
|
648
|
+
style: {
|
|
649
|
+
textAlign: 'right',
|
|
650
|
+
minWidth: 100
|
|
651
|
+
}
|
|
652
|
+
})));
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
SchemaSettings.SwitchItem = function (props) {
|
|
656
|
+
var title = props.title,
|
|
657
|
+
onChange = props.onChange,
|
|
658
|
+
others = _objectWithoutProperties(props, _excluded5);
|
|
659
|
+
|
|
611
660
|
var _useState3 = useState(!!props.checked),
|
|
612
661
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
613
662
|
checked = _useState4[0],
|
|
@@ -635,7 +684,7 @@ SchemaSettings.SwitchItem = function (props) {
|
|
|
635
684
|
|
|
636
685
|
SchemaSettings.PopupItem = function (props) {
|
|
637
686
|
var schema = props.schema,
|
|
638
|
-
others = _objectWithoutProperties(props,
|
|
687
|
+
others = _objectWithoutProperties(props, _excluded6);
|
|
639
688
|
|
|
640
689
|
var _useState5 = useState(false),
|
|
641
690
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
@@ -670,7 +719,7 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/React.memo(function (props) {
|
|
|
670
719
|
schema = props.schema,
|
|
671
720
|
modalTip = props.modalTip,
|
|
672
721
|
components = props.components,
|
|
673
|
-
others = _objectWithoutProperties(props,
|
|
722
|
+
others = _objectWithoutProperties(props, _excluded7);
|
|
674
723
|
|
|
675
724
|
var _useState7 = useState(false),
|
|
676
725
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
@@ -821,7 +870,8 @@ SchemaSettings.ModalItem = function (props) {
|
|
|
821
870
|
onSubmit = props.onSubmit,
|
|
822
871
|
asyncGetInitialValues = props.asyncGetInitialValues,
|
|
823
872
|
initialValues = props.initialValues,
|
|
824
|
-
|
|
873
|
+
width = props.width,
|
|
874
|
+
others = _objectWithoutProperties(props, _excluded8);
|
|
825
875
|
|
|
826
876
|
var options = useContext(SchemaOptionsContext);
|
|
827
877
|
var cm = useContext(CollectionManagerContext);
|
|
@@ -856,7 +906,10 @@ SchemaSettings.ModalItem = function (props) {
|
|
|
856
906
|
|
|
857
907
|
case 7:
|
|
858
908
|
values = _context9.t0;
|
|
859
|
-
FormDialog(
|
|
909
|
+
FormDialog({
|
|
910
|
+
title: schema.title || title,
|
|
911
|
+
width: width
|
|
912
|
+
}, function () {
|
|
860
913
|
return /*#__PURE__*/React.createElement(CollectionManagerContext.Provider, {
|
|
861
914
|
value: cm
|
|
862
915
|
}, /*#__PURE__*/React.createElement(SchemaComponentOptions, {
|
|
@@ -934,4 +987,144 @@ SchemaSettings.BlockTitleItem = function () {
|
|
|
934
987
|
dn.refresh();
|
|
935
988
|
}
|
|
936
989
|
});
|
|
990
|
+
};
|
|
991
|
+
|
|
992
|
+
SchemaSettings.LinkageRules = function (props) {
|
|
993
|
+
var collectionName = props.collectionName;
|
|
994
|
+
var fieldSchema = useFieldSchema();
|
|
995
|
+
|
|
996
|
+
var _useDesignable2 = useDesignable(),
|
|
997
|
+
dn = _useDesignable2.dn;
|
|
998
|
+
|
|
999
|
+
var _useTranslation6 = useTranslation(),
|
|
1000
|
+
t = _useTranslation6.t;
|
|
1001
|
+
|
|
1002
|
+
var _useSchemaTemplateMan4 = useSchemaTemplateManager(),
|
|
1003
|
+
getTemplateById = _useSchemaTemplateMan4.getTemplateById;
|
|
1004
|
+
|
|
1005
|
+
var type = fieldSchema['x-component'] === 'Action' ? 'button' : 'field';
|
|
1006
|
+
var gridSchema = findGridSchema(fieldSchema) || fieldSchema;
|
|
1007
|
+
return /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
|
|
1008
|
+
title: t('Linkage rules'),
|
|
1009
|
+
components: {
|
|
1010
|
+
ArrayCollapse: ArrayCollapse,
|
|
1011
|
+
FormLayout: FormLayout
|
|
1012
|
+
},
|
|
1013
|
+
width: 750,
|
|
1014
|
+
schema: {
|
|
1015
|
+
type: 'object',
|
|
1016
|
+
title: t('Linkage rules'),
|
|
1017
|
+
properties: {
|
|
1018
|
+
fieldReaction: {
|
|
1019
|
+
'x-component': FormLinkageRules,
|
|
1020
|
+
'x-component-props': {
|
|
1021
|
+
useProps: function useProps() {
|
|
1022
|
+
var options = useCollectionFilterOptions(collectionName);
|
|
1023
|
+
return {
|
|
1024
|
+
options: options,
|
|
1025
|
+
defaultValues: (gridSchema === null || gridSchema === void 0 ? void 0 : gridSchema['x-linkage-rules']) || (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-linkage-rules']),
|
|
1026
|
+
type: type,
|
|
1027
|
+
linkageOptions: useLinkageCollectionFieldOptions(collectionName),
|
|
1028
|
+
collectionName: collectionName
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
},
|
|
1035
|
+
onSubmit: function onSubmit(v) {
|
|
1036
|
+
var rules = [];
|
|
1037
|
+
|
|
1038
|
+
var _iterator = _createForOfIteratorHelper(v.fieldReaction.rules),
|
|
1039
|
+
_step;
|
|
1040
|
+
|
|
1041
|
+
try {
|
|
1042
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1043
|
+
var rule = _step.value;
|
|
1044
|
+
rules.push(_.pickBy(rule, _.identity));
|
|
1045
|
+
}
|
|
1046
|
+
} catch (err) {
|
|
1047
|
+
_iterator.e(err);
|
|
1048
|
+
} finally {
|
|
1049
|
+
_iterator.f();
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
var templateId = gridSchema['x-component'] === 'BlockTemplate' && gridSchema['x-component-props'].templateId;
|
|
1053
|
+
var uid = templateId && getTemplateById(templateId).uid || gridSchema['x-uid'];
|
|
1054
|
+
|
|
1055
|
+
var schema = _defineProperty({}, 'x-uid', uid);
|
|
1056
|
+
|
|
1057
|
+
gridSchema['x-linkage-rules'] = rules;
|
|
1058
|
+
schema['x-linkage-rules'] = rules;
|
|
1059
|
+
dn.emit('patch', {
|
|
1060
|
+
schema: schema
|
|
1061
|
+
});
|
|
1062
|
+
dn.refresh();
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
};
|
|
1066
|
+
|
|
1067
|
+
SchemaSettings.EnableChildCollections = function (props) {
|
|
1068
|
+
var collectionName = props.collectionName;
|
|
1069
|
+
var fieldSchema = useFieldSchema();
|
|
1070
|
+
|
|
1071
|
+
var _useDesignable3 = useDesignable(),
|
|
1072
|
+
dn = _useDesignable3.dn;
|
|
1073
|
+
|
|
1074
|
+
var _useTranslation7 = useTranslation(),
|
|
1075
|
+
t = _useTranslation7.t;
|
|
1076
|
+
|
|
1077
|
+
return /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
|
|
1078
|
+
title: t('Enable child collections'),
|
|
1079
|
+
components: {
|
|
1080
|
+
ArrayItems: ArrayItems,
|
|
1081
|
+
FormLayout: FormLayout
|
|
1082
|
+
},
|
|
1083
|
+
width: 600,
|
|
1084
|
+
schema: {
|
|
1085
|
+
type: 'object',
|
|
1086
|
+
title: t('Enable child collections'),
|
|
1087
|
+
properties: {
|
|
1088
|
+
enableChildren: {
|
|
1089
|
+
'x-component': EnableChildCollections,
|
|
1090
|
+
'x-component-props': {
|
|
1091
|
+
useProps: function useProps() {
|
|
1092
|
+
return {
|
|
1093
|
+
defaultValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-enable-children'],
|
|
1094
|
+
collectionName: collectionName
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
},
|
|
1101
|
+
onSubmit: function onSubmit(v) {
|
|
1102
|
+
var enableChildren = [];
|
|
1103
|
+
|
|
1104
|
+
var _iterator2 = _createForOfIteratorHelper(v.enableChildren.childrenCollections),
|
|
1105
|
+
_step2;
|
|
1106
|
+
|
|
1107
|
+
try {
|
|
1108
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1109
|
+
var item = _step2.value;
|
|
1110
|
+
enableChildren.push(_.pickBy(item, _.identity));
|
|
1111
|
+
}
|
|
1112
|
+
} catch (err) {
|
|
1113
|
+
_iterator2.e(err);
|
|
1114
|
+
} finally {
|
|
1115
|
+
_iterator2.f();
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
var uid = fieldSchema['x-uid'];
|
|
1119
|
+
|
|
1120
|
+
var schema = _defineProperty({}, 'x-uid', uid);
|
|
1121
|
+
|
|
1122
|
+
fieldSchema['x-enable-children'] = enableChildren;
|
|
1123
|
+
schema['x-enable-children'] = enableChildren;
|
|
1124
|
+
dn.emit('patch', {
|
|
1125
|
+
schema: schema
|
|
1126
|
+
});
|
|
1127
|
+
dn.refresh();
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
937
1130
|
};
|
|
@@ -25,6 +25,13 @@ export var BlockTemplate = observer(function (props) {
|
|
|
25
25
|
var template = useMemo(function () {
|
|
26
26
|
return getTemplateById(templateId);
|
|
27
27
|
}, [templateId]);
|
|
28
|
+
|
|
29
|
+
var onSuccess = function onSuccess(data) {
|
|
30
|
+
var _data$data;
|
|
31
|
+
|
|
32
|
+
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']) || [];
|
|
33
|
+
};
|
|
34
|
+
|
|
28
35
|
return template ? /*#__PURE__*/React.createElement(BlockTemplateContext.Provider, {
|
|
29
36
|
value: {
|
|
30
37
|
dn: dn,
|
|
@@ -34,6 +41,7 @@ export var BlockTemplate = observer(function (props) {
|
|
|
34
41
|
}
|
|
35
42
|
}, /*#__PURE__*/React.createElement(RemoteSchemaComponent, {
|
|
36
43
|
noForm: true,
|
|
37
|
-
uid: template === null || template === void 0 ? void 0 : template.uid
|
|
44
|
+
uid: template === null || template === void 0 ? void 0 : template.uid,
|
|
45
|
+
onSuccess: onSuccess
|
|
38
46
|
})) : null;
|
|
39
47
|
});
|
package/lib/acl/ACLProvider.js
CHANGED
|
@@ -33,10 +33,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
33
33
|
|
|
34
34
|
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; }
|
|
35
35
|
|
|
36
|
-
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
|
37
|
-
|
|
38
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
39
|
-
|
|
40
36
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
37
|
|
|
42
38
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -362,6 +358,8 @@ var useRecordPkValue = function useRecordPkValue() {
|
|
|
362
358
|
exports.useRecordPkValue = useRecordPkValue;
|
|
363
359
|
|
|
364
360
|
var ACLActionProvider = function ACLActionProvider(props) {
|
|
361
|
+
var _actionPath;
|
|
362
|
+
|
|
365
363
|
var recordPkValue = useRecordPkValue();
|
|
366
364
|
var resource = useResourceName();
|
|
367
365
|
|
|
@@ -375,7 +373,7 @@ var ACLActionProvider = function ACLActionProvider(props) {
|
|
|
375
373
|
actionPath = "".concat(resource, ":").concat(schema['x-action']);
|
|
376
374
|
}
|
|
377
375
|
|
|
378
|
-
if (!actionPath.includes(':')) {
|
|
376
|
+
if (!((_actionPath = actionPath) === null || _actionPath === void 0 ? void 0 : _actionPath.includes(':'))) {
|
|
379
377
|
actionPath = "".concat(resource, ":").concat(actionPath);
|
|
380
378
|
}
|
|
381
379
|
|
|
@@ -418,10 +416,11 @@ var useACLFieldWhitelist = function useACLFieldWhitelist() {
|
|
|
418
416
|
}
|
|
419
417
|
|
|
420
418
|
var _fieldSchema$xCollec = fieldSchema['x-collection-field'].split('.'),
|
|
421
|
-
_fieldSchema$xCollec2 =
|
|
422
|
-
|
|
419
|
+
_fieldSchema$xCollec2 = _slicedToArray(_fieldSchema$xCollec, 2),
|
|
420
|
+
key1 = _fieldSchema$xCollec2[0],
|
|
421
|
+
key2 = _fieldSchema$xCollec2[1];
|
|
423
422
|
|
|
424
|
-
return whitelist === null || whitelist === void 0 ? void 0 : whitelist.includes(
|
|
423
|
+
return whitelist === null || whitelist === void 0 ? void 0 : whitelist.includes(key2 || key1);
|
|
425
424
|
}
|
|
426
425
|
};
|
|
427
426
|
};
|
|
@@ -87,6 +87,12 @@ var APIClient = /*#__PURE__*/function (_APIClientSDK) {
|
|
|
87
87
|
value: function interceptors() {
|
|
88
88
|
this.axios.interceptors.request.use(function (config) {
|
|
89
89
|
config.headers['X-With-ACL-Meta'] = true;
|
|
90
|
+
var match = location.pathname.match(/^\/apps\/([^/]*)\//);
|
|
91
|
+
|
|
92
|
+
if (match) {
|
|
93
|
+
config.headers['X-App'] = match[1];
|
|
94
|
+
}
|
|
95
|
+
|
|
90
96
|
return config;
|
|
91
97
|
});
|
|
92
98
|
|
|
@@ -31,7 +31,7 @@ var _SharedFilterProvider = require("./SharedFilterProvider");
|
|
|
31
31
|
|
|
32
32
|
var _excluded = ["title", "to"];
|
|
33
33
|
|
|
34
|
-
var _templateObject, _templateObject2;
|
|
34
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
35
35
|
|
|
36
36
|
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); }
|
|
37
37
|
|
|
@@ -59,7 +59,7 @@ var BlockResourceContext = /*#__PURE__*/(0, _react2.createContext)(null);
|
|
|
59
59
|
exports.BlockResourceContext = BlockResourceContext;
|
|
60
60
|
var BlockAssociationContext = /*#__PURE__*/(0, _react2.createContext)(null);
|
|
61
61
|
exports.BlockAssociationContext = BlockAssociationContext;
|
|
62
|
-
var BlockRequestContext = /*#__PURE__*/(0, _react2.createContext)(
|
|
62
|
+
var BlockRequestContext = /*#__PURE__*/(0, _react2.createContext)({});
|
|
63
63
|
exports.BlockRequestContext = BlockRequestContext;
|
|
64
64
|
|
|
65
65
|
var useBlockResource = function useBlockResource() {
|
|
@@ -140,7 +140,7 @@ var useResourceAction = function useResourceAction(props) {
|
|
|
140
140
|
fields = _useCollection.fields;
|
|
141
141
|
|
|
142
142
|
var appends = fields === null || fields === void 0 ? void 0 : fields.filter(function (field) {
|
|
143
|
-
return field.target
|
|
143
|
+
return field.target;
|
|
144
144
|
}).map(function (field) {
|
|
145
145
|
return field.name;
|
|
146
146
|
});
|
|
@@ -264,10 +264,11 @@ var RenderChildrenWithAssociationFilter = function RenderChildrenWithAssociation
|
|
|
264
264
|
|
|
265
265
|
if (associationFilterSchema) {
|
|
266
266
|
return /*#__PURE__*/_react2.default.createElement(Component, _objectSpread({}, field.componentProps), /*#__PURE__*/_react2.default.createElement(_antd.Row, {
|
|
267
|
+
className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n "]))),
|
|
267
268
|
gutter: 16,
|
|
268
269
|
wrap: false
|
|
269
270
|
}, /*#__PURE__*/_react2.default.createElement(_antd.Col, {
|
|
270
|
-
className: (0, _css.css)(
|
|
271
|
+
className: (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 200px;\n flex: 0 0 auto;\n "])))
|
|
271
272
|
}, /*#__PURE__*/_react2.default.createElement(_react.RecursionField, {
|
|
272
273
|
schema: fieldSchema,
|
|
273
274
|
onlyRenderProperties: true,
|
|
@@ -275,14 +276,16 @@ var RenderChildrenWithAssociationFilter = function RenderChildrenWithAssociation
|
|
|
275
276
|
return s['x-component'] === 'AssociationFilter';
|
|
276
277
|
}
|
|
277
278
|
})), /*#__PURE__*/_react2.default.createElement(_antd.Col, {
|
|
278
|
-
className: (0, _css.css)(
|
|
279
|
+
className: (0, _css.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n min-width: 0;\n "])))
|
|
280
|
+
}, /*#__PURE__*/_react2.default.createElement("div", {
|
|
281
|
+
className: (0, _css.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n "])))
|
|
279
282
|
}, /*#__PURE__*/_react2.default.createElement(_react.RecursionField, {
|
|
280
283
|
schema: fieldSchema,
|
|
281
284
|
onlyRenderProperties: true,
|
|
282
285
|
filterProperties: function filterProperties(s) {
|
|
283
286
|
return s['x-component'] !== 'AssociationFilter';
|
|
284
287
|
}
|
|
285
|
-
}))));
|
|
288
|
+
})))));
|
|
286
289
|
}
|
|
287
290
|
|
|
288
291
|
return props.children;
|
|
@@ -85,18 +85,27 @@ var InternalFormBlockProvider = function InternalFormBlockProvider(props) {
|
|
|
85
85
|
|
|
86
86
|
var FormBlockProvider = function FormBlockProvider(props) {
|
|
87
87
|
var record = (0, _recordProvider.useRecord)();
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
var
|
|
91
|
-
getInheritCollections = _useCollectionManager.getInheritCollections;
|
|
92
|
-
|
|
93
|
-
var inheritCollections = getInheritCollections(__tableName);
|
|
88
|
+
var collection = props.collection;
|
|
89
|
+
var __collection = record.__collection;
|
|
90
|
+
var currentCollection = (0, _collectionManager.useCollection)();
|
|
94
91
|
|
|
95
92
|
var _useDesignable = (0, _schemaComponent.useDesignable)(),
|
|
96
93
|
designable = _useDesignable.designable;
|
|
97
94
|
|
|
98
|
-
var
|
|
99
|
-
|
|
95
|
+
var detailFlag = false;
|
|
96
|
+
|
|
97
|
+
if (Object.keys(record).length > 0) {
|
|
98
|
+
detailFlag = true;
|
|
99
|
+
|
|
100
|
+
if (!designable && __collection) {
|
|
101
|
+
detailFlag = __collection === collection;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
var createFlag = currentCollection.name === collection && !Object.keys(record).length || !currentCollection.name;
|
|
106
|
+
return (detailFlag || createFlag) && /*#__PURE__*/_react2.default.createElement(_BlockProvider.BlockProvider, _objectSpread(_objectSpread({}, props), {}, {
|
|
107
|
+
block: 'form'
|
|
108
|
+
}), /*#__PURE__*/_react2.default.createElement(InternalFormBlockProvider, _objectSpread({}, props)));
|
|
100
109
|
};
|
|
101
110
|
|
|
102
111
|
exports.FormBlockProvider = FormBlockProvider;
|
|
@@ -149,7 +149,7 @@ var useAssociationNames = function useAssociationNames(collection) {
|
|
|
149
149
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
150
150
|
var collectionField = _step.value;
|
|
151
151
|
|
|
152
|
-
if (collectionField.target
|
|
152
|
+
if (collectionField.target) {
|
|
153
153
|
associationFields.add(collectionField.name);
|
|
154
154
|
var fields = getCollectionFields(collectionField.target);
|
|
155
155
|
|
|
@@ -1,7 +1,5 @@
|
|
|
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
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -27,6 +25,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
27
25
|
|
|
28
26
|
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; }
|
|
29
27
|
|
|
28
|
+
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); }
|
|
29
|
+
|
|
30
30
|
var SHARED_FILTER_CONDITION;
|
|
31
31
|
exports.SHARED_FILTER_CONDITION = SHARED_FILTER_CONDITION;
|
|
32
32
|
|
|
@@ -37,7 +37,13 @@ exports.SHARED_FILTER_CONDITION = SHARED_FILTER_CONDITION;
|
|
|
37
37
|
|
|
38
38
|
var mergeFilter = function mergeFilter(filters) {
|
|
39
39
|
var op = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '$and';
|
|
40
|
-
var items = filters.filter(
|
|
40
|
+
var items = filters.filter(function (f) {
|
|
41
|
+
if (f && _typeof(f) === 'object' && !Array.isArray(f)) {
|
|
42
|
+
return Object.values(f).filter(function (v) {
|
|
43
|
+
return v !== undefined;
|
|
44
|
+
}).length;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
41
47
|
|
|
42
48
|
if (items.length === 0) {
|
|
43
49
|
return {};
|