@nocobase/client 0.9.2-alpha.4 → 0.9.3-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/block-provider/DetailsBlockProvider.js +13 -1
- package/es/block-provider/FormBlockProvider.js +30 -13
- package/es/block-provider/hooks/index.d.ts +10 -0
- package/es/block-provider/hooks/index.js +498 -281
- package/es/collection-manager/Configuration/CollectionFields.js +1 -2
- package/es/collection-manager/Configuration/EditFieldAction.js +0 -1
- package/es/collection-manager/Configuration/OverridingCollectionField.js +0 -1
- package/es/collection-manager/action-hooks.d.ts +1 -1
- package/es/collection-manager/action-hooks.js +18 -7
- package/es/collection-manager/interfaces/createdBy.js +1 -1
- package/es/collection-manager/interfaces/linkTo.js +3 -39
- package/es/collection-manager/interfaces/m2m.js +4 -38
- package/es/collection-manager/interfaces/m2o.js +4 -38
- package/es/collection-manager/interfaces/o2m.js +4 -68
- package/es/collection-manager/interfaces/o2o.js +25 -119
- package/es/collection-manager/interfaces/updatedBy.js +1 -1
- package/es/collection-manager/templates/tree.js +2 -2
- package/es/filter-provider/FilterProvider.js +3 -1
- package/es/locale/en_US.d.ts +3 -0
- package/es/locale/en_US.js +5 -2
- package/es/locale/ja_JP.d.ts +3 -0
- package/es/locale/ja_JP.js +3 -0
- package/es/locale/zh_CN.d.ts +4 -0
- package/es/locale/zh_CN.js +4 -0
- package/es/schema-component/antd/action/Action.Designer.js +4 -5
- package/es/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
- package/es/schema-component/antd/association-field/AssociationFieldProvider.js +19 -0
- package/es/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
- package/es/schema-component/antd/association-field/AssociationSelect.js +118 -0
- package/es/schema-component/antd/association-field/Editable.d.ts +2 -0
- package/es/schema-component/antd/association-field/Editable.js +88 -0
- package/es/schema-component/antd/association-field/FileManager.d.ts +4 -0
- package/es/schema-component/antd/association-field/FileManager.js +243 -0
- package/es/schema-component/antd/association-field/InternalNester.d.ts +1 -0
- package/es/schema-component/antd/association-field/InternalNester.js +28 -0
- package/es/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
- package/es/schema-component/antd/association-field/InternalPicker.js +267 -0
- package/es/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
- package/es/schema-component/antd/association-field/InternalSubTable.js +28 -0
- package/es/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
- package/es/schema-component/antd/association-field/InternalViewer.js +115 -0
- package/es/schema-component/antd/association-field/Nester.d.ts +1 -0
- package/es/schema-component/antd/association-field/Nester.js +80 -0
- package/es/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
- package/es/schema-component/antd/association-field/ReadPretty.js +38 -0
- package/es/schema-component/antd/association-field/SubTable.d.ts +1 -0
- package/es/schema-component/antd/association-field/SubTable.js +25 -0
- package/es/schema-component/antd/association-field/context.d.ts +7 -0
- package/es/schema-component/antd/association-field/context.js +2 -0
- package/es/schema-component/antd/association-field/hooks.d.ts +8 -0
- package/es/schema-component/antd/association-field/hooks.js +96 -0
- package/es/schema-component/antd/association-field/index.d.ts +1 -0
- package/es/schema-component/antd/association-field/index.js +14 -0
- package/es/schema-component/antd/association-field/schema.d.ts +142 -0
- package/es/schema-component/antd/association-field/schema.js +141 -0
- package/es/schema-component/antd/association-field/util.d.ts +8 -0
- package/es/schema-component/antd/association-field/util.js +84 -0
- package/es/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
- package/es/schema-component/antd/expand-action/Expand.Action.Design.js +112 -0
- package/es/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
- package/es/schema-component/antd/expand-action/Expand.Action.js +40 -0
- package/es/schema-component/antd/expand-action/index.d.ts +1 -0
- package/es/schema-component/antd/expand-action/index.js +5 -0
- package/es/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
- package/es/schema-component/antd/filter/FilterItem.js +1 -1
- package/es/schema-component/antd/filter/useOperators.d.ts +1 -1
- package/es/schema-component/antd/form-item/FormItem.d.ts +2 -1
- package/es/schema-component/antd/form-item/FormItem.js +183 -52
- package/es/schema-component/antd/form-item/SchemaSettingOptions.js +36 -58
- package/es/schema-component/antd/form-v2/utils.js +3 -1
- package/es/schema-component/antd/gantt/components/other/tooltip.js +1 -1
- package/es/schema-component/antd/index.d.ts +3 -1
- package/es/schema-component/antd/index.js +3 -1
- package/es/schema-component/antd/menu/Menu.js +6 -3
- package/es/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
- package/es/schema-component/antd/record-picker/InputRecordPicker.js +32 -12
- package/es/schema-component/antd/remote-select/RemoteSelect.js +16 -18
- package/es/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
- package/es/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
- package/es/schema-component/antd/table-v2/Table.Index.js +6 -0
- package/es/schema-component/antd/table-v2/Table.js +9 -5
- package/es/schema-component/antd/table-v2/index.js +3 -1
- package/es/schema-component/antd/table-v2/utils.js +1 -1
- package/es/schema-component/antd/variable/Input.js +5 -5
- package/es/schema-component/antd/variable/TextArea.js +2 -5
- package/es/schema-component/common/dnd-context/index.js +3 -2
- package/es/schema-component/common/sortable-item/SortableItem.js +4 -1
- package/es/schema-component/common/utils/uitls.js +1 -1
- package/es/schema-component/hooks/index.d.ts +1 -0
- package/es/schema-component/hooks/index.js +2 -1
- package/es/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
- package/es/schema-component/hooks/useFieldModeOptions.js +105 -0
- package/es/schema-initializer/components/CreateRecordAction.d.ts +1 -1
- package/es/schema-initializer/components/CreateRecordAction.js +4 -3
- package/es/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
- package/es/schema-initializer/items/ExpandActionInitializer.js +9 -34
- package/es/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
- package/es/schema-initializer/items/SelectActionInitializer.js +65 -0
- package/es/schema-initializer/items/index.d.ts +1 -0
- package/es/schema-initializer/items/index.js +2 -1
- package/es/schema-initializer/utils.js +20 -8
- package/es/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
- package/es/schema-settings/LinkageRules/Variables.d.ts +1 -1
- package/es/schema-settings/LinkageRules/Variables.js +7 -4
- package/es/schema-settings/SchemaSettings.js +2 -2
- package/lib/block-provider/DetailsBlockProvider.js +13 -1
- package/lib/block-provider/FormBlockProvider.js +31 -15
- package/lib/block-provider/hooks/index.d.ts +10 -0
- package/lib/block-provider/hooks/index.js +509 -289
- package/lib/collection-manager/Configuration/CollectionFields.js +1 -2
- package/lib/collection-manager/Configuration/EditFieldAction.js +0 -1
- package/lib/collection-manager/Configuration/OverridingCollectionField.js +0 -1
- package/lib/collection-manager/action-hooks.d.ts +1 -1
- package/lib/collection-manager/action-hooks.js +18 -7
- package/lib/collection-manager/interfaces/createdBy.js +1 -1
- package/lib/collection-manager/interfaces/linkTo.js +2 -38
- package/lib/collection-manager/interfaces/m2m.js +3 -37
- package/lib/collection-manager/interfaces/m2o.js +3 -37
- package/lib/collection-manager/interfaces/o2m.js +6 -70
- package/lib/collection-manager/interfaces/o2o.js +30 -124
- package/lib/collection-manager/interfaces/updatedBy.js +1 -1
- package/lib/collection-manager/templates/tree.js +2 -2
- package/lib/filter-provider/FilterProvider.js +3 -1
- package/lib/locale/en_US.d.ts +3 -0
- package/lib/locale/en_US.js +5 -2
- package/lib/locale/ja_JP.d.ts +3 -0
- package/lib/locale/ja_JP.js +3 -0
- package/lib/locale/zh_CN.d.ts +4 -0
- package/lib/locale/zh_CN.js +4 -0
- package/lib/schema-component/antd/action/Action.Designer.js +4 -5
- package/lib/schema-component/antd/association-field/AssociationFieldProvider.d.ts +2 -0
- package/lib/schema-component/antd/association-field/AssociationFieldProvider.js +28 -0
- package/lib/schema-component/antd/association-field/AssociationSelect.d.ts +14 -0
- package/lib/schema-component/antd/association-field/AssociationSelect.js +129 -0
- package/lib/schema-component/antd/association-field/Editable.d.ts +2 -0
- package/lib/schema-component/antd/association-field/Editable.js +97 -0
- package/lib/schema-component/antd/association-field/FileManager.d.ts +4 -0
- package/lib/schema-component/antd/association-field/FileManager.js +253 -0
- package/lib/schema-component/antd/association-field/InternalNester.d.ts +1 -0
- package/lib/schema-component/antd/association-field/InternalNester.js +39 -0
- package/lib/schema-component/antd/association-field/InternalPicker.d.ts +2 -0
- package/lib/schema-component/antd/association-field/InternalPicker.js +277 -0
- package/lib/schema-component/antd/association-field/InternalSubTable.d.ts +1 -0
- package/lib/schema-component/antd/association-field/InternalSubTable.js +39 -0
- package/lib/schema-component/antd/association-field/InternalViewer.d.ts +2 -0
- package/lib/schema-component/antd/association-field/InternalViewer.js +126 -0
- package/lib/schema-component/antd/association-field/Nester.d.ts +1 -0
- package/lib/schema-component/antd/association-field/Nester.js +89 -0
- package/lib/schema-component/antd/association-field/ReadPretty.d.ts +2 -0
- package/lib/schema-component/antd/association-field/ReadPretty.js +47 -0
- package/lib/schema-component/antd/association-field/SubTable.d.ts +1 -0
- package/lib/schema-component/antd/association-field/SubTable.js +33 -0
- package/lib/schema-component/antd/association-field/context.d.ts +7 -0
- package/lib/schema-component/antd/association-field/context.js +9 -0
- package/lib/schema-component/antd/association-field/hooks.d.ts +8 -0
- package/lib/schema-component/antd/association-field/hooks.js +107 -0
- package/lib/schema-component/antd/association-field/index.d.ts +1 -0
- package/lib/schema-component/antd/association-field/index.js +21 -0
- package/lib/schema-component/antd/association-field/schema.d.ts +142 -0
- package/lib/schema-component/antd/association-field/schema.js +148 -0
- package/lib/schema-component/antd/association-field/util.d.ts +8 -0
- package/lib/schema-component/antd/association-field/util.js +98 -0
- package/lib/schema-component/antd/expand-action/Expand.Action.Design.d.ts +1 -0
- package/lib/schema-component/antd/expand-action/Expand.Action.Design.js +120 -0
- package/lib/schema-component/antd/expand-action/Expand.Action.d.ts +1 -0
- package/lib/schema-component/antd/expand-action/Expand.Action.js +48 -0
- package/lib/schema-component/antd/expand-action/index.d.ts +1 -0
- package/lib/schema-component/antd/expand-action/index.js +12 -0
- package/lib/schema-component/antd/filter/Filter.Action.Designer.js +10 -12
- package/lib/schema-component/antd/filter/FilterItem.js +1 -1
- package/lib/schema-component/antd/filter/useOperators.d.ts +1 -1
- package/lib/schema-component/antd/form-item/FormItem.d.ts +2 -1
- package/lib/schema-component/antd/form-item/FormItem.js +180 -48
- package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +34 -56
- package/lib/schema-component/antd/form-v2/utils.js +3 -1
- package/lib/schema-component/antd/gantt/components/other/tooltip.js +1 -1
- package/lib/schema-component/antd/index.d.ts +3 -1
- package/lib/schema-component/antd/index.js +33 -11
- package/lib/schema-component/antd/menu/Menu.js +6 -3
- package/lib/schema-component/antd/record-picker/InputRecordPicker.d.ts +1 -0
- package/lib/schema-component/antd/record-picker/InputRecordPicker.js +34 -13
- package/lib/schema-component/antd/remote-select/RemoteSelect.js +15 -17
- package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +18 -9
- package/lib/schema-component/antd/table-v2/Table.Index.d.ts +1 -0
- package/lib/schema-component/antd/table-v2/Table.Index.js +14 -0
- package/lib/schema-component/antd/table-v2/Table.js +9 -5
- package/lib/schema-component/antd/table-v2/index.js +3 -1
- package/lib/schema-component/antd/table-v2/utils.js +1 -1
- package/lib/schema-component/antd/variable/Input.js +5 -5
- package/lib/schema-component/antd/variable/TextArea.js +2 -5
- package/lib/schema-component/common/dnd-context/index.js +3 -2
- package/lib/schema-component/common/sortable-item/SortableItem.js +4 -1
- package/lib/schema-component/common/utils/uitls.js +1 -1
- package/lib/schema-component/hooks/index.d.ts +1 -0
- package/lib/schema-component/hooks/index.js +11 -0
- package/lib/schema-component/hooks/useFieldModeOptions.d.ts +4 -0
- package/lib/schema-component/hooks/useFieldModeOptions.js +112 -0
- package/lib/schema-initializer/components/CreateRecordAction.d.ts +1 -1
- package/lib/schema-initializer/components/CreateRecordAction.js +4 -3
- package/lib/schema-initializer/items/ExpandActionInitializer.d.ts +0 -1
- package/lib/schema-initializer/items/ExpandActionInitializer.js +11 -37
- package/lib/schema-initializer/items/SelectActionInitializer.d.ts +1 -0
- package/lib/schema-initializer/items/SelectActionInitializer.js +73 -0
- package/lib/schema-initializer/items/index.d.ts +1 -0
- package/lib/schema-initializer/items/index.js +11 -0
- package/lib/schema-initializer/utils.js +20 -8
- package/lib/schema-settings/LinkageRules/FilterDynamicComponent.js +1 -1
- package/lib/schema-settings/LinkageRules/Variables.d.ts +1 -1
- package/lib/schema-settings/LinkageRules/Variables.js +7 -4
- package/lib/schema-settings/SchemaSettings.js +3 -3
- package/package.json +5 -6
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ExpandActionDesign = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _schemaSettings = require("../../../schema-settings");
|
|
9
|
+
var _reactI18next = require("react-i18next");
|
|
10
|
+
var _react2 = require("@formily/react");
|
|
11
|
+
var _ = require("../..");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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); }
|
|
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
|
+
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; }
|
|
16
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
18
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
|
+
var ExpandActionDesign = function ExpandActionDesign(props) {
|
|
20
|
+
var _fieldSchema$xCompon, _fieldSchema$xCompon2;
|
|
21
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
22
|
+
t = _useTranslation.t;
|
|
23
|
+
var fieldSchema = (0, _react2.useFieldSchema)();
|
|
24
|
+
var field = (0, _react2.useField)();
|
|
25
|
+
var _useDesignable = (0, _.useDesignable)(),
|
|
26
|
+
dn = _useDesignable.dn;
|
|
27
|
+
var _ref = fieldSchema['x-component-props'] || {},
|
|
28
|
+
titleExpand = _ref.titleExpand,
|
|
29
|
+
titleCollapse = _ref.titleCollapse,
|
|
30
|
+
iconExpand = _ref.iconExpand,
|
|
31
|
+
iconCollapse = _ref.iconCollapse;
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(_schemaSettings.GeneralSchemaDesigner, _objectSpread(_objectSpread({}, props), {}, {
|
|
33
|
+
disableInitializer: true
|
|
34
|
+
}), /*#__PURE__*/_react.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
|
|
35
|
+
title: t('Edit button'),
|
|
36
|
+
schema: {
|
|
37
|
+
type: 'object',
|
|
38
|
+
title: t('Edit button'),
|
|
39
|
+
properties: {
|
|
40
|
+
titleExpand: {
|
|
41
|
+
'x-decorator': 'FormItem',
|
|
42
|
+
'x-component': 'Input',
|
|
43
|
+
title: "".concat(t('Button title'), " - ").concat(t('Expand all')),
|
|
44
|
+
default: titleExpand
|
|
45
|
+
},
|
|
46
|
+
titleCollapse: {
|
|
47
|
+
'x-decorator': 'FormItem',
|
|
48
|
+
'x-component': 'Input',
|
|
49
|
+
title: "".concat(t('Button title'), " - ").concat(t('Collapse all')),
|
|
50
|
+
default: titleCollapse
|
|
51
|
+
},
|
|
52
|
+
iconExpand: {
|
|
53
|
+
'x-decorator': 'FormItem',
|
|
54
|
+
'x-component': 'IconPicker',
|
|
55
|
+
title: "".concat(t('Button icon'), " - ").concat(t('Expand all')),
|
|
56
|
+
default: iconExpand
|
|
57
|
+
},
|
|
58
|
+
iconCollapse: {
|
|
59
|
+
'x-decorator': 'FormItem',
|
|
60
|
+
'x-component': 'IconPicker',
|
|
61
|
+
title: "".concat(t('Button icon'), " - ").concat(t('Collapse all')),
|
|
62
|
+
default: iconCollapse
|
|
63
|
+
},
|
|
64
|
+
type: {
|
|
65
|
+
'x-decorator': 'FormItem',
|
|
66
|
+
'x-component': 'Radio.Group',
|
|
67
|
+
title: t('Button background color'),
|
|
68
|
+
default: (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.danger) ? 'danger' : (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.type) === 'primary' ? 'primary' : 'default',
|
|
69
|
+
enum: [{
|
|
70
|
+
value: 'default',
|
|
71
|
+
label: '{{t("Default")}}'
|
|
72
|
+
}, {
|
|
73
|
+
value: 'primary',
|
|
74
|
+
label: '{{t("Highlight")}}'
|
|
75
|
+
}, {
|
|
76
|
+
value: 'danger',
|
|
77
|
+
label: '{{t("Danger red")}}'
|
|
78
|
+
}]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
onSubmit: function onSubmit(_ref2) {
|
|
83
|
+
var titleExpand = _ref2.titleExpand,
|
|
84
|
+
titleCollapse = _ref2.titleCollapse,
|
|
85
|
+
iconExpand = _ref2.iconExpand,
|
|
86
|
+
iconCollapse = _ref2.iconCollapse,
|
|
87
|
+
type = _ref2.type;
|
|
88
|
+
fieldSchema.title = t('Expand/Collapse');
|
|
89
|
+
field.title = t('Expand/Collapse');
|
|
90
|
+
field.componentProps.icon = iconExpand;
|
|
91
|
+
field.componentProps.danger = type === 'danger';
|
|
92
|
+
field.componentProps.type = type;
|
|
93
|
+
fieldSchema['x-component-props'] = _objectSpread(_objectSpread({}, fieldSchema['x-component-props'] || {}), {}, {
|
|
94
|
+
titleExpand: titleExpand,
|
|
95
|
+
titleCollapse: titleCollapse,
|
|
96
|
+
iconExpand: iconExpand,
|
|
97
|
+
iconCollapse: iconCollapse,
|
|
98
|
+
type: type,
|
|
99
|
+
danger: type === 'danger'
|
|
100
|
+
});
|
|
101
|
+
dn.emit('patch', {
|
|
102
|
+
schema: {
|
|
103
|
+
'x-uid': fieldSchema['x-uid'],
|
|
104
|
+
'x-component-props': fieldSchema['x-component-props'],
|
|
105
|
+
title: fieldSchema.title
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
dn.refresh();
|
|
109
|
+
}
|
|
110
|
+
}), /*#__PURE__*/_react.default.createElement(_schemaSettings.SchemaSettings.Divider, null), /*#__PURE__*/_react.default.createElement(_schemaSettings.SchemaSettings.Remove, {
|
|
111
|
+
removeParentsIfNoChildren: true,
|
|
112
|
+
breakRemoveOn: function breakRemoveOn(s) {
|
|
113
|
+
return s['x-component'] === 'Space' || s['x-component'].endsWith('ActionBar');
|
|
114
|
+
},
|
|
115
|
+
confirm: {
|
|
116
|
+
title: t('Delete action')
|
|
117
|
+
}
|
|
118
|
+
}));
|
|
119
|
+
};
|
|
120
|
+
exports.ExpandActionDesign = ExpandActionDesign;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ExpandAction: (props: any) => JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ExpandAction = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _react2 = require("@formily/react");
|
|
9
|
+
var _reactI18next = require("react-i18next");
|
|
10
|
+
var _blockProvider = require("../../../block-provider");
|
|
11
|
+
var _antd = require("antd");
|
|
12
|
+
var _css = require("@emotion/css");
|
|
13
|
+
var _icon = require("../../../icon");
|
|
14
|
+
var _templateObject;
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
17
|
+
var actionDesignerCss = (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n &:hover {\n .general-schema-designer {\n display: block;\n }\n }\n .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: rgba(241, 139, 98, 0.06);\n border: 0;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: #f18b62;\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n }\n }\n }\n"])));
|
|
18
|
+
var ExpandAction = function ExpandAction(props) {
|
|
19
|
+
var _schema$parent, _schema$parent$parent;
|
|
20
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
21
|
+
t = _useTranslation.t;
|
|
22
|
+
var schema = (0, _react2.useFieldSchema)();
|
|
23
|
+
var ctxSelector = (0, _blockProvider.useTableSelectorContext)();
|
|
24
|
+
var ctxBlock = (0, _blockProvider.useTableBlockContext)();
|
|
25
|
+
var isTableSelector = ((_schema$parent = schema.parent) === null || _schema$parent === void 0 ? void 0 : (_schema$parent$parent = _schema$parent.parent) === null || _schema$parent$parent === void 0 ? void 0 : _schema$parent$parent['x-decorator']) === 'TableSelectorProvider';
|
|
26
|
+
var ctx = isTableSelector ? ctxSelector : ctxBlock;
|
|
27
|
+
var _ref = schema['x-component-props'] || {},
|
|
28
|
+
titleExpand = _ref.titleExpand,
|
|
29
|
+
titleCollapse = _ref.titleCollapse,
|
|
30
|
+
iconExpand = _ref.iconExpand,
|
|
31
|
+
iconCollapse = _ref.iconCollapse;
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
33
|
+
className: actionDesignerCss
|
|
34
|
+
}, (ctx === null || ctx === void 0 ? void 0 : ctx.params['tree']) && /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
35
|
+
onClick: function onClick() {
|
|
36
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.setExpandFlag();
|
|
37
|
+
},
|
|
38
|
+
icon: /*#__PURE__*/_react.default.createElement(_icon.Icon, {
|
|
39
|
+
type: (ctx === null || ctx === void 0 ? void 0 : ctx.expandFlag) ? iconCollapse : iconExpand
|
|
40
|
+
}),
|
|
41
|
+
type: props.type
|
|
42
|
+
}, props.children[1], /*#__PURE__*/_react.default.createElement("span", {
|
|
43
|
+
style: {
|
|
44
|
+
marginLeft: 10
|
|
45
|
+
}
|
|
46
|
+
}, (ctx === null || ctx === void 0 ? void 0 : ctx.expandFlag) ? titleCollapse : titleExpand)));
|
|
47
|
+
};
|
|
48
|
+
exports.ExpandAction = ExpandAction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Expand: any;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Expand = void 0;
|
|
7
|
+
var _Expand = require("./Expand.Action");
|
|
8
|
+
var _ExpandAction = require("./Expand.Action.Design");
|
|
9
|
+
var Expand = _Expand.ExpandAction;
|
|
10
|
+
exports.Expand = Expand;
|
|
11
|
+
Expand.Action = _Expand.ExpandAction;
|
|
12
|
+
Expand.Action.Design = _ExpandAction.ExpandActionDesign;
|
|
@@ -100,20 +100,18 @@ var FilterActionDesigner = function FilterActionDesigner(props) {
|
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
onSubmit: function onSubmit(_ref) {
|
|
103
|
+
var _schema2;
|
|
103
104
|
var title = _ref.title,
|
|
104
105
|
icon = _ref.icon;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
fieldSchema['x-component-props']
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
});
|
|
115
|
-
dn.refresh();
|
|
116
|
-
}
|
|
106
|
+
fieldSchema.title = title;
|
|
107
|
+
field.title = title;
|
|
108
|
+
field.componentProps.icon = icon;
|
|
109
|
+
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
110
|
+
fieldSchema['x-component-props'].icon = icon;
|
|
111
|
+
dn.emit('patch', {
|
|
112
|
+
schema: (_schema2 = {}, _defineProperty(_schema2, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema2, "title", title), _defineProperty(_schema2, 'x-component-props', _objectSpread({}, fieldSchema['x-component-props'])), _schema2)
|
|
113
|
+
});
|
|
114
|
+
dn.refresh();
|
|
117
115
|
}
|
|
118
116
|
}), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.Divider, null), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.Remove, {
|
|
119
117
|
removeParentsIfNoChildren: true,
|
|
@@ -61,7 +61,7 @@ var FilterItem = (0, _react.observer)(function (props) {
|
|
|
61
61
|
},
|
|
62
62
|
placeholder: t('Comparision')
|
|
63
63
|
}), !(operator === null || operator === void 0 ? void 0 : operator.noValue) && /*#__PURE__*/_react2.default.createElement(_DynamicComponent.DynamicComponent, {
|
|
64
|
-
value: value,
|
|
64
|
+
value: value ? value : undefined,
|
|
65
65
|
schema: schema,
|
|
66
66
|
onChange: function onChange(value) {
|
|
67
67
|
setValue(value);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ISchema } from '@formily/react';
|
|
2
|
-
import { CollectionFieldOptions } from '../../../collection-manager';
|
|
2
|
+
import { Collection, CollectionFieldOptions } from '../../../collection-manager';
|
|
3
3
|
export declare const FormItem: any;
|
|
4
|
+
export declare function isFileCollection(collection: Collection): boolean;
|
|
4
5
|
export declare function getFieldDefaultValue(fieldSchema: ISchema, collectionField: CollectionFieldOptions): any;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.FormItem = void 0;
|
|
8
8
|
exports.getFieldDefaultValue = getFieldDefaultValue;
|
|
9
|
+
exports.isFileCollection = isFileCollection;
|
|
9
10
|
var _css = require("@emotion/css");
|
|
10
11
|
var _antd = require("@formily/antd");
|
|
11
12
|
var _react = require("@formily/react");
|
|
@@ -20,8 +21,10 @@ var _collectionManager = require("../../../collection-manager");
|
|
|
20
21
|
var _CollectionFields = require("../../../collection-manager/Configuration/CollectionFields");
|
|
21
22
|
var _schemaSettings = require("../../../schema-settings");
|
|
22
23
|
var _VariableInput = require("../../../schema-settings/VariableInput/VariableInput");
|
|
24
|
+
var _FilterDynamicComponent = require("../table-v2/FilterDynamicComponent");
|
|
23
25
|
var _uitls = require("../../common/utils/uitls");
|
|
24
26
|
var _core = require("../../core");
|
|
27
|
+
var _filter = require("../filter");
|
|
25
28
|
var _hooks = require("../../hooks");
|
|
26
29
|
var _blockItem = require("../block-item");
|
|
27
30
|
var _shared2 = require("../input/shared");
|
|
@@ -84,7 +87,7 @@ var FormItem = (0, _react.observer)(function (props) {
|
|
|
84
87
|
});
|
|
85
88
|
exports.FormItem = FormItem;
|
|
86
89
|
FormItem.Designer = function Designer() {
|
|
87
|
-
var _interfaceConfig$vali, _collectionField$uiSc, _getCollectionFields, _collectionField$uiSc2, _fieldSchema$xDecora, _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4,
|
|
90
|
+
var _interfaceConfig$vali, _collectionField$uiSc, _getCollectionFields, _field$componentProps, _field$componentProps2, _field$componentProps3, _field$componentProps4, _field$componentProps5, _field$componentProps6, _field$componentProps7, _collectionField$uiSc2, _fieldSchema$xDecora, _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _field$componentProps8, _field$componentProps9;
|
|
88
91
|
var _useCollectionManager = (0, _collectionManager.useCollectionManager)(),
|
|
89
92
|
getCollectionFields = _useCollectionManager.getCollectionFields,
|
|
90
93
|
getInterface = _useCollectionManager.getInterface,
|
|
@@ -111,8 +114,10 @@ FormItem.Designer = function Designer() {
|
|
|
111
114
|
var validateSchema = interfaceConfig === null || interfaceConfig === void 0 ? void 0 : (_interfaceConfig$vali = interfaceConfig['validateSchema']) === null || _interfaceConfig$vali === void 0 ? void 0 : _interfaceConfig$vali.call(interfaceConfig, fieldSchema);
|
|
112
115
|
var originalTitle = collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc = collectionField.uiSchema) === null || _collectionField$uiSc === void 0 ? void 0 : _collectionField$uiSc.title;
|
|
113
116
|
var targetFields = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? getCollectionFields(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) : (_getCollectionFields = getCollectionFields(collectionField === null || collectionField === void 0 ? void 0 : collectionField.targetCollection)) !== null && _getCollectionFields !== void 0 ? _getCollectionFields : [];
|
|
114
|
-
var
|
|
115
|
-
var
|
|
117
|
+
var fieldModeOptions = (0, _hooks.useFieldModeOptions)();
|
|
118
|
+
var isAssociationField = ['belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.type);
|
|
119
|
+
var isTableField = fieldSchema['x-component'] === 'TableField';
|
|
120
|
+
var isFileField = isFileCollection(targetCollection);
|
|
116
121
|
var initialValue = {
|
|
117
122
|
title: field.title === originalTitle ? undefined : field.title
|
|
118
123
|
};
|
|
@@ -135,6 +140,21 @@ FormItem.Designer = function Designer() {
|
|
|
135
140
|
if (fieldSchema['x-read-pretty'] === true) {
|
|
136
141
|
readOnlyMode = 'read-pretty';
|
|
137
142
|
}
|
|
143
|
+
var dataSource = (0, _collectionManager.useCollectionFilterOptions)(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
|
|
144
|
+
var defaultFilter = ((_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : (_field$componentProps2 = _field$componentProps.service) === null || _field$componentProps2 === void 0 ? void 0 : (_field$componentProps3 = _field$componentProps2.params) === null || _field$componentProps3 === void 0 ? void 0 : _field$componentProps3.filter) || {};
|
|
145
|
+
var sortFields = (0, _collectionManager.useSortFields)(collectionField === null || collectionField === void 0 ? void 0 : collectionField.target);
|
|
146
|
+
var defaultSort = ((_field$componentProps4 = field.componentProps) === null || _field$componentProps4 === void 0 ? void 0 : (_field$componentProps5 = _field$componentProps4.service) === null || _field$componentProps5 === void 0 ? void 0 : (_field$componentProps6 = _field$componentProps5.params) === null || _field$componentProps6 === void 0 ? void 0 : _field$componentProps6.sort) || [];
|
|
147
|
+
var fieldMode = (field === null || field === void 0 ? void 0 : (_field$componentProps7 = field.componentProps) === null || _field$componentProps7 === void 0 ? void 0 : _field$componentProps7['mode']) || (isFileField ? 'FileManager' : 'Select');
|
|
148
|
+
var isSelectFieldMode = fieldMode === 'Select';
|
|
149
|
+
var sort = defaultSort === null || defaultSort === void 0 ? void 0 : defaultSort.map(function (item) {
|
|
150
|
+
return item.startsWith('-') ? {
|
|
151
|
+
field: item.substring(1),
|
|
152
|
+
direction: 'desc'
|
|
153
|
+
} : {
|
|
154
|
+
field: item,
|
|
155
|
+
direction: 'asc'
|
|
156
|
+
};
|
|
157
|
+
});
|
|
138
158
|
return /*#__PURE__*/_react2.default.createElement(_schemaSettings.GeneralSchemaDesigner, null, collectionField && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
|
|
139
159
|
key: "edit-field-title",
|
|
140
160
|
title: t('Edit field title'),
|
|
@@ -236,10 +256,10 @@ FormItem.Designer = function Designer() {
|
|
|
236
256
|
});
|
|
237
257
|
refresh();
|
|
238
258
|
}
|
|
239
|
-
}), !(form === null || form === void 0 ? void 0 : form.readPretty) &&
|
|
259
|
+
}), !(form === null || form === void 0 ? void 0 : form.readPretty) && isFileField ? /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
|
|
240
260
|
key: "quick-upload",
|
|
241
261
|
title: t('Quick upload'),
|
|
242
|
-
checked: (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.quickUpload,
|
|
262
|
+
checked: ((_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.quickUpload) !== false,
|
|
243
263
|
onChange: function onChange(value) {
|
|
244
264
|
var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
|
|
245
265
|
field.componentProps.quickUpload = value;
|
|
@@ -251,10 +271,10 @@ FormItem.Designer = function Designer() {
|
|
|
251
271
|
});
|
|
252
272
|
refresh();
|
|
253
273
|
}
|
|
254
|
-
}) : null, !(form === null || form === void 0 ? void 0 : form.readPretty) &&
|
|
274
|
+
}) : null, !(form === null || form === void 0 ? void 0 : form.readPretty) && isFileField ? /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
|
|
255
275
|
key: "select-file",
|
|
256
276
|
title: t('Select file'),
|
|
257
|
-
checked: (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.selectFile,
|
|
277
|
+
checked: ((_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.selectFile) !== false,
|
|
258
278
|
onChange: function onChange(value) {
|
|
259
279
|
var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
|
|
260
280
|
field.componentProps.selectFile = value;
|
|
@@ -475,44 +495,154 @@ FormItem.Designer = function Designer() {
|
|
|
475
495
|
});
|
|
476
496
|
refresh();
|
|
477
497
|
}
|
|
478
|
-
}),
|
|
479
|
-
title: t('
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
498
|
+
}), isSelectFieldMode && !field.readPretty && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
|
|
499
|
+
title: t('Set the data scope'),
|
|
500
|
+
schema: {
|
|
501
|
+
type: 'object',
|
|
502
|
+
title: t('Set the data scope'),
|
|
503
|
+
properties: {
|
|
504
|
+
filter: {
|
|
505
|
+
default: defaultFilter,
|
|
506
|
+
// title: '数据范围',
|
|
507
|
+
enum: dataSource,
|
|
508
|
+
'x-component': 'Filter',
|
|
509
|
+
'x-component-props': {
|
|
510
|
+
dynamicComponent: function dynamicComponent(props) {
|
|
511
|
+
return (0, _FilterDynamicComponent.FilterDynamicComponent)(_objectSpread({}, props));
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
onSubmit: function onSubmit(_ref4) {
|
|
518
|
+
var _schema6;
|
|
519
|
+
var filter = _ref4.filter;
|
|
520
|
+
filter = (0, _filter.removeNullCondition)(filter);
|
|
521
|
+
_lodash.default.set(field.componentProps, 'service.params.filter', filter);
|
|
522
|
+
fieldSchema['x-component-props'] = field.componentProps;
|
|
523
|
+
field.componentProps = field.componentProps;
|
|
524
|
+
dn.emit('patch', {
|
|
525
|
+
schema: (_schema6 = {}, _defineProperty(_schema6, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema6, 'x-component-props', field.componentProps), _schema6)
|
|
504
526
|
});
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
527
|
+
}
|
|
528
|
+
}), isSelectFieldMode && !field.readPretty && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
|
|
529
|
+
title: t('Set default sorting rules'),
|
|
530
|
+
components: {
|
|
531
|
+
ArrayItems: _antd.ArrayItems
|
|
532
|
+
},
|
|
533
|
+
schema: {
|
|
534
|
+
type: 'object',
|
|
535
|
+
title: t('Set default sorting rules'),
|
|
536
|
+
properties: {
|
|
537
|
+
sort: {
|
|
538
|
+
type: 'array',
|
|
539
|
+
default: sort,
|
|
540
|
+
'x-component': 'ArrayItems',
|
|
541
|
+
'x-decorator': 'FormItem',
|
|
542
|
+
items: {
|
|
543
|
+
type: 'object',
|
|
544
|
+
properties: {
|
|
545
|
+
space: {
|
|
546
|
+
type: 'void',
|
|
547
|
+
'x-component': 'Space',
|
|
548
|
+
properties: {
|
|
549
|
+
sort: {
|
|
550
|
+
type: 'void',
|
|
551
|
+
'x-decorator': 'FormItem',
|
|
552
|
+
'x-component': 'ArrayItems.SortHandle'
|
|
553
|
+
},
|
|
554
|
+
field: {
|
|
555
|
+
type: 'string',
|
|
556
|
+
enum: sortFields,
|
|
557
|
+
'x-decorator': 'FormItem',
|
|
558
|
+
'x-component': 'Select',
|
|
559
|
+
'x-component-props': {
|
|
560
|
+
style: {
|
|
561
|
+
width: 260
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
direction: {
|
|
566
|
+
type: 'string',
|
|
567
|
+
'x-decorator': 'FormItem',
|
|
568
|
+
'x-component': 'Radio.Group',
|
|
569
|
+
'x-component-props': {
|
|
570
|
+
optionType: 'button'
|
|
571
|
+
},
|
|
572
|
+
enum: [{
|
|
573
|
+
label: t('ASC'),
|
|
574
|
+
value: 'asc'
|
|
575
|
+
}, {
|
|
576
|
+
label: t('DESC'),
|
|
577
|
+
value: 'desc'
|
|
578
|
+
}]
|
|
579
|
+
},
|
|
580
|
+
remove: {
|
|
581
|
+
type: 'void',
|
|
582
|
+
'x-decorator': 'FormItem',
|
|
583
|
+
'x-component': 'ArrayItems.Remove'
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
511
587
|
}
|
|
512
|
-
}
|
|
588
|
+
},
|
|
589
|
+
properties: {
|
|
590
|
+
add: {
|
|
591
|
+
type: 'void',
|
|
592
|
+
title: t('Add sort field'),
|
|
593
|
+
'x-component': 'ArrayItems.Addition'
|
|
594
|
+
}
|
|
595
|
+
}
|
|
513
596
|
}
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
onSubmit: function onSubmit(_ref5) {
|
|
600
|
+
var _schema7;
|
|
601
|
+
var sort = _ref5.sort;
|
|
602
|
+
var sortArr = sort.map(function (item) {
|
|
603
|
+
return item.direction === 'desc' ? "-".concat(item.field) : item.field;
|
|
604
|
+
});
|
|
605
|
+
_lodash.default.set(field.componentProps, 'service.params.sort', sortArr);
|
|
606
|
+
fieldSchema['x-component-props'] = field.componentProps;
|
|
607
|
+
dn.emit('patch', {
|
|
608
|
+
schema: (_schema7 = {}, _defineProperty(_schema7, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema7, 'x-component-props', field.componentProps), _schema7)
|
|
514
609
|
});
|
|
515
610
|
}
|
|
611
|
+
}), isAssociationField && fieldModeOptions && !isTableField && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
|
|
612
|
+
key: "field-mode",
|
|
613
|
+
title: t('Field mode'),
|
|
614
|
+
options: fieldModeOptions,
|
|
615
|
+
value: fieldMode,
|
|
616
|
+
onChange: function onChange(mode) {
|
|
617
|
+
var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
|
|
618
|
+
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
619
|
+
fieldSchema['x-component-props']['mode'] = mode;
|
|
620
|
+
schema['x-component-props'] = fieldSchema['x-component-props'];
|
|
621
|
+
field.componentProps = field.componentProps || {};
|
|
622
|
+
field.componentProps.mode = mode;
|
|
623
|
+
if (mode === 'Nester') {
|
|
624
|
+
var initValue = ['o2m', 'm2m'].includes(collectionField.interface) ? [] : {};
|
|
625
|
+
field.value = field.value || initValue;
|
|
626
|
+
}
|
|
627
|
+
dn.emit('patch', {
|
|
628
|
+
schema: schema
|
|
629
|
+
});
|
|
630
|
+
dn.refresh();
|
|
631
|
+
}
|
|
632
|
+
}), !field.readPretty && isAssociationField && ['Select', 'Picker'].includes(fieldMode) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
|
|
633
|
+
key: "allowAddNew",
|
|
634
|
+
title: t('Allow add new data'),
|
|
635
|
+
checked: fieldSchema['x-add-new'],
|
|
636
|
+
onChange: function onChange(allowAddNew) {
|
|
637
|
+
var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
|
|
638
|
+
field['x-add-new'] = allowAddNew;
|
|
639
|
+
fieldSchema['x-add-new'] = allowAddNew;
|
|
640
|
+
schema['x-add-new'] = allowAddNew;
|
|
641
|
+
dn.emit('patch', {
|
|
642
|
+
schema: schema
|
|
643
|
+
});
|
|
644
|
+
refresh();
|
|
645
|
+
}
|
|
516
646
|
}), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && ['o2m', 'm2m'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && fieldSchema['x-component'] !== 'TableField' && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
|
|
517
647
|
key: "multiple",
|
|
518
648
|
title: t('Multiple'),
|
|
@@ -529,13 +659,14 @@ FormItem.Designer = function Designer() {
|
|
|
529
659
|
});
|
|
530
660
|
refresh();
|
|
531
661
|
}
|
|
532
|
-
}), field.readPretty && options.length > 0 && fieldSchema['x-component'] === 'CollectionField' && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
|
|
662
|
+
}), field.readPretty && options.length > 0 && fieldSchema['x-component'] === 'CollectionField' && !isFileField && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
|
|
533
663
|
title: t('Enable link'),
|
|
534
|
-
checked: ((_fieldSchema$xCompon4 =
|
|
664
|
+
checked: ((_fieldSchema$xCompon4 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4.enableLink) !== false,
|
|
535
665
|
onChange: function onChange(flag) {
|
|
536
666
|
fieldSchema['x-component-props'] = _objectSpread(_objectSpread({}, fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component-props']), {}, {
|
|
537
|
-
|
|
667
|
+
enableLink: flag
|
|
538
668
|
});
|
|
669
|
+
field.componentProps['enableLink'] = flag;
|
|
539
670
|
dn.emit('patch', {
|
|
540
671
|
schema: {
|
|
541
672
|
'x-uid': fieldSchema['x-uid'],
|
|
@@ -600,16 +731,17 @@ FormItem.Designer = function Designer() {
|
|
|
600
731
|
key: "title-field",
|
|
601
732
|
title: t('Title field'),
|
|
602
733
|
options: options,
|
|
603
|
-
value: field === null || field === void 0 ? void 0 : (_field$
|
|
734
|
+
value: field === null || field === void 0 ? void 0 : (_field$componentProps8 = field.componentProps) === null || _field$componentProps8 === void 0 ? void 0 : (_field$componentProps9 = _field$componentProps8.fieldNames) === null || _field$componentProps9 === void 0 ? void 0 : _field$componentProps9.label,
|
|
604
735
|
onChange: function onChange(label) {
|
|
605
|
-
var _collectionField$
|
|
736
|
+
var _collectionField$uiSc4, _collectionField$uiSc5;
|
|
606
737
|
var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
|
|
607
|
-
var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$
|
|
738
|
+
var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : (_collectionField$uiSc5 = _collectionField$uiSc4['x-component-props']) === null || _collectionField$uiSc5 === void 0 ? void 0 : _collectionField$uiSc5['fieldNames']), field.componentProps.fieldNames), {}, {
|
|
608
739
|
label: label
|
|
609
740
|
});
|
|
610
741
|
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
611
742
|
fieldSchema['x-component-props']['fieldNames'] = fieldNames;
|
|
612
743
|
schema['x-component-props'] = fieldSchema['x-component-props'];
|
|
744
|
+
field.componentProps.fieldNames = fieldSchema['x-component-props'].fieldNames;
|
|
613
745
|
dn.emit('patch', {
|
|
614
746
|
schema: schema
|
|
615
747
|
});
|
|
@@ -631,9 +763,9 @@ function isFileCollection(collection) {
|
|
|
631
763
|
}
|
|
632
764
|
FormItem.FilterFormDesigner = _FormItem.FilterFormDesigner;
|
|
633
765
|
function getFieldDefaultValue(fieldSchema, collectionField) {
|
|
634
|
-
var _collectionField$
|
|
766
|
+
var _collectionField$uiSc6;
|
|
635
767
|
var result = (fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.default) || (collectionField === null || collectionField === void 0 ? void 0 : collectionField.defaultValue);
|
|
636
|
-
if ((collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$
|
|
768
|
+
if ((collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc6 = collectionField.uiSchema) === null || _collectionField$uiSc6 === void 0 ? void 0 : _collectionField$uiSc6['x-component']) === 'DatePicker' && result) {
|
|
637
769
|
return (0, _moment.default)(result);
|
|
638
770
|
}
|
|
639
771
|
return result;
|