@zat-design/sisyphus-react 3.6.9-beta.4 → 3.6.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.
Files changed (49) hide show
  1. package/dist/index.esm.css +41 -41
  2. package/dist/less.esm.css +41 -41
  3. package/es/ProEditTable/components/RenderField/index.js +46 -26
  4. package/es/ProForm/components/combination/ProCascader/index.js +14 -8
  5. package/es/ProForm/components/render/Render.js +39 -25
  6. package/es/ProForm/style/index.less +52 -52
  7. package/es/ProForm/utils/diffOriginal.d.ts +1 -0
  8. package/es/ProForm/utils/diffOriginal.js +27 -4
  9. package/es/ProForm/utils/index.d.ts +0 -6
  10. package/es/ProForm/utils/index.js +8 -57
  11. package/es/ProForm/utils/useChanged.js +2 -1
  12. package/es/ProForm/utils/useListChanged.js +3 -3
  13. package/es/ProTable/components/FormatColumn/index.js +16 -0
  14. package/es/ProTable/propsType.d.ts +4 -0
  15. package/es/ProThemeTools/component/{ProTools → PrdTools}/index.d.ts +2 -2
  16. package/es/ProThemeTools/component/{ProTools → PrdTools}/index.js +2 -2
  17. package/es/ProThemeTools/component/index.d.ts +2 -1
  18. package/es/ProThemeTools/component/index.js +2 -1
  19. package/es/ProThemeTools/index.js +2 -2
  20. package/es/ProThemeTools/style/index.less +1 -1
  21. package/lib/ProEditTable/components/RenderField/index.js +41 -25
  22. package/lib/ProForm/components/combination/ProCascader/index.js +12 -6
  23. package/lib/ProForm/components/render/Render.js +37 -25
  24. package/lib/ProForm/style/index.less +52 -52
  25. package/lib/ProForm/utils/diffOriginal.d.ts +1 -0
  26. package/lib/ProForm/utils/diffOriginal.js +27 -3
  27. package/lib/ProForm/utils/index.d.ts +0 -6
  28. package/lib/ProForm/utils/index.js +8 -59
  29. package/lib/ProForm/utils/useChanged.js +2 -1
  30. package/lib/ProForm/utils/useListChanged.js +2 -2
  31. package/lib/ProTable/components/FormatColumn/index.js +16 -0
  32. package/lib/ProTable/propsType.d.ts +4 -0
  33. package/lib/ProThemeTools/component/{ProTools → PrdTools}/index.d.ts +2 -2
  34. package/lib/ProThemeTools/component/{ProTools → PrdTools}/index.js +2 -2
  35. package/lib/ProThemeTools/component/index.d.ts +2 -1
  36. package/lib/ProThemeTools/component/index.js +3 -3
  37. package/lib/ProThemeTools/index.js +1 -1
  38. package/lib/ProThemeTools/style/index.less +1 -1
  39. package/package.json +1 -1
  40. package/es/ProEditTable/components/RenderField/ListChanged.d.ts +0 -16
  41. package/es/ProEditTable/components/RenderField/ListChanged.js +0 -124
  42. package/es/ProForm/components/render/Changed.d.ts +0 -14
  43. package/es/ProForm/components/render/Changed.js +0 -64
  44. package/lib/ProEditTable/components/RenderField/ListChanged.d.ts +0 -16
  45. package/lib/ProEditTable/components/RenderField/ListChanged.js +0 -129
  46. package/lib/ProForm/components/render/Changed.d.ts +0 -14
  47. package/lib/ProForm/components/render/Changed.js +0 -69
  48. /package/es/ProThemeTools/component/{ProTools → PrdTools}/style/index.less +0 -0
  49. /package/lib/ProThemeTools/component/{ProTools → PrdTools}/style/index.less +0 -0
@@ -2883,6 +2883,47 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2883
2883
  vertical-align: bottom;
2884
2884
  fill: var(--zaui-aide-text, #909090);
2885
2885
  }
