@zat-design/sisyphus-react 4.0.0-beta.8 → 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/style/index.less +9 -3
- 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/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/lib/ProEditTable/components/RcTable/DraggableTable.js +5 -3
- package/lib/ProEditTable/style/index.less +9 -3
- 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/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/package.json +3 -3
|
@@ -62,7 +62,7 @@ var ToolbarButton = props => {
|
|
|
62
62
|
}, [props.toolbarProps]);
|
|
63
63
|
var handleClick = /*#__PURE__*/function () {
|
|
64
64
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(defaultCallback, callback, item) {
|
|
65
|
-
var value, data;
|
|
65
|
+
var value, data, insertIndex, _insertIndex;
|
|
66
66
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
67
67
|
while (1) switch (_context.prev = _context.next) {
|
|
68
68
|
case 0:
|
|
@@ -71,7 +71,8 @@ var ToolbarButton = props => {
|
|
|
71
71
|
return callback === null || callback === void 0 ? void 0 : callback(value, {
|
|
72
72
|
operation,
|
|
73
73
|
form,
|
|
74
|
-
namePath
|
|
74
|
+
namePath,
|
|
75
|
+
index: (value === null || value === void 0 ? void 0 : value.length) || 0
|
|
75
76
|
});
|
|
76
77
|
case 3:
|
|
77
78
|
data = _context.sent;
|
|
@@ -79,15 +80,42 @@ var ToolbarButton = props => {
|
|
|
79
80
|
_context.next = 7;
|
|
80
81
|
break;
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === 'add') {
|
|
84
|
+
// 如果有 addIndex 配置,使用它计算插入位置
|
|
85
|
+
if (item.addIndex) {
|
|
86
|
+
insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
|
|
87
|
+
namePath,
|
|
88
|
+
form,
|
|
89
|
+
operation,
|
|
90
|
+
index: (value === null || value === void 0 ? void 0 : value.length) || 0
|
|
91
|
+
}) : item.addIndex;
|
|
92
|
+
operation.add(data, insertIndex);
|
|
93
|
+
} else {
|
|
94
|
+
operation.add(data); // 默认插入到末尾
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
defaultCallback === null || defaultCallback === void 0 || defaultCallback(value, {
|
|
98
|
+
operation,
|
|
99
|
+
form,
|
|
100
|
+
namePath,
|
|
101
|
+
index: (value === null || value === void 0 ? void 0 : value.length) || 0
|
|
102
|
+
});
|
|
103
|
+
}
|
|
87
104
|
return _context.abrupt("return");
|
|
88
105
|
case 7:
|
|
89
106
|
if ((item === null || item === void 0 ? void 0 : item.type) === 'add' && data) {
|
|
90
|
-
|
|
107
|
+
// 如果有 addIndex 配置,使用它计算插入位置
|
|
108
|
+
if (item.addIndex) {
|
|
109
|
+
_insertIndex = typeof item.addIndex === 'function' ? item.addIndex(value, {
|
|
110
|
+
namePath,
|
|
111
|
+
form,
|
|
112
|
+
operation,
|
|
113
|
+
index: (value === null || value === void 0 ? void 0 : value.length) || 0
|
|
114
|
+
}) : item.addIndex;
|
|
115
|
+
operation.add(data, _insertIndex);
|
|
116
|
+
} else {
|
|
117
|
+
operation.add(data); // 默认插入到末尾
|
|
118
|
+
}
|
|
91
119
|
}
|
|
92
120
|
case 8:
|
|
93
121
|
case "end":
|
|
@@ -104,7 +132,8 @@ var ToolbarButton = props => {
|
|
|
104
132
|
callback === null || callback === void 0 || callback(value, {
|
|
105
133
|
operation,
|
|
106
134
|
form,
|
|
107
|
-
namePath
|
|
135
|
+
namePath,
|
|
136
|
+
index: 0
|
|
108
137
|
});
|
|
109
138
|
};
|
|
110
139
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Space, {
|
|
@@ -34,7 +34,10 @@ var FormList = (props, ref) => {
|
|
|
34
34
|
_props$span = props.span,
|
|
35
35
|
span = _props$span === void 0 ? 8 : _props$span,
|
|
36
36
|
disabled = props.disabled,
|
|
37
|
-
emptyBtnText = props.emptyBtnText
|
|
37
|
+
emptyBtnText = props.emptyBtnText,
|
|
38
|
+
hideStartEndActionProps = props.hideStartEndActionProps,
|
|
39
|
+
titlePosition = props.titlePosition,
|
|
40
|
+
className = props.className;
|
|
38
41
|
var _fields = fields.map(item => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
39
42
|
key: String(item.key)
|
|
40
43
|
}));
|
|
@@ -42,11 +45,12 @@ var FormList = (props, ref) => {
|
|
|
42
45
|
form = _ref.form,
|
|
43
46
|
name = _ref.name,
|
|
44
47
|
isView = _ref.isView,
|
|
45
|
-
diffConfig = _ref.diffConfig
|
|
48
|
+
diffConfig = _ref.diffConfig,
|
|
49
|
+
namePath = _ref.namePath;
|
|
46
50
|
var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProForm'),
|
|
47
51
|
isDiffAll = _useProConfig.isDiffAll;
|
|
48
52
|
var errors = meta.errors;
|
|
49
|
-
var _namePath = (0, _utils.toArray)(name);
|
|
53
|
+
var _namePath = namePath ? [...namePath.slice(0, -1), ...(0, _utils.toArray)(name)] : (0, _utils.toArray)(name);
|
|
50
54
|
var orgValues = (0, _lodash.get)(diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalValues, name);
|
|
51
55
|
var _diffConfig = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, diffConfig), {}, {
|
|
52
56
|
originalValues: diffConfig !== null && diffConfig !== void 0 && diffConfig.originalValues && isDiffAll ? orgValues || [] : orgValues
|
|
@@ -87,65 +91,71 @@ var FormList = (props, ref) => {
|
|
|
87
91
|
props.operation.move(activeIndex, overIndex);
|
|
88
92
|
}
|
|
89
93
|
};
|
|
90
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
91
|
-
|
|
92
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
94
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
95
|
+
className: className,
|
|
96
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_core.DndContext, {
|
|
97
|
+
onDragEnd: handleDragEnd,
|
|
98
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sortable.SortableContext, {
|
|
99
|
+
items: _fields.map(item => ({
|
|
100
|
+
id: item.key
|
|
101
|
+
})),
|
|
102
|
+
strategy: _sortable.verticalListSortingStrategy,
|
|
103
|
+
children: [_fields.map((field, index) => {
|
|
104
|
+
var namePath = [..._namePath, field.name];
|
|
105
|
+
var _columns = processColumns(index, namePath);
|
|
106
|
+
return mode === 'block' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_BlockFields.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
107
|
+
columns: _columns,
|
|
108
|
+
disabled: disabled,
|
|
109
|
+
isView: isView,
|
|
110
|
+
namePath: namePath,
|
|
111
|
+
index: index,
|
|
112
|
+
field: field,
|
|
113
|
+
colProps: {
|
|
114
|
+
span
|
|
115
|
+
},
|
|
116
|
+
form: form,
|
|
117
|
+
diffConfig: _diffConfig,
|
|
118
|
+
hideStartEndActionProps: hideStartEndActionProps,
|
|
119
|
+
titlePosition: titlePosition
|
|
120
|
+
}), field.key) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineFields.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
121
|
+
className: _fields.length === index + 1 ? 'pro-form-list-last' : ''
|
|
122
|
+
}, props), {}, {
|
|
123
|
+
mode: mode,
|
|
124
|
+
columns: _columns,
|
|
125
|
+
disabled: disabled,
|
|
126
|
+
isView: isView,
|
|
127
|
+
namePath: namePath,
|
|
128
|
+
index: index,
|
|
129
|
+
field: field,
|
|
130
|
+
colProps: {
|
|
131
|
+
span: mode === 'less' ? 24 : span
|
|
132
|
+
},
|
|
133
|
+
form: form,
|
|
134
|
+
diffConfig: _diffConfig,
|
|
135
|
+
hideStartEndActionProps: hideStartEndActionProps
|
|
136
|
+
}), field.key);
|
|
137
|
+
}), _fields.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Empty.default, {
|
|
102
138
|
disabled: disabled,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
index: index,
|
|
106
|
-
field: field,
|
|
107
|
-
colProps: {
|
|
108
|
-
span
|
|
109
|
-
},
|
|
139
|
+
toolbarProps: toolbarProps,
|
|
140
|
+
operation: operation,
|
|
110
141
|
form: form,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
columns: _columns,
|
|
142
|
+
namePath: _namePath,
|
|
143
|
+
emptyBtnText: emptyBtnText
|
|
144
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.ErrorList, {
|
|
145
|
+
errors: errors
|
|
146
|
+
}), toolbarProps !== false && _fields.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToolbarButton.default, {
|
|
117
147
|
disabled: disabled,
|
|
118
148
|
isView: isView,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
},
|
|
149
|
+
min: min,
|
|
150
|
+
max: max,
|
|
151
|
+
length: fields.length,
|
|
152
|
+
operation: operation,
|
|
153
|
+
namePath: _namePath,
|
|
125
154
|
form: form,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
toolbarProps: toolbarProps,
|
|
131
|
-
operation: operation,
|
|
132
|
-
form: form,
|
|
133
|
-
namePath: _namePath,
|
|
134
|
-
emptyBtnText: emptyBtnText
|
|
135
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.ErrorList, {
|
|
136
|
-
errors: errors
|
|
137
|
-
}), toolbarProps !== false && _fields.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToolbarButton.default, {
|
|
138
|
-
disabled: disabled,
|
|
139
|
-
isView: isView,
|
|
140
|
-
min: min,
|
|
141
|
-
max: max,
|
|
142
|
-
length: fields.length,
|
|
143
|
-
operation: operation,
|
|
144
|
-
namePath: _namePath,
|
|
145
|
-
form: form,
|
|
146
|
-
fields: fields,
|
|
147
|
-
toolbarProps: toolbarProps
|
|
148
|
-
})]
|
|
155
|
+
fields: fields,
|
|
156
|
+
toolbarProps: toolbarProps
|
|
157
|
+
})]
|
|
158
|
+
})
|
|
149
159
|
})
|
|
150
160
|
});
|
|
151
161
|
};
|
|
@@ -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
|
+
}
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
exports.toArray = toArray;
|
|
9
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
10
|
var _lodash = require("lodash");
|
|
12
11
|
var _warning = _interopRequireDefault(require("rc-util/lib/warning"));
|
|
13
12
|
var _react = require("react");
|
|
14
13
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
14
|
+
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
15
15
|
function toArray(value) {
|
|
16
16
|
if (value === undefined || value === null) {
|
|
17
17
|
return [];
|
|
@@ -123,7 +123,7 @@ function useWatch(dependencies, form, wait) {
|
|
|
123
123
|
return (0, _lodash.debounce)(value => {
|
|
124
124
|
// 只在值真正变化时才更新状态
|
|
125
125
|
if (!(0, _isEqual.default)(prevStateRef.current, value)) {
|
|
126
|
-
prevStateRef.current = (0,
|
|
126
|
+
prevStateRef.current = (0, _cloneDeep.default)(value);
|
|
127
127
|
setState(value);
|
|
128
128
|
}
|
|
129
129
|
}, wait);
|
|
@@ -132,7 +132,7 @@ function useWatch(dependencies, form, wait) {
|
|
|
132
132
|
// 非防抖版本
|
|
133
133
|
return value => {
|
|
134
134
|
if (!(0, _isEqual.default)(prevStateRef.current, value)) {
|
|
135
|
-
prevStateRef.current = (0,
|
|
135
|
+
prevStateRef.current = (0, _cloneDeep.default)(value);
|
|
136
136
|
setState(value);
|
|
137
137
|
}
|
|
138
138
|
};
|
|
@@ -25,6 +25,7 @@ var FoldMenu = props => {
|
|
|
25
25
|
collapsed = dataSource.collapsed,
|
|
26
26
|
headerHeight = dataSource.headerHeight;
|
|
27
27
|
var pathNamePrefix = `/${window.location.pathname.split('/')[1]}`;
|
|
28
|
+
var history = (0, _reactRouterDom.useHistory)();
|
|
28
29
|
var noticeCls = (0, _classnames.default)({
|
|
29
30
|
'pro-layout-menu-tooltip': true,
|
|
30
31
|
'pro-layout-menu-tooltip-has-notice': notice,
|
|
@@ -119,6 +120,11 @@ var FoldMenu = props => {
|
|
|
119
120
|
keyPath: menuKeyPath
|
|
120
121
|
});
|
|
121
122
|
}
|
|
123
|
+
|
|
124
|
+
// 导航到目标路径
|
|
125
|
+
if (toPath) {
|
|
126
|
+
history.push(toPath);
|
|
127
|
+
}
|
|
122
128
|
},
|
|
123
129
|
children: LiNode
|
|
124
130
|
})
|
|
@@ -139,14 +145,16 @@ var FoldMenu = props => {
|
|
|
139
145
|
keyPath: menuKeyPath
|
|
140
146
|
});
|
|
141
147
|
}
|
|
148
|
+
|
|
149
|
+
// 导航到目标路径
|
|
150
|
+
if (toPath) {
|
|
151
|
+
history.push(toPath);
|
|
152
|
+
}
|
|
142
153
|
onSelected({
|
|
143
154
|
selectedPath: toPath
|
|
144
155
|
});
|
|
145
156
|
},
|
|
146
|
-
children:
|
|
147
|
-
to: toPath,
|
|
148
|
-
children: LiNode
|
|
149
|
-
}, toPath)
|
|
157
|
+
children: LiNode
|
|
150
158
|
})
|
|
151
159
|
}, toPath) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
152
160
|
onClick: () => {
|
|
@@ -162,11 +170,13 @@ var FoldMenu = props => {
|
|
|
162
170
|
keyPath: menuKeyPath
|
|
163
171
|
});
|
|
164
172
|
}
|
|
173
|
+
|
|
174
|
+
// 导航到目标路径
|
|
175
|
+
if (toPath) {
|
|
176
|
+
history.push(toPath);
|
|
177
|
+
}
|
|
165
178
|
},
|
|
166
|
-
children:
|
|
167
|
-
to: toPath,
|
|
168
|
-
children: LiNode
|
|
169
|
-
}, toPath)
|
|
179
|
+
children: LiNode
|
|
170
180
|
});
|
|
171
181
|
})
|
|
172
182
|
})
|
|
@@ -29,6 +29,7 @@ var OpenMenu = props => {
|
|
|
29
29
|
menus = _ref.menus,
|
|
30
30
|
sideMenu = _ref.sideMenu;
|
|
31
31
|
var linkRef = (0, _react.useRef)(null);
|
|
32
|
+
var history = (0, _reactRouterDom.useHistory)();
|
|
32
33
|
// 通过URL匹配对应的ID用于回显
|
|
33
34
|
var _useSetState = (0, _ahooks.useSetState)({
|
|
34
35
|
selectedKeys: [],
|
|
@@ -125,10 +126,10 @@ var OpenMenu = props => {
|
|
|
125
126
|
});
|
|
126
127
|
}
|
|
127
128
|
}, [sideMenu]);
|
|
128
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
129
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
129
130
|
className: cls,
|
|
130
131
|
style: style,
|
|
131
|
-
children:
|
|
132
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Menu, {
|
|
132
133
|
mode: "inline"
|
|
133
134
|
// @ts-ignore
|
|
134
135
|
,
|
|
@@ -180,7 +181,7 @@ var OpenMenu = props => {
|
|
|
180
181
|
setTimeout(() => {
|
|
181
182
|
// 路由变更,且不再demo文档中
|
|
182
183
|
if (!window.location.href.includes('~demos/prolayout')) {
|
|
183
|
-
|
|
184
|
+
history.push(router);
|
|
184
185
|
}
|
|
185
186
|
}, 100);
|
|
186
187
|
}
|
|
@@ -189,10 +190,7 @@ var OpenMenu = props => {
|
|
|
189
190
|
height: dataSource.sideMenu ? 'auto' : `calc(100vh - ${(dataSource === null || dataSource === void 0 ? void 0 : dataSource.height) || 0}px)`,
|
|
190
191
|
color: 'red'
|
|
191
192
|
}
|
|
192
|
-
})
|
|
193
|
-
to: router,
|
|
194
|
-
ref: linkRef
|
|
195
|
-
})]
|
|
193
|
+
})
|
|
196
194
|
});
|
|
197
195
|
};
|
|
198
196
|
var _default = exports.default = OpenMenu;
|
|
@@ -116,11 +116,11 @@ var ProHeader = props => {
|
|
|
116
116
|
return null;
|
|
117
117
|
}
|
|
118
118
|
var onlyTag = tag && !label && !value;
|
|
119
|
-
var tagRender =
|
|
120
|
-
if (Array.isArray(
|
|
119
|
+
var tagRender = params => {
|
|
120
|
+
if (Array.isArray(params === null || params === void 0 ? void 0 : params.tag) && params !== null && params !== void 0 && params.tag.length) {
|
|
121
121
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Space, {
|
|
122
122
|
size: 4,
|
|
123
|
-
children:
|
|
123
|
+
children: params.tag.map((tagItem, index) => {
|
|
124
124
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
125
125
|
className: "pro-header-tag",
|
|
126
126
|
children: tagItem
|
|
@@ -128,26 +128,30 @@ var ProHeader = props => {
|
|
|
128
128
|
})
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
return
|
|
131
|
+
return params !== null && params !== void 0 && params.tag ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
132
132
|
className: "pro-header-tag",
|
|
133
|
-
children:
|
|
133
|
+
children: params === null || params === void 0 ? void 0 : params.tag
|
|
134
134
|
}) : null;
|
|
135
135
|
};
|
|
136
136
|
|
|
137
137
|
/** 单行渲染 */
|
|
138
|
-
var valueRender =
|
|
138
|
+
var valueRender = params => {
|
|
139
139
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Space, {
|
|
140
140
|
size: 4,
|
|
141
|
-
align:
|
|
142
|
-
children: [
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
141
|
+
align: params !== null && params !== void 0 && params.tag ? 'baseline' : 'center',
|
|
142
|
+
children: [params !== null && params !== void 0 && params.link ?
|
|
143
|
+
/*#__PURE__*/
|
|
144
|
+
// eslint-disable-next-line jsx-a11y/anchor-is-valid
|
|
145
|
+
(0, _jsxRuntime.jsx)("a", {
|
|
146
|
+
onClick: () => {
|
|
147
|
+
var newWindow = window.open(params.link);
|
|
148
|
+
newWindow.opener = null;
|
|
149
|
+
},
|
|
150
|
+
children: params === null || params === void 0 ? void 0 : params.value
|
|
151
|
+
}) : params === null || params === void 0 ? void 0 : params.value, params !== null && params !== void 0 && params.copyable && (0, _lodash.isString)(params === null || params === void 0 ? void 0 : params.value) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Copy, {
|
|
152
|
+
text: params.value
|
|
149
153
|
}) : null, tagRender({
|
|
150
|
-
tag:
|
|
154
|
+
tag: params === null || params === void 0 ? void 0 : params.tag
|
|
151
155
|
})]
|
|
152
156
|
});
|
|
153
157
|
};
|
|
@@ -157,13 +157,64 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
|
157
157
|
selectedRowKeys: []
|
|
158
158
|
});
|
|
159
159
|
};
|
|
160
|
+
var resetParams = () => {
|
|
161
|
+
setState({
|
|
162
|
+
searchValues: {},
|
|
163
|
+
allSelected: false,
|
|
164
|
+
selectedRecords: [],
|
|
165
|
+
selectedRowKeys: [],
|
|
166
|
+
extraFilter: {
|
|
167
|
+
filters: undefined,
|
|
168
|
+
sorter: undefined
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// 重置查询条件: 页码还原、勾选清空
|
|
174
|
+
var onReset = refresh => {
|
|
175
|
+
form === null || form === void 0 || form.resetFields();
|
|
176
|
+
var newPage = {
|
|
177
|
+
pageNum: 1,
|
|
178
|
+
pageSize: page.pageSize
|
|
179
|
+
};
|
|
180
|
+
resetParams();
|
|
181
|
+
if (isResetQuery || refresh) {
|
|
182
|
+
onPageChange(newPage);
|
|
183
|
+
run(getTransformParams({
|
|
184
|
+
page: newPage
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
};
|
|
160
188
|
|
|
161
189
|
/**
|
|
162
190
|
* 手动触发时,手动调用run
|
|
163
191
|
*/
|
|
164
192
|
(0, _react.useEffect)(() => {
|
|
165
193
|
if (!(useRequestOptions !== null && useRequestOptions !== void 0 && useRequestOptions.manual)) {
|
|
166
|
-
|
|
194
|
+
onReset(true);
|
|
195
|
+
}
|
|
196
|
+
}, [useRequestOptions === null || useRequestOptions === void 0 ? void 0 : useRequestOptions.manual, curExtraParams, curService]);
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* 手动触发时,手动调用run
|
|
200
|
+
*/
|
|
201
|
+
(0, _react.useEffect)(() => {
|
|
202
|
+
if (!(useRequestOptions !== null && useRequestOptions !== void 0 && useRequestOptions.manual)) {
|
|
203
|
+
// 当 extraParams 变化时,重置分页和选中状态
|
|
204
|
+
onPageChange(initPage);
|
|
205
|
+
setState({
|
|
206
|
+
searchValues: {},
|
|
207
|
+
allSelected: false,
|
|
208
|
+
selectedRecords: [],
|
|
209
|
+
selectedRowKeys: [],
|
|
210
|
+
extraFilter: {
|
|
211
|
+
filters: undefined,
|
|
212
|
+
sorter: undefined
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
run(getTransformParams({
|
|
216
|
+
page: initPage
|
|
217
|
+
}));
|
|
167
218
|
}
|
|
168
219
|
}, [useRequestOptions === null || useRequestOptions === void 0 ? void 0 : useRequestOptions.manual, curExtraParams, curService]);
|
|
169
220
|
(0, _ahooks.useDeepCompareEffect)(() => {
|
|
@@ -273,34 +324,6 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
|
273
324
|
page: newPage
|
|
274
325
|
}, extraFilter), _values)));
|
|
275
326
|
};
|
|
276
|
-
var resetParams = page => {
|
|
277
|
-
setState({
|
|
278
|
-
searchValues: {},
|
|
279
|
-
allSelected: false,
|
|
280
|
-
selectedRecords: [],
|
|
281
|
-
selectedRowKeys: [],
|
|
282
|
-
extraFilter: {
|
|
283
|
-
filters: undefined,
|
|
284
|
-
sorter: undefined
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
// 重置查询条件: 页码还原、勾选清空
|
|
290
|
-
var onReset = () => {
|
|
291
|
-
form === null || form === void 0 || form.resetFields();
|
|
292
|
-
var newPage = {
|
|
293
|
-
pageNum: 1,
|
|
294
|
-
pageSize: page.pageSize
|
|
295
|
-
};
|
|
296
|
-
resetParams(newPage);
|
|
297
|
-
if (isResetQuery) {
|
|
298
|
-
onPageChange(newPage);
|
|
299
|
-
run(getTransformParams({
|
|
300
|
-
page: newPage
|
|
301
|
-
}));
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
327
|
var refreshPage = res => {
|
|
305
328
|
var transformResult = transformResponse ? transformResponse(res) : res || {};
|
|
306
329
|
var _ref3 = (0, _utils.isListResult)(transformResult) ? transformResult : (transformResult === null || transformResult === void 0 ? void 0 : transformResult.data) || {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zat-design/sisyphus-react",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"@dnd-kit/sortable": "^7.0.2",
|
|
79
79
|
"@dnd-kit/utilities": "^3.2.1",
|
|
80
80
|
"@zat-design/utils": "4.0.0-beta.5",
|
|
81
|
-
"ahooks": "3.
|
|
82
|
-
"antd": "^5.
|
|
81
|
+
"ahooks": "3.9.5",
|
|
82
|
+
"antd": "^5.28.1",
|
|
83
83
|
"big.js": "^6.2.1",
|
|
84
84
|
"classnames": "^2.3.1",
|
|
85
85
|
"dayjs": "^1.11.13",
|