@zat-design/sisyphus-react 3.6.5-beta.1 → 3.6.5-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/es/ProAction/index.js +4 -4
- package/es/ProDownload/index.d.ts +1 -1
- package/es/ProEditTable/components/ActionButton/index.d.ts +1 -1
- package/es/ProEditTable/components/RcTable/BaseTable.d.ts +6 -0
- package/es/ProEditTable/components/RcTable/BaseTable.js +75 -0
- package/es/ProEditTable/components/RcTable/DraggableTable.d.ts +7 -0
- package/es/ProEditTable/components/RcTable/DraggableTable.js +90 -0
- package/es/ProEditTable/components/RcTable/VirtualTable1.d.ts +6 -0
- package/es/ProEditTable/components/RcTable/VirtualTable1.js +86 -0
- package/es/ProEditTable/components/RcTable/index.d.ts +6 -0
- package/es/ProEditTable/components/RcTable/index.js +6 -0
- package/es/ProEditTable/components/RenderField/index.d.ts +1 -1
- package/es/ProEditTable/components/RenderField/index.js +26 -18
- package/es/ProEditTable/components/RenderToolbar/index.d.ts +3 -2
- package/es/ProEditTable/components/RenderToolbar/index.js +2 -2
- package/es/ProEditTable/components/Summary/index.d.ts +1 -1
- package/es/ProEditTable/index.js +33 -55
- package/es/ProEditTable/propsType.d.ts +6 -0
- package/es/ProEditTable/utils/config.d.ts +1 -1
- package/es/ProEditTable/utils/config.js +2 -2
- package/es/ProEditTable/utils/tools.js +3 -3
- package/es/ProEnum/components/Group.d.ts +1 -1
- package/es/ProEnum/components/Tag.d.ts +1 -1
- package/es/ProEnum/index.d.ts +2 -2
- package/es/ProEnum/utils/eventCenter.js +1 -2
- package/es/ProEnum/utils/getEnumLabel.d.ts +1 -1
- package/es/ProForm/components/base/Input/index.d.ts +1 -1
- package/es/ProForm/components/combination/ProCascader/index.d.ts +1 -1
- package/es/ProForm/components/combination/ProCascader/index.js +7 -7
- package/es/ProForm/components/old/InputRange/index.d.ts +1 -1
- package/es/ProForm/components/old/InputWithSuffix/index.d.ts +1 -1
- package/es/ProForm/components/old/ProAddress/index.d.ts +1 -2
- package/es/ProForm/components/old/ProRangeBox/index.d.ts +1 -2
- package/es/ProForm/index.d.ts +3 -2
- package/es/ProForm/index.js +3 -17
- package/es/ProForm/utils/index.js +14 -10
- package/es/ProForm/utils/useShouldUpdate.js +9 -1
- package/es/ProForm/utils/useWatch.d.ts +7 -0
- package/es/ProForm/utils/useWatch.js +77 -0
- package/es/ProIcon/utils/index.js +4 -3
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.d.ts +1 -1
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +3 -3
- package/es/ProLayout/components/ProCollapse/index.d.ts +1 -1
- package/es/ProLayout/components/ProFooter/index.d.ts +1 -1
- package/es/ProLayout/components/ProHeader/components/Copy/index.d.ts +1 -1
- package/es/ProLayout/components/ProHeader/index.d.ts +1 -1
- package/es/ProLayout/index.d.ts +4 -4
- package/es/ProLayout/utils/index.js +9 -9
- package/es/ProSelect/components/AdaptiveTooltip.d.ts +1 -1
- package/es/ProSelect/index.d.ts +1 -1
- package/es/ProStep/components/Anchor/index.d.ts +1 -1
- package/es/ProStep/components/Item/index.d.ts +1 -1
- package/es/ProStep/components/Step/index.d.ts +1 -1
- package/es/ProStep/index.d.ts +2 -2
- package/es/ProTable/components/ResizableLine/index.d.ts +1 -1
- package/es/ProTable/components/TableResizable/index.d.ts +1 -1
- package/es/ProTable/index.d.ts +1 -1
- package/es/ProTable/utils.js +4 -4
- package/es/ProTabs/components/Card/index.d.ts +1 -1
- package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/es/ProThemeTools/index.d.ts +1 -1
- package/es/ProTooltip/index.d.ts +1 -1
- package/es/ProTree/components/CloseIcon.d.ts +1 -2
- package/es/ProTree/components/List.d.ts +1 -1
- package/es/ProTree/components/ProTree.d.ts +1 -1
- package/es/ProTree/components/ProTreeSelect/index.d.ts +1 -1
- package/es/ProTree/components/ProTreeSelect/index.js +33 -22
- package/es/ProTree/components/SearchTitle.d.ts +1 -1
- package/es/ProTree/components/Tree.d.ts +1 -1
- package/es/ProTree/components/Tree.js +3 -3
- package/es/ProTree/index.d.ts +1 -1
- package/es/ProTree/utils.js +12 -11
- package/es/ProTreeModal/components/Cascader.d.ts +1 -1
- package/es/ProTreeModal/components/CloseIcon.d.ts +1 -2
- package/es/ProTreeModal/components/SearchTitle.d.ts +1 -1
- package/es/ProTreeModal/components/Tree.js +6 -6
- package/es/ProTreeModal/components/Trigger.d.ts +1 -1
- package/es/ProTreeModal/index.d.ts +1 -1
- package/es/ProTreeModal/utils.js +12 -11
- package/es/ProUpload/components/DraggableUploadListItem.d.ts +1 -1
- package/lib/ProAction/index.js +4 -4
- package/lib/ProDownload/index.d.ts +1 -1
- package/lib/ProEditTable/components/ActionButton/index.d.ts +1 -1
- package/lib/ProEditTable/components/RcTable/BaseTable.d.ts +6 -0
- package/lib/ProEditTable/components/RcTable/BaseTable.js +81 -0
- package/lib/ProEditTable/components/RcTable/DraggableTable.d.ts +7 -0
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +96 -0
- package/lib/ProEditTable/components/RcTable/VirtualTable1.d.ts +6 -0
- package/lib/ProEditTable/components/RcTable/VirtualTable1.js +93 -0
- package/lib/ProEditTable/components/RcTable/index.d.ts +6 -0
- package/lib/ProEditTable/components/RcTable/index.js +27 -0
- package/lib/ProEditTable/components/RenderField/index.d.ts +1 -1
- package/lib/ProEditTable/components/RenderField/index.js +26 -18
- package/lib/ProEditTable/components/RenderToolbar/index.d.ts +3 -2
- package/lib/ProEditTable/components/RenderToolbar/index.js +3 -2
- package/lib/ProEditTable/components/Summary/index.d.ts +1 -1
- package/lib/ProEditTable/index.js +32 -52
- package/lib/ProEditTable/propsType.d.ts +6 -0
- package/lib/ProEditTable/utils/config.d.ts +1 -1
- package/lib/ProEditTable/utils/config.js +2 -2
- package/lib/ProEditTable/utils/tools.js +3 -3
- package/lib/ProEnum/components/Group.d.ts +1 -1
- package/lib/ProEnum/components/Tag.d.ts +1 -1
- package/lib/ProEnum/index.d.ts +2 -2
- package/lib/ProEnum/utils/eventCenter.js +1 -2
- package/lib/ProEnum/utils/getEnumLabel.d.ts +1 -1
- package/lib/ProForm/components/base/Input/index.d.ts +1 -1
- package/lib/ProForm/components/combination/ProCascader/index.d.ts +1 -1
- package/lib/ProForm/components/combination/ProCascader/index.js +7 -7
- package/lib/ProForm/components/old/InputRange/index.d.ts +1 -1
- package/lib/ProForm/components/old/InputWithSuffix/index.d.ts +1 -1
- package/lib/ProForm/components/old/ProAddress/index.d.ts +1 -2
- package/lib/ProForm/components/old/ProRangeBox/index.d.ts +1 -2
- package/lib/ProForm/index.d.ts +3 -2
- package/lib/ProForm/index.js +2 -16
- package/lib/ProForm/utils/index.js +10 -10
- package/lib/ProForm/utils/useShouldUpdate.js +9 -1
- package/lib/ProForm/utils/useWatch.d.ts +7 -0
- package/lib/ProForm/utils/useWatch.js +87 -0
- package/lib/ProIcon/utils/index.js +3 -3
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.d.ts +1 -1
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +3 -3
- package/lib/ProLayout/components/ProCollapse/index.d.ts +1 -1
- package/lib/ProLayout/components/ProFooter/index.d.ts +1 -1
- package/lib/ProLayout/components/ProHeader/components/Copy/index.d.ts +1 -1
- package/lib/ProLayout/components/ProHeader/index.d.ts +1 -1
- package/lib/ProLayout/index.d.ts +4 -4
- package/lib/ProLayout/utils/index.js +9 -9
- package/lib/ProSelect/components/AdaptiveTooltip.d.ts +1 -1
- package/lib/ProSelect/index.d.ts +1 -1
- package/lib/ProStep/components/Anchor/index.d.ts +1 -1
- package/lib/ProStep/components/Item/index.d.ts +1 -1
- package/lib/ProStep/components/Step/index.d.ts +1 -1
- package/lib/ProStep/index.d.ts +2 -2
- package/lib/ProTable/components/ResizableLine/index.d.ts +1 -1
- package/lib/ProTable/components/TableResizable/index.d.ts +1 -1
- package/lib/ProTable/index.d.ts +1 -1
- package/lib/ProTable/utils.js +4 -4
- package/lib/ProTabs/components/Card/index.d.ts +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/lib/ProThemeTools/index.d.ts +1 -1
- package/lib/ProTooltip/index.d.ts +1 -1
- package/lib/ProTree/components/CloseIcon.d.ts +1 -2
- package/lib/ProTree/components/List.d.ts +1 -1
- package/lib/ProTree/components/ProTree.d.ts +1 -1
- package/lib/ProTree/components/ProTreeSelect/index.d.ts +1 -1
- package/lib/ProTree/components/ProTreeSelect/index.js +33 -22
- package/lib/ProTree/components/SearchTitle.d.ts +1 -1
- package/lib/ProTree/components/Tree.d.ts +1 -1
- package/lib/ProTree/components/Tree.js +3 -3
- package/lib/ProTree/index.d.ts +1 -1
- package/lib/ProTree/utils.js +11 -11
- package/lib/ProTreeModal/components/Cascader.d.ts +1 -1
- package/lib/ProTreeModal/components/CloseIcon.d.ts +1 -2
- package/lib/ProTreeModal/components/SearchTitle.d.ts +1 -1
- package/lib/ProTreeModal/components/Tree.js +6 -6
- package/lib/ProTreeModal/components/Trigger.d.ts +1 -1
- package/lib/ProTreeModal/index.d.ts +1 -1
- package/lib/ProTreeModal/utils.js +11 -11
- package/lib/ProUpload/components/DraggableUploadListItem.d.ts +1 -1
- package/package.json +3 -2
|
@@ -167,7 +167,7 @@ export var actions = {
|
|
|
167
167
|
},
|
|
168
168
|
add: function () {
|
|
169
169
|
var _add = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref5) {
|
|
170
|
-
var _tableRef$current$
|
|
170
|
+
var _tableRef$current, _tableRef$current$chi, _tableRef$current$chi2;
|
|
171
171
|
var result, insertType, editingKeys, setState, form, name, virtualName, virtualKey, onlyOneLineMsg, tableRef, _ref5$prefixCls, prefixCls, nextData, rowKey, addData, nextEditingKeys;
|
|
172
172
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
173
173
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -200,7 +200,7 @@ export var actions = {
|
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
form.setFieldValue(name, nextData);
|
|
203
|
-
(_tableRef$current
|
|
203
|
+
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$chi = _tableRef$current.children) === null || _tableRef$current$chi === void 0 ? void 0 : (_tableRef$current$chi2 = _tableRef$current$chi.scrollTo) === null || _tableRef$current$chi2 === void 0 ? void 0 : _tableRef$current$chi2.call(_tableRef$current$chi, {
|
|
204
204
|
top: insertType === 'before' ? -10000 : 10000,
|
|
205
205
|
behavior: 'smooth'
|
|
206
206
|
});
|
|
@@ -5,14 +5,14 @@ export var getRandom = function getRandom() {
|
|
|
5
5
|
};
|
|
6
6
|
// 深层次对比两个对象且取出来差异值
|
|
7
7
|
export var difference = function difference(object, base) {
|
|
8
|
-
var
|
|
8
|
+
var _changes = function changes(object, base) {
|
|
9
9
|
return transform(object, function (result, value, key) {
|
|
10
10
|
if (!isEqual(value, base[key])) {
|
|
11
|
-
result[key] = isObject(value) && isObject(base[key]) ?
|
|
11
|
+
result[key] = isObject(value) && isObject(base[key]) ? _changes(value, base[key]) : value;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
return
|
|
15
|
+
return _changes(object, base);
|
|
16
16
|
};
|
|
17
17
|
// 数组字段循环校验,解决validateFields无法批量校验的问题
|
|
18
18
|
export var customValidate = function customValidate(validateKeys, form, rowName) {
|
|
@@ -6,5 +6,5 @@ interface Props extends Pick<ProEnum, 'id' | 'value' | 'onChange' | 'dataSource'
|
|
|
6
6
|
allowClear?: boolean;
|
|
7
7
|
button?: boolean;
|
|
8
8
|
}
|
|
9
|
-
declare const Group: (props: Props) => JSX.Element;
|
|
9
|
+
declare const Group: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export default Group;
|
|
@@ -3,5 +3,5 @@ interface Props extends Pick<ProEnum, 'id' | 'value' | 'onChange' | 'dataSource'
|
|
|
3
3
|
fieldValue: string;
|
|
4
4
|
fieldLabel: string;
|
|
5
5
|
}
|
|
6
|
-
declare const ProEnumTag: (props: Props) => JSX.Element;
|
|
6
|
+
declare const ProEnumTag: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default ProEnumTag;
|
package/es/ProEnum/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import useEnum from './hooks/useEnum';
|
|
|
2
2
|
import { ProEnumProps } from './propsType';
|
|
3
3
|
import './style/index.less';
|
|
4
4
|
declare const ProEnum: {
|
|
5
|
-
(props: ProEnumProps): JSX.Element;
|
|
6
|
-
getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) => JSX.Element;
|
|
5
|
+
(props: ProEnumProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
useEnum: typeof useEnum;
|
|
8
8
|
};
|
|
9
9
|
export default ProEnum;
|
|
@@ -7,7 +7,7 @@ var SimpleEventCenter = /*#__PURE__*/function () {
|
|
|
7
7
|
this.events = void 0;
|
|
8
8
|
this.events = new Map();
|
|
9
9
|
}
|
|
10
|
-
_createClass(SimpleEventCenter, [{
|
|
10
|
+
return _createClass(SimpleEventCenter, [{
|
|
11
11
|
key: "subscribe",
|
|
12
12
|
value: function subscribe(eventName, callback) {
|
|
13
13
|
if (!this.events.has(eventName)) {
|
|
@@ -34,6 +34,5 @@ var SimpleEventCenter = /*#__PURE__*/function () {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}]);
|
|
37
|
-
return SimpleEventCenter;
|
|
38
37
|
}(); // 将 eventCenter 实例添加到 window 对象上
|
|
39
38
|
window.eventCenter = new SimpleEventCenter();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) => JSX.Element;
|
|
1
|
+
declare const getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) => import("react/jsx-runtime").JSX.Element;
|
|
2
2
|
export default getEnumLabel;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ProCascaderProps } from './propsType';
|
|
3
|
-
declare const _default: import("react").MemoExoticComponent<(props: ProCascaderProps) => JSX.Element>;
|
|
3
|
+
declare const _default: import("react").MemoExoticComponent<(props: ProCascaderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
4
4
|
export default _default;
|
|
@@ -28,9 +28,9 @@ var defaultFieldNames = {
|
|
|
28
28
|
value: 'code',
|
|
29
29
|
children: 'children'
|
|
30
30
|
};
|
|
31
|
-
var
|
|
31
|
+
var _filterDataSource = function filterDataSource(dataSource, level, fieldNames) {
|
|
32
32
|
return dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
|
|
33
|
-
return _objectSpread(_objectSpread({}, item), {}, _defineProperty({}, (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children', level === 1 ? [] :
|
|
33
|
+
return _objectSpread(_objectSpread({}, item), {}, _defineProperty({}, (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children', level === 1 ? [] : _filterDataSource(item === null || item === void 0 ? void 0 : item[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'], level - 1, fieldNames)));
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
var getViewLabel = function getViewLabel(_ref) {
|
|
@@ -94,7 +94,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
94
94
|
enumDataSource = _ref5$ === void 0 ? [] : _ref5$;
|
|
95
95
|
var realDataSource = useMemo(function () {
|
|
96
96
|
var innerDataSource = dataSource || (addressCode ? enumDataSource : []);
|
|
97
|
-
var result = isAddressMode && realLevel === 2 ?
|
|
97
|
+
var result = isAddressMode && realLevel === 2 ? _filterDataSource(innerDataSource, level, fieldNames) : innerDataSource;
|
|
98
98
|
return transformDataName(result, fieldNames);
|
|
99
99
|
}, [isAddressMode, addressCode, realLevel, dataSource, enumDataSource === null || enumDataSource === void 0 ? void 0 : enumDataSource.length]);
|
|
100
100
|
var _useRequest = _objectSpread({}, useRequest),
|
|
@@ -129,7 +129,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
129
129
|
value: fieldNames.value,
|
|
130
130
|
children: (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'
|
|
131
131
|
});
|
|
132
|
-
serviceData = isAddressMode && realLevel === 2 ?
|
|
132
|
+
serviceData = isAddressMode && realLevel === 2 ? _filterDataSource(transFormData, level, fieldNames) : transFormData;
|
|
133
133
|
setServiceData(serviceData);
|
|
134
134
|
case 9:
|
|
135
135
|
case "end":
|
|
@@ -194,7 +194,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
194
194
|
})) === null || _ref7$filter === void 0 ? void 0 : _ref7$filter.join(separator)) || '-' : (defaultLabel === null || defaultLabel === void 0 ? void 0 : (_defaultLabel$filter = defaultLabel.filter(function (item) {
|
|
195
195
|
return !!item;
|
|
196
196
|
})) === null || _defaultLabel$filter === void 0 ? void 0 : _defaultLabel$filter.join(separator)) || '-';
|
|
197
|
-
var
|
|
197
|
+
var _findSelectedOptions = function findSelectedOptions(options, value) {
|
|
198
198
|
var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
199
199
|
var _value = value !== null && value !== void 0 ? value : [];
|
|
200
200
|
// 基准情况:如果 value 数组为空,且 path 不为空,说明找到了完整的路径
|
|
@@ -213,7 +213,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
213
213
|
if (foundOption) {
|
|
214
214
|
// 如果找到了匹配的选项,并且还有更多的 value 需要匹配,递归地在子选项中查找
|
|
215
215
|
if (_value.length > 1 && foundOption.children) {
|
|
216
|
-
return
|
|
216
|
+
return _findSelectedOptions(foundOption.children, _value.slice(1), [].concat(_toConsumableArray(path), [foundOption]));
|
|
217
217
|
}
|
|
218
218
|
// 如果没有更多的 value 需要匹配,返回当前选项(以及之前的路径)
|
|
219
219
|
return [].concat(_toConsumableArray(path), [foundOption]);
|
|
@@ -221,7 +221,7 @@ var ProCascader = function ProCascader(props) {
|
|
|
221
221
|
// 如果没有在当前层级的选项中找到匹配的 value,返回 null
|
|
222
222
|
return null;
|
|
223
223
|
};
|
|
224
|
-
var _selectedOptions =
|
|
224
|
+
var _selectedOptions = _findSelectedOptions(service ? serviceData : realDataSource, addressValue);
|
|
225
225
|
var handleAddressChange = function handleAddressChange(e) {
|
|
226
226
|
var cascaderValue = value === null || value === void 0 ? void 0 : value.slice(0, realLevel);
|
|
227
227
|
if (onChange) {
|
|
@@ -12,5 +12,5 @@ export interface InputRangeProps {
|
|
|
12
12
|
isPositiveInteger?: boolean;
|
|
13
13
|
precision?: number;
|
|
14
14
|
}
|
|
15
|
-
declare const InputRange: ({ value, onChange, min, max, group, disabled, precision, isPositiveInteger, }: InputRangeProps) => JSX.Element;
|
|
15
|
+
declare const InputRange: ({ value, onChange, min, max, group, disabled, precision, isPositiveInteger, }: InputRangeProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export default InputRange;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ProAddressPropsType } from './propsTypes';
|
|
3
2
|
export declare const transferAddressInfoToRegion: () => {
|
|
4
3
|
normalize: (value: any) => {
|
|
@@ -24,5 +23,5 @@ export declare const transferAddressInfoToRegion: () => {
|
|
|
24
23
|
};
|
|
25
24
|
};
|
|
26
25
|
};
|
|
27
|
-
export declare function ProAddress({ ...props }: ProAddressPropsType): JSX.Element;
|
|
26
|
+
export declare function ProAddress({ ...props }: ProAddressPropsType): import("react/jsx-runtime").JSX.Element;
|
|
28
27
|
export default ProAddress;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ProRangeBoxPropsType } from './propsType';
|
|
3
|
-
export default function ProRangeBox({ configOption }: ProRangeBoxPropsType): JSX.Element;
|
|
2
|
+
export default function ProRangeBox({ configOption }: ProRangeBoxPropsType): import("react/jsx-runtime").JSX.Element;
|
package/es/ProForm/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormInstance } from 'antd';
|
|
2
2
|
import React, { ForwardRefRenderFunction } from 'react';
|
|
3
3
|
import { FormProviderProps } from 'antd/es/form/context';
|
|
4
4
|
import { ProFormProps } from './propsType';
|
|
5
5
|
import { useForm } from './utils/useForm';
|
|
6
|
+
import useWatch from './utils/useWatch';
|
|
6
7
|
interface IProForm<T = any> extends ForwardRefRenderFunction<FormInstance<T>, ProFormProps<T>> {
|
|
7
8
|
useForm: typeof useForm;
|
|
8
|
-
useWatch: typeof
|
|
9
|
+
useWatch: typeof useWatch;
|
|
9
10
|
[key: string]: any;
|
|
10
11
|
}
|
|
11
12
|
declare const ProFormForward: IProForm;
|
package/es/ProForm/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
16
16
|
import { DoubleLeftOutlined } from '@ant-design/icons';
|
|
17
17
|
import classnames from 'classnames';
|
|
18
18
|
import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
|
|
19
|
-
import { isObject,
|
|
19
|
+
import { isObject, merge } from 'lodash';
|
|
20
20
|
import { FormFooter, InputRange, ProAddress, ProCascader, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload, ProTreeModal, ProTree, EnumSelect } from './components';
|
|
21
21
|
import RenderFields from './components/render/RenderFields';
|
|
22
22
|
import { useProConfig, useContextForms } from '../ProConfigProvider';
|
|
@@ -24,6 +24,7 @@ import { getLayout, splitNameStr, useControlled, initialValuesToNames, filterInt
|
|
|
24
24
|
import { useForm } from './utils/useForm';
|
|
25
25
|
import { useFieldProps } from './utils/useFieldProps';
|
|
26
26
|
import locale from '../locale';
|
|
27
|
+
import useWatch from './utils/useWatch';
|
|
27
28
|
var ProForm = function ProForm(props, ref) {
|
|
28
29
|
var _forms$formKey, _localStorage, _ref;
|
|
29
30
|
var _props$mode = props.mode,
|
|
@@ -273,22 +274,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
273
274
|
// @ts-ignore
|
|
274
275
|
var ProFormForward = /*#__PURE__*/forwardRef(ProForm);
|
|
275
276
|
ProFormForward.useForm = useForm;
|
|
276
|
-
ProFormForward.useWatch =
|
|
277
|
-
if (isString(watchValue)) {
|
|
278
|
-
var watchValues = [watchValue];
|
|
279
|
-
watchValues.forEach(function (item) {
|
|
280
|
-
_Form.useWatch(item, form);
|
|
281
|
-
});
|
|
282
|
-
return form.getFieldsValue(watchValues);
|
|
283
|
-
}
|
|
284
|
-
if (watchValue.length) {
|
|
285
|
-
watchValue.forEach(function (item) {
|
|
286
|
-
_Form.useWatch(item, form);
|
|
287
|
-
});
|
|
288
|
-
return form.getFieldsValue(watchValue);
|
|
289
|
-
}
|
|
290
|
-
return _Form.useWatch([], form);
|
|
291
|
-
};
|
|
277
|
+
ProFormForward.useWatch = useWatch;
|
|
292
278
|
export var ProFormProvider = function ProFormProvider(props) {
|
|
293
279
|
var onFormChange = props.onFormChange,
|
|
294
280
|
onFormFinish = props.onFormFinish,
|
|
@@ -121,7 +121,7 @@ export var splitNameStr = function splitNameStr(name) {
|
|
|
121
121
|
});
|
|
122
122
|
};
|
|
123
123
|
// 过滤掉字段名中包含 '-' 的字段
|
|
124
|
-
|
|
124
|
+
var _filterInternalFields = function filterInternalFields(values, optimize) {
|
|
125
125
|
if (optimize) {
|
|
126
126
|
return values;
|
|
127
127
|
}
|
|
@@ -135,20 +135,21 @@ export var filterInternalFields = function filterInternalFields(values, optimize
|
|
|
135
135
|
}
|
|
136
136
|
if (Array.isArray(nextValues)) {
|
|
137
137
|
return nextValues.map(function (item) {
|
|
138
|
-
return
|
|
138
|
+
return _filterInternalFields(item);
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
if (isObject(nextValues)) {
|
|
142
142
|
var result = {};
|
|
143
143
|
Object.keys(nextValues).forEach(function (key) {
|
|
144
144
|
if (key.includes('-')) return;
|
|
145
|
-
result[key] =
|
|
145
|
+
result[key] = _filterInternalFields(nextValues[key]);
|
|
146
146
|
});
|
|
147
147
|
return result;
|
|
148
148
|
}
|
|
149
149
|
return nextValues;
|
|
150
150
|
};
|
|
151
|
-
export
|
|
151
|
+
export { _filterInternalFields as filterInternalFields };
|
|
152
|
+
var _getAllNamePath = function getAllNamePath(object) {
|
|
152
153
|
var currentPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
153
154
|
var keys = Object.keys(object);
|
|
154
155
|
var resultKeys = [];
|
|
@@ -162,13 +163,14 @@ export var getAllNamePath = function getAllNamePath(object) {
|
|
|
162
163
|
}
|
|
163
164
|
// 深度获取对象key
|
|
164
165
|
if (isObject(value)) {
|
|
165
|
-
resultKeys.concat(
|
|
166
|
+
resultKeys.concat(_getAllNamePath(value, [].concat(_toConsumableArray(currentPath), [key])));
|
|
166
167
|
}
|
|
167
168
|
resultKeys.push([].concat(_toConsumableArray(currentPath), [key]));
|
|
168
169
|
});
|
|
169
170
|
return resultKeys;
|
|
170
171
|
};
|
|
171
172
|
// 判断一个字段值是否算空
|
|
173
|
+
export { _getAllNamePath as getAllNamePath };
|
|
172
174
|
var nullList = [undefined, 'null', '""', '[]'];
|
|
173
175
|
export var isNullValue = function isNullValue(value) {
|
|
174
176
|
return nullList.includes(JSON.stringify(value));
|
|
@@ -353,7 +355,7 @@ export var customEqualForFun = function customEqualForFun(value, other) {
|
|
|
353
355
|
/**
|
|
354
356
|
* 查询数据中是否包含rowKey
|
|
355
357
|
*/
|
|
356
|
-
|
|
358
|
+
var _hasRowKey = function hasRowKey(obj) {
|
|
357
359
|
if (_typeof(obj) !== 'object' || obj === null) {
|
|
358
360
|
return false;
|
|
359
361
|
}
|
|
@@ -363,12 +365,13 @@ export var hasRowKey = function hasRowKey(obj) {
|
|
|
363
365
|
return true;
|
|
364
366
|
}
|
|
365
367
|
return keys.some(function (key) {
|
|
366
|
-
return
|
|
368
|
+
return _hasRowKey(obj[key]);
|
|
367
369
|
});
|
|
368
370
|
};
|
|
369
371
|
/**
|
|
370
372
|
* 查询数据中是否包含rowKey
|
|
371
373
|
*/
|
|
374
|
+
export { _hasRowKey as hasRowKey };
|
|
372
375
|
export var view = function view(obj) {
|
|
373
376
|
if (_typeof(obj) !== 'object' || obj === null) {
|
|
374
377
|
return false;
|
|
@@ -379,7 +382,7 @@ export var view = function view(obj) {
|
|
|
379
382
|
return true;
|
|
380
383
|
}
|
|
381
384
|
return keys.some(function (key) {
|
|
382
|
-
return
|
|
385
|
+
return _hasRowKey(obj[key]);
|
|
383
386
|
});
|
|
384
387
|
};
|
|
385
388
|
/**
|
|
@@ -415,7 +418,7 @@ export var deleteForPath = function deleteForPath(values, namePath) {
|
|
|
415
418
|
* @param value 选中值
|
|
416
419
|
* @returns {}
|
|
417
420
|
*/
|
|
418
|
-
|
|
421
|
+
var _findOptionByValue = function findOptionByValue(treeData, value, fieldNames) {
|
|
419
422
|
if (isObject(value)) {
|
|
420
423
|
return value;
|
|
421
424
|
}
|
|
@@ -425,7 +428,7 @@ export var findOptionByValue = function findOptionByValue(treeData, value, field
|
|
|
425
428
|
return omit(node, ['children', fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children]);
|
|
426
429
|
}
|
|
427
430
|
if (node.children) {
|
|
428
|
-
var foundNode =
|
|
431
|
+
var foundNode = _findOptionByValue(node[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'], value, fieldNames);
|
|
429
432
|
if (foundNode) {
|
|
430
433
|
return omit(foundNode, ['children', fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children]);
|
|
431
434
|
}
|
|
@@ -435,6 +438,7 @@ export var findOptionByValue = function findOptionByValue(treeData, value, field
|
|
|
435
438
|
/**
|
|
436
439
|
* 对比依赖列表中的 值是否变更
|
|
437
440
|
*/
|
|
441
|
+
export { _findOptionByValue as findOptionByValue };
|
|
438
442
|
export var equalDependencies = function equalDependencies(dependencies, prevValues, currentValues) {
|
|
439
443
|
if (dependencies === null || dependencies === void 0 ? void 0 : dependencies.length) {
|
|
440
444
|
return dependencies.some(function (namePath) {
|
|
@@ -22,6 +22,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
22
22
|
names = formItemProps.names,
|
|
23
23
|
dependencies = formItemProps.dependencies;
|
|
24
24
|
var timerRef = useRef();
|
|
25
|
+
var needClear = useRef(); // 是否需要执行清值操作
|
|
25
26
|
var showRef = useRef();
|
|
26
27
|
var disabledRef = useRef();
|
|
27
28
|
var requiredRef = useRef();
|
|
@@ -158,17 +159,24 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
158
159
|
}) : fieldProps;
|
|
159
160
|
// 清值防抖 多次刷新时以最后一次为准
|
|
160
161
|
if (clearNotShow !== false && (name || names)) {
|
|
162
|
+
// 当show为其他变为false的时候记录一次需要清值
|
|
163
|
+
if (_show !== showRef.current && _show === false) {
|
|
164
|
+
needClear.current = true;
|
|
165
|
+
}
|
|
161
166
|
if (_show === false) {
|
|
162
167
|
clearTimeout(timerRef.current);
|
|
163
168
|
timerRef.current = setTimeout(function () {
|
|
169
|
+
if (needClear.current !== true) return;
|
|
164
170
|
if (Array.isArray(names)) {
|
|
165
171
|
form.resetFields(names);
|
|
166
172
|
} else {
|
|
167
173
|
var clearName = formItemProps.namePath ? formItemProps.namePath.slice(0, -1).concat(formItemProps.name) : formItemProps.name;
|
|
168
174
|
form.resetFields([clearName]);
|
|
169
175
|
}
|
|
170
|
-
|
|
176
|
+
needClear.current = false;
|
|
177
|
+
}, 300);
|
|
171
178
|
} else {
|
|
179
|
+
needClear.current = false;
|
|
172
180
|
clearTimeout(timerRef.current);
|
|
173
181
|
}
|
|
174
182
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InternalNamePath, FormInstance, NamePath } from 'rc-field-form/es/interface';
|
|
2
|
+
export declare function toArray<T>(value?: T | T[] | null): T[];
|
|
3
|
+
export declare function getNamePath(path: NamePath | null): InternalNamePath;
|
|
4
|
+
export declare function stringify(value: any): string | number;
|
|
5
|
+
declare function useWatch(dependencies: string, form?: FormInstance, wait?: number): any;
|
|
6
|
+
declare function useWatch(dependencies: NamePath[], form?: FormInstance, wait?: number): any[];
|
|
7
|
+
export default useWatch;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import { debounce } from 'lodash';
|
|
3
|
+
import { HOOK_MARK } from 'rc-field-form/es/FieldContext';
|
|
4
|
+
import warning from 'rc-util/lib/warning';
|
|
5
|
+
import { useState, useEffect, useRef, useMemo } from 'react';
|
|
6
|
+
export function toArray(value) {
|
|
7
|
+
if (value === undefined || value === null) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
return Array.isArray(value) ? value : [value];
|
|
11
|
+
}
|
|
12
|
+
export function getNamePath(path) {
|
|
13
|
+
return toArray(path);
|
|
14
|
+
}
|
|
15
|
+
export function stringify(value) {
|
|
16
|
+
try {
|
|
17
|
+
return JSON.stringify(value);
|
|
18
|
+
} catch (err) {
|
|
19
|
+
return Math.random();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// 创建之后namepath就不可变
|
|
23
|
+
var useWatchWarning = process.env.NODE_ENV !== 'production' ? function (namePath) {
|
|
24
|
+
var fullyStr = JSON.stringify(namePath);
|
|
25
|
+
var nameStrRef = useRef(fullyStr);
|
|
26
|
+
warning(nameStrRef.current === fullyStr, '`useWatch` is not support dynamic `namePath`. Please provide static instead.');
|
|
27
|
+
} : function () {};
|
|
28
|
+
function useWatch(dependencies, form, wait) {
|
|
29
|
+
var isSingle = typeof dependencies === 'string';
|
|
30
|
+
var _useState = useState({}),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
value = _useState2[0],
|
|
33
|
+
setValue = _useState2[1];
|
|
34
|
+
var valueStr = useMemo(function () {
|
|
35
|
+
return stringify(value);
|
|
36
|
+
}, [value]);
|
|
37
|
+
var valueStrRef = useRef(valueStr);
|
|
38
|
+
valueStrRef.current = valueStr;
|
|
39
|
+
var formInstance = form;
|
|
40
|
+
var isValidForm = formInstance && formInstance._init;
|
|
41
|
+
var _dependencies = isSingle ? [dependencies] : dependencies;
|
|
42
|
+
var namePaths = _dependencies === null || _dependencies === void 0 ? void 0 : _dependencies.map(function (item) {
|
|
43
|
+
return getNamePath(item);
|
|
44
|
+
});
|
|
45
|
+
var namePathsRef = useRef(namePaths);
|
|
46
|
+
namePathsRef.current = namePaths;
|
|
47
|
+
useWatchWarning(namePaths);
|
|
48
|
+
useEffect(function () {
|
|
49
|
+
if (!isValidForm) return;
|
|
50
|
+
var getFieldsValue = formInstance.getFieldsValue,
|
|
51
|
+
getInternalHooks = formInstance.getInternalHooks;
|
|
52
|
+
var _getInternalHooks = getInternalHooks(HOOK_MARK),
|
|
53
|
+
registerWatch = _getInternalHooks.registerWatch;
|
|
54
|
+
var callback = function callback() {
|
|
55
|
+
var newValue = getFieldsValue(_dependencies);
|
|
56
|
+
var nextValueStr = stringify(newValue);
|
|
57
|
+
// Compare stringify in case it's nest object
|
|
58
|
+
if (valueStrRef.current !== nextValueStr) {
|
|
59
|
+
valueStrRef.current = nextValueStr;
|
|
60
|
+
setValue(getFieldsValue(_dependencies));
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
// 增加防抖
|
|
64
|
+
if (wait) {
|
|
65
|
+
callback = debounce(callback, wait);
|
|
66
|
+
}
|
|
67
|
+
var cancelRegister = registerWatch(callback);
|
|
68
|
+
var initialValue = getFieldsValue(_dependencies);
|
|
69
|
+
setValue(initialValue);
|
|
70
|
+
return cancelRegister;
|
|
71
|
+
},
|
|
72
|
+
// We do not need re-register since namePath content is the same
|
|
73
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
74
|
+
[isValidForm]);
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
export default useWatch;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import { themeMap, themeFillMap } from '../config';
|
|
3
|
-
|
|
3
|
+
var _recurseGetNodes = function recurseGetNodes(type, node, queue) {
|
|
4
4
|
switch (type) {
|
|
5
5
|
// 渐变
|
|
6
6
|
case 'gradation':
|
|
@@ -19,10 +19,11 @@ export var recurseGetNodes = function recurseGetNodes(type, node, queue) {
|
|
|
19
19
|
}
|
|
20
20
|
if (node.childNodes) {
|
|
21
21
|
for (var i = 0; i < node.childNodes.length; i++) {
|
|
22
|
-
|
|
22
|
+
_recurseGetNodes(type, node.childNodes[i], queue);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
+
export { _recurseGetNodes as recurseGetNodes };
|
|
26
27
|
export var onBeforeInjection = function onBeforeInjection(_ref) {
|
|
27
28
|
var svg = _ref.svg,
|
|
28
29
|
actionMap = _ref.actionMap,
|
|
@@ -49,7 +50,7 @@ export var onBeforeInjection = function onBeforeInjection(_ref) {
|
|
|
49
50
|
// 目前只支持处理渐变及fill填充
|
|
50
51
|
var types = Reflect.ownKeys(nodeMap !== null && nodeMap !== void 0 ? nodeMap : {});
|
|
51
52
|
types.forEach(function (typeKey) {
|
|
52
|
-
|
|
53
|
+
_recurseGetNodes(typeKey, svg, nodeMap[typeKey]);
|
|
53
54
|
});
|
|
54
55
|
if ((gradList === null || gradList === void 0 ? void 0 : gradList.length) > 0) {
|
|
55
56
|
nodeMap.gradation.forEach(function (item, index) {
|
|
@@ -50,7 +50,7 @@ var OpenMenu = function OpenMenu(props) {
|
|
|
50
50
|
if (!Array.isArray(result) || !result.length) {
|
|
51
51
|
return [];
|
|
52
52
|
}
|
|
53
|
-
var
|
|
53
|
+
var _menuDeep = function menuDeep(data) {
|
|
54
54
|
data.forEach(function (item) {
|
|
55
55
|
var _item$keyIdPath, _item$keyIdPath2, _item$children;
|
|
56
56
|
// 是否是第一级菜单,展开模式一级菜单有icon, 收起模式二级菜单有icon
|
|
@@ -91,7 +91,7 @@ var OpenMenu = function OpenMenu(props) {
|
|
|
91
91
|
if ((_item === null || _item === void 0 ? void 0 : _item.hideInMenu) || ['TAB', 'QUERY', 'BUTTON'].includes(_item === null || _item === void 0 ? void 0 : _item.type)) {
|
|
92
92
|
delete item.children;
|
|
93
93
|
} else {
|
|
94
|
-
|
|
94
|
+
_menuDeep(item.children);
|
|
95
95
|
}
|
|
96
96
|
} else {
|
|
97
97
|
delete item.children;
|
|
@@ -99,7 +99,7 @@ var OpenMenu = function OpenMenu(props) {
|
|
|
99
99
|
});
|
|
100
100
|
return data;
|
|
101
101
|
};
|
|
102
|
-
|
|
102
|
+
_menuDeep(result);
|
|
103
103
|
return result;
|
|
104
104
|
}, [dataSource]);
|
|
105
105
|
useDeepCompareEffect(function () {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ProFooterProps } from './PropTypes';
|
|
3
|
-
declare const _default: import("react").MemoExoticComponent<(props: ProFooterProps) => JSX.Element>;
|
|
3
|
+
declare const _default: import("react").MemoExoticComponent<(props: ProFooterProps) => import("react/jsx-runtime").JSX.Element>;
|
|
4
4
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ProHeaderProps } from './PropTypes';
|
|
3
|
-
declare const _default: React.MemoExoticComponent<(props: ProHeaderProps) => JSX.Element>;
|
|
3
|
+
declare const _default: React.MemoExoticComponent<(props: ProHeaderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
4
4
|
export default _default;
|
package/es/ProLayout/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const LayoutContext: import("react").Context<{
|
|
|
5
5
|
onSelected: (params: any) => void;
|
|
6
6
|
}>;
|
|
7
7
|
declare const ProLayout: {
|
|
8
|
-
(props: ProLayoutProps): JSX.Element;
|
|
8
|
+
(props: ProLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
defaultProps: {
|
|
10
10
|
menus: any[];
|
|
11
11
|
iconfontUrl: string;
|
|
@@ -17,8 +17,8 @@ declare const ProLayout: {
|
|
|
17
17
|
headerHeight: number;
|
|
18
18
|
contentStyle: {};
|
|
19
19
|
};
|
|
20
|
-
ProCollapse: (props: import("./components/ProCollapse/PropTypes").ProCollapseProps) => JSX.Element;
|
|
21
|
-
ProFooter: import("react").MemoExoticComponent<(props: import("./components/ProFooter/PropTypes").ProFooterProps) => JSX.Element>;
|
|
22
|
-
ProHeader: import("react").MemoExoticComponent<(props: import("./components/ProHeader/PropTypes").ProHeaderProps) => JSX.Element>;
|
|
20
|
+
ProCollapse: (props: import("./components/ProCollapse/PropTypes").ProCollapseProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
ProFooter: import("react").MemoExoticComponent<(props: import("./components/ProFooter/PropTypes").ProFooterProps) => import("react/jsx-runtime").JSX.Element>;
|
|
22
|
+
ProHeader: import("react").MemoExoticComponent<(props: import("./components/ProHeader/PropTypes").ProHeaderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
23
23
|
};
|
|
24
24
|
export default ProLayout;
|