@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
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
+
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
+
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
|
|
15
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
16
|
+
|
|
17
|
+
import { CloseCircleOutlined } from '@ant-design/icons';
|
|
18
|
+
import { css } from '@emotion/css';
|
|
19
|
+
import { observer } from '@formily/react';
|
|
20
|
+
import { TreeSelect } from '@formily/antd';
|
|
21
|
+
import { Select, Space } from 'antd';
|
|
22
|
+
import React, { useContext, useState } from 'react';
|
|
23
|
+
import { useTranslation } from 'react-i18next';
|
|
24
|
+
import { useCompile } from '../..';
|
|
25
|
+
import { RemoveActionContext } from './context';
|
|
26
|
+
import { DynamicComponent } from './DynamicComponent';
|
|
27
|
+
import { useValues } from './useValues';
|
|
28
|
+
import { ActionType } from './type';
|
|
29
|
+
import { ValueDynamicComponent } from './ValueDynamicComponent';
|
|
30
|
+
export var FormFieldLinkageRuleAction = observer(function (props) {
|
|
31
|
+
var value = props.value,
|
|
32
|
+
options = props.options,
|
|
33
|
+
collectionName = props.collectionName;
|
|
34
|
+
|
|
35
|
+
var _useTranslation = useTranslation(),
|
|
36
|
+
t = _useTranslation.t;
|
|
37
|
+
|
|
38
|
+
var compile = useCompile();
|
|
39
|
+
var remove = useContext(RemoveActionContext);
|
|
40
|
+
|
|
41
|
+
var _useValues = useValues(options),
|
|
42
|
+
schema = _useValues.schema,
|
|
43
|
+
fields = _useValues.fields,
|
|
44
|
+
operator = _useValues.operator,
|
|
45
|
+
setDataIndex = _useValues.setDataIndex,
|
|
46
|
+
setOperator = _useValues.setOperator,
|
|
47
|
+
setValue = _useValues.setValue,
|
|
48
|
+
fieldValue = _useValues.value,
|
|
49
|
+
operators = _useValues.operators;
|
|
50
|
+
|
|
51
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
style: {
|
|
53
|
+
marginBottom: 8
|
|
54
|
+
}
|
|
55
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
56
|
+
className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ant-space-item {\n max-width: 95%;\n }\n "])))
|
|
57
|
+
}, /*#__PURE__*/React.createElement(TreeSelect, {
|
|
58
|
+
className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 160px;\n "]))),
|
|
59
|
+
fieldNames: {
|
|
60
|
+
label: 'title',
|
|
61
|
+
value: 'name',
|
|
62
|
+
children: 'children'
|
|
63
|
+
},
|
|
64
|
+
treeCheckable: true,
|
|
65
|
+
value: value === null || value === void 0 ? void 0 : value.targetFields,
|
|
66
|
+
multiple: true,
|
|
67
|
+
allowClear: true,
|
|
68
|
+
treeData: compile(fields),
|
|
69
|
+
onChange: function onChange(value) {
|
|
70
|
+
console.log(value);
|
|
71
|
+
setDataIndex(value);
|
|
72
|
+
},
|
|
73
|
+
placeholder: t('Select Field')
|
|
74
|
+
}), /*#__PURE__*/React.createElement(Select, {
|
|
75
|
+
value: operator,
|
|
76
|
+
className: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n min-width: 120px;\n "]))),
|
|
77
|
+
options: compile(operators),
|
|
78
|
+
onChange: function onChange(value) {
|
|
79
|
+
setOperator(value);
|
|
80
|
+
},
|
|
81
|
+
placeholder: t('action')
|
|
82
|
+
}), [ActionType.Value].includes(operator) && /*#__PURE__*/React.createElement(ValueDynamicComponent, {
|
|
83
|
+
fieldValue: fieldValue,
|
|
84
|
+
schema: schema,
|
|
85
|
+
setValue: setValue,
|
|
86
|
+
collectionName: collectionName
|
|
87
|
+
}), !props.disabled && /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(CloseCircleOutlined, {
|
|
88
|
+
onClick: function onClick() {
|
|
89
|
+
return remove();
|
|
90
|
+
},
|
|
91
|
+
style: {
|
|
92
|
+
color: '#bfbfbf'
|
|
93
|
+
}
|
|
94
|
+
}))));
|
|
95
|
+
});
|
|
96
|
+
export var FormButtonLinkageRuleAction = observer(function (props) {
|
|
97
|
+
var value = props.value,
|
|
98
|
+
options = props.options;
|
|
99
|
+
|
|
100
|
+
var _useTranslation2 = useTranslation(),
|
|
101
|
+
t = _useTranslation2.t;
|
|
102
|
+
|
|
103
|
+
var compile = useCompile();
|
|
104
|
+
|
|
105
|
+
var _useState = useState(false),
|
|
106
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
107
|
+
editFalg = _useState2[0],
|
|
108
|
+
setEditFlag = _useState2[1];
|
|
109
|
+
|
|
110
|
+
var remove = useContext(RemoveActionContext);
|
|
111
|
+
|
|
112
|
+
var _useValues2 = useValues(options),
|
|
113
|
+
schema = _useValues2.schema,
|
|
114
|
+
operator = _useValues2.operator,
|
|
115
|
+
setOperator = _useValues2.setOperator,
|
|
116
|
+
setValue = _useValues2.setValue;
|
|
117
|
+
|
|
118
|
+
var operators = [{
|
|
119
|
+
label: t('Visible'),
|
|
120
|
+
value: ActionType.Visible,
|
|
121
|
+
schema: {}
|
|
122
|
+
}, {
|
|
123
|
+
label: t('Hidden'),
|
|
124
|
+
value: ActionType.Hidden,
|
|
125
|
+
schema: {}
|
|
126
|
+
}, {
|
|
127
|
+
label: t('Disabled'),
|
|
128
|
+
value: ActionType.Disabled,
|
|
129
|
+
schema: {}
|
|
130
|
+
}, {
|
|
131
|
+
label: t('Enabled'),
|
|
132
|
+
value: ActionType.Active,
|
|
133
|
+
schema: {}
|
|
134
|
+
}];
|
|
135
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
136
|
+
style: {
|
|
137
|
+
marginBottom: 8
|
|
138
|
+
}
|
|
139
|
+
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Select, {
|
|
140
|
+
value: operator,
|
|
141
|
+
options: compile(operators),
|
|
142
|
+
onChange: function onChange(value) {
|
|
143
|
+
var flag = [ActionType.Value].includes(value);
|
|
144
|
+
setEditFlag(flag);
|
|
145
|
+
setOperator(value);
|
|
146
|
+
},
|
|
147
|
+
placeholder: t('action')
|
|
148
|
+
}), editFalg && /*#__PURE__*/React.createElement(DynamicComponent, {
|
|
149
|
+
value: value,
|
|
150
|
+
schema: schema,
|
|
151
|
+
onChange: function onChange(value) {
|
|
152
|
+
setValue(value);
|
|
153
|
+
}
|
|
154
|
+
}), !props.disabled && /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(CloseCircleOutlined, {
|
|
155
|
+
onClick: function onClick() {
|
|
156
|
+
return remove();
|
|
157
|
+
},
|
|
158
|
+
style: {
|
|
159
|
+
color: '#bfbfbf'
|
|
160
|
+
}
|
|
161
|
+
}))));
|
|
162
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
import { ArrayField, ObjectField, observer, useField } from '@formily/react';
|
|
8
|
+
import { Space } from 'antd';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { useTranslation } from 'react-i18next';
|
|
11
|
+
import { RemoveActionContext } from './context';
|
|
12
|
+
import { FormButtonLinkageRuleAction, FormFieldLinkageRuleAction } from './LinkageRuleAction';
|
|
13
|
+
export var LinkageRuleActions = observer(function (props) {
|
|
14
|
+
var _field$value;
|
|
15
|
+
|
|
16
|
+
var type = props.type,
|
|
17
|
+
linkageOptions = props.linkageOptions;
|
|
18
|
+
var field = useField();
|
|
19
|
+
return field === null || field === void 0 ? void 0 : (_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value.map(function (item, index) {
|
|
20
|
+
return /*#__PURE__*/React.createElement(RemoveActionContext.Provider, {
|
|
21
|
+
key: index,
|
|
22
|
+
value: function value() {
|
|
23
|
+
return field.remove(index);
|
|
24
|
+
}
|
|
25
|
+
}, /*#__PURE__*/React.createElement(ObjectField, {
|
|
26
|
+
name: index,
|
|
27
|
+
component: [type === 'button' ? FormButtonLinkageRuleAction : FormFieldLinkageRuleAction, _objectSpread(_objectSpread({}, props), {}, {
|
|
28
|
+
options: linkageOptions
|
|
29
|
+
})]
|
|
30
|
+
}));
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
export var LinkageRuleActionGroup = function LinkageRuleActionGroup(props) {
|
|
34
|
+
var _useTranslation = useTranslation(),
|
|
35
|
+
t = _useTranslation.t;
|
|
36
|
+
|
|
37
|
+
var field = useField();
|
|
38
|
+
var logic = 'actions';
|
|
39
|
+
|
|
40
|
+
var _props$useProps = props === null || props === void 0 ? void 0 : props.useProps(),
|
|
41
|
+
type = _props$useProps.type,
|
|
42
|
+
linkageOptions = _props$useProps.linkageOptions,
|
|
43
|
+
collectionName = _props$useProps.collectionName;
|
|
44
|
+
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
style: {
|
|
47
|
+
marginLeft: 10
|
|
48
|
+
}
|
|
49
|
+
}, /*#__PURE__*/React.createElement(ArrayField, {
|
|
50
|
+
name: logic,
|
|
51
|
+
component: [LinkageRuleActions, {
|
|
52
|
+
type: type,
|
|
53
|
+
linkageOptions: linkageOptions,
|
|
54
|
+
collectionName: collectionName
|
|
55
|
+
}],
|
|
56
|
+
disabled: false
|
|
57
|
+
}), /*#__PURE__*/React.createElement(Space, {
|
|
58
|
+
size: 16,
|
|
59
|
+
style: {
|
|
60
|
+
marginTop: 8,
|
|
61
|
+
marginBottom: 8
|
|
62
|
+
}
|
|
63
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
64
|
+
onClick: function onClick() {
|
|
65
|
+
var f = field.query('.actions').take();
|
|
66
|
+
var items = f.value || [];
|
|
67
|
+
items.push({});
|
|
68
|
+
f.value = items;
|
|
69
|
+
}
|
|
70
|
+
}, t('Add property'))));
|
|
71
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ValueDynamicComponent: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
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."); }
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import React, { useState } from 'react';
|
|
14
|
+
import { Input, Select } from 'antd';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { DynamicComponent } from './DynamicComponent';
|
|
17
|
+
var Option = Select.Option;
|
|
18
|
+
import { Variable } from '.././../schema-component';
|
|
19
|
+
import { useVariableOptions } from './Variables';
|
|
20
|
+
export var ValueDynamicComponent = function ValueDynamicComponent(props) {
|
|
21
|
+
var fieldValue = props.fieldValue,
|
|
22
|
+
schema = props.schema,
|
|
23
|
+
setValue = props.setValue,
|
|
24
|
+
collectionName = props.collectionName;
|
|
25
|
+
|
|
26
|
+
var _useState = useState((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.mode) || 'constant'),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
mode = _useState2[0],
|
|
29
|
+
setMode = _useState2[1];
|
|
30
|
+
|
|
31
|
+
var _useTranslation = useTranslation(),
|
|
32
|
+
t = _useTranslation.t;
|
|
33
|
+
|
|
34
|
+
var scope = useVariableOptions(collectionName);
|
|
35
|
+
return /*#__PURE__*/React.createElement(Input.Group, {
|
|
36
|
+
compact: true,
|
|
37
|
+
style: {
|
|
38
|
+
minWidth: 280
|
|
39
|
+
}
|
|
40
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
41
|
+
value: mode,
|
|
42
|
+
style: {
|
|
43
|
+
width: 150
|
|
44
|
+
},
|
|
45
|
+
onChange: function onChange(value) {
|
|
46
|
+
return setMode(value);
|
|
47
|
+
}
|
|
48
|
+
}, /*#__PURE__*/React.createElement(Option, {
|
|
49
|
+
value: "constant"
|
|
50
|
+
}, t('Constant value')), /*#__PURE__*/React.createElement(Option, {
|
|
51
|
+
value: "express"
|
|
52
|
+
}, t('Expression'))), /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
style: {
|
|
54
|
+
minWidth: 150,
|
|
55
|
+
maxWidth: 430
|
|
56
|
+
}
|
|
57
|
+
}, mode === 'constant' ? /*#__PURE__*/React.createElement(DynamicComponent, {
|
|
58
|
+
value: (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.value) || fieldValue,
|
|
59
|
+
schema: schema,
|
|
60
|
+
onChange: function onChange(value) {
|
|
61
|
+
setValue({
|
|
62
|
+
mode: mode,
|
|
63
|
+
value: value
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}) : /*#__PURE__*/React.createElement(Variable.TextArea, {
|
|
67
|
+
value: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.value,
|
|
68
|
+
onChange: function onChange(value) {
|
|
69
|
+
var result = value.replaceAll("".concat(collectionName, "."), '').replaceAll('$system.', '').trim();
|
|
70
|
+
setValue({
|
|
71
|
+
mode: mode,
|
|
72
|
+
value: value,
|
|
73
|
+
result: result
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
scope: scope,
|
|
77
|
+
style: {
|
|
78
|
+
minWidth: 460,
|
|
79
|
+
marginRight: 15
|
|
80
|
+
}
|
|
81
|
+
})));
|
|
82
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
|
|
3
|
+
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."); }
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
|
|
11
|
+
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; }
|
|
12
|
+
|
|
13
|
+
import { useCompile } from '../../schema-component';
|
|
14
|
+
import { useCollectionManager } from '../../collection-manager';
|
|
15
|
+
var supportsType = ['checkbox', 'number', 'percent', 'integer', 'input', 'textarea', 'email', 'phone', 'datetime', 'createdAt', 'updatedAt', 'radioGroup', 'checkboxGroup', 'select', 'multipleSelect', 'oho', 'obo', 'm2o'];
|
|
16
|
+
|
|
17
|
+
var VariableTypes = function VariableTypes(currentCollection) {
|
|
18
|
+
var _useCollectionManager = useCollectionManager(),
|
|
19
|
+
getCollectionFields = _useCollectionManager.getCollectionFields,
|
|
20
|
+
getInterface = _useCollectionManager.getInterface,
|
|
21
|
+
getCollection = _useCollectionManager.getCollection;
|
|
22
|
+
|
|
23
|
+
var collection = getCollection(currentCollection);
|
|
24
|
+
var fields = getCollectionFields(currentCollection);
|
|
25
|
+
return [{
|
|
26
|
+
title: collection.title,
|
|
27
|
+
value: currentCollection,
|
|
28
|
+
options: function options() {
|
|
29
|
+
var field2option = function field2option(field, depth) {
|
|
30
|
+
var _field$uiSchema;
|
|
31
|
+
|
|
32
|
+
if (!field.interface || !supportsType.includes(field.interface)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var fieldInterface = getInterface(field.interface);
|
|
37
|
+
|
|
38
|
+
if (!fieldInterface.filterable) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var _fieldInterface$filte = fieldInterface.filterable,
|
|
43
|
+
nested = _fieldInterface$filte.nested,
|
|
44
|
+
children = _fieldInterface$filte.children;
|
|
45
|
+
var option = {
|
|
46
|
+
key: field.name,
|
|
47
|
+
label: (field === null || field === void 0 ? void 0 : field.title) || ((_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title),
|
|
48
|
+
schema: field === null || field === void 0 ? void 0 : field.uiSchema,
|
|
49
|
+
value: field.name
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
if (field.target && depth > 2) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (depth > 2) {
|
|
57
|
+
return option;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (children === null || children === void 0 ? void 0 : children.length) {
|
|
61
|
+
option['children'] = children;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (nested) {
|
|
65
|
+
var _option$children;
|
|
66
|
+
|
|
67
|
+
var targetFields = getCollectionFields(field.target);
|
|
68
|
+
var options = getOptions(targetFields, depth + 1).filter(Boolean);
|
|
69
|
+
option['children'] = option['children'] || [];
|
|
70
|
+
|
|
71
|
+
(_option$children = option['children']).push.apply(_option$children, _toConsumableArray(options));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return option;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var getOptions = function getOptions(fields, depth) {
|
|
78
|
+
var options = [];
|
|
79
|
+
fields.forEach(function (field) {
|
|
80
|
+
var option = field2option(field, depth);
|
|
81
|
+
|
|
82
|
+
if (option) {
|
|
83
|
+
options.push(option);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
return options;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return getOptions(fields, 1);
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
title: "{{t(\"System variables\")}}",
|
|
93
|
+
value: '$system',
|
|
94
|
+
options: [{
|
|
95
|
+
key: 'now',
|
|
96
|
+
value: 'now',
|
|
97
|
+
label: "{{t(\"Current time\")}}"
|
|
98
|
+
}]
|
|
99
|
+
}];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export function useVariableOptions(collectionName) {
|
|
103
|
+
var compile = useCompile();
|
|
104
|
+
var options = VariableTypes(collectionName).map(function (item) {
|
|
105
|
+
var options = typeof item.options === 'function' ? item.options() : item.options;
|
|
106
|
+
return {
|
|
107
|
+
label: compile(item.title),
|
|
108
|
+
value: item.value,
|
|
109
|
+
key: item.value,
|
|
110
|
+
children: compile(options),
|
|
111
|
+
disabled: options && !options.length
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
return options;
|
|
115
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useLinkageCollectionFieldOptions: (collectionName: string) => any[];
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { useTranslation } from 'react-i18next';
|
|
2
|
+
import { useCollectionManager } from '../../collection-manager';
|
|
3
|
+
import { ActionType } from './type';
|
|
4
|
+
export var useLinkageCollectionFieldOptions = function useLinkageCollectionFieldOptions(collectionName) {
|
|
5
|
+
var _useCollectionManager = useCollectionManager(),
|
|
6
|
+
getCollectionFields = _useCollectionManager.getCollectionFields,
|
|
7
|
+
getInterface = _useCollectionManager.getInterface;
|
|
8
|
+
|
|
9
|
+
var fields = getCollectionFields(collectionName).filter(function (v) {
|
|
10
|
+
return !['id', 'createdAt', 'createdBy', 'updatedAt', 'updatedBy'].includes(v.name);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _useTranslation = useTranslation(),
|
|
14
|
+
t = _useTranslation.t;
|
|
15
|
+
|
|
16
|
+
var operators = [{
|
|
17
|
+
label: t('Visible'),
|
|
18
|
+
value: ActionType.Visible,
|
|
19
|
+
selected: true,
|
|
20
|
+
schema: {}
|
|
21
|
+
}, {
|
|
22
|
+
label: t('Editable'),
|
|
23
|
+
value: ActionType.Editable,
|
|
24
|
+
selected: false,
|
|
25
|
+
schema: {}
|
|
26
|
+
}, {
|
|
27
|
+
label: t('Disabled'),
|
|
28
|
+
value: ActionType.ReadOnly,
|
|
29
|
+
selected: false,
|
|
30
|
+
schema: {}
|
|
31
|
+
}, {
|
|
32
|
+
label: t('Easy reading'),
|
|
33
|
+
value: ActionType.ReadPretty,
|
|
34
|
+
selected: false,
|
|
35
|
+
schema: {}
|
|
36
|
+
}, {
|
|
37
|
+
label: t('Hidden'),
|
|
38
|
+
value: ActionType.None,
|
|
39
|
+
selected: false,
|
|
40
|
+
schema: {}
|
|
41
|
+
}, {
|
|
42
|
+
label: t('Hidden(reserved value)'),
|
|
43
|
+
value: ActionType.Hidden,
|
|
44
|
+
selected: false,
|
|
45
|
+
schema: {}
|
|
46
|
+
}, {
|
|
47
|
+
label: t('Required'),
|
|
48
|
+
value: ActionType.Required,
|
|
49
|
+
selected: false,
|
|
50
|
+
schema: {}
|
|
51
|
+
}, {
|
|
52
|
+
label: t('Not required'),
|
|
53
|
+
value: ActionType.InRequired,
|
|
54
|
+
selected: false,
|
|
55
|
+
schema: {}
|
|
56
|
+
}, {
|
|
57
|
+
label: t('Value'),
|
|
58
|
+
value: ActionType.Value,
|
|
59
|
+
selected: false,
|
|
60
|
+
schema: {}
|
|
61
|
+
}];
|
|
62
|
+
|
|
63
|
+
var field2option = function field2option(field, depth) {
|
|
64
|
+
var _field$uiSchema, _operators$filter;
|
|
65
|
+
|
|
66
|
+
var fieldInterface = getInterface(field.interface);
|
|
67
|
+
|
|
68
|
+
if (!fieldInterface) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
var _ref = (fieldInterface === null || fieldInterface === void 0 ? void 0 : fieldInterface.filterable) || {},
|
|
73
|
+
nested = _ref.nested,
|
|
74
|
+
children = _ref.children;
|
|
75
|
+
|
|
76
|
+
var option = {
|
|
77
|
+
name: field.name,
|
|
78
|
+
title: (field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title) || field.name,
|
|
79
|
+
schema: field === null || field === void 0 ? void 0 : field.uiSchema,
|
|
80
|
+
interface: field.interface,
|
|
81
|
+
target: field.target,
|
|
82
|
+
operators: (operators === null || operators === void 0 ? void 0 : (_operators$filter = operators.filter) === null || _operators$filter === void 0 ? void 0 : _operators$filter.call(operators, function (operator) {
|
|
83
|
+
if (nested || children || ['formula', 'richText', 'sequence'].includes(fieldInterface.name)) {
|
|
84
|
+
return (operator === null || operator === void 0 ? void 0 : operator.value) !== ActionType.Value;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return true;
|
|
88
|
+
})) || []
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
if (field.target && depth > 2) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (depth > 2) {
|
|
96
|
+
return option;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return option;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
var getOptions = function getOptions(fields, depth) {
|
|
103
|
+
var options = [];
|
|
104
|
+
fields.forEach(function (field) {
|
|
105
|
+
var option = field2option(field, depth);
|
|
106
|
+
|
|
107
|
+
if (option) {
|
|
108
|
+
options.push(option);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return options;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
return getOptions(fields, 1);
|
|
115
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ObjectField } from '@formily/core';
|
|
3
|
+
import { Schema } from '@formily/react';
|
|
4
|
+
export interface FilterContextProps {
|
|
5
|
+
field?: ObjectField;
|
|
6
|
+
fieldSchema?: Schema;
|
|
7
|
+
dynamicComponent?: any;
|
|
8
|
+
options?: any[];
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const RemoveActionContext: import("react").Context<any>;
|
|
12
|
+
export declare const FilterContext: import("react").Context<FilterContextProps>;
|
|
13
|
+
export declare const FilterLogicContext: import("react").Context<any>;
|