@zat-design/sisyphus-react 4.0.0-beta.3 → 4.0.0-beta.4
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/babel.config.js +7 -30
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/regExp/index.d.ts +19 -0
- package/dist/esm/regExp/index.js +73 -0
- package/dist/esm/tools/calc/index.d.ts +4 -0
- package/dist/esm/tools/calc/index.js +67 -0
- package/dist/esm/tools/dateUtils.d.ts +7 -0
- package/dist/esm/tools/dateUtils.js +23 -0
- package/dist/esm/tools/disableDate/index.d.ts +9 -0
- package/dist/esm/tools/disableDate/index.js +43 -0
- package/dist/esm/tools/disableTimeRange/index.d.ts +9 -0
- package/dist/esm/tools/disableTimeRange/index.js +121 -0
- package/dist/esm/tools/formatAmount/index.d.ts +7 -0
- package/dist/esm/tools/formatAmount/index.js +14 -0
- package/dist/esm/tools/formatPerMill/index.d.ts +7 -0
- package/dist/esm/tools/formatPerMill/index.js +11 -0
- package/dist/esm/tools/formatPercent/index.d.ts +7 -0
- package/dist/esm/tools/formatPercent/index.js +11 -0
- package/dist/esm/tools/getDataByIdCard/index.d.ts +16 -0
- package/dist/esm/tools/getDataByIdCard/index.js +65 -0
- package/dist/esm/tools/index.d.ts +12 -0
- package/dist/esm/tools/index.js +14 -0
- package/dist/esm/tools/sumAmount/index.d.ts +16 -0
- package/dist/esm/tools/sumAmount/index.js +40 -0
- package/dist/esm/tools/toChineseNum/index.d.ts +7 -0
- package/dist/esm/tools/toChineseNum/index.js +103 -0
- package/dist/esm/tools/toFixed/index.d.ts +2 -0
- package/dist/esm/tools/toFixed/index.js +5 -0
- package/dist/esm/tools/transformDataName/index.d.ts +12 -0
- package/dist/esm/tools/transformDataName/index.js +37 -0
- package/dist/esm/transforms/dateTransformer/index.d.ts +24 -0
- package/dist/esm/transforms/dateTransformer/index.js +67 -0
- package/dist/esm/transforms/index.d.ts +6 -0
- package/dist/esm/transforms/index.js +6 -0
- package/dist/esm/transforms/propTypes.d.ts +7 -0
- package/dist/esm/transforms/propTypes.js +1 -0
- package/dist/esm/transforms/transformDate/index.d.ts +21 -0
- package/dist/esm/transforms/transformDate/index.js +141 -0
- package/dist/esm/transforms/transformDatePicker/index.d.ts +12 -0
- package/dist/esm/transforms/transformDatePicker/index.js +24 -0
- package/dist/esm/transforms/transformRangePicker/index.d.ts +29 -0
- package/dist/esm/transforms/transformRangePicker/index.js +61 -0
- package/dist/esm/transforms/transformSwitch/index.d.ts +13 -0
- package/dist/esm/transforms/transformSwitch/index.js +35 -0
- package/dist/esm/transforms/utils.d.ts +2 -0
- package/dist/esm/transforms/utils.js +8 -0
- package/dist/esm/validate/index.d.ts +107 -0
- package/dist/esm/validate/index.js +284 -0
- package/es/ProAction/index.less +0 -2
- package/es/ProConfigProvider/index.d.ts +1 -0
- package/es/ProConfigProvider/index.js +4 -5
- package/es/ProDownload/style/index.less +0 -2
- package/es/ProDrawerForm/index.js +33 -29
- package/es/ProDrawerForm/style/index.less +0 -2
- package/es/ProEditLabel/style/index.less +0 -2
- package/es/ProEditTable/components/RcTable/DraggableTable.js +1 -1
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +14 -2
- package/es/ProEditTable/propsType.d.ts +1 -1
- package/es/ProEditTable/style/index.less +2 -4
- package/es/ProEditTable/utils/diffOriginal.d.ts +1 -0
- package/es/ProEditTable/utils/diffOriginal.js +68 -1
- package/es/ProEnum/hooks/useEnum.js +5 -0
- package/es/ProEnum/style/index.less +0 -2
- package/es/ProForm/components/FormFooter/index.js +6 -6
- package/es/ProForm/components/base/DatePicker/index.js +19 -34
- package/es/ProForm/components/base/SwitchCheckbox/style/index.less +0 -2
- package/es/ProForm/components/base/TextArea/index.less +0 -2
- package/es/ProForm/components/base/TimePicker/style/index.less +0 -2
- package/es/ProForm/components/combination/Container/style/index.less +0 -2
- package/es/ProForm/components/combination/FormList/style/index.less +0 -2
- package/es/ProForm/components/combination/Group/component/ComRender.js +9 -8
- package/es/ProForm/components/combination/Group/hooks/index.js +17 -4
- package/es/ProForm/components/combination/Group/index.d.ts +8 -2
- package/es/ProForm/components/combination/Group/index.js +10 -16
- package/es/ProForm/components/combination/ProCascader/index.js +106 -52
- package/es/ProForm/components/combination/ProCascader/propsType.d.ts +12 -4
- package/es/ProForm/components/combination/ProCascader/style/index.less +1 -3
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -4
- package/es/ProForm/components/combination/ProModalSelect/index.js +38 -64
- package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
- package/es/ProForm/components/combination/ProModalSelect/style/index.less +1 -4
- package/es/ProForm/components/combination/ProNumberRange/style/index.less +4 -3
- package/es/ProForm/components/combination/ProTimeLimit/style/index.less +0 -2
- package/es/ProForm/components/render/ChangedWrapper.js +2 -2
- package/es/ProForm/components/render/Render.js +17 -5
- package/es/ProForm/components/render/RenderFields.d.ts +1 -0
- package/es/ProForm/components/render/RenderFields.js +4 -2
- package/es/ProForm/components/render/propsType.d.ts +1 -0
- package/es/ProForm/index.d.ts +2 -2
- package/es/ProForm/index.js +5 -2
- package/es/ProForm/propsType.d.ts +2 -0
- package/es/ProForm/style/index.less +0 -2
- package/es/ProForm/utils/diffOriginal.d.ts +1 -0
- package/es/ProForm/utils/diffOriginal.js +66 -1
- package/es/ProForm/utils/index.js +1 -1
- package/es/ProForm/utils/useShouldUpdate.d.ts +1 -0
- package/es/ProForm/utils/useShouldUpdate.js +89 -3
- package/es/ProIcon/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +60 -8
- package/es/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +25 -3
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +3 -1
- package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Menu/index.js +4 -1
- package/es/ProLayout/components/Layout/Menu/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Notice/style/index.less +0 -2
- package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +8 -3
- package/es/ProLayout/components/ProCollapse/index.js +27 -3
- package/es/ProLayout/components/ProCollapse/style/index.less +148 -4
- package/es/ProLayout/components/ProFooter/style/index.less +0 -2
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +0 -2
- package/es/ProLayout/components/ProHeader/style/index.less +0 -2
- package/es/ProLayout/index.d.ts +0 -11
- package/es/ProLayout/index.js +60 -32
- package/es/ProLayout/propTypes.d.ts +9 -0
- package/es/ProLayout/style/index.less +0 -2
- package/es/ProLayout/utils/index.d.ts +7 -0
- package/es/ProLayout/utils/index.js +30 -0
- package/es/ProSelect/index.less +0 -2
- package/es/ProSelect/utils/index.js +62 -1
- package/es/ProStep/components/Item/index.js +1 -2
- package/es/ProStep/style/index.less +0 -2
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +1 -1
- package/es/ProTable/hooks/useAntdTable.d.ts +3 -0
- package/es/ProTable/hooks/useAntdTable.js +92 -64
- package/es/ProTable/index.d.ts +3 -7
- package/es/ProTable/index.js +14 -14
- package/es/ProTable/propsType.d.ts +3 -2
- package/es/ProTable/style/index.less +4 -6
- package/es/ProTabs/style/index.less +0 -2
- package/es/ProThemeTools/index.d.ts +0 -7
- package/es/ProThemeTools/index.js +10 -12
- package/es/ProThemeTools/style/index.less +0 -2
- package/es/ProTooltip/style/index.less +0 -2
- package/es/ProTree/components/ProTreeSelect/style/index.less +0 -2
- package/es/ProTree/style/index.less +0 -2
- package/es/ProTreeModal/style/index.less +0 -2
- package/es/ProUpload/style/index.less +0 -2
- package/es/ProViewer/style/index.less +0 -2
- package/es/style/theme/antd.less +0 -2
- package/jest.config.js +46 -4
- package/lib/ProAction/index.less +0 -2
- package/lib/ProConfigProvider/index.d.ts +1 -0
- package/lib/ProConfigProvider/index.js +4 -3
- package/lib/ProDownload/style/index.less +0 -2
- package/lib/ProDrawerForm/index.js +25 -28
- package/lib/ProDrawerForm/style/index.less +0 -2
- package/lib/ProEditLabel/style/index.less +0 -2
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +1 -1
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +10 -2
- package/lib/ProEditTable/propsType.d.ts +1 -1
- package/lib/ProEditTable/style/index.less +2 -4
- package/lib/ProEditTable/utils/diffOriginal.d.ts +1 -0
- package/lib/ProEditTable/utils/diffOriginal.js +48 -1
- package/lib/ProEnum/hooks/useEnum.js +3 -0
- package/lib/ProEnum/style/index.less +0 -2
- package/lib/ProForm/components/FormFooter/index.js +6 -5
- package/lib/ProForm/components/base/DatePicker/index.js +21 -33
- package/lib/ProForm/components/base/SwitchCheckbox/style/index.less +0 -2
- package/lib/ProForm/components/base/TextArea/index.less +0 -2
- package/lib/ProForm/components/base/TimePicker/style/index.less +0 -2
- package/lib/ProForm/components/combination/Container/style/index.less +0 -2
- package/lib/ProForm/components/combination/FormList/style/index.less +0 -2
- package/lib/ProForm/components/combination/Group/component/ComRender.js +8 -7
- package/lib/ProForm/components/combination/Group/hooks/index.js +8 -2
- package/lib/ProForm/components/combination/Group/index.d.ts +8 -2
- package/lib/ProForm/components/combination/Group/index.js +8 -13
- package/lib/ProForm/components/combination/ProCascader/index.js +73 -16
- package/lib/ProForm/components/combination/ProCascader/propsType.d.ts +12 -4
- package/lib/ProForm/components/combination/ProCascader/style/index.less +1 -3
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -2
- package/lib/ProForm/components/combination/ProModalSelect/index.js +26 -52
- package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
- package/lib/ProForm/components/combination/ProModalSelect/style/index.less +1 -4
- package/lib/ProForm/components/combination/ProNumberRange/style/index.less +4 -3
- package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +0 -2
- package/lib/ProForm/components/render/ChangedWrapper.js +2 -2
- package/lib/ProForm/components/render/Render.js +11 -3
- package/lib/ProForm/components/render/RenderFields.d.ts +1 -0
- package/lib/ProForm/components/render/RenderFields.js +4 -2
- package/lib/ProForm/components/render/propsType.d.ts +1 -0
- package/lib/ProForm/index.d.ts +2 -2
- package/lib/ProForm/index.js +3 -1
- package/lib/ProForm/propsType.d.ts +2 -0
- package/lib/ProForm/style/index.less +0 -2
- package/lib/ProForm/utils/diffOriginal.d.ts +1 -0
- package/lib/ProForm/utils/diffOriginal.js +48 -1
- package/lib/ProForm/utils/index.js +1 -1
- package/lib/ProForm/utils/useShouldUpdate.d.ts +1 -0
- package/lib/ProForm/utils/useShouldUpdate.js +50 -1
- package/lib/ProIcon/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +33 -4
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +7 -2
- package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +2 -1
- package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Menu/index.js +4 -1
- package/lib/ProLayout/components/Layout/Menu/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Notice/style/index.less +0 -2
- package/lib/ProLayout/components/ProCollapse/PropTypes.d.ts +8 -3
- package/lib/ProLayout/components/ProCollapse/index.js +27 -3
- package/lib/ProLayout/components/ProCollapse/style/index.less +148 -4
- package/lib/ProLayout/components/ProFooter/style/index.less +0 -2
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +0 -2
- package/lib/ProLayout/components/ProHeader/style/index.less +0 -2
- package/lib/ProLayout/index.d.ts +0 -11
- package/lib/ProLayout/index.js +51 -32
- package/lib/ProLayout/propTypes.d.ts +9 -0
- package/lib/ProLayout/style/index.less +0 -2
- package/lib/ProLayout/utils/index.d.ts +7 -0
- package/lib/ProLayout/utils/index.js +15 -0
- package/lib/ProSelect/index.less +0 -2
- package/lib/ProSelect/utils/index.js +34 -5
- package/lib/ProStep/components/Item/index.js +1 -2
- package/lib/ProStep/style/index.less +0 -2
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +1 -1
- package/lib/ProTable/hooks/useAntdTable.d.ts +3 -0
- package/lib/ProTable/hooks/useAntdTable.js +71 -36
- package/lib/ProTable/index.d.ts +3 -7
- package/lib/ProTable/index.js +8 -13
- package/lib/ProTable/propsType.d.ts +3 -2
- package/lib/ProTable/style/index.less +4 -6
- package/lib/ProTabs/style/index.less +0 -2
- package/lib/ProThemeTools/index.d.ts +0 -7
- package/lib/ProThemeTools/index.js +5 -12
- package/lib/ProThemeTools/style/index.less +0 -2
- package/lib/ProTooltip/style/index.less +0 -2
- package/lib/ProTree/components/ProTreeSelect/style/index.less +0 -2
- package/lib/ProTree/style/index.less +0 -2
- package/lib/ProTreeModal/style/index.less +0 -2
- package/lib/ProUpload/style/index.less +0 -2
- package/lib/ProViewer/style/index.less +0 -2
- package/lib/style/theme/antd.less +0 -2
- package/package.json +7 -6
- package/tests/__mocks__/fileMock.js +1 -0
- package/tests/__mocks__/zatUtils.js +27 -0
- package/tests/setup.ts +484 -0
- package/tests/test-utils.tsx +81 -0
- package/dist/index.esm.css +0 -6445
- package/dist/index.esm.js +0 -3
- package/dist/less.esm.css +0 -5871
- package/dist/less.esm.js +0 -3
@@ -26,7 +26,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
27
27
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
28
28
|
var Render = function Render(props) {
|
29
|
-
var _ref2, _ref3, _ref4, _ref5, _otherProps$
|
29
|
+
var _ref2, _ref3, _ref4, _ref5, _otherProps$names3;
|
30
30
|
var component = props.component,
|
31
31
|
originComponent = props.originComponent,
|
32
32
|
_props$formItemProps = props.formItemProps,
|
@@ -47,7 +47,8 @@ var Render = function Render(props) {
|
|
47
47
|
globalControl = props.globalControl,
|
48
48
|
diffConfig = props.diffConfig,
|
49
49
|
viewRender = props.viewRender,
|
50
|
-
desensitization = props.desensitization
|
50
|
+
desensitization = props.desensitization,
|
51
|
+
shouldUpdateDebounce = props.shouldUpdateDebounce;
|
51
52
|
var colProps = props.colProps;
|
52
53
|
|
53
54
|
// 剔除一些不是FormItem的属性, 防止控制台报warning
|
@@ -76,7 +77,8 @@ var Render = function Render(props) {
|
|
76
77
|
component: component,
|
77
78
|
originComponent: originComponent,
|
78
79
|
type: type,
|
79
|
-
desensitization: desensitization
|
80
|
+
desensitization: desensitization,
|
81
|
+
shouldUpdateDebounce: shouldUpdateDebounce
|
80
82
|
}),
|
81
83
|
shouldUpdate = _useShouldUpdate.shouldUpdate,
|
82
84
|
_show = _useShouldUpdate.show,
|
@@ -467,9 +469,19 @@ var Render = function Render(props) {
|
|
467
469
|
});
|
468
470
|
}
|
469
471
|
if (diffConfig !== null && diffConfig !== void 0 && diffConfig.originalValues) {
|
472
|
+
var _otherProps$namePath, _otherProps$names2;
|
473
|
+
var nextNames = otherProps.names;
|
474
|
+
// FormList中的names字段需要去除前缀
|
475
|
+
if (otherProps !== null && otherProps !== void 0 && (_otherProps$namePath = otherProps.namePath) !== null && _otherProps$namePath !== void 0 && _otherProps$namePath.length && (_otherProps$names2 = otherProps.names) !== null && _otherProps$names2 !== void 0 && _otherProps$names2.length) {
|
476
|
+
var _otherProps$namePath2;
|
477
|
+
var prefixLength = (otherProps === null || otherProps === void 0 || (_otherProps$namePath2 = otherProps.namePath) === null || _otherProps$namePath2 === void 0 ? void 0 : _otherProps$namePath2.length) - 1;
|
478
|
+
nextNames = otherProps.names.map(function (name) {
|
479
|
+
return name.slice(prefixLength);
|
480
|
+
});
|
481
|
+
}
|
470
482
|
child = /*#__PURE__*/_jsx(ChangedWrapper, {
|
471
483
|
name: formItemProps.name,
|
472
|
-
names:
|
484
|
+
names: nextNames,
|
473
485
|
namesStr: namesStr,
|
474
486
|
diffConfig: diffConfig,
|
475
487
|
form: form,
|
@@ -501,7 +513,7 @@ var Render = function Render(props) {
|
|
501
513
|
children: function children() {
|
502
514
|
return renderItem();
|
503
515
|
}
|
504
|
-
}) : renderItem(), otherProps !== null && otherProps !== void 0 && (_otherProps$
|
516
|
+
}) : renderItem(), otherProps !== null && otherProps !== void 0 && (_otherProps$names3 = otherProps.names) !== null && _otherProps$names3 !== void 0 && _otherProps$names3.length ? otherProps.names.map(function (name) {
|
505
517
|
return /*#__PURE__*/_jsx(Form.Item, {
|
506
518
|
hidden: true,
|
507
519
|
name: name,
|
@@ -21,6 +21,7 @@ interface Props<T = any> {
|
|
21
21
|
required?: boolean | boolean[] | (() => boolean | boolean[]);
|
22
22
|
globalControl?: boolean;
|
23
23
|
desensitizationKey?: string;
|
24
|
+
shouldUpdateDebounce?: number;
|
24
25
|
}
|
25
26
|
declare const RenderFields: React.FC<Props>;
|
26
27
|
export default RenderFields;
|
@@ -29,7 +29,8 @@ var RenderFields = function RenderFields(props) {
|
|
29
29
|
required = props.required,
|
30
30
|
diffConfig = props.diffConfig,
|
31
31
|
globalControl = props.globalControl,
|
32
|
-
desensitizationKey = props.desensitizationKey
|
32
|
+
desensitizationKey = props.desensitizationKey,
|
33
|
+
shouldUpdateDebounce = props.shouldUpdateDebounce;
|
33
34
|
|
34
35
|
// 是否包含隐藏字段
|
35
36
|
var hiddenData = columns.filter(function (item) {
|
@@ -240,7 +241,8 @@ var RenderFields = function RenderFields(props) {
|
|
240
241
|
requiredOnView: requiredOnView,
|
241
242
|
globalControl: globalControl,
|
242
243
|
viewRender: viewRender,
|
243
|
-
desensitization: desensitization
|
244
|
+
desensitization: desensitization,
|
245
|
+
shouldUpdateDebounce: shouldUpdateDebounce
|
244
246
|
})
|
245
247
|
}, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
|
246
248
|
});
|
package/es/ProForm/index.d.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import { FormInstance } from 'antd';
|
2
|
-
import React
|
2
|
+
import React from 'react';
|
3
3
|
import { FormProviderProps } from 'antd/es/form/context';
|
4
4
|
import type { ProFormType } from './propsType';
|
5
5
|
import { useForm } from './utils/useForm';
|
6
6
|
import useWatch from './utils/useWatch';
|
7
7
|
import { useForms } from '../FormsProvider';
|
8
|
-
interface IProForm<T = any> extends
|
8
|
+
interface IProForm<T = any> extends React.ForwardRefExoticComponent<ProFormType<T> & React.RefAttributes<FormInstance<T>>> {
|
9
9
|
useForm: typeof useForm;
|
10
10
|
useWatch: typeof useWatch;
|
11
11
|
useFormInstances: typeof useForms;
|
package/es/ProForm/index.js
CHANGED
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
6
|
-
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "diffConfig", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "formKey", "globalControl", "scrollToError", "optimize", "desensitizationKey", "stopOnFirstError"];
|
6
|
+
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "diffConfig", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "formKey", "globalControl", "scrollToError", "optimize", "desensitizationKey", "stopOnFirstError", "shouldUpdateDebounce"];
|
7
7
|
import { DoubleLeftOutlined } from '@ant-design/icons';
|
8
8
|
import { Col, Form, Row, Space } from 'antd';
|
9
9
|
import classnames from 'classnames';
|
@@ -69,6 +69,8 @@ var ProForm = function ProForm(props, ref) {
|
|
69
69
|
desensitizationKey = _props$desensitizatio === void 0 ? 'zat-design-pro-component-desensitization' : _props$desensitizatio,
|
70
70
|
_props$stopOnFirstErr = props.stopOnFirstError,
|
71
71
|
stopOnFirstError = _props$stopOnFirstErr === void 0 ? false : _props$stopOnFirstErr,
|
72
|
+
_props$shouldUpdateDe = props.shouldUpdateDebounce,
|
73
|
+
shouldUpdateDebounce = _props$shouldUpdateDe === void 0 ? 500 : _props$shouldUpdateDe,
|
72
74
|
otherProps = _objectWithoutProperties(props, _excluded);
|
73
75
|
var config = useProConfig('ProForm');
|
74
76
|
// source: 用于区分是哪个组件调用,用于错误提示
|
@@ -262,7 +264,8 @@ var ProForm = function ProForm(props, ref) {
|
|
262
264
|
requiredOnView: requiredOnView,
|
263
265
|
required: required,
|
264
266
|
globalControl: globalControl,
|
265
|
-
desensitizationKey: desensitizationKey
|
267
|
+
desensitizationKey: desensitizationKey,
|
268
|
+
shouldUpdateDebounce: shouldUpdateDebounce
|
266
269
|
}), footerRender()]
|
267
270
|
})), children]
|
268
271
|
}));
|
@@ -103,6 +103,8 @@ export interface ProFormType<Values = any> extends FormProps<Values> {
|
|
103
103
|
desensitizationKey?: string;
|
104
104
|
/** 是否在遇到第一个错误时停止验证 */
|
105
105
|
stopOnFirstError?: boolean;
|
106
|
+
/** shouldUpdate防抖延迟时间,默认500ms,设置为0则不防抖 */
|
107
|
+
shouldUpdateDebounce?: number;
|
106
108
|
}
|
107
109
|
export interface TransformType<T = any> {
|
108
110
|
normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
|
@@ -1,5 +1,3 @@
|
|
1
|
-
/* @root-entry-name: 'default'; */
|
2
|
-
/* @import (reference) '~antd/es/style/themes/index.less'; */
|
3
1
|
@import '../components/base/SwitchCheckbox/style/index.less';
|
4
2
|
@import '../components/base/TimePicker/style/index.less';
|
5
3
|
@import '../components/base/TextArea/index.less';
|
@@ -1,5 +1,63 @@
|
|
1
1
|
import { isEqual, isFunction, isObject } from 'lodash';
|
2
2
|
import { isEmpty } from "../../utils";
|
3
|
+
|
4
|
+
// 比较策略接口
|
5
|
+
|
6
|
+
// 数字类型标准化函数
|
7
|
+
var normalizeNumberValue = function normalizeNumberValue(value) {
|
8
|
+
if (value === null || value === undefined || value === '') return null;
|
9
|
+
var num = Number(value);
|
10
|
+
return Number.isNaN(num) ? null : num;
|
11
|
+
};
|
12
|
+
|
13
|
+
// InputNumber 比较策略
|
14
|
+
var inputNumberStrategy = {
|
15
|
+
compare: function compare(val1, val2) {
|
16
|
+
var num1 = normalizeNumberValue(val1);
|
17
|
+
var num2 = normalizeNumberValue(val2);
|
18
|
+
return num1 === num2;
|
19
|
+
}
|
20
|
+
};
|
21
|
+
|
22
|
+
// ProNumberRange 比较策略
|
23
|
+
var proNumberRangeStrategy = {
|
24
|
+
compare: function compare(val1, val2) {
|
25
|
+
if (!Array.isArray(val1) || !Array.isArray(val2)) return false;
|
26
|
+
if (val1.length !== val2.length) return false;
|
27
|
+
return val1.every(function (item, index) {
|
28
|
+
var num1 = normalizeNumberValue(item);
|
29
|
+
var num2 = normalizeNumberValue(val2[index]);
|
30
|
+
return num1 === num2;
|
31
|
+
});
|
32
|
+
}
|
33
|
+
};
|
34
|
+
|
35
|
+
// 数字类型处理函数
|
36
|
+
var handleNumberTypeDiff = function handleNumberTypeDiff(params) {
|
37
|
+
var originalValue = params.originalValue,
|
38
|
+
value = params.value,
|
39
|
+
type = params.type;
|
40
|
+
var isEmptyVal = isEmpty(value);
|
41
|
+
var isEmptyOrg = isEmpty(originalValue);
|
42
|
+
|
43
|
+
// 都为空视为相等
|
44
|
+
if (isEmptyOrg && isEmptyVal) return 'same';
|
45
|
+
|
46
|
+
// 如果原始值为空 且当前有值的话 视为新增
|
47
|
+
if (isEmptyOrg && !isEmptyVal) return 'add';
|
48
|
+
|
49
|
+
// 根据类型选择对应的比较策略
|
50
|
+
var compareStrategy;
|
51
|
+
if (type === 'InputNumber') {
|
52
|
+
compareStrategy = inputNumberStrategy;
|
53
|
+
} else if (type === 'ProNumberRange') {
|
54
|
+
compareStrategy = proNumberRangeStrategy;
|
55
|
+
} else {
|
56
|
+
return 'changed'; // 未知类型视为已改变
|
57
|
+
}
|
58
|
+
return compareStrategy.compare(value, originalValue) ? 'same' : 'changed';
|
59
|
+
};
|
60
|
+
|
3
61
|
// 过滤对象中undefined字段
|
4
62
|
// 防止{a: '1'} {a: '1', b: undefined | null}被认为不相等
|
5
63
|
var filterObject = function filterObject(data) {
|
@@ -32,7 +90,9 @@ var filterObject = function filterObject(data) {
|
|
32
90
|
export var diffOriginal = function diffOriginal(params) {
|
33
91
|
var originalValue = params.originalValue,
|
34
92
|
value = params.value,
|
35
|
-
onDiff = params.onDiff
|
93
|
+
onDiff = params.onDiff,
|
94
|
+
type = params.type;
|
95
|
+
|
36
96
|
// 支持传入自定义比较事件
|
37
97
|
if (isFunction(onDiff)) {
|
38
98
|
var diffRes = onDiff(originalValue, value);
|
@@ -44,6 +104,11 @@ export var diffOriginal = function diffOriginal(params) {
|
|
44
104
|
return diffRes;
|
45
105
|
}
|
46
106
|
}
|
107
|
+
if (['InputNumber', 'ProNumberRange'].includes(type)) {
|
108
|
+
return handleNumberTypeDiff(params);
|
109
|
+
}
|
110
|
+
|
111
|
+
// 其他类型使用原有逻辑
|
47
112
|
var _value = filterObject(value);
|
48
113
|
var _originalValue = filterObject(originalValue);
|
49
114
|
var isEmptyVal = isEmpty(_value);
|
@@ -149,7 +149,7 @@ export var filterInternalFields = function filterInternalFields(values, optimize
|
|
149
149
|
if (isObject(nextValues)) {
|
150
150
|
var result = {};
|
151
151
|
Object.keys(nextValues).forEach(function (key) {
|
152
|
-
if (key.includes('-')) return;
|
152
|
+
if (key.includes('-') || key.startsWith('__')) return;
|
153
153
|
result[key] = filterInternalFields(nextValues[key]);
|
154
154
|
});
|
155
155
|
return result;
|
@@ -19,6 +19,7 @@ interface UseShouldUpdateProps<Values> {
|
|
19
19
|
rules?: ProRule[];
|
20
20
|
required?: boolean;
|
21
21
|
type: string;
|
22
|
+
shouldUpdateDebounce?: number;
|
22
23
|
[key: string]: any;
|
23
24
|
}
|
24
25
|
type HookShouldUpdate<Values = any> = (props: UseShouldUpdateProps<Values>) => Result<Values>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
-
import { useRef, useState } from 'react';
|
3
|
-
import { isFunction, isEqualWith, get } from 'lodash';
|
2
|
+
import { useRef, useState, useEffect } from 'react';
|
3
|
+
import { isFunction, isEqualWith, get, debounce } from 'lodash';
|
4
4
|
import { customEqualForFunction } from "../../utils";
|
5
5
|
/** FormList中被删除的行也会再触发一次响应式函数 排除这种场景 */
|
6
6
|
var isDeleteLine = function isDeleteLine(form, namePath) {
|
@@ -23,7 +23,9 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
23
23
|
component = props.component,
|
24
24
|
originComponent = props.originComponent,
|
25
25
|
type = props.type,
|
26
|
-
desensitization = props.desensitization
|
26
|
+
desensitization = props.desensitization,
|
27
|
+
_props$shouldUpdateDe = props.shouldUpdateDebounce,
|
28
|
+
shouldUpdateDebounce = _props$shouldUpdateDe === void 0 ? 500 : _props$shouldUpdateDe;
|
27
29
|
var _shouldUpdate = formItemProps.shouldUpdate,
|
28
30
|
name = formItemProps.name,
|
29
31
|
clearNotShow = formItemProps.clearNotShow,
|
@@ -32,6 +34,8 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
32
34
|
names = formItemProps.names,
|
33
35
|
dependNames = formItemProps.dependNames;
|
34
36
|
var timerRef = useRef(null); // 清值防抖
|
37
|
+
var debouncedShouldUpdateRef = useRef(null); // shouldUpdate防抖函数
|
38
|
+
var pendingValuesRef = useRef(null); // 待处理的表单值
|
35
39
|
|
36
40
|
var needClear = useRef(false); // 是否需要执行清值操作
|
37
41
|
var showRef = useRef(false);
|
@@ -48,6 +52,77 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
48
52
|
reRender = _useState2[1];
|
49
53
|
var values = {};
|
50
54
|
|
55
|
+
// 处理表单值更新的函数
|
56
|
+
var processValuesUpdate = function processValuesUpdate(currentValues) {
|
57
|
+
var _currentValues;
|
58
|
+
if (namePath) {
|
59
|
+
_currentValues = form.getFieldValue(namePath) || {};
|
60
|
+
} else {
|
61
|
+
_currentValues = currentValues;
|
62
|
+
}
|
63
|
+
var _show = isFunction(show) ? Boolean(show(_currentValues, {
|
64
|
+
form: form,
|
65
|
+
index: index,
|
66
|
+
namePath: namePath
|
67
|
+
})) : show;
|
68
|
+
var _disabled = isFunction(disabled) ? disabled(_currentValues, {
|
69
|
+
form: form,
|
70
|
+
index: index,
|
71
|
+
namePath: namePath
|
72
|
+
}) : disabled;
|
73
|
+
var _required = isFunction(required) ? required(_currentValues, {
|
74
|
+
form: form,
|
75
|
+
index: index,
|
76
|
+
namePath: namePath
|
77
|
+
}) : required;
|
78
|
+
var _rules = isFunction(rules) ? rules(_currentValues, {
|
79
|
+
form: form,
|
80
|
+
index: index,
|
81
|
+
namePath: namePath
|
82
|
+
}) : rules;
|
83
|
+
var _fieldProps = isFunction(fieldProps) ? fieldProps(_currentValues, {
|
84
|
+
form: form,
|
85
|
+
index: index,
|
86
|
+
namePath: namePath
|
87
|
+
}) : fieldProps;
|
88
|
+
var _desensitization = isFunction(desensitization) ? desensitization(_currentValues, {
|
89
|
+
form: form,
|
90
|
+
index: index,
|
91
|
+
namePath: namePath
|
92
|
+
}) : desensitization;
|
93
|
+
var equalRes = isEqualWith(rulesRef.current, _rules, customEqualForFunction);
|
94
|
+
var proEqualRes = isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFunction);
|
95
|
+
var desensitizationRes = isEqualWith(desensitizationRef.current, _desensitization);
|
96
|
+
if (_show !== showRef.current || !isEqualWith(disabledRef.current, _disabled, customEqualForFunction) || _required !== requiredRef.current || !equalRes || !proEqualRes || !desensitizationRes || _fieldProps !== null && _fieldProps !== void 0 && _fieldProps.transformResponse) {
|
97
|
+
showRef.current = _show;
|
98
|
+
disabledRef.current = _disabled;
|
99
|
+
requiredRef.current = _required;
|
100
|
+
rulesRef.current = _rules;
|
101
|
+
fieldPropsRef.current = _fieldProps;
|
102
|
+
desensitizationRef.current = _desensitization;
|
103
|
+
reRender({});
|
104
|
+
}
|
105
|
+
};
|
106
|
+
|
107
|
+
// 创建防抖函数
|
108
|
+
useEffect(function () {
|
109
|
+
if (shouldUpdateDebounce > 0 && (dependNames !== null && dependNames !== void 0 && dependNames.length || isFunction(show) || isFunction(disabled) || isFunction(required) || isFunction(rules) || isFunction(fieldProps) || isFunction(originComponent) || isFunction(desensitization))) {
|
110
|
+
debouncedShouldUpdateRef.current = debounce(function () {
|
111
|
+
if (pendingValuesRef.current) {
|
112
|
+
var currentValues = pendingValuesRef.current;
|
113
|
+
pendingValuesRef.current = null;
|
114
|
+
|
115
|
+
// 使用最新的values重新计算状态
|
116
|
+
processValuesUpdate(currentValues);
|
117
|
+
}
|
118
|
+
}, shouldUpdateDebounce);
|
119
|
+
}
|
120
|
+
return function () {
|
121
|
+
var _debouncedShouldUpdat;
|
122
|
+
(_debouncedShouldUpdat = debouncedShouldUpdateRef.current) === null || _debouncedShouldUpdat === void 0 || _debouncedShouldUpdat.cancel();
|
123
|
+
};
|
124
|
+
}, [shouldUpdateDebounce, dependNames === null || dependNames === void 0 ? void 0 : dependNames.length, show, disabled, required, rules, fieldProps, originComponent, desensitization]);
|
125
|
+
|
51
126
|
// 不是动态函数直接返回
|
52
127
|
if (!(dependNames !== null && dependNames !== void 0 && dependNames.length) && !isFunction(show) && !isFunction(disabled) && !isFunction(required) && !isFunction(rules) && !isFunction(fieldProps) && !isFunction(originComponent) && !isFunction(desensitization)) {
|
53
128
|
return {
|
@@ -159,6 +234,17 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
159
234
|
dependNamesRef.current = curDependNamesValue;
|
160
235
|
if (!dependNamesChanged) return false;
|
161
236
|
}
|
237
|
+
|
238
|
+
// 如果启用了防抖且存在防抖函数
|
239
|
+
if (shouldUpdateDebounce > 0 && debouncedShouldUpdateRef.current) {
|
240
|
+
// 缓存最新的表单值
|
241
|
+
pendingValuesRef.current = currentValues;
|
242
|
+
// 触发防抖函数
|
243
|
+
debouncedShouldUpdateRef.current();
|
244
|
+
return false; // 暂时不更新,由防抖函数控制
|
245
|
+
}
|
246
|
+
|
247
|
+
// 原有的非防抖逻辑
|
162
248
|
var _currentValues;
|
163
249
|
if (namePath) {
|
164
250
|
// formList场景values取当前行数据
|
@@ -6,12 +6,13 @@ import { Link } from 'react-router-dom';
|
|
6
6
|
import { Icon } from "../../index";
|
7
7
|
import SideMenu from "../SideMenu";
|
8
8
|
import { LayoutContext } from "../../../../index";
|
9
|
-
import { getUrlParams, getPathNameKey } from "../../../../utils";
|
9
|
+
import { getUrlParams, getPathNameKey, findMenuItemByKey } from "../../../../utils";
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
12
12
|
var FoldMenu = function FoldMenu(props) {
|
13
13
|
var style = props.style,
|
14
|
-
dataSource = props.dataSource
|
14
|
+
dataSource = props.dataSource,
|
15
|
+
onMenuClick = props.onMenuClick;
|
15
16
|
var menus = dataSource.menus,
|
16
17
|
iconfontUrl = dataSource.iconfontUrl,
|
17
18
|
notice = dataSource.notice,
|
@@ -84,7 +85,8 @@ var FoldMenu = function FoldMenu(props) {
|
|
84
85
|
content: /*#__PURE__*/_jsx(SideMenu, {
|
85
86
|
dataSource: _objectSpread(_objectSpread({}, dataSource), {}, {
|
86
87
|
menus: item
|
87
|
-
})
|
88
|
+
}),
|
89
|
+
onMenuClick: onMenuClick
|
88
90
|
}),
|
89
91
|
color: "#fff",
|
90
92
|
classNames: {
|
@@ -97,12 +99,44 @@ var FoldMenu = function FoldMenu(props) {
|
|
97
99
|
}
|
98
100
|
},
|
99
101
|
placement: "rightTop",
|
100
|
-
children:
|
102
|
+
children: /*#__PURE__*/_jsx("span", {
|
103
|
+
onClick: function onClick() {
|
104
|
+
// 查找完整的菜单项数据
|
105
|
+
var menuItem = findMenuItemByKey(menus, String(id));
|
106
|
+
var menuKeyPath = menuItem !== null && menuItem !== void 0 && menuItem.keyIdPath ? menuItem.keyIdPath.map(function (id) {
|
107
|
+
return String(id);
|
108
|
+
}) : [String(id)];
|
109
|
+
|
110
|
+
// 调用用户传入的onMenuClick回调
|
111
|
+
if (onMenuClick) {
|
112
|
+
onMenuClick({
|
113
|
+
item: menuItem,
|
114
|
+
key: String(id),
|
115
|
+
keyPath: menuKeyPath
|
116
|
+
});
|
117
|
+
}
|
118
|
+
},
|
119
|
+
children: LiNode
|
120
|
+
})
|
101
121
|
}, "".concat(id, "-").concat(name)) : !collapsed ? /*#__PURE__*/_jsx(Tooltip, {
|
102
122
|
placement: "right",
|
103
123
|
title: name,
|
104
124
|
children: /*#__PURE__*/_jsx("span", {
|
105
125
|
onClick: function onClick() {
|
126
|
+
// 查找完整的菜单项数据
|
127
|
+
var menuItem = findMenuItemByKey(menus, String(id));
|
128
|
+
var menuKeyPath = menuItem !== null && menuItem !== void 0 && menuItem.keyIdPath ? menuItem.keyIdPath.map(function (id) {
|
129
|
+
return String(id);
|
130
|
+
}) : [String(id)];
|
131
|
+
|
132
|
+
// 调用用户传入的onMenuClick回调
|
133
|
+
if (onMenuClick) {
|
134
|
+
onMenuClick({
|
135
|
+
item: menuItem,
|
136
|
+
key: String(id),
|
137
|
+
keyPath: menuKeyPath
|
138
|
+
});
|
139
|
+
}
|
106
140
|
onSelected({
|
107
141
|
selectedPath: toPath
|
108
142
|
});
|
@@ -112,10 +146,28 @@ var FoldMenu = function FoldMenu(props) {
|
|
112
146
|
children: LiNode
|
113
147
|
}, toPath)
|
114
148
|
})
|
115
|
-
}, toPath) : /*#__PURE__*/_jsx(
|
116
|
-
|
117
|
-
|
118
|
-
|
149
|
+
}, toPath) : /*#__PURE__*/_jsx("span", {
|
150
|
+
onClick: function onClick() {
|
151
|
+
// 查找完整的菜单项数据
|
152
|
+
var menuItem = findMenuItemByKey(menus, String(id));
|
153
|
+
var menuKeyPath = menuItem !== null && menuItem !== void 0 && menuItem.keyIdPath ? menuItem.keyIdPath.map(function (id) {
|
154
|
+
return String(id);
|
155
|
+
}) : [String(id)];
|
156
|
+
|
157
|
+
// 调用用户传入的onMenuClick回调
|
158
|
+
if (onMenuClick) {
|
159
|
+
onMenuClick({
|
160
|
+
item: menuItem,
|
161
|
+
key: String(id),
|
162
|
+
keyPath: menuKeyPath
|
163
|
+
});
|
164
|
+
}
|
165
|
+
},
|
166
|
+
children: /*#__PURE__*/_jsx(Link, {
|
167
|
+
to: toPath,
|
168
|
+
children: LiNode
|
169
|
+
}, toPath)
|
170
|
+
});
|
119
171
|
})
|
120
172
|
})
|
121
173
|
});
|
@@ -8,7 +8,7 @@ import classnames from 'classnames';
|
|
8
8
|
import { Link } from 'react-router-dom';
|
9
9
|
import { cloneDeep } from 'lodash';
|
10
10
|
import { LayoutContext } from "../../../../index";
|
11
|
-
import { getIdsByPathName } from "../../../../utils";
|
11
|
+
import { getIdsByPathName, findMenuItemByKey } from "../../../../utils";
|
12
12
|
import { Icon } from "../../index";
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
14
14
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
@@ -19,7 +19,8 @@ var OpenMenu = function OpenMenu(props) {
|
|
19
19
|
dataSource = props.dataSource,
|
20
20
|
style = props.style,
|
21
21
|
_props$theme = props.theme,
|
22
|
-
theme = _props$theme === void 0 ? 'dark' : _props$theme
|
22
|
+
theme = _props$theme === void 0 ? 'dark' : _props$theme,
|
23
|
+
onMenuClick = props.onMenuClick;
|
23
24
|
var _ref = dataSource || {},
|
24
25
|
menus = _ref.menus,
|
25
26
|
sideMenu = _ref.sideMenu;
|
@@ -146,7 +147,28 @@ var OpenMenu = function OpenMenu(props) {
|
|
146
147
|
onClick: function onClick(_ref2) {
|
147
148
|
var _item$props, _item$props2;
|
148
149
|
var item = _ref2.item,
|
149
|
-
keyPath = _ref2.keyPath
|
150
|
+
keyPath = _ref2.keyPath,
|
151
|
+
key = _ref2.key,
|
152
|
+
domEvent = _ref2.domEvent;
|
153
|
+
// console.log('item', item);
|
154
|
+
// console.log('keyPath', keyPath);
|
155
|
+
// console.log('key', key);
|
156
|
+
// console.log('domEvent', domEvent);
|
157
|
+
|
158
|
+
// 查找完整的菜单项数据
|
159
|
+
var menuItem = findMenuItemByKey(menus, key);
|
160
|
+
var menuKeyPath = menuItem !== null && menuItem !== void 0 && menuItem.keyIdPath ? menuItem.keyIdPath.map(function (id) {
|
161
|
+
return String(id);
|
162
|
+
}) : keyPath;
|
163
|
+
|
164
|
+
// 调用用户传入的onMenuClick回调
|
165
|
+
if (onMenuClick) {
|
166
|
+
onMenuClick({
|
167
|
+
item: menuItem,
|
168
|
+
key: key,
|
169
|
+
keyPath: menuKeyPath
|
170
|
+
});
|
171
|
+
}
|
150
172
|
setState({
|
151
173
|
selectedKeys: keyPath,
|
152
174
|
router: item === null || item === void 0 || (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.router
|
@@ -5,7 +5,8 @@ import OpenMenu from "../OpenMenu";
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
6
6
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
7
7
|
var SideMenu = function SideMenu(props) {
|
8
|
-
var dataSource = props.dataSource
|
8
|
+
var dataSource = props.dataSource,
|
9
|
+
onMenuClick = props.onMenuClick;
|
9
10
|
var ref = useRef(null);
|
10
11
|
var size = useSize(ref);
|
11
12
|
var menus = dataSource.menus,
|
@@ -25,6 +26,7 @@ var SideMenu = function SideMenu(props) {
|
|
25
26
|
children: /*#__PURE__*/_jsx(OpenMenu, {
|
26
27
|
className: "pro-layout-sider-menu-list",
|
27
28
|
theme: "light",
|
29
|
+
onMenuClick: onMenuClick,
|
28
30
|
dataSource: {
|
29
31
|
menus: (menus === null || menus === void 0 ? void 0 : menus.children) || [],
|
30
32
|
iconfontUrl: iconfontUrl,
|
@@ -15,7 +15,8 @@ var Menu = function Menu(props) {
|
|
15
15
|
pure = _ref.pure,
|
16
16
|
theme = _ref.theme,
|
17
17
|
sideMenuFooterRender = _ref.sideMenuFooterRender,
|
18
|
-
sideMenuHeaderRender = _ref.sideMenuHeaderRender
|
18
|
+
sideMenuHeaderRender = _ref.sideMenuHeaderRender,
|
19
|
+
onMenuClick = _ref.onMenuClick;
|
19
20
|
var menus = [];
|
20
21
|
var menuCls = classnames({
|
21
22
|
'pro-layout-menu': true,
|
@@ -41,6 +42,7 @@ var Menu = function Menu(props) {
|
|
41
42
|
height: headerHeight + (notice ? 32 : 0) + 48
|
42
43
|
},
|
43
44
|
theme: theme,
|
45
|
+
onMenuClick: onMenuClick,
|
44
46
|
style: {
|
45
47
|
display: collapsed ? 'block' : 'none'
|
46
48
|
}
|
@@ -53,6 +55,7 @@ var Menu = function Menu(props) {
|
|
53
55
|
collapsed: collapsed,
|
54
56
|
headerHeight: headerHeight
|
55
57
|
},
|
58
|
+
onMenuClick: onMenuClick,
|
56
59
|
style: {
|
57
60
|
display: collapsed ? 'none' : 'block',
|
58
61
|
height: "calc(100vh - ".concat(headerHeight + (notice ? 32 : 0) + 48 || 0, "px)")
|