@zat-design/sisyphus-react 3.4.11-beta.9 → 3.4.12
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 +28 -0
- package/dist/less.esm.css +28 -0
- package/es/ProEditTable/components/DndWrapper/index.d.ts +1 -1
- package/es/ProEditTable/components/DndWrapper/index.js +3 -4
- package/es/ProEditTable/components/RenderField/index.js +6 -4
- package/es/ProEditTable/index.js +1 -1
- package/es/ProEnum/hooks/useEnum.js +13 -11
- package/es/ProEnum/hooks/useEnumRequest.js +34 -32
- package/es/ProEnum/index.js +4 -4
- package/es/ProEnum/utils/index.d.ts +1 -1
- package/es/ProEnum/utils/index.js +4 -1
- package/es/ProForm/components/combination/Group/component/ComRender.d.ts +2 -0
- package/es/ProForm/components/combination/Group/component/ComRender.js +9 -2
- package/es/ProForm/components/combination/Group/propsType.d.ts +2 -0
- package/es/ProForm/components/combination/Group/utils.js +1 -1
- package/es/ProForm/components/combination/ProCascader/index.js +2 -2
- package/es/ProForm/components/index.d.ts +1 -0
- package/es/ProForm/components/index.js +1 -0
- package/es/ProForm/components/render/Render.js +1 -1
- package/es/ProTable/components/RenderColumn/index.js +8 -1
- package/es/ProTabs/style/index.less +33 -0
- package/es/ProTooltip/index.js +12 -0
- package/es/ProTooltip/propsType.d.ts +3 -0
- package/es/ProTree/components/ProTree.js +33 -14
- package/es/ProTree/components/ProTreeSelect/index.js +11 -5
- package/es/ProTree/components/ProTreeSelect/propsType.d.ts +2 -0
- package/es/ProTree/propsType.d.ts +2 -1
- package/es/ProUpload/components/DragRender.js +4 -6
- package/es/ProUpload/style/fileItem.less +11 -0
- package/lib/ProEditTable/components/DndWrapper/index.d.ts +1 -1
- package/lib/ProEditTable/components/DndWrapper/index.js +3 -4
- package/lib/ProEditTable/components/RenderField/index.js +6 -4
- package/lib/ProEditTable/index.js +1 -1
- package/lib/ProEnum/hooks/useEnum.js +13 -12
- package/lib/ProEnum/hooks/useEnumRequest.js +34 -32
- package/lib/ProEnum/index.js +4 -4
- package/lib/ProEnum/utils/index.d.ts +1 -1
- package/lib/ProEnum/utils/index.js +4 -1
- package/lib/ProForm/components/combination/Group/component/ComRender.d.ts +2 -0
- package/lib/ProForm/components/combination/Group/component/ComRender.js +9 -2
- package/lib/ProForm/components/combination/Group/propsType.d.ts +2 -0
- package/lib/ProForm/components/combination/Group/utils.js +1 -1
- package/lib/ProForm/components/combination/ProCascader/index.js +2 -2
- package/lib/ProForm/components/index.d.ts +1 -0
- package/lib/ProForm/components/index.js +6 -0
- package/lib/ProForm/components/render/Render.js +1 -1
- package/lib/ProTable/components/RenderColumn/index.js +8 -1
- package/lib/ProTabs/style/index.less +33 -0
- package/lib/ProTooltip/index.js +12 -0
- package/lib/ProTooltip/propsType.d.ts +3 -0
- package/lib/ProTree/components/ProTree.js +33 -14
- package/lib/ProTree/components/ProTreeSelect/index.js +11 -5
- package/lib/ProTree/components/ProTreeSelect/propsType.d.ts +2 -0
- package/lib/ProTree/propsType.d.ts +2 -1
- package/lib/ProUpload/components/DragRender.js +3 -5
- package/lib/ProUpload/style/fileItem.less +11 -0
- package/package.json +1 -1
|
@@ -245,7 +245,7 @@ var ProTree = function ProTree(props) {
|
|
|
245
245
|
/**
|
|
246
246
|
* 复选事件处理函数,全选事件处理函数
|
|
247
247
|
*/
|
|
248
|
-
var handleFinish = function handleFinish(allValue, checkAll, checkedValues) {
|
|
248
|
+
var handleFinish = function handleFinish(allValue, checkAll, checkedValues, checkedNode) {
|
|
249
249
|
if (disabled || isView) {
|
|
250
250
|
return null;
|
|
251
251
|
}
|
|
@@ -257,16 +257,24 @@ var ProTree = function ProTree(props) {
|
|
|
257
257
|
onChange && onChange(allValue);
|
|
258
258
|
} else {
|
|
259
259
|
var values = checkedValues;
|
|
260
|
+
var options = state.flatTreeData.filter(function (item) {
|
|
261
|
+
return values.includes(item[fieldNameValue]);
|
|
262
|
+
});
|
|
263
|
+
if (checkedNode) {
|
|
264
|
+
options = checkedNode;
|
|
265
|
+
delete options[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'];
|
|
266
|
+
}
|
|
260
267
|
if (labelInValue) {
|
|
261
268
|
values = state.flatTreeData.filter(function (item) {
|
|
262
269
|
return values.includes(item[fieldNameValue]);
|
|
263
270
|
});
|
|
264
271
|
}
|
|
265
|
-
onChange && onChange(values);
|
|
272
|
+
onChange && onChange(values, options);
|
|
266
273
|
}
|
|
267
274
|
};
|
|
268
275
|
// 该方法只有复选框,在勾中checkbox后才会走到这个方法
|
|
269
276
|
var onCheck = function onCheck(checkedKeys, info) {
|
|
277
|
+
var _info$node;
|
|
270
278
|
if (disabled || isView) {
|
|
271
279
|
return null;
|
|
272
280
|
}
|
|
@@ -310,7 +318,11 @@ var ProTree = function ProTree(props) {
|
|
|
310
318
|
setState({
|
|
311
319
|
checkAll: checkAllTemp
|
|
312
320
|
});
|
|
313
|
-
|
|
321
|
+
var checkNodeValue = info === null || info === void 0 ? void 0 : (_info$node = info.node) === null || _info$node === void 0 ? void 0 : _info$node[fieldNameValue];
|
|
322
|
+
var options = state.flatTreeData.filter(function (item) {
|
|
323
|
+
return checkNodeValue === item[fieldNameValue];
|
|
324
|
+
});
|
|
325
|
+
handleFinish(allValue, checkAllTemp, checkedValues, Array.isArray(options) ? options === null || options === void 0 ? void 0 : options[0] : options);
|
|
314
326
|
if (other === null || other === void 0 ? void 0 : other.onCheck) {
|
|
315
327
|
other.onCheck(checkedKeys, {
|
|
316
328
|
checked: info.checked,
|
|
@@ -343,12 +355,12 @@ var ProTree = function ProTree(props) {
|
|
|
343
355
|
setState({
|
|
344
356
|
checkAll: checked
|
|
345
357
|
});
|
|
346
|
-
handleFinish(allValue, checked, checkedValues);
|
|
358
|
+
handleFinish(allValue, checked, checkedValues, null);
|
|
347
359
|
};
|
|
348
360
|
/** 点击了树节点开始loading,改变自身state并将值通过onchange上传到form */
|
|
349
361
|
var onSelectTreeNode = /*#__PURE__*/function () {
|
|
350
362
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(props, info) {
|
|
351
|
-
var values;
|
|
363
|
+
var values, options, option;
|
|
352
364
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
353
365
|
while (1) switch (_context.prev = _context.next) {
|
|
354
366
|
case 0:
|
|
@@ -372,17 +384,24 @@ var ProTree = function ProTree(props) {
|
|
|
372
384
|
clickShowLoading: false
|
|
373
385
|
});
|
|
374
386
|
case 7:
|
|
387
|
+
values = props;
|
|
388
|
+
options = state.flatTreeData.filter(function (item) {
|
|
389
|
+
return values === item[fieldNameValue];
|
|
390
|
+
});
|
|
391
|
+
if (labelInValue) {
|
|
392
|
+
values = state.flatTreeData.filter(function (item) {
|
|
393
|
+
return values === item[fieldNameValue];
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
option = options === null || options === void 0 ? void 0 : options[0];
|
|
397
|
+
delete option[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'];
|
|
375
398
|
if (!(other === null || other === void 0 ? void 0 : other.checkable)) {
|
|
376
|
-
// 单选将选中节点值冒泡到form
|
|
377
|
-
values
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
return values === item[fieldNameValue];
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
onChange && onChange(values);
|
|
399
|
+
// 单选将选中节点值冒泡到form, 给onFieldChange添加options
|
|
400
|
+
onChange && onChange(values, option);
|
|
401
|
+
} else {
|
|
402
|
+
onChange && onChange(value, option);
|
|
384
403
|
}
|
|
385
|
-
case
|
|
404
|
+
case 13:
|
|
386
405
|
case "end":
|
|
387
406
|
return _context.stop();
|
|
388
407
|
}
|
|
@@ -8,7 +8,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
8
8
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
9
9
|
import "antd/es/tree-select/style";
|
|
10
10
|
import _TreeSelect from "antd/es/tree-select";
|
|
11
|
-
var _excluded = ["disabled", "code", "dataSource", "defaultDisableValue", "onChange", "useRequest", "transformResponse", "fieldNames", "tooltip", "showSearch", "filterTreeNode", "treeNodeFilterProp", "defaultExpandAll", "expandedKeys", "treeCheckable", "onSearch", "otherProps", "width", "dropdownStyle", "popupClassName", "style", "allowClear", "listHeight", "showCodeName", "className"],
|
|
11
|
+
var _excluded = ["disabled", "code", "dataSource", "defaultDisableValue", "onChange", "useRequest", "transformResponse", "fieldNames", "tooltip", "showSearch", "filterTreeNode", "treeNodeFilterProp", "defaultExpandAll", "expandedKeys", "treeCheckable", "onSearch", "otherProps", "width", "dropdownStyle", "popupClassName", "style", "allowClear", "listHeight", "showCodeName", "className", "checkStrictly", "checkable"],
|
|
12
12
|
_excluded2 = ["children"];
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
/* eslint-disable react/no-danger */
|
|
@@ -65,6 +65,8 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
65
65
|
listHeight = props.listHeight,
|
|
66
66
|
showCodeName = props.showCodeName,
|
|
67
67
|
className = props.className,
|
|
68
|
+
checkStrictly = props.checkStrictly,
|
|
69
|
+
checkable = props.checkable,
|
|
68
70
|
selectProps = _objectWithoutProperties(props, _excluded);
|
|
69
71
|
var _props$value = props.value,
|
|
70
72
|
value = _props$value === void 0 ? undefined : _props$value;
|
|
@@ -377,9 +379,11 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
377
379
|
var filterData = function filterData(data) {
|
|
378
380
|
for (var i = 0; i < data.length; i++) {
|
|
379
381
|
var item = data[i];
|
|
380
|
-
if (item[code] === nodeValue) {
|
|
381
|
-
result
|
|
382
|
+
if (item[code] === nodeValue || Array.isArray(nodeValue) && nodeValue.includes(item[code])) {
|
|
383
|
+
result = _objectSpread({}, item);
|
|
384
|
+
result.value = item[code];
|
|
382
385
|
result.label = item[label];
|
|
386
|
+
delete result[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'];
|
|
383
387
|
return null;
|
|
384
388
|
}
|
|
385
389
|
// 一直递归到最后一层子节点
|
|
@@ -413,7 +417,8 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
413
417
|
if (props === null || props === void 0 ? void 0 : props.labelInValue) {
|
|
414
418
|
result = getLabelByValue(selectList, newVal);
|
|
415
419
|
}
|
|
416
|
-
|
|
420
|
+
var options = findTreeNode(selectList, extra === null || extra === void 0 ? void 0 : extra.triggerValue);
|
|
421
|
+
onChange && onChange(result, options, extra);
|
|
417
422
|
// 重置搜索
|
|
418
423
|
showSearch && searchTreeEvent('');
|
|
419
424
|
};
|
|
@@ -486,7 +491,8 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
486
491
|
allowClear: allowClear || true,
|
|
487
492
|
showArrow: true,
|
|
488
493
|
treeNodeFilterProp: treeNodeFilterProp,
|
|
489
|
-
virtual: true
|
|
494
|
+
virtual: true,
|
|
495
|
+
treeCheckStrictly: checkStrictly
|
|
490
496
|
}, selectProps);
|
|
491
497
|
if (value === null) {
|
|
492
498
|
delete treeProps.value;
|
|
@@ -71,6 +71,8 @@ export interface PropTreeSelectProps extends Omit<TreeSelectProps, 'onSearch'> {
|
|
|
71
71
|
};
|
|
72
72
|
defaultExpandAll?: boolean;
|
|
73
73
|
expandedKeys?: any[];
|
|
74
|
+
checkStrictly?: boolean;
|
|
75
|
+
checkable?: boolean;
|
|
74
76
|
}
|
|
75
77
|
export interface ProSelectAction {
|
|
76
78
|
/** 获取发生请求的 useRequest 的 ref */
|
|
@@ -60,7 +60,7 @@ export interface ProTreeProps extends PropTreeSelectProps {
|
|
|
60
60
|
/** 树节点文本宽度 */
|
|
61
61
|
ellipseWidth?: string;
|
|
62
62
|
/** value改变的回调 */
|
|
63
|
-
onChange?: (values: string[] | AllValueType) => void;
|
|
63
|
+
onChange?: (values: string[] | AllValueType, options?: object[]) => void;
|
|
64
64
|
/** 点击树节点触发 */
|
|
65
65
|
onSelect?: (values: string[] | AllValueType, info?: any) => any;
|
|
66
66
|
/** 复选情况下点击checkbox触发,参照antd */
|
|
@@ -193,6 +193,7 @@ export interface PropTreeSelectProps extends Omit<TreeSelectProps, 'onSearch'> {
|
|
|
193
193
|
service: Service<any, any>;
|
|
194
194
|
options?: Options<any, any>;
|
|
195
195
|
};
|
|
196
|
+
checkable?: boolean;
|
|
196
197
|
}
|
|
197
198
|
export interface ProSelectAction {
|
|
198
199
|
/** 获取发生请求的 useRequest 的 ref */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import "antd/es/upload/style";
|
|
3
3
|
import _Upload from "antd/es/upload";
|
|
4
|
-
import {
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useRef } from 'react';
|
|
6
6
|
import { DndContext } from '@dnd-kit/core';
|
|
7
7
|
import { SortableContext, rectSortingStrategy } from '@dnd-kit/sortable';
|
|
@@ -27,9 +27,7 @@ var DragRender = function DragRender(props) {
|
|
|
27
27
|
setFileList = props.setFileList,
|
|
28
28
|
onChange = props.onChange;
|
|
29
29
|
var refReSelect = useRef();
|
|
30
|
-
if (isView) return
|
|
31
|
-
children: "-"
|
|
32
|
-
});
|
|
30
|
+
// if (isView) return <>-</>;
|
|
33
31
|
// 拖拽模式下单个文件可用
|
|
34
32
|
var showDraggerSingleRender = maxCount === 1 && fileList[0];
|
|
35
33
|
/**
|
|
@@ -92,13 +90,13 @@ var DragRender = function DragRender(props) {
|
|
|
92
90
|
onPreview: onPreview
|
|
93
91
|
}), file.status !== 'uploading' && _jsxs("div", {
|
|
94
92
|
className: "file-action-box",
|
|
95
|
-
children: [_jsx("div", {
|
|
93
|
+
children: [!isView && !disabled && _jsx("div", {
|
|
96
94
|
className: "file-name",
|
|
97
95
|
onClick: function onClick() {
|
|
98
96
|
handleReSelect(file);
|
|
99
97
|
},
|
|
100
98
|
children: locale === null || locale === void 0 ? void 0 : (_locale$ProUpload = locale.ProUpload) === null || _locale$ProUpload === void 0 ? void 0 : _locale$ProUpload.draggerSelect
|
|
101
|
-
}), _jsx("div", {
|
|
99
|
+
}), !isView && !disabled && _jsx("div", {
|
|
102
100
|
className: "file-del",
|
|
103
101
|
onClick: function onClick() {
|
|
104
102
|
handleDelFile(file);
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
+
@root-entry-name: 'default';
|
|
2
|
+
@import (reference) '~antd/es/style/themes/index.less';
|
|
3
|
+
|
|
1
4
|
.pro-upload {
|
|
5
|
+
.@{ant-prefix}-upload-disabled{
|
|
6
|
+
.file-action-box{
|
|
7
|
+
.file-name, .file-del{
|
|
8
|
+
color: #ccc;
|
|
9
|
+
cursor: not-allowed !important;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
2
13
|
|
|
3
14
|
.filelist-item-wrapper {
|
|
4
15
|
.file-info-box {
|
|
@@ -13,10 +13,9 @@ var _core = require("@dnd-kit/core");
|
|
|
13
13
|
var _sortable = require("@dnd-kit/sortable");
|
|
14
14
|
var _utilities = require("@dnd-kit/utilities");
|
|
15
15
|
var _ProIcon = _interopRequireDefault(require("../../../ProIcon"));
|
|
16
|
-
var _excluded = ["disabled", "
|
|
16
|
+
var _excluded = ["disabled", "children"];
|
|
17
17
|
var Row = exports.Row = function Row(props) {
|
|
18
18
|
var disabled = props.disabled,
|
|
19
|
-
hide = props.hide,
|
|
20
19
|
children = props.children,
|
|
21
20
|
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
22
21
|
var data = (0, _sortable.useSortable)({
|
|
@@ -50,7 +49,7 @@ var Row = exports.Row = function Row(props) {
|
|
|
50
49
|
renderIndex = _ref.renderIndex;
|
|
51
50
|
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
52
51
|
children: (0, _jsxRuntime.jsxs)("span", {
|
|
53
|
-
className: "drag-wrapper".concat(hide ? ' no-check' : ''),
|
|
52
|
+
className: "drag-wrapper".concat(props['data-hide'] ? ' no-check' : ''),
|
|
54
53
|
children: [(0, _jsxRuntime.jsx)(_ProIcon.default, (0, _objectSpread2.default)({
|
|
55
54
|
className: "drag-icon",
|
|
56
55
|
style: {
|
|
@@ -59,7 +58,7 @@ var Row = exports.Row = function Row(props) {
|
|
|
59
58
|
},
|
|
60
59
|
type: "drag",
|
|
61
60
|
size: 20
|
|
62
|
-
}, listeners)), hide ? null : render === null || render === void 0 ? void 0 : render(null, record, renderIndex)]
|
|
61
|
+
}, listeners)), props['data-hide'] ? null : render === null || render === void 0 ? void 0 : render(null, record, renderIndex)]
|
|
63
62
|
})
|
|
64
63
|
});
|
|
65
64
|
}
|
|
@@ -110,7 +110,9 @@ var RenderField = function RenderField(_ref) {
|
|
|
110
110
|
var rowParams = [currentValue, rowData, options];
|
|
111
111
|
if (typeof isEditable === 'function') {
|
|
112
112
|
isEditable = isEditable.apply(void 0, rowParams);
|
|
113
|
-
|
|
113
|
+
setTimeout(function () {
|
|
114
|
+
!isEditable && form.validateFields([cellName]);
|
|
115
|
+
}, 100);
|
|
114
116
|
}
|
|
115
117
|
// 获取最终的disabled
|
|
116
118
|
_disabled = (0, _tools.getDisabled)({
|
|
@@ -376,10 +378,10 @@ var RenderField = function RenderField(_ref) {
|
|
|
376
378
|
return [].concat((0, _toConsumableArray2.default)(rowPath), [key]);
|
|
377
379
|
});
|
|
378
380
|
if (validateFieldKeys === null || validateFieldKeys === void 0 ? void 0 : validateFieldKeys.length) {
|
|
379
|
-
|
|
381
|
+
setTimeout(function () {
|
|
382
|
+
form.validateFields(validateFieldKeys);
|
|
383
|
+
}, 100);
|
|
380
384
|
}
|
|
381
|
-
} else {
|
|
382
|
-
debounceValidate();
|
|
383
385
|
}
|
|
384
386
|
setState({
|
|
385
387
|
forceUpdate: {
|
|
@@ -339,7 +339,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
339
339
|
onRow: function onRow() {
|
|
340
340
|
return {
|
|
341
341
|
disabled: disabled || virtualKey && !!editingKeys.length,
|
|
342
|
-
hide: isHideCheckBox,
|
|
342
|
+
'data-hide': isHideCheckBox,
|
|
343
343
|
onClick: function onClick() {}
|
|
344
344
|
};
|
|
345
345
|
}
|
|
@@ -6,8 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _ProConfigProvider = require("../../ProConfigProvider");
|
|
8
8
|
var _utils = require("../utils");
|
|
9
|
+
var _ref;
|
|
9
10
|
/* eslint-disable no-redeclare */
|
|
10
|
-
|
|
11
|
+
var baseEnumStorage = (_ref = window.localStorage.getItem('zat-design-pro-component-cacheKey') && JSON.parse(window.localStorage.getItem('zat-design-pro-component-cacheKey'))) !== null && _ref !== void 0 ? _ref : null;
|
|
11
12
|
/**
|
|
12
13
|
* 根据 code 从枚举缓存取出对应的 options 、以及回显
|
|
13
14
|
* @param codes
|
|
@@ -16,17 +17,17 @@ var _utils = require("../utils");
|
|
|
16
17
|
* @returns
|
|
17
18
|
*/
|
|
18
19
|
function useEnum(codes, value, compose) {
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
storage =
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
cacheKey =
|
|
25
|
-
|
|
26
|
-
fieldNames =
|
|
27
|
-
|
|
28
|
-
clear =
|
|
29
|
-
var catchData = (0, _utils.getEnumData)(storage, cacheKey);
|
|
20
|
+
var _ref2 = (0, _ProConfigProvider.useProConfig)('globalConfig') || {},
|
|
21
|
+
_ref2$storage = _ref2.storage,
|
|
22
|
+
storage = _ref2$storage === void 0 ? 'localStorage' : _ref2$storage;
|
|
23
|
+
var _ref3 = (0, _ProConfigProvider.useProConfig)('ProEnum') || {},
|
|
24
|
+
_ref3$cacheKey = _ref3.cacheKey,
|
|
25
|
+
cacheKey = _ref3$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref3$cacheKey,
|
|
26
|
+
_ref3$fieldNames = _ref3.fieldNames,
|
|
27
|
+
fieldNames = _ref3$fieldNames === void 0 ? {} : _ref3$fieldNames,
|
|
28
|
+
_ref3$clear = _ref3.clear,
|
|
29
|
+
clear = _ref3$clear === void 0 ? true : _ref3$clear;
|
|
30
|
+
var catchData = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage);
|
|
30
31
|
if (!codes) {
|
|
31
32
|
return catchData;
|
|
32
33
|
}
|
|
@@ -15,32 +15,34 @@ var _ahooks = require("ahooks");
|
|
|
15
15
|
var _utils = require("../utils");
|
|
16
16
|
var _locale = _interopRequireDefault(require("../../locale"));
|
|
17
17
|
require("../utils/eventCenter");
|
|
18
|
+
var _ref;
|
|
19
|
+
var baseEnumStorage = (_ref = window.localStorage.getItem('zat-design-pro-component-cacheKey') && JSON.parse(window.localStorage.getItem('zat-design-pro-component-cacheKey'))) !== null && _ref !== void 0 ? _ref : null;
|
|
18
20
|
var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
main =
|
|
22
|
-
|
|
23
|
-
share =
|
|
24
|
-
|
|
25
|
-
clear =
|
|
26
|
-
|
|
27
|
-
fieldNames =
|
|
21
|
+
var _ref2 = props || {},
|
|
22
|
+
_ref2$main = _ref2.main,
|
|
23
|
+
main = _ref2$main === void 0 ? false : _ref2$main,
|
|
24
|
+
_ref2$share = _ref2.share,
|
|
25
|
+
share = _ref2$share === void 0 ? false : _ref2$share,
|
|
26
|
+
_ref2$clear = _ref2.clear,
|
|
27
|
+
clear = _ref2$clear === void 0 ? true : _ref2$clear,
|
|
28
|
+
_ref2$fieldNames = _ref2.fieldNames,
|
|
29
|
+
fieldNames = _ref2$fieldNames === void 0 ? {
|
|
28
30
|
label: 'label',
|
|
29
31
|
value: 'value',
|
|
30
32
|
children: 'children'
|
|
31
|
-
} :
|
|
32
|
-
|
|
33
|
-
cacheKey =
|
|
34
|
-
|
|
35
|
-
requestRefresh =
|
|
36
|
-
|
|
37
|
-
storage =
|
|
38
|
-
|
|
39
|
-
dataSource =
|
|
40
|
-
useRequest =
|
|
41
|
-
transformResponse =
|
|
42
|
-
|
|
43
|
-
dics =
|
|
33
|
+
} : _ref2$fieldNames,
|
|
34
|
+
_ref2$cacheKey = _ref2.cacheKey,
|
|
35
|
+
cacheKey = _ref2$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref2$cacheKey,
|
|
36
|
+
_ref2$requestRefresh = _ref2.requestRefresh,
|
|
37
|
+
requestRefresh = _ref2$requestRefresh === void 0 ? false : _ref2$requestRefresh,
|
|
38
|
+
_ref2$storage = _ref2.storage,
|
|
39
|
+
storage = _ref2$storage === void 0 ? 'localStorage' : _ref2$storage,
|
|
40
|
+
_ref2$dataSource = _ref2.dataSource,
|
|
41
|
+
dataSource = _ref2$dataSource === void 0 ? {} : _ref2$dataSource,
|
|
42
|
+
useRequest = _ref2.useRequest,
|
|
43
|
+
transformResponse = _ref2.transformResponse,
|
|
44
|
+
_ref2$dics = _ref2.dics,
|
|
45
|
+
dics = _ref2$dics === void 0 ? {} : _ref2$dics;
|
|
44
46
|
if ((0, _typeof2.default)(dataSource) === 'object' && dataSource === null) {
|
|
45
47
|
var _locale$ProEnum;
|
|
46
48
|
throw new Error(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProEnum = _locale.default.ProEnum) === null || _locale$ProEnum === void 0 ? void 0 : _locale$ProEnum.errorDataSource);
|
|
@@ -107,7 +109,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
|
107
109
|
});
|
|
108
110
|
res.data = response;
|
|
109
111
|
}
|
|
110
|
-
cacheData = (0, _utils.getEnumData)(storage, cacheKey) || {
|
|
112
|
+
cacheData = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
|
|
111
113
|
data: {}
|
|
112
114
|
}; // 合并缓存数据
|
|
113
115
|
res.data = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, cacheData === null || cacheData === void 0 ? void 0 : cacheData.data), res.data);
|
|
@@ -137,7 +139,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
|
137
139
|
return setCache;
|
|
138
140
|
}(),
|
|
139
141
|
getCache: function getCache() {
|
|
140
|
-
var res = (0, _utils.getEnumData)(storage, cacheKey) || {
|
|
142
|
+
var res = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
|
|
141
143
|
data: {}
|
|
142
144
|
};
|
|
143
145
|
dispatch({
|
|
@@ -165,12 +167,12 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
|
165
167
|
})),
|
|
166
168
|
run = _useRequestFunc.run;
|
|
167
169
|
var mergeData = /*#__PURE__*/function () {
|
|
168
|
-
var
|
|
170
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
|
|
169
171
|
var cacheData, _useRequest$options2, _useRequest$options3, enumData, cacheCodes, codes, ignoreCodes, diff, response, res, _locale$ProEnum6;
|
|
170
172
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
171
173
|
while (1) switch (_context2.prev = _context2.next) {
|
|
172
174
|
case 0:
|
|
173
|
-
cacheData = (0, _utils.getEnumData)(storage, cacheKey) || {
|
|
175
|
+
cacheData = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
|
|
174
176
|
data: {}
|
|
175
177
|
};
|
|
176
178
|
if (!((0, _typeof2.default)(cacheData) === 'object')) {
|
|
@@ -252,13 +254,13 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
|
252
254
|
}, _callee2);
|
|
253
255
|
}));
|
|
254
256
|
return function mergeData() {
|
|
255
|
-
return
|
|
257
|
+
return _ref3.apply(this, arguments);
|
|
256
258
|
};
|
|
257
259
|
}();
|
|
258
260
|
(0, _ahooks.useDeepCompareEffect)(function () {
|
|
259
261
|
if (useRequest && (useRequest === null || useRequest === void 0 ? void 0 : useRequest.service)) {
|
|
260
|
-
var
|
|
261
|
-
defaultParams =
|
|
262
|
+
var _ref4 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
|
|
263
|
+
defaultParams = _ref4.defaultParams;
|
|
262
264
|
if (requestRefresh) {
|
|
263
265
|
window.localStorage.removeItem(cacheKey);
|
|
264
266
|
window.sessionStorage.removeItem(cacheKey);
|
|
@@ -267,7 +269,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
|
267
269
|
// TODO 这段代码目前看起来是没啥用的、没起到作用
|
|
268
270
|
mergeData();
|
|
269
271
|
} else if (Object.keys(dataSource)) {
|
|
270
|
-
var res = (0, _utils.getEnumData)(storage, cacheKey) || {
|
|
272
|
+
var res = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
|
|
271
273
|
data: {}
|
|
272
274
|
};
|
|
273
275
|
dispatch({
|
|
@@ -275,7 +277,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
|
275
277
|
payload: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, dataSource), res === null || res === void 0 ? void 0 : res.data)
|
|
276
278
|
});
|
|
277
279
|
} else {
|
|
278
|
-
var _res = (0, _utils.getEnumData)(storage, cacheKey) || {
|
|
280
|
+
var _res = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
|
|
279
281
|
data: {}
|
|
280
282
|
};
|
|
281
283
|
dispatch({
|
|
@@ -286,7 +288,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
|
286
288
|
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
|
|
287
289
|
var shareProEnumDic = function shareProEnumDic(cacheData) {
|
|
288
290
|
logDebug(cacheData);
|
|
289
|
-
var storageData = (0, _utils.getEnumData)(storage, cacheKey) || {
|
|
291
|
+
var storageData = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
|
|
290
292
|
data: {}
|
|
291
293
|
};
|
|
292
294
|
dispatch({
|
package/lib/ProEnum/index.js
CHANGED
|
@@ -167,7 +167,7 @@ var ProEnum = function ProEnum(props) {
|
|
|
167
167
|
}
|
|
168
168
|
switch (type) {
|
|
169
169
|
case 'ProSelect':
|
|
170
|
-
return (0, _jsxRuntime.jsx)(_ProSelect.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, enumProps), {}, {
|
|
170
|
+
return (0, _jsxRuntime.jsx)(_ProSelect.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(enumProps, ['showCodeName'])), {}, {
|
|
171
171
|
otherProps: otherProps,
|
|
172
172
|
dataSource: list,
|
|
173
173
|
fieldNames: {
|
|
@@ -178,7 +178,7 @@ var ProEnum = function ProEnum(props) {
|
|
|
178
178
|
onChange: onChange
|
|
179
179
|
}));
|
|
180
180
|
case 'Radio':
|
|
181
|
-
return (0, _jsxRuntime.jsx)(_antd.Radio.Group, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(enumProps, ['fieldNames'])), {}, {
|
|
181
|
+
return (0, _jsxRuntime.jsx)(_antd.Radio.Group, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(enumProps, ['fieldNames', 'showCodeName'])), {}, {
|
|
182
182
|
options: list,
|
|
183
183
|
value: value,
|
|
184
184
|
onChange: onChange,
|
|
@@ -191,7 +191,7 @@ var ProEnum = function ProEnum(props) {
|
|
|
191
191
|
})
|
|
192
192
|
}));
|
|
193
193
|
case 'Checkbox':
|
|
194
|
-
return (0, _jsxRuntime.jsx)(_antd.Checkbox.Group, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(enumProps, ['fieldNames'])), {}, {
|
|
194
|
+
return (0, _jsxRuntime.jsx)(_antd.Checkbox.Group, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(enumProps, ['fieldNames', 'showCodeName'])), {}, {
|
|
195
195
|
options: list,
|
|
196
196
|
value: value,
|
|
197
197
|
onChange: onChange,
|
|
@@ -212,7 +212,7 @@ var ProEnum = function ProEnum(props) {
|
|
|
212
212
|
dataSource: list
|
|
213
213
|
});
|
|
214
214
|
case 'Group':
|
|
215
|
-
return (0, _jsxRuntime.jsx)(_Group.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, enumProps), {}, {
|
|
215
|
+
return (0, _jsxRuntime.jsx)(_Group.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(enumProps, ['showCodeName'])), {}, {
|
|
216
216
|
value: value,
|
|
217
217
|
onChange: onChange,
|
|
218
218
|
fieldLabel: label,
|
|
@@ -4,7 +4,7 @@ interface EnumRes {
|
|
|
4
4
|
data: Record<string, DataOption[]>;
|
|
5
5
|
[key: string]: any;
|
|
6
6
|
}
|
|
7
|
-
export declare function getEnumData(storage: StorageType, cacheKey: string): EnumRes;
|
|
7
|
+
export declare function getEnumData(storage: StorageType, cacheKey: string, baseEnumStorage?: any): EnumRes;
|
|
8
8
|
export declare function setEnumData(storage: StorageType, cacheKey: string, data: Object): void;
|
|
9
9
|
export declare function hasEnumList(storage: StorageType, cacheKey: any, code: string): DataOption[];
|
|
10
10
|
export declare function isObject(obj: any): boolean;
|
|
@@ -14,7 +14,10 @@ exports.setEnumData = setEnumData;
|
|
|
14
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
15
|
var _lodash = require("lodash");
|
|
16
16
|
var _excluded = ["children"];
|
|
17
|
-
function getEnumData(storage, cacheKey) {
|
|
17
|
+
function getEnumData(storage, cacheKey, baseEnumStorage) {
|
|
18
|
+
if (baseEnumStorage) {
|
|
19
|
+
return baseEnumStorage;
|
|
20
|
+
}
|
|
18
21
|
if (storage === 'localStorage') {
|
|
19
22
|
return JSON.parse(window.localStorage.getItem(cacheKey) || '{}');
|
|
20
23
|
}
|
|
@@ -15,7 +15,7 @@ var _ConfirmWrapper = _interopRequireDefault(require("../../../../components/ren
|
|
|
15
15
|
var _useFieldProps = require("../../../../utils/useFieldProps");
|
|
16
16
|
var componentMap = _interopRequireWildcard(require("../../../../../index"));
|
|
17
17
|
var _AddonWrapper = _interopRequireDefault(require("./AddonWrapper"));
|
|
18
|
-
var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps", "before", "after"];
|
|
18
|
+
var _excluded = ["type", "confirm", "component", "fieldProps", "contextProps", "before", "after", "getValueProps", "valuePropName"];
|
|
19
19
|
// 这里的key与组件内参数一致, 决定使用哪个包裹组件
|
|
20
20
|
var wrapperMap = {
|
|
21
21
|
confirm: _ConfirmWrapper.default,
|
|
@@ -45,9 +45,16 @@ var ComRender = function ComRender(props) {
|
|
|
45
45
|
contextProps = props.contextProps,
|
|
46
46
|
before = props.before,
|
|
47
47
|
after = props.after,
|
|
48
|
+
getValueProps = props.getValueProps,
|
|
49
|
+
_props$valuePropName = props.valuePropName,
|
|
50
|
+
valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
|
|
48
51
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
49
52
|
var TypeComponent = componentMap[type];
|
|
50
|
-
var
|
|
53
|
+
var mergedGetValueProps = getValueProps || function (val) {
|
|
54
|
+
return (0, _defineProperty2.default)({}, valuePropName, val);
|
|
55
|
+
};
|
|
56
|
+
var _props = mergedGetValueProps(props.value);
|
|
57
|
+
var componentProps = (0, _objectSpread3.default)((0, _objectSpread3.default)((0, _objectSpread3.default)({}, fieldProps), rest), _props);
|
|
51
58
|
var Component = component ? ( /*#__PURE__*/_react.default.cloneElement(component, (0, _objectSpread3.default)({}, componentProps))) : (0, _jsxRuntime.jsx)(TypeComponent, (0, _objectSpread3.default)({}, componentProps));
|
|
52
59
|
var Com = getComRender(Component, props, componentProps);
|
|
53
60
|
return (0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
|
|
@@ -45,4 +45,6 @@ export type GroupColumnProps<Values = any> = {
|
|
|
45
45
|
toISOString?: boolean;
|
|
46
46
|
clearNotShow?: boolean;
|
|
47
47
|
confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps>;
|
|
48
|
+
valuePropName?: string;
|
|
49
|
+
getValueProps?: (value: any) => Record<string, unknown>;
|
|
48
50
|
} & ColumnPropsMap & FormItemProps;
|
|
@@ -239,7 +239,7 @@ var useTransformColumns = exports.useTransformColumns = function useTransformCol
|
|
|
239
239
|
if ((transform === null || transform === void 0 ? void 0 : transform.normalize) || normalize) {
|
|
240
240
|
var _transform$normalize;
|
|
241
241
|
// @ts-ignore
|
|
242
|
-
newValue = ((_transform$normalize = transform.normalize) === null || _transform$normalize === void 0 ? void 0 : _transform$normalize.call(transform, newValue)) || (normalize === null || normalize === void 0 ? void 0 : normalize(newValue));
|
|
242
|
+
newValue = (transform === null || transform === void 0 ? void 0 : (_transform$normalize = transform.normalize) === null || _transform$normalize === void 0 ? void 0 : _transform$normalize.call(transform, newValue)) || (normalize === null || normalize === void 0 ? void 0 : normalize(newValue));
|
|
243
243
|
}
|
|
244
244
|
internalChange === null || internalChange === void 0 ? void 0 : internalChange(newValue, args[1], index);
|
|
245
245
|
var values = form.getFieldValue(namePath);
|
|
@@ -49,12 +49,12 @@ var getViewLabel = function getViewLabel(_ref) {
|
|
|
49
49
|
return viewLabel;
|
|
50
50
|
};
|
|
51
51
|
var ProCascader = function ProCascader(props) {
|
|
52
|
-
var _value$slice, _ref7, _ref7$filter, _defaultLabel$filter, _locale$ProAddressBar, _locale$ProAddressBar2;
|
|
52
|
+
var _props$otherProps, _value$slice, _ref7, _ref7$filter, _defaultLabel$filter, _locale$ProAddressBar, _locale$ProAddressBar2;
|
|
53
53
|
var _ref2 = (0, _ProConfigProvider.useProConfig)('ProAddressBar') || {},
|
|
54
54
|
configDetailMaxLength = _ref2.detailMaxLength,
|
|
55
55
|
configEnumCode = _ref2.enumCode,
|
|
56
56
|
configCode = _ref2.code;
|
|
57
|
-
var isAddressMode = (props === null || props === void 0 ? void 0 : props.mode) === 'address';
|
|
57
|
+
var isAddressMode = (props === null || props === void 0 ? void 0 : props.mode) === 'address' || (props === null || props === void 0 ? void 0 : (_props$otherProps = props.otherProps) === null || _props$otherProps === void 0 ? void 0 : _props$otherProps.type) === 'ProAddressBar';
|
|
58
58
|
var _props$className = props.className,
|
|
59
59
|
className = _props$className === void 0 ? '' : _props$className,
|
|
60
60
|
_props$hasDetail = props.hasDetail,
|
|
@@ -12,6 +12,7 @@ export { default as TimePicker } from './base/TimePicker';
|
|
|
12
12
|
export { default as FormList } from './combination/FormList';
|
|
13
13
|
export { default as ProEditTable } from '../../ProEditTable';
|
|
14
14
|
export { default as ProCascader } from './combination/ProCascader';
|
|
15
|
+
export { default as ProAddressBar } from './combination/ProCascader';
|
|
15
16
|
export { default as ProCombination } from './combination/ProCombination';
|
|
16
17
|
export { default as ProNumberRange } from './combination/ProNumberRange';
|
|
17
18
|
export { default as ProModalSelect } from './combination/ProModalSelect';
|
|
@@ -71,6 +71,12 @@ Object.defineProperty(exports, "ProAddress", {
|
|
|
71
71
|
return _ProAddress.default;
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
|
+
Object.defineProperty(exports, "ProAddressBar", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function get() {
|
|
77
|
+
return _ProCascader.default;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
74
80
|
Object.defineProperty(exports, "ProCascader", {
|
|
75
81
|
enumerable: true,
|
|
76
82
|
get: function get() {
|