@zat-design/sisyphus-react 3.4.2-beta.2 → 3.4.2-beta.21

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 (128) hide show
  1. package/dist/index.esm.css +257 -127
  2. package/dist/less.esm.css +5028 -0
  3. package/dist/less.esm.js +3 -0
  4. package/es/ProEditTable/components/RenderField/index.js +13 -15
  5. package/es/ProEditTable/index.js +3 -3
  6. package/es/ProEditTable/propsType.d.ts +1 -1
  7. package/es/ProEditTable/utils/config.js +5 -5
  8. package/es/ProEditTable/utils/index.js +67 -30
  9. package/es/ProEditTable/utils/tools.js +3 -1
  10. package/es/ProEnum/components/Group.d.ts +1 -0
  11. package/es/ProEnum/components/Group.js +21 -8
  12. package/es/ProEnum/index.js +4 -2
  13. package/es/ProEnum/style/index.less +12 -3
  14. package/es/ProForm/components/combination/Group/index.js +8 -9
  15. package/es/ProForm/components/combination/Group/propsType.d.ts +1 -0
  16. package/es/ProForm/components/combination/Group/style/index.less +4 -4
  17. package/es/ProForm/components/combination/Group/utils.d.ts +2 -0
  18. package/es/ProForm/components/combination/Group/utils.js +10 -0
  19. package/es/ProForm/components/combination/ProTimeLimit/style/index.less +1 -1
  20. package/es/ProForm/components/render/Render.js +2 -2
  21. package/es/ProForm/components/render/RenderFields.d.ts +1 -1
  22. package/es/ProForm/components/render/RenderFields.js +2 -2
  23. package/es/ProForm/index.js +4 -4
  24. package/es/ProForm/propsType.d.ts +1 -1
  25. package/es/ProForm/style/index.less +16 -2
  26. package/es/ProForm/utils/{contrastOriginal.d.ts → diffOriginal.d.ts} +2 -1
  27. package/es/ProForm/utils/diffOriginal.js +61 -0
  28. package/es/ProForm/utils/index.d.ts +1 -1
  29. package/es/ProForm/utils/index.js +1 -1
  30. package/es/ProForm/utils/transformValue.js +2 -2
  31. package/es/ProForm/utils/useChanged.js +4 -3
  32. package/es/ProForm/utils/useListChanged.d.ts +1 -1
  33. package/es/ProForm/utils/useListChanged.js +5 -3
  34. package/es/ProIcon/index.d.ts +0 -1
  35. package/es/ProIcon/index.js +7 -29
  36. package/es/ProLayout/components/Layout/Header/style/index.less +1 -1
  37. package/es/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +58 -55
  38. package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +25 -20
  39. package/es/ProLayout/components/Layout/Menu/style/index.less +52 -56
  40. package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +5 -5
  41. package/es/ProLayout/components/ProCollapse/index.js +22 -6
  42. package/es/ProLayout/components/ProCollapse/style/index.less +24 -21
  43. package/es/ProLayout/components/ProFooter/index.js +1 -1
  44. package/es/ProLayout/components/ProFooter/style/index.less +1 -1
  45. package/es/ProLayout/components/ProHeader/style/index.less +2 -1
  46. package/es/ProLayout/style/index.less +176 -88
  47. package/es/ProStep/components/Item/index.js +2 -1
  48. package/es/ProStep/style/index.less +71 -70
  49. package/es/ProTable/components/RenderColumn/index.d.ts +1 -1
  50. package/es/ProTable/components/RenderColumn/index.js +3 -3
  51. package/es/ProTable/propsType.d.ts +1 -1
  52. package/es/ProTable/utils.js +9 -9
  53. package/es/ProTabs/style/index.less +3 -1
  54. package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  55. package/es/ProThemeTools/component/PrdTools/index.js +2 -2
  56. package/es/ProThemeTools/index.js +21 -28
  57. package/es/ProThemeTools/propsType.d.ts +1 -1
  58. package/es/ProThemeTools/style/index.less +25 -8
  59. package/es/assets/catalog.svg +30 -1
  60. package/es/assets/fold.svg +27 -0
  61. package/es/assets/setting.svg +14 -0
  62. package/es/style/less.less +2 -0
  63. package/es/style/theme/antd.less +0 -1
  64. package/lib/ProEditTable/components/RenderField/index.js +12 -14
  65. package/lib/ProEditTable/index.js +3 -3
  66. package/lib/ProEditTable/propsType.d.ts +1 -1
  67. package/lib/ProEditTable/utils/config.js +5 -5
  68. package/lib/ProEditTable/utils/index.js +67 -30
  69. package/lib/ProEditTable/utils/tools.js +3 -1
  70. package/lib/ProEnum/components/Group.d.ts +1 -0
  71. package/lib/ProEnum/components/Group.js +21 -8
  72. package/lib/ProEnum/index.js +4 -2
  73. package/lib/ProEnum/style/index.less +12 -3
  74. package/lib/ProForm/components/combination/Group/index.js +6 -7
  75. package/lib/ProForm/components/combination/Group/propsType.d.ts +1 -0
  76. package/lib/ProForm/components/combination/Group/style/index.less +4 -4
  77. package/lib/ProForm/components/combination/Group/utils.d.ts +2 -0
  78. package/lib/ProForm/components/combination/Group/utils.js +11 -1
  79. package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +1 -1
  80. package/lib/ProForm/components/render/Render.js +2 -2
  81. package/lib/ProForm/components/render/RenderFields.d.ts +1 -1
  82. package/lib/ProForm/components/render/RenderFields.js +2 -2
  83. package/lib/ProForm/index.js +4 -4
  84. package/lib/ProForm/propsType.d.ts +1 -1
  85. package/lib/ProForm/style/index.less +16 -2
  86. package/lib/ProForm/utils/{contrastOriginal.d.ts → diffOriginal.d.ts} +2 -1
  87. package/lib/ProForm/utils/diffOriginal.js +68 -0
  88. package/lib/ProForm/utils/index.d.ts +1 -1
  89. package/lib/ProForm/utils/index.js +2 -2
  90. package/lib/ProForm/utils/transformValue.js +1 -1
  91. package/lib/ProForm/utils/useChanged.js +4 -3
  92. package/lib/ProForm/utils/useListChanged.d.ts +1 -1
  93. package/lib/ProForm/utils/useListChanged.js +5 -3
  94. package/lib/ProIcon/index.d.ts +0 -1
  95. package/lib/ProIcon/index.js +7 -30
  96. package/lib/ProLayout/components/Layout/Header/style/index.less +1 -1
  97. package/lib/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +58 -55
  98. package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +25 -20
  99. package/lib/ProLayout/components/Layout/Menu/style/index.less +52 -56
  100. package/lib/ProLayout/components/ProCollapse/PropTypes.d.ts +5 -5
  101. package/lib/ProLayout/components/ProCollapse/index.js +20 -6
  102. package/lib/ProLayout/components/ProCollapse/style/index.less +24 -21
  103. package/lib/ProLayout/components/ProFooter/index.js +1 -1
  104. package/lib/ProLayout/components/ProFooter/style/index.less +1 -1
  105. package/lib/ProLayout/components/ProHeader/style/index.less +2 -1
  106. package/lib/ProLayout/style/index.less +176 -88
  107. package/lib/ProStep/components/Item/index.js +2 -1
  108. package/lib/ProStep/style/index.less +71 -70
  109. package/lib/ProTable/components/RenderColumn/index.d.ts +1 -1
  110. package/lib/ProTable/components/RenderColumn/index.js +3 -3
  111. package/lib/ProTable/propsType.d.ts +1 -1
  112. package/lib/ProTable/utils.js +9 -9
  113. package/lib/ProTabs/style/index.less +3 -1
  114. package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
  115. package/lib/ProThemeTools/component/PrdTools/index.js +2 -2
  116. package/lib/ProThemeTools/index.js +19 -27
  117. package/lib/ProThemeTools/propsType.d.ts +1 -1
  118. package/lib/ProThemeTools/style/index.less +25 -8
  119. package/lib/assets/catalog.svg +30 -1
  120. package/lib/assets/fold.svg +27 -0
  121. package/lib/assets/setting.svg +14 -0
  122. package/lib/style/less.less +2 -0
  123. package/lib/style/theme/antd.less +0 -1
  124. package/package.json +1 -1
  125. package/es/ProForm/utils/contrastOriginal.js +0 -24
  126. package/es/ProIcon/symbolIcon.js +0 -43
  127. package/lib/ProForm/utils/contrastOriginal.js +0 -30
  128. package/lib/ProIcon/symbolIcon.js +0 -45
