@zat-design/sisyphus-react 3.3.1-beta.1 → 3.3.1-beta.11

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 (76) hide show
  1. package/dist/index.esm.css +32 -9
  2. package/es/ProEditTable/components/RenderField/index.js +7 -6
  3. package/es/ProEditTable/index.js +19 -1
  4. package/es/ProEditTable/style/index.less +5 -0
  5. package/es/ProEnum/hooks/useEnumRequest.js +13 -1
  6. package/es/ProForm/components/combination/Group/index.js +0 -1
  7. package/es/ProForm/components/combination/Group/style/index.less +38 -21
  8. package/es/ProForm/components/combination/ProModalSelect/index.js +2 -2
  9. package/es/ProForm/components/render/Render.js +2 -1
  10. package/es/ProForm/style/index.less +5 -4
  11. package/es/ProForm/utils/contrastOriginal.d.ts +0 -1
  12. package/es/ProForm/utils/contrastOriginal.js +0 -1
  13. package/es/ProForm/utils/useChanged.d.ts +7 -14
  14. package/es/ProForm/utils/useChanged.js +13 -20
  15. package/es/ProForm/utils/useListChanged.d.ts +16 -0
  16. package/es/ProForm/utils/useListChanged.js +81 -0
  17. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +13 -5
  18. package/es/ProLayout/components/Layout/Menu/index.js +13 -10
  19. package/es/ProLayout/propTypes.d.ts +2 -0
  20. package/es/ProTable/style/index.less +1 -0
  21. package/es/ProTooltip/index.js +5 -3
  22. package/es/ProTreeModal/components/Trigger.d.ts +1 -0
  23. package/es/ProTreeModal/components/Trigger.js +17 -8
  24. package/es/ProTreeModal/index.js +12 -2
  25. package/es/ProUpload/components/DragRender.js +1 -2
  26. package/es/ProUpload/components/ImageRender.js +17 -7
  27. package/es/locale/en_US.d.ts +2 -0
  28. package/es/locale/en_US.js +3 -1
  29. package/es/locale/zh_CN.d.ts +3 -0
  30. package/es/locale/zh_CN.js +4 -1
  31. package/lib/ProEditTable/components/RenderField/index.js +7 -6
  32. package/lib/ProEditTable/index.js +18 -0
  33. package/lib/ProEditTable/style/index.less +5 -0
  34. package/lib/ProEnum/hooks/useEnumRequest.js +13 -1
  35. package/lib/ProForm/components/combination/Group/index.js +0 -1
  36. package/lib/ProForm/components/combination/Group/style/index.less +38 -21
  37. package/lib/ProForm/components/combination/ProModalSelect/index.js +1 -1
  38. package/lib/ProForm/components/render/Render.js +2 -1
  39. package/lib/ProForm/style/index.less +5 -4
  40. package/lib/ProForm/utils/contrastOriginal.d.ts +0 -1
  41. package/lib/ProForm/utils/contrastOriginal.js +0 -1
  42. package/lib/ProForm/utils/useChanged.d.ts +7 -14
  43. package/lib/ProForm/utils/useChanged.js +13 -20
  44. package/lib/ProForm/utils/useListChanged.d.ts +16 -0
  45. package/lib/ProForm/utils/useListChanged.js +86 -0
  46. package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +13 -5
  47. package/lib/ProLayout/components/Layout/Menu/index.js +13 -10
  48. package/lib/ProLayout/propTypes.d.ts +2 -0
  49. package/lib/ProTable/style/index.less +1 -0
  50. package/lib/ProTooltip/index.js +4 -2
  51. package/lib/ProTreeModal/components/Trigger.d.ts +1 -0
  52. package/lib/ProTreeModal/components/Trigger.js +16 -7
  53. package/lib/ProTreeModal/index.js +12 -2
  54. package/lib/ProUpload/components/DragRender.js +1 -2
  55. package/lib/ProUpload/components/ImageRender.js +16 -6
  56. package/lib/locale/en_US.d.ts +2 -0
  57. package/lib/locale/en_US.js +3 -1
  58. package/lib/locale/zh_CN.d.ts +3 -0
  59. package/lib/locale/zh_CN.js +4 -1
  60. package/package.json +1 -1
  61. package/es/assets/architecture.png +0 -0
  62. package/es/assets/dataShare.png +0 -0
  63. package/es/assets/generate.png +0 -0
  64. package/es/assets/import.png +0 -0
  65. package/es/assets/loadBalancer.png +0 -0
  66. package/es/assets/shipConfig.png +0 -0
  67. package/es/assets/subProjectConfig.png +0 -0
  68. package/es/assets/swaggerUrl.png +0 -0
  69. package/lib/assets/architecture.png +0 -0
  70. package/lib/assets/dataShare.png +0 -0
  71. package/lib/assets/generate.png +0 -0
  72. package/lib/assets/import.png +0 -0
  73. package/lib/assets/loadBalancer.png +0 -0
  74. package/lib/assets/shipConfig.png +0 -0
  75. package/lib/assets/subProjectConfig.png +0 -0
  76. package/lib/assets/swaggerUrl.png +0 -0
