@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,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LinkageRuleActions = exports.LinkageRuleActionGroup = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("@formily/react");
|
|
9
|
+
|
|
10
|
+
var _antd = require("antd");
|
|
11
|
+
|
|
12
|
+
var _react2 = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _reactI18next = require("react-i18next");
|
|
15
|
+
|
|
16
|
+
var _context = require("./context");
|
|
17
|
+
|
|
18
|
+
var _LinkageRuleAction = require("./LinkageRuleAction");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
+
|
|
28
|
+
var LinkageRuleActions = (0, _react.observer)(function (props) {
|
|
29
|
+
var _field$value;
|
|
30
|
+
|
|
31
|
+
var type = props.type,
|
|
32
|
+
linkageOptions = props.linkageOptions;
|
|
33
|
+
var field = (0, _react.useField)();
|
|
34
|
+
return field === null || field === void 0 ? void 0 : (_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value.map(function (item, index) {
|
|
35
|
+
return /*#__PURE__*/_react2.default.createElement(_context.RemoveActionContext.Provider, {
|
|
36
|
+
key: index,
|
|
37
|
+
value: function value() {
|
|
38
|
+
return field.remove(index);
|
|
39
|
+
}
|
|
40
|
+
}, /*#__PURE__*/_react2.default.createElement(_react.ObjectField, {
|
|
41
|
+
name: index,
|
|
42
|
+
component: [type === 'button' ? _LinkageRuleAction.FormButtonLinkageRuleAction : _LinkageRuleAction.FormFieldLinkageRuleAction, _objectSpread(_objectSpread({}, props), {}, {
|
|
43
|
+
options: linkageOptions
|
|
44
|
+
})]
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
exports.LinkageRuleActions = LinkageRuleActions;
|
|
49
|
+
|
|
50
|
+
var LinkageRuleActionGroup = function LinkageRuleActionGroup(props) {
|
|
51
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
52
|
+
t = _useTranslation.t;
|
|
53
|
+
|
|
54
|
+
var field = (0, _react.useField)();
|
|
55
|
+
var logic = 'actions';
|
|
56
|
+
|
|
57
|
+
var _props$useProps = props === null || props === void 0 ? void 0 : props.useProps(),
|
|
58
|
+
type = _props$useProps.type,
|
|
59
|
+
linkageOptions = _props$useProps.linkageOptions,
|
|
60
|
+
collectionName = _props$useProps.collectionName;
|
|
61
|
+
|
|
62
|
+
return /*#__PURE__*/_react2.default.createElement("div", {
|
|
63
|
+
style: {
|
|
64
|
+
marginLeft: 10
|
|
65
|
+
}
|
|
66
|
+
}, /*#__PURE__*/_react2.default.createElement(_react.ArrayField, {
|
|
67
|
+
name: logic,
|
|
68
|
+
component: [LinkageRuleActions, {
|
|
69
|
+
type: type,
|
|
70
|
+
linkageOptions: linkageOptions,
|
|
71
|
+
collectionName: collectionName
|
|
72
|
+
}],
|
|
73
|
+
disabled: false
|
|
74
|
+
}), /*#__PURE__*/_react2.default.createElement(_antd.Space, {
|
|
75
|
+
size: 16,
|
|
76
|
+
style: {
|
|
77
|
+
marginTop: 8,
|
|
78
|
+
marginBottom: 8
|
|
79
|
+
}
|
|
80
|
+
}, /*#__PURE__*/_react2.default.createElement("a", {
|
|
81
|
+
onClick: function onClick() {
|
|
82
|
+
var f = field.query('.actions').take();
|
|
83
|
+
var items = f.value || [];
|
|
84
|
+
items.push({});
|
|
85
|
+
f.value = items;
|
|
86
|
+
}
|
|
87
|
+
}, t('Add property'))));
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
exports.LinkageRuleActionGroup = LinkageRuleActionGroup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ValueDynamicComponent: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ValueDynamicComponent = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _antd = require("antd");
|
|
13
|
+
|
|
14
|
+
var _reactI18next = require("react-i18next");
|
|
15
|
+
|
|
16
|
+
var _DynamicComponent = require("./DynamicComponent");
|
|
17
|
+
|
|
18
|
+
var _schemaComponent = require(".././../schema-component");
|
|
19
|
+
|
|
20
|
+
var _Variables = require("./Variables");
|
|
21
|
+
|
|
22
|
+
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); }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
|
|
28
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
35
|
+
|
|
36
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
+
|
|
38
|
+
var Option = _antd.Select.Option;
|
|
39
|
+
|
|
40
|
+
var ValueDynamicComponent = function ValueDynamicComponent(props) {
|
|
41
|
+
var fieldValue = props.fieldValue,
|
|
42
|
+
schema = props.schema,
|
|
43
|
+
setValue = props.setValue,
|
|
44
|
+
collectionName = props.collectionName;
|
|
45
|
+
|
|
46
|
+
var _useState = (0, _react.useState)((fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.mode) || 'constant'),
|
|
47
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
+
mode = _useState2[0],
|
|
49
|
+
setMode = _useState2[1];
|
|
50
|
+
|
|
51
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
52
|
+
t = _useTranslation.t;
|
|
53
|
+
|
|
54
|
+
var scope = (0, _Variables.useVariableOptions)(collectionName);
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_antd.Input.Group, {
|
|
56
|
+
compact: true,
|
|
57
|
+
style: {
|
|
58
|
+
minWidth: 280
|
|
59
|
+
}
|
|
60
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Select, {
|
|
61
|
+
value: mode,
|
|
62
|
+
style: {
|
|
63
|
+
width: 150
|
|
64
|
+
},
|
|
65
|
+
onChange: function onChange(value) {
|
|
66
|
+
return setMode(value);
|
|
67
|
+
}
|
|
68
|
+
}, /*#__PURE__*/_react.default.createElement(Option, {
|
|
69
|
+
value: "constant"
|
|
70
|
+
}, t('Constant value')), /*#__PURE__*/_react.default.createElement(Option, {
|
|
71
|
+
value: "express"
|
|
72
|
+
}, t('Expression'))), /*#__PURE__*/_react.default.createElement("div", {
|
|
73
|
+
style: {
|
|
74
|
+
minWidth: 150,
|
|
75
|
+
maxWidth: 430
|
|
76
|
+
}
|
|
77
|
+
}, mode === 'constant' ? /*#__PURE__*/_react.default.createElement(_DynamicComponent.DynamicComponent, {
|
|
78
|
+
value: (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.value) || fieldValue,
|
|
79
|
+
schema: schema,
|
|
80
|
+
onChange: function onChange(value) {
|
|
81
|
+
setValue({
|
|
82
|
+
mode: mode,
|
|
83
|
+
value: value
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}) : /*#__PURE__*/_react.default.createElement(_schemaComponent.Variable.TextArea, {
|
|
87
|
+
value: fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.value,
|
|
88
|
+
onChange: function onChange(value) {
|
|
89
|
+
var result = value.replaceAll("".concat(collectionName, "."), '').replaceAll('$system.', '').trim();
|
|
90
|
+
setValue({
|
|
91
|
+
mode: mode,
|
|
92
|
+
value: value,
|
|
93
|
+
result: result
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
scope: scope,
|
|
97
|
+
style: {
|
|
98
|
+
minWidth: 460,
|
|
99
|
+
marginRight: 15
|
|
100
|
+
}
|
|
101
|
+
})));
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
exports.ValueDynamicComponent = ValueDynamicComponent;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useVariableOptions = useVariableOptions;
|
|
7
|
+
|
|
8
|
+
var _schemaComponent = require("../../schema-component");
|
|
9
|
+
|
|
10
|
+
var _collectionManager = require("../../collection-manager");
|
|
11
|
+
|
|
12
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13
|
+
|
|
14
|
+
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."); }
|
|
15
|
+
|
|
16
|
+
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); }
|
|
17
|
+
|
|
18
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
19
|
+
|
|
20
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
var supportsType = ['checkbox', 'number', 'percent', 'integer', 'input', 'textarea', 'email', 'phone', 'datetime', 'createdAt', 'updatedAt', 'radioGroup', 'checkboxGroup', 'select', 'multipleSelect', 'oho', 'obo', 'm2o'];
|
|
25
|
+
|
|
26
|
+
var VariableTypes = function VariableTypes(currentCollection) {
|
|
27
|
+
var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
|
|
28
|
+
getCollectionFields = _useCollectionManager.getCollectionFields,
|
|
29
|
+
getInterface = _useCollectionManager.getInterface,
|
|
30
|
+
getCollection = _useCollectionManager.getCollection;
|
|
31
|
+
|
|
32
|
+
var collection = getCollection(currentCollection);
|
|
33
|
+
var fields = getCollectionFields(currentCollection);
|
|
34
|
+
return [{
|
|
35
|
+
title: collection.title,
|
|
36
|
+
value: currentCollection,
|
|
37
|
+
options: function options() {
|
|
38
|
+
var field2option = function field2option(field, depth) {
|
|
39
|
+
var _field$uiSchema;
|
|
40
|
+
|
|
41
|
+
if (!field.interface || !supportsType.includes(field.interface)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var fieldInterface = getInterface(field.interface);
|
|
46
|
+
|
|
47
|
+
if (!fieldInterface.filterable) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var _fieldInterface$filte = fieldInterface.filterable,
|
|
52
|
+
nested = _fieldInterface$filte.nested,
|
|
53
|
+
children = _fieldInterface$filte.children;
|
|
54
|
+
var option = {
|
|
55
|
+
key: field.name,
|
|
56
|
+
label: (field === null || field === void 0 ? void 0 : field.title) || ((_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title),
|
|
57
|
+
schema: field === null || field === void 0 ? void 0 : field.uiSchema,
|
|
58
|
+
value: field.name
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
if (field.target && depth > 2) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (depth > 2) {
|
|
66
|
+
return option;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (children === null || children === void 0 ? void 0 : children.length) {
|
|
70
|
+
option['children'] = children;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (nested) {
|
|
74
|
+
var _option$children;
|
|
75
|
+
|
|
76
|
+
var targetFields = getCollectionFields(field.target);
|
|
77
|
+
var options = getOptions(targetFields, depth + 1).filter(Boolean);
|
|
78
|
+
option['children'] = option['children'] || [];
|
|
79
|
+
|
|
80
|
+
(_option$children = option['children']).push.apply(_option$children, _toConsumableArray(options));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return option;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
var getOptions = function getOptions(fields, depth) {
|
|
87
|
+
var options = [];
|
|
88
|
+
fields.forEach(function (field) {
|
|
89
|
+
var option = field2option(field, depth);
|
|
90
|
+
|
|
91
|
+
if (option) {
|
|
92
|
+
options.push(option);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return options;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return getOptions(fields, 1);
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
title: "{{t(\"System variables\")}}",
|
|
102
|
+
value: '$system',
|
|
103
|
+
options: [{
|
|
104
|
+
key: 'now',
|
|
105
|
+
value: 'now',
|
|
106
|
+
label: "{{t(\"Current time\")}}"
|
|
107
|
+
}]
|
|
108
|
+
}];
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
function useVariableOptions(collectionName) {
|
|
112
|
+
var compile = (0, _schemaComponent.useCompile)();
|
|
113
|
+
var options = VariableTypes(collectionName).map(function (item) {
|
|
114
|
+
var options = typeof item.options === 'function' ? item.options() : item.options;
|
|
115
|
+
return {
|
|
116
|
+
label: compile(item.title),
|
|
117
|
+
value: item.value,
|
|
118
|
+
key: item.value,
|
|
119
|
+
children: compile(options),
|
|
120
|
+
disabled: options && !options.length
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
return options;
|
|
124
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useLinkageCollectionFieldOptions: (collectionName: string) => any[];
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useLinkageCollectionFieldOptions = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactI18next = require("react-i18next");
|
|
9
|
+
|
|
10
|
+
var _collectionManager = require("../../collection-manager");
|
|
11
|
+
|
|
12
|
+
var _type = require("./type");
|
|
13
|
+
|
|
14
|
+
var useLinkageCollectionFieldOptions = function useLinkageCollectionFieldOptions(collectionName) {
|
|
15
|
+
var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
|
|
16
|
+
getCollectionFields = _useCollectionManager.getCollectionFields,
|
|
17
|
+
getInterface = _useCollectionManager.getInterface;
|
|
18
|
+
|
|
19
|
+
var fields = getCollectionFields(collectionName).filter(function (v) {
|
|
20
|
+
return !['id', 'createdAt', 'createdBy', 'updatedAt', 'updatedBy'].includes(v.name);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
24
|
+
t = _useTranslation.t;
|
|
25
|
+
|
|
26
|
+
var operators = [{
|
|
27
|
+
label: t('Visible'),
|
|
28
|
+
value: _type.ActionType.Visible,
|
|
29
|
+
selected: true,
|
|
30
|
+
schema: {}
|
|
31
|
+
}, {
|
|
32
|
+
label: t('Editable'),
|
|
33
|
+
value: _type.ActionType.Editable,
|
|
34
|
+
selected: false,
|
|
35
|
+
schema: {}
|
|
36
|
+
}, {
|
|
37
|
+
label: t('Disabled'),
|
|
38
|
+
value: _type.ActionType.ReadOnly,
|
|
39
|
+
selected: false,
|
|
40
|
+
schema: {}
|
|
41
|
+
}, {
|
|
42
|
+
label: t('Easy reading'),
|
|
43
|
+
value: _type.ActionType.ReadPretty,
|
|
44
|
+
selected: false,
|
|
45
|
+
schema: {}
|
|
46
|
+
}, {
|
|
47
|
+
label: t('Hidden'),
|
|
48
|
+
value: _type.ActionType.None,
|
|
49
|
+
selected: false,
|
|
50
|
+
schema: {}
|
|
51
|
+
}, {
|
|
52
|
+
label: t('Hidden(reserved value)'),
|
|
53
|
+
value: _type.ActionType.Hidden,
|
|
54
|
+
selected: false,
|
|
55
|
+
schema: {}
|
|
56
|
+
}, {
|
|
57
|
+
label: t('Required'),
|
|
58
|
+
value: _type.ActionType.Required,
|
|
59
|
+
selected: false,
|
|
60
|
+
schema: {}
|
|
61
|
+
}, {
|
|
62
|
+
label: t('Not required'),
|
|
63
|
+
value: _type.ActionType.InRequired,
|
|
64
|
+
selected: false,
|
|
65
|
+
schema: {}
|
|
66
|
+
}, {
|
|
67
|
+
label: t('Value'),
|
|
68
|
+
value: _type.ActionType.Value,
|
|
69
|
+
selected: false,
|
|
70
|
+
schema: {}
|
|
71
|
+
}];
|
|
72
|
+
|
|
73
|
+
var field2option = function field2option(field, depth) {
|
|
74
|
+
var _field$uiSchema, _operators$filter;
|
|
75
|
+
|
|
76
|
+
var fieldInterface = getInterface(field.interface);
|
|
77
|
+
|
|
78
|
+
if (!fieldInterface) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
var _ref = (fieldInterface === null || fieldInterface === void 0 ? void 0 : fieldInterface.filterable) || {},
|
|
83
|
+
nested = _ref.nested,
|
|
84
|
+
children = _ref.children;
|
|
85
|
+
|
|
86
|
+
var option = {
|
|
87
|
+
name: field.name,
|
|
88
|
+
title: (field === null || field === void 0 ? void 0 : (_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title) || field.name,
|
|
89
|
+
schema: field === null || field === void 0 ? void 0 : field.uiSchema,
|
|
90
|
+
interface: field.interface,
|
|
91
|
+
target: field.target,
|
|
92
|
+
operators: (operators === null || operators === void 0 ? void 0 : (_operators$filter = operators.filter) === null || _operators$filter === void 0 ? void 0 : _operators$filter.call(operators, function (operator) {
|
|
93
|
+
if (nested || children || ['formula', 'richText', 'sequence'].includes(fieldInterface.name)) {
|
|
94
|
+
return (operator === null || operator === void 0 ? void 0 : operator.value) !== _type.ActionType.Value;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return true;
|
|
98
|
+
})) || []
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
if (field.target && depth > 2) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (depth > 2) {
|
|
106
|
+
return option;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return option;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
var getOptions = function getOptions(fields, depth) {
|
|
113
|
+
var options = [];
|
|
114
|
+
fields.forEach(function (field) {
|
|
115
|
+
var option = field2option(field, depth);
|
|
116
|
+
|
|
117
|
+
if (option) {
|
|
118
|
+
options.push(option);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return options;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
return getOptions(fields, 1);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
exports.useLinkageCollectionFieldOptions = useLinkageCollectionFieldOptions;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ObjectField } from '@formily/core';
|
|
3
|
+
import { Schema } from '@formily/react';
|
|
4
|
+
export interface FilterContextProps {
|
|
5
|
+
field?: ObjectField;
|
|
6
|
+
fieldSchema?: Schema;
|
|
7
|
+
dynamicComponent?: any;
|
|
8
|
+
options?: any[];
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const RemoveActionContext: import("react").Context<any>;
|
|
12
|
+
export declare const FilterContext: import("react").Context<FilterContextProps>;
|
|
13
|
+
export declare const FilterLogicContext: import("react").Context<any>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RemoveActionContext = exports.FilterLogicContext = exports.FilterContext = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var RemoveActionContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
11
|
+
exports.RemoveActionContext = RemoveActionContext;
|
|
12
|
+
var FilterContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
13
|
+
exports.FilterContext = FilterContext;
|
|
14
|
+
var FilterLogicContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
15
|
+
exports.FilterLogicContext = FilterLogicContext;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FormLinkageRules = void 0;
|
|
7
|
+
|
|
8
|
+
var _css = require("@emotion/css");
|
|
9
|
+
|
|
10
|
+
var _react = require("@formily/react");
|
|
11
|
+
|
|
12
|
+
var _react2 = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _schemaComponent = require("../../schema-component");
|
|
15
|
+
|
|
16
|
+
var _context = require("../../schema-component/antd/filter/context");
|
|
17
|
+
|
|
18
|
+
var _FilterDynamicComponent = require("./FilterDynamicComponent");
|
|
19
|
+
|
|
20
|
+
var _LinkageRuleActionGroup = require("./LinkageRuleActionGroup");
|
|
21
|
+
|
|
22
|
+
var _templateObject;
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
33
|
+
|
|
34
|
+
var FormLinkageRules = (0, _react.observer)(function (props) {
|
|
35
|
+
var fieldSchema = (0, _react.useFieldSchema)();
|
|
36
|
+
var useProps = props.useProps,
|
|
37
|
+
dynamicComponent = props.dynamicComponent;
|
|
38
|
+
|
|
39
|
+
var _useProps = useProps(),
|
|
40
|
+
options = _useProps.options,
|
|
41
|
+
defaultValues = _useProps.defaultValues,
|
|
42
|
+
collectionName = _useProps.collectionName;
|
|
43
|
+
|
|
44
|
+
return /*#__PURE__*/_react2.default.createElement(_context.FilterContext.Provider, {
|
|
45
|
+
value: {
|
|
46
|
+
field: options,
|
|
47
|
+
fieldSchema: fieldSchema,
|
|
48
|
+
dynamicComponent: dynamicComponent,
|
|
49
|
+
options: options || []
|
|
50
|
+
}
|
|
51
|
+
}, /*#__PURE__*/_react2.default.createElement(_schemaComponent.SchemaComponent, {
|
|
52
|
+
schema: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {
|
|
55
|
+
rules: {
|
|
56
|
+
type: 'array',
|
|
57
|
+
default: defaultValues,
|
|
58
|
+
'x-component': 'ArrayCollapse',
|
|
59
|
+
'x-decorator': 'FormItem',
|
|
60
|
+
'x-component-props': {
|
|
61
|
+
accordion: true
|
|
62
|
+
},
|
|
63
|
+
items: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
'x-component': 'ArrayCollapse.CollapsePanel',
|
|
66
|
+
'x-component-props': {
|
|
67
|
+
header: '{{ t("Linkage rule") }}'
|
|
68
|
+
},
|
|
69
|
+
properties: {
|
|
70
|
+
index: {
|
|
71
|
+
type: 'void',
|
|
72
|
+
'x-component': 'ArrayCollapse.Index'
|
|
73
|
+
},
|
|
74
|
+
layout: {
|
|
75
|
+
type: 'void',
|
|
76
|
+
'x-component': 'FormLayout',
|
|
77
|
+
'x-component-props': {
|
|
78
|
+
labelStyle: {
|
|
79
|
+
marginTop: '6px'
|
|
80
|
+
},
|
|
81
|
+
labelCol: 8,
|
|
82
|
+
wrapperCol: 16
|
|
83
|
+
},
|
|
84
|
+
properties: {
|
|
85
|
+
conditions: {
|
|
86
|
+
'x-component': 'h4',
|
|
87
|
+
'x-content': '{{ t("Condition") }}'
|
|
88
|
+
},
|
|
89
|
+
condition: {
|
|
90
|
+
'x-component': 'Filter',
|
|
91
|
+
'x-component-props': {
|
|
92
|
+
useProps: function useProps() {
|
|
93
|
+
return {
|
|
94
|
+
options: options,
|
|
95
|
+
className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n margin-left: 10px;\n "])))
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
dynamicComponent: function dynamicComponent(props) {
|
|
99
|
+
return (0, _FilterDynamicComponent.FilterDynamicComponent)(_objectSpread(_objectSpread({}, props), {}, {
|
|
100
|
+
collectionName: collectionName
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
actions: {
|
|
106
|
+
'x-component': 'h4',
|
|
107
|
+
'x-content': '{{ t("Properties") }}'
|
|
108
|
+
},
|
|
109
|
+
action: {
|
|
110
|
+
type: 'void',
|
|
111
|
+
'x-component': _LinkageRuleActionGroup.LinkageRuleActionGroup,
|
|
112
|
+
'x-component-props': _objectSpread({}, props)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
remove: {
|
|
117
|
+
type: 'void',
|
|
118
|
+
'x-component': 'ArrayCollapse.Remove'
|
|
119
|
+
},
|
|
120
|
+
moveUp: {
|
|
121
|
+
type: 'void',
|
|
122
|
+
'x-component': 'ArrayCollapse.MoveUp'
|
|
123
|
+
},
|
|
124
|
+
moveDown: {
|
|
125
|
+
type: 'void',
|
|
126
|
+
'x-component': 'ArrayCollapse.MoveDown'
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
properties: {
|
|
131
|
+
add: {
|
|
132
|
+
type: 'void',
|
|
133
|
+
title: '{{ t("Add linkage rule") }}',
|
|
134
|
+
'x-component': 'ArrayCollapse.Addition',
|
|
135
|
+
'x-reactions': {
|
|
136
|
+
dependencies: ['rules'],
|
|
137
|
+
fulfill: {
|
|
138
|
+
state: {// disabled: '{{$deps[0].length >= 3}}',
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}));
|
|
148
|
+
});
|
|
149
|
+
exports.FormLinkageRules = FormLinkageRules;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum ActionType {
|
|
2
|
+
Visible = "visible",
|
|
3
|
+
Editable = "editable",
|
|
4
|
+
ReadOnly = "disabled",
|
|
5
|
+
ReadPretty = "readPretty",
|
|
6
|
+
None = "none",
|
|
7
|
+
Hidden = "hidden",
|
|
8
|
+
Required = "required",
|
|
9
|
+
InRequired = "notRequired",
|
|
10
|
+
Disabled = "disabled",
|
|
11
|
+
Value = "value",
|
|
12
|
+
Active = "enabled"
|
|
13
|
+
}
|