@zat-design/sisyphus-react 3.4.2-beta.1 → 3.4.2-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.
Files changed (116) hide show
  1. package/dist/index.esm.css +239 -122
  2. package/es/ProEditLabel/style/index.less +1 -1
  3. package/es/ProEditTable/components/RenderField/index.js +13 -15
  4. package/es/ProEditTable/index.js +3 -3
  5. package/es/ProEditTable/propsType.d.ts +1 -1
  6. package/es/ProEditTable/style/index.less +1 -1
  7. package/es/ProEditTable/utils/index.js +36 -22
  8. package/es/ProEditTable/utils/tools.js +3 -1
  9. package/es/ProEnum/style/index.less +2 -2
  10. package/es/ProForm/components/base/DatePicker/index.js +2 -2
  11. package/es/ProForm/components/combination/Group/index.js +6 -9
  12. package/es/ProForm/components/combination/Group/style/index.less +4 -4
  13. package/es/ProForm/components/combination/Group/utils.d.ts +2 -0
  14. package/es/ProForm/components/combination/Group/utils.js +10 -0
  15. package/es/ProForm/components/combination/ProTimeLimit/index.js +8 -2
  16. package/es/ProForm/components/render/Render.js +2 -2
  17. package/es/ProForm/components/render/RenderFields.d.ts +1 -1
  18. package/es/ProForm/components/render/RenderFields.js +2 -2
  19. package/es/ProForm/index.js +4 -4
  20. package/es/ProForm/propsType.d.ts +1 -1
  21. package/es/ProForm/utils/{contrastOriginal.d.ts → diffOriginal.d.ts} +2 -1
  22. package/es/ProForm/utils/diffOriginal.js +61 -0
  23. package/es/ProForm/utils/index.d.ts +1 -1
  24. package/es/ProForm/utils/index.js +1 -1
  25. package/es/ProForm/utils/transformValue.js +2 -2
  26. package/es/ProForm/utils/useChanged.js +4 -3
  27. package/es/ProForm/utils/useListChanged.d.ts +1 -1
  28. package/es/ProForm/utils/useListChanged.js +4 -3
  29. package/es/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +58 -55
  30. package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +25 -20
  31. package/es/ProLayout/components/Layout/Menu/style/index.less +52 -56
  32. package/es/ProLayout/components/ProCollapse/style/index.less +17 -9
  33. package/es/ProLayout/components/ProFooter/index.js +1 -1
  34. package/es/ProLayout/components/ProFooter/style/index.less +1 -1
  35. package/es/ProLayout/components/ProHeader/style/index.less +4 -3
  36. package/es/ProLayout/style/index.less +173 -87
  37. package/es/ProTable/components/RenderColumn/index.d.ts +1 -1
  38. package/es/ProTable/components/RenderColumn/index.js +3 -3
  39. package/es/ProTable/propsType.d.ts +1 -1
  40. package/es/ProTable/style/index.less +2 -2
  41. package/es/ProTable/utils.js +9 -9
  42. package/es/ProTabs/style/index.less +3 -1
  43. package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  44. package/es/ProThemeTools/component/PrdTools/index.js +2 -2
  45. package/es/ProThemeTools/component/PrdTools/style/index.less +1 -1
  46. package/es/ProThemeTools/index.js +21 -28
  47. package/es/ProThemeTools/propsType.d.ts +1 -1
  48. package/es/ProThemeTools/style/index.less +25 -8
  49. package/es/ProTreeModal/style/index.less +2 -2
  50. package/es/ProUpload/style/fileItem.less +2 -2
  51. package/es/ProUpload/style/index.less +2 -2
  52. package/es/assets/setting.svg +14 -0
  53. package/es/style/components.less +0 -1
  54. package/es/style/theme/antd.less +0 -1
  55. package/es/style/theme/index.less +2 -2
  56. package/es/style/theme/tokens.less +2 -2
  57. package/es/tokens.js +2 -2
  58. package/lib/ProEditLabel/style/index.less +1 -1
  59. package/lib/ProEditTable/components/RenderField/index.js +12 -14
  60. package/lib/ProEditTable/index.js +3 -3
  61. package/lib/ProEditTable/propsType.d.ts +1 -1
  62. package/lib/ProEditTable/style/index.less +1 -1
  63. package/lib/ProEditTable/utils/index.js +36 -22
  64. package/lib/ProEditTable/utils/tools.js +3 -1
  65. package/lib/ProEnum/style/index.less +2 -2
  66. package/lib/ProForm/components/base/DatePicker/index.js +1 -1
  67. package/lib/ProForm/components/combination/Group/index.js +4 -7
  68. package/lib/ProForm/components/combination/Group/style/index.less +4 -4
  69. package/lib/ProForm/components/combination/Group/utils.d.ts +2 -0
  70. package/lib/ProForm/components/combination/Group/utils.js +11 -1
  71. package/lib/ProForm/components/combination/ProTimeLimit/index.js +7 -1
  72. package/lib/ProForm/components/render/Render.js +2 -2
  73. package/lib/ProForm/components/render/RenderFields.d.ts +1 -1
  74. package/lib/ProForm/components/render/RenderFields.js +2 -2
  75. package/lib/ProForm/index.js +4 -4
  76. package/lib/ProForm/propsType.d.ts +1 -1
  77. package/lib/ProForm/utils/{contrastOriginal.d.ts → diffOriginal.d.ts} +2 -1
  78. package/lib/ProForm/utils/diffOriginal.js +68 -0
  79. package/lib/ProForm/utils/index.d.ts +1 -1
  80. package/lib/ProForm/utils/index.js +2 -2
  81. package/lib/ProForm/utils/transformValue.js +1 -1
  82. package/lib/ProForm/utils/useChanged.js +4 -3
  83. package/lib/ProForm/utils/useListChanged.d.ts +1 -1
  84. package/lib/ProForm/utils/useListChanged.js +4 -3
  85. package/lib/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +58 -55
  86. package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +25 -20
  87. package/lib/ProLayout/components/Layout/Menu/style/index.less +52 -56
  88. package/lib/ProLayout/components/ProCollapse/style/index.less +17 -9
  89. package/lib/ProLayout/components/ProFooter/index.js +1 -1
  90. package/lib/ProLayout/components/ProFooter/style/index.less +1 -1
  91. package/lib/ProLayout/components/ProHeader/style/index.less +4 -3
  92. package/lib/ProLayout/style/index.less +173 -87
  93. package/lib/ProTable/components/RenderColumn/index.d.ts +1 -1
  94. package/lib/ProTable/components/RenderColumn/index.js +3 -3
  95. package/lib/ProTable/propsType.d.ts +1 -1
  96. package/lib/ProTable/style/index.less +2 -2
  97. package/lib/ProTable/utils.js +9 -9
  98. package/lib/ProTabs/style/index.less +3 -1
  99. package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  100. package/lib/ProThemeTools/component/PrdTools/index.js +2 -2
  101. package/lib/ProThemeTools/component/PrdTools/style/index.less +1 -1
  102. package/lib/ProThemeTools/index.js +19 -27
  103. package/lib/ProThemeTools/propsType.d.ts +1 -1
  104. package/lib/ProThemeTools/style/index.less +25 -8
  105. package/lib/ProTreeModal/style/index.less +2 -2
  106. package/lib/ProUpload/style/fileItem.less +2 -2
  107. package/lib/ProUpload/style/index.less +2 -2
  108. package/lib/assets/setting.svg +14 -0
  109. package/lib/style/components.less +0 -1
  110. package/lib/style/theme/antd.less +0 -1
  111. package/lib/style/theme/index.less +2 -2
  112. package/lib/style/theme/tokens.less +2 -2
  113. package/lib/tokens.js +2 -2
  114. package/package.json +1 -1
  115. package/es/ProForm/utils/contrastOriginal.js +0 -24
  116. package/lib/ProForm/utils/contrastOriginal.js +0 -30
