@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
|
@@ -25,28 +25,39 @@ export var TabsDesigner = function TabsDesigner() {
|
|
|
25
25
|
properties: {
|
|
26
26
|
title: {
|
|
27
27
|
title: t('Tab name'),
|
|
28
|
+
required: true,
|
|
28
29
|
'x-decorator': 'FormItem',
|
|
29
30
|
'x-component': 'Input',
|
|
30
31
|
'x-component-props': {}
|
|
32
|
+
},
|
|
33
|
+
icon: {
|
|
34
|
+
title: t('Icon'),
|
|
35
|
+
'x-decorator': 'FormItem',
|
|
36
|
+
'x-component': 'IconPicker',
|
|
37
|
+
'x-component-props': {}
|
|
31
38
|
}
|
|
32
39
|
}
|
|
33
40
|
},
|
|
34
41
|
initialValues: {
|
|
35
|
-
title: field.title
|
|
42
|
+
title: field.title,
|
|
43
|
+
icon: field.componentProps.icon
|
|
36
44
|
},
|
|
37
45
|
onSubmit: function onSubmit(_ref) {
|
|
38
|
-
var
|
|
46
|
+
var _schema;
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
var title = _ref.title,
|
|
49
|
+
icon = _ref.icon;
|
|
50
|
+
var props = fieldSchema['x-component-props'] || {};
|
|
51
|
+
fieldSchema.title = title;
|
|
52
|
+
field.title = title;
|
|
53
|
+
props.icon = icon;
|
|
54
|
+
field.componentProps.icon = icon;
|
|
55
|
+
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
56
|
+
fieldSchema['x-component-props'].icon = icon;
|
|
57
|
+
dn.emit('patch', {
|
|
58
|
+
schema: (_schema = {}, _defineProperty(_schema, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema, "title", title), _defineProperty(_schema, 'x-component-props', props), _schema)
|
|
59
|
+
});
|
|
60
|
+
dn.refresh();
|
|
50
61
|
}
|
|
51
62
|
}), /*#__PURE__*/React.createElement(SchemaSettings.Divider, null), /*#__PURE__*/React.createElement(SchemaSettings.Remove, null));
|
|
52
63
|
};
|
|
@@ -7,6 +7,7 @@ import { observer, RecursionField, useField, useFieldSchema } from '@formily/rea
|
|
|
7
7
|
import { Tabs as AntdTabs } from 'antd';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import React from 'react';
|
|
10
|
+
import { Icon } from '../../../icon';
|
|
10
11
|
import { useSchemaInitializer } from '../../../schema-initializer';
|
|
11
12
|
import { DndContext, SortableItem } from '../../common';
|
|
12
13
|
import { useDesigner } from '../../hooks/useDesigner';
|
|
@@ -42,6 +43,11 @@ Tabs.TabPane = observer(function (props) {
|
|
|
42
43
|
var field = useField();
|
|
43
44
|
return /*#__PURE__*/React.createElement(SortableItem, {
|
|
44
45
|
className: classNames('nb-action-link', designerCss, props.className)
|
|
45
|
-
}, props.
|
|
46
|
+
}, props.icon && /*#__PURE__*/React.createElement(Icon, {
|
|
47
|
+
style: {
|
|
48
|
+
marginRight: 2
|
|
49
|
+
},
|
|
50
|
+
type: props.icon
|
|
51
|
+
}), " ", props.tab || field.title, /*#__PURE__*/React.createElement(Designer, null));
|
|
46
52
|
});
|
|
47
53
|
Tabs.Designer = TabsDesigner;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { usePrefixCls } from '@formily/antd/lib/__builtins__';
|
|
2
|
+
import { toArr } from '@formily/shared';
|
|
3
3
|
import cls from 'classnames';
|
|
4
|
+
import moment from 'moment';
|
|
4
5
|
import React from 'react';
|
|
5
6
|
export var ReadPretty = function ReadPretty(props) {
|
|
6
|
-
var
|
|
7
|
+
var value = props.value,
|
|
8
|
+
_props$format = props.format,
|
|
9
|
+
format = _props$format === void 0 ? 'HH:mm:ss' : _props$format;
|
|
7
10
|
var prefixCls = usePrefixCls('description-text', props);
|
|
11
|
+
var values = toArr(value);
|
|
8
12
|
|
|
9
13
|
var getLabels = function getLabels() {
|
|
10
|
-
var labels =
|
|
11
|
-
|
|
14
|
+
var labels = values.map(function (v) {
|
|
15
|
+
return moment(v, 'HH:mm:ss').format(format);
|
|
16
|
+
});
|
|
17
|
+
return labels.join('~');
|
|
12
18
|
};
|
|
13
19
|
|
|
14
20
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useDesignable } from '..';
|
|
5
5
|
import { PluginManager } from '../../plugin-manager';
|
|
6
|
+
import { useHotkeys } from 'react-hotkeys-hook';
|
|
6
7
|
export var DesignableSwitch = function DesignableSwitch() {
|
|
7
8
|
var _useDesignable = useDesignable(),
|
|
8
9
|
designable = _useDesignable.designable,
|
|
@@ -15,12 +16,17 @@ export var DesignableSwitch = function DesignableSwitch() {
|
|
|
15
16
|
|
|
16
17
|
if (designable) {
|
|
17
18
|
style['backgroundColor'] = '#f18b62';
|
|
18
|
-
}
|
|
19
|
+
} // 快捷键切换编辑状态
|
|
19
20
|
|
|
21
|
+
|
|
22
|
+
useHotkeys('Ctrl+Shift+U', function () {
|
|
23
|
+
return setDesignable(!designable);
|
|
24
|
+
}, [designable]);
|
|
20
25
|
return /*#__PURE__*/React.createElement(PluginManager.Toolbar.Item, {
|
|
21
26
|
selected: designable,
|
|
22
27
|
icon: /*#__PURE__*/React.createElement(HighlightOutlined, null),
|
|
23
28
|
title: t('UI Editor'),
|
|
29
|
+
subtitle: 'Ctrl+Shift+U',
|
|
24
30
|
style: style,
|
|
25
31
|
onClick: function onClick() {
|
|
26
32
|
setDesignable(!designable);
|
|
@@ -724,6 +724,27 @@ export var Designable = /*#__PURE__*/function () {
|
|
|
724
724
|
wrap = _options$wrap4 === void 0 ? defaultWrap : _options$wrap4,
|
|
725
725
|
breakRemoveOn = options.breakRemoveOn,
|
|
726
726
|
removeParentsIfNoChildren = options.removeParentsIfNoChildren;
|
|
727
|
+
var order = 0;
|
|
728
|
+
var newOrder = 0;
|
|
729
|
+
var start = false;
|
|
730
|
+
var properties = {};
|
|
731
|
+
this.current.parent.mapProperties(function (property, key) {
|
|
732
|
+
property['x-index'] = order;
|
|
733
|
+
|
|
734
|
+
if (key === _this4.current.name) {
|
|
735
|
+
++order;
|
|
736
|
+
newOrder = order;
|
|
737
|
+
start = true;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
++order;
|
|
741
|
+
|
|
742
|
+
if (start && key !== _this4.current.name) {
|
|
743
|
+
properties[key] = property;
|
|
744
|
+
|
|
745
|
+
_this4.current.parent.removeProperty(key);
|
|
746
|
+
}
|
|
747
|
+
});
|
|
727
748
|
|
|
728
749
|
if (Schema.isSchemaInstance(schema)) {
|
|
729
750
|
if (this.parentsIn(schema)) {
|
|
@@ -747,27 +768,6 @@ export var Designable = /*#__PURE__*/function () {
|
|
|
747
768
|
schema = cloneDeep(schema);
|
|
748
769
|
}
|
|
749
770
|
|
|
750
|
-
var order = 0;
|
|
751
|
-
var newOrder = 0;
|
|
752
|
-
var start = false;
|
|
753
|
-
var properties = {};
|
|
754
|
-
this.current.parent.mapProperties(function (property, key) {
|
|
755
|
-
property['x-index'] = order;
|
|
756
|
-
|
|
757
|
-
if (key === _this4.current.name) {
|
|
758
|
-
++order;
|
|
759
|
-
newOrder = order;
|
|
760
|
-
start = true;
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
++order;
|
|
764
|
-
|
|
765
|
-
if (start && key !== _this4.current.name) {
|
|
766
|
-
properties[key] = property;
|
|
767
|
-
|
|
768
|
-
_this4.current.parent.removeProperty(key);
|
|
769
|
-
}
|
|
770
|
-
});
|
|
771
771
|
this.prepareProperty(schema);
|
|
772
772
|
var wrapped = wrap(schema);
|
|
773
773
|
var s = this.current.parent.addProperty(wrapped.name || uid(), wrapped);
|
|
@@ -9,6 +9,6 @@ export var useProps = function useProps(props, options) {
|
|
|
9
9
|
var useProps = props.useProps,
|
|
10
10
|
props1 = _objectWithoutProperties(props, _excluded);
|
|
11
11
|
|
|
12
|
-
var props2 =
|
|
12
|
+
var props2 = typeof useProps === 'function' ? useProps() : {};
|
|
13
13
|
return merge(props1 || {}, props2, options);
|
|
14
14
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { union } from 'lodash';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { useTranslation } from 'react-i18next';
|
|
3
4
|
import { SchemaInitializer } from '../SchemaInitializer';
|
|
4
|
-
import { gridRowColWrap, useFormItemInitializerFields } from '../utils'; // 表单里配置字段
|
|
5
|
+
import { gridRowColWrap, useAssociatedFormItemInitializerFields, useFormItemInitializerFields } from '../utils'; // 表单里配置字段
|
|
5
6
|
|
|
6
7
|
export var FormItemInitializers = function FormItemInitializers(props) {
|
|
7
8
|
var _useTranslation = useTranslation(),
|
|
@@ -9,14 +10,24 @@ export var FormItemInitializers = function FormItemInitializers(props) {
|
|
|
9
10
|
|
|
10
11
|
var insertPosition = props.insertPosition,
|
|
11
12
|
component = props.component;
|
|
13
|
+
var associationFields = useAssociatedFormItemInitializerFields({
|
|
14
|
+
readPretty: true,
|
|
15
|
+
block: 'Form'
|
|
16
|
+
});
|
|
12
17
|
return /*#__PURE__*/React.createElement(SchemaInitializer.Button, {
|
|
13
18
|
wrap: gridRowColWrap,
|
|
14
19
|
icon: 'SettingOutlined',
|
|
15
|
-
items: [{
|
|
20
|
+
items: union([{
|
|
16
21
|
type: 'itemGroup',
|
|
17
22
|
title: t('Display fields'),
|
|
18
23
|
children: useFormItemInitializerFields()
|
|
24
|
+
}], associationFields.length > 0 ? [{
|
|
25
|
+
type: 'divider'
|
|
19
26
|
}, {
|
|
27
|
+
type: 'itemGroup',
|
|
28
|
+
title: t('Display association fields'),
|
|
29
|
+
children: associationFields
|
|
30
|
+
}] : [], [{
|
|
20
31
|
type: 'divider'
|
|
21
32
|
}, {
|
|
22
33
|
type: 'item',
|
|
@@ -32,7 +43,7 @@ export var FormItemInitializers = function FormItemInitializers(props) {
|
|
|
32
43
|
content: t('This is a demo text, **supports Markdown syntax**.')
|
|
33
44
|
}
|
|
34
45
|
}
|
|
35
|
-
}],
|
|
46
|
+
}]),
|
|
36
47
|
insertPosition: insertPosition,
|
|
37
48
|
component: component,
|
|
38
49
|
title: component ? null : t('Configure fields')
|
|
@@ -27,6 +27,14 @@ export var ReadPrettyFormActionInitializers = {
|
|
|
27
27
|
'x-component': 'Action',
|
|
28
28
|
'x-decorator': 'ACLActionProvider'
|
|
29
29
|
}
|
|
30
|
+
}, {
|
|
31
|
+
type: 'item',
|
|
32
|
+
title: '{{t("Print")}}',
|
|
33
|
+
component: 'PrintActionInitializer',
|
|
34
|
+
schema: {
|
|
35
|
+
'x-component': 'Action',
|
|
36
|
+
'x-decorator': 'ACLActionProvider'
|
|
37
|
+
}
|
|
30
38
|
}]
|
|
31
39
|
}, {
|
|
32
40
|
type: 'divider'
|
|
@@ -1,21 +1,32 @@
|
|
|
1
|
+
import { union } from 'lodash';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { useTranslation } from 'react-i18next';
|
|
3
4
|
import { SchemaInitializer } from '../SchemaInitializer';
|
|
4
|
-
import { gridRowColWrap, useFormItemInitializerFields } from '../utils';
|
|
5
|
+
import { gridRowColWrap, useAssociatedFormItemInitializerFields, useFormItemInitializerFields } from '../utils';
|
|
5
6
|
export var ReadPrettyFormItemInitializers = function ReadPrettyFormItemInitializers(props) {
|
|
6
7
|
var _useTranslation = useTranslation(),
|
|
7
8
|
t = _useTranslation.t;
|
|
8
9
|
|
|
9
10
|
var insertPosition = props.insertPosition,
|
|
10
11
|
component = props.component;
|
|
12
|
+
var associationFields = useAssociatedFormItemInitializerFields({
|
|
13
|
+
readPretty: true,
|
|
14
|
+
block: 'Form'
|
|
15
|
+
});
|
|
11
16
|
return /*#__PURE__*/React.createElement(SchemaInitializer.Button, {
|
|
12
17
|
wrap: gridRowColWrap,
|
|
13
18
|
icon: 'SettingOutlined',
|
|
14
|
-
items: [{
|
|
19
|
+
items: union([{
|
|
15
20
|
type: 'itemGroup',
|
|
16
21
|
title: t('Display fields'),
|
|
17
22
|
children: useFormItemInitializerFields()
|
|
23
|
+
}], associationFields.length > 0 ? [{
|
|
24
|
+
type: 'divider'
|
|
18
25
|
}, {
|
|
26
|
+
type: 'itemGroup',
|
|
27
|
+
title: t('Display association fields'),
|
|
28
|
+
children: associationFields
|
|
29
|
+
}] : [], [{
|
|
19
30
|
type: 'divider'
|
|
20
31
|
}, {
|
|
21
32
|
type: 'item',
|
|
@@ -31,7 +42,7 @@ export var ReadPrettyFormItemInitializers = function ReadPrettyFormItemInitializ
|
|
|
31
42
|
content: t('This is a demo text, **supports Markdown syntax**.')
|
|
32
43
|
}
|
|
33
44
|
}
|
|
34
|
-
}],
|
|
45
|
+
}]),
|
|
35
46
|
insertPosition: insertPosition,
|
|
36
47
|
component: component,
|
|
37
48
|
title: component ? null : t('Configure fields')
|
|
@@ -1,11 +1,40 @@
|
|
|
1
|
+
import { useFieldSchema } from '@formily/react';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { SchemaInitializer, useCollection } from '../..';
|
|
4
|
+
import { SchemaInitializer, useCollection, useCollectionManager } from '../..';
|
|
4
5
|
import { gridRowColWrap } from '../utils';
|
|
5
6
|
|
|
7
|
+
var recursiveParent = function recursiveParent(schema) {
|
|
8
|
+
var _schema$xDecorator;
|
|
9
|
+
|
|
10
|
+
if (!schema) return null;
|
|
11
|
+
|
|
12
|
+
if ((_schema$xDecorator = schema['x-decorator']) === null || _schema$xDecorator === void 0 ? void 0 : _schema$xDecorator.endsWith('BlockProvider')) {
|
|
13
|
+
var _schema$xDecoratorP;
|
|
14
|
+
|
|
15
|
+
return (_schema$xDecoratorP = schema['x-decorator-props']) === null || _schema$xDecoratorP === void 0 ? void 0 : _schema$xDecoratorP['collection'];
|
|
16
|
+
} else {
|
|
17
|
+
return recursiveParent(schema.parent);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
6
21
|
var useRelationFields = function useRelationFields() {
|
|
7
|
-
var
|
|
8
|
-
|
|
22
|
+
var fieldSchema = useFieldSchema();
|
|
23
|
+
|
|
24
|
+
var _useCollectionManager = useCollectionManager(),
|
|
25
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
26
|
+
|
|
27
|
+
var fields = [];
|
|
28
|
+
|
|
29
|
+
if (fieldSchema['x-initializer']) {
|
|
30
|
+
fields = useCollection().fields;
|
|
31
|
+
} else {
|
|
32
|
+
var collection = recursiveParent(fieldSchema.parent);
|
|
33
|
+
|
|
34
|
+
if (collection) {
|
|
35
|
+
fields = getCollectionFields(collection);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
9
38
|
|
|
10
39
|
var relationFields = fields.filter(function (field) {
|
|
11
40
|
return ['linkTo', 'subTable', 'o2m', 'm2m', 'obo', 'oho', 'o2o', 'm2o'].includes(field.interface);
|
|
@@ -20,7 +20,8 @@ export var TabPaneInitializers = function TabPaneInitializers() {
|
|
|
20
20
|
return {
|
|
21
21
|
run: function run() {
|
|
22
22
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
23
|
-
var title;
|
|
23
|
+
var _form$values, title, icon;
|
|
24
|
+
|
|
24
25
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
25
26
|
while (1) {
|
|
26
27
|
switch (_context.prev = _context.next) {
|
|
@@ -29,13 +30,15 @@ export var TabPaneInitializers = function TabPaneInitializers() {
|
|
|
29
30
|
return form.submit();
|
|
30
31
|
|
|
31
32
|
case 2:
|
|
32
|
-
|
|
33
|
+
_form$values = form.values, title = _form$values.title, icon = _form$values.icon;
|
|
33
34
|
insertBeforeEnd({
|
|
34
35
|
type: 'void',
|
|
35
36
|
title: title,
|
|
36
37
|
'x-component': 'Tabs.TabPane',
|
|
37
38
|
'x-designer': 'Tabs.Designer',
|
|
38
|
-
'x-component-props': {
|
|
39
|
+
'x-component-props': {
|
|
40
|
+
icon: icon
|
|
41
|
+
},
|
|
39
42
|
properties: {
|
|
40
43
|
grid: {
|
|
41
44
|
type: 'void',
|
|
@@ -94,6 +97,11 @@ export var TabPaneInitializers = function TabPaneInitializers() {
|
|
|
94
97
|
'x-component': 'Input',
|
|
95
98
|
'x-decorator': 'FormItem'
|
|
96
99
|
},
|
|
100
|
+
icon: {
|
|
101
|
+
title: '{{t("Icon")}}',
|
|
102
|
+
'x-component': 'IconPicker',
|
|
103
|
+
'x-decorator': 'FormItem'
|
|
104
|
+
},
|
|
97
105
|
footer: {
|
|
98
106
|
'x-component': 'Action.Modal.Footer',
|
|
99
107
|
type: 'void',
|
|
@@ -37,6 +37,17 @@ export var TableActionInitializers = {
|
|
|
37
37
|
skipScopeCheck: true
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
}, {
|
|
41
|
+
type: 'item',
|
|
42
|
+
title: "{{t('Refresh')}}",
|
|
43
|
+
component: 'RefreshActionInitializer',
|
|
44
|
+
schema: {
|
|
45
|
+
'x-align': 'right',
|
|
46
|
+
'x-decorator': 'ACLActionProvider',
|
|
47
|
+
'x-acl-action-props': {
|
|
48
|
+
skipScopeCheck: true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
40
51
|
}]
|
|
41
52
|
}]
|
|
42
53
|
};
|