@zat-design/sisyphus-react 3.9.0 → 3.9.1-beta.10
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 +71 -37
- package/dist/less.esm.css +67 -35
- package/es/ProDrawerForm/components/ProDrawer/index.js +3 -1
- package/es/ProDrawerForm/components/ProModal/index.js +5 -3
- package/es/ProDrawerForm/propsType.d.ts +1 -0
- package/es/ProDrawerForm/style/index.less +3 -0
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +7 -3
- package/es/ProEditTable/components/RenderField/index.js +3 -2
- package/es/ProEditTable/index.js +23 -16
- package/es/ProEditTable/style/index.less +22 -3
- package/es/ProEnum/index.js +10 -5
- package/es/ProEnum/propsType.d.ts +1 -0
- package/es/ProForm/components/base/SwitchCheckbox/index.js +9 -2
- package/es/ProForm/components/combination/FormList/index.js +1 -1
- package/es/ProForm/components/combination/Group/component/ComRender.d.ts +1 -0
- package/es/ProForm/components/combination/Group/component/ComRender.js +12 -1
- package/es/ProForm/components/combination/Group/index.js +4 -3
- package/es/ProForm/components/combination/ProCascader/index.js +7 -1
- package/es/ProForm/components/combination/ProModalSelect/index.js +40 -38
- package/es/ProForm/components/render/ChangedWrapper.js +3 -3
- package/es/ProForm/components/render/RenderFields.js +3 -2
- package/es/ProForm/components/render/propsType.d.ts +1 -0
- package/es/ProForm/style/index.less +12 -8
- package/es/ProForm/utils/diffOriginal.js +18 -12
- package/es/ProTable/components/FormatColumn/index.d.ts +5 -3
- package/es/ProTable/components/FormatColumn/index.js +93 -72
- package/es/ProTable/components/RenderColumn/index.d.ts +1 -1
- package/es/ProTable/components/RenderColumn/index.js +41 -23
- package/es/ProTable/components/TableResizable/index.js +1 -5
- package/es/ProTable/index.d.ts +6 -5
- package/es/ProTable/index.js +4 -6
- package/es/ProTable/propsType.d.ts +2 -1
- package/es/ProTable/style/index.less +20 -6
- package/es/ProTable/utils/index.d.ts +5 -2
- package/es/ProTable/utils/index.js +13 -4
- package/es/ProTree/components/ProTreeSelect/index.js +32 -13
- package/es/style/theme/antd.less +4 -2
- package/es/utils/index.d.ts +1 -1
- package/es/utils/index.js +4 -1
- package/lib/ProDrawerForm/components/ProDrawer/index.js +3 -1
- package/lib/ProDrawerForm/components/ProModal/index.js +5 -3
- package/lib/ProDrawerForm/propsType.d.ts +1 -0
- package/lib/ProDrawerForm/style/index.less +3 -0
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +5 -1
- package/lib/ProEditTable/components/RenderField/index.js +3 -2
- package/lib/ProEditTable/index.js +23 -16
- package/lib/ProEditTable/style/index.less +22 -3
- package/lib/ProEnum/index.js +10 -5
- package/lib/ProEnum/propsType.d.ts +1 -0
- package/lib/ProForm/components/base/SwitchCheckbox/index.js +9 -2
- package/lib/ProForm/components/combination/FormList/index.js +1 -1
- package/lib/ProForm/components/combination/Group/component/ComRender.d.ts +1 -0
- package/lib/ProForm/components/combination/Group/component/ComRender.js +12 -1
- package/lib/ProForm/components/combination/Group/index.js +4 -3
- package/lib/ProForm/components/combination/ProCascader/index.js +7 -1
- package/lib/ProForm/components/combination/ProModalSelect/index.js +39 -37
- package/lib/ProForm/components/render/ChangedWrapper.js +3 -3
- package/lib/ProForm/components/render/RenderFields.js +3 -2
- package/lib/ProForm/components/render/propsType.d.ts +1 -0
- package/lib/ProForm/style/index.less +12 -8
- package/lib/ProForm/utils/diffOriginal.js +18 -12
- package/lib/ProTable/components/FormatColumn/index.d.ts +5 -3
- package/lib/ProTable/components/FormatColumn/index.js +92 -71
- package/lib/ProTable/components/RenderColumn/index.d.ts +1 -1
- package/lib/ProTable/components/RenderColumn/index.js +41 -23
- package/lib/ProTable/components/TableResizable/index.js +0 -4
- package/lib/ProTable/index.d.ts +6 -5
- package/lib/ProTable/index.js +4 -6
- package/lib/ProTable/propsType.d.ts +2 -1
- package/lib/ProTable/style/index.less +20 -6
- package/lib/ProTable/utils/index.d.ts +5 -2
- package/lib/ProTable/utils/index.js +13 -4
- package/lib/ProTree/components/ProTreeSelect/index.js +31 -12
- package/lib/style/theme/antd.less +4 -2
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +4 -1
- package/package.json +2 -2
@@ -29,7 +29,7 @@ var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames",
|
|
29
29
|
_excluded2 = ["onOk"],
|
30
30
|
_excluded3 = ["rowKey", "columns", "rowSelection"];
|
31
31
|
var ProModalSelect = function ProModalSelect(props, ref) {
|
32
|
-
var _formColumns$;
|
32
|
+
var _useRequest$options9, _formColumns$;
|
33
33
|
var value = props.value,
|
34
34
|
onChange = props.onChange,
|
35
35
|
disabled = props.disabled,
|
@@ -142,13 +142,21 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
142
142
|
})),
|
143
143
|
run = _useRequestList.run,
|
144
144
|
selectLoading = _useRequestList.loading;
|
145
|
+
var initParams = (0, _react.useMemo)(function () {
|
146
|
+
var nextInitParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams;
|
147
|
+
if (typeof (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) === 'function') {
|
148
|
+
var _contentForm$getField;
|
149
|
+
nextInitParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams(value, contentForm === null || contentForm === void 0 ? void 0 : (_contentForm$getField = contentForm.getFieldsValue) === null || _contentForm$getField === void 0 ? void 0 : _contentForm$getField.call(contentForm));
|
150
|
+
}
|
151
|
+
return nextInitParams;
|
152
|
+
}, [value]);
|
145
153
|
var _useRequestList2 = (0, _useRequestList3.default)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, {
|
146
154
|
withPagination: withPagination,
|
147
155
|
transformParams: transformParams,
|
148
156
|
transformResponse: transformResponse
|
149
157
|
}, (0, _objectSpread3.default)({
|
150
158
|
manual: true,
|
151
|
-
ready: (
|
159
|
+
ready: (initParams || defaultOne) && !readOnly || visible
|
152
160
|
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options)),
|
153
161
|
data = _useRequestList2.data,
|
154
162
|
loading = _useRequestList2.loading,
|
@@ -453,18 +461,15 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
453
461
|
// 初始化回显,当传入initParams时,前端用来回险
|
454
462
|
var getInitValues = /*#__PURE__*/function () {
|
455
463
|
var _ref10 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4() {
|
456
|
-
var
|
464
|
+
var _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _res$data2, _list, list, _data, nextSelectRowKeys;
|
457
465
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee4$(_context4) {
|
458
466
|
while (1) switch (_context4.prev = _context4.next) {
|
459
467
|
case 0:
|
460
|
-
if (
|
461
|
-
|
462
|
-
}
|
463
|
-
if (!((useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || defaultOne)) {
|
464
|
-
_context4.next = 10;
|
468
|
+
if (!(initParams || defaultOne)) {
|
469
|
+
_context4.next = 9;
|
465
470
|
break;
|
466
471
|
}
|
467
|
-
queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.defaultParams),
|
472
|
+
queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.defaultParams), initParams || {});
|
468
473
|
page = (0, _objectSpread3.default)({
|
469
474
|
pageNum: 1,
|
470
475
|
pageSize: 10
|
@@ -473,9 +478,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
473
478
|
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
474
479
|
}) : queryBean;
|
475
480
|
params = transformParams ? transformParams(params) : params;
|
476
|
-
_context4.next =
|
481
|
+
_context4.next = 7;
|
477
482
|
return runAsync(params);
|
478
|
-
case
|
483
|
+
case 7:
|
479
484
|
res = _context4.sent;
|
480
485
|
if (res === null || res === void 0 ? void 0 : res.data) {
|
481
486
|
list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list : res === null || res === void 0 ? void 0 : res.data;
|
@@ -503,7 +508,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
503
508
|
});
|
504
509
|
}
|
505
510
|
}
|
506
|
-
case
|
511
|
+
case 9:
|
507
512
|
case "end":
|
508
513
|
return _context4.stop();
|
509
514
|
}
|
@@ -594,7 +599,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
594
599
|
});
|
595
600
|
}
|
596
601
|
});
|
597
|
-
(0, _ahooks.
|
602
|
+
(0, _ahooks.useDebounceEffect)(function () {
|
598
603
|
if (onOff && !visible) {
|
599
604
|
var _useRequest$options6;
|
600
605
|
if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options6 = useRequest.options) === null || _useRequest$options6 === void 0 ? void 0 : _useRequest$options6.manual) !== true) {
|
@@ -629,13 +634,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
629
634
|
}
|
630
635
|
setState(nextState);
|
631
636
|
}
|
632
|
-
}, [onOff, visible, value]);
|
637
|
+
}, [onOff, visible, JSON.stringify(value)]);
|
633
638
|
(0, _ahooks.useDeepCompareEffect)(function () {
|
634
639
|
if (value && !visible && isInit && !readOnly) {
|
635
640
|
getInitValues();
|
636
641
|
}
|
637
|
-
}, [value, visible, isInit]);
|
638
|
-
(0, _ahooks.
|
642
|
+
}, [JSON.stringify(value), visible, isInit]);
|
643
|
+
(0, _ahooks.useDebounceEffect)(function () {
|
639
644
|
if (value && !visible && readOnly) {
|
640
645
|
var _options$some;
|
641
646
|
var isHasValue = options === null || options === void 0 ? void 0 : (_options$some = options.some) === null || _options$some === void 0 ? void 0 : _options$some.call(options, function (item) {
|
@@ -647,11 +652,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
647
652
|
// 加定时器 修复依赖数据同步更新未取到问题
|
648
653
|
setTimeout(function () {
|
649
654
|
var _useRequest$options7, _useRequest$options8;
|
650
|
-
var initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams;
|
651
|
-
if (typeof (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) === 'function') {
|
652
|
-
var _contentForm$getField2;
|
653
|
-
initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams(value, contentForm === null || contentForm === void 0 ? void 0 : (_contentForm$getField2 = contentForm.getFieldsValue) === null || _contentForm$getField2 === void 0 ? void 0 : _contentForm$getField2.call(contentForm));
|
654
|
-
}
|
655
655
|
var params = withPagination ? {
|
656
656
|
pageNum: 1,
|
657
657
|
pageSize: 50,
|
@@ -661,8 +661,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
661
661
|
run(nextParams);
|
662
662
|
}, 300);
|
663
663
|
}
|
664
|
-
}, [value,
|
665
|
-
(0, _ahooks.
|
664
|
+
}, [JSON.stringify(value), visible, JSON.stringify(useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams), JSON.stringify(initParams)]);
|
665
|
+
(0, _ahooks.useDebounceEffect)(function () {
|
666
666
|
if (!value) {
|
667
667
|
if (defaultOne) {
|
668
668
|
getDefaultOneValues();
|
@@ -713,8 +713,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
713
713
|
}) : null,
|
714
714
|
onFocus: function onFocus() {
|
715
715
|
if (useRequest) {
|
716
|
-
var _useRequest$
|
717
|
-
var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
716
|
+
var _useRequest$options10;
|
717
|
+
var queryBean = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options10 = useRequest.options) === null || _useRequest$options10 === void 0 ? void 0 : _useRequest$options10.defaultParams) || {};
|
718
718
|
var params = withPagination ? {
|
719
719
|
pageNum: 1,
|
720
720
|
pageSize: 50,
|
@@ -728,8 +728,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
728
728
|
}
|
729
729
|
},
|
730
730
|
onSearch: (0, _lodash.debounce)(function (val) {
|
731
|
-
var _useRequest$
|
732
|
-
var queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
731
|
+
var _useRequest$options11;
|
732
|
+
var queryBean = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options11 = useRequest.options) === null || _useRequest$options11 === void 0 ? void 0 : _useRequest$options11.defaultParams), {}, (0, _defineProperty2.default)({}, searchKey !== null && searchKey !== void 0 ? searchKey : labelKey, val));
|
733
733
|
var params = withPagination ? {
|
734
734
|
pageNum: 1,
|
735
735
|
pageSize: 50,
|
@@ -825,16 +825,18 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
825
825
|
children: "".concat(viewText)
|
826
826
|
});
|
827
827
|
}
|
828
|
-
return (0, _jsxRuntime.jsxs)(
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
828
|
+
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
829
|
+
children: [(0, _jsxRuntime.jsx)("div", {
|
830
|
+
id: uuid,
|
831
|
+
className: "pro-modal-select ".concat(className !== null && className !== void 0 ? className : ''),
|
832
|
+
style: style,
|
833
|
+
children: isTooltip && viewText ? (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
834
|
+
placement: "topLeft",
|
835
|
+
open: open,
|
836
|
+
title: viewText,
|
837
|
+
children: initRender
|
838
|
+
}) : initRender
|
839
|
+
}), (0, _jsxRuntime.jsxs)(_index.ProDrawerForm, (0, _objectSpread3.default)((0, _objectSpread3.default)({
|
838
840
|
showType: "Modal",
|
839
841
|
title: title,
|
840
842
|
onOk: handleFinish,
|
@@ -34,7 +34,6 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
34
34
|
getValueProps = props.getValueProps,
|
35
35
|
viewRender = props.viewRender,
|
36
36
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
37
|
-
// const contentRef = useRef(null);
|
38
37
|
var _useProConfig = (0, _ProConfigProvider.useProConfig)('ProForm'),
|
39
38
|
isDiffAll = _useProConfig.isDiffAll;
|
40
39
|
var originalValues = diffConfig.originalValues,
|
@@ -108,7 +107,9 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
108
107
|
getPopupContainer: function getPopupContainer(trigger) {
|
109
108
|
return scrollFollowParent ? trigger.parentElement : document.body;
|
110
109
|
},
|
111
|
-
overlayClassName: "original-value-
|
110
|
+
overlayClassName: "original-value-tooltip",
|
111
|
+
placement: "topLeft",
|
112
|
+
autoAdjustOverflow: false,
|
112
113
|
title: (0, _jsxRuntime.jsxs)(_antd.Space, {
|
113
114
|
direction: "vertical",
|
114
115
|
className: "changed-tooltip",
|
@@ -124,7 +125,6 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
124
125
|
})) : undefined]
|
125
126
|
})]
|
126
127
|
}),
|
127
|
-
placement: "topLeft",
|
128
128
|
children: (0, _jsxRuntime.jsx)("div", {
|
129
129
|
className: diffClassName,
|
130
130
|
style: style,
|
@@ -17,7 +17,7 @@ var componentMap = _interopRequireWildcard(require("../index"));
|
|
17
17
|
var _utils = require("../../utils");
|
18
18
|
var _useFieldProps = require("../../utils/useFieldProps");
|
19
19
|
var _locale = _interopRequireDefault(require("../../../locale"));
|
20
|
-
var _excluded = ["show", "type", "viewRender", "viewType", "valueType", "formItemProps", "colProps", "formItemChildProps", "fieldProps", "equalWith", "clearNotShow", "required", "confirm"];
|
20
|
+
var _excluded = ["show", "type", "viewRender", "viewType", "valueType", "formItemProps", "colProps", "formItemChildProps", "fieldProps", "equalWith", "onDiff", "clearNotShow", "required", "confirm"];
|
21
21
|
var RenderFields = function RenderFields(props) {
|
22
22
|
var isView = props.isView,
|
23
23
|
_props$columns = props.columns,
|
@@ -77,6 +77,7 @@ var RenderFields = function RenderFields(props) {
|
|
77
77
|
_column$fieldProps = column.fieldProps,
|
78
78
|
fieldProps = _column$fieldProps === void 0 ? {} : _column$fieldProps,
|
79
79
|
equalWith = column.equalWith,
|
80
|
+
onDiff = column.onDiff,
|
80
81
|
_column$clearNotShow = column.clearNotShow,
|
81
82
|
clearNotShow = _column$clearNotShow === void 0 ? outerClearNotShow : _column$clearNotShow,
|
82
83
|
columnRequired = column.required,
|
@@ -216,7 +217,7 @@ var RenderFields = function RenderFields(props) {
|
|
216
217
|
fieldProps: (0, _lodash.isFunction)(fieldProps) ? fieldProps : null,
|
217
218
|
isSelect: _isSelect,
|
218
219
|
diffConfig: diffConfig,
|
219
|
-
equalWith: equalWith,
|
220
|
+
equalWith: onDiff || equalWith,
|
220
221
|
requiredOnView: requiredOnView,
|
221
222
|
globalControl: globalControl,
|
222
223
|
viewRender: viewRender
|
@@ -207,6 +207,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
|
|
207
207
|
hiddenNames?: string[] | any[];
|
208
208
|
rules?: ProRule[] | ReactiveFunction<Values, ProRule[]>;
|
209
209
|
equalWith?: DiffOriginalParams['equalWith'];
|
210
|
+
onDiff?: DiffOriginalParams['equalWith'];
|
210
211
|
required?: boolean | boolean[] | ReactiveFunction<Values, boolean | boolean[]>;
|
211
212
|
labelRequired?: boolean;
|
212
213
|
toISOString?: boolean;
|
@@ -351,7 +351,7 @@
|
|
351
351
|
background: transparent !important;
|
352
352
|
}
|
353
353
|
.@{ant-prefix}-select-selection-placeholder {
|
354
|
-
z-index: 9;
|
354
|
+
// z-index: 9;
|
355
355
|
}
|
356
356
|
}
|
357
357
|
|
@@ -385,7 +385,7 @@
|
|
385
385
|
}
|
386
386
|
|
387
387
|
// checkbox
|
388
|
-
.@{ant-prefix}-checkbox-group {
|
388
|
+
.@{ant-prefix}-checkbox-group,.pro-switch-checkbox {
|
389
389
|
padding: 5px 0
|
390
390
|
}
|
391
391
|
// switch
|
@@ -412,7 +412,7 @@
|
|
412
412
|
background: @zaui-contract-bg-add !important;
|
413
413
|
|
414
414
|
.@{ant-prefix}-input {
|
415
|
-
background: @zaui-contract-bg !important;
|
415
|
+
background: @zaui-contract-bg-add !important;
|
416
416
|
}
|
417
417
|
|
418
418
|
.@{ant-prefix}-select.@{ant-prefix}-select-disabled .@{ant-prefix}-select-selector{
|
@@ -429,7 +429,7 @@
|
|
429
429
|
background: transparent !important;
|
430
430
|
}
|
431
431
|
.@{ant-prefix}-select-selection-placeholder {
|
432
|
-
z-index: 9;
|
432
|
+
// z-index: 9;
|
433
433
|
}
|
434
434
|
}
|
435
435
|
|
@@ -463,7 +463,7 @@
|
|
463
463
|
}
|
464
464
|
|
465
465
|
// checkbox
|
466
|
-
.@{ant-prefix}-checkbox-group {
|
466
|
+
.@{ant-prefix}-checkbox-group,.pro-switch-checkbox {
|
467
467
|
padding: 5px 0
|
468
468
|
}
|
469
469
|
// switch
|
@@ -485,10 +485,8 @@
|
|
485
485
|
}
|
486
486
|
}
|
487
487
|
|
488
|
-
.original-value-
|
489
|
-
max-width: 100%;
|
488
|
+
.original-value-tooltip{
|
490
489
|
width: max-content;
|
491
|
-
z-index: 99;
|
492
490
|
.changed-tooltip {
|
493
491
|
.original-value-container {
|
494
492
|
.ant-space-item:nth-child(1) {
|
@@ -511,3 +509,9 @@
|
|
511
509
|
}
|
512
510
|
}
|
513
511
|
|
512
|
+
.original-value-tooltip-fixed {
|
513
|
+
position: fixed;
|
514
|
+
}
|
515
|
+
|
516
|
+
|
517
|
+
|
@@ -7,15 +7,17 @@ exports.diffOriginal = void 0;
|
|
7
7
|
var _lodash = require("lodash");
|
8
8
|
var _utils = require("../../utils");
|
9
9
|
// 过滤对象中undefined字段
|
10
|
-
// 防止{a: '1'} {a: '1', b: undefined}被认为不相等
|
11
|
-
var
|
10
|
+
// 防止{a: '1'} {a: '1', b: undefined | null}被认为不相等
|
11
|
+
var filterObject = function filterObject(data) {
|
12
12
|
if (!(0, _lodash.isObject)(data) || Array.isArray(data) || data === null) return data;
|
13
13
|
var resData = {};
|
14
14
|
Object.keys(data).forEach(function (key) {
|
15
|
-
if (data[key]
|
15
|
+
if (!(0, _utils.isEmpty)(data[key])) {
|
16
16
|
resData[key] = data[key];
|
17
17
|
}
|
18
18
|
});
|
19
|
+
// 空对象视为null 比较时 null undefined {} [] '' 视为相等
|
20
|
+
if (!Object.keys(resData).length) return null;
|
19
21
|
return resData;
|
20
22
|
};
|
21
23
|
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
@@ -26,18 +28,22 @@ var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
26
28
|
// 支持传入自定义比较事件
|
27
29
|
if ((0, _lodash.isFunction)(equalWith)) {
|
28
30
|
var diffRes = equalWith(originalValue, value);
|
29
|
-
|
30
|
-
if (
|
31
|
-
|
31
|
+
// 如果返回undefined走内置比较逻辑
|
32
|
+
if (diffRes !== undefined) {
|
33
|
+
if (typeof diffRes === 'boolean') {
|
34
|
+
return diffRes ? 'same' : 'changed';
|
35
|
+
}
|
36
|
+
return diffRes;
|
32
37
|
}
|
33
|
-
return diffRes;
|
34
38
|
}
|
39
|
+
var _value = filterObject(value);
|
40
|
+
var _originalValue = filterObject(originalValue);
|
35
41
|
// 如果原始值为空 且当前有值的话 认为变更类型是新增
|
36
|
-
if ((0, _utils.isEmpty)(
|
42
|
+
if ((0, _utils.isEmpty)(_originalValue) && !(0, _utils.isEmpty)(_value)) {
|
37
43
|
return 'add';
|
38
44
|
}
|
39
|
-
if (Array.isArray(
|
40
|
-
var isSame =
|
45
|
+
if (Array.isArray(_originalValue)) {
|
46
|
+
var isSame = _originalValue.every(function (valueItem, index) {
|
41
47
|
// 如果两个值有一个不是空值, 则进行深比较
|
42
48
|
if (!(0, _utils.isEmpty)(value === null || value === void 0 ? void 0 : value[index]) || !(0, _utils.isEmpty)(valueItem)) {
|
43
49
|
return (0, _lodash.isEqual)(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
@@ -46,8 +52,8 @@ var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
46
52
|
});
|
47
53
|
return isSame ? 'same' : 'changed';
|
48
54
|
}
|
49
|
-
if (!
|
50
|
-
return (0, _lodash.isEqual)(
|
55
|
+
if (!(0, _utils.isEmpty)(_originalValue) || !(0, _utils.isEmpty)(_value)) {
|
56
|
+
return (0, _lodash.isEqual)(_value, _originalValue) ? 'same' : 'changed';
|
51
57
|
}
|
52
58
|
return 'same';
|
53
59
|
};
|
@@ -1,15 +1,17 @@
|
|
1
|
+
/**
|
2
|
+
* 调整点:
|
3
|
+
*/
|
1
4
|
import React from 'react';
|
2
5
|
import { ProTableColumn } from '../../propsType';
|
3
|
-
export declare const formatColumn: ({ column, originalObj,
|
6
|
+
export declare const formatColumn: ({ column, originalObj, rowKey, wrapToolTipProps, scroll, onUpdateMinWidth, isInNewRow, diffConfig, }: {
|
4
7
|
column: ProTableColumn;
|
5
8
|
originalObj: any;
|
6
|
-
dataSourceObj: any;
|
7
9
|
rowKey: any;
|
8
|
-
diffToolTip?: boolean;
|
9
10
|
wrapToolTipProps?: any;
|
10
11
|
scroll?: any;
|
11
12
|
onUpdateMinWidth?: any;
|
12
13
|
isInNewRow?: any;
|
14
|
+
diffConfig: any;
|
13
15
|
}) => void;
|
14
16
|
/**
|
15
17
|
* 查找最近的父级className
|