@nocobase/client 0.7.2-alpha.7 → 0.7.4-alpha.4
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/application/Application.d.ts +1 -0
- package/es/application/Application.js +7 -1
- package/es/block-provider/FormBlockProvider.js +15 -3
- package/es/block-provider/TableFieldProvider.d.ts +1 -0
- package/es/block-provider/TableFieldProvider.js +5 -2
- package/es/block-provider/TableSelectorProvider.js +42 -14
- package/es/block-provider/hooks/index.d.ts +6 -0
- package/es/block-provider/hooks/index.js +159 -65
- package/es/collection-manager/CollectionField.js +11 -4
- package/es/collection-manager/Configuration/AddFieldAction.js +6 -0
- package/es/collection-manager/Configuration/EditFieldAction.js +7 -0
- package/es/collection-manager/Configuration/index.js +5 -1
- package/es/collection-manager/Configuration/schemas/collections.js +2 -1
- package/es/collection-manager/interfaces/checkbox.js +1 -0
- package/es/collection-manager/interfaces/checkboxGroup.js +1 -0
- package/es/collection-manager/interfaces/datetime.js +1 -0
- package/es/collection-manager/interfaces/email.js +1 -0
- package/es/collection-manager/interfaces/icon.js +1 -0
- package/es/collection-manager/interfaces/input.js +104 -0
- package/es/collection-manager/interfaces/integer.js +64 -0
- package/es/collection-manager/interfaces/m2m.js +2 -0
- package/es/collection-manager/interfaces/m2o.js +1 -0
- package/es/collection-manager/interfaces/markdown.js +35 -0
- package/es/collection-manager/interfaces/multipleSelect.js +1 -0
- package/es/collection-manager/interfaces/number.js +56 -0
- package/es/collection-manager/interfaces/o2m.js +1 -0
- package/es/collection-manager/interfaces/o2o.js +3 -0
- package/es/collection-manager/interfaces/password.js +37 -1
- package/es/collection-manager/interfaces/percent.js +98 -0
- package/es/collection-manager/interfaces/phone.js +1 -0
- package/es/collection-manager/interfaces/properties/index.d.ts +1 -0
- package/es/collection-manager/interfaces/properties/index.js +1 -0
- package/es/collection-manager/interfaces/properties/operators.js +4 -4
- package/es/collection-manager/interfaces/radioGroup.js +1 -0
- package/es/collection-manager/interfaces/richText.js +35 -0
- package/es/collection-manager/interfaces/select.js +1 -0
- package/es/collection-manager/interfaces/textarea.js +35 -0
- package/es/collection-manager/interfaces/time.js +1 -0
- package/es/file-manager/FileStorageShortcut.js +2 -2
- package/es/locale/en_US.d.ts +8 -2
- package/es/locale/en_US.js +9 -3
- package/es/locale/zh_CN.d.ts +28 -2
- package/es/locale/zh_CN.js +29 -3
- package/es/plugin-manager/PluginManager.d.ts +1 -0
- package/es/plugin-manager/PluginManager.js +20 -6
- package/es/schema-component/antd/action/Action.Modal.js +1 -1
- package/es/schema-component/antd/calendar/Calendar.Designer.js +16 -10
- package/es/schema-component/antd/date-picker/DatePicker.d.ts +1 -1
- package/es/schema-component/antd/date-picker/DatePicker.js +1 -1
- package/es/schema-component/antd/date-picker/ReadPretty.js +1 -1
- package/es/schema-component/antd/date-picker/util.d.ts +0 -10
- package/es/schema-component/antd/date-picker/util.js +1 -79
- package/es/schema-component/antd/form-item/FormItem.js +193 -10
- package/es/schema-component/antd/grid/Grid.js +72 -6
- package/es/schema-component/antd/input-number/InputNumber.d.ts +1 -5
- package/es/schema-component/antd/input-number/InputNumber.js +25 -1
- package/es/schema-component/antd/input-number/ReadPretty.js +2 -4
- package/es/schema-component/antd/kanban/Kanban.Card.Designer.js +20 -14
- package/es/schema-component/antd/menu/Menu.js +6 -3
- package/es/schema-component/antd/percent/Percent.js +2 -2
- package/es/schema-component/antd/record-picker/InputRecordPicker.js +27 -13
- package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +5 -3
- package/es/schema-component/antd/table/Table.Array.js +2 -2
- package/es/schema-component/antd/table/Table.Void.js +11 -1
- package/es/schema-component/antd/table-v2/Table.Column.Designer.js +3 -1
- package/es/schema-component/antd/table-v2/Table.d.ts +0 -11
- package/es/schema-component/antd/table-v2/Table.js +163 -92
- package/es/schema-component/antd/table-v2/TableField.js +3 -0
- package/es/schema-component/antd/tabs/Tabs.Designer.js +23 -12
- package/es/schema-component/antd/tabs/Tabs.js +7 -1
- package/es/schema-component/antd/time-picker/ReadPretty.js +11 -5
- package/es/schema-component/core/DesignableSwitch.js +7 -1
- package/es/schema-component/hooks/useDesignable.js +21 -21
- package/es/schema-component/hooks/useProps.js +1 -1
- package/es/schema-initializer/buttons/FormItemInitializers.js +14 -3
- package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +8 -0
- package/es/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +14 -3
- package/es/schema-initializer/buttons/RecordBlockInitializers.js +32 -3
- package/es/schema-initializer/buttons/TabPaneInitializers.js +11 -3
- package/es/schema-initializer/buttons/TableActionInitializers.js +11 -0
- package/es/schema-initializer/components/assigned-field/AssignedField.d.ts +4 -0
- package/es/schema-initializer/components/assigned-field/AssignedField.js +255 -69
- package/es/schema-initializer/items/index.d.ts +2 -0
- package/es/schema-initializer/items/index.js +48 -2
- package/es/schema-initializer/utils.js +22 -2
- package/es/schema-settings/SchemaSettings.js +7 -0
- package/es/system-settings/SystemSettingsShortcut.js +35 -12
- package/lib/application/Application.d.ts +1 -0
- package/lib/application/Application.js +11 -2
- package/lib/block-provider/FormBlockProvider.js +15 -2
- package/lib/block-provider/TableFieldProvider.d.ts +1 -0
- package/lib/block-provider/TableFieldProvider.js +4 -1
- package/lib/block-provider/TableSelectorProvider.js +42 -14
- package/lib/block-provider/hooks/index.d.ts +6 -0
- package/lib/block-provider/hooks/index.js +168 -67
- package/lib/collection-manager/CollectionField.js +12 -4
- package/lib/collection-manager/Configuration/AddFieldAction.js +6 -0
- package/lib/collection-manager/Configuration/EditFieldAction.js +7 -0
- package/lib/collection-manager/Configuration/index.js +5 -0
- package/lib/collection-manager/Configuration/schemas/collections.js +2 -1
- package/lib/collection-manager/interfaces/checkbox.js +1 -0
- package/lib/collection-manager/interfaces/checkboxGroup.js +1 -0
- package/lib/collection-manager/interfaces/datetime.js +1 -0
- package/lib/collection-manager/interfaces/email.js +1 -0
- package/lib/collection-manager/interfaces/icon.js +1 -0
- package/lib/collection-manager/interfaces/input.js +105 -0
- package/lib/collection-manager/interfaces/integer.js +66 -0
- package/lib/collection-manager/interfaces/m2m.js +2 -0
- package/lib/collection-manager/interfaces/m2o.js +1 -0
- package/lib/collection-manager/interfaces/markdown.js +36 -0
- package/lib/collection-manager/interfaces/multipleSelect.js +1 -0
- package/lib/collection-manager/interfaces/number.js +57 -0
- package/lib/collection-manager/interfaces/o2m.js +1 -0
- package/lib/collection-manager/interfaces/o2o.js +3 -0
- package/lib/collection-manager/interfaces/password.js +38 -1
- package/lib/collection-manager/interfaces/percent.js +100 -0
- package/lib/collection-manager/interfaces/phone.js +1 -0
- package/lib/collection-manager/interfaces/properties/index.d.ts +1 -0
- package/lib/collection-manager/interfaces/properties/index.js +1 -0
- package/lib/collection-manager/interfaces/properties/operators.js +4 -4
- package/lib/collection-manager/interfaces/radioGroup.js +1 -0
- package/lib/collection-manager/interfaces/richText.js +36 -0
- package/lib/collection-manager/interfaces/select.js +1 -0
- package/lib/collection-manager/interfaces/textarea.js +36 -0
- package/lib/collection-manager/interfaces/time.js +1 -0
- package/lib/file-manager/FileStorageShortcut.js +1 -1
- package/lib/locale/en_US.d.ts +8 -2
- package/lib/locale/en_US.js +9 -3
- package/lib/locale/zh_CN.d.ts +28 -2
- package/lib/locale/zh_CN.js +29 -3
- package/lib/plugin-manager/PluginManager.d.ts +1 -0
- package/lib/plugin-manager/PluginManager.js +23 -5
- package/lib/schema-component/antd/action/Action.Modal.js +1 -1
- package/lib/schema-component/antd/calendar/Calendar.Designer.js +16 -10
- package/lib/schema-component/antd/date-picker/DatePicker.d.ts +1 -1
- package/lib/schema-component/antd/date-picker/DatePicker.js +2 -2
- package/lib/schema-component/antd/date-picker/ReadPretty.js +6 -6
- package/lib/schema-component/antd/date-picker/util.d.ts +0 -10
- package/lib/schema-component/antd/date-picker/util.js +6 -89
- package/lib/schema-component/antd/form-item/FormItem.js +196 -12
- package/lib/schema-component/antd/grid/Grid.js +69 -3
- package/lib/schema-component/antd/input-number/InputNumber.d.ts +1 -5
- package/lib/schema-component/antd/input-number/InputNumber.js +28 -1
- package/lib/schema-component/antd/input-number/ReadPretty.js +2 -5
- package/lib/schema-component/antd/kanban/Kanban.Card.Designer.js +20 -14
- package/lib/schema-component/antd/menu/Menu.js +6 -3
- package/lib/schema-component/antd/percent/Percent.js +2 -2
- package/lib/schema-component/antd/record-picker/InputRecordPicker.js +27 -12
- package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +4 -2
- package/lib/schema-component/antd/table/Table.Array.js +2 -2
- package/lib/schema-component/antd/table/Table.Void.js +11 -1
- package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +3 -1
- package/lib/schema-component/antd/table-v2/Table.d.ts +0 -11
- package/lib/schema-component/antd/table-v2/Table.js +172 -94
- package/lib/schema-component/antd/table-v2/TableField.js +3 -0
- package/lib/schema-component/antd/tabs/Tabs.Designer.js +23 -12
- package/lib/schema-component/antd/tabs/Tabs.js +8 -1
- package/lib/schema-component/antd/time-picker/ReadPretty.js +10 -3
- package/lib/schema-component/core/DesignableSwitch.js +8 -1
- package/lib/schema-component/hooks/useDesignable.js +21 -21
- package/lib/schema-component/hooks/useProps.js +1 -1
- package/lib/schema-initializer/buttons/FormItemInitializers.js +14 -2
- package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +8 -0
- package/lib/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +14 -2
- package/lib/schema-initializer/buttons/RecordBlockInitializers.js +34 -4
- package/lib/schema-initializer/buttons/TabPaneInitializers.js +11 -3
- package/lib/schema-initializer/buttons/TableActionInitializers.js +11 -0
- package/lib/schema-initializer/components/assigned-field/AssignedField.d.ts +4 -0
- package/lib/schema-initializer/components/assigned-field/AssignedField.js +257 -66
- package/lib/schema-initializer/items/index.d.ts +2 -0
- package/lib/schema-initializer/items/index.js +54 -2
- package/lib/schema-initializer/utils.js +22 -2
- package/lib/schema-settings/SchemaSettings.js +7 -0
- package/lib/system-settings/SystemSettingsShortcut.js +37 -13
- package/package.json +7 -4
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
exports.
|
|
8
|
+
exports.Table = void 0;
|
|
7
9
|
|
|
8
10
|
var _icons = require("@ant-design/icons");
|
|
9
11
|
|
|
12
|
+
var _sortable = require("@dnd-kit/sortable");
|
|
13
|
+
|
|
10
14
|
var _css = require("@emotion/css");
|
|
11
15
|
|
|
12
16
|
var _react = require("@formily/react");
|
|
13
17
|
|
|
18
|
+
var _reactive = require("@formily/reactive");
|
|
19
|
+
|
|
20
|
+
var _ahooks = require("ahooks");
|
|
21
|
+
|
|
14
22
|
var _antd = require("antd");
|
|
15
23
|
|
|
16
24
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
25
|
|
|
18
|
-
var _react2 =
|
|
19
|
-
|
|
20
|
-
var _reactDragListview = _interopRequireDefault(require("react-drag-listview"));
|
|
26
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
21
27
|
|
|
22
28
|
var _reactI18next = require("react-i18next");
|
|
23
29
|
|
|
@@ -27,28 +33,28 @@ var _2 = require("../../../");
|
|
|
27
33
|
|
|
28
34
|
var _excluded = ["pagination", "useProps", "onChange"],
|
|
29
35
|
_excluded2 = ["pagination"],
|
|
30
|
-
_excluded3 = ["dragSort", "showIndex", "
|
|
36
|
+
_excluded3 = ["dragSort", "showIndex", "onRowSelectionChange", "onChange", "rowSelection", "rowKey", "required"];
|
|
31
37
|
|
|
32
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
38
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
33
39
|
|
|
34
|
-
function
|
|
40
|
+
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); }
|
|
35
41
|
|
|
36
|
-
function
|
|
42
|
+
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; }
|
|
37
43
|
|
|
38
|
-
function
|
|
44
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
45
|
|
|
40
46
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
41
47
|
|
|
42
48
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
43
49
|
|
|
44
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
45
|
-
|
|
46
50
|
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; }
|
|
47
51
|
|
|
48
52
|
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; }
|
|
49
53
|
|
|
50
54
|
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; }
|
|
51
55
|
|
|
56
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
57
|
+
|
|
52
58
|
var isColumnComponent = function isColumnComponent(schema) {
|
|
53
59
|
var _schema$xComponent;
|
|
54
60
|
|
|
@@ -66,8 +72,7 @@ var useTableColumns = function useTableColumns() {
|
|
|
66
72
|
|
|
67
73
|
var _useSchemaInitializer = (0, _2.useSchemaInitializer)(schema['x-initializer']),
|
|
68
74
|
exists = _useSchemaInitializer.exists,
|
|
69
|
-
render = _useSchemaInitializer.render;
|
|
70
|
-
|
|
75
|
+
render = _useSchemaInitializer.render;
|
|
71
76
|
|
|
72
77
|
var columns = schema.reduceProperties(function (buf, s) {
|
|
73
78
|
if (isColumnComponent(s)) {
|
|
@@ -82,7 +87,6 @@ var useTableColumns = function useTableColumns() {
|
|
|
82
87
|
}
|
|
83
88
|
}, []);
|
|
84
89
|
var dataIndex = (collectionFields === null || collectionFields === void 0 ? void 0 : collectionFields.length) > 0 ? collectionFields[0].name : s.name;
|
|
85
|
-
console.log('useTableColumns', s.name, s, field.value);
|
|
86
90
|
return {
|
|
87
91
|
title: /*#__PURE__*/_react2.default.createElement(_react.RecursionField, {
|
|
88
92
|
name: s.name,
|
|
@@ -98,7 +102,6 @@ var useTableColumns = function useTableColumns() {
|
|
|
98
102
|
|
|
99
103
|
var index = (_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value.indexOf(record); // console.log((Date.now() - start) / 1000);
|
|
100
104
|
|
|
101
|
-
console.log('useTableColumns.index', index, record);
|
|
102
105
|
return /*#__PURE__*/_react2.default.createElement(_2.RecordIndexProvider, {
|
|
103
106
|
index: index
|
|
104
107
|
}, /*#__PURE__*/_react2.default.createElement(_2.RecordProvider, {
|
|
@@ -123,40 +126,41 @@ var useTableColumns = function useTableColumns() {
|
|
|
123
126
|
});
|
|
124
127
|
};
|
|
125
128
|
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
}
|
|
129
|
+
var topActiveClass = (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n & > td {\n border-top: 2px solid rgba(241, 139, 98, 0.6) !important;\n }\n"])));
|
|
130
|
+
var bottomActiveClass = (0, _css.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n & > td {\n border-bottom: 2px solid rgba(241, 139, 98, 0.6) !important;\n }\n"])));
|
|
131
|
+
|
|
132
|
+
var SortableRow = function SortableRow(props) {
|
|
133
|
+
var _props$dataRowKey, _active$data$current$, _active$data$current, _over$data$current$so, _over$data$current;
|
|
134
|
+
|
|
135
|
+
var id = (_props$dataRowKey = props['data-row-key']) === null || _props$dataRowKey === void 0 ? void 0 : _props$dataRowKey.toString();
|
|
136
|
+
|
|
137
|
+
var _useSortable = (0, _sortable.useSortable)({
|
|
138
|
+
id: id
|
|
139
|
+
}),
|
|
140
|
+
setNodeRef = _useSortable.setNodeRef,
|
|
141
|
+
isOver = _useSortable.isOver,
|
|
142
|
+
active = _useSortable.active,
|
|
143
|
+
over = _useSortable.over;
|
|
144
|
+
|
|
145
|
+
var className = ((_active$data$current$ = active === null || active === void 0 ? void 0 : (_active$data$current = active.data.current) === null || _active$data$current === void 0 ? void 0 : _active$data$current.sortable.index) !== null && _active$data$current$ !== void 0 ? _active$data$current$ : -1) > ((_over$data$current$so = over === null || over === void 0 ? void 0 : (_over$data$current = over.data.current) === null || _over$data$current === void 0 ? void 0 : _over$data$current.sortable.index) !== null && _over$data$current$so !== void 0 ? _over$data$current$so : -1) ? topActiveClass : bottomActiveClass;
|
|
146
|
+
return /*#__PURE__*/_react2.default.createElement("tr", _objectSpread(_objectSpread({
|
|
147
|
+
ref: (active === null || active === void 0 ? void 0 : active.id) !== id ? setNodeRef : null
|
|
148
|
+
}, props), {}, {
|
|
149
|
+
className: (0, _classnames.default)(_defineProperty({}, className, active && isOver))
|
|
150
|
+
}));
|
|
150
151
|
};
|
|
151
|
-
exports.components = components;
|
|
152
152
|
|
|
153
|
-
var SortHandle = function SortHandle() {
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
var SortHandle = function SortHandle(props) {
|
|
154
|
+
var _useSortable2 = (0, _sortable.useSortable)({
|
|
155
|
+
id: props.id
|
|
156
|
+
}),
|
|
157
|
+
listeners = _useSortable2.listeners;
|
|
158
|
+
|
|
159
|
+
return /*#__PURE__*/_react2.default.createElement(_icons.MenuOutlined, _objectSpread(_objectSpread({}, listeners), {}, {
|
|
156
160
|
style: {
|
|
157
161
|
cursor: 'grab'
|
|
158
162
|
}
|
|
159
|
-
});
|
|
163
|
+
}));
|
|
160
164
|
};
|
|
161
165
|
|
|
162
166
|
var TableIndex = function TableIndex(props) {
|
|
@@ -191,6 +195,25 @@ var usePaginationProps = function usePaginationProps(pagination1, pagination2) {
|
|
|
191
195
|
}, pagination1), pagination2);
|
|
192
196
|
};
|
|
193
197
|
|
|
198
|
+
var useValidator = function useValidator(validator) {
|
|
199
|
+
var field = (0, _react.useField)();
|
|
200
|
+
(0, _react2.useEffect)(function () {
|
|
201
|
+
var dispose = (0, _reactive.reaction)(function () {
|
|
202
|
+
return field.value;
|
|
203
|
+
}, function (value) {
|
|
204
|
+
var message = validator(value);
|
|
205
|
+
field.setFeedback({
|
|
206
|
+
type: 'error',
|
|
207
|
+
code: 'ValidateError',
|
|
208
|
+
messages: message ? [message] : []
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
return function () {
|
|
212
|
+
dispose();
|
|
213
|
+
};
|
|
214
|
+
}, []);
|
|
215
|
+
};
|
|
216
|
+
|
|
194
217
|
var Table = (0, _react.observer)(function (props) {
|
|
195
218
|
var _field$data, _field$value3, _field$value3$slice;
|
|
196
219
|
|
|
@@ -211,13 +234,92 @@ var Table = (0, _react.observer)(function (props) {
|
|
|
211
234
|
dragSort = _others1$others$dragS === void 0 ? false : _others1$others$dragS,
|
|
212
235
|
_others1$others$showI = _others1$others.showIndex,
|
|
213
236
|
showIndex = _others1$others$showI === void 0 ? true : _others1$others$showI,
|
|
214
|
-
onRowDragEnd = _others1$others.onRowDragEnd,
|
|
215
237
|
onRowSelectionChange = _others1$others.onRowSelectionChange,
|
|
216
238
|
onTableChange = _others1$others.onChange,
|
|
217
239
|
rowSelection = _others1$others.rowSelection,
|
|
240
|
+
rowKey = _others1$others.rowKey,
|
|
241
|
+
required = _others1$others.required,
|
|
218
242
|
others = _objectWithoutProperties(_others1$others, _excluded3);
|
|
219
243
|
|
|
244
|
+
var onRowDragEnd = (0, _ahooks.useMemoizedFn)(others.onRowDragEnd || function () {});
|
|
220
245
|
var paginationProps = usePaginationProps(pagination1, pagination2);
|
|
246
|
+
var requiredValidator = field.required || required;
|
|
247
|
+
(0, _react2.useEffect)(function () {
|
|
248
|
+
field.setValidator(function (value) {
|
|
249
|
+
if (requiredValidator) {
|
|
250
|
+
return Array.isArray(value) && value.length > 0 ? null : 'The field value is required';
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return;
|
|
254
|
+
});
|
|
255
|
+
}, [requiredValidator]);
|
|
256
|
+
var components = (0, _react2.useMemo)(function () {
|
|
257
|
+
return {
|
|
258
|
+
header: {
|
|
259
|
+
wrapper: function wrapper(props) {
|
|
260
|
+
return /*#__PURE__*/_react2.default.createElement(_.DndContext, null, /*#__PURE__*/_react2.default.createElement("thead", _objectSpread({}, props)));
|
|
261
|
+
},
|
|
262
|
+
cell: function cell(props) {
|
|
263
|
+
return /*#__PURE__*/_react2.default.createElement("th", _objectSpread(_objectSpread({}, props), {}, {
|
|
264
|
+
className: (0, _classnames.default)(props.className, (0, _css.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n max-width: 300px;\n white-space: nowrap;\n &:hover .general-schema-designer {\n display: block;\n }\n "]))))
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
body: {
|
|
269
|
+
wrapper: function wrapper(props) {
|
|
270
|
+
return /*#__PURE__*/_react2.default.createElement(_.DndContext, {
|
|
271
|
+
onDragEnd: function onDragEnd(e) {
|
|
272
|
+
var _e$active, _e$active$data$curren, _e$active$data$curren2, _e$over, _e$over$data$current, _e$over$data$current$;
|
|
273
|
+
|
|
274
|
+
if (!e.active || !e.over) {
|
|
275
|
+
console.warn('move cancel');
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
var fromIndex = (_e$active = e.active) === null || _e$active === void 0 ? void 0 : (_e$active$data$curren = _e$active.data.current) === null || _e$active$data$curren === void 0 ? void 0 : (_e$active$data$curren2 = _e$active$data$curren.sortable) === null || _e$active$data$curren2 === void 0 ? void 0 : _e$active$data$curren2.index;
|
|
280
|
+
var toIndex = (_e$over = e.over) === null || _e$over === void 0 ? void 0 : (_e$over$data$current = _e$over.data.current) === null || _e$over$data$current === void 0 ? void 0 : (_e$over$data$current$ = _e$over$data$current.sortable) === null || _e$over$data$current$ === void 0 ? void 0 : _e$over$data$current$.index;
|
|
281
|
+
var from = field.value[fromIndex];
|
|
282
|
+
var to = field.value[toIndex];
|
|
283
|
+
field.move(fromIndex, toIndex);
|
|
284
|
+
onRowDragEnd({
|
|
285
|
+
fromIndex: fromIndex,
|
|
286
|
+
toIndex: toIndex,
|
|
287
|
+
from: from,
|
|
288
|
+
to: to
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}, /*#__PURE__*/_react2.default.createElement("tbody", _objectSpread({}, props)));
|
|
292
|
+
},
|
|
293
|
+
row: function row(props) {
|
|
294
|
+
return /*#__PURE__*/_react2.default.createElement(SortableRow, _objectSpread({}, props));
|
|
295
|
+
},
|
|
296
|
+
cell: function cell(props) {
|
|
297
|
+
return /*#__PURE__*/_react2.default.createElement("td", _objectSpread(_objectSpread({}, props), {}, {
|
|
298
|
+
className: (0, _classnames.default)(props.className, (0, _css.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n max-width: 300px;\n white-space: nowrap;\n .nb-read-pretty-input-number {\n text-align: right;\n }\n "]))))
|
|
299
|
+
}));
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
}, [field, onRowDragEnd, dragSort]);
|
|
304
|
+
|
|
305
|
+
var defaultRowKey = function defaultRowKey(record) {
|
|
306
|
+
var _field$value2, _field$value2$indexOf;
|
|
307
|
+
|
|
308
|
+
return (_field$value2 = field.value) === null || _field$value2 === void 0 ? void 0 : (_field$value2$indexOf = _field$value2.indexOf) === null || _field$value2$indexOf === void 0 ? void 0 : _field$value2$indexOf.call(_field$value2, record);
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
var getRowKey = function getRowKey(record) {
|
|
312
|
+
if (typeof rowKey === 'string') {
|
|
313
|
+
var _record$rowKey;
|
|
314
|
+
|
|
315
|
+
return (_record$rowKey = record[rowKey]) === null || _record$rowKey === void 0 ? void 0 : _record$rowKey.toString();
|
|
316
|
+
} else {
|
|
317
|
+
var _ref2;
|
|
318
|
+
|
|
319
|
+
return (_ref2 = (rowKey !== null && rowKey !== void 0 ? rowKey : defaultRowKey)(record)) === null || _ref2 === void 0 ? void 0 : _ref2.toString();
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
|
|
221
323
|
var restProps = {
|
|
222
324
|
rowSelection: rowSelection ? _objectSpread({
|
|
223
325
|
type: 'checkbox',
|
|
@@ -242,62 +344,32 @@ var Table = (0, _react.observer)(function (props) {
|
|
|
242
344
|
}
|
|
243
345
|
|
|
244
346
|
return /*#__PURE__*/_react2.default.createElement("div", {
|
|
245
|
-
className: (0, _classnames.default)(checked ? 'checked' : null, (0, _css.css)(
|
|
347
|
+
className: (0, _classnames.default)(checked ? 'checked' : null, (0, _css.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-evenly;\n padding-right: 8px;\n .nb-table-index {\n opacity: 0;\n }\n &:not(.checked) {\n .nb-table-index {\n opacity: 1;\n }\n }\n &:hover {\n .nb-table-index {\n opacity: 0;\n }\n .nb-origin-node {\n display: block;\n }\n }\n "]))))
|
|
246
348
|
}, /*#__PURE__*/_react2.default.createElement("div", {
|
|
247
|
-
className: (0, _classnames.default)(checked ? 'checked' : null, (0, _css.css)(
|
|
248
|
-
}, dragSort && /*#__PURE__*/_react2.default.createElement(SortHandle,
|
|
349
|
+
className: (0, _classnames.default)(checked ? 'checked' : null, (0, _css.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-evenly;\n "]))))
|
|
350
|
+
}, dragSort && /*#__PURE__*/_react2.default.createElement(SortHandle, {
|
|
351
|
+
id: getRowKey(record)
|
|
352
|
+
}), showIndex && /*#__PURE__*/_react2.default.createElement(TableIndex, {
|
|
249
353
|
index: index
|
|
250
354
|
})), /*#__PURE__*/_react2.default.createElement("div", {
|
|
251
|
-
className: (0, _classnames.default)('nb-origin-node', checked ? 'checked' : null, (0, _css.css)(
|
|
355
|
+
className: (0, _classnames.default)('nb-origin-node', checked ? 'checked' : null, (0, _css.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: absolute;\n right: 50%;\n transform: translateX(50%);\n &:not(.checked) {\n display: none;\n }\n "]))))
|
|
252
356
|
}, originNode));
|
|
253
357
|
}
|
|
254
358
|
}, rowSelection) : undefined
|
|
255
359
|
};
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
360
|
+
var SortableWrapper = (0, _react2.useCallback)(function (_ref3) {
|
|
361
|
+
var children = _ref3.children;
|
|
362
|
+
return dragSort ? /*#__PURE__*/_react2.default.createElement(_sortable.SortableContext, {
|
|
363
|
+
items: field.value.map(getRowKey),
|
|
364
|
+
children: children
|
|
365
|
+
}) : /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, {
|
|
366
|
+
children: children
|
|
367
|
+
});
|
|
368
|
+
}, [field, dragSort]);
|
|
263
369
|
return /*#__PURE__*/_react2.default.createElement("div", {
|
|
264
|
-
className: (0, _css.css)(
|
|
265
|
-
}, /*#__PURE__*/_react2.default.createElement(
|
|
266
|
-
|
|
267
|
-
onDragEnd: function () {
|
|
268
|
-
var _onDragEnd = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(fromIndex, toIndex) {
|
|
269
|
-
var from, to;
|
|
270
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
271
|
-
while (1) {
|
|
272
|
-
switch (_context.prev = _context.next) {
|
|
273
|
-
case 0:
|
|
274
|
-
from = field.value[fromIndex];
|
|
275
|
-
to = field.value[toIndex];
|
|
276
|
-
field.move(fromIndex, toIndex);
|
|
277
|
-
onRowDragEnd({
|
|
278
|
-
fromIndex: fromIndex,
|
|
279
|
-
toIndex: toIndex,
|
|
280
|
-
from: from,
|
|
281
|
-
to: to
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
case 4:
|
|
285
|
-
case "end":
|
|
286
|
-
return _context.stop();
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}, _callee);
|
|
290
|
-
}));
|
|
291
|
-
|
|
292
|
-
function onDragEnd(_x, _x2) {
|
|
293
|
-
return _onDragEnd.apply(this, arguments);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
return onDragEnd;
|
|
297
|
-
}(),
|
|
298
|
-
lineClassName: (0, _css.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n border-bottom: 2px solid rgba(241, 139, 98, 0.6) !important;\n "])))
|
|
299
|
-
}, /*#__PURE__*/_react2.default.createElement(_antd.Table, _objectSpread(_objectSpread(_objectSpread({
|
|
300
|
-
rowKey: defaultRowKey
|
|
370
|
+
className: (0, _css.css)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n .ant-table {\n overflow-x: auto;\n overflow-y: hidden;\n }\n "])))
|
|
371
|
+
}, /*#__PURE__*/_react2.default.createElement(SortableWrapper, null, /*#__PURE__*/_react2.default.createElement(_antd.Table, _objectSpread(_objectSpread(_objectSpread({
|
|
372
|
+
rowKey: rowKey !== null && rowKey !== void 0 ? rowKey : defaultRowKey
|
|
301
373
|
}, others), restProps), {}, {
|
|
302
374
|
pagination: paginationProps,
|
|
303
375
|
components: components,
|
|
@@ -308,6 +380,12 @@ var Table = (0, _react.observer)(function (props) {
|
|
|
308
380
|
// scroll={{ x: 12 * 300 + 80 }}
|
|
309
381
|
columns: columns,
|
|
310
382
|
dataSource: field === null || field === void 0 ? void 0 : (_field$value3 = field.value) === null || _field$value3 === void 0 ? void 0 : (_field$value3$slice = _field$value3.slice) === null || _field$value3$slice === void 0 ? void 0 : _field$value3$slice.call(_field$value3)
|
|
311
|
-
})))
|
|
383
|
+
}))), field.errors.length > 0 && /*#__PURE__*/_react2.default.createElement("div", {
|
|
384
|
+
className: "ant-formily-item-error-help ant-formily-item-help ant-formily-item-help-enter ant-formily-item-help-enter-active"
|
|
385
|
+
}, field.errors.map(function (error) {
|
|
386
|
+
return error.messages.map(function (message) {
|
|
387
|
+
return /*#__PURE__*/_react2.default.createElement("div", null, message);
|
|
388
|
+
});
|
|
389
|
+
})));
|
|
312
390
|
});
|
|
313
391
|
exports.Table = Table;
|
|
@@ -51,6 +51,9 @@ var TableField = (0, _react.observer)(function (props) {
|
|
|
51
51
|
ctx.field.added.add(fieldSchema.name);
|
|
52
52
|
}
|
|
53
53
|
}, []);
|
|
54
|
+
(0, _react2.useEffect)(function () {
|
|
55
|
+
field.decoratorProps.asterisk = fieldSchema.required;
|
|
56
|
+
}, [fieldSchema.required]);
|
|
54
57
|
return /*#__PURE__*/_react2.default.createElement("div", null, props.children);
|
|
55
58
|
});
|
|
56
59
|
exports.TableField = TableField;
|
|
@@ -39,28 +39,39 @@ var TabsDesigner = function TabsDesigner() {
|
|
|
39
39
|
properties: {
|
|
40
40
|
title: {
|
|
41
41
|
title: t('Tab name'),
|
|
42
|
+
required: true,
|
|
42
43
|
'x-decorator': 'FormItem',
|
|
43
44
|
'x-component': 'Input',
|
|
44
45
|
'x-component-props': {}
|
|
46
|
+
},
|
|
47
|
+
icon: {
|
|
48
|
+
title: t('Icon'),
|
|
49
|
+
'x-decorator': 'FormItem',
|
|
50
|
+
'x-component': 'IconPicker',
|
|
51
|
+
'x-component-props': {}
|
|
45
52
|
}
|
|
46
53
|
}
|
|
47
54
|
},
|
|
48
55
|
initialValues: {
|
|
49
|
-
title: field.title
|
|
56
|
+
title: field.title,
|
|
57
|
+
icon: field.componentProps.icon
|
|
50
58
|
},
|
|
51
59
|
onSubmit: function onSubmit(_ref) {
|
|
52
|
-
var
|
|
60
|
+
var _schema;
|
|
53
61
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
var title = _ref.title,
|
|
63
|
+
icon = _ref.icon;
|
|
64
|
+
var props = fieldSchema['x-component-props'] || {};
|
|
65
|
+
fieldSchema.title = title;
|
|
66
|
+
field.title = title;
|
|
67
|
+
props.icon = icon;
|
|
68
|
+
field.componentProps.icon = icon;
|
|
69
|
+
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
70
|
+
fieldSchema['x-component-props'].icon = icon;
|
|
71
|
+
dn.emit('patch', {
|
|
72
|
+
schema: (_schema = {}, _defineProperty(_schema, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema, "title", title), _defineProperty(_schema, 'x-component-props', props), _schema)
|
|
73
|
+
});
|
|
74
|
+
dn.refresh();
|
|
64
75
|
}
|
|
65
76
|
}), /*#__PURE__*/_react2.default.createElement(_2.SchemaSettings.Divider, null), /*#__PURE__*/_react2.default.createElement(_2.SchemaSettings.Remove, null));
|
|
66
77
|
};
|
|
@@ -15,6 +15,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
15
15
|
|
|
16
16
|
var _react2 = _interopRequireDefault(require("react"));
|
|
17
17
|
|
|
18
|
+
var _icon = require("../../../icon");
|
|
19
|
+
|
|
18
20
|
var _schemaInitializer = require("../../../schema-initializer");
|
|
19
21
|
|
|
20
22
|
var _common = require("../../common");
|
|
@@ -61,6 +63,11 @@ Tabs.TabPane = (0, _react.observer)(function (props) {
|
|
|
61
63
|
var field = (0, _react.useField)();
|
|
62
64
|
return /*#__PURE__*/_react2.default.createElement(_common.SortableItem, {
|
|
63
65
|
className: (0, _classnames.default)('nb-action-link', designerCss, props.className)
|
|
64
|
-
}, props.
|
|
66
|
+
}, props.icon && /*#__PURE__*/_react2.default.createElement(_icon.Icon, {
|
|
67
|
+
style: {
|
|
68
|
+
marginRight: 2
|
|
69
|
+
},
|
|
70
|
+
type: props.icon
|
|
71
|
+
}), " ", props.tab || field.title, /*#__PURE__*/_react2.default.createElement(Designer, null));
|
|
65
72
|
});
|
|
66
73
|
Tabs.Designer = _Tabs.TabsDesigner;
|
|
@@ -11,17 +11,24 @@ var _shared = require("@formily/shared");
|
|
|
11
11
|
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
13
|
|
|
14
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
15
|
+
|
|
14
16
|
var _react = _interopRequireDefault(require("react"));
|
|
15
17
|
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
var ReadPretty = function ReadPretty(props) {
|
|
19
|
-
var
|
|
21
|
+
var value = props.value,
|
|
22
|
+
_props$format = props.format,
|
|
23
|
+
format = _props$format === void 0 ? 'HH:mm:ss' : _props$format;
|
|
20
24
|
var prefixCls = (0, _builtins__.usePrefixCls)('description-text', props);
|
|
25
|
+
var values = (0, _shared.toArr)(value);
|
|
21
26
|
|
|
22
27
|
var getLabels = function getLabels() {
|
|
23
|
-
var labels = (
|
|
24
|
-
|
|
28
|
+
var labels = values.map(function (v) {
|
|
29
|
+
return (0, _moment.default)(v, 'HH:mm:ss').format(format);
|
|
30
|
+
});
|
|
31
|
+
return labels.join('~');
|
|
25
32
|
};
|
|
26
33
|
|
|
27
34
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -15,6 +15,8 @@ var _ = require("..");
|
|
|
15
15
|
|
|
16
16
|
var _pluginManager = require("../../plugin-manager");
|
|
17
17
|
|
|
18
|
+
var _reactHotkeysHook = require("react-hotkeys-hook");
|
|
19
|
+
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
21
|
|
|
20
22
|
var DesignableSwitch = function DesignableSwitch() {
|
|
@@ -29,12 +31,17 @@ var DesignableSwitch = function DesignableSwitch() {
|
|
|
29
31
|
|
|
30
32
|
if (designable) {
|
|
31
33
|
style['backgroundColor'] = '#f18b62';
|
|
32
|
-
}
|
|
34
|
+
} // 快捷键切换编辑状态
|
|
35
|
+
|
|
33
36
|
|
|
37
|
+
(0, _reactHotkeysHook.useHotkeys)('Ctrl+Shift+U', function () {
|
|
38
|
+
return setDesignable(!designable);
|
|
39
|
+
}, [designable]);
|
|
34
40
|
return /*#__PURE__*/_react.default.createElement(_pluginManager.PluginManager.Toolbar.Item, {
|
|
35
41
|
selected: designable,
|
|
36
42
|
icon: /*#__PURE__*/_react.default.createElement(_icons.HighlightOutlined, null),
|
|
37
43
|
title: t('UI Editor'),
|
|
44
|
+
subtitle: 'Ctrl+Shift+U',
|
|
38
45
|
style: style,
|
|
39
46
|
onClick: function onClick() {
|
|
40
47
|
setDesignable(!designable);
|
|
@@ -755,6 +755,27 @@ var Designable = /*#__PURE__*/function () {
|
|
|
755
755
|
wrap = _options$wrap4 === void 0 ? defaultWrap : _options$wrap4,
|
|
756
756
|
breakRemoveOn = options.breakRemoveOn,
|
|
757
757
|
removeParentsIfNoChildren = options.removeParentsIfNoChildren;
|
|
758
|
+
var order = 0;
|
|
759
|
+
var newOrder = 0;
|
|
760
|
+
var start = false;
|
|
761
|
+
var properties = {};
|
|
762
|
+
this.current.parent.mapProperties(function (property, key) {
|
|
763
|
+
property['x-index'] = order;
|
|
764
|
+
|
|
765
|
+
if (key === _this4.current.name) {
|
|
766
|
+
++order;
|
|
767
|
+
newOrder = order;
|
|
768
|
+
start = true;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
++order;
|
|
772
|
+
|
|
773
|
+
if (start && key !== _this4.current.name) {
|
|
774
|
+
properties[key] = property;
|
|
775
|
+
|
|
776
|
+
_this4.current.parent.removeProperty(key);
|
|
777
|
+
}
|
|
778
|
+
});
|
|
758
779
|
|
|
759
780
|
if (_react.Schema.isSchemaInstance(schema)) {
|
|
760
781
|
if (this.parentsIn(schema)) {
|
|
@@ -778,27 +799,6 @@ var Designable = /*#__PURE__*/function () {
|
|
|
778
799
|
schema = (0, _cloneDeep.default)(schema);
|
|
779
800
|
}
|
|
780
801
|
|
|
781
|
-
var order = 0;
|
|
782
|
-
var newOrder = 0;
|
|
783
|
-
var start = false;
|
|
784
|
-
var properties = {};
|
|
785
|
-
this.current.parent.mapProperties(function (property, key) {
|
|
786
|
-
property['x-index'] = order;
|
|
787
|
-
|
|
788
|
-
if (key === _this4.current.name) {
|
|
789
|
-
++order;
|
|
790
|
-
newOrder = order;
|
|
791
|
-
start = true;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
++order;
|
|
795
|
-
|
|
796
|
-
if (start && key !== _this4.current.name) {
|
|
797
|
-
properties[key] = property;
|
|
798
|
-
|
|
799
|
-
_this4.current.parent.removeProperty(key);
|
|
800
|
-
}
|
|
801
|
-
});
|
|
802
802
|
this.prepareProperty(schema);
|
|
803
803
|
var wrapped = wrap(schema);
|
|
804
804
|
var s = this.current.parent.addProperty(wrapped.name || (0, _shared.uid)(), wrapped);
|
|
@@ -17,7 +17,7 @@ var useProps = function useProps(props, options) {
|
|
|
17
17
|
var useProps = props.useProps,
|
|
18
18
|
props1 = _objectWithoutProperties(props, _excluded);
|
|
19
19
|
|
|
20
|
-
var props2 =
|
|
20
|
+
var props2 = typeof useProps === 'function' ? useProps() : {};
|
|
21
21
|
return (0, _shared.merge)(props1 || {}, props2, options);
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.FormItemInitializers = void 0;
|
|
7
7
|
|
|
8
|
+
var _lodash = require("lodash");
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireDefault(require("react"));
|
|
9
11
|
|
|
10
12
|
var _reactI18next = require("react-i18next");
|
|
@@ -22,14 +24,24 @@ var FormItemInitializers = function FormItemInitializers(props) {
|
|
|
22
24
|
|
|
23
25
|
var insertPosition = props.insertPosition,
|
|
24
26
|
component = props.component;
|
|
27
|
+
var associationFields = (0, _utils.useAssociatedFormItemInitializerFields)({
|
|
28
|
+
readPretty: true,
|
|
29
|
+
block: 'Form'
|
|
30
|
+
});
|
|
25
31
|
return /*#__PURE__*/_react.default.createElement(_SchemaInitializer.SchemaInitializer.Button, {
|
|
26
32
|
wrap: _utils.gridRowColWrap,
|
|
27
33
|
icon: 'SettingOutlined',
|
|
28
|
-
items: [{
|
|
34
|
+
items: (0, _lodash.union)([{
|
|
29
35
|
type: 'itemGroup',
|
|
30
36
|
title: t('Display fields'),
|
|
31
37
|
children: (0, _utils.useFormItemInitializerFields)()
|
|
38
|
+
}], associationFields.length > 0 ? [{
|
|
39
|
+
type: 'divider'
|
|
32
40
|
}, {
|
|
41
|
+
type: 'itemGroup',
|
|
42
|
+
title: t('Display association fields'),
|
|
43
|
+
children: associationFields
|
|
44
|
+
}] : [], [{
|
|
33
45
|
type: 'divider'
|
|
34
46
|
}, {
|
|
35
47
|
type: 'item',
|
|
@@ -45,7 +57,7 @@ var FormItemInitializers = function FormItemInitializers(props) {
|
|
|
45
57
|
content: t('This is a demo text, **supports Markdown syntax**.')
|
|
46
58
|
}
|
|
47
59
|
}
|
|
48
|
-
}],
|
|
60
|
+
}]),
|
|
49
61
|
insertPosition: insertPosition,
|
|
50
62
|
component: component,
|
|
51
63
|
title: component ? null : t('Configure fields')
|