2886
+ .pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper,
2887
+ .pro-form .ant-form-item.pro-form-item-changed .ant-select .ant-select-selector,
2888
+ .pro-form .ant-form-item.pro-form-item-changed .ant-picker,
2889
+ .pro-form .ant-form-item.pro-form-item-changed .ant-input-number {
2890
+ background: var(--zaui-contract-bg, #fffaa1) !important;
2891
+ }
2892
+ .pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper input,
2893
+ .pro-form .ant-form-item.pro-form-item-changed .ant-select .ant-select-selector input,
2894
+ .pro-form .ant-form-item.pro-form-item-changed .ant-picker input,
2895
+ .pro-form .ant-form-item.pro-form-item-changed .ant-input-number input {
2896
+ background: transparent;
2897
+ }
2898
+ .pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper .ant-select-selection-placeholder,
2899
+ .pro-form .ant-form-item.pro-form-item-changed .ant-select .ant-select-selector .ant-select-selection-placeholder,
2900
+ .pro-form .ant-form-item.pro-form-item-changed .ant-picker .ant-select-selection-placeholder,
2901
+ .pro-form .ant-form-item.pro-form-item-changed .ant-input-number .ant-select-selection-placeholder {
2902
+ z-index: 9;
2903
+ }
2904
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle),
2905
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
2906
+ background: var(--zaui-contract-bg, #fffaa1);
2907
+ border-radius: 4px;
2908
+ }
2909
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > span {
2910
+ border-radius: 4px;
2911
+ padding: 5px 8px;
2912
+ background: var(--zaui-contract-bg, #fffaa1);
2913
+ }
2914
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-select-selector,
2915
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
2916
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
2917
+ background: var(--zaui-contract-bg, #fffaa1);
2918
+ }
2919
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
2920
+ background: var(--zaui-contract-bg, #fffaa1);
2921
+ }
2922
+ .pro-form .ant-form-item.pro-form-item-changed .pro-form-view-container {
2923
+ padding: 4px 8px;
2924
+ background: var(--zaui-contract-bg, #fffaa1);
2925
+ border-radius: 4px;
2926
+ }
2886
2927
  .pro-form .ant-form-item .ant-row {
2887
2928
  width: 100%;
2888
2929
  }
@@ -3035,47 +3076,6 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3035
3076
  .pro-form .pro-form-list-mode-block .pro-collapse-content .ant-row {
3036
3077
  width: auto;
3037
3078
  }
3038
- .pro-form .pro-form-item-changed span.ant-input-affix-wrapper,
3039
- .pro-form .pro-form-item-changed .ant-select .ant-select-selector,
3040
- .pro-form .pro-form-item-changed .ant-picker,
3041
- .pro-form .pro-form-item-changed .ant-input-number {
3042
- background: var(--zaui-contract-bg, #fffaa1) !important;
3043
- }
3044
- .pro-form .pro-form-item-changed span.ant-input-affix-wrapper input,
3045
- .pro-form .pro-form-item-changed .ant-select .ant-select-selector input,
3046
- .pro-form .pro-form-item-changed .ant-picker input,
3047
- .pro-form .pro-form-item-changed .ant-input-number input {
3048
- background: transparent;
3049
- }
3050
- .pro-form .pro-form-item-changed span.ant-input-affix-wrapper .ant-select-selection-placeholder,
3051
- .pro-form .pro-form-item-changed .ant-select .ant-select-selector .ant-select-selection-placeholder,
3052
- .pro-form .pro-form-item-changed .ant-picker .ant-select-selection-placeholder,
3053
- .pro-form .pro-form-item-changed .ant-input-number .ant-select-selection-placeholder {
3054
- z-index: 9;
3055
- }
3056
- .pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle),
3057
- .pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
3058
- background: var(--zaui-contract-bg, #fffaa1);
3059
- border-radius: 4px;
3060
- }
3061
- .pro-form .pro-form-item-changed .ant-form-item-control-input-content > span {
3062
- border-radius: 4px;
3063
- padding: 5px 8px;
3064
- background: var(--zaui-contract-bg, #fffaa1);
3065
- }
3066
- .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-select-selector,
3067
- .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
3068
- .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
3069
- background: var(--zaui-contract-bg, #fffaa1);
3070
- }
3071
- .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
3072
- background: var(--zaui-contract-bg, #fffaa1);
3073
- }
3074
- .pro-form .pro-form-item-changed .pro-form-view-container {
3075
- padding: 4px 8px;
3076
- background: var(--zaui-contract-bg, #fffaa1);
3077
- border-radius: 4px;
3078
- }
3079
3079
  .pro-upload .pro-upload-dragger .pro-upload-handle-box {
3080
3080
  padding: var(--zaui-space-size-sm, 8px);
3081
3081
  background: #f8f9fa;
package/dist/less.esm.css CHANGED
@@ -2883,6 +2883,47 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2883
2883
  vertical-align: bottom;
2884
2884
  fill: var(--zaui-aide-text, #909090);
2885
2885
  }
2886
+ .pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper,
2887
+ .pro-form .ant-form-item.pro-form-item-changed .ant-select .ant-select-selector,
2888
+ .pro-form .ant-form-item.pro-form-item-changed .ant-picker,
2889
+ .pro-form .ant-form-item.pro-form-item-changed .ant-input-number {
2890
+ background: var(--zaui-contract-bg, #fffaa1) !important;
2891
+ }
2892
+ .pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper input,
2893
+ .pro-form .ant-form-item.pro-form-item-changed .ant-select .ant-select-selector input,
2894
+ .pro-form .ant-form-item.pro-form-item-changed .ant-picker input,
2895
+ .pro-form .ant-form-item.pro-form-item-changed .ant-input-number input {
2896
+ background: transparent;
2897
+ }
2898
+ .pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper .ant-select-selection-placeholder,
2899
+ .pro-form .ant-form-item.pro-form-item-changed .ant-select .ant-select-selector .ant-select-selection-placeholder,
2900
+ .pro-form .ant-form-item.pro-form-item-changed .ant-picker .ant-select-selection-placeholder,
2901
+ .pro-form .ant-form-item.pro-form-item-changed .ant-input-number .ant-select-selection-placeholder {
2902
+ z-index: 9;
2903
+ }
2904
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle),
2905
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
2906
+ background: var(--zaui-contract-bg, #fffaa1);
2907
+ border-radius: 4px;
2908
+ }
2909
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > span {
2910
+ border-radius: 4px;
2911
+ padding: 5px 8px;
2912
+ background: var(--zaui-contract-bg, #fffaa1);
2913
+ }
2914
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-select-selector,
2915
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
2916
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
2917
+ background: var(--zaui-contract-bg, #fffaa1);
2918
+ }
2919
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
2920
+ background: var(--zaui-contract-bg, #fffaa1);
2921
+ }
2922
+ .pro-form .ant-form-item.pro-form-item-changed .pro-form-view-container {
2923
+ padding: 4px 8px;
2924
+ background: var(--zaui-contract-bg, #fffaa1);
2925
+ border-radius: 4px;
2926
+ }
2886
2927
  .pro-form .ant-form-item .ant-row {
2887
2928
  width: 100%;
2888
2929
  }
@@ -3035,47 +3076,6 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3035
3076
  .pro-form .pro-form-list-mode-block .pro-collapse-content .ant-row {
3036
3077
  width: auto;
3037
3078
  }
3038
- .pro-form .pro-form-item-changed span.ant-input-affix-wrapper,
3039
- .pro-form .pro-form-item-changed .ant-select .ant-select-selector,
3040
- .pro-form .pro-form-item-changed .ant-picker,
3041
- .pro-form .pro-form-item-changed .ant-input-number {
3042
- background: var(--zaui-contract-bg, #fffaa1) !important;
3043
- }
3044
- .pro-form .pro-form-item-changed span.ant-input-affix-wrapper input,
3045
- .pro-form .pro-form-item-changed .ant-select .ant-select-selector input,
3046
- .pro-form .pro-form-item-changed .ant-picker input,
3047
- .pro-form .pro-form-item-changed .ant-input-number input {
3048
- background: transparent;
3049
- }
3050
- .pro-form .pro-form-item-changed span.ant-input-affix-wrapper .ant-select-selection-placeholder,
3051
- .pro-form .pro-form-item-changed .ant-select .ant-select-selector .ant-select-selection-placeholder,
3052
- .pro-form .pro-form-item-changed .ant-picker .ant-select-selection-placeholder,
3053
- .pro-form .pro-form-item-changed .ant-input-number .ant-select-selection-placeholder {
3054
- z-index: 9;
3055
- }
3056
- .pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle),
3057
- .pro-form .pro-form-item-changed .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
3058
- background: var(--zaui-contract-bg, #fffaa1);
3059
- border-radius: 4px;
3060
- }
3061
- .pro-form .pro-form-item-changed .ant-form-item-control-input-content > span {
3062
- border-radius: 4px;
3063
- padding: 5px 8px;
3064
- background: var(--zaui-contract-bg, #fffaa1);
3065
- }
3066
- .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-select-selector,
3067
- .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-affix-wrapper,
3068
- .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .pro-address .ant-input-disabled {
3069
- background: var(--zaui-contract-bg, #fffaa1);
3070
- }
3071
- .pro-form .pro-form-item-changed .ant-form-item-control-input-content > .ant-input-group .forever-checkbox {
3072
- background: var(--zaui-contract-bg, #fffaa1);
3073
- }
3074
- .pro-form .pro-form-item-changed .pro-form-view-container {
3075
- padding: 4px 8px;
3076
- background: var(--zaui-contract-bg, #fffaa1);
3077
- border-radius: 4px;
3078
- }
3079
3079
  .pro-upload .pro-upload-dragger .pro-upload-handle-box {
3080
3080
  padding: var(--zaui-space-size-sm, 8px);
3081
3081
  background: #f8f9fa;
@@ -1,13 +1,18 @@
1
+ import "antd/es/tooltip/style";
2
+ import _Tooltip from "antd/es/tooltip";
3
+ import "antd/es/space/style";
4
+ import _Space from "antd/es/space";
1
5
  import "antd/es/form/style";
2
6
  import _Form from "antd/es/form";
3
7
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
9
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
5
10
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
6
11
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
7
12
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
8
13
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
9
14
  var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className", "trim", "confirm"];
10
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
15
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
16
  /* eslint-disable prefer-destructuring */
12
17
  /* eslint-disable prefer-const */
13
18
  import React, { useCallback, useEffect } from 'react';
@@ -21,10 +26,10 @@ import { useProConfig } from '../../../ProConfigProvider';
21
26
  import Container from '../../../ProForm/components/Container';
22
27
  import transformNames from '../../../ProForm/utils/transformNames';
23
28
  import { FieldProvider } from '../../../ProForm/utils/useFieldProps';
29
+ import { useListChanged } from '../../../ProForm/utils/useListChanged';
24
30
  import useRules from '../../../ProForm/utils/useRules';
25
31
  import { isSelect, isTrim } from '../../../ProForm/utils';
26
32
  import ConfirmWrapper from '../../../ProForm/components/render/ConfirmWrapper';
27
- import ListChanged from './ListChanged';
28
33
  var RenderField = function RenderField(_ref) {
29
34
  var _type, _type$replace, _fieldProps2, _names, _TargetComponent4, _componentProps, _componentProps2;
30
35
  var value = _ref.text,
@@ -484,6 +489,21 @@ var RenderField = function RenderField(_ref) {
484
489
  return _ref3.apply(this, arguments);
485
490
  };
486
491
  }();
492
+ // 判断当前字段是否变更
493
+ var _useListChanged = useListChanged({
494
+ name: cellName,
495
+ names: names,
496
+ namesStr: [].concat(_toConsumableArray(baseName), [index, dataIndex]),
497
+ rowKeyPath: [].concat(_toConsumableArray(baseName), [index, 'rowKey']),
498
+ originalName: originalName,
499
+ originalNames: originalNames,
500
+ originalValues: originalValues,
501
+ form: form,
502
+ equalWith: equalWith
503
+ }),
504
+ _useListChanged2 = _slicedToArray(_useListChanged, 2),
505
+ changed = _useListChanged2[0],
506
+ originalValue = _useListChanged2[1];
487
507
  var componentProps = _objectSpread(_objectSpread(_objectSpread({
488
508
  form: form,
489
509
  name: cellName
@@ -529,35 +549,16 @@ var RenderField = function RenderField(_ref) {
529
549
  if (isView) {
530
550
  delete _formItemProps.rules;
531
551
  }
532
- var _className = classNames(_defineProperty({}, className, className));
552
+ var _className = classNames(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-changed', changed));
533
553
  var FormItem = null;
534
- var FieldComponent = /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps));
535
- if (originalValues) {
536
- FieldComponent = _jsx(ListChanged, {
537
- name: cellName,
538
- names: names,
539
- namesStr: [].concat(_toConsumableArray(baseName), [index, dataIndex]),
540
- rowKeyPath: [].concat(_toConsumableArray(baseName), [index, 'rowKey']),
541
- originalName: originalName,
542
- originalNames: originalNames,
543
- originalValues: originalValues,
544
- form: form,
545
- equalWith: equalWith,
546
- type: type,
547
- children: FieldComponent
548
- });
549
- }
550
- if ((_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.confirm) {
551
- FieldComponent = _jsx(ConfirmWrapper, _objectSpread(_objectSpread({}, componentProps), {}, {
552
- children: FieldComponent
553
- }));
554
- }
555
554
  FormItem = TargetComponent ? _jsx(_Form.Item, _objectSpread(_objectSpread({
556
555
  validateFirst: true
557
556
  }, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name', 'onCell'])), {}, {
558
557
  className: _className,
559
558
  name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName,
560
- children: FieldComponent
559
+ children: ((_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.confirm) ? _jsx(ConfirmWrapper, _objectSpread(_objectSpread({}, componentProps), {}, {
560
+ children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
561
+ })) : /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
561
562
  })) : _jsx(Container, {
562
563
  viewEmpty: viewEmpty
563
564
  });
@@ -575,9 +576,28 @@ var RenderField = function RenderField(_ref) {
575
576
  }
576
577
  }));
577
578
  }
579
+ var originalTitle = originalDiffTip && originalValues ? _jsxs(_Space, {
580
+ children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
581
+ isView: true,
582
+ value: originalValue,
583
+ checked: type === 'Switch' ? originalValue : undefined
584
+ }))) : _jsx(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
585
+ isView: true,
586
+ value: originalValue,
587
+ checked: type === 'Switch' ? originalValue : undefined
588
+ }))]
589
+ }) : null;
578
590
  return _jsx(FieldProvider, {
579
591
  value: (_componentProps2 = componentProps) === null || _componentProps2 === void 0 ? void 0 : _componentProps2.otherProps,
580
- children: FormItem
592
+ children: !originalTitle || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
593
+ title: originalTitle,
594
+ placement: "topLeft",
595
+ open: changed ? undefined : false,
596
+ getPopupContainer: function getPopupContainer(target) {
597
+ return target.parentElement;
598
+ },
599
+ children: FormItem
600
+ })
581
601
  });
582
602
  };
583
603
  export default RenderField;
@@ -1,9 +1,9 @@
1
1
  import "antd/es/input/style";
2
2
  import _Input from "antd/es/input";
3
- import "antd/es/tooltip/style";
4
- import _Tooltip from "antd/es/tooltip";
5
3
  import "antd/es/cascader/style";
6
4
  import _Cascader from "antd/es/cascader";
5
+ import "antd/es/tooltip/style";
6
+ import _Tooltip from "antd/es/tooltip";
7
7
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
8
8
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
9
9
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
@@ -22,7 +22,6 @@ import { useProConfig } from '../../../../ProConfigProvider';
22
22
  import useEnum from '../../../../ProEnum/hooks/useEnum';
23
23
  import locale from '../../../../locale';
24
24
  import ProForm from '../../..';
25
- import Container from '../../Container';
26
25
  var Text = _Typography.Text;
27
26
  var defaultFieldNames = {
28
27
  label: 'name',
@@ -83,8 +82,7 @@ var ProCascader = function ProCascader(props) {
83
82
  detailPlaceholder = props.detailPlaceholder,
84
83
  otherProps = _objectWithoutProperties(props, _excluded);
85
84
  var _ref3 = ProForm.useFieldProps() || {},
86
- isViewCon = _ref3.isView,
87
- viewEmpty = _ref3.viewEmpty;
85
+ isViewCon = _ref3.isView;
88
86
  var addressCode = code || enumCode;
89
87
  var realIsView = typeof isView === 'boolean' ? isView : isViewCon;
90
88
  var realLevel = Math.max(2, level);
@@ -240,9 +238,17 @@ var ProCascader = function ProCascader(props) {
240
238
  }
241
239
  }
242
240
  };
243
- return realIsView ? _jsx(Container, {
244
- tooltip: !!tooltip,
245
- viewEmpty: viewEmpty,
241
+ return realIsView ? tooltip ? _jsx(_Tooltip, {
242
+ className: className,
243
+ title: tooltip === true ? viewValue : tooltip,
244
+ children: _jsx(Text, {
245
+ ellipsis: {
246
+ tooltip: false
247
+ },
248
+ children: viewValue
249
+ })
250
+ }) : _jsx("span", {
251
+ className: className,
246
252
  children: viewValue
247
253
  }) : _jsxs("div", {
248
254
  className: "pro-address ".concat(className),
@@ -1,5 +1,7 @@
1
1
  import "antd/es/col/style";
2
2
  import _Col from "antd/es/col";
3
+ import "antd/es/tooltip/style";
4
+ import _Tooltip from "antd/es/tooltip";
3
5
  import "antd/es/space/style";
4
6
  import _Space from "antd/es/space";
5
7
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
@@ -11,6 +13,7 @@ import "antd/es/form/style";
11
13
  import _Form from "antd/es/form";
12
14
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
13
15
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
16
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
14
17
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
15
18
  var _excluded = ["labelWidth", "hiddenNames", "trim", "upperCase", "className", "rules", "required", "labelRequired", "tooltip"];
16
19
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
@@ -25,10 +28,10 @@ import { isTrim, isUpperCase, findOptionByValue, parseNamePath } from '../../uti
25
28
  import { useProConfig } from '../../../ProConfigProvider';
26
29
  import transformNames from '../../utils/transformNames';
27
30
  import valueTypeMap from '../../utils/valueType';
31
+ import { useChanged } from '../../utils/useChanged';
28
32
  import tipSvg from '../../../assets/tip.svg';
29
33
  import useRules from '../../utils/useRules';
30
34
  import ConfirmWrapper from './ConfirmWrapper';
31
- import Changed from './Changed';
32
35
  // 这个组件只管渲染, 参数的整理在外部处理
33
36
  var Render = function Render(props) {
34
37
  var _ref2, _ref3, _ref4, _ref5, _otherProps$names2;
@@ -98,6 +101,18 @@ var Render = function Render(props) {
98
101
  return Array.isArray(name) ? name.join('_') : name;
99
102
  }).join('-');
100
103
  }, [otherProps === null || otherProps === void 0 ? void 0 : otherProps.names]);
104
+ // 判断当前字段是否变更
105
+ var _useChanged = useChanged({
106
+ name: formItemProps.name,
107
+ names: otherProps.names,
108
+ namesStr: namesStr,
109
+ originalValues: originalValues,
110
+ form: form,
111
+ equalWith: equalWith
112
+ }),
113
+ _useChanged2 = _slicedToArray(_useChanged, 2),
114
+ changed = _useChanged2[0],
115
+ originalValue = _useChanged2[1];
101
116
  var internalRule = useRules({
102
117
  names: otherProps.names,
103
118
  label: otherFormItemProps.label,
@@ -169,7 +184,7 @@ var Render = function Render(props) {
169
184
  var lastComponentProps = _objectSpread(_objectSpread(_objectSpread({}, componentProps), _fieldProps), {}, {
170
185
  disabled: lastDisabled
171
186
  });
172
- var _className = classNames(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-width-auto', ['Switch'].includes(type)));
187
+ var _className = classNames(_defineProperty(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-changed', changed), 'pro-form-item-width-auto', ['Switch'].includes(type)));
173
188
  if (formItemProps.hidden === true || _show === false) {
174
189
  // 为了监听shouldUpdate 必须存在一个FormItem, 空Input解决 【[antd: Form.Item] `name` is only used for validate React element】
175
190
  return _jsx(_Form.Item, {
@@ -431,17 +446,7 @@ var Render = function Render(props) {
431
446
  // @ts-ignore
432
447
  _internalItemRender: internalItemRender,
433
448
  className: _className,
434
- children: _jsx(Changed, {
435
- name: formItemProps.name,
436
- names: otherProps.names,
437
- namesStr: namesStr,
438
- originalValues: originalValues,
439
- form: form,
440
- equalWith: equalWith,
441
- originalDiffTip: originalDiffTip,
442
- type: type,
443
- children: child
444
- })
449
+ children: child
445
450
  }));
446
451
  var formItem = orgFormItem;
447
452
  // 当存在shouldUpdate时捕获所有form变更(防止表单onchange设置form值时无法更新的问题)
@@ -457,23 +462,32 @@ var Render = function Render(props) {
457
462
  // @ts-ignore
458
463
  _internalItemRender: internalItemRender,
459
464
  className: _className,
460
- children: _jsx(Changed, {
461
- name: formItemProps.name,
462
- names: otherProps.names,
463
- namesStr: namesStr,
464
- originalValues: originalValues,
465
- form: form,
466
- equalWith: equalWith,
467
- originalDiffTip: originalDiffTip,
468
- type: type,
469
- children: child
470
- })
465
+ children: child
471
466
  }));
472
467
  }
473
468
  })
474
469
  });
475
470
  }
476
- return formItem;
471
+ // 不渲染tooltip
472
+ if (!originalDiffTip || ['FormList', 'ProEditTable'].includes(type)) {
473
+ return formItem;
474
+ }
475
+ var title = _jsxs(_Space, {
476
+ children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.cloneElement(child, _objectSpread(_objectSpread({}, child), {}, {
477
+ isView: true,
478
+ value: originalValue,
479
+ checked: type === 'Switch' ? originalValue : undefined
480
+ }))]
481
+ });
482
+ return _jsx(_Tooltip, {
483
+ title: title,
484
+ open: changed ? undefined : false,
485
+ // open={true}
486
+ getPopupContainer: function getPopupContainer(target) {
487
+ return target.parentElement;
488
+ },
489
+ children: formItem
490
+ });
477
491
  };
478
492
  var FormItem = _jsxs(_Fragment, {
479
493
  children: [renderItem(), (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$names2 = otherProps.names) === null || _otherProps$names2 === void 0 ? void 0 : _otherProps$names2.length) ? otherProps.names.map(function (name) {
@@ -116,6 +116,58 @@
116
116
  }
117
117
  }
118
118
 
119
+ // 比较原始值场景下 不同时的样式
120
+ &.pro-form-item-changed {
121
+ span.@{ant-prefix}-input-affix-wrapper,
122
+ .@{ant-prefix}-select .@{ant-prefix}-select-selector,
123
+ .@{ant-prefix}-picker,
124
+ .@{ant-prefix}-input-number {
125
+ background: @zaui-contract-bg !important;
126
+
127
+ input {
128
+ background: transparent;
129
+ }
130
+ .@{ant-prefix}-select-selection-placeholder {
131
+ z-index: 9;
132
+ }
133
+ }
134
+
135
+ .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
136
+ .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
137
+ background: @zaui-contract-bg;
138
+ border-radius: 4px;
139
+ }
140
+
141
+ // 地址组件
142
+ .@{ant-prefix}-form-item-control-input-content {
143
+ // 查看模式
144
+ & > span {
145
+ border-radius: 4px;
146
+ padding: 5px 8px;
147
+ background: @zaui-contract-bg;
148
+ }
149
+
150
+ & > .pro-address {
151
+ .@{ant-prefix}-select-selector,
152
+ .@{ant-prefix}-input-affix-wrapper,
153
+ .@{ant-prefix}-input-disabled {
154
+ background: @zaui-contract-bg;
155
+ }
156
+ }
157
+ & > .@{ant-prefix}-input-group {
158
+ .forever-checkbox {
159
+ background: @zaui-contract-bg;
160
+ }
161
+ }
162
+ }
163
+
164
+ .pro-form-view-container {
165
+ padding: 4px 8px;
166
+ background: @zaui-contract-bg;
167
+ border-radius: 4px;
168
+ }
169
+ }
170
+
119
171
  .@{ant-prefix}-row {
120
172
  width: 100%;
121
173
  }
@@ -321,56 +373,4 @@
321
373
  }
322
374
  }
323
375
  }
324
-
325
- // 比较原始值场景下 不同时的样式
326
- .pro-form-item-changed {
327
- span.@{ant-prefix}-input-affix-wrapper,
328
- .@{ant-prefix}-select .@{ant-prefix}-select-selector,
329
- .@{ant-prefix}-picker,
330
- .@{ant-prefix}-input-number {
331
- background: @zaui-contract-bg !important;
332
-
333
- input {
334
- background: transparent;
335
- }
336
- .@{ant-prefix}-select-selection-placeholder {
337
- z-index: 9;
338
- }
339
- }
340
-
341
- .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
342
- .@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
343
- background: @zaui-contract-bg;
344
- border-radius: 4px;
345
- }
346
-
347
- // 地址组件
348
- .@{ant-prefix}-form-item-control-input-content {
349
- // 查看模式
350
- & > span {
351
- border-radius: 4px;
352
- padding: 5px 8px;
353
- background: @zaui-contract-bg;
354
- }
355
-
356
- & > .pro-address {
357
- .@{ant-prefix}-select-selector,
358
- .@{ant-prefix}-input-affix-wrapper,
359
- .@{ant-prefix}-input-disabled {
360
- background: @zaui-contract-bg;
361
- }
362
- }
363
- & > .@{ant-prefix}-input-group {
364
- .forever-checkbox {
365
- background: @zaui-contract-bg;
366
- }
367
- }
368
- }
369
-
370
- .pro-form-view-container {
371
- padding: 4px 8px;
372
- background: @zaui-contract-bg;
373
- border-radius: 4px;
374
- }
375
- }
376
376
  }