@@ -0,0 +1,3 @@
1
+ var undefined$1 = undefined;
2
+
3
+ export default undefined$1;
@@ -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
@@ -190,11 +190,6 @@ export var actions = {
190
190
  addData.isEditing = true;
191
191
  }
192
192
  insertType === 'before' ? nextData.unshift(addData) : nextData.push(addData);
193
- form.setFieldValue(name, nextData);
194
- (_tableRef$current$que = tableRef.current.querySelector(".".concat(prefixCls, "-table-body"))) === null || _tableRef$current$que === void 0 ? void 0 : (_tableRef$current$que2 = _tableRef$current$que.scrollTo) === null || _tableRef$current$que2 === void 0 ? void 0 : _tableRef$current$que2.call(_tableRef$current$que, {
195
- top: 10000,
196
- behavior: 'smooth'
197
- });
198
193
  // 当单选情况下,存储正在编辑值
199
194
  if (virtualKey) {
200
195
  nextEditingKeys = _toConsumableArray(editingKeys); // 开启编辑状态
@@ -204,6 +199,11 @@ export var actions = {
204
199
  editingKeys: nextEditingKeys
205
200
  });
206
201
  }
202
+ form.setFieldValue(name, nextData);
203
+ (_tableRef$current$que = tableRef.current.querySelector(".".concat(prefixCls, "-table-body"))) === null || _tableRef$current$que === void 0 ? void 0 : (_tableRef$current$que2 = _tableRef$current$que.scrollTo) === null || _tableRef$current$que2 === void 0 ? void 0 : _tableRef$current$que2.call(_tableRef$current$que, {
204
+ top: insertType === 'before' ? -10000 : 10000,
205
+ behavior: 'smooth'
206
+ });
207
207
  _context2.next = 14;
