@nocobase/client 0.7.3-alpha.1 → 0.7.4-alpha.7
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 +7 -0
- package/es/block-provider/TableFieldProvider.d.ts +1 -0
- package/es/block-provider/TableFieldProvider.js +5 -2
- package/es/block-provider/TableSelectorProvider.js +1 -1
- package/es/block-provider/hooks/index.js +14 -2
- package/es/collection-manager/CollectionField.js +9 -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 +3 -2
- package/es/collection-manager/action-hooks.d.ts +3 -0
- package/es/collection-manager/action-hooks.js +91 -36
- 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 +1 -0
- package/es/collection-manager/interfaces/integer.js +1 -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 +1 -0
- package/es/collection-manager/interfaces/multipleSelect.js +1 -0
- package/es/collection-manager/interfaces/number.js +1 -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 +3 -1
- package/es/collection-manager/interfaces/percent.js +1 -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 +1 -0
- package/es/collection-manager/interfaces/select.js +1 -0
- package/es/collection-manager/interfaces/textarea.js +1 -0
- package/es/collection-manager/interfaces/time.js +1 -0
- package/es/locale/en_US.d.ts +3 -2
- package/es/locale/en_US.js +4 -3
- package/es/locale/zh_CN.d.ts +5 -2
- package/es/locale/zh_CN.js +5 -2
- package/es/plugin-manager/PluginManager.d.ts +1 -0
- package/es/plugin-manager/PluginManager.js +12 -2
- 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 +39 -9
- package/es/schema-component/antd/input-number/InputNumber.js +1 -1
- package/es/schema-component/antd/input-number/ReadPretty.js +2 -4
- package/es/schema-component/antd/record-picker/InputRecordPicker.js +1 -1
- package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +1 -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 +162 -88
- 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/core/DesignableSwitch.js +7 -1
- package/es/schema-initializer/buttons/TabPaneInitializers.js +11 -3
- package/es/schema-initializer/components/assigned-field/AssignedField.js +6 -4
- package/es/schema-initializer/items/index.js +2 -1
- package/es/schema-initializer/utils.js +16 -0
- package/es/schema-settings/SchemaSettings.js +7 -0
- package/lib/application/Application.d.ts +1 -0
- package/lib/application/Application.js +11 -2
- package/lib/block-provider/FormBlockProvider.js +8 -0
- package/lib/block-provider/TableFieldProvider.d.ts +1 -0
- package/lib/block-provider/TableFieldProvider.js +4 -1
- package/lib/block-provider/TableSelectorProvider.js +1 -1
- package/lib/block-provider/hooks/index.js +14 -2
- package/lib/collection-manager/CollectionField.js +9 -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 +3 -2
- package/lib/collection-manager/action-hooks.d.ts +3 -0
- package/lib/collection-manager/action-hooks.js +98 -37
- 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 +1 -0
- package/lib/collection-manager/interfaces/integer.js +1 -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 +1 -0
- package/lib/collection-manager/interfaces/multipleSelect.js +1 -0
- package/lib/collection-manager/interfaces/number.js +1 -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 +4 -2
- package/lib/collection-manager/interfaces/percent.js +1 -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 +1 -0
- package/lib/collection-manager/interfaces/select.js +1 -0
- package/lib/collection-manager/interfaces/textarea.js +1 -0
- package/lib/collection-manager/interfaces/time.js +1 -0
- package/lib/locale/en_US.d.ts +3 -2
- package/lib/locale/en_US.js +4 -3
- package/lib/locale/zh_CN.d.ts +5 -2
- package/lib/locale/zh_CN.js +5 -2
- package/lib/plugin-manager/PluginManager.d.ts +1 -0
- package/lib/plugin-manager/PluginManager.js +15 -2
- 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 +42 -18
- package/lib/schema-component/antd/input-number/InputNumber.js +6 -6
- package/lib/schema-component/antd/input-number/ReadPretty.js +2 -5
- package/lib/schema-component/antd/record-picker/InputRecordPicker.js +2 -2
- package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +1 -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 +171 -90
- 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/core/DesignableSwitch.js +8 -1
- package/lib/schema-initializer/buttons/TabPaneInitializers.js +11 -3
- package/lib/schema-initializer/components/assigned-field/AssignedField.js +7 -4
- package/lib/schema-initializer/items/index.js +2 -1
- package/lib/schema-initializer/utils.js +16 -0
- package/lib/schema-settings/SchemaSettings.js +7 -0
- package/package.json +5 -4
|
@@ -4,8 +4,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
7
|
-
import { defaultProps } from './properties';
|
|
8
7
|
import { i18n } from '../../i18n';
|
|
8
|
+
import { defaultProps } from './properties';
|
|
9
9
|
export var password = {
|
|
10
10
|
name: 'password',
|
|
11
11
|
type: 'object',
|
|
@@ -14,6 +14,7 @@ export var password = {
|
|
|
14
14
|
title: '{{t("Password")}}',
|
|
15
15
|
default: {
|
|
16
16
|
type: 'password',
|
|
17
|
+
hidden: true,
|
|
17
18
|
// name,
|
|
18
19
|
uiSchema: {
|
|
19
20
|
type: 'string',
|
|
@@ -21,6 +22,7 @@ export var password = {
|
|
|
21
22
|
'x-component': 'Password'
|
|
22
23
|
}
|
|
23
24
|
},
|
|
25
|
+
hasDefaultValue: true,
|
|
24
26
|
properties: _objectSpread({}, defaultProps),
|
|
25
27
|
validateSchema: function validateSchema(fieldSchema) {
|
|
26
28
|
return {
|
|
@@ -247,6 +247,7 @@ export var defaultProps = {
|
|
|
247
247
|
'x-disabled': '{{ !createOnly }}',
|
|
248
248
|
'x-decorator': 'FormItem',
|
|
249
249
|
'x-component': 'Input',
|
|
250
|
+
'x-validator': 'uid',
|
|
250
251
|
description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"
|
|
251
252
|
},
|
|
252
253
|
type: type
|
|
@@ -87,11 +87,11 @@ export var datetime = [{
|
|
|
87
87
|
value: '$dateNotAfter'
|
|
88
88
|
}, {
|
|
89
89
|
label: "{{ t('is empty') }}",
|
|
90
|
-
value: '$
|
|
90
|
+
value: '$empty',
|
|
91
91
|
noValue: true
|
|
92
92
|
}, {
|
|
93
93
|
label: "{{ t('is not empty') }}",
|
|
94
|
-
value: '$
|
|
94
|
+
value: '$notEmpty',
|
|
95
95
|
noValue: true
|
|
96
96
|
}];
|
|
97
97
|
export var number = [{
|
|
@@ -201,11 +201,11 @@ export var time = [{
|
|
|
201
201
|
value: '$neq'
|
|
202
202
|
}, {
|
|
203
203
|
label: '{{t("is empty")}}',
|
|
204
|
-
value: '$
|
|
204
|
+
value: '$empty',
|
|
205
205
|
noValue: true
|
|
206
206
|
}, {
|
|
207
207
|
label: '{{t("is not empty")}}',
|
|
208
|
-
value: '$
|
|
208
|
+
value: '$notEmpty',
|
|
209
209
|
noValue: true
|
|
210
210
|
}];
|
|
211
211
|
export var boolean = [{
|
package/es/locale/en_US.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ declare const _default: {
|
|
|
54
54
|
"Select data source": string;
|
|
55
55
|
Calendar: string;
|
|
56
56
|
Kanban: string;
|
|
57
|
-
"Select
|
|
57
|
+
"Select grouping field": string;
|
|
58
58
|
Media: string;
|
|
59
59
|
Markdown: string;
|
|
60
60
|
Wysiwyg: string;
|
|
@@ -373,7 +373,7 @@ declare const _default: {
|
|
|
373
373
|
"Reference template": string;
|
|
374
374
|
"Create calendar block": string;
|
|
375
375
|
"Create kanban block": string;
|
|
376
|
-
"
|
|
376
|
+
"Grouping field": string;
|
|
377
377
|
"Tab name": string;
|
|
378
378
|
"Current record blocks": string;
|
|
379
379
|
"Popup message": string;
|
|
@@ -554,5 +554,6 @@ declare const _default: {
|
|
|
554
554
|
"Enabled languages": string;
|
|
555
555
|
"View all plugins": string;
|
|
556
556
|
Print: string;
|
|
557
|
+
'Single select and radio fields can be used as the grouping field': string;
|
|
557
558
|
};
|
|
558
559
|
export default _default;
|
package/es/locale/en_US.js
CHANGED
|
@@ -54,7 +54,7 @@ export default {
|
|
|
54
54
|
"Select data source": "Select data source",
|
|
55
55
|
"Calendar": "Calendar",
|
|
56
56
|
"Kanban": "Kanban",
|
|
57
|
-
"Select
|
|
57
|
+
"Select grouping field": "Select grouping field",
|
|
58
58
|
"Media": "Media",
|
|
59
59
|
"Markdown": "Markdown",
|
|
60
60
|
"Wysiwyg": "Wysiwyg",
|
|
@@ -373,7 +373,7 @@ export default {
|
|
|
373
373
|
"Reference template": "Reference template",
|
|
374
374
|
"Create calendar block": "Create calendar block",
|
|
375
375
|
"Create kanban block": "Create kanban block",
|
|
376
|
-
"
|
|
376
|
+
"Grouping field": "Grouping field",
|
|
377
377
|
"Tab name": "Tab name",
|
|
378
378
|
"Current record blocks": "Current record blocks",
|
|
379
379
|
"Popup message": "Popup message",
|
|
@@ -553,5 +553,6 @@ export default {
|
|
|
553
553
|
"Regular expression": "Pattern",
|
|
554
554
|
"Enabled languages": "Enabled languages",
|
|
555
555
|
"View all plugins": "View all plugins",
|
|
556
|
-
"Print": "Print"
|
|
556
|
+
"Print": "Print",
|
|
557
|
+
'Single select and radio fields can be used as the grouping field': 'Single select and radio fields can be used as the grouping field'
|
|
557
558
|
};
|
package/es/locale/zh_CN.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ declare const _default: {
|
|
|
54
54
|
"Select data source": string;
|
|
55
55
|
Calendar: string;
|
|
56
56
|
Kanban: string;
|
|
57
|
-
"Select
|
|
57
|
+
"Select grouping field": string;
|
|
58
58
|
Media: string;
|
|
59
59
|
Markdown: string;
|
|
60
60
|
Wysiwyg: string;
|
|
@@ -251,6 +251,8 @@ declare const _default: {
|
|
|
251
251
|
"The field value cannot be greater than ": string;
|
|
252
252
|
"The field value cannot be less than ": string;
|
|
253
253
|
"The field value is not an integer number": string;
|
|
254
|
+
"Set default value": string;
|
|
255
|
+
"Default value": string;
|
|
254
256
|
"is before": string;
|
|
255
257
|
"is after": string;
|
|
256
258
|
"is on or after": string;
|
|
@@ -408,7 +410,8 @@ declare const _default: {
|
|
|
408
410
|
'Reference template': string;
|
|
409
411
|
'Create calendar block': string;
|
|
410
412
|
'Create kanban block': string;
|
|
411
|
-
'
|
|
413
|
+
'Grouping field': string;
|
|
414
|
+
'Single select and radio fields can be used as the grouping field': string;
|
|
412
415
|
'Tab name': string;
|
|
413
416
|
'Current record blocks': string;
|
|
414
417
|
'Popup message': string;
|
package/es/locale/zh_CN.js
CHANGED
|
@@ -54,7 +54,7 @@ export default {
|
|
|
54
54
|
"Select data source": "选择数据源",
|
|
55
55
|
"Calendar": "日历",
|
|
56
56
|
"Kanban": "看板",
|
|
57
|
-
"Select
|
|
57
|
+
"Select grouping field": "选择分组字段",
|
|
58
58
|
"Media": "多媒体",
|
|
59
59
|
"Markdown": "Markdown",
|
|
60
60
|
"Wysiwyg": "富文本",
|
|
@@ -251,6 +251,8 @@ export default {
|
|
|
251
251
|
"The field value cannot be greater than ": "数值不能大于",
|
|
252
252
|
"The field value cannot be less than ": "数值不能小于",
|
|
253
253
|
"The field value is not an integer number": "数字不是整数",
|
|
254
|
+
"Set default value": "设置默认值",
|
|
255
|
+
"Default value": "默认值",
|
|
254
256
|
"is before": "早于",
|
|
255
257
|
"is after": "晚于",
|
|
256
258
|
"is on or after": "不早于",
|
|
@@ -408,7 +410,8 @@ export default {
|
|
|
408
410
|
'Reference template': '引用模板',
|
|
409
411
|
'Create calendar block': '创建日历区块',
|
|
410
412
|
'Create kanban block': '创建看板区块',
|
|
411
|
-
'
|
|
413
|
+
'Grouping field': '分组字段',
|
|
414
|
+
'Single select and radio fields can be used as the grouping field': '数据表的单选字段可以作为分组字段',
|
|
412
415
|
'Tab name': '标签名称',
|
|
413
416
|
'Current record blocks': '当前数据区块',
|
|
414
417
|
'Popup message': '弹窗提示消息',
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _templateObject;
|
|
2
|
+
|
|
3
|
+
var _excluded = ["selected", "icon", "title", "subtitle"];
|
|
2
4
|
|
|
3
5
|
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
6
|
|
|
5
7
|
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
8
|
|
|
9
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
10
|
+
|
|
7
11
|
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
12
|
|
|
9
13
|
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; }
|
|
@@ -25,6 +29,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
25
29
|
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
30
|
|
|
27
31
|
import { AppstoreOutlined, EllipsisOutlined } from '@ant-design/icons';
|
|
32
|
+
import { css } from '@emotion/css';
|
|
28
33
|
import { ConfigProvider, Menu, Spin, Tooltip } from 'antd';
|
|
29
34
|
import cls from 'classnames';
|
|
30
35
|
import { get } from 'lodash';
|
|
@@ -126,14 +131,19 @@ PluginManager.Toolbar.Item = function (props) {
|
|
|
126
131
|
var selected = props.selected,
|
|
127
132
|
icon = props.icon,
|
|
128
133
|
title = props.title,
|
|
134
|
+
subtitle = props.subtitle,
|
|
129
135
|
others = _objectWithoutProperties(props, _excluded);
|
|
130
136
|
|
|
131
137
|
var prefix = usePrefixCls();
|
|
132
138
|
var className = cls(_defineProperty({}, "".concat(prefix, "-menu-item-selected"), selected));
|
|
133
139
|
|
|
134
140
|
if (item.pin) {
|
|
141
|
+
var subtitleComponent = subtitle && /*#__PURE__*/React.createElement("div", {
|
|
142
|
+
className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: 12px;\n color: #999;\n "])))
|
|
143
|
+
}, subtitle);
|
|
144
|
+
var titleComponent = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, title), subtitleComponent);
|
|
135
145
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
136
|
-
title:
|
|
146
|
+
title: titleComponent
|
|
137
147
|
}, /*#__PURE__*/React.createElement(Menu.Item, _objectSpread(_objectSpread({}, others), {}, {
|
|
138
148
|
className: className,
|
|
139
149
|
eventKey: item.component
|
|
@@ -15,12 +15,17 @@ import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings'
|
|
|
15
15
|
import { useSchemaTemplate } from '../../../schema-templates';
|
|
16
16
|
|
|
17
17
|
var useOptions = function useOptions() {
|
|
18
|
+
var _fields$filter;
|
|
19
|
+
|
|
20
|
+
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'string';
|
|
18
21
|
var compile = useCompile();
|
|
19
22
|
|
|
20
23
|
var _useCollection = useCollection(),
|
|
21
24
|
fields = _useCollection.fields;
|
|
22
25
|
|
|
23
|
-
var options = fields === null || fields === void 0 ? void 0 : fields.
|
|
26
|
+
var options = fields === null || fields === void 0 ? void 0 : (_fields$filter = fields.filter(function (field) {
|
|
27
|
+
return field.type === type;
|
|
28
|
+
})) === null || _fields$filter === void 0 ? void 0 : _fields$filter.map(function (field) {
|
|
24
29
|
var _field$uiSchema;
|
|
25
30
|
|
|
26
31
|
return {
|
|
@@ -57,7 +62,6 @@ export var CalendarDesigner = function CalendarDesigner() {
|
|
|
57
62
|
|
|
58
63
|
var template = useSchemaTemplate();
|
|
59
64
|
var defaultFilter = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora === void 0 ? void 0 : (_fieldSchema$xDecora$ = _fieldSchema$xDecora.params) === null || _fieldSchema$xDecora$ === void 0 ? void 0 : _fieldSchema$xDecora$.filter) || {};
|
|
60
|
-
var options = useOptions();
|
|
61
65
|
var fieldNames = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora2 = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora2 === void 0 ? void 0 : _fieldSchema$xDecora2['fieldNames']) || {};
|
|
62
66
|
var defaultResource = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora3 = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora3 === void 0 ? void 0 : _fieldSchema$xDecora3.resource;
|
|
63
67
|
return /*#__PURE__*/React.createElement(GeneralSchemaDesigner, {
|
|
@@ -66,14 +70,16 @@ export var CalendarDesigner = function CalendarDesigner() {
|
|
|
66
70
|
}, /*#__PURE__*/React.createElement(SchemaSettings.BlockTitleItem, null), /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
|
|
67
71
|
title: t('Title field'),
|
|
68
72
|
value: fieldNames.title,
|
|
69
|
-
options:
|
|
73
|
+
options: useOptions('string'),
|
|
70
74
|
onChange: function onChange(title) {
|
|
71
75
|
var _schema;
|
|
72
76
|
|
|
73
77
|
var fieldNames = field.decoratorProps.fieldNames || {};
|
|
74
78
|
fieldNames['title'] = title;
|
|
75
79
|
field.decoratorProps.params = fieldNames;
|
|
76
|
-
fieldSchema['x-decorator-props']['params'] = fieldNames;
|
|
80
|
+
fieldSchema['x-decorator-props']['params'] = fieldNames; // Select切换option后value未按照预期切换,固增加以下代码
|
|
81
|
+
|
|
82
|
+
fieldSchema['x-decorator-props']['fieldNames'] = fieldNames;
|
|
77
83
|
service.refresh();
|
|
78
84
|
dn.emit('patch', {
|
|
79
85
|
schema: (_schema = {}, _defineProperty(_schema, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema, 'x-decorator-props', field.decoratorProps), _schema)
|
|
@@ -83,14 +89,14 @@ export var CalendarDesigner = function CalendarDesigner() {
|
|
|
83
89
|
}), /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
|
|
84
90
|
title: t('Start date field'),
|
|
85
91
|
value: fieldNames.start,
|
|
86
|
-
options:
|
|
92
|
+
options: useOptions('date'),
|
|
87
93
|
onChange: function onChange(start) {
|
|
88
94
|
var _schema2;
|
|
89
95
|
|
|
90
96
|
var fieldNames = field.decoratorProps.fieldNames || {};
|
|
91
97
|
fieldNames['start'] = start;
|
|
92
|
-
field.decoratorProps.
|
|
93
|
-
fieldSchema['x-decorator-props']['
|
|
98
|
+
field.decoratorProps.fieldNames = fieldNames;
|
|
99
|
+
fieldSchema['x-decorator-props']['fieldNames'] = fieldNames;
|
|
94
100
|
service.refresh();
|
|
95
101
|
dn.emit('patch', {
|
|
96
102
|
schema: (_schema2 = {}, _defineProperty(_schema2, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema2, 'x-decorator-props', field.decoratorProps), _schema2)
|
|
@@ -100,14 +106,14 @@ export var CalendarDesigner = function CalendarDesigner() {
|
|
|
100
106
|
}), /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
|
|
101
107
|
title: t('End date field'),
|
|
102
108
|
value: fieldNames.end,
|
|
103
|
-
options:
|
|
109
|
+
options: useOptions('date'),
|
|
104
110
|
onChange: function onChange(end) {
|
|
105
111
|
var _schema3;
|
|
106
112
|
|
|
107
113
|
var fieldNames = field.decoratorProps.fieldNames || {};
|
|
108
114
|
fieldNames['end'] = end;
|
|
109
|
-
field.decoratorProps.
|
|
110
|
-
fieldSchema['x-decorator-props']['
|
|
115
|
+
field.decoratorProps.fieldNames = fieldNames;
|
|
116
|
+
fieldSchema['x-decorator-props']['fieldNames'] = fieldNames;
|
|
111
117
|
service.refresh();
|
|
112
118
|
dn.emit('patch', {
|
|
113
119
|
schema: (_schema3 = {}, _defineProperty(_schema3, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema3, 'x-decorator-props', field.decoratorProps), _schema3)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { DatePickerProps as AntdDatePickerProps, RangePickerProps as AntdRangePickerProps } from 'antd/lib/date-picker';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
declare type ComposedDatePicker = React.FC<AntdDatePickerProps> & {
|
|
4
4
|
RangePicker?: React.FC<AntdRangePickerProps>;
|
|
5
5
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DatePicker as AntdDatePicker } from 'antd';
|
|
2
1
|
import { connect, mapProps, mapReadPretty } from '@formily/react';
|
|
2
|
+
import { DatePicker as AntdDatePicker } from 'antd';
|
|
3
3
|
import { ReadPretty } from './ReadPretty';
|
|
4
4
|
import { mapDateFormat } from './util';
|
|
5
5
|
export var DatePicker = connect(AntdDatePicker, mapProps(mapDateFormat()), mapReadPretty(ReadPretty.DatePicker));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { usePrefixCls } from '@formily/antd/lib/__builtins__';
|
|
2
2
|
import { isArr } from '@formily/shared';
|
|
3
|
+
import { getDefaultFormat, str2moment } from '@nocobase/utils/client';
|
|
3
4
|
import cls from 'classnames';
|
|
4
5
|
import moment from 'moment';
|
|
5
6
|
import React from 'react';
|
|
6
|
-
import { getDefaultFormat, str2moment } from './util';
|
|
7
7
|
export var ReadPretty = function ReadPretty() {
|
|
8
8
|
return null;
|
|
9
9
|
};
|
|
@@ -1,18 +1,8 @@
|
|
|
1
|
-
import type { DatePickerProps } from 'antd/lib/date-picker';
|
|
2
1
|
import moment from 'moment';
|
|
3
|
-
export interface Str2momentOptions {
|
|
4
|
-
gmt?: boolean;
|
|
5
|
-
picker?: 'year' | 'month' | 'week' | 'quarter';
|
|
6
|
-
}
|
|
7
|
-
export declare const str2moment: (value?: string | string[], options?: Str2momentOptions) => any;
|
|
8
2
|
export interface Moment2strOptions {
|
|
9
3
|
showTime?: boolean;
|
|
10
4
|
gmt?: boolean;
|
|
11
5
|
picker?: 'year' | 'month' | 'week' | 'quarter';
|
|
12
6
|
}
|
|
13
7
|
export declare const moment2str: (value?: moment.Moment | moment.Moment[], options?: Moment2strOptions) => string | string[] | moment.Moment | moment.Moment[];
|
|
14
|
-
export declare const getDefaultFormat: (props: DatePickerProps & {
|
|
15
|
-
dateFormat: string;
|
|
16
|
-
timeFormat: string;
|
|
17
|
-
}) => string | import("rc-picker/lib/interface").CustomFormat<moment.Moment> | (string | import("rc-picker/lib/interface").CustomFormat<moment.Moment>)[];
|
|
18
8
|
export declare const mapDateFormat: () => (props: any) => any;
|
|
@@ -4,24 +4,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
7
|
+
import { getDefaultFormat, str2moment, toGmt, toLocal } from '@nocobase/utils/client';
|
|
7
8
|
import moment from 'moment';
|
|
8
9
|
|
|
9
|
-
var toGmt = function toGmt(value) {
|
|
10
|
-
if (!value) {
|
|
11
|
-
return value;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (Array.isArray(value)) {
|
|
15
|
-
return value.map(function (val) {
|
|
16
|
-
return "".concat(val.format('YYYY-MM-DD'), "T").concat(val.format('HH:mm:ss.SSS'), "Z");
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (moment.isMoment(value)) {
|
|
21
|
-
return "".concat(value.format('YYYY-MM-DD'), "T").concat(value.format('HH:mm:ss.SSS'), "Z");
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
10
|
var toStringByPicker = function toStringByPicker(value, picker) {
|
|
26
11
|
if (picker === 'year') {
|
|
27
12
|
return value.format('YYYY') + '-01-01T00:00:00.000Z';
|
|
@@ -58,44 +43,6 @@ var toGmtByPicker = function toGmtByPicker(value, picker) {
|
|
|
58
43
|
}
|
|
59
44
|
};
|
|
60
45
|
|
|
61
|
-
var toLocal = function toLocal(value) {
|
|
62
|
-
if (!value) {
|
|
63
|
-
return value;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (Array.isArray(value)) {
|
|
67
|
-
return value.map(function (val) {
|
|
68
|
-
return val.toISOString();
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (moment.isMoment(value)) {
|
|
73
|
-
return value.toISOString();
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
var toMoment = function toMoment(val, options) {
|
|
78
|
-
if (moment.isMoment(val)) {
|
|
79
|
-
return val;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
var gmt = options.gmt,
|
|
83
|
-
picker = options.picker;
|
|
84
|
-
|
|
85
|
-
if (gmt || picker) {
|
|
86
|
-
val = val.replace('T', ' ').replace('Z', '');
|
|
87
|
-
return moment(val);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return moment(val);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export var str2moment = function str2moment(value) {
|
|
94
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
95
|
-
return Array.isArray(value) ? value.map(function (val) {
|
|
96
|
-
return toMoment(val, options);
|
|
97
|
-
}) : value ? toMoment(value, options) : value;
|
|
98
|
-
};
|
|
99
46
|
export var moment2str = function moment2str(value) {
|
|
100
47
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
101
48
|
var showTime = options.showTime,
|
|
@@ -112,31 +59,6 @@ export var moment2str = function moment2str(value) {
|
|
|
112
59
|
|
|
113
60
|
return toGmtByPicker(value, picker);
|
|
114
61
|
};
|
|
115
|
-
export var getDefaultFormat = function getDefaultFormat(props) {
|
|
116
|
-
if (props.format) {
|
|
117
|
-
return props.format;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (props.dateFormat) {
|
|
121
|
-
if (props['showTime']) {
|
|
122
|
-
return "".concat(props.dateFormat, " ").concat(props.timeFormat || 'HH:mm:ss');
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return props.dateFormat;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (props['picker'] === 'month') {
|
|
129
|
-
return 'YYYY-MM';
|
|
130
|
-
} else if (props['picker'] === 'quarter') {
|
|
131
|
-
return 'YYYY-\\QQ';
|
|
132
|
-
} else if (props['picker'] === 'year') {
|
|
133
|
-
return 'YYYY';
|
|
134
|
-
} else if (props['picker'] === 'week') {
|
|
135
|
-
return 'YYYY-wo';
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return props['showTime'] ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';
|
|
139
|
-
};
|
|
140
62
|
export var mapDateFormat = function mapDateFormat() {
|
|
141
63
|
return function (props) {
|
|
142
64
|
var format = getDefaultFormat(props);
|
|
@@ -18,6 +18,7 @@ import { css } from '@emotion/css';
|
|
|
18
18
|
import { ArrayCollapse, FormItem as Item, FormLayout } from '@formily/antd';
|
|
19
19
|
import { useField, useFieldSchema } from '@formily/react';
|
|
20
20
|
import { uid } from '@formily/shared';
|
|
21
|
+
import _ from 'lodash';
|
|
21
22
|
import React from 'react';
|
|
22
23
|
import { useTranslation } from 'react-i18next';
|
|
23
24
|
import { useCompile, useDesignable } from '../..';
|
|
@@ -26,7 +27,6 @@ import { useCollection, useCollectionManager } from '../../../collection-manager
|
|
|
26
27
|
import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
|
|
27
28
|
import { BlockItem } from '../block-item';
|
|
28
29
|
import { HTMLEncode } from '../input/shared';
|
|
29
|
-
import * as _ from 'lodash';
|
|
30
30
|
|
|
31
31
|
var divWrap = function divWrap(schema) {
|
|
32
32
|
return {
|
|
@@ -52,7 +52,7 @@ export var FormItem = function FormItem(props) {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
FormItem.Designer = function (props) {
|
|
55
|
-
var _interfaceConfig$vali, _collectionField$uiSc, _collectionField$uiSc2, _fieldSchema$xDecora, _fieldSchema$xCompon, _field$componentProps, _field$componentProps2;
|
|
55
|
+
var _interfaceConfig$vali, _collectionField$uiSc, _collectionField$uiSc2, _fieldSchema$xDecora, _collectionField$uiSc4, _fieldSchema$xCompon, _field$componentProps, _field$componentProps2;
|
|
56
56
|
|
|
57
57
|
var _useCollectionManager = useCollectionManager(),
|
|
58
58
|
getCollectionFields = _useCollectionManager.getCollectionFields,
|
|
@@ -207,7 +207,7 @@ FormItem.Designer = function (props) {
|
|
|
207
207
|
}), !field.readPretty && fieldSchema['x-component'] !== 'FormField' && /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
|
|
208
208
|
key: "required",
|
|
209
209
|
title: t('Required'),
|
|
210
|
-
checked:
|
|
210
|
+
checked: fieldSchema.required,
|
|
211
211
|
onChange: function onChange(required) {
|
|
212
212
|
var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
|
|
213
213
|
|
|
@@ -364,6 +364,38 @@ FormItem.Designer = function (props) {
|
|
|
364
364
|
});
|
|
365
365
|
refresh();
|
|
366
366
|
}
|
|
367
|
+
}), form && !(form === null || form === void 0 ? void 0 : form.readPretty) && (collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc4 = collectionField.uiSchema) === null || _collectionField$uiSc4 === void 0 ? void 0 : _collectionField$uiSc4.type) && /*#__PURE__*/React.createElement(SchemaSettings.ModalItem, {
|
|
368
|
+
title: t('Set default value'),
|
|
369
|
+
components: {
|
|
370
|
+
ArrayCollapse: ArrayCollapse,
|
|
371
|
+
FormLayout: FormLayout
|
|
372
|
+
},
|
|
373
|
+
schema: {
|
|
374
|
+
type: 'object',
|
|
375
|
+
title: t('Set default value'),
|
|
376
|
+
properties: {
|
|
377
|
+
default: _objectSpread(_objectSpread({}, collectionField.uiSchema), {}, {
|
|
378
|
+
name: 'default',
|
|
379
|
+
title: t('Default value'),
|
|
380
|
+
'x-decorator': 'FormItem',
|
|
381
|
+
default: fieldSchema.default || collectionField.defaultValue
|
|
382
|
+
})
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
onSubmit: function onSubmit(v) {
|
|
386
|
+
var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
|
|
387
|
+
|
|
388
|
+
if (field.value !== v.default) {
|
|
389
|
+
field.value = v.default;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
fieldSchema.default = v.default;
|
|
393
|
+
schema.default = v.default;
|
|
394
|
+
dn.emit('patch', {
|
|
395
|
+
schema: schema
|
|
396
|
+
});
|
|
397
|
+
refresh();
|
|
398
|
+
}
|
|
367
399
|
}), form && !isSubFormAssocitionField && ['o2o', 'oho', 'obo', 'o2m'].includes(collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) && /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
|
|
368
400
|
title: t('Field component'),
|
|
369
401
|
options: (collectionField === null || collectionField === void 0 ? void 0 : collectionField.interface) === 'o2m' ? [{
|
|
@@ -472,15 +504,13 @@ FormItem.Designer = function (props) {
|
|
|
472
504
|
options: options,
|
|
473
505
|
value: field === null || field === void 0 ? void 0 : (_field$componentProps = field.componentProps) === null || _field$componentProps === void 0 ? void 0 : (_field$componentProps2 = _field$componentProps.fieldNames) === null || _field$componentProps2 === void 0 ? void 0 : _field$componentProps2.label,
|
|
474
506
|
onChange: function onChange(label) {
|
|
507
|
+
var _collectionField$uiSc5, _collectionField$uiSc6;
|
|
508
|
+
|
|
475
509
|
var schema = _defineProperty({}, 'x-uid', fieldSchema['x-uid']);
|
|
476
510
|
|
|
477
|
-
var fieldNames = _objectSpread(_objectSpread({}, field.componentProps.fieldNames), {}, {
|
|
511
|
+
var fieldNames = _objectSpread(_objectSpread(_objectSpread({}, collectionField === null || collectionField === void 0 ? void 0 : (_collectionField$uiSc5 = collectionField.uiSchema) === null || _collectionField$uiSc5 === void 0 ? void 0 : (_collectionField$uiSc6 = _collectionField$uiSc5['x-component-props']) === null || _collectionField$uiSc6 === void 0 ? void 0 : _collectionField$uiSc6['fieldNames']), field.componentProps.fieldNames), {}, {
|
|
478
512
|
label: label
|
|
479
|
-
});
|
|
480
|
-
// fieldSchema['x-component-props']['field']['uiSchema']['x-component-props']['fieldNames'] = fieldNames;
|
|
481
|
-
// } else {
|
|
482
|
-
// }
|
|
483
|
-
|
|
513
|
+
});
|
|
484
514
|
|
|
485
515
|
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
486
516
|
fieldSchema['x-component-props']['fieldNames'] = fieldNames;
|
|
@@ -10,9 +10,9 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
10
10
|
|
|
11
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
12
|
|
|
13
|
-
import React from 'react';
|
|
14
13
|
import { connect, mapReadPretty } from '@formily/react';
|
|
15
14
|
import { InputNumber as AntdNumber } from 'antd';
|
|
15
|
+
import React from 'react';
|
|
16
16
|
import { ReadPretty } from './ReadPretty';
|
|
17
17
|
export var InputNumber = connect(function (props) {
|
|
18
18
|
var onChange = props.onChange,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isValid } from '@formily/shared';
|
|
2
|
-
import {
|
|
3
|
-
import { getNumberPrecision } from 'rc-input-number/lib/utils/numberUtil';
|
|
2
|
+
import { toFixedByStep } from '@nocobase/utils/client';
|
|
4
3
|
import React from 'react';
|
|
5
4
|
export var ReadPretty = function ReadPretty(props) {
|
|
6
5
|
var step = props.step,
|
|
@@ -12,8 +11,7 @@ export var ReadPretty = function ReadPretty(props) {
|
|
|
12
11
|
return /*#__PURE__*/React.createElement("div", null);
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
var precision = Math.max(getNumberPrecision(String(value)), getNumberPrecision(step));
|
|
16
14
|
return /*#__PURE__*/React.createElement("div", {
|
|
17
15
|
className: 'nb-read-pretty-input-number'
|
|
18
|
-
}, addonBefore,
|
|
16
|
+
}, addonBefore, toFixedByStep(value, step), addonAfter);
|
|
19
17
|
};
|