@@ -1634,6 +1634,7 @@
1634
1634
  }
1635
1635
  .pro-table .ant-table-body .ant-table-tbody .ant-table-row:nth-child(odd).new-cell td {
1636
1636
  background: #d2fff4 !important;
1637
+ border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
1637
1638
  }
1638
1639
  .pro-table .ant-table-body .ant-table-cell .varied-cell {
1639
1640
  margin-left: -8px;
@@ -2248,16 +2249,25 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2248
2249
  display: none;
2249
2250
  }
2250
2251
  .pro-group .ant-space-compact {
2251
- -webkit-box-align: center;
2252
- -webkit-align-items: center;
2253
- -ms-flex-align: center;
2254
- align-items: center;
2255
2252
  -webkit-box-flex: 1;
2256
2253
  -webkit-flex: auto;
2257
2254
  -ms-flex: auto;
2258
2255
  flex: auto;
2256
+ -webkit-box-align: center;
2257
+ -webkit-align-items: center;
2258
+ -ms-flex-align: center;
2259
+ align-items: center;
2259
2260
  width: 100%;
2260
2261
  }
2262
+ .pro-group .ant-space-compact > .ant-input-number:first-child {
2263
+ border-end-end-radius: 0;
2264
+ border-start-end-radius: 0;
2265
+ }
2266
+ .pro-group .ant-space-compact > .ant-input-number:last-child {
2267
+ border-start-start-radius: 0;
2268
+ border-end-start-radius: 0;
2269
+ margin-left: -1px;
2270
+ }
2261
2271
  .pro-group .ant-space-compact .ant-form-item {
2262
2272
  margin-bottom: 0 !important;
2263
2273
  }
@@ -2269,6 +2279,13 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2269
2279
  border-start-start-radius: 0;
2270
2280
  border-end-start-radius: 0;
2271
2281
  }
2282
+ .pro-group .ant-space-compact .pro-modal-select {
2283
+ margin-left: -1px;
2284
+ }
2285
+ .pro-group .ant-space-compact .pro-modal-select .ant-input {
2286
+ border-start-start-radius: 0;
2287
+ border-end-start-radius: 0;
2288
+ }
2272
2289
  .pro-group .ant-space-compact .ant-input-affix-wrapper,
2273
2290
  .pro-group .ant-space-compact .ant-select {
2274
2291
  border-start-end-radius: 0;
@@ -2276,8 +2293,8 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2276
2293
  border-start-start-radius: 0;
2277
2294
  border-end-start-radius: 0;
2278
2295
  }
2279
- .pro-group .ant-space-compact .ant-input-affix-wrapper:nth-child(n+2),
2280
- .pro-group .ant-space-compact .ant-select:nth-child(n+2) {
2296
+ .pro-group .ant-space-compact .ant-input-affix-wrapper:nth-child(n + 2),
2297
+ .pro-group .ant-space-compact .ant-select:nth-child(n + 2) {
2281
2298
  -webkit-margin-start: -1px;
2282
2299
  margin-inline-start: -1px;
2283
2300
  }
@@ -2306,8 +2323,8 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2306
2323
  border-end-end-radius: var(--zaui-border-radius, 4px);
2307
2324
  }
2308
2325
  .pro-group .ant-space-compact .ant-input-affix-wrapper-status-error ~ .group-separator {
2309
- border-color: var(--ant-error-color);
2310
2326
  color: var(--ant-error-color);
2327
+ border-color: var(--ant-error-color);
2311
2328
  }