208
208
  return form.validateFields([name]);
209
209
  case 14:
@@ -85,40 +85,77 @@ 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
+ var tableBody = errorDom.closest('.ant-table-content') || errorDom.closest('.ant-table-body');
104
+ var tableCell = errorDom.closest('.ant-table-cell');
105
+ if (tableBody && tableCell) {
106
+ var previousSibling = tableCell.previousElementSibling;
107
+ var childOffsetLeft = 0;
108
+ var childFixedLeft = 0;
109
+ while (previousSibling) {
110
+ if (previousSibling.nodeType === 1) {
111
+ var _previousSibling, _previousSibling$clas, _previousSibling$clas2, _previousSibling$clas3;
112
+ var _ref2 = previousSibling.getBoundingClientRect() || {},
113
+ _ref2$width = _ref2.width,
114
+ width = _ref2$width === void 0 ? 0 : _ref2$width;
115
+ childOffsetLeft += width;
116
+ if ((_previousSibling = previousSibling) === null || _previousSibling === void 0 ? void 0 : (_previousSibling$clas = _previousSibling.classList) === null || _previousSibling$clas === void 0 ? void 0 : (_previousSibling$clas2 = (_previousSibling$clas3 = _previousSibling$clas).contains) === null || _previousSibling$clas2 === void 0 ? void 0 : _previousSibling$clas2.call(_previousSibling$clas3, 'ant-table-cell-fix-left')) {
117
+ childFixedLeft += width;
118
+ }
119
+ }
120
+ previousSibling = previousSibling.previousElementSibling;
121
+ }
122
+ tableBody.scrollTo({
123
+ left: childOffsetLeft - childFixedLeft,
124
+ behavior: 'smooth'
125
+ });
126
+ }
127
+ }
128
+ }, 0);
129
+ return _context.abrupt("return", Promise.reject(_context.t0));
130
+ case 12:
94
131
  // 编辑状态使用自定义form值,非编辑状态直接使用行数据
95
132
  _record = (_form$getFieldValue = form.getFieldValue(rowName)) !== null && _form$getFieldValue !== void 0 ? _form$getFieldValue : record; // 新增事件可以设置初始默认值,当做函数的出参导出
96
133
  onEvent = onClick || onHandle;
97
- _context.next = 9;
134
+ _context.next = 16;
98
135
  return onEvent === null || onEvent === void 0 ? void 0 : onEvent(_record, index, {
99
136
  form: form,
100
137
  namePath: virtualRowName
101
138
  });
