@zat-design/sisyphus-react 3.9.8-beta.1 → 3.9.8-beta.11
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 +0 -5
- package/dist/less.esm.css +0 -5
- package/es/ProEditTable/components/ActionButton/index.js +57 -9
- package/es/ProEditTable/components/RenderField/index.js +23 -14
- package/es/ProEditTable/components/RenderToolbar/index.js +18 -16
- package/es/ProEditTable/index.js +1 -1
- package/es/ProEditTable/propsType.d.ts +6 -3
- package/es/ProEditTable/utils/diffOriginal.d.ts +1 -1
- package/es/ProEditTable/utils/diffOriginal.js +21 -22
- package/es/ProEditTable/utils/index.js +35 -30
- package/es/ProEditTable/utils/tools.d.ts +1 -1
- package/es/ProEditTable/utils/tools.js +1 -1
- package/es/ProForm/components/combination/Group/index.js +7 -2
- package/es/ProForm/components/combination/Group/propsType.d.ts +1 -0
- package/es/ProForm/components/combination/Group/utils.d.ts +6 -1
- package/es/ProForm/components/combination/Group/utils.js +28 -6
- package/es/ProForm/components/render/Render.js +23 -11
- package/es/ProForm/components/render/RenderFields.d.ts +1 -0
- package/es/ProForm/components/render/RenderFields.js +8 -4
- package/es/ProForm/components/render/propsType.d.ts +3 -1
- package/es/ProForm/index.js +5 -2
- package/es/ProForm/propsType.d.ts +3 -0
- package/es/ProForm/utils/diffOriginal.js +9 -2
- package/es/ProForm/utils/useShouldUpdate.js +25 -5
- package/es/ProForm/utils/valueType.d.ts +8 -0
- package/es/ProForm/utils/valueType.js +99 -33
- package/es/ProLayout/components/ProHeader/style/index.less +0 -8
- package/es/ProTable/components/FormatColumn/index.js +1 -0
- package/es/ProTable/components/RenderColumn/index.d.ts +2 -0
- package/es/ProTable/components/RenderColumn/index.js +10 -2
- package/es/ProTable/hooks/useAntdTable.js +4 -3
- package/es/ProTable/propsType.d.ts +2 -0
- package/es/ProTable/utils/index.d.ts +4 -0
- package/es/ProTable/utils/index.js +15 -0
- package/lib/ProEditTable/components/ActionButton/index.js +57 -9
- package/lib/ProEditTable/components/RenderField/index.js +22 -13
- package/lib/ProEditTable/components/RenderToolbar/index.js +18 -16
- package/lib/ProEditTable/index.js +1 -1
- package/lib/ProEditTable/propsType.d.ts +6 -3
- package/lib/ProEditTable/utils/diffOriginal.d.ts +1 -1
- package/lib/ProEditTable/utils/diffOriginal.js +21 -22
- package/lib/ProEditTable/utils/index.js +35 -30
- package/lib/ProEditTable/utils/tools.d.ts +1 -1
- package/lib/ProEditTable/utils/tools.js +1 -1
- package/lib/ProForm/components/combination/Group/index.js +7 -2
- package/lib/ProForm/components/combination/Group/propsType.d.ts +1 -0
- package/lib/ProForm/components/combination/Group/utils.d.ts +6 -1
- package/lib/ProForm/components/combination/Group/utils.js +28 -6
- package/lib/ProForm/components/render/Render.js +23 -11
- package/lib/ProForm/components/render/RenderFields.d.ts +1 -0
- package/lib/ProForm/components/render/RenderFields.js +8 -4
- package/lib/ProForm/components/render/propsType.d.ts +3 -1
- package/lib/ProForm/index.js +5 -2
- package/lib/ProForm/propsType.d.ts +3 -0
- package/lib/ProForm/utils/diffOriginal.js +9 -2
- package/lib/ProForm/utils/useShouldUpdate.js +25 -5
- package/lib/ProForm/utils/valueType.d.ts +8 -0
- package/lib/ProForm/utils/valueType.js +100 -34
- package/lib/ProLayout/components/ProHeader/style/index.less +0 -8
- package/lib/ProTable/components/FormatColumn/index.js +1 -0
- package/lib/ProTable/components/RenderColumn/index.d.ts +2 -0
- package/lib/ProTable/components/RenderColumn/index.js +10 -2
- package/lib/ProTable/hooks/useAntdTable.js +3 -2
- package/lib/ProTable/propsType.d.ts +2 -0
- package/lib/ProTable/utils/index.d.ts +4 -0
- package/lib/ProTable/utils/index.js +17 -1
- package/package.json +2 -1
@@ -4,7 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
5
5
|
value: true
|
6
6
|
});
|
7
|
-
exports.default = void 0;
|
7
|
+
exports.maskStringRangeWithRegex = exports.default = void 0;
|
8
|
+
var _readOnlyError2 = _interopRequireDefault(require("@babel/runtime/helpers/readOnlyError"));
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
8
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
9
11
|
var _big = _interopRequireDefault(require("big.js"));
|
10
12
|
var _lodash = require("lodash");
|
@@ -195,13 +197,31 @@ var dateTransform = function dateTransform(_ref2) {
|
|
195
197
|
}
|
196
198
|
return result;
|
197
199
|
};
|
200
|
+
/** 脱敏处理函数 */
|
201
|
+
var maskStringRangeWithRegex = exports.maskStringRangeWithRegex = function maskStringRangeWithRegex(input, range) {
|
202
|
+
var _ref3 = range || [],
|
203
|
+
_ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
204
|
+
start = _ref4[0],
|
205
|
+
end = _ref4[1];
|
206
|
+
if (start < 0) {
|
207
|
+
throw new Error('脱敏数据: start index cannot be negative');
|
208
|
+
}
|
209
|
+
var adjustedEnd = Math.min(end, input.length - 1);
|
210
|
+
if (start >= input.length) {
|
211
|
+
return '';
|
212
|
+
}
|
213
|
+
var regexPattern = "^(.{".concat(start, "})(.{").concat(adjustedEnd - start + 1, "})(.*)$");
|
214
|
+
var regex = new RegExp(regexPattern);
|
215
|
+
var maskedValue = input.replace(regex, "$1".concat('*'.repeat(adjustedEnd - start + 1), "$3"));
|
216
|
+
return maskedValue;
|
217
|
+
};
|
198
218
|
var _default = exports.default = {
|
199
219
|
/** 年月日 */
|
200
|
-
date: function date(
|
201
|
-
var type =
|
202
|
-
toISOString =
|
203
|
-
toCSTString =
|
204
|
-
mode =
|
220
|
+
date: function date(_ref5) {
|
221
|
+
var type = _ref5.type,
|
222
|
+
toISOString = _ref5.toISOString,
|
223
|
+
toCSTString = _ref5.toCSTString,
|
224
|
+
mode = _ref5.mode;
|
205
225
|
return dateTransform({
|
206
226
|
type: type,
|
207
227
|
_valueType: 'date',
|
@@ -211,11 +231,11 @@ var _default = exports.default = {
|
|
211
231
|
});
|
212
232
|
},
|
213
233
|
/** 年月日 时分秒 */
|
214
|
-
dateTime: function dateTime(
|
215
|
-
var type =
|
216
|
-
toISOString =
|
217
|
-
toCSTString =
|
218
|
-
mode =
|
234
|
+
dateTime: function dateTime(_ref6) {
|
235
|
+
var type = _ref6.type,
|
236
|
+
toISOString = _ref6.toISOString,
|
237
|
+
toCSTString = _ref6.toCSTString,
|
238
|
+
mode = _ref6.mode;
|
219
239
|
return dateTransform({
|
220
240
|
type: type,
|
221
241
|
_valueType: 'dateTime',
|
@@ -225,11 +245,11 @@ var _default = exports.default = {
|
|
225
245
|
});
|
226
246
|
},
|
227
247
|
/** 年月日 00:00:00 */
|
228
|
-
dateStartTime: function dateStartTime(
|
229
|
-
var type =
|
230
|
-
toISOString =
|
231
|
-
toCSTString =
|
232
|
-
mode =
|
248
|
+
dateStartTime: function dateStartTime(_ref7) {
|
249
|
+
var type = _ref7.type,
|
250
|
+
toISOString = _ref7.toISOString,
|
251
|
+
toCSTString = _ref7.toCSTString,
|
252
|
+
mode = _ref7.mode;
|
233
253
|
return dateTransform({
|
234
254
|
type: type,
|
235
255
|
_valueType: 'dateStartTime',
|
@@ -239,11 +259,11 @@ var _default = exports.default = {
|
|
239
259
|
});
|
240
260
|
},
|
241
261
|
/** 年月日 23:59:59 */
|
242
|
-
dateEndTime: function dateEndTime(
|
243
|
-
var type =
|
244
|
-
toISOString =
|
245
|
-
toCSTString =
|
246
|
-
mode =
|
262
|
+
dateEndTime: function dateEndTime(_ref8) {
|
263
|
+
var type = _ref8.type,
|
264
|
+
toISOString = _ref8.toISOString,
|
265
|
+
toCSTString = _ref8.toCSTString,
|
266
|
+
mode = _ref8.mode;
|
247
267
|
return dateTransform({
|
248
268
|
type: type,
|
249
269
|
_valueType: 'dateEndTime',
|
@@ -253,11 +273,11 @@ var _default = exports.default = {
|
|
253
273
|
});
|
254
274
|
},
|
255
275
|
/** 年月日 00:00:00 ~ 年月日 23:59:59 */
|
256
|
-
dateStartEndTime: function dateStartEndTime(
|
257
|
-
var type =
|
258
|
-
toISOString =
|
259
|
-
toCSTString =
|
260
|
-
mode =
|
276
|
+
dateStartEndTime: function dateStartEndTime(_ref9) {
|
277
|
+
var type = _ref9.type,
|
278
|
+
toISOString = _ref9.toISOString,
|
279
|
+
toCSTString = _ref9.toCSTString,
|
280
|
+
mode = _ref9.mode;
|
261
281
|
return dateTransform({
|
262
282
|
type: type,
|
263
283
|
_valueType: 'dateStartEndTime',
|
@@ -267,9 +287,9 @@ var _default = exports.default = {
|
|
267
287
|
});
|
268
288
|
},
|
269
289
|
/** 百分比 */
|
270
|
-
percentage: function percentage(
|
271
|
-
var type =
|
272
|
-
valueType =
|
290
|
+
percentage: function percentage(_ref10) {
|
291
|
+
var type = _ref10.type,
|
292
|
+
valueType = _ref10.valueType;
|
273
293
|
return transformRatio({
|
274
294
|
type: type,
|
275
295
|
valueType: valueType,
|
@@ -277,9 +297,9 @@ var _default = exports.default = {
|
|
277
297
|
});
|
278
298
|
},
|
279
299
|
/** 千分比 */
|
280
|
-
permillage: function permillage(
|
281
|
-
var type =
|
282
|
-
valueType =
|
300
|
+
permillage: function permillage(_ref11) {
|
301
|
+
var type = _ref11.type,
|
302
|
+
valueType = _ref11.valueType;
|
283
303
|
return transformRatio({
|
284
304
|
type: type,
|
285
305
|
valueType: valueType,
|
@@ -287,8 +307,54 @@ var _default = exports.default = {
|
|
287
307
|
});
|
288
308
|
},
|
289
309
|
/** 开关 YN转换 */
|
290
|
-
switch: function _switch(
|
291
|
-
var switchValue =
|
310
|
+
switch: function _switch(_ref12) {
|
311
|
+
var switchValue = _ref12.switchValue;
|
292
312
|
return switchTransform(switchValue);
|
313
|
+
},
|
314
|
+
/** 脱敏 转换 */
|
315
|
+
desensitization: function desensitization(props) {
|
316
|
+
var desensitization = props.desensitization,
|
317
|
+
type = props.type,
|
318
|
+
mode = props.mode,
|
319
|
+
names = props.names;
|
320
|
+
// 判断是否是地址控件,并带地址详情场景
|
321
|
+
if (type === 'ProCascader' && mode === 'address' && (names === null || names === void 0 ? void 0 : names.length) === 4) {
|
322
|
+
return {
|
323
|
+
getValueProps: function getValueProps(value) {
|
324
|
+
try {
|
325
|
+
if (value === null || value === void 0 ? void 0 : value.length) {
|
326
|
+
var _value = (0, _slicedToArray2.default)(value, 4),
|
327
|
+
province = _value[0],
|
328
|
+
city = _value[1],
|
329
|
+
county = _value[2],
|
330
|
+
address = _value[3];
|
331
|
+
return {
|
332
|
+
value: [province, city, county, maskStringRangeWithRegex(address, desensitization)]
|
333
|
+
};
|
334
|
+
}
|
335
|
+
return {
|
336
|
+
value: value
|
337
|
+
};
|
338
|
+
} catch (error) {
|
339
|
+
return {
|
340
|
+
value: value
|
341
|
+
}; // 如果发生错误,返回原始值
|
342
|
+
}
|
343
|
+
}
|
344
|
+
};
|
345
|
+
}
|
346
|
+
return {
|
347
|
+
getValueProps: function getValueProps(value) {
|
348
|
+
try {
|
349
|
+
return {
|
350
|
+
value: maskStringRangeWithRegex(value, desensitization)
|
351
|
+
};
|
352
|
+
} catch (error) {
|
353
|
+
return {
|
354
|
+
value: value
|
355
|
+
}; // 如果发生错误,返回原始值
|
356
|
+
}
|
357
|
+
}
|
358
|
+
};
|
293
359
|
}
|
294
360
|
};
|
@@ -84,6 +84,7 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref2) {
|
|
84
84
|
minWidth = column.minWidth,
|
85
85
|
onDiff = column.onDiff,
|
86
86
|
otherProps = (0, _objectWithoutProperties2.default)(column, _excluded);
|
87
|
+
otherProps.scroll = scroll;
|
87
88
|
// 仅在 {x: 'max-content', y: 300 } 且 column无指定 width minWidth 情况下 才开启 minWidth的自动计算
|
88
89
|
var isMaxContentOverFlow = (0, _lodash.isObject)(scroll) ? (scroll === null || scroll === void 0 ? void 0 : scroll.x) === 'max-content' && Reflect.ownKeys(scroll).includes('y') : false;
|
89
90
|
calcMinWidth({
|
@@ -31,7 +31,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
31
31
|
_props$toolTipProps = props.toolTipProps,
|
32
32
|
toolTipProps = _props$toolTipProps === void 0 ? {} : _props$toolTipProps,
|
33
33
|
minWidth = props.minWidth,
|
34
|
-
isInNewRowFlag = props.isInNewRowFlag
|
34
|
+
isInNewRowFlag = props.isInNewRowFlag,
|
35
|
+
scroll = props.scroll;
|
35
36
|
var _useSetState = (0, _ahooks.useSetState)({
|
36
37
|
tooltip: false
|
37
38
|
}),
|
@@ -45,8 +46,9 @@ var RenderColumn = function RenderColumn(props) {
|
|
45
46
|
// 比对场景走的逻辑
|
46
47
|
if (!isInNewRowFlag && (0, _lodash.isBoolean)(props === null || props === void 0 ? void 0 : props.isChanged)) {
|
47
48
|
var renderNode = value ? node : '-';
|
49
|
+
var isXMaxContent = (scroll === null || scroll === void 0 ? void 0 : scroll.x) === 'max-content';
|
48
50
|
if (ellipsis || (props === null || props === void 0 ? void 0 : props.isChanged)) {
|
49
|
-
renderNode = (0, _jsxRuntime.jsx)(Text, {
|
51
|
+
renderNode = !isXMaxContent ? (0, _jsxRuntime.jsx)(Text, {
|
50
52
|
style: {
|
51
53
|
width: currentValue === '-' ? 32.5 : width,
|
52
54
|
minWidth: minWidth
|
@@ -55,6 +57,12 @@ var RenderColumn = function RenderColumn(props) {
|
|
55
57
|
tooltip: false
|
56
58
|
},
|
57
59
|
children: ellipsis ? currentValue : renderNode
|
60
|
+
}) : (0, _jsxRuntime.jsx)("div", {
|
61
|
+
style: {
|
62
|
+
minWidth: minWidth,
|
63
|
+
width: width
|
64
|
+
},
|
65
|
+
children: ellipsis ? currentValue : renderNode
|
58
66
|
});
|
59
67
|
if ((props === null || props === void 0 ? void 0 : props.isChanged) === false) {
|
60
68
|
return renderNode;
|
@@ -226,16 +226,17 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
226
226
|
pageNum: 1,
|
227
227
|
pageSize: page.pageSize
|
228
228
|
};
|
229
|
+
var _values = (0, _utils.removeEmptyKeys)(values);
|
229
230
|
onPageChange(newPage);
|
230
231
|
setState({
|
231
|
-
searchValues:
|
232
|
+
searchValues: _values,
|
232
233
|
allSelected: false,
|
233
234
|
selectedRecords: [],
|
234
235
|
selectedRowKeys: []
|
235
236
|
});
|
236
237
|
run(getTransformParams((0, _objectSpread2.default)((0, _objectSpread2.default)({
|
237
238
|
page: newPage
|
238
|
-
}, extraFilter),
|
239
|
+
}, extraFilter), _values)));
|
239
240
|
}, [extraFilter, page.pageSize, run, getTransformParams]);
|
240
241
|
var resetParams = (0, _react.useCallback)(function () {
|
241
242
|
var page = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initPage;
|
@@ -46,6 +46,8 @@ export interface ProTableColumn extends Omit<ColumnType<any>, 'dataIndex'> {
|
|
46
46
|
viewRender?: ({ value, record, index, originalValue, originalRecord, }: any) => 'same' | 'changed' | 'add' | undefined;
|
47
47
|
isChanged?: boolean | null;
|
48
48
|
children?: ProTableColumn[];
|
49
|
+
/** table透传下来的scroll配置 */
|
50
|
+
scroll?: any;
|
49
51
|
}
|
50
52
|
export interface CreateTreeFromArrayOptions {
|
51
53
|
itemKey?: string;
|
@@ -29,3 +29,7 @@ export declare const isListResult: (data: {
|
|
29
29
|
[key: string]: any;
|
30
30
|
}) => boolean;
|
31
31
|
export declare const getRowKey: (rowKey: any, record: any) => any;
|
32
|
+
/** 移除对象中的 null , undefined, '' 的key */
|
33
|
+
export declare const removeEmptyKeys: (obj: any) => {
|
34
|
+
[k: string]: unknown;
|
35
|
+
};
|
@@ -1,9 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
4
5
|
value: true
|
5
6
|
});
|
6
|
-
exports.isListResult = exports.getRowKey = exports.getOriginalValue = exports.getDecimalDigits = exports.getColumnDataIndex = void 0;
|
7
|
+
exports.removeEmptyKeys = exports.isListResult = exports.getRowKey = exports.getOriginalValue = exports.getDecimalDigits = exports.getColumnDataIndex = void 0;
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
7
9
|
var _lodash = require("lodash");
|
8
10
|
var _utils = require("@zat-design/utils");
|
9
11
|
var isEmpty = _utils.validate.isEmpty;
|
@@ -76,4 +78,18 @@ var getRowKey = exports.getRowKey = function getRowKey(rowKey, record) {
|
|
76
78
|
key = (_ref = typeof rowKey === 'function' ? rowKey(record) : record[rowKey]) !== null && _ref !== void 0 ? _ref : key;
|
77
79
|
}
|
78
80
|
return key;
|
81
|
+
};
|
82
|
+
/** 移除对象中的 null , undefined, '' 的key */
|
83
|
+
var removeEmptyKeys = exports.removeEmptyKeys = function removeEmptyKeys(obj) {
|
84
|
+
// 使用 Object.entries() 将对象转换为键值对数组
|
85
|
+
var entries = Object.entries(obj);
|
86
|
+
// 过滤掉值为 null, undefined, 或 '' 的键值对
|
87
|
+
var filteredEntries = entries.filter(function (_ref2) {
|
88
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
89
|
+
key = _ref3[0],
|
90
|
+
value = _ref3[1];
|
91
|
+
return !isEmpty(value);
|
92
|
+
});
|
93
|
+
// 使用 Object.fromEntries() 将过滤后的键值对数组转换回对象
|
94
|
+
return Object.fromEntries(filteredEntries);
|
79
95
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@zat-design/sisyphus-react",
|
3
|
-
"version": "3.9.8-beta.
|
3
|
+
"version": "3.9.8-beta.11",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -9,6 +9,7 @@
|
|
9
9
|
"analyze": "ANALYZE=1 dumi build",
|
10
10
|
"build": "npm run build-lib && npm run build-es && npm run build-dist",
|
11
11
|
"build-dist": "father-build",
|
12
|
+
"build-umd": "cross-env BUILD_TYPE=umd father-build",
|
12
13
|
"build-es": "cross-env BUILD_TYPE=es father-build",
|
13
14
|
"build-lib": "father-build && cross-env BUILD_TYPE=lib father-build",
|
14
15
|
"docs": "dumi build",
|