@zat-design/sisyphus-react 4.0.0-beta.7 → 4.0.0-beta.9
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/dist/index.esm.css +1 -1
- package/dist/less.esm.css +1 -1
- package/es/ProEditTable/components/RcTable/DraggableTable.js +5 -3
- package/es/ProEditTable/components/RenderField/index.js +44 -9
- package/es/ProEditTable/index.js +11 -9
- package/es/ProEditTable/propsType.d.ts +6 -0
- package/es/ProEditTable/style/index.less +9 -3
- package/es/ProEditTable/utils/useShouldUpdateForTable.d.ts +15 -0
- package/es/ProEditTable/utils/useShouldUpdateForTable.js +132 -0
- package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +84 -3
- package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +63 -6
- package/es/ProForm/components/combination/FormList/components/Empty.js +11 -2
- package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +1 -0
- package/es/ProForm/components/combination/FormList/components/LineFields.js +4 -2
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +38 -9
- package/es/ProForm/components/combination/FormList/index.js +67 -57
- package/es/ProForm/components/combination/FormList/propsType.d.ts +7 -2
- package/es/ProForm/components/combination/FormList/style/index.less +41 -0
- package/es/ProForm/components/render/RenderFields.js +2 -1
- package/es/ProForm/index.js +1 -1
- package/es/ProForm/propsType.d.ts +1 -0
- package/es/ProForm/utils/useShouldUpdate.js +1 -2
- package/es/ProForm/utils/useWatch.js +3 -3
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +19 -9
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +6 -8
- package/es/ProLayout/components/ProHeader/index.js +19 -15
- package/es/ProTable/hooks/useAntdTable.js +52 -29
- package/es/ProTabs/style/index.less +5 -1
- package/es/utils/index.js +13 -1
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +5 -3
- package/lib/ProEditTable/components/RenderField/index.js +44 -9
- package/lib/ProEditTable/index.js +11 -9
- package/lib/ProEditTable/propsType.d.ts +6 -0
- package/lib/ProEditTable/style/index.less +9 -3
- package/lib/ProEditTable/utils/useShouldUpdateForTable.d.ts +15 -0
- package/lib/ProEditTable/utils/useShouldUpdateForTable.js +139 -0
- package/lib/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +84 -3
- package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +62 -6
- package/lib/ProForm/components/combination/FormList/components/Empty.js +11 -2
- package/lib/ProForm/components/combination/FormList/components/LineFields.d.ts +1 -0
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +4 -2
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +38 -9
- package/lib/ProForm/components/combination/FormList/index.js +67 -57
- package/lib/ProForm/components/combination/FormList/propsType.d.ts +7 -2
- package/lib/ProForm/components/combination/FormList/style/index.less +41 -0
- package/lib/ProForm/components/render/RenderFields.js +2 -1
- package/lib/ProForm/index.js +1 -1
- package/lib/ProForm/propsType.d.ts +1 -0
- package/lib/ProForm/utils/useShouldUpdate.js +1 -2
- package/lib/ProForm/utils/useWatch.js +3 -3
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +18 -8
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +5 -7
- package/lib/ProLayout/components/ProHeader/index.js +19 -15
- package/lib/ProTable/hooks/useAntdTable.js +52 -29
- package/lib/ProTabs/style/index.less +5 -1
- package/lib/utils/index.js +13 -1
- package/package.json +3 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
3
|
import { Button } from 'antd';
|
|
4
|
+
import { isFunction } from 'lodash';
|
|
4
5
|
import EmptyImg from "../../../../../assets/empty.png";
|
|
5
6
|
import locale from "../../../../../locale";
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -34,7 +35,8 @@ var Empty = _ref => {
|
|
|
34
35
|
return addConfig === null || addConfig === void 0 || (_addConfig$onClick = addConfig.onClick) === null || _addConfig$onClick === void 0 ? void 0 : _addConfig$onClick.call(addConfig, value, {
|
|
35
36
|
operation,
|
|
36
37
|
form,
|
|
37
|
-
namePath
|
|
38
|
+
namePath,
|
|
39
|
+
index: 0
|
|
38
40
|
});
|
|
39
41
|
case 5:
|
|
40
42
|
data = _context.sent;
|
|
@@ -63,6 +65,13 @@ var Empty = _ref => {
|
|
|
63
65
|
var getBtnText = () => {
|
|
64
66
|
return emptyBtnText || (addConfig === null || addConfig === void 0 ? void 0 : addConfig.label) || locale.ProForm.formListActions[6];
|
|
65
67
|
};
|
|
68
|
+
var show = true;
|
|
69
|
+
if ((addConfig === null || addConfig === void 0 ? void 0 : addConfig.show) !== undefined) {
|
|
70
|
+
show = isFunction(addConfig.show) ? addConfig.show(form.getFieldValue(namePath), {
|
|
71
|
+
namePath,
|
|
72
|
+
form
|
|
73
|
+
}) : !!addConfig.show;
|
|
74
|
+
}
|
|
66
75
|
return /*#__PURE__*/_jsxs("div", {
|
|
67
76
|
className: "pro-form-list-empty",
|
|
68
77
|
children: [/*#__PURE__*/_jsx("img", {
|
|
@@ -71,7 +80,7 @@ var Empty = _ref => {
|
|
|
71
80
|
alt: "Empty"
|
|
72
81
|
}), /*#__PURE__*/_jsx("div", {
|
|
73
82
|
className: "pro-form-list-empty-content",
|
|
74
|
-
children: disabled ? locale.ProForm.noData : /*#__PURE__*/_jsxs(_Fragment, {
|
|
83
|
+
children: disabled || !show ? locale.ProForm.noData : /*#__PURE__*/_jsxs(_Fragment, {
|
|
75
84
|
children: [locale.ProForm.noData, !disabled && /*#__PURE__*/_jsxs(_Fragment, {
|
|
76
85
|
children: ["\uFF0C", /*#__PURE__*/_jsx(Button, {
|
|
77
86
|
type: "link",
|
|
@@ -29,7 +29,8 @@ var LineFields = props => {
|
|
|
29
29
|
draggable = props.draggable,
|
|
30
30
|
className = props.className,
|
|
31
31
|
id = props.id,
|
|
32
|
-
diffConfig = props.diffConfig
|
|
32
|
+
diffConfig = props.diffConfig,
|
|
33
|
+
hideStartEndActionProps = props.hideStartEndActionProps;
|
|
33
34
|
var isLess = mode === 'less';
|
|
34
35
|
var _useSortable = useSortable({
|
|
35
36
|
id: field.key,
|
|
@@ -87,7 +88,8 @@ var LineFields = props => {
|
|
|
87
88
|
fields: fields,
|
|
88
89
|
actionProps: actionProps,
|
|
89
90
|
mode: mode,
|
|
90
|
-
disabled: disabled
|
|
91
|
+
disabled: disabled,
|
|
92
|
+
hideStartEndActionProps: hideStartEndActionProps
|
|
91
93
|
})]
|
|
92
94
|
});
|
|
93
95
|
};
|
|
@@ -55,7 +55,7 @@ var ToolbarButton = props => {
|
|
|
55
55
|
}, [props.toolbarProps]);
|
|
56
56
|
var handleClick = /*#__PURE__*/function () {
|
|
57
57
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(defaultCallback, callback, item) {
|
|
58
|
-
var value, data;
|
|
58
|
+
var value, data, insertIndex, _insertIndex;
|
|
59
59
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
60
60
|
while (1) switch (_context.prev = _context.next) {
|
|
61
61
|
case 0:
|
|
@@ -64,7 +64,8 @@ var ToolbarButton = props => {
|
|
|
64
64
|
return callback === null || callback === void 0 ? void 0 : callback(value, {
|
|
65
65
|
operation,
|
|
66
66
|
form,
|
|
67
|
-
namePath
|
|
67
|
+
namePath,
|
|
68
|
+
index: (value === null || value === void 0 ? void 0 : value.length) || 0
|
|
68
69
|
});
|
|
69
70
|
case 3:
|
|
70
71
|
data = _context.sent;
|
|
@@ -72,15 +73,42 @@ var ToolbarButton = props => {
|
|
|
72
73
|
_context.next = 7;
|
|
73
74
|
break;
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === 'add') {
|
|
77
|
+
// 如果有 addIndex 配置,使用它计算插入位置
|
|
78
|
+
if (item.addIndex) {
|
|
79
|
+
insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
|
|
80
|
+
namePath,
|
|
81
|
+
form,
|
|
82
|
+
operation,
|
|
83
|
+
index: (value === null || value === void 0 ? void 0 : value.length) || 0
|
|
84
|
+
}) : item.addIndex;
|
|
85
|
+
operation.add(data, insertIndex);
|
|
86
|
+
} else {
|
|
87
|
+
operation.add(data); // 默认插入到末尾
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
defaultCallback === null || defaultCallback === void 0 || defaultCallback(value, {
|
|
91
|
+
operation,
|
|
92
|
+
form,
|
|
93
|
+
namePath,
|
|
94
|
+
index: (value === null || value === void 0 ? void 0 : value.length) || 0
|
|
95
|
+
});
|
|
96
|
+
}
|
|
80
97
|
return _context.abrupt("return");
|
|
81
98
|
case 7:
|
|
82
99
|
if ((item === null || item === void 0 ? void 0 : item.type) === 'add' && data) {
|
|
83
|
-
|
|
100
|
+
// 如果有 addIndex 配置,使用它计算插入位置
|
|
101
|
+
if (item.addIndex) {
|
|
102
|
+
_insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
|
|
103
|
+
namePath,
|
|
104
|
+
form,
|
|
105
|
+
operation,
|
|
106
|
+
index: (value === null || value === void 0 ? void 0 : value.length) || 0
|
|
107
|
+
}) : item.addIndex;
|
|
108
|
+
operation.add(data, _insertIndex);
|
|
109
|
+
} else {
|
|
110
|
+
operation.add(data); // 默认插入到末尾
|
|
111
|
+
}
|
|
84
112
|
}
|
|
85
113
|
case 8:
|
|
86
114
|
case "end":
|
|
@@ -97,7 +125,8 @@ var ToolbarButton = props => {
|
|
|
97
125
|
callback === null || callback === void 0 || callback(value, {
|
|
98
126
|
operation,
|
|
99
127
|
form,
|
|
100
|
-
namePath
|
|
128
|
+
namePath,
|
|
129
|
+
index: 0
|
|
101
130
|
});
|
|
102
131
|
};
|
|
103
132
|
return /*#__PURE__*/_jsx(Space, {
|
|
@@ -27,7 +27,10 @@ var FormList = (props, ref) => {
|
|
|
27
27
|
_props$span = props.span,
|
|
28
28
|
span = _props$span === void 0 ? 8 : _props$span,
|
|
29
29
|
disabled = props.disabled,
|
|
30
|
-
emptyBtnText = props.emptyBtnText
|
|
30
|
+
emptyBtnText = props.emptyBtnText,
|
|
31
|
+
hideStartEndActionProps = props.hideStartEndActionProps,
|
|
32
|
+
titlePosition = props.titlePosition,
|
|
33
|
+
className = props.className;
|
|
31
34
|
var _fields = fields.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
32
35
|
key: String(item.key)
|
|
33
36
|
}));
|
|
@@ -35,11 +38,12 @@ var FormList = (props, ref) => {
|
|
|
35
38
|
form = _ref.form,
|
|
36
39
|
name = _ref.name,
|
|
37
40
|
isView = _ref.isView,
|
|
38
|
-
diffConfig = _ref.diffConfig
|
|
41
|
+
diffConfig = _ref.diffConfig,
|
|
42
|
+
namePath = _ref.namePath;
|
|
39
43
|
var _useProConfig = useProConfig('ProForm'),
|
|
40
44
|
isDiffAll = _useProConfig.isDiffAll;
|
|
41
45
|
var errors = meta.errors;
|
|
42
|
-
var _namePath = toArray(name);
|
|
46
|
+
var _namePath = namePath ? [...namePath.slice(0, -1), ...toArray(name)] : toArray(name);
|
|
43
47
|
var orgValues = get(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues, name);
|
|
44
48
|
var _diffConfig = _objectSpread(_objectSpread({}, diffConfig), {}, {
|
|
45
49
|
originalValues: diffConfig !== null && diffConfig !== void 0 && diffConfig.originalValues && isDiffAll ? orgValues || [] : orgValues
|
|
@@ -80,65 +84,71 @@ var FormList = (props, ref) => {
|
|
|
80
84
|
props.operation.move(activeIndex, overIndex);
|
|
81
85
|
}
|
|
82
86
|
};
|
|
83
|
-
return /*#__PURE__*/_jsx(
|
|
84
|
-
|
|
85
|
-
children: /*#__PURE__*/
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
return /*#__PURE__*/_jsx("div", {
|
|
88
|
+
className: className,
|
|
89
|
+
children: /*#__PURE__*/_jsx(DndContext, {
|
|
90
|
+
onDragEnd: handleDragEnd,
|
|
91
|
+
children: /*#__PURE__*/_jsxs(SortableContext, {
|
|
92
|
+
items: _fields.map(item => ({
|
|
93
|
+
id: item.key
|
|
94
|
+
})),
|
|
95
|
+
strategy: verticalListSortingStrategy,
|
|
96
|
+
children: [_fields.map((field, index) => {
|
|
97
|
+
var namePath = [..._namePath, field.name];
|
|
98
|
+
var _columns = processColumns(index, namePath);
|
|
99
|
+
return mode === 'block' ? /*#__PURE__*/_jsx(BlockFields, _objectSpread(_objectSpread({}, props), {}, {
|
|
100
|
+
columns: _columns,
|
|
101
|
+
disabled: disabled,
|
|
102
|
+
isView: isView,
|
|
103
|
+
namePath: namePath,
|
|
104
|
+
index: index,
|
|
105
|
+
field: field,
|
|
106
|
+
colProps: {
|
|
107
|
+
span
|
|
108
|
+
},
|
|
109
|
+
form: form,
|
|
110
|
+
diffConfig: _diffConfig,
|
|
111
|
+
hideStartEndActionProps: hideStartEndActionProps,
|
|
112
|
+
titlePosition: titlePosition
|
|
113
|
+
}), field.key) : /*#__PURE__*/_jsx(LineFields, _objectSpread(_objectSpread({
|
|
114
|
+
className: _fields.length === index + 1 ? 'pro-form-list-last' : ''
|
|
115
|
+
}, props), {}, {
|
|
116
|
+
mode: mode,
|
|
117
|
+
columns: _columns,
|
|
118
|
+
disabled: disabled,
|
|
119
|
+
isView: isView,
|
|
120
|
+
namePath: namePath,
|
|
121
|
+
index: index,
|
|
122
|
+
field: field,
|
|
123
|
+
colProps: {
|
|
124
|
+
span: mode === 'less' ? 24 : span
|
|
125
|
+
},
|
|
126
|
+
form: form,
|
|
127
|
+
diffConfig: _diffConfig,
|
|
128
|
+
hideStartEndActionProps: hideStartEndActionProps
|
|
129
|
+
}), field.key);
|
|
130
|
+
}), _fields.length === 0 && /*#__PURE__*/_jsx(Empty, {
|
|
95
131
|
disabled: disabled,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
index: index,
|
|
99
|
-
field: field,
|
|
100
|
-
colProps: {
|
|
101
|
-
span
|
|
102
|
-
},
|
|
132
|
+
toolbarProps: toolbarProps,
|
|
133
|
+
operation: operation,
|
|
103
134
|
form: form,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
columns: _columns,
|
|
135
|
+
namePath: _namePath,
|
|
136
|
+
emptyBtnText: emptyBtnText
|
|
137
|
+
}), /*#__PURE__*/_jsx(Form.ErrorList, {
|
|
138
|
+
errors: errors
|
|
139
|
+
}), toolbarProps !== false && _fields.length > 0 && /*#__PURE__*/_jsx(ToolbarButton, {
|
|
110
140
|
disabled: disabled,
|
|
111
141
|
isView: isView,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
},
|
|
142
|
+
min: min,
|
|
143
|
+
max: max,
|
|
144
|
+
length: fields.length,
|
|
145
|
+
operation: operation,
|
|
146
|
+
namePath: _namePath,
|
|
118
147
|
form: form,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
toolbarProps: toolbarProps,
|
|
124
|
-
operation: operation,
|
|
125
|
-
form: form,
|
|
126
|
-
namePath: _namePath,
|
|
127
|
-
emptyBtnText: emptyBtnText
|
|
128
|
-
}), /*#__PURE__*/_jsx(Form.ErrorList, {
|
|
129
|
-
errors: errors
|
|
130
|
-
}), toolbarProps !== false && _fields.length > 0 && /*#__PURE__*/_jsx(ToolbarButton, {
|
|
131
|
-
disabled: disabled,
|
|
132
|
-
isView: isView,
|
|
133
|
-
min: min,
|
|
134
|
-
max: max,
|
|
135
|
-
length: fields.length,
|
|
136
|
-
operation: operation,
|
|
137
|
-
namePath: _namePath,
|
|
138
|
-
form: form,
|
|
139
|
-
fields: fields,
|
|
140
|
-
toolbarProps: toolbarProps
|
|
141
|
-
})]
|
|
148
|
+
fields: fields,
|
|
149
|
+
toolbarProps: toolbarProps
|
|
150
|
+
})]
|
|
151
|
+
})
|
|
142
152
|
})
|
|
143
153
|
});
|
|
144
154
|
};
|
|
@@ -7,9 +7,9 @@ import type { ProFormColumnType, ProFormOtherType } from '../../../propsType';
|
|
|
7
7
|
export type TitleRender = (record: Record<string, any>, index: number, form: FormInstance) => any;
|
|
8
8
|
export type TitleType = string | React.ReactNode | TitleRender;
|
|
9
9
|
type Callback = (record: any, option: Pick<Option, 'namePath' | 'index' | 'operation' | 'form'>) => any | void;
|
|
10
|
-
export type ToolbarCallback = (record: any, option: Pick<Option, 'namePath' | 'form' | 'operation'>) => any | void;
|
|
10
|
+
export type ToolbarCallback = (record: any, option: Pick<Option, 'index' | 'namePath' | 'form' | 'operation'>) => any | void;
|
|
11
11
|
export interface Option {
|
|
12
|
-
index: number;
|
|
12
|
+
index: number | undefined;
|
|
13
13
|
namePath: InternalNamePath;
|
|
14
14
|
form: FormInstance;
|
|
15
15
|
operation: FormListOperation;
|
|
@@ -23,12 +23,14 @@ export interface ActionType extends Omit<ButtonProps, 'onClick' | 'type'> {
|
|
|
23
23
|
confirmProps?: boolean | PopconfirmProps;
|
|
24
24
|
title?: string;
|
|
25
25
|
show?: boolean | ((record: any, option: Pick<Option, 'index' | 'form' | 'namePath'>) => boolean);
|
|
26
|
+
addIndex?: number | ((record: any, option: Pick<Option, 'index' | 'form' | 'namePath' | 'operation'>) => number);
|
|
26
27
|
}
|
|
27
28
|
export interface ToolbarActionType extends Omit<ActionType, 'actionType' | 'onHandle' | 'onClick' | 'show' | 'type'> {
|
|
28
29
|
type?: 'add';
|
|
29
30
|
onHandle?: ToolbarCallback;
|
|
30
31
|
onClick?: ToolbarCallback;
|
|
31
32
|
show?: boolean | ((record: any, option: Pick<Option, 'form' | 'namePath'>) => boolean);
|
|
33
|
+
addIndex?: number | ((record: any, option: Pick<Option, 'index' | 'form' | 'namePath' | 'operation'>) => number);
|
|
32
34
|
}
|
|
33
35
|
export type FormListMode = 'block' | 'line' | 'less';
|
|
34
36
|
export interface FormListType {
|
|
@@ -56,6 +58,9 @@ export interface FormListType {
|
|
|
56
58
|
draggable?: boolean;
|
|
57
59
|
id?: string;
|
|
58
60
|
emptyBtnText?: string;
|
|
61
|
+
hideStartEndActionProps?: [boolean, boolean];
|
|
62
|
+
titlePosition?: 'top' | 'left';
|
|
63
|
+
className?: string;
|
|
59
64
|
}
|
|
60
65
|
export type TypeWithRef = FormListType & React.RefAttributes<FormListRefType>;
|
|
61
66
|
export interface FormListRefType {
|
|
@@ -127,3 +127,44 @@
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
+
|
|
131
|
+
// 左侧标题布局样式
|
|
132
|
+
.pro-form-list-mode-block.pro-form-list-title-left {
|
|
133
|
+
.@{ant-prefix}-collapse-header-text{
|
|
134
|
+
display: none;
|
|
135
|
+
}
|
|
136
|
+
.pro-form-list-left-title-wrapper {
|
|
137
|
+
display: flex;
|
|
138
|
+
gap: 16px;
|
|
139
|
+
align-items: flex-start;
|
|
140
|
+
|
|
141
|
+
.pro-form-list-left-title {
|
|
142
|
+
flex: 0 0 80px;
|
|
143
|
+
font-weight: 600;
|
|
144
|
+
font-size: 14px;
|
|
145
|
+
line-height: 1.4;
|
|
146
|
+
color: @zaui-text;
|
|
147
|
+
padding-top: 8px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.pro-form-list-left-content {
|
|
151
|
+
flex: 1;
|
|
152
|
+
min-width: 0;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// 移动端响应式
|
|
157
|
+
@media (max-width: 768px) {
|
|
158
|
+
.pro-form-list-left-title-wrapper {
|
|
159
|
+
flex-direction: column;
|
|
160
|
+
gap: 8px;
|
|
161
|
+
|
|
162
|
+
.pro-form-list-left-title {
|
|
163
|
+
flex: none;
|
|
164
|
+
width: 100%;
|
|
165
|
+
padding-top: 0;
|
|
166
|
+
margin-bottom: 8px;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
package/es/ProForm/index.js
CHANGED
|
@@ -66,7 +66,7 @@ var ProForm = (props, ref) => {
|
|
|
66
66
|
_props$stopOnFirstErr = props.stopOnFirstError,
|
|
67
67
|
stopOnFirstError = _props$stopOnFirstErr === void 0 ? false : _props$stopOnFirstErr,
|
|
68
68
|
_props$shouldUpdateDe = props.shouldUpdateDebounce,
|
|
69
|
-
shouldUpdateDebounce = _props$shouldUpdateDe === void 0 ?
|
|
69
|
+
shouldUpdateDebounce = _props$shouldUpdateDe === void 0 ? 200 : _props$shouldUpdateDe,
|
|
70
70
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
71
71
|
var config = useProConfig('ProForm');
|
|
72
72
|
// source: 用于区分是哪个组件调用,用于错误提示
|
|
@@ -24,8 +24,7 @@ var useShouldUpdate = props => {
|
|
|
24
24
|
originComponent = props.originComponent,
|
|
25
25
|
type = props.type,
|
|
26
26
|
desensitization = props.desensitization,
|
|
27
|
-
|
|
28
|
-
shouldUpdateDebounce = _props$shouldUpdateDe === void 0 ? 500 : _props$shouldUpdateDe;
|
|
27
|
+
shouldUpdateDebounce = props.shouldUpdateDebounce;
|
|
29
28
|
var _shouldUpdate = formItemProps.shouldUpdate,
|
|
30
29
|
name = formItemProps.name,
|
|
31
30
|
clearNotShow = formItemProps.clearNotShow,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
2
|
import { debounce } from 'lodash';
|
|
4
3
|
import warning from 'rc-util/lib/warning';
|
|
5
4
|
import { useState, useEffect, useRef, useMemo } from 'react';
|
|
6
5
|
import isEqual from 'lodash/isEqual';
|
|
6
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
7
7
|
export function toArray(value) {
|
|
8
8
|
if (value === undefined || value === null) {
|
|
9
9
|
return [];
|
|
@@ -115,7 +115,7 @@ function useWatch(dependencies, form, wait) {
|
|
|
115
115
|
return debounce(value => {
|
|
116
116
|
// 只在值真正变化时才更新状态
|
|
117
117
|
if (!isEqual(prevStateRef.current, value)) {
|
|
118
|
-
prevStateRef.current =
|
|
118
|
+
prevStateRef.current = cloneDeep(value);
|
|
119
119
|
setState(value);
|
|
120
120
|
}
|
|
121
121
|
}, wait);
|
|
@@ -124,7 +124,7 @@ function useWatch(dependencies, form, wait) {
|
|
|
124
124
|
// 非防抖版本
|
|
125
125
|
return value => {
|
|
126
126
|
if (!isEqual(prevStateRef.current, value)) {
|
|
127
|
-
prevStateRef.current =
|
|
127
|
+
prevStateRef.current = cloneDeep(value);
|
|
128
128
|
setState(value);
|
|
129
129
|
}
|
|
130
130
|
};
|
|
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import { useContext } from 'react';
|
|
3
3
|
import { Popover, Tooltip } from 'antd';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import {
|
|
5
|
+
import { useHistory } from 'react-router-dom';
|
|
6
6
|
import { Icon } from "../../index";
|
|
7
7
|
import SideMenu from "../SideMenu";
|
|
8
8
|
import { LayoutContext } from "../../../../index";
|
|
@@ -19,6 +19,7 @@ var FoldMenu = props => {
|
|
|
19
19
|
collapsed = dataSource.collapsed,
|
|
20
20
|
headerHeight = dataSource.headerHeight;
|
|
21
21
|
var pathNamePrefix = `/${window.location.pathname.split('/')[1]}`;
|
|
22
|
+
var history = useHistory();
|
|
22
23
|
var noticeCls = classnames({
|
|
23
24
|
'pro-layout-menu-tooltip': true,
|
|
24
25
|
'pro-layout-menu-tooltip-has-notice': notice,
|
|
@@ -113,6 +114,11 @@ var FoldMenu = props => {
|
|
|
113
114
|
keyPath: menuKeyPath
|
|
114
115
|
});
|
|
115
116
|
}
|
|
117
|
+
|
|
118
|
+
// 导航到目标路径
|
|
119
|
+
if (toPath) {
|
|
120
|
+
history.push(toPath);
|
|
121
|
+
}
|
|
116
122
|
},
|
|
117
123
|
children: LiNode
|
|
118
124
|
})
|
|
@@ -133,14 +139,16 @@ var FoldMenu = props => {
|
|
|
133
139
|
keyPath: menuKeyPath
|
|
134
140
|
});
|
|
135
141
|
}
|
|
142
|
+
|
|
143
|
+
// 导航到目标路径
|
|
144
|
+
if (toPath) {
|
|
145
|
+
history.push(toPath);
|
|
146
|
+
}
|
|
136
147
|
onSelected({
|
|
137
148
|
selectedPath: toPath
|
|
138
149
|
});
|
|
139
150
|
},
|
|
140
|
-
children:
|
|
141
|
-
to: toPath,
|
|
142
|
-
children: LiNode
|
|
143
|
-
}, toPath)
|
|
151
|
+
children: LiNode
|
|
144
152
|
})
|
|
145
153
|
}, toPath) : /*#__PURE__*/_jsx("span", {
|
|
146
154
|
onClick: () => {
|
|
@@ -156,11 +164,13 @@ var FoldMenu = props => {
|
|
|
156
164
|
keyPath: menuKeyPath
|
|
157
165
|
});
|
|
158
166
|
}
|
|
167
|
+
|
|
168
|
+
// 导航到目标路径
|
|
169
|
+
if (toPath) {
|
|
170
|
+
history.push(toPath);
|
|
171
|
+
}
|
|
159
172
|
},
|
|
160
|
-
children:
|
|
161
|
-
to: toPath,
|
|
162
|
-
children: LiNode
|
|
163
|
-
}, toPath)
|
|
173
|
+
children: LiNode
|
|
164
174
|
});
|
|
165
175
|
})
|
|
166
176
|
})
|
|
@@ -4,7 +4,7 @@ import { Menu } from 'antd';
|
|
|
4
4
|
import { useDeepCompareEffect, useSetState } from 'ahooks';
|
|
5
5
|
import { CaretDownOutlined } from '@ant-design/icons';
|
|
6
6
|
import classnames from 'classnames';
|
|
7
|
-
import {
|
|
7
|
+
import { useHistory } from 'react-router-dom';
|
|
8
8
|
import { cloneDeep } from 'lodash';
|
|
9
9
|
import { LayoutContext } from "../../../../index";
|
|
10
10
|
import { getIdsByPathName, findMenuItemByKey } from "../../../../utils";
|
|
@@ -24,6 +24,7 @@ var OpenMenu = props => {
|
|
|
24
24
|
menus = _ref.menus,
|
|
25
25
|
sideMenu = _ref.sideMenu;
|
|
26
26
|
var linkRef = useRef(null);
|
|
27
|
+
var history = useHistory();
|
|
27
28
|
// 通过URL匹配对应的ID用于回显
|
|
28
29
|
var _useSetState = useSetState({
|
|
29
30
|
selectedKeys: [],
|
|
@@ -120,10 +121,10 @@ var OpenMenu = props => {
|
|
|
120
121
|
});
|
|
121
122
|
}
|
|
122
123
|
}, [sideMenu]);
|
|
123
|
-
return /*#__PURE__*/
|
|
124
|
+
return /*#__PURE__*/_jsx("div", {
|
|
124
125
|
className: cls,
|
|
125
126
|
style: style,
|
|
126
|
-
children:
|
|
127
|
+
children: /*#__PURE__*/_jsx(Menu, {
|
|
127
128
|
mode: "inline"
|
|
128
129
|
// @ts-ignore
|
|
129
130
|
,
|
|
@@ -175,7 +176,7 @@ var OpenMenu = props => {
|
|
|
175
176
|
setTimeout(() => {
|
|
176
177
|
// 路由变更,且不再demo文档中
|
|
177
178
|
if (!window.location.href.includes('~demos/prolayout')) {
|
|
178
|
-
|
|
179
|
+
history.push(router);
|
|
179
180
|
}
|
|
180
181
|
}, 100);
|
|
181
182
|
}
|
|
@@ -184,10 +185,7 @@ var OpenMenu = props => {
|
|
|
184
185
|
height: dataSource.sideMenu ? 'auto' : `calc(100vh - ${(dataSource === null || dataSource === void 0 ? void 0 : dataSource.height) || 0}px)`,
|
|
185
186
|
color: 'red'
|
|
186
187
|
}
|
|
187
|
-
})
|
|
188
|
-
to: router,
|
|
189
|
-
ref: linkRef
|
|
190
|
-
})]
|
|
188
|
+
})
|
|
191
189
|
});
|
|
192
190
|
};
|
|
193
191
|
export default OpenMenu;
|
|
@@ -110,11 +110,11 @@ var ProHeader = props => {
|
|
|
110
110
|
return null;
|
|
111
111
|
}
|
|
112
112
|
var onlyTag = tag && !label && !value;
|
|
113
|
-
var tagRender =
|
|
114
|
-
if (Array.isArray(
|
|
113
|
+
var tagRender = params => {
|
|
114
|
+
if (Array.isArray(params === null || params === void 0 ? void 0 : params.tag) && params !== null && params !== void 0 && params.tag.length) {
|
|
115
115
|
return /*#__PURE__*/_jsx(Space, {
|
|
116
116
|
size: 4,
|
|
117
|
-
children:
|
|
117
|
+
children: params.tag.map((tagItem, index) => {
|
|
118
118
|
return /*#__PURE__*/_jsx("div", {
|
|
119
119
|
className: "pro-header-tag",
|
|
120
120
|
children: tagItem
|
|
@@ -122,26 +122,30 @@ var ProHeader = props => {
|
|
|
122
122
|
})
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return params !== null && params !== void 0 && params.tag ? /*#__PURE__*/_jsx("div", {
|
|
126
126
|
className: "pro-header-tag",
|
|
127
|
-
children:
|
|
127
|
+
children: params === null || params === void 0 ? void 0 : params.tag
|
|
128
128
|
}) : null;
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
/** 单行渲染 */
|
|
132
|
-
var valueRender =
|
|
132
|
+
var valueRender = params => {
|
|
133
133
|
return /*#__PURE__*/_jsxs(Space, {
|
|
134
134
|
size: 4,
|
|
135
|
-
align:
|
|
136
|
-
children: [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
align: params !== null && params !== void 0 && params.tag ? 'baseline' : 'center',
|
|
136
|
+
children: [params !== null && params !== void 0 && params.link ?
|
|
137
|
+
/*#__PURE__*/
|
|
138
|
+
// eslint-disable-next-line jsx-a11y/anchor-is-valid
|
|
139
|
+
_jsx("a", {
|
|
140
|
+
onClick: () => {
|
|
141
|
+
var newWindow = window.open(params.link);
|
|
142
|
+
newWindow.opener = null;
|
|
143
|
+
},
|
|
144
|
+
children: params === null || params === void 0 ? void 0 : params.value
|
|
145
|
+
}) : params === null || params === void 0 ? void 0 : params.value, params !== null && params !== void 0 && params.copyable && isString(params === null || params === void 0 ? void 0 : params.value) ? /*#__PURE__*/_jsx(Copy, {
|
|
146
|
+
text: params.value
|
|
143
147
|
}) : null, tagRender({
|
|
144
|
-
tag:
|
|
148
|
+
tag: params === null || params === void 0 ? void 0 : params.tag
|
|
145
149
|
})]
|
|
146
150
|
});
|
|
147
151
|
};
|