102
- case 9:
103
- _context.t1 = _yield$onEvent = _context.sent;
104
- _context.t0 = _context.t1 !== null;
105
- if (!_context.t0) {
106
- _context.next = 13;
139
+ case 16:
140
+ _context.t2 = _yield$onEvent = _context.sent;
141
+ _context.t1 = _context.t2 !== null;
142
+ if (!_context.t1) {
143
+ _context.next = 20;
107
144
  break;
108
145
  }
109
- _context.t0 = _yield$onEvent !== void 0;
110
- case 13:
111
- if (!_context.t0) {
112
- _context.next = 17;
146
+ _context.t1 = _yield$onEvent !== void 0;
147
+ case 20:
148
+ if (!_context.t1) {
149
+ _context.next = 24;
113
150
  break;
114
151
  }
115
- _context.t2 = _yield$onEvent;
116
- _context.next = 18;
152
+ _context.t3 = _yield$onEvent;
153
+ _context.next = 25;
117
154
  break;
118
- case 17:
119
- _context.t2 = true;
120
- case 18:
121
- result = _context.t2;
155
+ case 24:
156
+ _context.t3 = true;
157
+ case 25:
158
+ result = _context.t3;
122
159
  if (result && type !== 'custom') {
123
160
  actions[type](_objectSpread(_objectSpread({}, config), {}, {
124
161
  rowName: [].concat(_toConsumableArray(name), [index]),
@@ -128,11 +165,11 @@ var getActionColumn = function getActionColumn(config) {
128
165
  validateKeys: validateKeys
129
166
  }));
130
167
  }
131
- case 20:
168
+ case 27:
132
169
  case "end":
133
170
  return _context.stop();
134
171
  }
135
- }, _callee);
172
+ }, _callee, null, [[3, 8]]);
136
173
  }));
