@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
|
@@ -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) || {},
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
.pro-tabs-card-left {
|
|
7
7
|
width: 84px !important;
|
|
8
8
|
}
|
|
9
|
+
.pro-tabs-card-right {
|
|
10
|
+
width: 24px !important;
|
|
11
|
+
}
|
|
9
12
|
.pro-tabs-card-right img {
|
|
10
13
|
width: 24px !important;
|
|
11
14
|
}
|
|
@@ -94,7 +97,7 @@
|
|
|
94
97
|
|
|
95
98
|
.pro-tabs-card-right {
|
|
96
99
|
display: flex;
|
|
97
|
-
|
|
100
|
+
width: 48px;
|
|
98
101
|
img {
|
|
99
102
|
width: 48px;
|
|
100
103
|
}
|
|
@@ -123,6 +126,7 @@
|
|
|
123
126
|
width: 200px;
|
|
124
127
|
padding: calc(9px * var(--zaui-size; 1)) 16px calc(9px * var(--zaui-size; 1)) 24px;
|
|
125
128
|
border: 1px solid var(--zaui-line, #dddddd);
|
|
129
|
+
border-radius: var(--zaui-border-radius, 8px);
|
|
126
130
|
|
|
127
131
|
.pro-tabs-card-left {
|
|
128
132
|
width: 104px;
|
package/lib/utils/index.js
CHANGED
|
@@ -13,10 +13,22 @@ var _lodash = require("lodash");
|
|
|
13
13
|
var EMPTY_VALUE = [undefined, null, ''];
|
|
14
14
|
|
|
15
15
|
// 自定义深比对 如果两边都是函数类型则认为相等
|
|
16
|
+
// 对于 React 元素,不直接认为相等,而是让 lodash 继续进行深度比较
|
|
16
17
|
var customEqualForFunction = (value, other) => {
|
|
17
|
-
|
|
18
|
+
// 只有当两边都是函数时才认为相等
|
|
19
|
+
if ((0, _lodash.isFunction)(value) && (0, _lodash.isFunction)(other)) {
|
|
18
20
|
return true;
|
|
19
21
|
}
|
|
22
|
+
// 对于 React 元素,返回 undefined 让 isEqualWith 继续使用默认比较逻辑
|
|
23
|
+
// 这样会比较 React 元素的 type、props 等属性
|
|
24
|
+
if ( /*#__PURE__*/_react.default.isValidElement(value) && /*#__PURE__*/_react.default.isValidElement(other)) {
|
|
25
|
+
// 比较 React 元素的类型和关键 props
|
|
26
|
+
if (value.type !== other.type) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
// 对于相同类型的 React 元素,返回 undefined 让 isEqualWith 继续深度比较 props
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
20
32
|
};
|
|
21
33
|
|
|
22
34
|
/**
|
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",
|
|
@@ -135,7 +135,6 @@
|
|
|
135
135
|
"lint-staged": "^10.0.0",
|
|
136
136
|
"mini-css-extract-plugin": "^2.9.4",
|
|
137
137
|
"mockjs": "^1.0.0",
|
|
138
|
-
"moment": "^2.30.1",
|
|
139
138
|
"prettier": "^2.5.0",
|
|
140
139
|
"pretty-quick": "^3.1.3",
|
|
141
140
|
"react": "^18.2.0",
|