@@ -39,7 +39,7 @@
39
39
 
40
40
  &:active {
41
41
  background : #E3E8F0;
42
- border-radius: var(--zaui-border-radius-card, 2px);
42
+ border-radius: var(--zaui-border-radius-card, 4px);
43
43
  }
44
44
  }
45
45
 
@@ -17,7 +17,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
17
17
  /* eslint-disable prefer-const */
18
18
  import React, { useCallback, useEffect } from 'react';
19
19
  import classNames from 'classnames';
20
- import { cloneDeep, isEqual, debounce, omit, isFunction, isString } from 'lodash';
20
+ import { cloneDeep, isEqual, debounce, omit, isFunction, get } from 'lodash';
21
21
  import valueTypeMap from '../../../ProForm/utils/valueType';
22
22
  import transformMap from '../../utils/transform';
23
23
  import { getNamePath, difference } from '../../utils/tools';
@@ -28,9 +28,8 @@ import { FieldProvider } from '../../../ProForm/utils/useFieldProps';
28
28
  import { useListChanged } from '../../../ProForm/utils/useListChanged';
29
29
  import useRules from '../../../ProForm/utils/useRules';
30
30
  import { isSelect } from '../../../ProForm/utils';
31
- import locale from '../../../locale';
32
31
  var RenderField = function RenderField(_ref) {
33
- var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names, _formItemChildProps$p, _TargetComponent4;
32
+ var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names, _TargetComponent4;
34
33
  var value = _ref.text,
35
34
  record = _ref.record,
36
35
  index = _ref.index,
@@ -73,7 +72,7 @@ var RenderField = function RenderField(_ref) {
73
72
  virtualKey = config.virtualKey,
74
73
  viewEmpty = config.viewEmpty,
75
74
  originalValues = config.originalValues,
76
- originalTip = config.originalTip;
75
+ originalDiffTip = config.originalDiffTip;
77
76
  var _fieldProps = fieldProps || formItemProps || {};
78
77
  var _rules = rules || [];
79
78
  var _required = required;
@@ -86,7 +85,7 @@ var RenderField = function RenderField(_ref) {
86
85
  type = ((_type = type) === null || _type === void 0 ? void 0 : (_type$replace = _type.replace) === null || _type$replace === void 0 ? void 0 : _type$replace.call(_type, type[0], type[0].toUpperCase())) || 'Input';
87
86
  // 单行正在编辑时,临时生成一套formItem用来存储中间值,点击取消时候重置回上一次状态
88
87
  var namePath = getNamePath(name, virtualKey);
89
- var rowData = form.getFieldValue([].concat(_toConsumableArray(namePath), [index])) || record || {};
88
+ var rowData = get(form.getFieldsValue(), [].concat(_toConsumableArray(namePath), [index])) || record || {};
90
89
  var currentValue = dataIndex ? rowData === null || rowData === void 0 ? void 0 : rowData[dataIndex] : null;
91
90
  // 第三个参数
92
91
  var options = {
@@ -141,7 +140,7 @@ var RenderField = function RenderField(_ref) {
141
140
  var formItemChildProps = _objectSpread({}, _fieldProps);
142
141
  // 允许formItem的属性放在column最外层
143
142
  var _formItemProps = _objectSpread(_objectSpread({}, resetProps), internalRule);
144
- if (['Switch', 'Checkbox'].includes(type)) {
143
+ if (['Switch', 'SwitchCheckbox'].includes(type)) {
145
144
  _formItemProps.valuePropName = 'checked';
146
145
  valueType = 'switch';
147
146
  }
@@ -241,8 +240,6 @@ var RenderField = function RenderField(_ref) {
241
240
  TargetComponent = viewRender;
242
241
  }
243
242
  }
244
- var defaultPlaceholder = ['Select', 'EnumSelect', 'DatePicker', 'RangePicker', 'Cascader', 'ProSelect', 'ProEnum', 'ProTimeLimit'].includes(type) ? "".concat(locale.ProEditTable.select).concat(isString(label) ? label || title : '') : "".concat(locale.ProEditTable.enter).concat(isString(label) ? label || title : '');
245
- var _placeholder = (_formItemChildProps$p = formItemChildProps === null || formItemChildProps === void 0 ? void 0 : formItemChildProps.placeholder) !== null && _formItemChildProps$p !== void 0 ? _formItemChildProps$p : defaultPlaceholder;
246
243
  var onChange = formItemChildProps === null || formItemChildProps === void 0 ? void 0 : formItemChildProps.onChange;
247
244
  var onFieldChange = formItemChildProps === null || formItemChildProps === void 0 ? void 0 : formItemChildProps.onFieldChange;
248
245
  var onBlur = formItemChildProps === null || formItemChildProps === void 0 ? void 0 : formItemChildProps.onBlur;
@@ -303,7 +300,7 @@ var RenderField = function RenderField(_ref) {
303
300
  }
304
301
  _args = [].concat(args);
305
302
  rowPath = [].concat(_toConsumableArray(namePath), [index]);
306
- row = form.getFieldValue(rowPath);
303
+ row = form.getFieldValue(rowPath, true);
307
304
  orgRow = cloneDeep(row);
308
305
  if (!onFieldChange) {
309
306
  _context.next = 18;
@@ -355,7 +352,9 @@ var RenderField = function RenderField(_ref) {
355
352
  return [].concat(_toConsumableArray(rowPath), [key]);
356
353
  });
357
354
  if (validateFieldKeys === null || validateFieldKeys === void 0 ? void 0 : validateFieldKeys.length) {
358
- form.validateFields(validateFieldKeys);
355
+ setTimeout(function () {
356
+ form.validateFields(validateFieldKeys);
357
+ }, 100);
359
358
  }
360
359
  }
361
360
  setState({
@@ -468,8 +467,7 @@ var RenderField = function RenderField(_ref) {
468
467
  originalValue = _useListChanged2[1];
469
468
  var componentProps = _objectSpread(_objectSpread(_objectSpread({
470
469
  form: form,
471
- name: cellName,
472
- placeholder: _placeholder
470
+ name: cellName
473
471
  }, _fieldProps), (_TargetComponent4 = TargetComponent) === null || _TargetComponent4 === void 0 ? void 0 : _TargetComponent4.props), {}, {
474
472
  disabled: _disabled,
475
473
  onChange: _onchange,
@@ -487,7 +485,7 @@ var RenderField = function RenderField(_ref) {
487
485
  if (isCell) {
488
486
  record["".concat(dataIndex, "-Disabled")] = _disabled;
489
487
  }
490
- if (['Switch', 'Checkbox'].includes(type)) {
488
+ if (['Switch', 'SwitchCheckbox'].includes(type)) {
491
489
  _formItemProps.valuePropName = 'checked';
492
490
  }
493
491
  useEffect(function () {
@@ -507,7 +505,7 @@ var RenderField = function RenderField(_ref) {
507
505
  delete _formItemProps.rules;
508
506
  }
509
507
  var _className = classNames(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-changed', changed));
510
- var originalTitle = originalTip ? _jsxs(_Space, {
508
+ var originalTitle = originalDiffTip ? _jsxs(_Space, {
511
509
  children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({}, omit(componentProps, ['onFieldChange'])), {}, {
512
510
  isView: true,
513
511
  value: originalValue,
@@ -529,7 +527,7 @@ var RenderField = function RenderField(_ref) {
529
527
  });
530
528
  return _jsx(FieldProvider, {
531
529
  value: componentProps === null || componentProps === void 0 ? void 0 : componentProps.otherProps,
532
- children: !originalTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
530
+ children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
533
531
  title: originalTitle,
534
532
  open: changed ? undefined : false,
535
533
  children: FormItem
@@ -10,7 +10,7 @@ import _ConfigProvider from "antd/es/config-provider";
10
10
  import "antd/es/form/style";
11
11
  import _Form from "antd/es/form";
12
12
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
13
- var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "otherProps", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalTip", "rowKey"];
13
+ var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "otherProps", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey"];
14
14
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
15
15
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
16
16
  import { get, isArray } from 'lodash';
@@ -49,7 +49,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
49
49
  headerRender = _ref.headerRender,
50
50
  pagination = _ref.pagination,
51
51
  originalValues = _ref.originalValues,
52
- originalTip = _ref.originalTip,
52
+ originalDiffTip = _ref.originalDiffTip,
53
53
  rowKey = _ref.rowKey,
54
54
  resetProps = _objectWithoutProperties(_ref, _excluded);
55
55
  // 上下文form
@@ -151,7 +151,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
151
151
  tableLength: value === null || value === void 0 ? void 0 : value.length,
152
152
  page: page,
153
153
  originalValues: originalValues,
154
- originalTip: originalTip,
154
+ originalDiffTip: originalDiffTip,
155
155
  prefixCls: prefixCls
156
156
  };
157
157
  // 编辑行设置下样式
@@ -130,7 +130,7 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
130
130
  * @description 原始数据源,是否tooltip显示
131
131
  * @default -
132
132
  */
133
- originalTip?: boolean;
133
+ originalDiffTip?: boolean;
134
134
  /**
135
135
  * @description 可编辑表格的类型,单行、多行、单元格编辑
136
136
  * @default false
@@ -55,7 +55,7 @@
55
55
 
56
56
  &:hover {
57
57
  border : 1px solid #DEE0E3;
58
- border-radius: var(--zaui-border-radius, 4px);
58
+ border-radius: var(--zaui-border-radius, 8px);
59
59
  text-indent : 5px;
60
60
  }
61
61
  }
@@ -85,40 +85,54 @@ var getActionColumn = function getActionColumn(config) {
85
85
  index = tools.calc(firstIndex, '+', index);
86
86
  rowName = [].concat(_toConsumableArray(virtualRowName), [index]);
87
87
  if (!(type === 'save')) {
88
- _context.next = 5;
88
+ _context.next = 12;
89
89
  break;
90
90
  }
91
- _context.next = 5;
91
+ _context.prev = 3;
92
+ _context.next = 6;
92
93
  return customValidate(validateKeys, form, rowName);
93
- case 5:
94
+ case 6:
95
+ _context.next = 12;
96
+ break;
97
+ case 8:
98
+ _context.prev = 8;
99
+ _context.t0 = _context["catch"](3);
100
+ setTimeout(function () {
101
+ var errorDom = document.querySelector('.ant-form-item-has-error');
102
+ if (errorDom) {
103
+ errorDom.scrollIntoViewIfNeeded(true);
104
+ }
105
+ }, 0);
106
+ return _context.abrupt("return", Promise.reject(_context.t0));
107
+ case 12:
94
108
  // 编辑状态使用自定义form值,非编辑状态直接使用行数据
95
109
  _record = (_form$getFieldValue = form.getFieldValue(rowName)) !== null && _form$getFieldValue !== void 0 ? _form$getFieldValue : record; // 新增事件可以设置初始默认值,当做函数的出参导出
96
110
  onEvent = onClick || onHandle;
97
- _context.next = 9;
111
+ _context.next = 16;
98
112
  return onEvent === null || onEvent === void 0 ? void 0 : onEvent(_record, index, {
99
113
  form: form,
100
114
  namePath: virtualRowName
101
115
  });
102
- case 9:
103
- _context.t1 = _yield$onEvent = _context.sent;
104
- _context.t0 = _context.t1 !== null;
105
- if (!_context.t0) {
106
- _context.next = 13;
116
+ case 16:
117
+ _context.t2 = _yield$onEvent = _context.sent;
118
+ _context.t1 = _context.t2 !== null;
119
+ if (!_context.t1) {
120
+ _context.next = 20;
107
121
  break;
108
122
  }
109
- _context.t0 = _yield$onEvent !== void 0;
110
- case 13:
111
- if (!_context.t0) {
112
- _context.next = 17;
123
+ _context.t1 = _yield$onEvent !== void 0;
124
+ case 20:
125
+ if (!_context.t1) {
126
+ _context.next = 24;
113
127
  break;
114
128
  }
115
- _context.t2 = _yield$onEvent;
116
- _context.next = 18;
129
+ _context.t3 = _yield$onEvent;
130
+ _context.next = 25;
117
131
  break;
118
- case 17:
119
- _context.t2 = true;
120
- case 18:
121
- result = _context.t2;
132
+ case 24:
133
+ _context.t3 = true;
134
+ case 25:
135
+ result = _context.t3;
122
136
  if (result && type !== 'custom') {
123
137
  actions[type](_objectSpread(_objectSpread({}, config), {}, {
124
138
  rowName: [].concat(_toConsumableArray(name), [index]),
@@ -128,11 +142,11 @@ var getActionColumn = function getActionColumn(config) {
128
142
  validateKeys: validateKeys
129
143
  }));
130
144
  }
131
- case 20:
145
+ case 27:
132
146
  case "end":
133
147
  return _context.stop();
134
148
  }
135
- }, _callee);
149
+ }, _callee, null, [[3, 8]]);
136
150
  }));
137
151
  return function (_x, _x2) {
138
152
  return _ref.apply(this, arguments);
@@ -280,7 +294,7 @@ export var transformColumns = function transformColumns() {
280
294
  (_item$fieldProps3 = item.fieldProps) === null || _item$fieldProps3 === void 0 ? true : delete _item$fieldProps3.useRequest;
281
295
  }
282
296
  var _render = function _render(text, record, index) {
283
- var isEditing = !virtualKey || editingKeys.includes(record.rowKey);
297
+ var isEditing = !virtualKey || editingKeys.includes(record.rowKey) || record.addFlag;
284
298
  var namePath = isArray(name) ? name : [name];
285
299
  if (virtualKey && editingKeys.includes(record.rowKey)) {
286
300
  namePath = getNamePath(name, virtualKey);
@@ -6,7 +6,9 @@ export var getRandom = function getRandom() {
6
6
  export var difference = function difference(object, base) {
7
7
  var changes = function changes(object, base) {
8
8
  return transform(object, function (result, value, key) {
9
- if (!isEqual(value, base[key])) {
9
+ if (key.indexOf('-') > -1) {
10
+ result[key] = true;
11
+ } else if (!isEqual(value, base[key])) {
10
12
  result[key] = isObject(value) && isObject(base[key]) ? changes(value, base[key]) : value;
11
13
  }
12
14
  });
@@ -38,8 +38,7 @@
38
38
  display: flex;
39
39
  align-items: center;
40
40
  justify-content: center;
41
- margin-bottom: calc(var(--zaui-space-size-sm; 8px) * var(--zaui-size; 1));
42
- padding: var(--zaui-space-size-sm) var(--zaui-space-border);
41
+ padding: 6px var(--zaui-space-border);
43
42
  line-height: 18px;
44
43
  background-color: #f1f3f6ff;
45
44
  border: 1px solid transparent;
@@ -73,6 +72,7 @@
73
72
  .pro-enum-group-item-selected {
74
73
  color: var(--zaui-brand);
75
74
  border: 1px solid var(--zaui-brand);
75
+ background: #fff;
76
76
  &::after {
77
77
  background: transparent;
78
78
  }
@@ -5,7 +5,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
5
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
6
6
  var _excluded = ["className", "format"];
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
- import { isFunction, isString } from 'lodash';
8
+ import { isFunction, isString, isObject } from 'lodash';
9
9
  import classNames from 'classnames';
10
10
  import moment from 'moment';
11
11
  import { useProConfig } from '../../../../ProConfigProvider';
@@ -30,7 +30,7 @@ var DatePicker = function DatePicker(props) {
30
30
  var viewChildren = null;
31
31
  if (!value) {
32
32
  viewChildren = null;
33
- } else if (typeof format === 'string' && moment.isMoment(value)) {
33
+ } else if (typeof format === 'string' && isObject(value)) {
34
34
  viewChildren = value.format(format);
35
35
  } else if (isFunction(format)) {
36
36
  viewChildren = format(value);
@@ -4,14 +4,13 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
4
  import "antd/es/button/style";
5
5
  import _Button from "antd/es/button";
6
6
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
7
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
8
7
  import { jsx as _jsx } from "react/jsx-runtime";
9
8
  import { useMemo } from 'react';
10
9
  import { omit, isFunction } from 'lodash';
11
- import { useDeepCompareEffect, useCounter } from 'ahooks';
10
+ import { useDeepCompareEffect } from 'ahooks';
12
11
  import classnames from 'classnames';
13
12
  import RenderFields from '../../render/RenderFields';
14
- import { insertSeparator } from './utils';
13
+ import { insertSeparator, transformNamesString } from './utils';
15
14
  import ProForm from '../../../../ProForm';
16
15
  var Group = function Group(props) {
17
16
  var columns = props.children,
@@ -24,10 +23,6 @@ var Group = function Group(props) {
24
23
  id = props.id,
25
24
  value = props.value,
26
25
  onFieldChange = props.onFieldChange;
27
- var _useCounter = useCounter(0),
28
- _useCounter2 = _slicedToArray(_useCounter, 2),
29
- num = _useCounter2[0],
30
- inc = _useCounter2[1].inc;
31
26
  var _ref = ProForm.useFieldProps() || {},
32
27
  names = _ref.names,
33
28
  name = _ref.name,
@@ -65,13 +60,15 @@ var Group = function Group(props) {
65
60
  })
66
61
  }, "".concat(className), className));
67
62
  useDeepCompareEffect(function () {
63
+ var _document, _document$activeEleme;
64
+ // 焦点激活的表单
65
+ var touchName = ((_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) || '';
68
66
  // 模拟change,初始化不执行onFieldChange
69
- if (isFunction(onFieldChange) && num >= 1) {
67
+ if (isFunction(onFieldChange) && form.isFieldsTouched(names) && transformNamesString(names).includes(touchName)) {
70
68
  onFieldChange(value, form.getFieldsValue(), {
71
69
  form: form
72
70
  });
73
71
  }
74
- inc();
75
72
  }, [value]);
76
73
  return _jsx("div", {
77
74
  className: _className,
@@ -9,13 +9,13 @@
9
9
  }
10
10
 
11
11
  .start-radius() {
12
- border-start-start-radius: var(--zaui-border-radius, 4px);
13
- border-end-start-radius: var(--zaui-border-radius, 4px);
12
+ border-start-start-radius: 4px;
13
+ border-end-start-radius: 4px;
14
14
  }
15
15
 
16
16
  .end-radius() {
17
- border-start-end-radius: var(--zaui-border-radius, 4px);
18
- border-end-end-radius: var(--zaui-border-radius, 4px);
17
+ border-start-end-radius: 4px;
18
+ border-end-end-radius: 4px;
19
19
  }
20
20
 
21
21
  .pro-group {
@@ -6,3 +6,5 @@ import { SpaceType } from './propsType';
6
6
  * @returns
7
7
  */
8
8
  export declare const insertSeparator: (columns: any, space?: SpaceType, separatorNode?: ReactNode, otherProps?: any) => any;
9
+ /** 转换names */
10
+ export declare const transformNamesString: (arr: (string | string[])[]) => (string | string[])[];
@@ -33,4 +33,14 @@ export var insertSeparator = function insertSeparator(columns, space, separatorN
33
33
  }
34
34
  return result;
35
35
  }, []);
36
+ };
37
+ /** 转换names */
38
+ export var transformNamesString = function transformNamesString(arr) {
39
+ var result = arr.map(function (subArr) {
40
+ if (Array.isArray(subArr)) {
41
+ return subArr.join('_');
42
+ }
43
+ return subArr;
44
+ });
45
+ return result;
36
46
  };
@@ -11,7 +11,7 @@ var _excluded = ["format", "disabled", "foreverTime", "foreverText", "valueType"
11
11
  _excluded2 = ["mode"];
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import classNames from 'classnames';
14
- import { omit } from 'lodash';
14
+ import { omit, isObject } from 'lodash';
15
15
  import moment from 'moment';
16
16
  import { useMemo } from 'react';
17
17
  import { useProConfig } from '../../../../ProConfigProvider';
@@ -53,7 +53,7 @@ export var ProTimeLimit = function ProTimeLimit(props) {
53
53
  onChange = _useControlled2[1];
54
54
  var initialConfig = useProConfig('ProTimeLimit');
55
55
  var isForever = useMemo(function () {
56
- if (moment.isMoment(value)) {
56
+ if (isObject(value)) {
57
57
  return foreverMoment.format(format) === value.format(format);
58
58
  }
59
59
  return false;
@@ -73,6 +73,12 @@ export var ProTimeLimit = function ProTimeLimit(props) {
73
73
  children: foreverText
74
74
  });
75
75
  }
76
+ if (isObject(value)) {
77
+ return _jsx(Container, {
78
+ viewEmpty: viewEmpty,
79
+ children: value.format(format)
80
+ });
81
+ }
76
82
  return _jsx(Container, {
77
83
  viewEmpty: viewEmpty,
78
84
  children: props.value
@@ -52,7 +52,7 @@ var Render = function Render(props) {
52
52
  originalValues = props.originalValues,
53
53
  equalWith = props.equalWith,
54
54
  requiredOnView = props.requiredOnView,
55
- originalTip = props.originalTip,
55
+ originalDiffTip = props.originalDiffTip,
56
56
  confirm = props.confirm,
57
57
  globalControl = props.globalControl;
58
58
  var colProps = props.colProps;
@@ -434,7 +434,7 @@ var Render = function Render(props) {
434
434
  });
435
435
  }
436
436
  // 不渲染tooltip
437
- if (!originalTip || ['FormList', 'ProEditTable'].includes(type)) {
437
+ if (!originalDiffTip || ['FormList', 'ProEditTable'].includes(type)) {
438
438
  return formItem;
439
439
  }
440
440
  var title = _jsxs(_Space, {
@@ -17,7 +17,7 @@ interface Props<T = any> {
17
17
  clearNotShow?: boolean;
18
18
  requiredOnView?: boolean;
19
19
  required?: boolean | (() => boolean);
20
- originalTip?: boolean;
20
+ originalDiffTip?: boolean;
21
21
  globalControl?: boolean;
22
22
  }
23
23
  declare const RenderFields: React.FC<Props>;
@@ -25,7 +25,7 @@ var RenderFields = function RenderFields(props) {
25
25
  outerClearNotShow = props.clearNotShow,
26
26
  requiredOnView = props.requiredOnView,
27
27
  required = props.required,
28
- originalTip = props.originalTip,
28
+ originalDiffTip = props.originalDiffTip,
29
29
  globalControl = props.globalControl;
30
30
  // 是否包含隐藏字段
31
31
  var hiddenData = columns.filter(function (item) {
@@ -205,7 +205,7 @@ var RenderFields = function RenderFields(props) {
205
205
  originalValues: originalValues,
206
206
  equalWith: equalWith,
207
207
  requiredOnView: requiredOnView,
208
- originalTip: originalTip,
208
+ originalDiffTip: originalDiffTip,
209
209
  globalControl: globalControl
210
210
  })
211
211
  }, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
@@ -12,7 +12,7 @@ import _Space from "antd/es/space";
12
12
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
13
13
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
14
14
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
15
- 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", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "originalTip", "formKey", "globalControl"];
15
+ 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", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "originalDiffTip", "formKey", "globalControl"];
16
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
17
  import { DoubleLeftOutlined } from '@ant-design/icons';
18
18
  import classnames from 'classnames';
@@ -63,8 +63,8 @@ var ProForm = function ProForm(props, ref) {
63
63
  requiredOnView = _props$requiredOnView === void 0 ? true : _props$requiredOnView,
64
64
  formId = props.formId,
65
65
  required = props.required,
66
- _props$originalTip = props.originalTip,
67
- originalTip = _props$originalTip === void 0 ? true : _props$originalTip,
66
+ _props$originalDiffTi = props.originalDiffTip,
67
+ originalDiffTip = _props$originalDiffTi === void 0 ? true : _props$originalDiffTi,
68
68
  formKey = props.formKey,
69
69
  globalControl = props.globalControl,
70
70
  otherProps = _objectWithoutProperties(props, _excluded);
@@ -254,7 +254,7 @@ var ProForm = function ProForm(props, ref) {
254
254
  clearNotShow: clearNotShow,
255
255
  requiredOnView: requiredOnView,
256
256
  required: required,
257
- originalTip: originalTip,
257
+ originalDiffTip: originalDiffTip,
258
258
  globalControl: globalControl
259
259
  }), children, footerRender()]
260
260
  }))
@@ -69,7 +69,7 @@ export interface ProFormProps<Values = any> extends FormProps<Values> {
69
69
  requiredOnView?: boolean;
70
70
  formId?: string;
71
71
  required?: boolean;
72
- originalTip?: boolean;
72
+ originalDiffTip?: boolean;
73
73
  }
74
74
  export interface Transform<T = any> {
75
75
  normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
@@ -3,7 +3,8 @@ 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
- export declare const contrastOriginal: (params: Params) => boolean;
9
+ export declare const diffOriginal: (params: Params) => boolean;
9
10
  export {};
@@ -0,0 +1,61 @@
1
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
2
+ import { isEqual, isFunction } from 'lodash';
3
+ var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
4
+ var extractValue = function extractValue(obj, path) {
5
+ var value = obj || {};
6
+ if (!Object.keys(obj)) {
7
+ return [];
8
+ }
9
+ var _iterator = _createForOfIteratorHelper(path),
10
+ _step;
11
+ try {
12
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
13
+ var key = _step.value;
14
+ if (value && value.hasOwnProperty(key)) {
15
+ value = value[key];
16
+ } else {
17
+ return undefined;
18
+ }
19
+ }
20
+ } catch (err) {
21
+ _iterator.e(err);
22
+ } finally {
23
+ _iterator.f();
24
+ }
25
+ return Object.values(value);
26
+ };
27
+ /** 将解构后的name值,反向转回names,例如 formData {a:1, b:2} names ['a', 'b'] 返回 [1,2] */
28
+ var extractValues = function extractValues(data, pathString) {
29
+ if (pathString.includes('_')) {
30
+ var namePrefixes = pathString.split('-')[0].split('_').slice(0, -1);
31
+ return extractValue(data, namePrefixes);
32
+ }
33
+ return pathString.split('-').map(function (item) {
34
+ return data[item];
35
+ });
36
+ };
37
+ export var diffOriginal = function diffOriginal(params) {
38
+ var originalValue = params.originalValue,
39
+ _value = params.value,
40
+ equalWith = params.equalWith,
41
+ form = params.form,
42
+ name = params.name;
43
+ var value = !(name === null || name === void 0 ? void 0 : name.includes('-')) ? _value : extractValues(form.getFieldsValue(), name);
44
+ // 支持传入自定义比较事件
45
+ if (isFunction(equalWith)) {
46
+ return !equalWith(originalValue, value);
47
+ }
48
+ if (Array.isArray(originalValue)) {
49
+ return originalValue.some(function (valueItem, index) {
50
+ // 如果两个值有一个不是空值, 则进行深比较
51
+ if (!nullValue.includes(value === null || value === void 0 ? void 0 : value[index]) || !nullValue.includes(valueItem)) {
52
+ return !isEqual(value === null || value === void 0 ? void 0 : value[index], valueItem);
53
+ }
54
+ return false;
55
+ });
56
+ }
57
+ if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
58
+ return !isEqual(value, originalValue);
59
+ }
60
+ return false;
61
+ };
@@ -26,7 +26,7 @@ export declare const isTrim: (type: string, trim: boolean, configData: any) => a
26
26
  */
27
27
  export declare const isUpperCase: (type: string, upperCase: boolean) => any;
28
28
  export declare const weedOutProps: (data: Record<string, any>, keys: string[]) => {}[];
29
- export declare const contrast: (prevValues: any, curValues: any, names: NamePath[]) => boolean;
29
+ export declare const diffField: (prevValues: any, curValues: any, names: NamePath[]) => boolean;
30
30
  export declare const splitNameStr: (name: string) => NamePath[];
31
31
  export declare const filterInternalFields: (values: any) => any;
32
32
  export declare const getAllNamePath: (object: Record<string, any>, currentPath?: InternalNamePath) => InternalNamePath[];
@@ -108,7 +108,7 @@ export var weedOutProps = function weedOutProps(data, keys) {
108
108
  return [obj, weedOut];
109
109
  };
110
110
  // 对比字段变化
111
- export var contrast = function contrast(prevValues, curValues, names) {
111
+ export var diffField = function diffField(prevValues, curValues, names) {
112
112
  return names.some(function (name) {
113
113
  return _.get(prevValues, name) !== _.get(curValues, name);
114
114
  });
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  var _excluded = ["value"];
4
4
  import { set } from 'lodash';
5
- import { contrast } from '../utils';
5
+ import { diffField } from '../utils';
6
6
  export var transformValue = function transformValue(names, form, fieldName, _normalize, _getValueProps) {
7
7
  return {
8
8
  normalize: function normalize(value) {
@@ -41,7 +41,7 @@ export var transformValue = function transformValue(names, form, fieldName, _nor
41
41
  }, cusRest);
42
42
  },
43
43
  shouldUpdate: function shouldUpdate(prevValues, curValues) {
44
- return contrast(prevValues, curValues, names);
44
+ return diffField(prevValues, curValues, names);
45
45
  }
46
46
  };
47
47
  };