137
174
  return function (_x, _x2) {
138
175
  return _ref.apply(this, arguments);
@@ -210,10 +247,10 @@ export var transformColumns = function transformColumns() {
210
247
  if (typeof columnTitle === 'string') {
211
248
  item.originTitle = columnTitle;
212
249
  if (tooltip) {
213
- var _ref2 = tooltip || {},
214
- tooltipTitle = _ref2.title,
215
- icon = _ref2.icon,
216
- resetProps = _objectWithoutProperties(_ref2, _excluded2);
250
+ var _ref3 = tooltip || {},
251
+ tooltipTitle = _ref3.title,
252
+ icon = _ref3.icon,
253
+ resetProps = _objectWithoutProperties(_ref3, _excluded2);
217
254
  item.title = _jsxs("span", {
218
255
  className: "pro-edit-table-title pro-edit-table-tooltip",
219
256
  children: [before, columnTitle, _jsx(_Tooltip, _objectSpread(_objectSpread({
@@ -280,7 +317,7 @@ export var transformColumns = function transformColumns() {
280
317
  (_item$fieldProps3 = item.fieldProps) === null || _item$fieldProps3 === void 0 ? true : delete _item$fieldProps3.useRequest;
281
318
  }
282
319
  var _render = function _render(text, record, index) {
283
- var isEditing = !virtualKey || editingKeys.includes(record.rowKey);
320
+ var isEditing = !virtualKey || editingKeys.includes(record.rowKey) || record.addFlag;
284
321
  var namePath = isArray(name) ? name : [name];
285
322
  if (virtualKey && editingKeys.includes(record.rowKey)) {
286
323
  namePath = getNamePath(name, virtualKey);
@@ -365,13 +402,13 @@ export var transformColumns = function transformColumns() {
365
402
  // cacheMap 用来存储缓存值,若有值后不再请求
366
403
  if (JSON.stringify(cacheMap.current) === '{}') {
367
404
  Promise.all(Object.entries(_cacheMap).map( /*#__PURE__*/function () {
368
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item) {
369
- var _item, key, value, _ref4, service, option;
405
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item) {
406
+ var _item, key, value, _ref5, service, option;
370
407
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
371
408
  while (1) switch (_context2.prev = _context2.next) {
372
409
  case 0:
373
410
  _item = _slicedToArray(item, 2), key = _item[0], value = _item[1];
374
- _ref4 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref4.service, option = _ref4.option;
411
+ _ref5 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref5.service, option = _ref5.option;
375
412
  if (!service) {
376
413
  _context2.next = 8;
377
414
  break;
@@ -391,7 +428,7 @@ export var transformColumns = function transformColumns() {
391
428
  }, _callee2);
392
429
  }));
393
430
  return function (_x3) {
394
- return _ref3.apply(this, arguments);
431
+ return _ref4.apply(this, arguments);
395
432
  };
396
433
  }())).then(function (res) {
397
434
  res.forEach(function (item) {
@@ -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
  });
@@ -2,6 +2,7 @@ import { ProEnum } from '../propsType';
2
2
  interface Props extends Pick<ProEnum, 'value' | 'onChange' | 'dataSource'> {
3
3
  fieldValue: string;
4
4
  fieldLabel: string;
5
+ disabled?: boolean;
5
6
  }
6
7
  declare const Group: (props: Props) => JSX.Element;
7
8
  export default Group;
@@ -8,7 +8,8 @@ var Group = function Group(props) {
8
8
  onChange = props.onChange,
9
9
  dataSource = props.dataSource,
10
10
  fieldValue = props.fieldValue,
11
- fieldLabel = props.fieldLabel;
11
+ fieldLabel = props.fieldLabel,
12
+ disabled = props.disabled;
12
13
  var idx = useRef(-1);
13
14
  var _useSetState = useSetState({
14
15
  checked: ''
@@ -20,13 +21,25 @@ var Group = function Group(props) {
20
21
  setState({
21
22
  checked: value
22
23
  });
23
- }, [value]);
24
- var handleClick = function handleClick(val, index) {
25
- setState({
26
- checked: val
24
+ var index = dataSource.findIndex(function (item) {
25
+ return item[fieldValue] === value;
27
26
  });
28
27
  idx.current = index;
29
- onChange === null || onChange === void 0 ? void 0 : onChange(val);
28
+ }, [value]);
29
+ var handleClick = function handleClick(val, index) {
30
+ if (state.checked === val) {
31
+ setState({
32
+ checked: ''
33
+ });
34
+ onChange === null || onChange === void 0 ? void 0 : onChange('');
35
+ idx.current = -1;
36
+ } else {
37
+ setState({
38
+ checked: val
39
+ });
40
+ idx.current = index;
41
+ onChange === null || onChange === void 0 ? void 0 : onChange(val);
42
+ }
30
43
  };
31
44
  if (dataSource.length === 0) {
32
45
  return _jsx("span", {
@@ -34,11 +47,11 @@ var Group = function Group(props) {
34
47
  });
35
48
  }
36
49
  return _jsx("div", {
37
- className: "pro-enum-group-root",
50
+ className: classNames('pro-enum-group-root', disabled ? 'pro-enum-group-root-disabled' : ''),
38
51
  children: dataSource.map(function (item, index) {
39
52
  return _jsx("div", {
40
53
  onClick: function onClick() {
41
- if (!item.disabled) {
54
+ if (!item.disabled && !disabled) {
42
55
  handleClick(item[fieldValue], index);
43
56
  }
44
57
  },
@@ -41,7 +41,8 @@ var ProEnum = function ProEnum(props) {
41
41
  enumProps = _objectWithoutProperties(props, _excluded);
42
42
  var _ref = otherProps || {},
43
43
  isView = _ref.isView,
44
- viewEmpty = _ref.viewEmpty;
44
+ viewEmpty = _ref.viewEmpty,
45
+ disabled = _ref.disabled;
45
46
  var _ref2 = useProConfig('ProEnum') || {},
46
47
  fieldNames = _ref2.fieldNames,
47
48
  _ref2$clear = _ref2.clear,
@@ -212,7 +213,8 @@ var ProEnum = function ProEnum(props) {
212
213
  onChange: onChange,
213
214
  fieldLabel: label,
214
215
  fieldValue: fieldValue,
215
- dataSource: list
216
+ dataSource: list,
217
+ disabled: disabled
216
218
  });
217
219
  default:
218
220
  return null;
@@ -7,12 +7,17 @@
7
7
  flex-direction: row;
8
8
  flex-wrap: wrap;
9
9
  }
10
+ &-group-root-disabled {
11
+ color: rgba(0, 0, 0, 0.25);
12
+ .pro-enum-group-item{
13
+ cursor: not-allowed !important;
14
+ }
15
+ }
10
16
  &-tag-item {
11
17
  display: flex;
12
18
  align-items: center;
13
19
  justify-content: center;
14
20
  margin-right: var(--zaui-space-size-sm);
15
- margin-bottom: calc(var(--zaui-space-size-sm; 8px) * var(--zaui-size; 1));
16
21
  padding: var(--zaui-space-size-xs) 10px;
17
22
  background-color: #f5f5f5;
18
23
  border-radius: var(--zaui-space-size-xs);
@@ -38,8 +43,7 @@
38
43
  display: flex;
39
44
  align-items: center;
40
45
  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);
46
+ padding: 6px var(--zaui-space-border);
43
47
  line-height: 18px;
44
48
  background-color: #f1f3f6ff;
45
49
  border: 1px solid transparent;
@@ -72,6 +76,7 @@
72
76
 
73
77
  .pro-enum-group-item-selected {
74
78
  color: var(--zaui-brand);
79
+ background: #fff;
75
80
  border: 1px solid var(--zaui-brand);
76
81
  &::after {
77
82
  background: transparent;
@@ -88,4 +93,8 @@
88
93
  cursor: not-allowed;
89
94
  }
90
95
  }
96
+
97
+ &-group-root-disabled {
98
+ opacity: 0.7;
99
+ }
91
100
  }
@@ -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,
@@ -23,11 +22,8 @@ var Group = function Group(props) {
23
22
  } : _props$space,
24
23
  id = props.id,
25
24
  value = props.value,
25
+ isView = props.isView,
26
26
  onFieldChange = props.onFieldChange;
27
- var _useCounter = useCounter(0),
28
- _useCounter2 = _slicedToArray(_useCounter, 2),
29
- num = _useCounter2[0],
30
- inc = _useCounter2[1].inc;
31
27
  var _ref = ProForm.useFieldProps() || {},
32
28
  names = _ref.names,
33
29
  name = _ref.name,
@@ -41,6 +37,7 @@ var Group = function Group(props) {
41
37
  return _objectSpread(_objectSpread({
42
38
  disabled: Boolean(props === null || props === void 0 ? void 0 : props.disabled)
43
39
  }, item), {}, {
40
+ isView: isView !== null && isView !== void 0 ? isView : item.isView,
44
41
  noStyle: (space === null || space === void 0 ? void 0 : space.compact) || (space === null || space === void 0 ? void 0 : space.separator),
45
42
  parentNames: id
46
43
  });
@@ -65,13 +62,15 @@ var Group = function Group(props) {
65
62
  })
66
63
  }, "".concat(className), className));
67
64
  useDeepCompareEffect(function () {
65
+ var _document, _document$activeEleme;
66
+ // 焦点激活的表单
67
+ 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
68
  // 模拟change,初始化不执行onFieldChange
69
- if (isFunction(onFieldChange) && num >= 1) {
69
+ if (isFunction(onFieldChange) && form.isFieldsTouched(names) && transformNamesString(names).includes(touchName)) {
70
70
  onFieldChange(value, form.getFieldsValue(), {
71
71
  form: form
72
72
  });
73
73
  }
74
- inc();
75
74
  }, [value]);
76
75
  return _jsx("div", {
77
76
  className: _className,
@@ -23,6 +23,7 @@ export interface GroupProps {
23
23
  value?: any;
24
24
  id?: string;
25
25
  disabled?: boolean | (() => void);
26
+ isView?: boolean;
26
27
  onFieldChange?: (value: any[] | null, record: any, { form, }: {
27
28
  form: FormInstance;
28
29
  }) => any;
@@ -9,13 +9,13 @@
9
9
  }
10
10
 
11
11
  .start-radius() {
12
- border-start-start-radius: var(--zaui-border-radius, 8px);
13
- border-end-start-radius: var(--zaui-border-radius, 8px);
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, 8px);
18
- border-end-end-radius: var(--zaui-border-radius, 8px);
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
  };
@@ -6,7 +6,7 @@
6
6
  ~ .forever-checkbox:not(.@{ant-prefix}-input-disabled):not(
7
7
  .@{ant-prefix}-input-borderless
8
8
  ).@{ant-prefix}-input {
9
- background: @zaui-base-bg;
9
+ // background: @zaui-base-bg;
10
10
  border-color: var(--ant-error-color);
11
11
  }
12
12
  .forever-checkbox:not(.@{ant-prefix}-input-disabled):not(
@@ -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));