@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,161 @@
|
|
|
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
|
+
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
8
|
+
|
|
9
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
+
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
|
|
13
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
14
|
+
|
|
15
|
+
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."); }
|
|
16
|
+
|
|
17
|
+
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); }
|
|
18
|
+
|
|
19
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
20
|
+
|
|
21
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
22
|
+
|
|
23
|
+
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; }
|
|
24
|
+
|
|
25
|
+
import { last, get } from 'lodash';
|
|
26
|
+
import * as functions from '@formulajs/formulajs';
|
|
27
|
+
import { conditionAnalyse } from '../../common/utils/uitls';
|
|
28
|
+
import { ActionType } from '../../../schema-settings/LinkageRules/type';
|
|
29
|
+
|
|
30
|
+
function now() {
|
|
31
|
+
return new Date();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var fnNames = Object.keys(functions).filter(function (key) {
|
|
35
|
+
return key !== 'default';
|
|
36
|
+
});
|
|
37
|
+
var fns = fnNames.map(function (key) {
|
|
38
|
+
return functions[key];
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
function formula(expression) {
|
|
42
|
+
var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
var fn = _construct(Function, _toConsumableArray(fnNames).concat(_toConsumableArray(Object.keys(scope)), ["return ".concat(expression)]));
|
|
46
|
+
|
|
47
|
+
var result = fn.apply(void 0, _toConsumableArray(fns).concat(_toConsumableArray(Object.values(scope))));
|
|
48
|
+
|
|
49
|
+
if (typeof result === 'number') {
|
|
50
|
+
if (Number.isNaN(result) || !Number.isFinite(result)) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return functions.ROUND(result, 9);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (typeof result === 'function') {
|
|
58
|
+
return result();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return result;
|
|
62
|
+
} catch (error) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function evaluate(expression) {
|
|
68
|
+
var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
69
|
+
|
|
70
|
+
var mergeScope = _objectSpread(_objectSpread({}, scope), {}, {
|
|
71
|
+
now: now
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
var exp = expression.trim().replace(/{{\s*([^{}]+)\s*}}/g, function (_, v) {
|
|
75
|
+
var item = get(scope, v);
|
|
76
|
+
var key = v.replace(/\.(\d+)/g, '["$1"]');
|
|
77
|
+
return " ".concat(typeof item === 'function' ? item() : key, " ");
|
|
78
|
+
});
|
|
79
|
+
return formula(exp, mergeScope);
|
|
80
|
+
}
|
|
81
|
+
export var linkageMergeAction = function linkageMergeAction(_ref, field, condition, values) {
|
|
82
|
+
var _field$linkagePropert, _field$initProperty, _field$linkagePropert2, _field$initProperty2, _field$linkagePropert3, _field$initProperty3, _field$linkagePropert4, _field$initProperty4, _field$linkagePropert5, _field$linkagePropert6, _field$linkagePropert7;
|
|
83
|
+
|
|
84
|
+
var operator = _ref.operator,
|
|
85
|
+
value = _ref.value;
|
|
86
|
+
var requiredResult = (field === null || field === void 0 ? void 0 : (_field$linkagePropert = field.linkageProperty) === null || _field$linkagePropert === void 0 ? void 0 : _field$linkagePropert.required) || [(field === null || field === void 0 ? void 0 : (_field$initProperty = field.initProperty) === null || _field$initProperty === void 0 ? void 0 : _field$initProperty.required) || false];
|
|
87
|
+
var displayResult = (field === null || field === void 0 ? void 0 : (_field$linkagePropert2 = field.linkageProperty) === null || _field$linkagePropert2 === void 0 ? void 0 : _field$linkagePropert2.display) || [field === null || field === void 0 ? void 0 : (_field$initProperty2 = field.initProperty) === null || _field$initProperty2 === void 0 ? void 0 : _field$initProperty2.display];
|
|
88
|
+
var patternResult = (field === null || field === void 0 ? void 0 : (_field$linkagePropert3 = field.linkageProperty) === null || _field$linkagePropert3 === void 0 ? void 0 : _field$linkagePropert3.pattern) || [field === null || field === void 0 ? void 0 : (_field$initProperty3 = field.initProperty) === null || _field$initProperty3 === void 0 ? void 0 : _field$initProperty3.pattern];
|
|
89
|
+
var valueResult = (field === null || field === void 0 ? void 0 : (_field$linkagePropert4 = field.linkageProperty) === null || _field$linkagePropert4 === void 0 ? void 0 : _field$linkagePropert4.value) || [field.value || (field === null || field === void 0 ? void 0 : (_field$initProperty4 = field.initProperty) === null || _field$initProperty4 === void 0 ? void 0 : _field$initProperty4.value)];
|
|
90
|
+
|
|
91
|
+
switch (operator) {
|
|
92
|
+
case ActionType.Required:
|
|
93
|
+
if (conditionAnalyse(condition, values)) {
|
|
94
|
+
requiredResult.push(true);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
field.linkageProperty = _objectSpread(_objectSpread({}, field.linkageProperty), {}, {
|
|
98
|
+
required: requiredResult
|
|
99
|
+
});
|
|
100
|
+
field.required = last((_field$linkagePropert5 = field.linkageProperty) === null || _field$linkagePropert5 === void 0 ? void 0 : _field$linkagePropert5.required);
|
|
101
|
+
break;
|
|
102
|
+
|
|
103
|
+
case ActionType.InRequired:
|
|
104
|
+
if (conditionAnalyse(condition, values)) {
|
|
105
|
+
requiredResult.push(false);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
field.linkageProperty = _objectSpread(_objectSpread({}, field.linkageProperty), {}, {
|
|
109
|
+
required: requiredResult
|
|
110
|
+
});
|
|
111
|
+
field.required = last((_field$linkagePropert6 = field.linkageProperty) === null || _field$linkagePropert6 === void 0 ? void 0 : _field$linkagePropert6.required);
|
|
112
|
+
break;
|
|
113
|
+
|
|
114
|
+
case ActionType.Visible:
|
|
115
|
+
case ActionType.None:
|
|
116
|
+
case ActionType.Hidden:
|
|
117
|
+
if (conditionAnalyse(condition, values)) {
|
|
118
|
+
displayResult.push(operator);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
field.linkageProperty = _objectSpread(_objectSpread({}, field.linkageProperty), {}, {
|
|
122
|
+
display: displayResult
|
|
123
|
+
});
|
|
124
|
+
field.display = last((_field$linkagePropert7 = field.linkageProperty) === null || _field$linkagePropert7 === void 0 ? void 0 : _field$linkagePropert7.display);
|
|
125
|
+
break;
|
|
126
|
+
|
|
127
|
+
case ActionType.Editable:
|
|
128
|
+
case ActionType.ReadOnly:
|
|
129
|
+
case ActionType.ReadPretty:
|
|
130
|
+
if (conditionAnalyse(condition, values)) {
|
|
131
|
+
patternResult.push(operator);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
field.linkageProperty = _objectSpread(_objectSpread({}, field.linkageProperty), {}, {
|
|
135
|
+
pattern: patternResult
|
|
136
|
+
});
|
|
137
|
+
field.pattern = last(field.linkageProperty.pattern);
|
|
138
|
+
break;
|
|
139
|
+
|
|
140
|
+
case ActionType.Value:
|
|
141
|
+
if (conditionAnalyse(condition, values)) {
|
|
142
|
+
if ((value === null || value === void 0 ? void 0 : value.mode) === 'express') {
|
|
143
|
+
var result = evaluate(value.result || value.value, values);
|
|
144
|
+
valueResult.push(result);
|
|
145
|
+
} else {
|
|
146
|
+
valueResult.push((value === null || value === void 0 ? void 0 : value.value) || value);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
field.linkageProperty = _objectSpread(_objectSpread({}, field.linkageProperty), {}, {
|
|
151
|
+
value: valueResult
|
|
152
|
+
});
|
|
153
|
+
setTimeout(function () {
|
|
154
|
+
return field.value = last(valueResult) === undefined ? field.value : last(valueResult);
|
|
155
|
+
});
|
|
156
|
+
break;
|
|
157
|
+
|
|
158
|
+
default:
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
@@ -68,8 +68,10 @@ export var G2PlotRenderer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
68
68
|
if (plotRef.current) {
|
|
69
69
|
plotRef.current.update(config);
|
|
70
70
|
} else {
|
|
71
|
+
var _plotRef$current;
|
|
72
|
+
|
|
71
73
|
plotRef.current = new plot(containerRef.current, config);
|
|
72
|
-
plotRef.current.render();
|
|
74
|
+
plotRef === null || plotRef === void 0 ? void 0 : (_plotRef$current = plotRef.current) === null || _plotRef$current === void 0 ? void 0 : _plotRef$current.render();
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
syncRef(plotRef, ref);
|
|
@@ -394,15 +394,20 @@ Grid.Row = observer(function (props) {
|
|
|
394
394
|
})));
|
|
395
395
|
});
|
|
396
396
|
Grid.Col = observer(function (props) {
|
|
397
|
-
var _schema$xComponentP;
|
|
398
|
-
|
|
399
397
|
var _useContext = useContext(GridRowContext),
|
|
400
|
-
cols = _useContext.cols
|
|
398
|
+
_useContext$cols = _useContext.cols,
|
|
399
|
+
cols = _useContext$cols === void 0 ? [] : _useContext$cols;
|
|
401
400
|
|
|
402
401
|
var schema = useFieldSchema();
|
|
403
402
|
var field = useField();
|
|
404
|
-
var
|
|
405
|
-
|
|
403
|
+
var width = '100%';
|
|
404
|
+
|
|
405
|
+
if (cols === null || cols === void 0 ? void 0 : cols.length) {
|
|
406
|
+
var _schema$xComponentP;
|
|
407
|
+
|
|
408
|
+
var w = (schema === null || schema === void 0 ? void 0 : (_schema$xComponentP = schema['x-component-props']) === null || _schema$xComponentP === void 0 ? void 0 : _schema$xComponentP['width']) || 100 / cols.length;
|
|
409
|
+
width = "calc(".concat(w, "% - 24px - 24px / ").concat(cols.length, ")");
|
|
410
|
+
}
|
|
406
411
|
|
|
407
412
|
var _useDroppable3 = useDroppable({
|
|
408
413
|
id: field.address.toString(),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { InputProps, TextAreaProps } from 'antd/lib/input';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { JSONTextAreaProps } from './Json';
|
|
3
4
|
declare type ComposedInput = React.FC<InputProps> & {
|
|
4
5
|
TextArea?: React.FC<TextAreaProps>;
|
|
5
6
|
URL?: React.FC<InputProps>;
|
|
6
|
-
JSON?: React.FC<
|
|
7
|
+
JSON?: React.FC<JSONTextAreaProps>;
|
|
7
8
|
};
|
|
8
9
|
export declare const Input: ComposedInput;
|
|
9
10
|
export default Input;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import React, { Ref } from 'react';
|
|
2
2
|
import { TextAreaProps } from 'antd/lib/input';
|
|
3
|
-
export declare
|
|
3
|
+
export declare type JSONTextAreaProps = TextAreaProps & {
|
|
4
|
+
ref: Ref<any>;
|
|
4
5
|
value: any;
|
|
5
6
|
space: number;
|
|
6
|
-
}
|
|
7
|
+
};
|
|
8
|
+
export declare const Json: React.ForwardRefExoticComponent<React.RefAttributes<React.Ref<any>>>;
|
|
@@ -13,7 +13,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { useField } from '@formily/react';
|
|
15
15
|
import { Input } from 'antd';
|
|
16
|
-
export
|
|
16
|
+
export var Json = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
17
17
|
var value = _ref.value,
|
|
18
18
|
_onChange = _ref.onChange,
|
|
19
19
|
_ref$space = _ref.space,
|
|
@@ -22,6 +22,7 @@ export function Json(_ref) {
|
|
|
22
22
|
|
|
23
23
|
var field = useField();
|
|
24
24
|
return /*#__PURE__*/React.createElement(Input.TextArea, _objectSpread(_objectSpread({}, props), {}, {
|
|
25
|
+
ref: ref,
|
|
25
26
|
defaultValue: value != null ? JSON.stringify(value, null, space) : '',
|
|
26
27
|
onChange: function onChange(ev) {
|
|
27
28
|
try {
|
|
@@ -38,4 +39,4 @@ export function Json(_ref) {
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
}));
|
|
41
|
-
}
|
|
42
|
+
});
|
|
@@ -102,7 +102,7 @@ ReadPretty.JSON = function (props) {
|
|
|
102
102
|
|
|
103
103
|
var prefixCls = usePrefixCls('json', props);
|
|
104
104
|
return /*#__PURE__*/React.createElement("pre", {
|
|
105
|
-
className: cx(prefixCls, props.className, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-bottom: 0;\n "])))),
|
|
105
|
+
className: cx(prefixCls, props.className, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-bottom: 0;\n line-height: 1.5;\n font-size: 90%;\n "])))),
|
|
106
106
|
style: props.style
|
|
107
107
|
}, props.value != null ? JSON.stringify(props.value, null, (_props$space = props.space) !== null && _props$space !== void 0 ? _props$space : 2) : '');
|
|
108
108
|
};
|
|
@@ -10,7 +10,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
10
10
|
|
|
11
11
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
12
|
|
|
13
|
-
import { connect, mapReadPretty } from '@formily/react';
|
|
13
|
+
import { connect, mapReadPretty, useField } from '@formily/react';
|
|
14
14
|
import { InputNumber as AntdNumber } from 'antd';
|
|
15
15
|
import React from 'react';
|
|
16
16
|
import { ReadPretty } from './ReadPretty';
|
|
@@ -18,6 +18,8 @@ export var InputNumber = connect(function (props) {
|
|
|
18
18
|
var onChange = props.onChange,
|
|
19
19
|
others = _objectWithoutProperties(props, _excluded);
|
|
20
20
|
|
|
21
|
+
var field = useField();
|
|
22
|
+
|
|
21
23
|
var handleChange = function handleChange(v) {
|
|
22
24
|
onChange(parseFloat(v));
|
|
23
25
|
};
|
|
@@ -89,13 +89,15 @@ export var useFixedBlockDesignerSetting = function useFixedBlockDesignerSetting(
|
|
|
89
89
|
|
|
90
90
|
var record = useRecord();
|
|
91
91
|
return useMemo(function () {
|
|
92
|
+
var _fieldSchema$xDecora3;
|
|
93
|
+
|
|
92
94
|
if (Object.keys(record).length) {
|
|
93
95
|
return;
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
return /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
|
|
97
99
|
title: t('Fix block'),
|
|
98
|
-
checked: fieldSchema['x-decorator-props']
|
|
100
|
+
checked: (_fieldSchema$xDecora3 = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora3 === void 0 ? void 0 : _fieldSchema$xDecora3.fixedBlock,
|
|
99
101
|
onChange: function () {
|
|
100
102
|
var _onChange = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(fixedBlock) {
|
|
101
103
|
var _schema;
|
|
@@ -30,6 +30,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
30
30
|
|
|
31
31
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
32
32
|
|
|
33
|
+
import { PlusOutlined } from '@ant-design/icons';
|
|
33
34
|
import { css } from '@emotion/css';
|
|
34
35
|
import { FormDialog, FormLayout } from '@formily/antd';
|
|
35
36
|
import { Schema, SchemaOptionsContext, useField, useFieldSchema } from '@formily/react';
|
|
@@ -40,6 +41,8 @@ import { useTranslation } from 'react-i18next';
|
|
|
40
41
|
import { useHistory, useLocation } from 'react-router-dom';
|
|
41
42
|
import { useDocumentTitle } from '../../../document-title';
|
|
42
43
|
import { Icon } from '../../../icon';
|
|
44
|
+
import { DndContext } from '../../common';
|
|
45
|
+
import { SortableItem } from '../../common/sortable-item';
|
|
43
46
|
import { SchemaComponent, SchemaComponentOptions } from '../../core';
|
|
44
47
|
import { useCompile, useDesignable } from '../../hooks';
|
|
45
48
|
import FixedBlock from './FixedBlock';
|
|
@@ -110,7 +113,7 @@ export var Page = function Page(props) {
|
|
|
110
113
|
ghost: false,
|
|
111
114
|
title: hidePageTitle ? undefined : fieldSchema.title || compile(title)
|
|
112
115
|
}, others), {}, {
|
|
113
|
-
footer: enablePageTabs && /*#__PURE__*/React.createElement(Tabs, {
|
|
116
|
+
footer: enablePageTabs && /*#__PURE__*/React.createElement(DndContext, null, /*#__PURE__*/React.createElement(Tabs, {
|
|
114
117
|
size: 'small',
|
|
115
118
|
activeKey: activeKey,
|
|
116
119
|
onTabClick: function onTabClick(activeKey) {
|
|
@@ -122,7 +125,8 @@ export var Page = function Page(props) {
|
|
|
122
125
|
}, 50);
|
|
123
126
|
},
|
|
124
127
|
tabBarExtraContent: dn.designable && /*#__PURE__*/React.createElement(Button, {
|
|
125
|
-
|
|
128
|
+
icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
|
|
129
|
+
className: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-color: rgb(241, 139, 98) !important;\n color: rgb(241, 139, 98) !important;\n "]))),
|
|
126
130
|
type: 'dashed',
|
|
127
131
|
onClick: function () {
|
|
128
132
|
var _onClick = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
@@ -185,10 +189,12 @@ export var Page = function Page(props) {
|
|
|
185
189
|
|
|
186
190
|
return onClick;
|
|
187
191
|
}()
|
|
188
|
-
},
|
|
192
|
+
}, t('Add tab'))
|
|
189
193
|
}, fieldSchema.mapProperties(function (schema) {
|
|
190
194
|
return /*#__PURE__*/React.createElement(Tabs.TabPane, {
|
|
191
|
-
tab: /*#__PURE__*/React.createElement(
|
|
195
|
+
tab: /*#__PURE__*/React.createElement(SortableItem, {
|
|
196
|
+
id: schema.name,
|
|
197
|
+
schema: schema,
|
|
192
198
|
className: classNames('nb-action-link', designerCss, props.className)
|
|
193
199
|
}, schema['x-icon'] && /*#__PURE__*/React.createElement(Icon, {
|
|
194
200
|
style: {
|
|
@@ -200,7 +206,7 @@ export var Page = function Page(props) {
|
|
|
200
206
|
})),
|
|
201
207
|
key: schema.name
|
|
202
208
|
});
|
|
203
|
-
}))
|
|
209
|
+
})))
|
|
204
210
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
205
211
|
style: {
|
|
206
212
|
margin: 24
|
|
@@ -4,12 +4,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
5
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
6
|
|
|
7
|
-
import { MenuOutlined } from '@ant-design/icons';
|
|
7
|
+
import { DragOutlined, MenuOutlined } from '@ant-design/icons';
|
|
8
8
|
import { useField, useFieldSchema } from '@formily/react';
|
|
9
9
|
import { Modal, Space } from 'antd';
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { useTranslation } from 'react-i18next';
|
|
12
|
-
import { useDesignable } from '../..';
|
|
12
|
+
import { DragHandler, useDesignable } from '../..';
|
|
13
13
|
import { SchemaSettings } from '../../../schema-settings';
|
|
14
14
|
export var PageDesigner = function PageDesigner(_ref) {
|
|
15
15
|
var _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xCompon5;
|
|
@@ -137,7 +137,7 @@ export var PageTabDesigner = function PageTabDesigner(_ref3) {
|
|
|
137
137
|
}, /*#__PURE__*/React.createElement(Space, {
|
|
138
138
|
size: 2,
|
|
139
139
|
align: 'center'
|
|
140
|
-
}, /*#__PURE__*/React.createElement(SchemaSettings, {
|
|
140
|
+
}, /*#__PURE__*/React.createElement(DragHandler, null, /*#__PURE__*/React.createElement(DragOutlined, null)), /*#__PURE__*/React.createElement(SchemaSettings, {
|
|
141
141
|
title: /*#__PURE__*/React.createElement(MenuOutlined, {
|
|
142
142
|
style: {
|
|
143
143
|
cursor: 'pointer',
|
|
@@ -32,6 +32,8 @@ var toValue = function toValue(value, placeholder) {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
export var ReadPrettyRecordPicker = observer(function (props) {
|
|
35
|
+
var _collectionField$targ;
|
|
36
|
+
|
|
35
37
|
var ellipsis = props.ellipsis;
|
|
36
38
|
var fieldSchema = useFieldSchema();
|
|
37
39
|
var recordCtx = useRecord();
|
|
@@ -123,7 +125,7 @@ export var ReadPrettyRecordPicker = observer(function (props) {
|
|
|
123
125
|
return collectionField ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BlockAssociationContext.Provider, {
|
|
124
126
|
value: "".concat(collectionField.collectionName, ".").concat(collectionField.name)
|
|
125
127
|
}, /*#__PURE__*/React.createElement(CollectionProvider, {
|
|
126
|
-
name: collectionField.target
|
|
128
|
+
name: (_collectionField$targ = collectionField.target) !== null && _collectionField$targ !== void 0 ? _collectionField$targ : collectionField.targetCollection
|
|
127
129
|
}, /*#__PURE__*/React.createElement(EllipsisWithTooltip, {
|
|
128
130
|
ellipsis: ellipsis,
|
|
129
131
|
ref: ellipsisWithTooltipRef
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { connect, mapReadPretty } from '@formily/react';
|
|
2
2
|
import { InputRecordPicker } from './InputRecordPicker';
|
|
3
3
|
import { ReadPrettyRecordPicker } from './ReadPrettyRecordPicker';
|
|
4
|
-
export var RecordPicker = connect(InputRecordPicker,
|
|
5
|
-
mapReadPretty(ReadPrettyRecordPicker));
|
|
4
|
+
export var RecordPicker = connect(InputRecordPicker, mapReadPretty(ReadPrettyRecordPicker));
|
|
@@ -25,6 +25,13 @@ export var getDatePickerLabels = function getDatePickerLabels(props) {
|
|
|
25
25
|
return isArr(labels) ? labels.join('~') : labels;
|
|
26
26
|
};
|
|
27
27
|
export var getLabelFormatValue = function getLabelFormatValue(labelUiSchema, value) {
|
|
28
|
+
if (Array.isArray(labelUiSchema === null || labelUiSchema === void 0 ? void 0 : labelUiSchema.enum) && value) {
|
|
29
|
+
var opt = labelUiSchema.enum.find(function (option) {
|
|
30
|
+
return option.value === value;
|
|
31
|
+
});
|
|
32
|
+
return opt === null || opt === void 0 ? void 0 : opt.label;
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
switch (labelUiSchema === null || labelUiSchema === void 0 ? void 0 : labelUiSchema['x-component']) {
|
|
29
36
|
case 'DatePicker':
|
|
30
37
|
return getDatePickerLabels(_objectSpread(_objectSpread({}, labelUiSchema === null || labelUiSchema === void 0 ? void 0 : labelUiSchema['x-component-props']), {}, {
|
|
@@ -7,6 +7,7 @@ export declare type RemoteSelectProps<P = any> = SelectProps<P, any> & {
|
|
|
7
7
|
onChange?: (v: any) => void;
|
|
8
8
|
target: string;
|
|
9
9
|
wait?: number;
|
|
10
|
+
manual?: boolean;
|
|
10
11
|
service: ResourceActionOptions<P>;
|
|
11
12
|
};
|
|
12
13
|
export declare const RemoteSelect: React.ForwardRefExoticComponent<Partial<SelectProps<any, any> & {
|
|
@@ -14,6 +15,7 @@ export declare const RemoteSelect: React.ForwardRefExoticComponent<Partial<Selec
|
|
|
14
15
|
onChange?: (v: any) => void;
|
|
15
16
|
target: string;
|
|
16
17
|
wait?: number;
|
|
18
|
+
manual?: boolean;
|
|
17
19
|
service: ResourceActionOptions<any>;
|
|
18
20
|
}> & React.RefAttributes<unknown>> & {
|
|
19
21
|
ReadPretty: typeof ReadPretty;
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
var _excluded = ["fieldNames", "service", "wait"];
|
|
1
|
+
var _excluded = ["fieldNames", "service", "wait", "value", "objectValue", "manual"];
|
|
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); }
|
|
2
4
|
|
|
3
5
|
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); } }
|
|
4
6
|
|
|
5
7
|
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); }); }; }
|
|
6
8
|
|
|
7
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
-
|
|
9
|
-
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."); }
|
|
10
|
-
|
|
11
|
-
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); }
|
|
12
|
-
|
|
13
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
14
|
-
|
|
15
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
|
-
|
|
17
|
-
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; }
|
|
18
|
-
|
|
19
9
|
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; }
|
|
20
10
|
|
|
21
11
|
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; }
|
|
@@ -28,13 +18,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
28
18
|
|
|
29
19
|
import { LoadingOutlined } from '@ant-design/icons';
|
|
30
20
|
import { connect, mapProps, mapReadPretty } from '@formily/react';
|
|
31
|
-
import React, { useMemo } from 'react';
|
|
21
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
32
22
|
import { useRequest } from '../../../api-client';
|
|
23
|
+
import { mergeFilter } from '../../../block-provider/SharedFilterProvider';
|
|
33
24
|
import { useCompile } from '../../hooks';
|
|
34
25
|
import { defaultFieldNames, Select } from '../select';
|
|
35
26
|
import { ReadPretty } from './ReadPretty';
|
|
36
27
|
var InternalRemoteSelect = connect(function (props) {
|
|
37
|
-
var _service$params
|
|
28
|
+
var _service$params;
|
|
38
29
|
|
|
39
30
|
var _props$fieldNames = props.fieldNames,
|
|
40
31
|
fieldNames = _props$fieldNames === void 0 ? {} : _props$fieldNames,
|
|
@@ -42,9 +33,14 @@ var InternalRemoteSelect = connect(function (props) {
|
|
|
42
33
|
service = _props$service === void 0 ? {} : _props$service,
|
|
43
34
|
_props$wait = props.wait,
|
|
44
35
|
wait = _props$wait === void 0 ? 300 : _props$wait,
|
|
36
|
+
value = props.value,
|
|
37
|
+
objectValue = props.objectValue,
|
|
38
|
+
_props$manual = props.manual,
|
|
39
|
+
manual = _props$manual === void 0 ? true : _props$manual,
|
|
45
40
|
others = _objectWithoutProperties(props, _excluded);
|
|
46
41
|
|
|
47
42
|
var compile = useCompile();
|
|
43
|
+
var firstRun = useRef(false);
|
|
48
44
|
|
|
49
45
|
var _useRequest = useRequest(_objectSpread(_objectSpread({
|
|
50
46
|
action: 'list'
|
|
@@ -52,33 +48,43 @@ var InternalRemoteSelect = connect(function (props) {
|
|
|
52
48
|
params: _objectSpread(_objectSpread({
|
|
53
49
|
pageSize: 200
|
|
54
50
|
}, service === null || service === void 0 ? void 0 : service.params), {}, {
|
|
55
|
-
fields: [fieldNames.label, fieldNames.value
|
|
51
|
+
// fields: [fieldNames.label, fieldNames.value, ...(service?.params?.fields || [])],
|
|
56
52
|
// search needs
|
|
57
|
-
filter:
|
|
58
|
-
$and: [service === null || service === void 0 ? void 0 : (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2.filter].filter(Boolean)
|
|
59
|
-
}
|
|
53
|
+
filter: mergeFilter([service === null || service === void 0 ? void 0 : (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params.filter])
|
|
60
54
|
})
|
|
61
55
|
}), {
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
manual: manual,
|
|
57
|
+
debounceWait: wait
|
|
64
58
|
}),
|
|
65
59
|
data = _useRequest.data,
|
|
66
|
-
run = _useRequest.run
|
|
60
|
+
run = _useRequest.run,
|
|
61
|
+
loading = _useRequest.loading;
|
|
62
|
+
|
|
63
|
+
var runDep = useMemo(function () {
|
|
64
|
+
return JSON.stringify({
|
|
65
|
+
service: service,
|
|
66
|
+
fieldNames: fieldNames
|
|
67
|
+
});
|
|
68
|
+
}, [service, fieldNames]);
|
|
69
|
+
useEffect(function () {
|
|
70
|
+
// Lazy load
|
|
71
|
+
if (firstRun.current) {
|
|
72
|
+
run();
|
|
73
|
+
}
|
|
74
|
+
}, [runDep]);
|
|
67
75
|
|
|
68
76
|
var onSearch = /*#__PURE__*/function () {
|
|
69
77
|
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(search) {
|
|
70
|
-
var _service$
|
|
78
|
+
var _service$params2;
|
|
71
79
|
|
|
72
80
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
73
81
|
while (1) {
|
|
74
82
|
switch (_context.prev = _context.next) {
|
|
75
83
|
case 0:
|
|
76
84
|
run({
|
|
77
|
-
filter: {
|
|
78
|
-
$
|
|
79
|
-
|
|
80
|
-
}), service === null || service === void 0 ? void 0 : (_service$params3 = service.params) === null || _service$params3 === void 0 ? void 0 : _service$params3.filter].filter(Boolean)
|
|
81
|
-
}
|
|
85
|
+
filter: mergeFilter([_defineProperty({}, fieldNames.label, {
|
|
86
|
+
$includes: search
|
|
87
|
+
}), service === null || service === void 0 ? void 0 : (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2.filter])
|
|
82
88
|
});
|
|
83
89
|
|
|
84
90
|
case 1:
|
|
@@ -94,25 +100,61 @@ var InternalRemoteSelect = connect(function (props) {
|
|
|
94
100
|
};
|
|
95
101
|
}();
|
|
96
102
|
|
|
103
|
+
var getOptionsByFieldNames = useCallback(function (item) {
|
|
104
|
+
return Object.keys(fieldNames).reduce(function (obj, key) {
|
|
105
|
+
var value = item[fieldNames[key]];
|
|
106
|
+
|
|
107
|
+
if (value) {
|
|
108
|
+
// support hidden, disabled, etc.
|
|
109
|
+
obj[['label', 'value', 'options'].includes(key) ? fieldNames[key] : key] = key === 'label' ? compile(value) : value;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return obj;
|
|
113
|
+
}, {});
|
|
114
|
+
}, [fieldNames]);
|
|
115
|
+
var normalizeOptions = useCallback(function (obj) {
|
|
116
|
+
var _ref3;
|
|
117
|
+
|
|
118
|
+
if (objectValue || _typeof(obj) === 'object') {
|
|
119
|
+
return getOptionsByFieldNames(obj);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return _ref3 = {}, _defineProperty(_ref3, fieldNames.value, obj), _defineProperty(_ref3, fieldNames.label, obj), _ref3;
|
|
123
|
+
}, [objectValue, getOptionsByFieldNames]);
|
|
97
124
|
var options = useMemo(function () {
|
|
98
|
-
var _data$data;
|
|
125
|
+
var _data$data, _data$data2;
|
|
126
|
+
|
|
127
|
+
if (!(data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.length)) {
|
|
128
|
+
return value !== undefined && value !== null ? Array.isArray(value) ? value.map(normalizeOptions) : [normalizeOptions(value)] : [];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return (data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : _data$data2.map(getOptionsByFieldNames)) || [];
|
|
132
|
+
}, [data === null || data === void 0 ? void 0 : data.data, getOptionsByFieldNames, normalizeOptions, value]);
|
|
133
|
+
|
|
134
|
+
var onDropdownVisibleChange = function onDropdownVisibleChange() {
|
|
135
|
+
if (firstRun.current) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
run();
|
|
140
|
+
firstRun.current = true;
|
|
141
|
+
};
|
|
99
142
|
|
|
100
|
-
return (data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.map(function (item) {
|
|
101
|
-
return _objectSpread(_objectSpread({}, item), {}, _defineProperty({}, fieldNames.label, compile(item[fieldNames.label])));
|
|
102
|
-
})) || [];
|
|
103
|
-
}, [data, fieldNames.label]);
|
|
104
143
|
return /*#__PURE__*/React.createElement(Select, _objectSpread(_objectSpread({
|
|
105
144
|
autoClearSearchValue: true,
|
|
106
145
|
filterOption: false,
|
|
107
146
|
filterSort: null,
|
|
108
147
|
fieldNames: fieldNames,
|
|
109
|
-
onSearch: onSearch
|
|
148
|
+
onSearch: onSearch,
|
|
149
|
+
onDropdownVisibleChange: onDropdownVisibleChange,
|
|
150
|
+
objectValue: objectValue,
|
|
151
|
+
value: value
|
|
110
152
|
}, others), {}, {
|
|
153
|
+
loading: loading,
|
|
111
154
|
options: options
|
|
112
155
|
}));
|
|
113
156
|
}, mapProps({
|
|
114
|
-
dataSource: 'options'
|
|
115
|
-
loading: true
|
|
157
|
+
dataSource: 'options'
|
|
116
158
|
}, function (props, field) {
|
|
117
159
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
118
160
|
fieldNames: _objectSpread(_objectSpread(_objectSpread({}, defaultFieldNames), props.fieldNames), field.componentProps.fieldNames),
|