@nocobase/client 0.7.2-alpha.5 → 0.7.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/FormBlockProvider.js +8 -3
- package/es/block-provider/TableSelectorProvider.js +41 -13
- package/es/block-provider/hooks/index.d.ts +6 -0
- package/es/block-provider/hooks/index.js +145 -63
- package/es/collection-manager/CollectionField.js +5 -3
- package/es/collection-manager/interfaces/input.js +103 -0
- package/es/collection-manager/interfaces/integer.js +63 -0
- package/es/collection-manager/interfaces/markdown.js +34 -0
- package/es/collection-manager/interfaces/number.js +55 -0
- package/es/collection-manager/interfaces/password.js +35 -1
- package/es/collection-manager/interfaces/percent.js +97 -0
- package/es/collection-manager/interfaces/richText.js +34 -0
- package/es/collection-manager/interfaces/textarea.js +34 -0
- package/es/file-manager/FileStorageShortcut.js +2 -2
- package/es/locale/en_US.d.ts +5 -0
- package/es/locale/en_US.js +6 -1
- package/es/locale/zh_CN.d.ts +23 -0
- package/es/locale/zh_CN.js +24 -1
- package/es/plugin-manager/PluginManager.js +8 -4
- package/es/schema-component/antd/action/Action.Modal.js +1 -1
- package/es/schema-component/antd/form-item/FormItem.js +156 -3
- 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/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 +4 -2
- 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.js +1 -4
- package/es/schema-component/antd/time-picker/ReadPretty.js +11 -5
- 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/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 +253 -69
- package/es/schema-initializer/items/index.d.ts +2 -0
- package/es/schema-initializer/items/index.js +46 -1
- package/es/schema-initializer/utils.js +6 -2
- package/es/system-settings/SystemSettingsShortcut.js +35 -12
- package/lib/block-provider/FormBlockProvider.js +7 -2
- package/lib/block-provider/TableSelectorProvider.js +41 -13
- package/lib/block-provider/hooks/index.d.ts +6 -0
- package/lib/block-provider/hooks/index.js +154 -65
- package/lib/collection-manager/CollectionField.js +5 -2
- package/lib/collection-manager/interfaces/input.js +104 -0
- package/lib/collection-manager/interfaces/integer.js +65 -0
- package/lib/collection-manager/interfaces/markdown.js +35 -0
- package/lib/collection-manager/interfaces/number.js +56 -0
- package/lib/collection-manager/interfaces/password.js +36 -1
- package/lib/collection-manager/interfaces/percent.js +99 -0
- package/lib/collection-manager/interfaces/richText.js +35 -0
- package/lib/collection-manager/interfaces/textarea.js +35 -0
- package/lib/file-manager/FileStorageShortcut.js +1 -1
- package/lib/locale/en_US.d.ts +5 -0
- package/lib/locale/en_US.js +6 -1
- package/lib/locale/zh_CN.d.ts +23 -0
- package/lib/locale/zh_CN.js +24 -1
- package/lib/plugin-manager/PluginManager.js +8 -3
- package/lib/schema-component/antd/action/Action.Modal.js +1 -1
- package/lib/schema-component/antd/form-item/FormItem.js +165 -5
- 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 +29 -2
- 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 +3 -1
- 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.js +1 -4
- package/lib/schema-component/antd/time-picker/ReadPretty.js +10 -3
- 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/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 +254 -66
- package/lib/schema-initializer/items/index.d.ts +2 -0
- package/lib/schema-initializer/items/index.js +52 -1
- package/lib/schema-initializer/utils.js +6 -2
- package/lib/system-settings/SystemSettingsShortcut.js +37 -13
- package/package.json +6 -4
package/es/locale/zh_CN.js
CHANGED
|
@@ -98,6 +98,7 @@ export default {
|
|
|
98
98
|
"Update": "更新",
|
|
99
99
|
"View": "查看",
|
|
100
100
|
"View record": "查看数据",
|
|
101
|
+
"Refresh": "刷新",
|
|
101
102
|
"Data changes": "数据变更",
|
|
102
103
|
"Field name": "字段标识",
|
|
103
104
|
"Before change": "变更前",
|
|
@@ -232,6 +233,24 @@ export default {
|
|
|
232
233
|
"Label field": "标签字段",
|
|
233
234
|
"Default is the ID field": "默认为 ID 字段",
|
|
234
235
|
"Set default sorting rules": "设置排序规则",
|
|
236
|
+
"Set validation rules": "设置验证规则",
|
|
237
|
+
"Max length": "最大长度",
|
|
238
|
+
"Min length": "最小长度",
|
|
239
|
+
"Maximum": "最大值",
|
|
240
|
+
"Minimum": "最小值",
|
|
241
|
+
"Max length must greater than min length": "最大长度必须大于最小长度",
|
|
242
|
+
"Min length must less than max length": "最小长度必须小于最大长度",
|
|
243
|
+
"Maximum must greater than minimum": "最大值必须大于最小值",
|
|
244
|
+
"Minimum must less than maximum": "最小值必须小于最大值",
|
|
245
|
+
"Validation rule": "验证规则",
|
|
246
|
+
"Add validation rule": "新增验证规则",
|
|
247
|
+
"Format": "格式",
|
|
248
|
+
"Regular expression": "正则表达式",
|
|
249
|
+
"Error message": "错误消息",
|
|
250
|
+
"Length": "长度",
|
|
251
|
+
"The field value cannot be greater than ": "数值不能大于",
|
|
252
|
+
"The field value cannot be less than ": "数值不能小于",
|
|
253
|
+
"The field value is not an integer number": "数字不是整数",
|
|
235
254
|
"is before": "早于",
|
|
236
255
|
"is after": "晚于",
|
|
237
256
|
"is on or after": "不早于",
|
|
@@ -540,6 +559,7 @@ export default {
|
|
|
540
559
|
'Dynamic value': '动态值',
|
|
541
560
|
'Current user': '当前用户',
|
|
542
561
|
'Current record': '当前记录',
|
|
562
|
+
'Current time': '当前时间',
|
|
543
563
|
'Popup close method': '弹窗关闭方式',
|
|
544
564
|
'Automatic close': '自动关闭',
|
|
545
565
|
'Manually close': '手动关闭',
|
|
@@ -574,5 +594,8 @@ export default {
|
|
|
574
594
|
"One to one (has one)": "一对一(has one)",
|
|
575
595
|
"One to one (belongs to)": "一对一(belongs to)",
|
|
576
596
|
"Use the same time zone (GMT) for all users": "所有用户使用同一时区 (格林尼治标准时间)",
|
|
577
|
-
"Province/city/area name": "省市区名称"
|
|
597
|
+
"Province/city/area name": "省市区名称",
|
|
598
|
+
"Enabled languages": "启用的语言",
|
|
599
|
+
"View all plugins": "查看所有插件",
|
|
600
|
+
"Print": "打印"
|
|
578
601
|
};
|
|
@@ -24,11 +24,12 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
24
24
|
|
|
25
25
|
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; }
|
|
26
26
|
|
|
27
|
-
import {
|
|
27
|
+
import { AppstoreOutlined, EllipsisOutlined } from '@ant-design/icons';
|
|
28
28
|
import { ConfigProvider, Menu, Spin, Tooltip } from 'antd';
|
|
29
29
|
import cls from 'classnames';
|
|
30
30
|
import { get } from 'lodash';
|
|
31
31
|
import React, { createContext, useContext } from 'react';
|
|
32
|
+
import { useTranslation } from 'react-i18next';
|
|
32
33
|
import { useAPIClient, useRequest } from '../api-client';
|
|
33
34
|
import { PluginManagerContext } from './context';
|
|
34
35
|
export var usePrefixCls = function usePrefixCls(tag, props) {
|
|
@@ -80,6 +81,9 @@ PluginManager.Toolbar = function (props) {
|
|
|
80
81
|
pinned = _splitItems2[0],
|
|
81
82
|
unpinned = _splitItems2[1];
|
|
82
83
|
|
|
84
|
+
var _useTranslation = useTranslation(),
|
|
85
|
+
t = _useTranslation.t;
|
|
86
|
+
|
|
83
87
|
return /*#__PURE__*/React.createElement("div", {
|
|
84
88
|
style: {
|
|
85
89
|
display: 'inline-block'
|
|
@@ -100,7 +104,7 @@ PluginManager.Toolbar = function (props) {
|
|
|
100
104
|
}), unpinned.length > 0 && /*#__PURE__*/React.createElement(Menu.SubMenu, {
|
|
101
105
|
popupClassName: 'pm-sub-menu',
|
|
102
106
|
key: 'more',
|
|
103
|
-
title: /*#__PURE__*/React.createElement(
|
|
107
|
+
title: /*#__PURE__*/React.createElement(EllipsisOutlined, null)
|
|
104
108
|
}, unpinned.map(function (item, index) {
|
|
105
109
|
var Action = get(components, item.component);
|
|
106
110
|
return Action && /*#__PURE__*/React.createElement(ToolbarItemContext.Provider, {
|
|
@@ -112,8 +116,8 @@ PluginManager.Toolbar = function (props) {
|
|
|
112
116
|
}), /*#__PURE__*/React.createElement(Menu.Item, {
|
|
113
117
|
key: 'plugins',
|
|
114
118
|
disabled: true,
|
|
115
|
-
icon: /*#__PURE__*/React.createElement(
|
|
116
|
-
},
|
|
119
|
+
icon: /*#__PURE__*/React.createElement(AppstoreOutlined, null)
|
|
120
|
+
}, t('View all plugins')))));
|
|
117
121
|
};
|
|
118
122
|
|
|
119
123
|
PluginManager.Toolbar.Item = function (props) {
|
|
@@ -52,7 +52,7 @@ export var ActionModal = observer(function (props) {
|
|
|
52
52
|
onCancel: function onCancel() {
|
|
53
53
|
return setVisible(false, true);
|
|
54
54
|
},
|
|
55
|
-
className: classNames(others.className, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.nb-action-popup {\n .ant-modal-body {\n background: #f0f2f5;\n }\n }\n "])))),
|
|
55
|
+
className: classNames(others.className, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.nb-action-popup {\n .ant-modal-header {\n display: none;\n }\n .ant-modal-body {\n padding-top: 16px;\n }\n .ant-modal-body {\n background: #f0f2f5;\n }\n .ant-modal-close-x {\n width: 32px;\n height: 32px;\n line-height: 32px;\n }\n }\n "])))),
|
|
56
56
|
footer: footerSchema ? /*#__PURE__*/React.createElement("div", {
|
|
57
57
|
className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: flex-end;\n width: 100%;\n .ant-btn {\n margin-right: 8px;\n }\n "])))
|
|
58
58
|
}, /*#__PURE__*/React.createElement(RecursionField, {
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
var _templateObject;
|
|
2
2
|
|
|
3
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
3
9
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
4
10
|
|
|
5
11
|
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; }
|
|
@@ -9,7 +15,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
9
15
|
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; }
|
|
10
16
|
|
|
11
17
|
import { css } from '@emotion/css';
|
|
12
|
-
import { FormItem as Item } from '@formily/antd';
|
|
18
|
+
import { ArrayCollapse, FormItem as Item, FormLayout } from '@formily/antd';
|
|
13
19
|
import { useField, useFieldSchema } from '@formily/react';
|
|
14
20
|
import { uid } from '@formily/shared';
|
|
15
21
|
import React from 'react';
|
|
@@ -20,6 +26,7 @@ import { useCollection, useCollectionManager } from '../../../collection-manager
|
|
|
20
26
|
import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
|
|
21
27
|
import { BlockItem } from '../block-item';
|
|
22
28
|
import { HTMLEncode } from '../input/shared';
|
|
29
|
+
import * as _ from 'lodash';
|
|
23
30
|
|
|
24
31
|
var divWrap = function divWrap(schema) {
|
|
25
32
|
return {
|
|
@@ -45,7 +52,7 @@ export var FormItem = function FormItem(props) {
|
|
|
45
52
|
};
|
|
46
53
|
|
|
47
54
|
FormItem.Designer = function (props) {
|
|
48
|
-
var _collectionField$uiSc, _collectionField$uiSc2, _fieldSchema$xDecora, _field$componentProps, _field$componentProps2;
|
|
55
|
+
var _interfaceConfig$vali, _collectionField$uiSc, _collectionField$uiSc2, _fieldSchema$xDecora, _fieldSchema$xCompon, _field$componentProps, _field$componentProps2;
|
|
49
56
|
|
|
50
57
|
var _useCollectionManager = useCollectionManager(),
|
|
51
58
|
getCollectionFields = _useCollectionManager.getCollectionFields,
|
|
@@ -76,6 +83,7 @@ FormItem.Designer = function (props) {
|
|
|
76
83
|
var compile = useCompile();
|
|
77
84
|
var collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
|
|
78
85
|
var interfaceConfig = getInterface(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface);
|
|
86
|
+
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);
|
|
79
87
|
var originalTitle = collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc = collectionField.uiSchema) === null || _collectionField$uiSc === void 0 ? void 0 : _collectionField$uiSc.title;
|
|
80
88
|
var targetFields = (collectionField === null || collectionField === void 0 ? void 0 : collectionField.target) ? getCollectionFields(collectionField.target) : [];
|
|
81
89
|
var isSubFormAssocitionField = field.address.segments.includes('__form_grid');
|
|
@@ -211,6 +219,151 @@ FormItem.Designer = function (props) {
|
|
|
211
219
|
});
|
|
212
220
|
refresh();
|
|
213
221
|
}
|
|
222
|
+
}), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && validateSchema && /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
|
|
223
|
+
title: t('Set validation rules'),
|
|
224
|
+
components: {
|
|
225
|
+
ArrayCollapse: ArrayCollapse,
|
|
226
|
+
FormLayout: FormLayout
|
|
227
|
+
},
|
|
228
|
+
schema: {
|
|
229
|
+
type: 'object',
|
|
230
|
+
title: t('Set validation rules'),
|
|
231
|
+
properties: {
|
|
232
|
+
rules: {
|
|
233
|
+
type: 'array',
|
|
234
|
+
default: fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-validator'],
|
|
235
|
+
'x-component': 'ArrayCollapse',
|
|
236
|
+
'x-decorator': 'FormItem',
|
|
237
|
+
'x-component-props': {
|
|
238
|
+
accordion: true
|
|
239
|
+
},
|
|
240
|
+
maxItems: 3,
|
|
241
|
+
items: {
|
|
242
|
+
type: 'object',
|
|
243
|
+
'x-component': 'ArrayCollapse.CollapsePanel',
|
|
244
|
+
'x-component-props': {
|
|
245
|
+
header: '{{ t("Validation rule") }}'
|
|
246
|
+
},
|
|
247
|
+
properties: {
|
|
248
|
+
index: {
|
|
249
|
+
type: 'void',
|
|
250
|
+
'x-component': 'ArrayCollapse.Index'
|
|
251
|
+
},
|
|
252
|
+
layout: {
|
|
253
|
+
type: 'void',
|
|
254
|
+
'x-component': 'FormLayout',
|
|
255
|
+
'x-component-props': {
|
|
256
|
+
labelStyle: {
|
|
257
|
+
marginTop: '6px'
|
|
258
|
+
},
|
|
259
|
+
labelCol: 8,
|
|
260
|
+
wrapperCol: 16
|
|
261
|
+
},
|
|
262
|
+
properties: _objectSpread(_objectSpread({}, validateSchema), {}, {
|
|
263
|
+
message: {
|
|
264
|
+
type: 'string',
|
|
265
|
+
title: '{{ t("Error message") }}',
|
|
266
|
+
'x-decorator': 'FormItem',
|
|
267
|
+
'x-component': 'Input.TextArea',
|
|
268
|
+
'x-component-props': {
|
|
269
|
+
autoSize: {
|
|
270
|
+
minRows: 2,
|
|
271
|
+
maxRows: 2
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
})
|
|
276
|
+
},
|
|
277
|
+
remove: {
|
|
278
|
+
type: 'void',
|
|
279
|
+
'x-component': 'ArrayCollapse.Remove'
|
|
280
|
+
},
|
|
281
|
+
moveUp: {
|
|
282
|
+
type: 'void',
|
|
283
|
+
'x-component': 'ArrayCollapse.MoveUp'
|
|
284
|
+
},
|
|
285
|
+
moveDown: {
|
|
286
|
+
type: 'void',
|
|
287
|
+
'x-component': 'ArrayCollapse.MoveDown'
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
properties: {
|
|
292
|
+
add: {
|
|
293
|
+
type: 'void',
|
|
294
|
+
title: '{{ t("Add validation rule") }}',
|
|
295
|
+
'x-component': 'ArrayCollapse.Addition',
|
|
296
|
+
'x-reactions': {
|
|
297
|
+
dependencies: ['rules'],
|
|
298
|
+
fulfill: {
|
|
299
|
+
state: {
|
|
300
|
+
disabled: '{{$deps[0].length >= 3}}'
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
onSubmit: function onSubmit(v) {
|
|
310
|
+
var _collectionField$uiSc3;
|
|
311
|
+
|
|
312
|
+
var rules = [];
|
|
313
|
+
|
|
314
|
+
var _iterator = _createForOfIteratorHelper(v.rules),
|
|
315
|
+
_step;
|
|
316
|
+
|
|
317
|
+
try {
|
|
318
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
319
|
+
var _rule = _step.value;
|
|
320
|
+
rules.push(_.pickBy(_rule, _.identity));
|
|
321
|
+
}
|
|
322
|
+
} catch (err) {
|
|
323
|
+
_iterator.e(err);
|
|
324
|
+
} finally {
|
|
325
|
+
_iterator.f();
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']); // return;
|
|
329
|
+
// if (['number'].includes(collectionField?.interface) && collectionField?.uiSchema?.['x-component-props']?.['stringMode'] === true) {
|
|
330
|
+
// rules['numberStringMode'] = true;
|
|
331
|
+
// }
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
if (['percent'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface)) {
|
|
335
|
+
var _iterator2 = _createForOfIteratorHelper(rules),
|
|
336
|
+
_step2;
|
|
337
|
+
|
|
338
|
+
try {
|
|
339
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
340
|
+
var rule = _step2.value;
|
|
341
|
+
|
|
342
|
+
if (!!rule.maxValue || !!rule.minValue) {
|
|
343
|
+
rule['percentMode'] = true;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
if (rule.percentFormat) {
|
|
347
|
+
rule['percentFormats'] = true;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
} catch (err) {
|
|
351
|
+
_iterator2.e(err);
|
|
352
|
+
} finally {
|
|
353
|
+
_iterator2.f();
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
var concatValidator = _.concat([], (collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc3 = collectionField.uiSchema) === null || _collectionField$uiSc3 === void 0 ? void 0 : _collectionField$uiSc3['x-validator']) || [], rules);
|
|
358
|
+
|
|
359
|
+
field.validator = concatValidator;
|
|
360
|
+
fieldSchema['x-validator'] = rules;
|
|
361
|
+
schema['x-validator'] = rules;
|
|
362
|
+
dn.emit('patch', {
|
|
363
|
+
schema: schema
|
|
364
|
+
});
|
|
365
|
+
refresh();
|
|
366
|
+
}
|
|
214
367
|
}), form && !isSubFormAssocitionField && ['o2o', 'oho', 'obo', 'o2m'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
|
|
215
368
|
title: t('Field component'),
|
|
216
369
|
options: (collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) === 'o2m' ? [{
|
|
@@ -257,7 +410,7 @@ FormItem.Designer = function (props) {
|
|
|
257
410
|
}
|
|
258
411
|
});
|
|
259
412
|
}
|
|
260
|
-
}), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) !== 'o2m' && /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
|
|
413
|
+
}), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) !== 'o2m' && (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon['pattern-disable']) != true && /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
|
|
261
414
|
key: "pattern",
|
|
262
415
|
title: t('Pattern'),
|
|
263
416
|
options: [{
|
|
@@ -20,19 +20,29 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
20
20
|
|
|
21
21
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
22
22
|
|
|
23
|
-
import { useDndMonitor, useDroppable } from '@dnd-kit/core';
|
|
23
|
+
import { useDndContext, useDndMonitor, useDroppable } from '@dnd-kit/core';
|
|
24
24
|
import { css } from '@emotion/css';
|
|
25
25
|
import { observer, RecursionField, Schema, useField, useFieldSchema } from '@formily/react';
|
|
26
26
|
import { uid } from '@formily/shared';
|
|
27
27
|
import cls from 'classnames';
|
|
28
|
-
import React, { createContext, useContext, useState } from 'react';
|
|
29
|
-
import { useSchemaInitializer } from '../../../';
|
|
28
|
+
import React, { createContext, useContext, useEffect, useRef, useState } from 'react';
|
|
29
|
+
import { useFormBlockContext, useSchemaInitializer } from '../../../';
|
|
30
30
|
import { DndContext } from '../../common/dnd-context';
|
|
31
31
|
var GridRowContext = /*#__PURE__*/createContext(null);
|
|
32
32
|
var GridColContext = /*#__PURE__*/createContext(null);
|
|
33
33
|
var GridContext = /*#__PURE__*/createContext({});
|
|
34
34
|
|
|
35
|
+
var breakRemoveOnGrid = function breakRemoveOnGrid(s) {
|
|
36
|
+
return s['x-component'] === 'Grid';
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var breakRemoveOnRow = function breakRemoveOnRow(s) {
|
|
40
|
+
return s['x-component'] === 'Grid.Row';
|
|
41
|
+
};
|
|
42
|
+
|
|
35
43
|
var ColDivider = function ColDivider(props) {
|
|
44
|
+
var _dndContext$active, _dndContext$active$da, _dndContext$active$da2;
|
|
45
|
+
|
|
36
46
|
var _useDroppable = useDroppable({
|
|
37
47
|
id: props.id,
|
|
38
48
|
data: props.data
|
|
@@ -43,14 +53,31 @@ var ColDivider = function ColDivider(props) {
|
|
|
43
53
|
var droppableStyle = {
|
|
44
54
|
backgroundColor: isOver ? 'rgba(241, 139, 98, .1)' : undefined
|
|
45
55
|
};
|
|
56
|
+
var dndContext = useDndContext();
|
|
57
|
+
var activeSchema = (_dndContext$active = dndContext.active) === null || _dndContext$active === void 0 ? void 0 : (_dndContext$active$da = _dndContext$active.data.current) === null || _dndContext$active$da === void 0 ? void 0 : (_dndContext$active$da2 = _dndContext$active$da.schema) === null || _dndContext$active$da2 === void 0 ? void 0 : _dndContext$active$da2.parent;
|
|
58
|
+
var blocksLength = activeSchema ? Object.keys(activeSchema.properties).length : 0;
|
|
59
|
+
var visible = true;
|
|
60
|
+
|
|
61
|
+
if (blocksLength === 1) {
|
|
62
|
+
if (props.first) {
|
|
63
|
+
visible = activeSchema !== props.cols[0];
|
|
64
|
+
} else {
|
|
65
|
+
var currentSchema = props.cols[props.index];
|
|
66
|
+
var downSchema = props.cols[props.index + 1];
|
|
67
|
+
visible = activeSchema !== currentSchema && downSchema !== activeSchema;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
46
71
|
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
-
ref: setNodeRef,
|
|
72
|
+
ref: visible ? setNodeRef : null,
|
|
48
73
|
className: cls('nb-col-divider', css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 24px;\n "])))),
|
|
49
74
|
style: _objectSpread({}, droppableStyle)
|
|
50
75
|
});
|
|
51
76
|
};
|
|
52
77
|
|
|
53
78
|
var RowDivider = function RowDivider(props) {
|
|
79
|
+
var _dndContext$active2, _dndContext$active2$d, _dndContext$active2$d2;
|
|
80
|
+
|
|
54
81
|
var _useDroppable2 = useDroppable({
|
|
55
82
|
id: props.id,
|
|
56
83
|
data: props.data
|
|
@@ -69,6 +96,23 @@ var RowDivider = function RowDivider(props) {
|
|
|
69
96
|
active = _useState2[0],
|
|
70
97
|
setActive = _useState2[1];
|
|
71
98
|
|
|
99
|
+
var dndContext = useDndContext();
|
|
100
|
+
var currentSchema = props.rows[props.index];
|
|
101
|
+
var activeSchema = (_dndContext$active2 = dndContext.active) === null || _dndContext$active2 === void 0 ? void 0 : (_dndContext$active2$d = _dndContext$active2.data.current) === null || _dndContext$active2$d === void 0 ? void 0 : (_dndContext$active2$d2 = _dndContext$active2$d.schema) === null || _dndContext$active2$d2 === void 0 ? void 0 : _dndContext$active2$d2.parent.parent;
|
|
102
|
+
var colsLength = activeSchema === null || activeSchema === void 0 ? void 0 : activeSchema.mapProperties(function (schema) {
|
|
103
|
+
return schema['x-component'] === 'Grid.Col';
|
|
104
|
+
}).filter(Boolean).length;
|
|
105
|
+
var visible = true; // col > 1 时不需要隐藏
|
|
106
|
+
|
|
107
|
+
if (colsLength === 1) {
|
|
108
|
+
if (props.first) {
|
|
109
|
+
visible = activeSchema !== props.rows[0];
|
|
110
|
+
} else {
|
|
111
|
+
var downSchema = props.rows[props.index + 1];
|
|
112
|
+
visible = activeSchema !== currentSchema && downSchema !== activeSchema;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
72
116
|
useDndMonitor({
|
|
73
117
|
onDragStart: function onDragStart(event) {
|
|
74
118
|
setActive(true);
|
|
@@ -83,7 +127,7 @@ var RowDivider = function RowDivider(props) {
|
|
|
83
127
|
}
|
|
84
128
|
});
|
|
85
129
|
return /*#__PURE__*/React.createElement("span", {
|
|
86
|
-
ref: setNodeRef,
|
|
130
|
+
ref: visible ? setNodeRef : null,
|
|
87
131
|
className: cls('nb-row-divider', css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: 24px;\n width: 100%;\n position: absolute;\n margin-top: -24px;\n "])))),
|
|
88
132
|
style: _objectSpread({
|
|
89
133
|
zIndex: active ? 1000 : -1
|
|
@@ -165,6 +209,7 @@ export var useGridRowContext = function useGridRowContext() {
|
|
|
165
209
|
return useContext(GridRowContext);
|
|
166
210
|
};
|
|
167
211
|
export var Grid = observer(function (props) {
|
|
212
|
+
var gridRef = useRef(null);
|
|
168
213
|
var field = useField();
|
|
169
214
|
var fieldSchema = useFieldSchema();
|
|
170
215
|
|
|
@@ -173,8 +218,16 @@ export var Grid = observer(function (props) {
|
|
|
173
218
|
|
|
174
219
|
var addr = field.address.toString();
|
|
175
220
|
var rows = useRowProperties();
|
|
221
|
+
|
|
222
|
+
var _useFormBlockContext = useFormBlockContext(),
|
|
223
|
+
setPrintContent = _useFormBlockContext.setPrintContent;
|
|
224
|
+
|
|
225
|
+
useEffect(function () {
|
|
226
|
+
gridRef.current && (setPrintContent === null || setPrintContent === void 0 ? void 0 : setPrintContent(gridRef.current));
|
|
227
|
+
}, [gridRef.current]);
|
|
176
228
|
return /*#__PURE__*/React.createElement(GridContext.Provider, {
|
|
177
229
|
value: {
|
|
230
|
+
ref: gridRef,
|
|
178
231
|
fieldSchema: fieldSchema,
|
|
179
232
|
renderSchemaInitializer: render
|
|
180
233
|
}
|
|
@@ -182,12 +235,16 @@ export var Grid = observer(function (props) {
|
|
|
182
235
|
className: 'nb-grid',
|
|
183
236
|
style: {
|
|
184
237
|
position: 'relative'
|
|
185
|
-
}
|
|
238
|
+
},
|
|
239
|
+
ref: gridRef
|
|
186
240
|
}, /*#__PURE__*/React.createElement(DndWrapper, {
|
|
187
241
|
dndContext: props.dndContext
|
|
188
242
|
}, /*#__PURE__*/React.createElement(RowDivider, {
|
|
243
|
+
rows: rows,
|
|
244
|
+
first: true,
|
|
189
245
|
id: "".concat(addr, "_0"),
|
|
190
246
|
data: {
|
|
247
|
+
breakRemoveOn: breakRemoveOnGrid,
|
|
191
248
|
wrapSchema: wrapRowSchema,
|
|
192
249
|
insertAdjacent: 'afterBegin',
|
|
193
250
|
schema: fieldSchema
|
|
@@ -199,8 +256,11 @@ export var Grid = observer(function (props) {
|
|
|
199
256
|
name: schema.name,
|
|
200
257
|
schema: schema
|
|
201
258
|
}), /*#__PURE__*/React.createElement(RowDivider, {
|
|
259
|
+
rows: rows,
|
|
260
|
+
index: index,
|
|
202
261
|
id: "".concat(addr, "_").concat(index + 1),
|
|
203
262
|
data: {
|
|
263
|
+
breakRemoveOn: breakRemoveOnGrid,
|
|
204
264
|
wrapSchema: wrapRowSchema,
|
|
205
265
|
insertAdjacent: 'afterEnd',
|
|
206
266
|
schema: schema
|
|
@@ -220,8 +280,11 @@ Grid.Row = observer(function (props) {
|
|
|
220
280
|
}, /*#__PURE__*/React.createElement("div", {
|
|
221
281
|
className: cls('nb-grid-row', css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin: 0 -24px;\n display: flex;\n position: relative;\n /* z-index: 0; */\n "]))))
|
|
222
282
|
}, /*#__PURE__*/React.createElement(ColDivider, {
|
|
283
|
+
cols: cols,
|
|
284
|
+
first: true,
|
|
223
285
|
id: "".concat(addr, "_0"),
|
|
224
286
|
data: {
|
|
287
|
+
breakRemoveOn: breakRemoveOnRow,
|
|
225
288
|
wrapSchema: wrapColSchema,
|
|
226
289
|
insertAdjacent: 'afterBegin',
|
|
227
290
|
schema: fieldSchema
|
|
@@ -233,8 +296,11 @@ Grid.Row = observer(function (props) {
|
|
|
233
296
|
name: schema.name,
|
|
234
297
|
schema: schema
|
|
235
298
|
}), /*#__PURE__*/React.createElement(ColDivider, {
|
|
299
|
+
cols: cols,
|
|
300
|
+
index: index,
|
|
236
301
|
id: "".concat(addr, "_").concat(index + 1),
|
|
237
302
|
data: {
|
|
303
|
+
breakRemoveOn: breakRemoveOnRow,
|
|
238
304
|
wrapSchema: wrapColSchema,
|
|
239
305
|
insertAdjacent: 'afterEnd',
|
|
240
306
|
schema: schema
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const InputNumber: React.ForwardRefExoticComponent<Pick<Partial<
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
} & {
|
|
5
|
-
ref?: React.Ref<HTMLInputElement>;
|
|
6
|
-
}>, keyof import("antd").InputNumberProps<string | number>> & React.RefAttributes<unknown>>;
|
|
2
|
+
export declare const InputNumber: React.ForwardRefExoticComponent<Pick<Partial<any>, string | number | symbol> & React.RefAttributes<unknown>>;
|
|
7
3
|
export default InputNumber;
|
|
@@ -1,5 +1,29 @@
|
|
|
1
|
+
var _excluded = ["onChange"];
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
|
+
|
|
13
|
+
import React from 'react';
|
|
1
14
|
import { connect, mapReadPretty } from '@formily/react';
|
|
2
15
|
import { InputNumber as AntdNumber } from 'antd';
|
|
3
16
|
import { ReadPretty } from './ReadPretty';
|
|
4
|
-
export var InputNumber = connect(
|
|
17
|
+
export var InputNumber = connect(function (props) {
|
|
18
|
+
var onChange = props.onChange,
|
|
19
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
20
|
+
|
|
21
|
+
var handleChange = function handleChange(v) {
|
|
22
|
+
onChange(parseFloat(v));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return /*#__PURE__*/React.createElement(AntdNumber, _objectSpread({
|
|
26
|
+
onChange: handleChange
|
|
27
|
+
}, others));
|
|
28
|
+
}, mapReadPretty(ReadPretty));
|
|
5
29
|
export default InputNumber;
|
|
@@ -57,6 +57,25 @@ export var KanbanCardDesigner = function KanbanCardDesigner(props) {
|
|
|
57
57
|
readPretty: true,
|
|
58
58
|
block: 'Kanban'
|
|
59
59
|
});
|
|
60
|
+
var associationFields = useAssociatedFormItemInitializerFields({
|
|
61
|
+
readPretty: true,
|
|
62
|
+
block: 'Kanban'
|
|
63
|
+
});
|
|
64
|
+
var items = [{
|
|
65
|
+
type: 'itemGroup',
|
|
66
|
+
title: t('Display fields'),
|
|
67
|
+
children: fields
|
|
68
|
+
}];
|
|
69
|
+
|
|
70
|
+
if (associationFields.length > 0) {
|
|
71
|
+
items.push({
|
|
72
|
+
type: 'divider'
|
|
73
|
+
}, {
|
|
74
|
+
type: 'itemGroup',
|
|
75
|
+
title: t('Display association fields'),
|
|
76
|
+
children: associationFields
|
|
77
|
+
});
|
|
78
|
+
}
|
|
60
79
|
|
|
61
80
|
if (!designable) {
|
|
62
81
|
return null;
|
|
@@ -93,20 +112,7 @@ export var KanbanCardDesigner = function KanbanCardDesigner(props) {
|
|
|
93
112
|
dn.loadAPIClientEvents();
|
|
94
113
|
dn.insertBeforeEnd(schema);
|
|
95
114
|
},
|
|
96
|
-
items:
|
|
97
|
-
type: 'itemGroup',
|
|
98
|
-
title: t('Display fields'),
|
|
99
|
-
children: fields
|
|
100
|
-
}, {
|
|
101
|
-
type: 'divider'
|
|
102
|
-
}, {
|
|
103
|
-
type: 'itemGroup',
|
|
104
|
-
title: t('Display association fields'),
|
|
105
|
-
children: useAssociatedFormItemInitializerFields({
|
|
106
|
-
readPretty: true,
|
|
107
|
-
block: 'Kanban'
|
|
108
|
-
})
|
|
109
|
-
}],
|
|
115
|
+
items: items,
|
|
110
116
|
component: /*#__PURE__*/React.createElement(MenuOutlined, {
|
|
111
117
|
style: {
|
|
112
118
|
cursor: 'pointer',
|
|
@@ -3,7 +3,7 @@ var _excluded = ["onSelect", "mode", "selectedUid", "defaultSelectedUid", "sideM
|
|
|
3
3
|
_excluded3 = ["icon"],
|
|
4
4
|
_excluded4 = ["icon"];
|
|
5
5
|
|
|
6
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
6
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
7
7
|
|
|
8
8
|
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; }
|
|
9
9
|
|
|
@@ -274,6 +274,7 @@ Menu.Item = observer(function (props) {
|
|
|
274
274
|
var field = useField();
|
|
275
275
|
var Designer = useContext(MenuItemDesignerContext);
|
|
276
276
|
return /*#__PURE__*/React.createElement(AntdMenu.Item, _objectSpread(_objectSpread({}, others), {}, {
|
|
277
|
+
className: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n :active {\n background: inherit;\n }\n "]))),
|
|
277
278
|
key: schema.name,
|
|
278
279
|
eventKey: schema.name,
|
|
279
280
|
schema: schema
|
|
@@ -282,7 +283,7 @@ Menu.Item = observer(function (props) {
|
|
|
282
283
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
283
284
|
type: icon
|
|
284
285
|
}), /*#__PURE__*/React.createElement("span", {
|
|
285
|
-
className: css(
|
|
286
|
+
className: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n width: 100%;\n vertical-align: middle;\n "])))
|
|
286
287
|
}, field.title), /*#__PURE__*/React.createElement(Designer, null)));
|
|
287
288
|
});
|
|
288
289
|
Menu.URL = observer(function (props) {
|
|
@@ -293,6 +294,7 @@ Menu.URL = observer(function (props) {
|
|
|
293
294
|
var field = useField();
|
|
294
295
|
var Designer = useContext(MenuItemDesignerContext);
|
|
295
296
|
return /*#__PURE__*/React.createElement(AntdMenu.Item, _objectSpread(_objectSpread({}, others), {}, {
|
|
297
|
+
className: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n :active {\n background: inherit;\n }\n "]))),
|
|
296
298
|
key: schema.name,
|
|
297
299
|
eventKey: schema.name,
|
|
298
300
|
schema: schema,
|
|
@@ -304,7 +306,7 @@ Menu.URL = observer(function (props) {
|
|
|
304
306
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
305
307
|
type: icon
|
|
306
308
|
}), /*#__PURE__*/React.createElement("span", {
|
|
307
|
-
className: css(
|
|
309
|
+
className: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n width: 100%;\n vertical-align: middle;\n "])))
|
|
308
310
|
}, field.title), /*#__PURE__*/React.createElement(Designer, null)));
|
|
309
311
|
});
|
|
310
312
|
Menu.SubMenu = observer(function (props) {
|
|
@@ -321,6 +323,7 @@ Menu.SubMenu = observer(function (props) {
|
|
|
321
323
|
}
|
|
322
324
|
|
|
323
325
|
return /*#__PURE__*/React.createElement(AntdMenu.SubMenu, _objectSpread(_objectSpread({}, others), {}, {
|
|
326
|
+
className: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n :active {\n background: inherit;\n }\n "]))),
|
|
324
327
|
key: schema.name,
|
|
325
328
|
eventKey: schema.name,
|
|
326
329
|
title: /*#__PURE__*/React.createElement(SortableItem, {
|
|
@@ -14,10 +14,10 @@ export var Percent = connect(function (props) {
|
|
|
14
14
|
_onChange = props.onChange;
|
|
15
15
|
return /*#__PURE__*/React.createElement(InputNumber, _objectSpread(_objectSpread({}, props), {}, {
|
|
16
16
|
addonAfter: "%",
|
|
17
|
-
value: math.round(value * 100, 9),
|
|
17
|
+
value: value ? math.round(value * 100, 9) : null,
|
|
18
18
|
onChange: function onChange(v) {
|
|
19
19
|
if (_onChange) {
|
|
20
|
-
_onChange(math.round(v / 100, 9));
|
|
20
|
+
_onChange(v ? math.round(v / 100, 9) : null);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}));
|