@zat-design/sisyphus-react 3.4.10 → 3.4.11-beta.2
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 +64 -50
- package/dist/less.esm.css +64 -50
- package/es/ProEditTable/components/DndWrapper/index.d.ts +1 -0
- package/es/ProEditTable/components/DndWrapper/index.js +4 -3
- package/es/ProEditTable/components/RenderField/index.js +6 -10
- package/es/ProEditTable/index.js +49 -56
- package/es/ProEditTable/propsType.d.ts +5 -0
- package/es/ProEditTable/style/index.less +10 -0
- package/es/ProForm/components/base/DatePicker/useDateLimit.d.ts +9 -0
- package/es/ProForm/components/base/DatePicker/useDateLimit.js +15 -0
- package/es/ProForm/components/base/InputNumber/index.js +42 -28
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +35 -29
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +28 -20
- package/es/ProForm/components/combination/FormList/propsType.d.ts +4 -4
- package/es/ProForm/components/combination/Group/component/ComRender.d.ts +3 -0
- package/es/ProForm/components/combination/Group/index.js +2 -2
- package/es/ProForm/components/combination/Group/style/index.less +1 -1
- package/es/ProForm/components/combination/Group/utils.d.ts +1 -1
- package/es/ProForm/components/combination/Group/utils.js +40 -5
- package/es/ProForm/components/combination/ProCascader/utils/index.js +5 -3
- package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +1 -1
- package/es/ProForm/components/combination/ProRangeLimit/index.js +4 -3
- package/es/ProForm/index.js +3 -2
- package/es/ProForm/utils/useDeepCompareMemo.d.ts +1 -1
- package/es/ProForm/utils/useDeepCompareMemo.js +2 -1
- package/es/ProForm/utils/useForm.js +11 -2
- package/es/ProForm/utils/useShouldUpdate.js +8 -2
- package/es/ProIcon/index.d.ts +1 -0
- package/es/ProIcon/index.js +2 -3
- package/es/ProIcon/symbolIcon.js +43 -0
- package/es/ProTree/components/ProTree.js +18 -10
- package/es/ProTree/components/ProTreeSelect/index.js +2 -2
- package/es/ProTree/components/Tree.js +11 -6
- package/es/ProTree/index.js +2 -1
- package/es/ProUpload/components/ButtonRender.d.ts +1 -0
- package/es/ProUpload/components/ButtonRender.js +3 -1
- package/es/ProUpload/components/FileItem.d.ts +1 -0
- package/es/ProUpload/components/FileItem.js +21 -3
- package/es/ProUpload/index.js +4 -2
- package/es/ProUpload/propsType.d.ts +5 -0
- package/es/ProUpload/style/index.less +101 -111
- package/lib/ProEditTable/components/DndWrapper/index.d.ts +1 -0
- package/lib/ProEditTable/components/DndWrapper/index.js +4 -3
- package/lib/ProEditTable/components/RenderField/index.js +6 -10
- package/lib/ProEditTable/index.js +48 -55
- package/lib/ProEditTable/propsType.d.ts +5 -0
- package/lib/ProEditTable/style/index.less +10 -0
- package/lib/ProForm/components/base/DatePicker/useDateLimit.d.ts +9 -0
- package/lib/ProForm/components/base/DatePicker/useDateLimit.js +22 -0
- package/lib/ProForm/components/base/InputNumber/index.js +41 -27
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +35 -29
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +28 -20
- package/lib/ProForm/components/combination/FormList/propsType.d.ts +4 -4
- package/lib/ProForm/components/combination/Group/component/ComRender.d.ts +3 -0
- package/lib/ProForm/components/combination/Group/index.js +1 -1
- package/lib/ProForm/components/combination/Group/style/index.less +1 -1
- package/lib/ProForm/components/combination/Group/utils.d.ts +1 -1
- package/lib/ProForm/components/combination/Group/utils.js +40 -5
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +5 -3
- package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +1 -1
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +4 -3
- package/lib/ProForm/index.js +3 -2
- package/lib/ProForm/utils/useDeepCompareMemo.d.ts +1 -1
- package/lib/ProForm/utils/useDeepCompareMemo.js +2 -1
- package/lib/ProForm/utils/useForm.js +11 -2
- package/lib/ProForm/utils/useShouldUpdate.js +8 -2
- package/lib/ProIcon/index.d.ts +1 -0
- package/lib/ProIcon/index.js +1 -2
- package/lib/ProIcon/symbolIcon.js +45 -0
- package/lib/ProTree/components/ProTree.js +17 -9
- package/lib/ProTree/components/ProTreeSelect/index.js +2 -2
- package/lib/ProTree/components/Tree.js +11 -6
- package/lib/ProTree/index.js +2 -1
- package/lib/ProUpload/components/ButtonRender.d.ts +1 -0
- package/lib/ProUpload/components/ButtonRender.js +3 -1
- package/lib/ProUpload/components/FileItem.d.ts +1 -0
- package/lib/ProUpload/components/FileItem.js +19 -3
- package/lib/ProUpload/index.js +4 -2
- package/lib/ProUpload/propsType.d.ts +5 -0
- package/lib/ProUpload/style/index.less +101 -111
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import "antd/es/button/style";
|
|
3
2
|
import _Button from "antd/es/button";
|
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
@@ -7,7 +6,8 @@ import _Space from "antd/es/space";
|
|
|
7
6
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
8
7
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
9
8
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
10
|
-
|
|
9
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
10
|
+
var _excluded = ["label", "onClick", "onHandle", "type"],
|
|
11
11
|
_excluded2 = ["onClick", "label"];
|
|
12
12
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
13
|
import { PlusOutlined } from '@ant-design/icons';
|
|
@@ -23,12 +23,11 @@ var actions = {
|
|
|
23
23
|
operation.add();
|
|
24
24
|
},
|
|
25
25
|
label: "".concat(locale.ProForm.formListActions[5]),
|
|
26
|
-
type: 'link',
|
|
27
26
|
icon: _jsx(PlusOutlined, {})
|
|
28
27
|
}
|
|
29
28
|
};
|
|
30
29
|
var defaultActionProps = [{
|
|
31
|
-
|
|
30
|
+
type: 'add'
|
|
32
31
|
}];
|
|
33
32
|
var ToolbarButton = function ToolbarButton(props) {
|
|
34
33
|
var namePath = props.namePath,
|
|
@@ -43,12 +42,19 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
|
43
42
|
// 默认显示一个delete
|
|
44
43
|
var toolbarProps = useMemo(function () {
|
|
45
44
|
var _props$toolbarProps;
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
// 兼容 actionType 和 type
|
|
46
|
+
var _toolbarProps = (_props$toolbarProps = props.toolbarProps) === null || _props$toolbarProps === void 0 ? void 0 : _props$toolbarProps.map(function (item) {
|
|
47
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
type: item.actionType
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
if (!(_toolbarProps === null || _toolbarProps === void 0 ? void 0 : _toolbarProps.find(function (item) {
|
|
53
|
+
return item.type === 'add';
|
|
48
54
|
}))) {
|
|
49
|
-
return
|
|
55
|
+
return _toolbarProps ? [].concat(_toConsumableArray(_toolbarProps), defaultActionProps) : defaultActionProps;
|
|
50
56
|
}
|
|
51
|
-
return
|
|
57
|
+
return _toolbarProps;
|
|
52
58
|
}, [props.toolbarProps]);
|
|
53
59
|
var handleClick = /*#__PURE__*/function () {
|
|
54
60
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(defaultCallback, callback, item) {
|
|
@@ -76,7 +82,7 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
|
76
82
|
});
|
|
77
83
|
return _context.abrupt("return");
|
|
78
84
|
case 7:
|
|
79
|
-
if ((item === null || item === void 0 ? void 0 : item.
|
|
85
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === 'add' && data) {
|
|
80
86
|
operation.add(data);
|
|
81
87
|
}
|
|
82
88
|
case 8:
|
|
@@ -100,7 +106,7 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
|
100
106
|
return _jsx(_Space, {
|
|
101
107
|
align: "start",
|
|
102
108
|
className: "pro-form-list-toolbar",
|
|
103
|
-
children: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.map(function (item) {
|
|
109
|
+
children: toolbarProps === null || toolbarProps === void 0 ? void 0 : toolbarProps.map(function (item, index) {
|
|
104
110
|
if (item.show === false) return _jsx(_Fragment, {});
|
|
105
111
|
if (isFunction(item.show) && !item.show(form.getFieldValue(namePath), {
|
|
106
112
|
namePath: namePath,
|
|
@@ -111,32 +117,34 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
|
111
117
|
var label = item.label,
|
|
112
118
|
_onClick2 = item.onClick,
|
|
113
119
|
onHandle = item.onHandle,
|
|
114
|
-
|
|
120
|
+
type = item.type,
|
|
115
121
|
rest = _objectWithoutProperties(item, _excluded);
|
|
116
122
|
var _onClick = _onClick2 || onHandle;
|
|
117
|
-
if (
|
|
123
|
+
if (type === 'add') {
|
|
118
124
|
if (disabled || isView) return _jsx(_Fragment, {});
|
|
119
|
-
var _actions$
|
|
120
|
-
internalOnClick = _actions$
|
|
121
|
-
defaultLabel = _actions$
|
|
122
|
-
defaultRest = _objectWithoutProperties(_actions$
|
|
125
|
+
var _actions$type = actions[type],
|
|
126
|
+
internalOnClick = _actions$type.onClick,
|
|
127
|
+
defaultLabel = _actions$type.label,
|
|
128
|
+
defaultRest = _objectWithoutProperties(_actions$type, _excluded2);
|
|
123
129
|
// 大于等于max不可新增
|
|
124
|
-
if (max && max <= fields.length &&
|
|
130
|
+
if (max && max <= fields.length && type === 'add') {
|
|
125
131
|
return false;
|
|
126
132
|
}
|
|
127
|
-
return _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({}, actions[
|
|
133
|
+
return _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({}, actions[type]), rest), {}, {
|
|
134
|
+
type: "link",
|
|
128
135
|
onClick: function onClick() {
|
|
129
136
|
return handleClick(internalOnClick, _onClick, item);
|
|
130
137
|
},
|
|
131
138
|
children: label || defaultLabel
|
|
132
|
-
}),
|
|
139
|
+
}), "".concat(type).concat(index));
|
|
133
140
|
}
|
|
134
141
|
return _jsx(_Button, _objectSpread(_objectSpread({}, rest), {}, {
|
|
142
|
+
type: "link",
|
|
135
143
|
onClick: function onClick() {
|
|
136
144
|
return customClick(_onClick2, item);
|
|
137
145
|
},
|
|
138
146
|
children: label
|
|
139
|
-
}),
|
|
147
|
+
}), "".concat(type).concat(index));
|
|
140
148
|
})
|
|
141
149
|
});
|
|
142
150
|
};
|
|
@@ -14,8 +14,8 @@ export interface Option {
|
|
|
14
14
|
form: FormInstance;
|
|
15
15
|
operation: FormListOperation;
|
|
16
16
|
}
|
|
17
|
-
export interface ActionProps extends Omit<ButtonProps, 'onClick'> {
|
|
18
|
-
|
|
17
|
+
export interface ActionProps extends Omit<ButtonProps, 'onClick' | 'type'> {
|
|
18
|
+
type?: 'add' | 'delete' | 'copy' | 'moveUp' | 'moveDown';
|
|
19
19
|
onHandle?: Callback;
|
|
20
20
|
onClick?: Callback;
|
|
21
21
|
label?: string;
|
|
@@ -24,8 +24,8 @@ export interface ActionProps extends Omit<ButtonProps, 'onClick'> {
|
|
|
24
24
|
title?: string;
|
|
25
25
|
show?: boolean | ((record: any, option: Pick<Option, 'index' | 'form' | 'namePath'>) => boolean);
|
|
26
26
|
}
|
|
27
|
-
export interface ToolbarActionProps extends Omit<ActionProps, 'actionType' | 'onHandle' | 'onClick' | 'show'> {
|
|
28
|
-
|
|
27
|
+
export interface ToolbarActionProps extends Omit<ActionProps, 'actionType' | 'onHandle' | 'onClick' | 'show' | 'type'> {
|
|
28
|
+
type?: 'add';
|
|
29
29
|
onHandle?: ToolbarCallback;
|
|
30
30
|
onClick?: ToolbarCallback;
|
|
31
31
|
show?: boolean | ((record: any, option: Pick<Option, 'form' | 'namePath'>) => boolean);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { NamePath } from 'antd/lib/form/interface';
|
|
2
3
|
interface Props {
|
|
3
4
|
type: string;
|
|
4
5
|
component: React.ReactElement;
|
|
@@ -10,6 +11,8 @@ interface Props {
|
|
|
10
11
|
contextProps: any;
|
|
11
12
|
before?: React.ReactNode;
|
|
12
13
|
after?: React.ReactNode;
|
|
14
|
+
name?: NamePath;
|
|
15
|
+
valueType: string;
|
|
13
16
|
}
|
|
14
17
|
/** 渲染组件 */
|
|
15
18
|
declare const ComRender: React.FC<Props>;
|
|
@@ -7,7 +7,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { omit } from 'lodash';
|
|
9
9
|
import classnames from 'classnames';
|
|
10
|
-
import { insertSeparator,
|
|
10
|
+
import { insertSeparator, useTransformColumns } from './utils';
|
|
11
11
|
import ProForm from '../../../../ProForm';
|
|
12
12
|
import ComRender from './component/ComRender';
|
|
13
13
|
/**
|
|
@@ -41,7 +41,7 @@ var Group = function Group(props) {
|
|
|
41
41
|
_option.current[index] = option;
|
|
42
42
|
onChange(_value, _option.current);
|
|
43
43
|
};
|
|
44
|
-
var columnsProps =
|
|
44
|
+
var columnsProps = useTransformColumns({
|
|
45
45
|
columns: children,
|
|
46
46
|
name: name,
|
|
47
47
|
names: names,
|
|
@@ -59,5 +59,5 @@ interface ColumnsTransformerParams {
|
|
|
59
59
|
groupProps: GroupProps;
|
|
60
60
|
}
|
|
61
61
|
/** 转换columns */
|
|
62
|
-
export declare const
|
|
62
|
+
export declare const useTransformColumns: (params: ColumnsTransformerParams) => any[];
|
|
63
63
|
export {};
|
|
@@ -4,9 +4,11 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
|
4
4
|
import "antd/es/button/style";
|
|
5
5
|
import _Button from "antd/es/button";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
7
|
+
import { useRef } from 'react';
|
|
8
|
+
import { cloneDeep, isEqual, isFunction } from 'lodash';
|
|
8
9
|
import valueTypeMap from '../../../utils/valueType';
|
|
9
10
|
import { useDeepCompareMemo } from '../../../utils/useDeepCompareMemo';
|
|
11
|
+
import { difference } from '../../../../ProEditTable/utils/tools';
|
|
10
12
|
/**
|
|
11
13
|
* 插入间隔符
|
|
12
14
|
* @param columns 表单配置数组
|
|
@@ -153,7 +155,7 @@ var valueFromEventWrapper = function valueFromEventWrapper(column, args) {
|
|
|
153
155
|
return getValueMiddleware(newValue, list);
|
|
154
156
|
};
|
|
155
157
|
/** 转换columns */
|
|
156
|
-
export var
|
|
158
|
+
export var useTransformColumns = function useTransformColumns(params) {
|
|
157
159
|
var form = params.form,
|
|
158
160
|
columns = params.columns,
|
|
159
161
|
name = params.name,
|
|
@@ -163,6 +165,7 @@ export var transformColumns = function transformColumns(params) {
|
|
|
163
165
|
value = params.value,
|
|
164
166
|
internalChange = params.onChange,
|
|
165
167
|
groupProps = params.groupProps;
|
|
168
|
+
var timerRef = useRef([]);
|
|
166
169
|
return columns === null || columns === void 0 ? void 0 : columns.flatMap(function (column, index) {
|
|
167
170
|
var type = column.type,
|
|
168
171
|
valueType = column.valueType,
|
|
@@ -172,7 +175,8 @@ export var transformColumns = function transformColumns(params) {
|
|
|
172
175
|
normalize = column.normalize,
|
|
173
176
|
disabled = column.disabled,
|
|
174
177
|
show = column.show,
|
|
175
|
-
component = column.component
|
|
178
|
+
component = column.component,
|
|
179
|
+
clearNotShow = column.clearNotShow;
|
|
176
180
|
var _ref = fieldProps || {},
|
|
177
181
|
mode = _ref.mode,
|
|
178
182
|
onChange = _ref.onChange,
|
|
@@ -180,7 +184,22 @@ export var transformColumns = function transformColumns(params) {
|
|
|
180
184
|
comDisabled = _ref.disabled;
|
|
181
185
|
var _disabled = disabled || comDisabled;
|
|
182
186
|
var columnName = names ? names[index] : [].concat(name, index);
|
|
187
|
+
// 响应式字段改变后的回调
|
|
188
|
+
var changedCallback = function changedCallback(lastDependency, current) {
|
|
189
|
+
// 清值防抖 多次刷新时以最后一次为准
|
|
190
|
+
if (clearNotShow !== false && names) {
|
|
191
|
+
if ((current === null || current === void 0 ? void 0 : current.show) === false) {
|
|
192
|
+
clearInterval(timerRef.current[index]);
|
|
193
|
+
timerRef.current[index] = setTimeout(function () {
|
|
194
|
+
form.resetFields([columnName]);
|
|
195
|
+
}, 200);
|
|
196
|
+
} else {
|
|
197
|
+
clearInterval(timerRef.current[index]);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
};
|
|
183
201
|
// 响应式字段
|
|
202
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
184
203
|
var reactiveProps = useDeepCompareMemo(function () {
|
|
185
204
|
return getReactiveProps({
|
|
186
205
|
form: form,
|
|
@@ -193,7 +212,7 @@ export var transformColumns = function transformColumns(params) {
|
|
|
193
212
|
fieldProps: fieldProps,
|
|
194
213
|
name: columnName
|
|
195
214
|
});
|
|
196
|
-
}, [value, show, fieldProps, _disabled, columnName, type]);
|
|
215
|
+
}, changedCallback, [value, show, fieldProps, _disabled, columnName, type]);
|
|
197
216
|
if (reactiveProps.show === false) {
|
|
198
217
|
return [];
|
|
199
218
|
}
|
|
@@ -216,13 +235,29 @@ export var transformColumns = function transformColumns(params) {
|
|
|
216
235
|
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));
|
|
217
236
|
}
|
|
218
237
|
internalChange === null || internalChange === void 0 ? void 0 : internalChange(newValue, args[1], index);
|
|
238
|
+
var values = form.getFieldValue(namePath);
|
|
239
|
+
var originRow = (namePath === null || namePath === void 0 ? void 0 : namePath.length) ? cloneDeep(values) : undefined;
|
|
219
240
|
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, args);
|
|
220
|
-
onFieldChange === null || onFieldChange === void 0 ? void 0 : onFieldChange(newValue,
|
|
241
|
+
onFieldChange === null || onFieldChange === void 0 ? void 0 : onFieldChange(newValue, values, {
|
|
221
242
|
index: outerIndex,
|
|
222
243
|
namePath: namePath,
|
|
223
244
|
form: form,
|
|
224
245
|
option: args === null || args === void 0 ? void 0 : args[1]
|
|
225
246
|
});
|
|
247
|
+
// 如果是在可编辑表格或formList内部, 储存当前行的值, 并在变更后更新到表单里
|
|
248
|
+
if ((namePath === null || namePath === void 0 ? void 0 : namePath.length) && !isEqual(originRow, values)) {
|
|
249
|
+
var _Object$keys, _Object$keys$map;
|
|
250
|
+
form.setFieldValue(namePath, values);
|
|
251
|
+
var diff = difference(originRow, values) || {};
|
|
252
|
+
var validateFieldKeys = (_Object$keys = Object.keys(diff)) === null || _Object$keys === void 0 ? void 0 : (_Object$keys$map = _Object$keys.map) === null || _Object$keys$map === void 0 ? void 0 : _Object$keys$map.call(_Object$keys, function (key) {
|
|
253
|
+
return [].concat(_toConsumableArray(namePath), [key]);
|
|
254
|
+
});
|
|
255
|
+
if (validateFieldKeys === null || validateFieldKeys === void 0 ? void 0 : validateFieldKeys.length) {
|
|
256
|
+
setTimeout(function () {
|
|
257
|
+
form.validateFields([name].concat(_toConsumableArray(validateFieldKeys)));
|
|
258
|
+
}, 100);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
226
261
|
};
|
|
227
262
|
return _objectSpread(_objectSpread(_objectSpread({}, column), {}, {
|
|
228
263
|
name: columnName
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
1
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
3
|
var _excluded = ["label", "value", "children"];
|
|
4
|
+
import { omit } from 'lodash';
|
|
3
5
|
export var transformDataName = function transformDataName(dataSource, fieldNames) {
|
|
4
6
|
var label = fieldNames.label,
|
|
5
7
|
value = fieldNames.value,
|
|
@@ -20,10 +22,10 @@ export var transformDataName = function transformDataName(dataSource, fieldNames
|
|
|
20
22
|
if (children && Array.isArray(node[children])) {
|
|
21
23
|
newNode.children = node[children].map(transformNode);
|
|
22
24
|
}
|
|
23
|
-
return newNode;
|
|
25
|
+
return _objectSpread(_objectSpread({}, newNode), omit(node, Object.values(fieldNames)));
|
|
24
26
|
}
|
|
25
|
-
function transformData(data) {
|
|
27
|
+
var transformData = function transformData(data) {
|
|
26
28
|
return data.map(transformNode);
|
|
27
|
-
}
|
|
29
|
+
};
|
|
28
30
|
return transformData(dataSource);
|
|
29
31
|
};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { RangePickerProps } from 'antd/es/date-picker';
|
|
3
3
|
import { Moment } from 'moment';
|
|
4
4
|
export type Props = Omit<RangePickerProps, 'value' | 'onChange' | 'format' | 'separator' | 'mode'> & {
|
|
5
|
-
disabled?: boolean;
|
|
5
|
+
disabled?: boolean | [boolean, boolean];
|
|
6
6
|
foreverText?: string;
|
|
7
7
|
foreverDate?: string;
|
|
8
8
|
otherProps?: any;
|
|
@@ -72,9 +72,10 @@ var ProRangeLimit = function ProRangeLimit(props) {
|
|
|
72
72
|
startDate = _ref3[0],
|
|
73
73
|
endDate = _ref3[1];
|
|
74
74
|
var initialConfig = useProConfig('ProTimeLimit');
|
|
75
|
+
var _disabled = typeof disabled === 'boolean' ? [disabled, disabled] : disabled;
|
|
75
76
|
var className = classNames({
|
|
76
77
|
'ant-input': true,
|
|
77
|
-
'ant-input-disabled':
|
|
78
|
+
'ant-input-disabled': _disabled === null || _disabled === void 0 ? void 0 : _disabled[1],
|
|
78
79
|
'forever-checkbox': true
|
|
79
80
|
});
|
|
80
81
|
var _isForever = useMemo(function () {
|
|
@@ -139,7 +140,7 @@ var ProRangeLimit = function ProRangeLimit(props) {
|
|
|
139
140
|
className: "pro-range-limit",
|
|
140
141
|
children: [_jsx(RangePicker, _objectSpread(_objectSpread(_objectSpread({
|
|
141
142
|
allowClear: true,
|
|
142
|
-
disabled: [
|
|
143
|
+
disabled: [_disabled === null || _disabled === void 0 ? void 0 : _disabled[0], (_disabled === null || _disabled === void 0 ? void 0 : _disabled[1]) || _isForever],
|
|
143
144
|
defaultPickerValue: defaultPickerValue
|
|
144
145
|
}, initialConfig), omit(rest, ['placeholder', 'separator'])), {}, {
|
|
145
146
|
format: format,
|
|
@@ -149,7 +150,7 @@ var ProRangeLimit = function ProRangeLimit(props) {
|
|
|
149
150
|
className: className,
|
|
150
151
|
children: _jsx(_Checkbox, {
|
|
151
152
|
checked: _isForever,
|
|
152
|
-
disabled:
|
|
153
|
+
disabled: _disabled === null || _disabled === void 0 ? void 0 : _disabled[1],
|
|
153
154
|
onChange: handleForeverChange,
|
|
154
155
|
children: foreverText
|
|
155
156
|
})
|
package/es/ProForm/index.js
CHANGED
|
@@ -159,10 +159,11 @@ var ProForm = function ProForm(props, ref) {
|
|
|
159
159
|
});
|
|
160
160
|
// 解决平铺后的值拿不到的问题
|
|
161
161
|
var handleValuesChange = function handleValuesChange(changedValue) {
|
|
162
|
+
if (!onValuesChange) return;
|
|
162
163
|
// 暂时通过'-'区分组合组件字段和普通字段
|
|
163
164
|
var keys = Object.keys(changedValue);
|
|
164
165
|
if (!keys.length) {
|
|
165
|
-
onValuesChange
|
|
166
|
+
onValuesChange(changedValue, form.getFieldsValue());
|
|
166
167
|
} else {
|
|
167
168
|
var values = keys.map(function (key) {
|
|
168
169
|
if (key.includes('-')) {
|
|
@@ -174,7 +175,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
174
175
|
}
|
|
175
176
|
return {};
|
|
176
177
|
});
|
|
177
|
-
onValuesChange
|
|
178
|
+
onValuesChange(merge.apply(void 0, [changedValue].concat(_toConsumableArray(values))), form.getFieldsValue());
|
|
178
179
|
}
|
|
179
180
|
};
|
|
180
181
|
// 包装一层兼容 names 改变
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** 深度比较依赖变化memo */
|
|
2
|
-
export declare const useDeepCompareMemo: (fun: () => any, depList: any[]) => any;
|
|
2
|
+
export declare const useDeepCompareMemo: (fun: () => any, changedCb: (last: any, current: any) => void, depList: any[]) => any;
|
|
@@ -2,11 +2,12 @@ import { useRef } from 'react';
|
|
|
2
2
|
import { isEqualWith } from 'lodash';
|
|
3
3
|
import { customEqualForFun } from '.';
|
|
4
4
|
/** 深度比较依赖变化memo */
|
|
5
|
-
export var useDeepCompareMemo = function useDeepCompareMemo(fun, depList) {
|
|
5
|
+
export var useDeepCompareMemo = function useDeepCompareMemo(fun, changedCb, depList) {
|
|
6
6
|
var lastDependency = useRef(); // 上一次的依赖
|
|
7
7
|
var lastRes = useRef(); // 上一次的结果
|
|
8
8
|
if (!isEqualWith(depList, lastDependency.current, customEqualForFun)) {
|
|
9
9
|
var res = fun();
|
|
10
|
+
changedCb === null || changedCb === void 0 ? void 0 : changedCb(lastRes.current, res);
|
|
10
11
|
lastRes.current = res;
|
|
11
12
|
}
|
|
12
13
|
lastDependency.current = depList;
|
|
@@ -9,16 +9,24 @@ export var useForm = function useForm(originForm) {
|
|
|
9
9
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
10
10
|
form = _Form$useForm2[0];
|
|
11
11
|
var getFieldsValue = form.getFieldsValue,
|
|
12
|
-
validateFields = form.validateFields
|
|
12
|
+
validateFields = form.validateFields,
|
|
13
|
+
setFieldsValue = form.setFieldsValue;
|
|
13
14
|
// @ts-ignore
|
|
14
15
|
var _getFieldsValue = function _getFieldsValue(nameList, filterFunc) {
|
|
15
16
|
// 全部查询
|
|
16
17
|
if (nameList !== true) {
|
|
17
|
-
var values = getFieldsValue(true, filterFunc);
|
|
18
|
+
var values = getFieldsValue(nameList || true, filterFunc);
|
|
18
19
|
return filterInternalFields(values);
|
|
19
20
|
}
|
|
20
21
|
return getFieldsValue(nameList, filterFunc);
|
|
21
22
|
};
|
|
23
|
+
// const _setFieldsValue: FormInstance<T>['setFieldsValue'] = (data) => {
|
|
24
|
+
// // 解决names通过set设置无法触发rc-field-form中onStoreChange的问题
|
|
25
|
+
// setTimeout(() => {
|
|
26
|
+
// const baseData = getFieldsValue(true);
|
|
27
|
+
// setFieldsValue({ ...baseData, ...data });
|
|
28
|
+
// }, 0);
|
|
29
|
+
// };
|
|
22
30
|
var _validateFields = /*#__PURE__*/function () {
|
|
23
31
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(nameList) {
|
|
24
32
|
var _rest$,
|
|
@@ -87,5 +95,6 @@ export var useForm = function useForm(originForm) {
|
|
|
87
95
|
}();
|
|
88
96
|
form.getFieldsValue = _getFieldsValue;
|
|
89
97
|
form.validateFields = _validateFields;
|
|
98
|
+
// form.setFieldsValue = _setFieldsValue;
|
|
90
99
|
return [form];
|
|
91
100
|
};
|
|
@@ -121,8 +121,14 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
121
121
|
}
|
|
122
122
|
return {
|
|
123
123
|
shouldUpdate: function shouldUpdate(prevValues, currentValues) {
|
|
124
|
-
// formList场景取当前行数据,不取shouldUpdate变更后值
|
|
125
|
-
var _currentValues
|
|
124
|
+
// @ts-ignore formList场景取当前行数据,不取shouldUpdate变更后值
|
|
125
|
+
var _currentValues;
|
|
126
|
+
if (namePath) {
|
|
127
|
+
// formList场景values取当前行数据
|
|
128
|
+
_currentValues = form.getFieldValue(namePath) || {};
|
|
129
|
+
} else {
|
|
130
|
+
_currentValues = form.getFieldsValue(true);
|
|
131
|
+
}
|
|
126
132
|
var _show = isFunction(show) ? Boolean(show(_currentValues, {
|
|
127
133
|
form: form,
|
|
128
134
|
index: index,
|
package/es/ProIcon/index.d.ts
CHANGED
package/es/ProIcon/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
7
7
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
8
8
|
var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled", "mode", "buttonProps", "children", "mapList", "src", "actionMap", "tooltip"];
|
|
9
9
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
import {
|
|
10
|
+
import { useLocalStorageState, useSetState, useDeepCompareLayoutEffect } from 'ahooks';
|
|
11
11
|
import classNames from 'classnames';
|
|
12
12
|
import { uniqBy } from 'lodash';
|
|
13
13
|
import { ReactSVG } from 'react-svg';
|
|
@@ -16,6 +16,7 @@ import { useProConfig } from '../ProConfigProvider';
|
|
|
16
16
|
import { iconMap } from './config';
|
|
17
17
|
import { onBeforeInjection } from './utils';
|
|
18
18
|
import locale from '../locale';
|
|
19
|
+
import './symbolIcon.js';
|
|
19
20
|
var ProIcon = function ProIcon(props) {
|
|
20
21
|
var _window, _window2;
|
|
21
22
|
var _useProConfig = useProConfig(),
|
|
@@ -72,8 +73,6 @@ var ProIcon = function ProIcon(props) {
|
|
|
72
73
|
((_window = window) === null || _window === void 0 ? void 0 : _window.__POWERED_BY_QIANKUN__) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.isMicroApp);
|
|
73
74
|
// 语言
|
|
74
75
|
var language = locale.ProIcon.language;
|
|
75
|
-
// 加载内部icon
|
|
76
|
-
useExternal('https://at.alicdn.com/t/c/font_4063056_jmnz9g5uycp.js');
|
|
77
76
|
var rotateStyle = rotate ? {
|
|
78
77
|
msTransform: "rotate(".concat(rotate, "deg)"),
|
|
79
78
|
transform: "rotate(".concat(rotate, "deg)")
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
window._iconfont_svg_string_4063056 = '<svg><symbol id="icon-lock" viewBox="0 0 1024 1024"><path d="M752.384 412.1088h-55.6544V300.3904C696.7296 183.6544 608.512 102.4 501.76 102.4 395.0592 102.4 306.8928 183.6544 306.8928 300.3904V407.04H251.1872c-27.8016 0-46.3872 25.344-46.3872 50.7392v385.8432c0 30.464 23.1936 50.7904 46.3872 50.7904h501.248c27.8016 0 46.3872-25.3952 46.3872-50.7904V462.848c0-30.464-18.5856-50.7392-46.4384-50.7392z m-222.72 253.8496v86.272c0 5.12-4.6592 5.12-4.6592 5.12h-41.7792c-4.608 0-4.608-5.12-4.608-5.12v-86.272c-23.2448-10.1888-37.12-30.464-37.12-55.8592 0-35.5328 27.8016-66.048 60.3136-66.048 32.4608 0 60.3136 30.5152 60.3136 66.048 0 25.3952-13.9264 45.6704-32.4608 55.808z m92.7744-253.8496H381.1328V295.3216c0-60.928 55.7056-111.6672 120.6784-111.6672 64.9728 0 120.6272 50.7392 120.6272 111.6672v116.736z" fill="#BCBCBC" ></path></symbol><symbol id="icon-drag" viewBox="0 0 1024 1024"><path d="M670.72 179.2m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z" fill="#939599" ></path><path d="M670.72 506.88m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z" fill="#939599" ></path><path d="M670.72 834.56m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z" fill="#939599" ></path><path d="M343.04 179.2m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z" fill="#939599" ></path><path d="M343.04 506.88m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z" fill="#939599" ></path><path d="M343.04 834.56m-76.8 0a76.8 76.8 0 1 0 153.6 0 76.8 76.8 0 1 0-153.6 0Z" fill="#939599" ></path></symbol><symbol id="icon-plus" viewBox="0 0 1024 1024"><path d="M576 64H448v384H64v128h384v384h128V576h384V448H576z" ></path></symbol><symbol id="icon-zengjia" viewBox="0 0 1024 1024"><path d="M939.94 459.073h-377.6V83.519H462.055v375.554h-377.6v100.284h377.6v379.646H562.34V559.357h377.6z" fill="#272636" ></path></symbol><symbol id="icon-dot" viewBox="0 0 1024 1024"><path d="M512 624a112 112 0 1 0 0-224 112 112 0 0 0 0 224z" ></path></symbol><symbol id="icon-solid-close" viewBox="0 0 1024 1024"><path d="M516.707 66.513C272.86 66.513 75.16 264.212 75.16 508.06S272.86 949.607 516.707 949.607 958.254 751.91 958.254 508.06 760.556 66.513 516.707 66.513z m227.067 601.691c18.419 18.42 18.419 48.504 0 66.923s-48.504 18.42-66.923 0L516.707 574.983 356.563 735.127c-18.419 18.42-48.503 18.42-66.923 0s-18.419-48.504 0-66.923L449.784 508.06 289.64 347.916c-18.419-18.419-18.419-48.503 0-66.922 18.42-18.42 48.504-18.42 66.923 0l160.144 160.144 160.144-160.144c18.42-18.42 48.504-18.42 66.923 0 18.419 18.419 18.419 48.503 0 66.922L583.63 508.06l160.144 160.144z" ></path></symbol><symbol id="icon-arrow" viewBox="0 0 1024 1024"><path d="M832 0a192 192 0 0 1 192 192v640a192 192 0 0 1-192 192H192A192 192 0 0 1 0 832V192A192 192 0 0 1 192 0z m0 42.667H192A149.333 149.333 0 0 0 42.667 192v640A149.333 149.333 0 0 0 192 981.333h640A149.333 149.333 0 0 0 981.333 832V192A149.333 149.333 0 0 0 832 42.667z m-94.165 329.386l60.33 60.331L512 718.592 225.835 432.384l60.33-60.33L512 597.887l225.835-225.835z" ></path></symbol><symbol id="icon-delete" viewBox="0 0 1024 1024"><path d="M662.08 121.472v64H361.92v-64z m206.4 159.488v64H155.52v-64z" ></path><path d="M280.512 303.232l-0.064 530.816h460.096V303.232h64v594.88H216.512v-594.88z" ></path><path d="M431.424 440.704v337.728h-64V440.704z m225.152 0v337.728h-64V440.704z" ></path></symbol><symbol id="icon-catalog" viewBox="0 0 1075 1024"><path d="M1044.429 758.323v128.973H313.702V758.272h730.727z m-833.127 0v128.973H71.732V758.272h139.57zM1044.43 447.54v128.922H313.702V447.539h730.727z m-833.127 0v128.922H71.732V447.539h139.57z m833.127-310.784v128.922H313.702V136.704h730.727z m-833.127 0v128.922H71.732V136.704h139.57z" ></path></symbol><symbol id="icon-customColumn" viewBox="0 0 1024 1024"><path d="M170.368 128h0.576c28.288 0 42.368 14.848 42.368 44.608v678.784c0 29.76-14.08 44.608-42.368 44.608h-0.576C142.144 896 128 881.152 128 851.392V172.608c0-29.76 14.08-44.608 42.368-44.608z m682.752 0h0.576c28.224 0 42.368 14.848 42.368 44.608v678.784c0 29.76-14.08 44.608-42.368 44.608h-0.576c-28.288 0-42.368-14.848-42.368-44.608V172.608c0-29.76 14.08-44.608 42.368-44.608z m-453.632 0h225.024c38.784 0 58.176 20.16 58.176 60.416v647.168c0 40.32-19.392 60.416-58.176 60.416H399.488c-38.784 0-58.176-20.16-58.176-60.416V188.416c0-40.32 19.392-60.416 58.176-60.416z" ></path></symbol><symbol id="icon-copy" viewBox="0 0 1024 1024"><path d="M363.746 0h565.883c52.05 0 94.286 42.236 94.286 94.285V660.17c0 52.049-42.237 94.285-94.286 94.285H363.746c-52.05 0-94.286-42.236-94.286-94.285V94.285C269.46 42.236 311.697 0 363.746 0z m0 80.804a13.482 13.482 0 0 0-13.482 13.481V660.17c0 7.423 6.058 13.482 13.482 13.482h565.883c7.424 0 13.482-6.059 13.482-13.482V94.285a13.482 13.482 0 0 0-13.482-13.481H363.746z m309.905 754.54a40.445 40.445 0 1 1 80.803 0v94.37c0 52.05-42.236 94.286-94.285 94.286H94.285C42.236 1023.915 0 981.678 0 929.63V363.745c0-52.05 42.236-94.286 94.285-94.286h94.371a40.445 40.445 0 0 1 0 80.804h-94.37a13.482 13.482 0 0 0-13.482 13.482v565.883c0 7.424 6.058 13.482 13.481 13.482H660.17c7.423 0 13.482-6.058 13.482-13.482v-94.37z" ></path></symbol><symbol id="icon-drag-old" viewBox="0 0 1024 1024"><path d="M358.4 204.8m-51.2 0a51.2 51.2 0 1 0 102.4 0 51.2 51.2 0 1 0-102.4 0Z" ></path><path d="M665.6 204.8m-51.2 0a51.2 51.2 0 1 0 102.4 0 51.2 51.2 0 1 0-102.4 0Z" ></path><path d="M665.6 409.6m-51.2 0a51.2 51.2 0 1 0 102.4 0 51.2 51.2 0 1 0-102.4 0Z" ></path><path d="M358.4 614.4m-51.2 0a51.2 51.2 0 1 0 102.4 0 51.2 51.2 0 1 0-102.4 0Z" ></path><path d="M358.4 819.2m-51.2 0a51.2 51.2 0 1 0 102.4 0 51.2 51.2 0 1 0-102.4 0Z" ></path><path d="M665.6 819.2m-51.2 0a51.2 51.2 0 1 0 102.4 0 51.2 51.2 0 1 0-102.4 0Z" ></path><path d="M358.4 409.6m-51.2 0a51.2 51.2 0 1 0 102.4 0 51.2 51.2 0 1 0-102.4 0Z" ></path><path d="M665.6 614.4m-51.2 0a51.2 51.2 0 1 0 102.4 0 51.2 51.2 0 1 0-102.4 0Z" ></path></symbol><symbol id="icon-disabled" viewBox="0 0 1024 1024"><path d="M752.384 412.1088h-55.6544V300.3904C696.7296 183.6544 608.512 102.4 501.76 102.4 395.0592 102.4 306.8928 183.6544 306.8928 300.3904V407.04H251.1872c-27.8016 0-46.3872 25.344-46.3872 50.7392v385.8432c0 30.464 23.1936 50.7904 46.3872 50.7904h501.248c27.8016 0 46.3872-25.3952 46.3872-50.7904V462.848c0-30.464-18.5856-50.7392-46.4384-50.7392z m-222.72 253.8496v86.272c0 5.12-4.6592 5.12-4.6592 5.12h-41.7792c-4.608 0-4.608-5.12-4.608-5.12v-86.272c-23.2448-10.1888-37.12-30.464-37.12-55.8592 0-35.5328 27.8016-66.048 60.3136-66.048 32.4608 0 60.3136 30.5152 60.3136 66.048 0 25.3952-13.9264 45.6704-32.4608 55.808z m92.7744-253.8496H381.1328V295.3216c0-60.928 55.7056-111.6672 120.6784-111.6672 64.9728 0 120.6272 50.7392 120.6272 111.6672v116.736z" ></path></symbol><symbol id="icon-tip" viewBox="0 0 1024 1024"><path d="M512 19.017a492.983 492.983 0 1 1-0.073 986.039A492.983 492.983 0 0 1 512 19.09z m0 48.786a444.27 444.27 0 1 0 0.073 888.467A444.27 444.27 0 0 0 512 67.803z m22.016 317.367c37.45 3.877 55.15 33.792 48.64 66.707l-78.41 259.072c-1.023 5.924 2.049 11.849 7.315 13.677 5.852 2.048 17.92-5.412 27.648-16.091l47.104-56.613c1.244 9.509-0.878 26.185-0.878 32.549-35.328 53.028-71.314 93.988-131.876 93.988-41.326-6.729-58.222-36.352-49.298-66.56l77.897-257.828c1.901-6.364-1.244-13.02-7.022-15.068-5.778-2.048-17.042 5.413-26.77 16.092l-47.031 56.612c-1.317-9.508-0.146-25.234-0.146-31.597 35.328-53.029 93.403-94.94 132.827-94.94z m40.96-144.823c29.77 0 53.906 21.724 53.906 53.614 0 31.964-24.137 53.614-53.906 53.614a52.297 52.297 0 0 1-53.906-53.614c0-31.89 24.137-53.614 53.906-53.614z" ></path></symbol><symbol id="icon-reset" viewBox="0 0 1024 1024"><path d="M482.464768 117.691733L364.363435 66.696533A49.288533 49.288533 0 0 0 325.314901 157.013333a417.9968 417.9968 0 0 0 53.8624 789.845334 49.288533 49.288533 0 0 0 25.668267-95.163734 319.624533 319.624533 0 0 1-29.559467-608.324266l-7.850666 18.158933a49.152 49.152 0 0 0 26.0096 64.580267 49.288533 49.288533 0 0 0 64.580266-24.9856l50.107734-118.9888a49.425067 49.425067 0 0 0-25.668267-64.512z m429.602133 421.410134A418.884267 418.884267 0 0 0 614.424235 126.839467a49.288533 49.288533 0 1 0-28.398934 94.344533 319.829333 319.829333 0 0 1 56.9344 589.824 49.152 49.152 0 0 0-86.152533-47.240533l-67.106133 109.431466a48.9472 48.9472 0 0 0 16.110933 67.925334l109.294933 67.9936a49.288533 49.288533 0 1 0 50.9952-83.7632l-15.018666-9.352534a418.679467 418.679467 0 0 0 261.051733-376.900266z" ></path></symbol><symbol id="icon-view" viewBox="0 0 1024 1024"><path d="M801.606 104.727a117.667 117.667 0 0 1 117.434 109.94l0.233 7.727v246.598a34.91 34.91 0 0 1-69.493 4.748l-0.325-4.748V222.394c0-24.669-18.619-44.963-42.636-47.57l-5.213-0.279H222.394c-24.669 0-44.963 18.619-47.57 42.636l-0.279 5.213v579.212c0 24.669 18.619 44.963 42.636 47.57l5.213 0.279h243.247a34.91 34.91 0 0 1 4.747 69.492l-4.747 0.326H222.394a117.667 117.667 0 0 1-117.434-109.94l-0.233-7.727V222.394a117.667 117.667 0 0 1 109.94-117.434l7.727-0.233h579.212zM448.559 585.728a34.91 34.91 0 1 1 0 69.818H332.195a34.91 34.91 0 1 1 0-69.818h116.364z m232.727-232.727a34.91 34.91 0 1 1 0 69.818H332.195a34.91 34.91 0 1 1 0-69.818h349.09z" ></path><path d="M699.764 490.356a186.182 186.182 0 1 1 0 372.364 186.182 186.182 0 0 1 0-372.364z m0 69.819a116.364 116.364 0 1 0 0 232.727 116.364 116.364 0 0 0 0-232.727z" ></path><path d="M798.673 769.35a34.91 34.91 0 0 1 49.339 0l82.292 82.246a34.91 34.91 0 1 1-49.338 49.384l-82.293-82.292a34.91 34.91 0 0 1 0-49.338z" ></path></symbol><symbol id="icon-search" viewBox="0 0 1024 1024"><path d="M801.606 104.727a117.667 117.667 0 0 1 117.434 109.94l0.233 7.727v246.598a34.91 34.91 0 0 1-69.493 4.748l-0.325-4.748V222.394c0-24.669-18.619-44.963-42.636-47.57l-5.213-0.279H222.394c-24.669 0-44.963 18.619-47.57 42.636l-0.279 5.213v579.212c0 24.669 18.619 44.963 42.636 47.57l5.213 0.279h243.247a34.91 34.91 0 0 1 4.747 69.492l-4.747 0.326H222.394a117.667 117.667 0 0 1-117.434-109.94l-0.233-7.727V222.394a117.667 117.667 0 0 1 109.94-117.434l7.727-0.233h579.212zM448.559 585.728a34.91 34.91 0 1 1 0 69.818H332.195a34.91 34.91 0 1 1 0-69.818h116.364z m232.727-232.727a34.91 34.91 0 1 1 0 69.818H332.195a34.91 34.91 0 1 1 0-69.818h349.09z" ></path><path d="M699.764 490.356a186.182 186.182 0 1 1 0 372.364 186.182 186.182 0 0 1 0-372.364z m0 69.819a116.364 116.364 0 1 0 0 232.727 116.364 116.364 0 0 0 0-232.727z" ></path><path d="M798.673 769.35a34.91 34.91 0 0 1 49.339 0l82.292 82.246a34.91 34.91 0 1 1-49.338 49.384l-82.293-82.292a34.91 34.91 0 0 1 0-49.338z" ></path></symbol></svg>', function (o) {
|
|
2
|
+
var t = (t = document.getElementsByTagName('script'))[t.length - 1],
|
|
3
|
+
a = t.getAttribute('data-injectcss'),
|
|
4
|
+
t = t.getAttribute('data-disable-injectsvg');
|
|
5
|
+
if (!t) {
|
|
6
|
+
var e,
|
|
7
|
+
_l,
|
|
8
|
+
h,
|
|
9
|
+
i,
|
|
10
|
+
c,
|
|
11
|
+
d = function d(t, a) {
|
|
12
|
+
a.parentNode.insertBefore(t, a);
|
|
13
|
+
};
|
|
14
|
+
if (a && !o.__iconfont__svg__cssinject__) {
|
|
15
|
+
o.__iconfont__svg__cssinject__ = !0;
|
|
16
|
+
try {
|
|
17
|
+
document.write('<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>');
|
|
18
|
+
} catch (t) {
|
|
19
|
+
console && console.log(t);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
e = function e() {
|
|
23
|
+
var t,
|
|
24
|
+
a = document.createElement('div');
|
|
25
|
+
a.innerHTML = o._iconfont_svg_string_4063056, (a = a.getElementsByTagName('svg')[0]) && (a.setAttribute('aria-hidden', 'true'), a.style.position = 'absolute', a.style.width = 0, a.style.height = 0, a.style.overflow = 'hidden', a = a, (t = document.body).firstChild ? d(a, t.firstChild) : t.appendChild(a));
|
|
26
|
+
}, document.addEventListener ? ~['complete', 'loaded', 'interactive'].indexOf(document.readyState) ? setTimeout(e, 0) : (_l = function l() {
|
|
27
|
+
document.removeEventListener('DOMContentLoaded', _l, !1), e();
|
|
28
|
+
}, document.addEventListener('DOMContentLoaded', _l, !1)) : document.attachEvent && (h = e, i = o.document, c = !1, n(), i.onreadystatechange = function () {
|
|
29
|
+
'complete' == i.readyState && (i.onreadystatechange = null, m());
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function m() {
|
|
33
|
+
c || (c = !0, h());
|
|
34
|
+
}
|
|
35
|
+
function n() {
|
|
36
|
+
try {
|
|
37
|
+
i.documentElement.doScroll('left');
|
|
38
|
+
} catch (t) {
|
|
39
|
+
return void setTimeout(n, 50);
|
|
40
|
+
}
|
|
41
|
+
m();
|
|
42
|
+
}
|
|
43
|
+
}(window);
|
|
@@ -25,7 +25,7 @@ import { ReactSVG } from 'react-svg';
|
|
|
25
25
|
import { useProConfig } from '../../ProConfigProvider';
|
|
26
26
|
import { TreeView } from './index';
|
|
27
27
|
import locale from '../../locale';
|
|
28
|
-
import {
|
|
28
|
+
import { getFlatTreeData, getChildrenKeys, findTreeNodeByKey, getAllKeys } from '../utils';
|
|
29
29
|
import searchSVG from '../../assets/input-search.svg';
|
|
30
30
|
import '../style/index.less';
|
|
31
31
|
var ProTree = function ProTree(props) {
|
|
@@ -88,11 +88,18 @@ var ProTree = function ProTree(props) {
|
|
|
88
88
|
checkAll: false,
|
|
89
89
|
allKeys: [],
|
|
90
90
|
clickShowLoading: false,
|
|
91
|
-
innerExpandKeys:
|
|
91
|
+
innerExpandKeys: undefined // 将传入德默认展开德节点传入内部state德innerExpandKeys上面,后续由innerExpandKeys控制展开节点
|
|
92
92
|
}),
|
|
93
93
|
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
94
94
|
state = _useSetState2[0],
|
|
95
95
|
setState = _useSetState2[1];
|
|
96
|
+
useEffect(function () {
|
|
97
|
+
if (expandedKeys) {
|
|
98
|
+
setState({
|
|
99
|
+
innerExpandKeys: expandedKeys
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}, [expandedKeys]);
|
|
96
103
|
var fetchFunction = useRequestFunc(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread({
|
|
97
104
|
manual: true,
|
|
98
105
|
onSuccess: function onSuccess(res) {
|
|
@@ -104,8 +111,8 @@ var ProTree = function ProTree(props) {
|
|
|
104
111
|
treeData: responseData,
|
|
105
112
|
originalTreeData: responseData,
|
|
106
113
|
flatTreeData: flatTrees,
|
|
107
|
-
allKeys: allKey
|
|
108
|
-
innerExpandKeys:
|
|
114
|
+
allKeys: allKey
|
|
115
|
+
// innerExpandKeys: props?.expandedKeys ? props?.expandedKeys : getDefaultExpandKeys(defaultExpandAll, allKey),
|
|
109
116
|
});
|
|
110
117
|
} else {
|
|
111
118
|
var _res$status = res.status,
|
|
@@ -122,8 +129,8 @@ var ProTree = function ProTree(props) {
|
|
|
122
129
|
treeData: data,
|
|
123
130
|
originalTreeData: data,
|
|
124
131
|
flatTreeData: _flatTrees,
|
|
125
|
-
allKeys: _allKey
|
|
126
|
-
innerExpandKeys:
|
|
132
|
+
allKeys: _allKey
|
|
133
|
+
// innerExpandKeys: props?.expandedKeys ? props?.expandedKeys : getDefaultExpandKeys(defaultExpandAll, allKey),
|
|
127
134
|
});
|
|
128
135
|
}
|
|
129
136
|
},
|
|
@@ -136,8 +143,8 @@ var ProTree = function ProTree(props) {
|
|
|
136
143
|
treeData: dataSource,
|
|
137
144
|
originalTreeData: cloneDeep(dataSource),
|
|
138
145
|
flatTreeData: getFlatTreeData(dataSource, fieldNames),
|
|
139
|
-
allKeys: allKey
|
|
140
|
-
innerExpandKeys:
|
|
146
|
+
allKeys: allKey
|
|
147
|
+
// innerExpandKeys: props?.expandedKeys ? props?.expandedKeys : getDefaultExpandKeys(defaultExpandAll, allKey),
|
|
141
148
|
});
|
|
142
149
|
} else if (enumCode) {
|
|
143
150
|
var dictEnum = dics[enumCode] || [];
|
|
@@ -155,8 +162,8 @@ var ProTree = function ProTree(props) {
|
|
|
155
162
|
treeData: dictEnum,
|
|
156
163
|
originalTreeData: cloneDeep(dictEnum),
|
|
157
164
|
flatTreeData: getFlatTreeData(dictEnum, fieldNames),
|
|
158
|
-
allKeys: getAllKeys(dictEnum, fieldNames)
|
|
159
|
-
innerExpandKeys:
|
|
165
|
+
allKeys: getAllKeys(dictEnum, fieldNames)
|
|
166
|
+
// innerExpandKeys: props?.expandedKeys ? props?.expandedKeys : getDefaultExpandKeys(defaultExpandAll, allKey),
|
|
160
167
|
});
|
|
161
168
|
}
|
|
162
169
|
}, [dataSource, enumCode]);
|
|
@@ -455,6 +462,7 @@ var ProTree = function ProTree(props) {
|
|
|
455
462
|
originalTreeData: state.originalTreeData,
|
|
456
463
|
flatTreeData: state.flatTreeData,
|
|
457
464
|
checkedValues: state.checkedValues,
|
|
465
|
+
defaultExpandAll: defaultExpandAll,
|
|
458
466
|
innerExpandKeys: state === null || state === void 0 ? void 0 : state.innerExpandKeys,
|
|
459
467
|
optionRender: optionRender,
|
|
460
468
|
searchStr: state.searchStr,
|