2312
2329
  .pro-container.pro-container-diy .pro-container-content {
2313
2330
  display: -webkit-box;
@@ -2561,9 +2578,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2561
2578
  .pro-form .ant-form-item.pro-form-item-changed .ant-picker .ant-select-selection-placeholder {
2562
2579
  z-index: 9;
2563
2580
  }
2564
- .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > span {
2565
- background: var(--zaui-contract-bg, #fffaa1);
2581
+ .pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control-input-content > .pro-form-view-container {
2566
2582
  padding: 4px 8px;
2583
+ background: var(--zaui-contract-bg, #fffaa1);
2567
2584
  border-radius: 4px;
2568
2585
  }
2569
2586
  .pro-form .ant-form-item .ant-row {
@@ -4183,6 +4200,12 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
4183
4200
  .pro-edit-table .ant-table-pagination .ant-pagination-options .ant-select.ant-select-in-form-item {
4184
4201
  width: auto;
4185
4202
  }
4203
+ .pro-edit-table .is-new-row td,
4204
+ .pro-edit-table .is-new-row.ant-table-row:hover td,
4205
+ .pro-edit-table .is-new-row .ant-table-cell-row-hover,
4206
+ .pro-edit-table .is-new-row.ant-table-row:hover .ant-table-cell-row-hover {
4207
+ background: var(--ant-primary-2) !important;
4208
+ }
4186
4209
  .pro-edit-table-header {
4187
4210
  margin-bottom: calc(var(--zaui-space-size-md, 16px) * var(--zaui-size, 1));
4188
4211
  }
@@ -25,7 +25,7 @@ import * as componentMap from '../../../ProForm/components';
25
25
  import Container from '../../../ProForm/components/Container';
26
26
  import transformNames from '../../../ProForm/utils/transformNames';
27
27
  import { FieldProvider } from '../../../ProForm/utils/useFieldProps';
28
- import { useChanged } from '../../../ProForm/utils/useChanged';
28
+ import { useListChanged } from '../../../ProForm/utils/useListChanged';
29
29
  import useRules from '../../../ProForm/utils/useRules';
30
30
  import { isSelect } from '../../../ProForm/utils';
31
31
  import locale from '../../../locale';
@@ -129,7 +129,7 @@ var RenderField = function RenderField(_ref) {
129
129
  names: names,
130
130
  label: label,
131
131
  labelRequired: labelRequired,
132
- required: _required,
132
+ required: !isView && _required,
133
133
  rules: isEditing ? _rules : [],
134
134
  isSelect: isSelect({
135
135
  dataSource: (_fieldProps4 = _fieldProps) === null || _fieldProps4 === void 0 ? void 0 : _fieldProps4.dataSource,
@@ -452,19 +452,20 @@ var RenderField = function RenderField(_ref) {
452
452
  };
453
453
  }();
454
454
  // 判断当前字段是否变更
455
- var _useChanged = useChanged({
455
+ var _useListChanged = useListChanged({
456
456
  name: cellName,
457
457
  names: names,
458
458
  namesStr: [].concat(_toConsumableArray(baseName), [index, dataIndex]),
459
+ rowKeyPath: [].concat(_toConsumableArray(baseName), [index, 'rowKey']),
459
460
  originalName: originalName,
460
461
  originalNames: originalNames,
461
462
  originalValues: originalValues,
462
463
  form: form,
463
464
  equalWith: equalWith
464
465
  }),
465
- _useChanged2 = _slicedToArray(_useChanged, 2),
466
- changed = _useChanged2[0],
467
- originalValue = _useChanged2[1];
466
+ _useListChanged2 = _slicedToArray(_useListChanged, 2),
467
+ changed = _useListChanged2[0],
468
+ originalValue = _useListChanged2[1];
468
469
  var componentProps = _objectSpread(_objectSpread(_objectSpread({
469
470
  form: form,
470
471
  name: cellName,
@@ -13,7 +13,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
13
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"];
14
14
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
15
15
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef } from 'react';
16
- import { isArray } from 'lodash';
16
+ import { get, isArray } from 'lodash';
17
17
  import { useDebounceEffect, useSetState } from 'ahooks';
18
18
  import classnames from 'classnames';
19
19
  import { transformColumns } from './utils';
@@ -106,6 +106,15 @@ var ProEditTable = function ProEditTable(_ref, ref) {
106
106
  }
107
107
  return key;
108
108
  };
109
+ var IsNew = function IsNew(preArr, record) {
110
+ var _preArr$find;
111
+ if (!(preArr === null || preArr === void 0 ? void 0 : preArr.length)) {
112
+ return false;
113
+ }
114
+ return !(preArr === null || preArr === void 0 ? void 0 : (_preArr$find = preArr.find) === null || _preArr$find === void 0 ? void 0 : _preArr$find.call(preArr, function (item) {
115
+ return getRowKey(item) === getRowKey(record);
116
+ }));
117
+ };
109
118
  var config = {
110
119
  form: form,
111
120
  mode: mode,
@@ -142,6 +151,10 @@ var ProEditTable = function ProEditTable(_ref, ref) {
142
151
  var _rowClassName = function _rowClassName(record) {
143
152
  var isEdit = !virtualKey || editingKeys.includes(record.rowKey);
144
153
  var className = isEdit ? 'is-editing' : '';
154
+ var originalArr = get(originalValues, name);
155
+ if (!isEdit && IsNew(originalArr, record)) {
156
+ return "is-new-row ".concat(className);
157
+ }
145
158
  return className;
146
159
  };
147
160
  // 复选框
@@ -246,11 +259,16 @@ var ProEditTable = function ProEditTable(_ref, ref) {
246
259
  var _value$;
247
260
  // 初始化默认生成row-key
248
261
  if ((value === null || value === void 0 ? void 0 : value.length) && !(value === null || value === void 0 ? void 0 : (_value$ = value[0]) === null || _value$ === void 0 ? void 0 : _value$.rowKey)) {
262
+ var _originalArr$forEach;
249
263
  var nextValues = value === null || value === void 0 ? void 0 : value.map(function (item) {
250
264
  return _objectSpread(_objectSpread({}, item), {}, {
251
265
  rowKey: getRowKey(item)
252
266
  });
253
267
  });
268
+ var originalArr = get(originalValues, name);
269
+ originalArr === null || originalArr === void 0 ? void 0 : (_originalArr$forEach = originalArr.forEach) === null || _originalArr$forEach === void 0 ? void 0 : _originalArr$forEach.call(originalArr, function (item) {
270
+ item.rowKey = getRowKey(item);
271
+ });
254
272
  onChange(nextValues);
255
273
  if (virtualKey) {
256
274
  form.setFieldValue(virtualRowName, nextValues);
@@ -296,6 +296,11 @@
296
296
  }
297
297
  }
298
298
 
299
+ .is-new-row, .is-new-row.@{ant-prefix}-table-row:hover {
300
+ td, .@{ant-prefix}-table-cell-row-hover {
301
+ background: var(--ant-primary-2) !important;
302
+ }
303
+ }
299
304
  }
300
305
 
301
306
  .pro-edit-table-header {
@@ -72,6 +72,18 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
72
72
  case 9:
73
73
  res.data = response;
74
74
  case 10:
75
+ if (!(_typeof(response) !== 'object' || response === null)) {
76
+ _context.next = 12;
77
+ break;
78
+ }
79
+ throw Error('response enum data must be object');
80
+ case 12:
81
+ if (!(Object.keys(response).length === 0)) {
82
+ _context.next = 14;
83
+ break;
84
+ }
85
+ throw Error('Please return valid enumeration data');
86
+ case 14:
75
87
  // 只返回fieldNames对象的key
76
88
  if (clear) {
77
89
  // 忽略清洗的 codes
@@ -106,7 +118,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
106
118
  }, 10000);
107
119
  }
108
120
  return _context.abrupt("return", res);
109
- case 17:
121
+ case 21:
110
122
  case "end":
111
123
  return _context.stop();
112
124
  }
@@ -53,7 +53,6 @@ var Group = function Group(props) {
53
53
  return item === null || item === void 0 ? void 0 : (_item$fieldProps = item.fieldProps) === null || _item$fieldProps === void 0 ? void 0 : (_item$fieldProps$styl = _item$fieldProps.style) === null || _item$fieldProps$styl === void 0 ? void 0 : _item$fieldProps$styl.width;
54
54
  })
55
55
  }, "".concat(className), className));
56
- console.log('name', name, data);
57
56
  return _jsx("div", {
58
57
  className: _className,
59
58
  children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? _jsx(_Space.Compact, {
@@ -2,20 +2,20 @@
2
2
  @import (reference) '~antd/es/style/themes/index.less';
3
3
 
4
4
  .border-radius(@start-end: 0, @end-end: 0, @start-start: 0, @end-start: 0) {
5
- border-start-end-radius : @start-end;
6
- border-end-end-radius : @end-end;
5
+ border-start-end-radius: @start-end;
6
+ border-end-end-radius: @end-end;
7
7
  border-start-start-radius: @start-start;
8
- border-end-start-radius : @end-start;
8
+ border-end-start-radius: @end-start;
9
9
  }
10
10
 
11
11
  .start-radius() {
12
12
  border-start-start-radius: var(--zaui-border-radius, 4px);
13
- border-end-start-radius : var(--zaui-border-radius, 4px);
13
+ border-end-start-radius: var(--zaui-border-radius, 4px);
14
14
  }
15
15
 
16
16
  .end-radius() {
17
17
  border-start-end-radius: var(--zaui-border-radius, 4px);
18
- border-end-end-radius : var(--zaui-border-radius, 4px);
18
+ border-end-end-radius: var(--zaui-border-radius, 4px);
19
19
  }
20
20
 
21
21
  .pro-group {
@@ -39,7 +39,6 @@
39
39
  }
40
40
 
41
41
  .@{ant-prefix}-form-item {
42
-
43
42
  margin-bottom: 0 !important;
44
43
  }
45
44
  }
@@ -49,19 +48,38 @@
49
48
  }
50
49
 
51
50
  .@{ant-prefix}-space-compact {
51
+ flex: auto;
52
52
  align-items: center;
53
- flex : auto;
54
- width : 100%;
53
+ width: 100%;
54
+
55
+ &>.@{ant-prefix}-input-number{
56
+ &:first-child{
57
+ border-end-end-radius: 0;
58
+ border-start-end-radius: 0;
59
+ }
60
+ &:last-child{
61
+ border-start-start-radius: 0;
62
+ border-end-start-radius: 0;
63
+ margin-left: -1px;
64
+ }
65
+ }
55
66
 
56
67
  .@{ant-prefix}-form-item {
57
68
  margin-bottom: 0 !important;
58
69
  }
59
70
 
60
71
  .group-separator {
61
- margin-inline-end : -2px;
62
- margin-inline-start : -1px;
72
+ margin-inline-end: -2px;
73
+ margin-inline-start: -1px;
63
74
  border-start-start-radius: 0;
64
- border-end-start-radius : 0;
75
+ border-end-start-radius: 0;
76
+ }
77
+ .pro-modal-select {
78
+ margin-left: -1px;
79
+ .@{ant-prefix}-input{
80
+ border-start-start-radius: 0;
81
+ border-end-start-radius: 0;
82
+ }
65
83
  }
66
84
 
67
85
  // 定制内敛合并样式
@@ -69,16 +87,16 @@
69
87
  .@{ant-prefix}-select {
70
88
  .border-radius(0, 0, 0, 0);
71
89
 
72
- &:nth-child(n+2) {
73
- margin-inline-start: -1px
90
+ &:nth-child(n + 2) {
91
+ margin-inline-start: -1px;
74
92
  }
75
93
 
76
94
  &:first-child {
77
- .start-radius()
95
+ .start-radius();
78
96
  }
79
97
 
80
98
  &:last-child {
81
- .end-radius()
99
+ .end-radius();
82
100
  }
83
101
  }
84
102
 
@@ -89,22 +107,21 @@
89
107
 
90
108
  &:first-child {
91
109
  .@{ant-prefix}-select-selector {
92
- .start-radius()
110
+ .start-radius();
93
111
  }
94
112
  }
95
113
 
96
114
  &:last-child {
97
115
  .@{ant-prefix}-select-selector {
98
- .end-radius()
116
+ .end-radius();
99
117
  }
100
118
  }
101
-
102
119
  }
103
120
 
104
121
  // 报错样式定制
105
- .@{ant-prefix}-input-affix-wrapper-status-error~.group-separator {
122
+ .@{ant-prefix}-input-affix-wrapper-status-error ~ .group-separator {
123
+ color: var(--ant-error-color);
106
124
  border-color: var(--ant-error-color);
107
- color : var(--ant-error-color);
108
125
  }
109
126
  }
110
- }
127
+ }
@@ -18,7 +18,7 @@ var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames",
18
18
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
19
19
  import { CloseOutlined, SearchOutlined } from '@ant-design/icons';
20
20
  import { useMount, useSetState } from 'ahooks';
21
- import { cloneDeep, isArray, isEqual, isFunction } from 'lodash';
21
+ import { cloneDeep, isArray, isEqual, isFunction, omit } from 'lodash';
22
22
  import { ReactSVG } from 'react-svg';
23
23
  import React, { forwardRef, useEffect, useImperativeHandle, useMemo } from 'react';
24
24
  import { ProForm, ProDrawerForm, ProTable, useProConfig } from '../../../../index';
@@ -652,7 +652,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
652
652
  disabled: disabled,
653
653
  addonAfter: forceAddonAfterRender(),
654
654
  autoComplete: "off"
655
- }, restInputProps)), _jsx(_Input, {
655
+ }, omit(restInputProps, ['otherProps']))), _jsx(_Input, {
656
656
  type: "hidden",
657
657
  value: value
658
658
  })]
@@ -251,9 +251,10 @@ var Render = function Render(props) {
251
251
  ((_AutoComponent$props$ = (_AutoComponent$props = AutoComponent === null || AutoComponent === void 0 ? void 0 : AutoComponent.props)[changeKey]) === null || _AutoComponent$props$ === void 0 ? void 0 : _AutoComponent$props$.call.apply(_AutoComponent$props$, [_AutoComponent$props].concat(_toConsumableArray(_args)))) || ((_lastComponentProps$c = lastComponentProps[changeKey]) === null || _lastComponentProps$c === void 0 ? void 0 : _lastComponentProps$c.call.apply(_lastComponentProps$c, [lastComponentProps].concat(_toConsumableArray(_args))));
252
252
  return false;
253
253
  }
254
- // Group默认校验, 延时校验解决值未同步最新的问题
254
+ // Group默认校验, 延时与重新setFieldValue,为了解决校验值未同步最新的问题,
255
255
  if (formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames) {
256
256
  setTimeout(function () {
257
+ form.setFieldValue(formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames, form.getFieldValue(formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames));
257
258
  form.validateFields([formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames]);
258
259
  }, 60);
259
260
  }
@@ -56,7 +56,8 @@
56
56
  visibility: unset;
57
57
  }
58
58
 
59
- .@{ant-prefix}-input-affix-wrapper:hover span.@{ant-prefix}-input-clear-icon[class~='ant-input-clear-icon-hidden'] {
59
+ .@{ant-prefix}-input-affix-wrapper:hover
60
+ span.@{ant-prefix}-input-clear-icon[class~='ant-input-clear-icon-hidden'] {
60
61
  display: unset;
61
62
  visibility: hidden;
62
63
  }
@@ -140,9 +141,9 @@
140
141
  }
141
142
  }
142
143
 
143
- .@{ant-prefix}-form-item-control-input-content > span {
144
- background: @zaui-contract-bg;
144
+ .@{ant-prefix}-form-item-control-input-content > .pro-form-view-container {
145
145
  padding: 4px 8px;
146
+ background: @zaui-contract-bg;
146
147
  border-radius: 4px;
147
148
  }
148
149
  }
@@ -306,7 +307,7 @@
306
307
 
307
308
  div.pro-form-custom-footer {
308
309
  width: unset !important;
309
- height:32px;
310
+ height: 32px;
310
311
  margin-bottom: calc(var(--zaui-height-size-md, 16px) * var(--zaui-size, 1));
311
312
 
312
313
  &.pro-form-custom-footer-hidden {
@@ -1,6 +1,5 @@
1
1
  import { FormInstance } from 'antd';
2
2
  interface Params {
3
- originalValues: any;
4
3
  originalValue: any;
5
4
  value: any;
6
5
  form: FormInstance;
@@ -2,7 +2,6 @@ import { isEqual, isFunction } from 'lodash';
2
2
  var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
3
3
  export var contrastOriginal = function contrastOriginal(params) {
4
4
  var originalValue = params.originalValue,
5
- originalValues = params.originalValues,
6
5
  value = params.value,
7
6
  equalWith = params.equalWith;
8
7
  // 支持传入自定义比较事件
@@ -1,15 +1,8 @@
1
- import { FormInstance } from 'antd';
2
- import { NamePath } from 'antd/lib/form/interface';
3
- interface Params {
4
- name?: NamePath;
5
- names?: NamePath[];
6
- namesStr?: NamePath;
7
- originalName?: NamePath;
8
- originalNames?: NamePath[];
9
- originalNameStr?: NamePath;
1
+ export declare const useChanged: ({ name, names, namesStr, originalValues, form, equalWith }: {
2
+ name: any;
3
+ names: any;
4
+ namesStr: any;
10
5
  originalValues: any;
11
- form: FormInstance;
12
- equalWith?: (originalValue: any, currentValue: any) => boolean;
13
- }
14
- export declare const useChanged: (params: Params) => any[];
15
- export {};
6
+ form: any;
7
+ equalWith: any;
8
+ }) => any[];
@@ -2,30 +2,23 @@ import "antd/es/form/style";
2
2
  import _Form from "antd/es/form";
3
3
  import { get } from 'lodash';
4
4
  import { contrastOriginal } from './contrastOriginal';
5
- export var useChanged = function useChanged(params) {
6
- var name = params.name,
7
- names = params.names,
8
- namesStr = params.namesStr,
9
- _params$originalName = params.originalName,
10
- originalName = _params$originalName === void 0 ? name : _params$originalName,
11
- _params$originalNames = params.originalNames,
12
- originalNames = _params$originalNames === void 0 ? names : _params$originalNames,
13
- originalValues = params.originalValues,
14
- form = params.form,
15
- equalWith = params.equalWith;
16
- var _form = form;
17
- var originalValue = (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
18
- return get(originalValues, originalName);
19
- }) : get(originalValues, originalName);
5
+ export var useChanged = function useChanged(_ref) {
6
+ var name = _ref.name,
7
+ names = _ref.names,
8
+ namesStr = _ref.namesStr,
9
+ originalValues = _ref.originalValues,
10
+ form = _ref.form,
11
+ equalWith = _ref.equalWith;
12
+ var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
13
+ return get(originalValues, name);
14
+ }) : get(originalValues, name);
20
15
  var notWatch = !originalValues || originalValue === undefined;
21
- // @ts-ignore
22
- if (notWatch) _form = [];
23
- var value = _Form.useWatch(namesStr || name, _form);
16
+ if (notWatch) form = [];
17
+ var value = _Form.useWatch(namesStr || name, form);
24
18
  if (notWatch) return [false];
25
19
  var changed = contrastOriginal({
26
- value: value,
27
20
  originalValue: originalValue,
28
- originalValues: originalValues,
21
+ value: value,
29
22
  form: form,
30
23
  equalWith: equalWith
31
24
  });
@@ -0,0 +1,16 @@
1
+ import { FormInstance } from 'antd';
2
+ import { InternalNamePath, NamePath } from 'antd/lib/form/interface';
3
+ interface Params {
4
+ name?: NamePath;
5
+ names?: NamePath[];
6
+ namesStr?: NamePath;
7
+ originalName?: NamePath;
8
+ originalNames?: NamePath[];
9
+ originalNameStr?: NamePath;
10
+ originalValues: any;
11
+ form: FormInstance;
12
+ rowKeyPath?: InternalNamePath;
13
+ equalWith?: (originalValue: any, currentValue: any) => boolean;
14
+ }
15
+ export declare const useListChanged: (params: Params) => any[];
16
+ export {};
@@ -0,0 +1,81 @@
1
+ import "antd/es/form/style";
2
+ import _Form from "antd/es/form";
3
+ import { get } from 'lodash';
4
+ import { contrastOriginal } from './contrastOriginal';
5
+ var toNamePath = function toNamePath(name) {
6
+ if (Array.isArray(name)) {
7
+ return name;
8
+ }
9
+ return [name];
10
+ };
11
+ var toNamePaths = function toNamePaths(names) {
12
+ return names.map(function (name) {
13
+ return toNamePath(name);
14
+ });
15
+ };
16
+ var getOriginalValue = function getOriginalValue(_ref) {
17
+ var namePath = _ref.namePath,
18
+ originalName = _ref.originalName,
19
+ originalNames = _ref.originalNames,
20
+ originalValues = _ref.originalValues,
21
+ rowKeyPath = _ref.rowKeyPath,
22
+ form = _ref.form;
23
+ if (!originalValues) {
24
+ return undefined;
25
+ }
26
+ if (rowKeyPath) {
27
+ var rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
28
+ var rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
29
+ var rowValue = form.getFieldValue(rowValueNamePath);
30
+ var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
31
+ if (!keyValue) return undefined;
32
+ var originalValueList = get(originalValues, originalName.slice(0, rowKeyPath.length - 2));
33
+ var originalValueRow = originalValueList.find(function (item) {
34
+ return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
35
+ });
36
+ var originalValue = (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
37
+ return get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
38
+ }) : get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
39
+ return originalValue;
40
+ }
41
+ return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
42
+ return get(originalValues, originalName);
43
+ }) : get(originalValues, originalName);
44
+ };
45
+ export var useListChanged = function useListChanged(params) {
46
+ var name = params.name,
47
+ names = params.names,
48
+ namesStr = params.namesStr,
49
+ _params$originalName = params.originalName,
50
+ originalName = _params$originalName === void 0 ? name : _params$originalName,
51
+ _params$originalNames = params.originalNames,
52
+ originalNames = _params$originalNames === void 0 ? names : _params$originalNames,
53
+ originalValues = params.originalValues,
54
+ form = params.form,
55
+ equalWith = params.equalWith,
56
+ rowKeyPath = params.rowKeyPath;
57
+ // let _form = form;
58
+ var namePath = toNamePath(namesStr || name);
59
+ var originalNamePath = toNamePath(originalName);
60
+ var originalNamePaths = originalNames && toNamePaths(originalNames);
61
+ var originalValue = getOriginalValue({
62
+ namePath: namePath,
63
+ originalName: originalNamePath,
64
+ originalNames: originalNamePaths,
65
+ originalValues: originalValues,
66
+ rowKeyPath: rowKeyPath,
67
+ form: form
68
+ });
69
+ var notWatch = !originalValues || originalValue === undefined;
70
+ // @ts-ignore
71
+ // if (notWatch) _form = [];
72
+ var value = _Form.useWatch(namePath, form);
73
+ if (notWatch) return [false];
74
+ var changed = contrastOriginal({
75
+ value: value,
76
+ originalValue: originalValue,
77
+ form: form,
78
+ equalWith: equalWith
79
+ });
80
+ return [changed, originalValue];
81
+ };
@@ -26,7 +26,8 @@ var FoldMenu = function FoldMenu(props) {
26
26
  'pro-layout-menu-tooltip-nav-open': collapsed
27
27
  });
28
28
  var _useContext = useContext(LayoutContext),
29
- selectedPath = _useContext.selectedPath;
29
+ selectedPath = _useContext.selectedPath,
30
+ onSelected = _useContext.onSelected;
30
31
  return _jsx("div", {
31
32
  className: "pro-layout-menu-fold",
32
33
  style: _objectSpread({}, style),
@@ -94,10 +95,17 @@ var FoldMenu = function FoldMenu(props) {
94
95
  }, "".concat(id, "-").concat(name)) : !collapsed ? _jsx(_Tooltip, {
95
96
  placement: "right",
96
97
  title: name,
97
- children: _jsx(Link, {
98
- to: toPath,
99
- children: LiNode
100
- }, toPath)
98
+ children: _jsx("span", {
99
+ onClick: function onClick() {
100
+ onSelected({
101
+ selectedPath: toPath
102
+ });
103
+ },
104
+ children: _jsx(Link, {
105
+ to: toPath,
106
+ children: LiNode
107
+ }, toPath)
108
+ })
101
109
  }, toPath) : _jsx(Link, {
102
110
  to: toPath,
103
111
  children: LiNode