@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
|
@@ -96,7 +96,7 @@ var useAssociationNames = function useAssociationNames(collection) {
|
|
|
96
96
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
97
97
|
var collectionField = _step.value;
|
|
98
98
|
|
|
99
|
-
if (collectionField.target
|
|
99
|
+
if (collectionField.target) {
|
|
100
100
|
associationFields.add(collectionField.name);
|
|
101
101
|
var fields = getCollectionFields(collectionField.target);
|
|
102
102
|
|
|
@@ -88,7 +88,7 @@ var useAssociationNames2 = function useAssociationNames2(collection) {
|
|
|
88
88
|
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
89
89
|
|
|
90
90
|
var names = (_getCollectionFields = getCollectionFields(collection)) === null || _getCollectionFields === void 0 ? void 0 : _getCollectionFields.filter(function (field) {
|
|
91
|
-
return field.target
|
|
91
|
+
return field.target;
|
|
92
92
|
}).map(function (field) {
|
|
93
93
|
return field.name;
|
|
94
94
|
});
|
|
@@ -113,7 +113,7 @@ var useAssociationNames = function useAssociationNames(collection) {
|
|
|
113
113
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
114
114
|
var collectionField = _step.value;
|
|
115
115
|
|
|
116
|
-
if (collectionField.target
|
|
116
|
+
if (collectionField.target) {
|
|
117
117
|
associationFields.add(collectionField.name);
|
|
118
118
|
var fields = getCollectionFields(collectionField.target);
|
|
119
119
|
|
|
@@ -15,6 +15,8 @@ var _lodash = require("lodash");
|
|
|
15
15
|
|
|
16
16
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
17
17
|
|
|
18
|
+
var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
19
|
+
|
|
18
20
|
var _reactI18next = require("react-i18next");
|
|
19
21
|
|
|
20
22
|
var _reactRouterDom = require("react-router-dom");
|
|
@@ -43,16 +45,16 @@ var _TableFieldProvider = require("../TableFieldProvider");
|
|
|
43
45
|
|
|
44
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
45
47
|
|
|
48
|
+
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); } }
|
|
49
|
+
|
|
50
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
51
|
+
|
|
46
52
|
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; }
|
|
47
53
|
|
|
48
54
|
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; }
|
|
49
55
|
|
|
50
56
|
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; }
|
|
51
57
|
|
|
52
|
-
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); } }
|
|
53
|
-
|
|
54
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
55
|
-
|
|
56
58
|
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); }
|
|
57
59
|
|
|
58
60
|
var usePickActionProps = function usePickActionProps() {
|
|
@@ -118,6 +120,20 @@ var filterValue = function filterValue(value) {
|
|
|
118
120
|
};
|
|
119
121
|
|
|
120
122
|
function getFormValues(filterByTk, field, form, fieldNames, getField, resource) {
|
|
123
|
+
if (filterByTk) {
|
|
124
|
+
var _field$data;
|
|
125
|
+
|
|
126
|
+
var actionFields = field === null || field === void 0 ? void 0 : (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.activeFields;
|
|
127
|
+
|
|
128
|
+
if (actionFields) {
|
|
129
|
+
var keys = Object.keys(form.values).filter(function (key) {
|
|
130
|
+
var f = getField(key);
|
|
131
|
+
return !actionFields.has(key) && ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany'].includes(f === null || f === void 0 ? void 0 : f.type);
|
|
132
|
+
});
|
|
133
|
+
return (0, _omit.default)(_objectSpread({}, form.values), keys);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
121
137
|
return form.values;
|
|
122
138
|
var values = {};
|
|
123
139
|
|
|
@@ -1222,13 +1238,13 @@ var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
|
|
|
1222
1238
|
return {
|
|
1223
1239
|
onClick: function onClick() {
|
|
1224
1240
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17() {
|
|
1225
|
-
var _field$
|
|
1241
|
+
var _field$data2, _field$data2$selected, _field$data3, _service$refresh5;
|
|
1226
1242
|
|
|
1227
1243
|
return regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
1228
1244
|
while (1) {
|
|
1229
1245
|
switch (_context17.prev = _context17.next) {
|
|
1230
1246
|
case 0:
|
|
1231
|
-
if (field === null || field === void 0 ? void 0 : (_field$
|
|
1247
|
+
if (field === null || field === void 0 ? void 0 : (_field$data2 = field.data) === null || _field$data2 === void 0 ? void 0 : (_field$data2$selected = _field$data2.selectedRowKeys) === null || _field$data2$selected === void 0 ? void 0 : _field$data2$selected.length) {
|
|
1232
1248
|
_context17.next = 2;
|
|
1233
1249
|
break;
|
|
1234
1250
|
}
|
|
@@ -1238,7 +1254,7 @@ var useBulkDestroyActionProps = function useBulkDestroyActionProps() {
|
|
|
1238
1254
|
case 2:
|
|
1239
1255
|
_context17.next = 4;
|
|
1240
1256
|
return resource.destroy({
|
|
1241
|
-
filterByTk: (_field$
|
|
1257
|
+
filterByTk: (_field$data3 = field.data) === null || _field$data3 === void 0 ? void 0 : _field$data3.selectedRowKeys
|
|
1242
1258
|
});
|
|
1243
1259
|
|
|
1244
1260
|
case 4:
|
|
@@ -2,3 +2,4 @@ import React from 'react';
|
|
|
2
2
|
import { CollectionManagerOptions } from './types';
|
|
3
3
|
export declare const CollectionManagerProvider: React.FC<CollectionManagerOptions>;
|
|
4
4
|
export declare const RemoteCollectionManagerProvider: (props: any) => JSX.Element;
|
|
5
|
+
export declare const CollectionCategroriesProvider: (props: any) => JSX.Element;
|
|
@@ -5,25 +5,25 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.RemoteCollectionManagerProvider = exports.CollectionManagerProvider = void 0;
|
|
8
|
+
exports.RemoteCollectionManagerProvider = exports.CollectionManagerProvider = exports.CollectionCategroriesProvider = void 0;
|
|
9
9
|
|
|
10
10
|
var _antd = require("antd");
|
|
11
11
|
|
|
12
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
12
|
var _lodash = require("lodash");
|
|
15
13
|
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
16
|
var _apiClient = require("../api-client");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _templates = require("../collection-manager/Configuration/templates");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _CollectionHistoryProvider = require("./CollectionHistoryProvider");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _CollectionManagerSchemaComponentProvider = require("./CollectionManagerSchemaComponentProvider");
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _context3 = require("./context");
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var defaultInterfaces = _interopRequireWildcard(require("./interfaces"));
|
|
27
27
|
|
|
28
28
|
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); }
|
|
29
29
|
|
|
@@ -37,13 +37,21 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
37
37
|
|
|
38
38
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
39
39
|
|
|
40
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
41
|
+
|
|
42
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
43
|
+
|
|
44
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
45
|
+
|
|
46
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
47
|
+
|
|
40
48
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
41
49
|
|
|
42
|
-
function
|
|
50
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
43
51
|
|
|
44
|
-
function
|
|
52
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
45
53
|
|
|
46
|
-
function
|
|
54
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
47
55
|
|
|
48
56
|
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; }
|
|
49
57
|
|
|
@@ -61,13 +69,13 @@ var CollectionManagerProvider = function CollectionManagerProvider(props) {
|
|
|
61
69
|
var defaultTemplates = (0, _lodash.keyBy)((0, _templates.templateOptions)(), function (item) {
|
|
62
70
|
return item.name;
|
|
63
71
|
});
|
|
64
|
-
var ctx = (0, _react.useContext)(
|
|
65
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
72
|
+
var ctx = (0, _react.useContext)(_context3.CollectionManagerContext);
|
|
73
|
+
return /*#__PURE__*/_react.default.createElement(_context3.CollectionManagerContext.Provider, {
|
|
66
74
|
value: _objectSpread(_objectSpread({}, ctx), {}, {
|
|
67
75
|
service: service,
|
|
68
76
|
interfaces: _objectSpread(_objectSpread(_objectSpread({}, defaultInterfaces), ctx.interfaces), interfaces),
|
|
69
77
|
templates: _objectSpread(_objectSpread({}, defaultTemplates), templates),
|
|
70
|
-
collections: collections,
|
|
78
|
+
collections: [].concat(_toConsumableArray(ctx.collections), _toConsumableArray(collections)),
|
|
71
79
|
refreshCM: refreshCM
|
|
72
80
|
})
|
|
73
81
|
}, /*#__PURE__*/_react.default.createElement(_CollectionManagerSchemaComponentProvider.CollectionManagerSchemaComponentProvider, null, props.children));
|
|
@@ -93,7 +101,7 @@ var RemoteCollectionManagerProvider = function RemoteCollectionManagerProvider(p
|
|
|
93
101
|
action: 'list',
|
|
94
102
|
params: {
|
|
95
103
|
paginate: false,
|
|
96
|
-
appends: ['fields', 'fields.uiSchema'],
|
|
104
|
+
appends: ['fields', 'fields.uiSchema', 'category'],
|
|
97
105
|
filter: {// inherit: false,
|
|
98
106
|
},
|
|
99
107
|
sort: ['sort']
|
|
@@ -157,4 +165,61 @@ var RemoteCollectionManagerProvider = function RemoteCollectionManagerProvider(p
|
|
|
157
165
|
}, props));
|
|
158
166
|
};
|
|
159
167
|
|
|
160
|
-
exports.RemoteCollectionManagerProvider = RemoteCollectionManagerProvider;
|
|
168
|
+
exports.RemoteCollectionManagerProvider = RemoteCollectionManagerProvider;
|
|
169
|
+
|
|
170
|
+
var CollectionCategroriesProvider = function CollectionCategroriesProvider(props) {
|
|
171
|
+
var _result$data;
|
|
172
|
+
|
|
173
|
+
var api = (0, _apiClient.useAPIClient)();
|
|
174
|
+
var options = {
|
|
175
|
+
url: 'collectionCategories:list',
|
|
176
|
+
params: {
|
|
177
|
+
paginate: false,
|
|
178
|
+
sort: ['sort']
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
var result = (0, _apiClient.useRequest)(options);
|
|
182
|
+
|
|
183
|
+
if (result.loading) {
|
|
184
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Spin, null);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return /*#__PURE__*/_react.default.createElement(_context3.CollectionCategroriesContext.Provider, {
|
|
188
|
+
value: _objectSpread(_objectSpread({}, result), {}, {
|
|
189
|
+
data: result === null || result === void 0 ? void 0 : (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.data,
|
|
190
|
+
refresh: function () {
|
|
191
|
+
var _refresh = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
192
|
+
var _yield$api$request2, data;
|
|
193
|
+
|
|
194
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
195
|
+
while (1) {
|
|
196
|
+
switch (_context2.prev = _context2.next) {
|
|
197
|
+
case 0:
|
|
198
|
+
_context2.next = 2;
|
|
199
|
+
return api.request(options);
|
|
200
|
+
|
|
201
|
+
case 2:
|
|
202
|
+
_yield$api$request2 = _context2.sent;
|
|
203
|
+
data = _yield$api$request2.data;
|
|
204
|
+
result.mutate(data);
|
|
205
|
+
return _context2.abrupt("return", (data === null || data === void 0 ? void 0 : data.data) || []);
|
|
206
|
+
|
|
207
|
+
case 6:
|
|
208
|
+
case "end":
|
|
209
|
+
return _context2.stop();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}, _callee2);
|
|
213
|
+
}));
|
|
214
|
+
|
|
215
|
+
function refresh() {
|
|
216
|
+
return _refresh.apply(this, arguments);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return refresh;
|
|
220
|
+
}()
|
|
221
|
+
})
|
|
222
|
+
}, props.children);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
exports.CollectionCategroriesProvider = CollectionCategroriesProvider;
|
|
@@ -11,8 +11,6 @@ var _icons = require("@ant-design/icons");
|
|
|
11
11
|
|
|
12
12
|
var _shared = require("@formily/shared");
|
|
13
13
|
|
|
14
|
-
var _antd = require("antd");
|
|
15
|
-
|
|
16
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
15
|
|
|
18
16
|
var _reactI18next = require("react-i18next");
|
|
@@ -25,6 +23,8 @@ var _schemaComponent = require("../schema-component");
|
|
|
25
23
|
|
|
26
24
|
var _Configuration = require("./Configuration");
|
|
27
25
|
|
|
26
|
+
var _CollectionManagerProvider = require("./CollectionManagerProvider");
|
|
27
|
+
|
|
28
28
|
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); }
|
|
29
29
|
|
|
30
30
|
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; }
|
|
@@ -59,31 +59,41 @@ var schema = {
|
|
|
59
59
|
var schema2 = {
|
|
60
60
|
type: 'object',
|
|
61
61
|
properties: _defineProperty({}, (0, _shared.uid)(), {
|
|
62
|
+
'x-decorator': 'CollectionCategroriesProvider',
|
|
62
63
|
'x-component': 'ConfigurationTable'
|
|
63
64
|
})
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
var CollectionManagerPane = function CollectionManagerPane() {
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
68
|
+
return (
|
|
69
|
+
/*#__PURE__*/
|
|
70
|
+
// <Card bordered={false}>
|
|
71
|
+
_react.default.createElement(_schemaComponent.SchemaComponent, {
|
|
72
|
+
schema: schema2,
|
|
73
|
+
components: {
|
|
74
|
+
CollectionCategroriesProvider: _CollectionManagerProvider.CollectionCategroriesProvider,
|
|
75
|
+
ConfigurationTable: _Configuration.ConfigurationTable,
|
|
76
|
+
ConfigurationTabs: _Configuration.ConfigurationTabs,
|
|
77
|
+
AddFieldAction: _Configuration.AddFieldAction,
|
|
78
|
+
AddCollectionField: _Configuration.AddCollectionField,
|
|
79
|
+
AddCollection: _Configuration.AddCollection,
|
|
80
|
+
AddCollectionAction: _Configuration.AddCollectionAction,
|
|
81
|
+
AddCategoryAction: _Configuration.AddCategoryAction,
|
|
82
|
+
AddCategory: _Configuration.AddCategory,
|
|
83
|
+
EditCollection: _Configuration.EditCollection,
|
|
84
|
+
EditCollectionAction: _Configuration.EditCollectionAction,
|
|
85
|
+
EditFieldAction: _Configuration.EditFieldAction,
|
|
86
|
+
EditCollectionField: _Configuration.EditCollectionField,
|
|
87
|
+
OverridingCollectionField: _Configuration.OverridingCollectionField,
|
|
88
|
+
OverridingFieldAction: _Configuration.OverridingFieldAction,
|
|
89
|
+
ViewCollectionField: _Configuration.ViewCollectionField,
|
|
90
|
+
ViewFieldAction: _Configuration.ViewFieldAction,
|
|
91
|
+
EditCategory: _Configuration.EditCategory,
|
|
92
|
+
EditCategoryAction: _Configuration.EditCategoryAction
|
|
93
|
+
}
|
|
94
|
+
}) // </Card>
|
|
95
|
+
|
|
96
|
+
);
|
|
87
97
|
};
|
|
88
98
|
|
|
89
99
|
exports.CollectionManagerPane = CollectionManagerPane;
|
|
@@ -128,12 +138,15 @@ var CollectionManagerShortcut2 = function CollectionManagerShortcut2() {
|
|
|
128
138
|
schema: schema,
|
|
129
139
|
components: {
|
|
130
140
|
ConfigurationTable: _Configuration.ConfigurationTable,
|
|
141
|
+
ConfigurationTabs: _Configuration.ConfigurationTabs,
|
|
131
142
|
AddFieldAction: _Configuration.AddFieldAction,
|
|
132
143
|
EditFieldAction: _Configuration.EditFieldAction,
|
|
133
144
|
OverridingFieldAction: _Configuration.OverridingFieldAction,
|
|
134
145
|
ViewFieldAction: _Configuration.ViewFieldAction,
|
|
135
146
|
AddCollectionAction: _Configuration.AddCollectionAction,
|
|
136
|
-
EditCollectionAction: _Configuration.EditCollectionAction
|
|
147
|
+
EditCollectionAction: _Configuration.EditCollectionAction,
|
|
148
|
+
AddCategoryAction: _Configuration.AddCategoryAction,
|
|
149
|
+
EditCategoryAction: _Configuration.EditCategoryAction
|
|
137
150
|
}
|
|
138
151
|
}));
|
|
139
152
|
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.AddCategoryAction = exports.AddCategory = void 0;
|
|
9
|
+
|
|
10
|
+
var _icons = require("@ant-design/icons");
|
|
11
|
+
|
|
12
|
+
var _react = require("@formily/react");
|
|
13
|
+
|
|
14
|
+
var _lodash = require("lodash");
|
|
15
|
+
|
|
16
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _reactI18next = require("react-i18next");
|
|
19
|
+
|
|
20
|
+
var _apiClient = require("../../api-client");
|
|
21
|
+
|
|
22
|
+
var _schemaComponent = require("../../schema-component");
|
|
23
|
+
|
|
24
|
+
var _actionHooks = require("../action-hooks");
|
|
25
|
+
|
|
26
|
+
var _context2 = require("../context");
|
|
27
|
+
|
|
28
|
+
var components = _interopRequireWildcard(require("./components"));
|
|
29
|
+
|
|
30
|
+
var _collections = require("./schemas/collections");
|
|
31
|
+
|
|
32
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
|
+
|
|
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
|
+
|
|
36
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
37
|
+
|
|
38
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
39
|
+
|
|
40
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
41
|
+
|
|
42
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
43
|
+
|
|
44
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
45
|
+
|
|
46
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
47
|
+
|
|
48
|
+
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; }
|
|
49
|
+
|
|
50
|
+
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; }
|
|
51
|
+
|
|
52
|
+
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; }
|
|
53
|
+
|
|
54
|
+
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
|
+
|
|
56
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
57
|
+
|
|
58
|
+
var useCreateCategry = function useCreateCategry() {
|
|
59
|
+
var form = (0, _react.useForm)();
|
|
60
|
+
var ctx = (0, _schemaComponent.useActionContext)();
|
|
61
|
+
|
|
62
|
+
var _useContext = (0, _react2.useContext)(_context2.CollectionCategroriesContext),
|
|
63
|
+
refresh = _useContext.refresh;
|
|
64
|
+
|
|
65
|
+
var api = (0, _apiClient.useAPIClient)();
|
|
66
|
+
return {
|
|
67
|
+
run: function run() {
|
|
68
|
+
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
69
|
+
var values;
|
|
70
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
71
|
+
while (1) {
|
|
72
|
+
switch (_context.prev = _context.next) {
|
|
73
|
+
case 0:
|
|
74
|
+
_context.next = 2;
|
|
75
|
+
return form.submit();
|
|
76
|
+
|
|
77
|
+
case 2:
|
|
78
|
+
values = (0, _lodash.cloneDeep)(form.values);
|
|
79
|
+
_context.next = 5;
|
|
80
|
+
return api.resource('collectionCategories').create({
|
|
81
|
+
values: _objectSpread({}, values)
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
case 5:
|
|
85
|
+
ctx.setVisible(false);
|
|
86
|
+
_context.next = 8;
|
|
87
|
+
return form.reset();
|
|
88
|
+
|
|
89
|
+
case 8:
|
|
90
|
+
_context.next = 10;
|
|
91
|
+
return refresh();
|
|
92
|
+
|
|
93
|
+
case 10:
|
|
94
|
+
case "end":
|
|
95
|
+
return _context.stop();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}, _callee);
|
|
99
|
+
}))();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
var AddCategory = function AddCategory(props) {
|
|
105
|
+
return /*#__PURE__*/_react2.default.createElement(AddCategoryAction, _objectSpread({}, props));
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
exports.AddCategory = AddCategory;
|
|
109
|
+
|
|
110
|
+
var AddCategoryAction = function AddCategoryAction(props) {
|
|
111
|
+
var scope = props.scope,
|
|
112
|
+
getContainer = props.getContainer,
|
|
113
|
+
children = props.children;
|
|
114
|
+
|
|
115
|
+
var _useState = (0, _react2.useState)(false),
|
|
116
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
117
|
+
visible = _useState2[0],
|
|
118
|
+
setVisible = _useState2[1];
|
|
119
|
+
|
|
120
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
121
|
+
t = _useTranslation.t;
|
|
122
|
+
|
|
123
|
+
return /*#__PURE__*/_react2.default.createElement(_schemaComponent.ActionContext.Provider, {
|
|
124
|
+
value: {
|
|
125
|
+
visible: visible,
|
|
126
|
+
setVisible: setVisible
|
|
127
|
+
}
|
|
128
|
+
}, /*#__PURE__*/_react2.default.createElement("div", {
|
|
129
|
+
onClick: function onClick() {
|
|
130
|
+
return setVisible(true);
|
|
131
|
+
},
|
|
132
|
+
title: t('Add category')
|
|
133
|
+
}, children || /*#__PURE__*/_react2.default.createElement(_icons.PlusOutlined, null)), /*#__PURE__*/_react2.default.createElement(_schemaComponent.SchemaComponent, {
|
|
134
|
+
schema: _collections.collectionCategorySchema,
|
|
135
|
+
components: _objectSpread({}, components),
|
|
136
|
+
scope: _objectSpread({
|
|
137
|
+
getContainer: getContainer,
|
|
138
|
+
useCancelAction: _actionHooks.useCancelAction,
|
|
139
|
+
createOnly: true,
|
|
140
|
+
useCreateCategry: useCreateCategry
|
|
141
|
+
}, scope)
|
|
142
|
+
}));
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
exports.AddCategoryAction = AddCategoryAction;
|
|
@@ -73,7 +73,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
73
73
|
|
|
74
74
|
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; }
|
|
75
75
|
|
|
76
|
-
var getSchema = function getSchema(schema,
|
|
76
|
+
var getSchema = function getSchema(schema, category, compile) {
|
|
77
77
|
if (!schema) {
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
@@ -88,7 +88,8 @@ var getSchema = function getSchema(schema, record, compile) {
|
|
|
88
88
|
|
|
89
89
|
var initialValue = _objectSpread({
|
|
90
90
|
name: "t_".concat((0, _shared.uid)()),
|
|
91
|
-
template: schema.name
|
|
91
|
+
template: schema.name,
|
|
92
|
+
category: category
|
|
92
93
|
}, (0, _lodash.cloneDeep)(schema.default));
|
|
93
94
|
|
|
94
95
|
if (initialValue.reverseField) {
|
|
@@ -373,6 +374,10 @@ var AddCollectionAction = function AddCollectionAction(props) {
|
|
|
373
374
|
key: option.name
|
|
374
375
|
};
|
|
375
376
|
});
|
|
377
|
+
|
|
378
|
+
var _useResourceActionCon2 = (0, _ResourceActionProvider.useResourceActionContext)(),
|
|
379
|
+
category = _useResourceActionCon2.state.category;
|
|
380
|
+
|
|
376
381
|
return /*#__PURE__*/_react2.default.createElement(_recordProvider.RecordProvider, {
|
|
377
382
|
record: record
|
|
378
383
|
}, /*#__PURE__*/_react2.default.createElement(_schemaComponent.ActionContext.Provider, {
|
|
@@ -390,7 +395,7 @@ var AddCollectionAction = function AddCollectionAction(props) {
|
|
|
390
395
|
overflow: 'auto'
|
|
391
396
|
},
|
|
392
397
|
onClick: function onClick(info) {
|
|
393
|
-
var schema = getSchema(getTemplate(info.key),
|
|
398
|
+
var schema = getSchema(getTemplate(info.key), category, compile);
|
|
394
399
|
setSchema(schema);
|
|
395
400
|
setVisible(true);
|
|
396
401
|
},
|
|
@@ -368,6 +368,7 @@ var AddFieldAction = function AddFieldAction(props) {
|
|
|
368
368
|
useCancelAction: _actionHooks.useCancelAction,
|
|
369
369
|
createOnly: true,
|
|
370
370
|
isOverride: false,
|
|
371
|
+
override: false,
|
|
371
372
|
useCreateCollectionField: useCreateCollectionField,
|
|
372
373
|
record: record,
|
|
373
374
|
showReverseFieldConfig: true,
|
|
@@ -25,6 +25,8 @@ var _schemaComponent = require("../../schema-component");
|
|
|
25
25
|
|
|
26
26
|
var _actionHooks = require("../action-hooks");
|
|
27
27
|
|
|
28
|
+
var _context5 = require("../context");
|
|
29
|
+
|
|
28
30
|
var _useCollectionManager4 = require("../hooks/useCollectionManager");
|
|
29
31
|
|
|
30
32
|
var _subTable = require("../sub-table");
|
|
@@ -158,6 +160,7 @@ var ConfigurationTable = function ConfigurationTable() {
|
|
|
158
160
|
var _useCurrentAppInfo = (0, _appInfo.useCurrentAppInfo)(),
|
|
159
161
|
database = _useCurrentAppInfo.data.database;
|
|
160
162
|
|
|
163
|
+
var data = (0, _react2.useContext)(_context5.CollectionCategroriesContext);
|
|
161
164
|
var collectonsRef = (0, _react2.useRef)();
|
|
162
165
|
collectonsRef.current = collections;
|
|
163
166
|
var compile = (0, _schemaComponent.useCompile)();
|
|
@@ -175,9 +178,9 @@ var ConfigurationTable = function ConfigurationTable() {
|
|
|
175
178
|
return _context3.abrupt("return", (_collectonsRef$curren = collectonsRef.current) === null || _collectonsRef$curren === void 0 ? void 0 : _collectonsRef$curren.filter(function (item) {
|
|
176
179
|
return !(item.autoCreate && item.isThrough);
|
|
177
180
|
}).filter(function (item) {
|
|
178
|
-
var _targetScope$template, _targetScope$
|
|
181
|
+
var _targetScope$template, _targetScope$field$pr;
|
|
179
182
|
|
|
180
|
-
return targetScope ? ((_targetScope$template = targetScope['template']) === null || _targetScope$template === void 0 ? void 0 : _targetScope$template.includes(item.template)) || ((_targetScope$
|
|
183
|
+
return targetScope ? ((_targetScope$template = targetScope['template']) === null || _targetScope$template === void 0 ? void 0 : _targetScope$template.includes(item.template)) || ((_targetScope$field$pr = targetScope[field.props.name]) === null || _targetScope$field$pr === void 0 ? void 0 : _targetScope$field$pr.includes(item.name)) : true;
|
|
181
184
|
}).map(function (item) {
|
|
182
185
|
return {
|
|
183
186
|
label: compile(item.title),
|
|
@@ -198,8 +201,34 @@ var ConfigurationTable = function ConfigurationTable() {
|
|
|
198
201
|
};
|
|
199
202
|
}();
|
|
200
203
|
|
|
204
|
+
var loadCategories = /*#__PURE__*/function () {
|
|
205
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
206
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
207
|
+
while (1) {
|
|
208
|
+
switch (_context4.prev = _context4.next) {
|
|
209
|
+
case 0:
|
|
210
|
+
return _context4.abrupt("return", data.data.map(function (item) {
|
|
211
|
+
return {
|
|
212
|
+
label: compile(item.name),
|
|
213
|
+
value: item.id
|
|
214
|
+
};
|
|
215
|
+
}));
|
|
216
|
+
|
|
217
|
+
case 1:
|
|
218
|
+
case "end":
|
|
219
|
+
return _context4.stop();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}, _callee4);
|
|
223
|
+
}));
|
|
224
|
+
|
|
225
|
+
return function loadCategories() {
|
|
226
|
+
return _ref2.apply(this, arguments);
|
|
227
|
+
};
|
|
228
|
+
}();
|
|
229
|
+
|
|
201
230
|
var ctx = (0, _react2.useContext)(_schemaComponent.SchemaComponentContext);
|
|
202
|
-
return /*#__PURE__*/_react2.default.createElement(
|
|
231
|
+
return /*#__PURE__*/_react2.default.createElement(_schemaComponent.SchemaComponentContext.Provider, {
|
|
203
232
|
value: _objectSpread(_objectSpread({}, ctx), {}, {
|
|
204
233
|
designable: false
|
|
205
234
|
})
|
|
@@ -217,13 +246,14 @@ var ConfigurationTable = function ConfigurationTable() {
|
|
|
217
246
|
useSelectedRowKeys: useSelectedRowKeys,
|
|
218
247
|
useAsyncDataSource: useAsyncDataSource,
|
|
219
248
|
loadCollections: loadCollections,
|
|
249
|
+
loadCategories: loadCategories,
|
|
220
250
|
useCurrentFields: useCurrentFields,
|
|
221
251
|
useNewId: useNewId,
|
|
222
252
|
useCancelAction: _actionHooks.useCancelAction,
|
|
223
253
|
interfaces: interfaces,
|
|
224
254
|
enableInherits: (database === null || database === void 0 ? void 0 : database.dialect) === 'postgres'
|
|
225
255
|
}
|
|
226
|
-
}))
|
|
256
|
+
}));
|
|
227
257
|
};
|
|
228
258
|
|
|
229
259
|
exports.ConfigurationTable = ConfigurationTable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ConfigurationTabs: () => JSX.Element;
|