@@ -3,6 +3,7 @@ interface Params {
3
3
  originalValue: any;
4
4
  value: any;
5
5
  form: FormInstance;
6
+ name?: string | any[];
6
7
  equalWith?: (originalValue: any, currentValue: any) => boolean;
7
8
  }
8
9
  export declare const diffOriginal: (params: Params) => boolean;
@@ -1,9 +1,31 @@
1
- import { isEqual, isFunction } from 'lodash';
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import { isEqual, isFunction, isString } from 'lodash';
2
3
  var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
4
+ /** 将解构后的name值,反向转回names,例如 formData {a:1, b:2} names ['a', 'b'] 返回 [1,2] */
5
+ var extractValues = function extractValues(form, pathString) {
6
+ var _pathString;
7
+ var result = [];
8
+ var PrefixesName = isString(pathString) ? [] : pathString.slice(0, -1);
9
+ if (isString(pathString)) {
10
+ pathString.split('-').forEach(function (item) {
11
+ result.push(form.getFieldValue([].concat(_toConsumableArray(PrefixesName), [item])));
12
+ });
13
+ return result;
14
+ }
15
+ (_pathString = pathString[pathString.length - 1]) === null || _pathString === void 0 ? void 0 : _pathString.split('-').forEach(function (item) {
16
+ result.push(form.getFieldValue([].concat(_toConsumableArray(PrefixesName), [item])));
17
+ });
18
+ return result;
19
+ };
3
20
  export var diffOriginal = function diffOriginal(params) {
21
+ var _name$join;
4
22
  var originalValue = params.originalValue,
5
- value = params.value,
6
- equalWith = params.equalWith;
23
+ _value = params.value,
24
+ equalWith = params.equalWith,
25
+ form = params.form,
26
+ name = params.name;
27
+ var isNames = Array.isArray(name) && ((_name$join = name.join(',')) === null || _name$join === void 0 ? void 0 : _name$join.includes('-')) || (name === null || name === void 0 ? void 0 : name.includes('-'));
28
+ var value = !isNames ? _value : extractValues(form, name);
7
29
  // 支持传入自定义比较事件
8
30
  if (isFunction(equalWith)) {
9
31
  return !equalWith(originalValue, value);
@@ -18,7 +40,8 @@ export var diffOriginal = function diffOriginal(params) {
18
40
  });
19
41
  }
20
42
  if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
21
- return !isEqual(value, originalValue);
43
+ var res = !isEqual(value, originalValue);
44
+ return res;
22
45
  }
23
46
  return false;
24
47
  };
@@ -50,12 +50,6 @@ export declare const isNullArray: (arr: any) => boolean;
50
50
  */
51
51
  export declare const isEmptyArray: (arr: any) => boolean;
52
52
  export declare function toArray<T>(value?: T | T[] | null): T[];
53
- /**
54
- * names值合并
55
- * @param obj AnyObject
56
- * @returns AnyObject
57
- */
58
- export declare function processHyphenKeys(obj: AnyObject): AnyObject;
59
53
  /**
60
54
  * 初始化值names值合并
61
55
  * @param obj AnyObject