@nocobase/client 0.9.0-alpha.2 → 0.9.1-alpha.1
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 +4 -7
- package/es/api-client/APIClient.js +6 -0
- package/es/block-provider/BlockProvider.js +9 -6
- package/es/block-provider/FormBlockProvider.js +3 -1
- 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.js +3 -1
- 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 +51 -6
- 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 +22 -15
- package/es/schema-component/antd/action/Action.js +25 -3
- 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 +90 -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/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-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.js +76 -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/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 +0 -1
- package/es/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
- package/es/schema-initializer/buttons/TableActionColumnInitializers.js +1 -3
- 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/utils.js +22 -7
- 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 +153 -26
- package/es/schema-templates/BlockTemplate.js +9 -1
- package/es/system-settings/SystemSettingsShortcut.js +1 -1
- package/lib/acl/ACLProvider.js +4 -7
- package/lib/api-client/APIClient.js +6 -0
- package/lib/block-provider/BlockProvider.js +9 -6
- package/lib/block-provider/FormBlockProvider.js +3 -1
- 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.js +3 -1
- 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 +24 -14
- package/lib/schema-component/antd/action/Action.js +27 -2
- 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 +89 -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/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-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.js +76 -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/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 +0 -1
- package/lib/schema-initializer/buttons/TableActionColumnInitializers.d.ts +1 -0
- package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +3 -1
- 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/utils.js +22 -6
- 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 +176 -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,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ActionType = void 0;
|
|
7
|
+
var ActionType;
|
|
8
|
+
exports.ActionType = ActionType;
|
|
9
|
+
|
|
10
|
+
(function (ActionType) {
|
|
11
|
+
ActionType["Visible"] = "visible";
|
|
12
|
+
ActionType["Editable"] = "editable";
|
|
13
|
+
ActionType["ReadOnly"] = "disabled";
|
|
14
|
+
ActionType["ReadPretty"] = "readPretty";
|
|
15
|
+
ActionType["None"] = "none";
|
|
16
|
+
ActionType["Hidden"] = "hidden";
|
|
17
|
+
ActionType["Required"] = "required";
|
|
18
|
+
ActionType["InRequired"] = "notRequired";
|
|
19
|
+
ActionType["Disabled"] = "disabled";
|
|
20
|
+
ActionType["Value"] = "value";
|
|
21
|
+
ActionType["Active"] = "enabled";
|
|
22
|
+
})(ActionType || (exports.ActionType = ActionType = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useValues: (options: any) => any;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useValues = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("@formily/react");
|
|
9
|
+
|
|
10
|
+
var _react2 = require("react");
|
|
11
|
+
|
|
12
|
+
var _context = require("./context");
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
var findOption = function findOption() {
|
|
21
|
+
var _dataIndex$forEach;
|
|
22
|
+
|
|
23
|
+
var dataIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
24
|
+
var options = arguments.length > 1 ? arguments[1] : undefined;
|
|
25
|
+
var items = options;
|
|
26
|
+
var option;
|
|
27
|
+
dataIndex === null || dataIndex === void 0 ? void 0 : (_dataIndex$forEach = dataIndex.forEach) === null || _dataIndex$forEach === void 0 ? void 0 : _dataIndex$forEach.call(dataIndex, function (name, index) {
|
|
28
|
+
var item = items.find(function (v) {
|
|
29
|
+
return v.name === name;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (item) {
|
|
33
|
+
option = item;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
items = (item === null || item === void 0 ? void 0 : item.children) || [];
|
|
37
|
+
});
|
|
38
|
+
return option;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var useValues = function useValues(options) {
|
|
42
|
+
var field = (0, _react.useField)();
|
|
43
|
+
var logic = (0, _react2.useContext)(_context.FilterLogicContext);
|
|
44
|
+
|
|
45
|
+
var value2data = function value2data() {
|
|
46
|
+
var _field$initialValue;
|
|
47
|
+
|
|
48
|
+
field.data = _objectSpread({}, field.initialValue);
|
|
49
|
+
var dataIndex = (_field$initialValue = field.initialValue) === null || _field$initialValue === void 0 ? void 0 : _field$initialValue.targetFields;
|
|
50
|
+
var option = dataIndex && findOption(dataIndex, options) || {};
|
|
51
|
+
var operators = (option === null || option === void 0 ? void 0 : option.operators) || [];
|
|
52
|
+
field.data.operators = operators;
|
|
53
|
+
field.data.schema = option === null || option === void 0 ? void 0 : option.schema;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
(0, _react2.useEffect)(value2data, [logic]);
|
|
57
|
+
return _objectSpread(_objectSpread({
|
|
58
|
+
fields: options
|
|
59
|
+
}, field.data), {}, {
|
|
60
|
+
setDataIndex: function setDataIndex(dataIndex) {
|
|
61
|
+
var option = findOption(dataIndex, options);
|
|
62
|
+
field.data = field.data || {};
|
|
63
|
+
var operators = option === null || option === void 0 ? void 0 : option.operators;
|
|
64
|
+
field.data.operators = operators === null || operators === void 0 ? void 0 : operators.filter(function (v) {
|
|
65
|
+
// if (dataIndex.length > 1) {
|
|
66
|
+
// return v.value !== 'value';
|
|
67
|
+
// }
|
|
68
|
+
return true;
|
|
69
|
+
});
|
|
70
|
+
field.data.schema = option === null || option === void 0 ? void 0 : option.schema;
|
|
71
|
+
field.value = field.value || [];
|
|
72
|
+
field.data.operator = undefined;
|
|
73
|
+
field.data.value = undefined;
|
|
74
|
+
field.value = _objectSpread(_objectSpread({}, field.value), {}, {
|
|
75
|
+
targetFields: dataIndex,
|
|
76
|
+
operator: undefined,
|
|
77
|
+
value: undefined
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
setOperator: function setOperator(operatorValue) {
|
|
81
|
+
field.data.operator = operatorValue;
|
|
82
|
+
field.value = _objectSpread(_objectSpread({}, field.value), {}, {
|
|
83
|
+
operator: operatorValue
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
setValue: function setValue(value) {
|
|
87
|
+
field.data.value = value;
|
|
88
|
+
field.value = _objectSpread(_objectSpread({}, field.value), {}, {
|
|
89
|
+
value: value
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
exports.useValues = useValues;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GeneralField } from '@formily/core';
|
|
2
2
|
import { ISchema, Schema } from '@formily/react';
|
|
3
|
-
import { MenuItemProps } from 'antd';
|
|
3
|
+
import { CascaderProps, MenuItemProps } from 'antd';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { Designable } from '..';
|
|
6
6
|
interface SchemaSettingsProps {
|
|
@@ -32,6 +32,9 @@ declare type SchemaSettingsNested = {
|
|
|
32
32
|
schema?: ISchema;
|
|
33
33
|
}>;
|
|
34
34
|
SwitchItem?: React.FC<SwitchItemProps>;
|
|
35
|
+
CascaderItem?: React.FC<CascaderProps<any> & Omit<MenuItemProps, 'title'> & {
|
|
36
|
+
title: any;
|
|
37
|
+
}>;
|
|
35
38
|
[key: string]: any;
|
|
36
39
|
};
|
|
37
40
|
interface SchemaSettingsProviderProps {
|
|
@@ -15,41 +15,48 @@ var _core = require("@formily/core");
|
|
|
15
15
|
|
|
16
16
|
var _react = require("@formily/react");
|
|
17
17
|
|
|
18
|
+
var _lodash = _interopRequireWildcard(require("lodash"));
|
|
19
|
+
|
|
18
20
|
var _shared = require("@formily/shared");
|
|
19
21
|
|
|
20
22
|
var _antd2 = require("antd");
|
|
21
23
|
|
|
22
24
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
23
25
|
|
|
24
|
-
var _lodash = require("lodash");
|
|
25
|
-
|
|
26
26
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
27
27
|
|
|
28
28
|
var _reactDom = require("react-dom");
|
|
29
29
|
|
|
30
30
|
var _reactI18next = require("react-i18next");
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _2 = require("..");
|
|
33
33
|
|
|
34
34
|
var _schemaTemplates = require("../schema-templates");
|
|
35
35
|
|
|
36
36
|
var _BlockTemplate = require("../schema-templates/BlockTemplate");
|
|
37
37
|
|
|
38
|
+
var _LinkageRules = require("./LinkageRules");
|
|
39
|
+
|
|
40
|
+
var _actionHooks = require("./LinkageRules/action-hooks");
|
|
41
|
+
|
|
38
42
|
var _templateObject;
|
|
39
43
|
|
|
40
44
|
var _excluded = ["children", "fieldSchema"],
|
|
41
45
|
_excluded2 = ["title", "dn"],
|
|
42
46
|
_excluded3 = ["title", "options", "value", "onChange"],
|
|
43
|
-
_excluded4 = ["title", "onChange"],
|
|
44
|
-
_excluded5 = ["
|
|
45
|
-
_excluded6 = ["
|
|
46
|
-
_excluded7 = ["
|
|
47
|
+
_excluded4 = ["title", "options", "value", "onChange"],
|
|
48
|
+
_excluded5 = ["title", "onChange"],
|
|
49
|
+
_excluded6 = ["schema"],
|
|
50
|
+
_excluded7 = ["title", "onSubmit", "initialValues", "initialSchema", "schema", "modalTip", "components"],
|
|
51
|
+
_excluded8 = ["hidden", "title", "components", "scope", "effects", "schema", "onSubmit", "asyncGetInitialValues", "initialValues", "width"];
|
|
52
|
+
|
|
53
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
47
54
|
|
|
48
55
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
49
56
|
|
|
50
57
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
51
58
|
|
|
52
|
-
function
|
|
59
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
53
60
|
|
|
54
61
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
55
62
|
|
|
@@ -95,7 +102,7 @@ var SchemaSettingsProvider = function SchemaSettingsProvider(props) {
|
|
|
95
102
|
var _useSchemaTemplateMan = (0, _schemaTemplates.useSchemaTemplateManager)(),
|
|
96
103
|
getTemplateBySchema = _useSchemaTemplateMan.getTemplateBySchema;
|
|
97
104
|
|
|
98
|
-
var _useCollection = (0,
|
|
105
|
+
var _useCollection = (0, _2.useCollection)(),
|
|
99
106
|
name = _useCollection.name;
|
|
100
107
|
|
|
101
108
|
var template = getTemplateBySchema(fieldSchema);
|
|
@@ -150,13 +157,17 @@ SchemaSettings.Template = function (props) {
|
|
|
150
157
|
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
151
158
|
t = _useTranslation.t;
|
|
152
159
|
|
|
160
|
+
var _useCollectionManager = (0, _2.useCollectionManager)(),
|
|
161
|
+
getCollection = _useCollectionManager.getCollection;
|
|
162
|
+
|
|
153
163
|
var _useSchemaSettings = useSchemaSettings(),
|
|
154
164
|
dn = _useSchemaSettings.dn,
|
|
155
165
|
setVisible = _useSchemaSettings.setVisible,
|
|
156
166
|
template = _useSchemaSettings.template,
|
|
157
167
|
fieldSchema = _useSchemaSettings.fieldSchema;
|
|
158
168
|
|
|
159
|
-
var
|
|
169
|
+
var compile = (0, _2.useCompile)();
|
|
170
|
+
var api = (0, _2.useAPIClient)();
|
|
160
171
|
|
|
161
172
|
var _useBlockTemplateCont = (0, _BlockTemplate.useBlockTemplateContext)(),
|
|
162
173
|
tdn = _useBlockTemplateCont.dn;
|
|
@@ -226,18 +237,19 @@ SchemaSettings.Template = function (props) {
|
|
|
226
237
|
return /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, {
|
|
227
238
|
onClick: function () {
|
|
228
239
|
var _onClick2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
229
|
-
var values, sdn, _yield$saveAsTemplate, key;
|
|
240
|
+
var _getCollection, title, values, sdn, _yield$saveAsTemplate, key;
|
|
230
241
|
|
|
231
242
|
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
232
243
|
while (1) {
|
|
233
244
|
switch (_context3.prev = _context3.next) {
|
|
234
245
|
case 0:
|
|
235
246
|
setVisible(false);
|
|
236
|
-
|
|
247
|
+
_getCollection = getCollection(collectionName), title = _getCollection.title;
|
|
248
|
+
_context3.next = 4;
|
|
237
249
|
return (0, _antd.FormDialog)(t('Save as template'), function () {
|
|
238
250
|
return /*#__PURE__*/_react2.default.createElement(_antd.FormLayout, {
|
|
239
251
|
layout: 'vertical'
|
|
240
|
-
}, /*#__PURE__*/_react2.default.createElement(
|
|
252
|
+
}, /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
|
|
241
253
|
components: {
|
|
242
254
|
Input: _antd.Input,
|
|
243
255
|
FormItem: _antd.FormItem
|
|
@@ -248,6 +260,7 @@ SchemaSettings.Template = function (props) {
|
|
|
248
260
|
name: {
|
|
249
261
|
title: t('Template name'),
|
|
250
262
|
required: true,
|
|
263
|
+
default: "".concat(compile(title), "_").concat(t(componentName)),
|
|
251
264
|
'x-decorator': 'FormItem',
|
|
252
265
|
'x-component': 'Input'
|
|
253
266
|
}
|
|
@@ -256,16 +269,16 @@ SchemaSettings.Template = function (props) {
|
|
|
256
269
|
}));
|
|
257
270
|
}).open({});
|
|
258
271
|
|
|
259
|
-
case
|
|
272
|
+
case 4:
|
|
260
273
|
values = _context3.sent;
|
|
261
|
-
sdn = (0,
|
|
274
|
+
sdn = (0, _2.createDesignable)({
|
|
262
275
|
t: t,
|
|
263
276
|
api: api,
|
|
264
277
|
refresh: dn.refresh.bind(dn),
|
|
265
278
|
current: fieldSchema.parent
|
|
266
279
|
});
|
|
267
280
|
sdn.loadAPIClientEvents();
|
|
268
|
-
_context3.next =
|
|
281
|
+
_context3.next = 9;
|
|
269
282
|
return saveAsTemplate({
|
|
270
283
|
collectionName: collectionName,
|
|
271
284
|
resourceName: resourceName,
|
|
@@ -274,7 +287,7 @@ SchemaSettings.Template = function (props) {
|
|
|
274
287
|
uid: fieldSchema['x-uid']
|
|
275
288
|
});
|
|
276
289
|
|
|
277
|
-
case
|
|
290
|
+
case 9:
|
|
278
291
|
_yield$saveAsTemplate = _context3.sent;
|
|
279
292
|
key = _yield$saveAsTemplate.key;
|
|
280
293
|
sdn.removeWithoutEmit(fieldSchema);
|
|
@@ -286,7 +299,7 @@ SchemaSettings.Template = function (props) {
|
|
|
286
299
|
}
|
|
287
300
|
});
|
|
288
301
|
|
|
289
|
-
case
|
|
302
|
+
case 13:
|
|
290
303
|
case "end":
|
|
291
304
|
return _context3.stop();
|
|
292
305
|
}
|
|
@@ -307,7 +320,7 @@ var findGridSchema = function findGridSchema(fieldSchema) {
|
|
|
307
320
|
return fieldSchema.reduceProperties(function (buf, s) {
|
|
308
321
|
if (s['x-component'] === 'FormV2') {
|
|
309
322
|
var f = s.reduceProperties(function (buf, s) {
|
|
310
|
-
if (s['x-component'] === 'Grid') {
|
|
323
|
+
if (s['x-component'] === 'Grid' || s['x-component'] === 'BlockTemplate') {
|
|
311
324
|
return s;
|
|
312
325
|
}
|
|
313
326
|
|
|
@@ -353,13 +366,18 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
353
366
|
var _useTranslation2 = (0, _reactI18next.useTranslation)(),
|
|
354
367
|
t = _useTranslation2.t;
|
|
355
368
|
|
|
369
|
+
var compile = (0, _2.useCompile)();
|
|
370
|
+
|
|
371
|
+
var _useCollectionManager2 = (0, _2.useCollectionManager)(),
|
|
372
|
+
getCollection = _useCollectionManager2.getCollection;
|
|
373
|
+
|
|
356
374
|
var _useSchemaSettings2 = useSchemaSettings(),
|
|
357
375
|
dn = _useSchemaSettings2.dn,
|
|
358
376
|
setVisible = _useSchemaSettings2.setVisible,
|
|
359
377
|
template = _useSchemaSettings2.template,
|
|
360
378
|
fieldSchema = _useSchemaSettings2.fieldSchema;
|
|
361
379
|
|
|
362
|
-
var api = (0,
|
|
380
|
+
var api = (0, _2.useAPIClient)();
|
|
363
381
|
|
|
364
382
|
var _useSchemaTemplateMan3 = (0, _schemaTemplates.useSchemaTemplateManager)(),
|
|
365
383
|
saveAsTemplate = _useSchemaTemplateMan3.saveAsTemplate,
|
|
@@ -384,7 +402,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
384
402
|
case 2:
|
|
385
403
|
schema = _context5.sent;
|
|
386
404
|
templateSchema = findBlockTemplateSchema(fieldSchema);
|
|
387
|
-
sdn = (0,
|
|
405
|
+
sdn = (0, _2.createDesignable)({
|
|
388
406
|
t: t,
|
|
389
407
|
api: api,
|
|
390
408
|
refresh: dn.refresh.bind(dn),
|
|
@@ -447,19 +465,24 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
447
465
|
return /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, {
|
|
448
466
|
onClick: function () {
|
|
449
467
|
var _onClick4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
|
|
450
|
-
var gridSchema, values, sdn, _yield$saveAsTemplate2, key;
|
|
468
|
+
var _getCollection2, title, gridSchema, values, sdn, _yield$saveAsTemplate2, key;
|
|
451
469
|
|
|
452
470
|
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
453
471
|
while (1) {
|
|
454
472
|
switch (_context6.prev = _context6.next) {
|
|
455
473
|
case 0:
|
|
456
474
|
setVisible(false);
|
|
475
|
+
_getCollection2 = getCollection(collectionName), title = _getCollection2.title;
|
|
457
476
|
gridSchema = findGridSchema(fieldSchema);
|
|
458
|
-
_context6.next =
|
|
477
|
+
_context6.next = 5;
|
|
459
478
|
return (0, _antd.FormDialog)(t('Save as template'), function () {
|
|
479
|
+
var componentTitle = {
|
|
480
|
+
FormItem: t('Form'),
|
|
481
|
+
ReadPrettyFormItem: t('Details')
|
|
482
|
+
};
|
|
460
483
|
return /*#__PURE__*/_react2.default.createElement(_antd.FormLayout, {
|
|
461
484
|
layout: 'vertical'
|
|
462
|
-
}, /*#__PURE__*/_react2.default.createElement(
|
|
485
|
+
}, /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
|
|
463
486
|
components: {
|
|
464
487
|
Input: _antd.Input,
|
|
465
488
|
FormItem: _antd.FormItem
|
|
@@ -470,6 +493,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
470
493
|
name: {
|
|
471
494
|
title: t('Template name'),
|
|
472
495
|
required: true,
|
|
496
|
+
default: "".concat(compile(title), "_").concat(componentTitle[componentName] || componentName),
|
|
473
497
|
'x-decorator': 'FormItem',
|
|
474
498
|
'x-component': 'Input'
|
|
475
499
|
}
|
|
@@ -478,16 +502,16 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
478
502
|
}));
|
|
479
503
|
}).open({});
|
|
480
504
|
|
|
481
|
-
case
|
|
505
|
+
case 5:
|
|
482
506
|
values = _context6.sent;
|
|
483
|
-
sdn = (0,
|
|
507
|
+
sdn = (0, _2.createDesignable)({
|
|
484
508
|
t: t,
|
|
485
509
|
api: api,
|
|
486
510
|
refresh: dn.refresh.bind(dn),
|
|
487
511
|
current: gridSchema.parent
|
|
488
512
|
});
|
|
489
513
|
sdn.loadAPIClientEvents();
|
|
490
|
-
_context6.next =
|
|
514
|
+
_context6.next = 10;
|
|
491
515
|
return saveAsTemplate({
|
|
492
516
|
collectionName: collectionName,
|
|
493
517
|
resourceName: resourceName,
|
|
@@ -496,7 +520,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
496
520
|
uid: gridSchema['x-uid']
|
|
497
521
|
});
|
|
498
522
|
|
|
499
|
-
case
|
|
523
|
+
case 10:
|
|
500
524
|
_yield$saveAsTemplate2 = _context6.sent;
|
|
501
525
|
key = _yield$saveAsTemplate2.key;
|
|
502
526
|
sdn.removeWithoutEmit(gridSchema);
|
|
@@ -508,7 +532,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
508
532
|
}
|
|
509
533
|
});
|
|
510
534
|
fieldSchema['x-template-key'] = key;
|
|
511
|
-
_context6.next =
|
|
535
|
+
_context6.next = 17;
|
|
512
536
|
return api.request({
|
|
513
537
|
url: "uiSchemas:patch",
|
|
514
538
|
method: 'post',
|
|
@@ -518,7 +542,7 @@ SchemaSettings.FormItemTemplate = function (props) {
|
|
|
518
542
|
}
|
|
519
543
|
});
|
|
520
544
|
|
|
521
|
-
case
|
|
545
|
+
case 17:
|
|
522
546
|
case "end":
|
|
523
547
|
return _context6.stop();
|
|
524
548
|
}
|
|
@@ -641,11 +665,36 @@ SchemaSettings.SelectItem = function (props) {
|
|
|
641
665
|
})));
|
|
642
666
|
};
|
|
643
667
|
|
|
644
|
-
SchemaSettings.
|
|
668
|
+
SchemaSettings.CascaderItem = function (props) {
|
|
645
669
|
var title = props.title,
|
|
670
|
+
options = props.options,
|
|
671
|
+
value = props.value,
|
|
646
672
|
onChange = props.onChange,
|
|
647
673
|
others = _objectWithoutProperties(props, _excluded4);
|
|
648
674
|
|
|
675
|
+
return /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, _objectSpread({}, others), /*#__PURE__*/_react2.default.createElement("div", {
|
|
676
|
+
style: {
|
|
677
|
+
alignItems: 'center',
|
|
678
|
+
display: 'flex',
|
|
679
|
+
justifyContent: 'space-between'
|
|
680
|
+
}
|
|
681
|
+
}, title, /*#__PURE__*/_react2.default.createElement(_antd2.Cascader, {
|
|
682
|
+
bordered: false,
|
|
683
|
+
defaultValue: value,
|
|
684
|
+
onChange: onChange,
|
|
685
|
+
options: options,
|
|
686
|
+
style: {
|
|
687
|
+
textAlign: 'right',
|
|
688
|
+
minWidth: 100
|
|
689
|
+
}
|
|
690
|
+
})));
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
SchemaSettings.SwitchItem = function (props) {
|
|
694
|
+
var title = props.title,
|
|
695
|
+
onChange = props.onChange,
|
|
696
|
+
others = _objectWithoutProperties(props, _excluded5);
|
|
697
|
+
|
|
649
698
|
var _useState3 = (0, _react2.useState)(!!props.checked),
|
|
650
699
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
651
700
|
checked = _useState4[0],
|
|
@@ -673,7 +722,7 @@ SchemaSettings.SwitchItem = function (props) {
|
|
|
673
722
|
|
|
674
723
|
SchemaSettings.PopupItem = function (props) {
|
|
675
724
|
var schema = props.schema,
|
|
676
|
-
others = _objectWithoutProperties(props,
|
|
725
|
+
others = _objectWithoutProperties(props, _excluded6);
|
|
677
726
|
|
|
678
727
|
var _useState5 = (0, _react2.useState)(false),
|
|
679
728
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
@@ -681,8 +730,8 @@ SchemaSettings.PopupItem = function (props) {
|
|
|
681
730
|
setVisible = _useState6[1];
|
|
682
731
|
|
|
683
732
|
var ctx = (0, _react2.useContext)(SchemaSettingsContext);
|
|
684
|
-
var actx = (0,
|
|
685
|
-
return /*#__PURE__*/_react2.default.createElement(
|
|
733
|
+
var actx = (0, _2.useActionContext)();
|
|
734
|
+
return /*#__PURE__*/_react2.default.createElement(_2.ActionContext.Provider, {
|
|
686
735
|
value: {
|
|
687
736
|
visible: visible,
|
|
688
737
|
setVisible: setVisible
|
|
@@ -693,7 +742,7 @@ SchemaSettings.PopupItem = function (props) {
|
|
|
693
742
|
ctx.setVisible(false);
|
|
694
743
|
setVisible(true);
|
|
695
744
|
}
|
|
696
|
-
}), props.children || props.title), /*#__PURE__*/_react2.default.createElement(
|
|
745
|
+
}), props.children || props.title), /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
|
|
697
746
|
schema: _objectSpread({
|
|
698
747
|
name: (0, _shared.uid)()
|
|
699
748
|
}, schema)
|
|
@@ -708,7 +757,7 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
|
|
|
708
757
|
schema = props.schema,
|
|
709
758
|
modalTip = props.modalTip,
|
|
710
759
|
components = props.components,
|
|
711
|
-
others = _objectWithoutProperties(props,
|
|
760
|
+
others = _objectWithoutProperties(props, _excluded7);
|
|
712
761
|
|
|
713
762
|
var _useState7 = (0, _react2.useState)(false),
|
|
714
763
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
@@ -729,8 +778,8 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
|
|
|
729
778
|
var _useSchemaSettings4 = useSchemaSettings(),
|
|
730
779
|
dn = _useSchemaSettings4.dn;
|
|
731
780
|
|
|
732
|
-
var compile = (0,
|
|
733
|
-
var api = (0,
|
|
781
|
+
var compile = (0, _2.useCompile)();
|
|
782
|
+
var api = (0, _2.useAPIClient)();
|
|
734
783
|
var form = (0, _react2.useMemo)(function () {
|
|
735
784
|
return (0, _core.createForm)({
|
|
736
785
|
initialValues: (0, _lodash.cloneDeep)(initialValues),
|
|
@@ -833,17 +882,17 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
|
|
|
833
882
|
type: "primary",
|
|
834
883
|
onClick: submitHandler
|
|
835
884
|
}, t('Submit')))
|
|
836
|
-
}), /*#__PURE__*/_react2.default.createElement(
|
|
885
|
+
}), /*#__PURE__*/_react2.default.createElement(_2.FormProvider, {
|
|
837
886
|
form: form
|
|
838
887
|
}, /*#__PURE__*/_react2.default.createElement(_antd.FormLayout, {
|
|
839
888
|
layout: 'vertical'
|
|
840
889
|
}, modalTip && /*#__PURE__*/_react2.default.createElement(_antd2.Alert, {
|
|
841
890
|
message: modalTip
|
|
842
|
-
}), modalTip && /*#__PURE__*/_react2.default.createElement("br", null), visible && schemaUid && /*#__PURE__*/_react2.default.createElement(
|
|
891
|
+
}), modalTip && /*#__PURE__*/_react2.default.createElement("br", null), visible && schemaUid && /*#__PURE__*/_react2.default.createElement(_2.RemoteSchemaComponent, {
|
|
843
892
|
noForm: true,
|
|
844
893
|
components: components,
|
|
845
894
|
uid: schemaUid
|
|
846
|
-
}), visible && schema && /*#__PURE__*/_react2.default.createElement(
|
|
895
|
+
}), visible && schema && /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
|
|
847
896
|
components: components,
|
|
848
897
|
schema: schema
|
|
849
898
|
}))))), document.body));
|
|
@@ -859,10 +908,11 @@ SchemaSettings.ModalItem = function (props) {
|
|
|
859
908
|
onSubmit = props.onSubmit,
|
|
860
909
|
asyncGetInitialValues = props.asyncGetInitialValues,
|
|
861
910
|
initialValues = props.initialValues,
|
|
862
|
-
|
|
911
|
+
width = props.width,
|
|
912
|
+
others = _objectWithoutProperties(props, _excluded8);
|
|
863
913
|
|
|
864
914
|
var options = (0, _react2.useContext)(_react.SchemaOptionsContext);
|
|
865
|
-
var cm = (0, _react2.useContext)(
|
|
915
|
+
var cm = (0, _react2.useContext)(_2.CollectionManagerContext);
|
|
866
916
|
|
|
867
917
|
if (hidden) {
|
|
868
918
|
return null;
|
|
@@ -894,15 +944,18 @@ SchemaSettings.ModalItem = function (props) {
|
|
|
894
944
|
|
|
895
945
|
case 7:
|
|
896
946
|
values = _context9.t0;
|
|
897
|
-
(0, _antd.FormDialog)(
|
|
898
|
-
|
|
947
|
+
(0, _antd.FormDialog)({
|
|
948
|
+
title: schema.title || title,
|
|
949
|
+
width: width
|
|
950
|
+
}, function () {
|
|
951
|
+
return /*#__PURE__*/_react2.default.createElement(_2.CollectionManagerContext.Provider, {
|
|
899
952
|
value: cm
|
|
900
|
-
}, /*#__PURE__*/_react2.default.createElement(
|
|
953
|
+
}, /*#__PURE__*/_react2.default.createElement(_2.SchemaComponentOptions, {
|
|
901
954
|
scope: options.scope,
|
|
902
955
|
components: options.components
|
|
903
956
|
}, /*#__PURE__*/_react2.default.createElement(_antd.FormLayout, {
|
|
904
957
|
layout: 'vertical'
|
|
905
|
-
}, /*#__PURE__*/_react2.default.createElement(
|
|
958
|
+
}, /*#__PURE__*/_react2.default.createElement(_2.SchemaComponent, {
|
|
906
959
|
components: components,
|
|
907
960
|
scope: scope,
|
|
908
961
|
schema: schema
|
|
@@ -937,7 +990,7 @@ SchemaSettings.BlockTitleItem = function () {
|
|
|
937
990
|
var field = (0, _react.useField)();
|
|
938
991
|
var fieldSchema = (0, _react.useFieldSchema)();
|
|
939
992
|
|
|
940
|
-
var _useDesignable = (0,
|
|
993
|
+
var _useDesignable = (0, _2.useDesignable)(),
|
|
941
994
|
dn = _useDesignable.dn;
|
|
942
995
|
|
|
943
996
|
var _useTranslation5 = (0, _reactI18next.useTranslation)(),
|
|
@@ -972,4 +1025,79 @@ SchemaSettings.BlockTitleItem = function () {
|
|
|
972
1025
|
dn.refresh();
|
|
973
1026
|
}
|
|
974
1027
|
});
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
SchemaSettings.LinkageRules = function (props) {
|
|
1031
|
+
var collectionName = props.collectionName;
|
|
1032
|
+
var fieldSchema = (0, _react.useFieldSchema)();
|
|
1033
|
+
|
|
1034
|
+
var _useDesignable2 = (0, _2.useDesignable)(),
|
|
1035
|
+
dn = _useDesignable2.dn;
|
|
1036
|
+
|
|
1037
|
+
var _useTranslation6 = (0, _reactI18next.useTranslation)(),
|
|
1038
|
+
t = _useTranslation6.t;
|
|
1039
|
+
|
|
1040
|
+
var _useSchemaTemplateMan4 = (0, _schemaTemplates.useSchemaTemplateManager)(),
|
|
1041
|
+
getTemplateById = _useSchemaTemplateMan4.getTemplateById;
|
|
1042
|
+
|
|
1043
|
+
var type = fieldSchema['x-component'] === 'Action' ? 'button' : 'field';
|
|
1044
|
+
var gridSchema = findGridSchema(fieldSchema) || fieldSchema;
|
|
1045
|
+
return /*#__PURE__*/_react2.default.createElement(SchemaSettings.ModalItem, {
|
|
1046
|
+
title: t('Linkage rules'),
|
|
1047
|
+
components: {
|
|
1048
|
+
ArrayCollapse: _antd.ArrayCollapse,
|
|
1049
|
+
FormLayout: _antd.FormLayout
|
|
1050
|
+
},
|
|
1051
|
+
width: 750,
|
|
1052
|
+
schema: {
|
|
1053
|
+
type: 'object',
|
|
1054
|
+
title: t('Linkage rules'),
|
|
1055
|
+
properties: {
|
|
1056
|
+
fieldReaction: {
|
|
1057
|
+
'x-component': _LinkageRules.FormLinkageRules,
|
|
1058
|
+
'x-component-props': {
|
|
1059
|
+
useProps: function useProps() {
|
|
1060
|
+
var options = (0, _2.useCollectionFilterOptions)(collectionName);
|
|
1061
|
+
return {
|
|
1062
|
+
options: options,
|
|
1063
|
+
defaultValues: (gridSchema === null || gridSchema === void 0 ? void 0 : gridSchema['x-linkage-rules']) || (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-linkage-rules']),
|
|
1064
|
+
type: type,
|
|
1065
|
+
linkageOptions: (0, _actionHooks.useLinkageCollectionFieldOptions)(collectionName),
|
|
1066
|
+
collectionName: collectionName
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
},
|
|
1073
|
+
onSubmit: function onSubmit(v) {
|
|
1074
|
+
var rules = [];
|
|
1075
|
+
|
|
1076
|
+
var _iterator = _createForOfIteratorHelper(v.fieldReaction.rules),
|
|
1077
|
+
_step;
|
|
1078
|
+
|
|
1079
|
+
try {
|
|
1080
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1081
|
+
var rule = _step.value;
|
|
1082
|
+
rules.push(_lodash.default.pickBy(rule, _lodash.default.identity));
|
|
1083
|
+
}
|
|
1084
|
+
} catch (err) {
|
|
1085
|
+
_iterator.e(err);
|
|
1086
|
+
} finally {
|
|
1087
|
+
_iterator.f();
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
var templateId = gridSchema['x-component'] === 'BlockTemplate' && gridSchema['x-component-props'].templateId;
|
|
1091
|
+
var uid = templateId && getTemplateById(templateId).uid || gridSchema['x-uid'];
|
|
1092
|
+
|
|
1093
|
+
var schema = _defineProperty({}, 'x-uid', uid);
|
|
1094
|
+
|
|
1095
|
+
gridSchema['x-linkage-rules'] = rules;
|
|
1096
|
+
schema['x-linkage-rules'] = rules;
|
|
1097
|
+
dn.emit('patch', {
|
|
1098
|
+
schema: schema
|
|
1099
|
+
});
|
|
1100
|
+
dn.refresh();
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
975
1103
|
};
|
|
@@ -46,6 +46,13 @@ var BlockTemplate = (0, _react.observer)(function (props) {
|
|
|
46
46
|
var template = (0, _react2.useMemo)(function () {
|
|
47
47
|
return getTemplateById(templateId);
|
|
48
48
|
}, [templateId]);
|
|
49
|
+
|
|
50
|
+
var onSuccess = function onSuccess(data) {
|
|
51
|
+
var _data$data;
|
|
52
|
+
|
|
53
|
+
fieldSchema['x-linkage-rules'] = (data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data['x-linkage-rules']) || [];
|
|
54
|
+
};
|
|
55
|
+
|
|
49
56
|
return template ? /*#__PURE__*/_react2.default.createElement(BlockTemplateContext.Provider, {
|
|
50
57
|
value: {
|
|
51
58
|
dn: dn,
|
|
@@ -55,7 +62,8 @@ var BlockTemplate = (0, _react.observer)(function (props) {
|
|
|
55
62
|
}
|
|
56
63
|
}, /*#__PURE__*/_react2.default.createElement(_.RemoteSchemaComponent, {
|
|
57
64
|
noForm: true,
|
|
58
|
-
uid: template === null || template === void 0 ? void 0 : template.uid
|
|
65
|
+
uid: template === null || template === void 0 ? void 0 : template.uid,
|
|
66
|
+
onSuccess: onSuccess
|
|
59
67
|
})) : null;
|
|
60
68
|
});
|
|
61
69
|
exports.BlockTemplate = BlockTemplate;
|