@zat-design/sisyphus-react 3.3.1 → 3.3.2

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 (81) hide show
  1. package/dist/index.esm.css +32 -9
  2. package/es/ProDownload/utils.js +2 -0
  3. package/es/ProEditTable/components/RenderField/index.js +7 -6
  4. package/es/ProEditTable/index.js +19 -1
  5. package/es/ProEditTable/style/index.less +5 -0
  6. package/es/ProEnum/hooks/useEnumRequest.js +13 -1
  7. package/es/ProForm/components/combination/Group/index.js +3 -4
  8. package/es/ProForm/components/combination/Group/style/index.less +38 -21
  9. package/es/ProForm/components/combination/Group/utils.d.ts +0 -2
  10. package/es/ProForm/components/combination/Group/utils.js +0 -13
  11. package/es/ProForm/components/combination/ProModalSelect/index.js +2 -2
  12. package/es/ProForm/components/render/Render.js +15 -9
  13. package/es/ProForm/components/render/RenderFields.js +2 -1
  14. package/es/ProForm/style/index.less +5 -4
  15. package/es/ProForm/utils/contrastOriginal.d.ts +0 -1
  16. package/es/ProForm/utils/contrastOriginal.js +0 -1
  17. package/es/ProForm/utils/useChanged.d.ts +7 -14
  18. package/es/ProForm/utils/useChanged.js +13 -20
  19. package/es/ProForm/utils/useListChanged.d.ts +16 -0
  20. package/es/ProForm/utils/useListChanged.js +81 -0
  21. package/es/ProForm/utils/useShouldUpdate.js +17 -3
  22. package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +13 -5
  23. package/es/ProLayout/components/Layout/Menu/index.js +13 -10
  24. package/es/ProLayout/propTypes.d.ts +2 -0
  25. package/es/ProTable/style/index.less +1 -0
  26. package/es/ProTooltip/index.js +5 -3
  27. package/es/ProTreeModal/components/Trigger.d.ts +1 -0
  28. package/es/ProTreeModal/components/Trigger.js +17 -8
  29. package/es/ProTreeModal/index.js +12 -2
  30. package/es/ProUpload/components/DragRender.js +1 -2
  31. package/es/ProUpload/components/ImageRender.js +17 -7
  32. package/es/locale/en_US.d.ts +2 -0
  33. package/es/locale/en_US.js +3 -1
  34. package/es/locale/zh_CN.d.ts +3 -0
  35. package/es/locale/zh_CN.js +4 -1
  36. package/lib/ProEditTable/components/RenderField/index.js +9 -6
  37. package/lib/ProEditTable/index.js +18 -0
  38. package/lib/ProEditTable/style/index.less +5 -0
  39. package/lib/ProEnum/hooks/useEnumRequest.js +13 -1
  40. package/lib/ProForm/components/base/RangePicker/index.js +1 -1
  41. package/lib/ProForm/components/combination/Group/index.js +2 -3
  42. package/lib/ProForm/components/combination/Group/style/index.less +38 -21
  43. package/lib/ProForm/components/combination/Group/utils.d.ts +0 -2
  44. package/lib/ProForm/components/combination/Group/utils.js +1 -14
  45. package/lib/ProForm/components/combination/ProModalSelect/index.js +1 -1
  46. package/lib/ProForm/components/old/InputRange/index.js +0 -1
  47. package/lib/ProForm/components/old/ProCertValidity/index.js +1 -1
  48. package/lib/ProForm/components/render/Render.js +16 -9
  49. package/lib/ProForm/components/render/RenderFields.js +2 -1
  50. package/lib/ProForm/style/index.less +5 -4
  51. package/lib/ProForm/utils/contrastOriginal.d.ts +0 -1
  52. package/lib/ProForm/utils/contrastOriginal.js +0 -1
  53. package/lib/ProForm/utils/useChanged.d.ts +7 -14
  54. package/lib/ProForm/utils/useChanged.js +13 -20
  55. package/lib/ProForm/utils/useListChanged.d.ts +16 -0
  56. package/lib/ProForm/utils/useListChanged.js +86 -0
  57. package/lib/ProForm/utils/useShouldUpdate.js +17 -3
  58. package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +13 -5
  59. package/lib/ProLayout/components/Layout/Menu/index.js +13 -10
  60. package/lib/ProLayout/propTypes.d.ts +2 -0
  61. package/lib/ProTable/components/TableResizable/index.js +8 -0
  62. package/lib/ProTable/style/index.less +1 -0
  63. package/lib/ProTabs/index.js +1 -0
  64. package/lib/ProThemeTools/index.js +1 -0
  65. package/lib/ProTooltip/index.js +4 -2
  66. package/lib/ProTree/components/Tree.js +7 -0
  67. package/lib/ProTree/index.js +0 -1
  68. package/lib/ProTreeModal/components/Tree.js +1 -0
  69. package/lib/ProTreeModal/components/Trigger.d.ts +1 -0
  70. package/lib/ProTreeModal/components/Trigger.js +16 -7
  71. package/lib/ProTreeModal/index.js +12 -2
  72. package/lib/ProUpload/components/DragRender.js +1 -2
  73. package/lib/ProUpload/components/ImageRender.js +16 -6
  74. package/lib/ProUpload/index.js +7 -0
  75. package/lib/ProViewer/index.js +1 -0
  76. package/lib/locale/en_US.d.ts +2 -0
  77. package/lib/locale/en_US.js +3 -1
  78. package/lib/locale/zh_CN.d.ts +3 -0
  79. package/lib/locale/zh_CN.js +4 -1
  80. package/lib/old/ProCertValidity/index.js +1 -1
  81. package/package.json +1 -1
@@ -79,6 +79,18 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
79
79
  case 9:
80
80
  res.data = response;
81
81
  case 10:
82
+ if (!((0, _typeof2.default)(response) !== 'object' || response === null)) {
83
+ _context.next = 12;
84
+ break;
85
+ }
86
+ throw Error('response enum data must be object');
87
+ case 12:
88
+ if (!(Object.keys(response).length === 0)) {
89
+ _context.next = 14;
90
+ break;
91
+ }
92
+ throw Error('Please return valid enumeration data');
93
+ case 14:
82
94
  // 只返回fieldNames对象的key
83
95
  if (clear) {
84
96
  // 忽略清洗的 codes
@@ -113,7 +125,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
113
125
  }, 10000);
114
126
  }
115
127
  return _context.abrupt("return", res);
116
- case 17:
128
+ case 21:
117
129
  case "end":
118
130
  return _context.stop();
119
131
  }
@@ -14,7 +14,7 @@ var _moment = _interopRequireDefault(require("moment"));
14
14
  var _ProConfigProvider = require("../../../../ProConfigProvider");
15
15
  var _ProForm = _interopRequireDefault(require("../../../../ProForm"));
16
16
  var _Container = _interopRequireDefault(require("../../Container"));
17
- var _excluded = ["format", "otherProps", "separator"];
17
+ var _excluded = ["format", "otherProps", "separator"]; // @ts-check
18
18
  var AntRangePicker = _antd.DatePicker.RangePicker;
19
19
  var RangePicker = function RangePicker(props) {
20
20
  var _props$format = props.format,
@@ -31,7 +31,6 @@ var Group = function Group(props) {
31
31
  if (!Array.isArray(names)) {
32
32
  console.error('Warning: Composite form components whose type is Group must be configured with names');
33
33
  }
34
- var _parentNames = (0, _utils.parseName)(id);
35
34
  var data = (0, _react.useMemo)(function () {
36
35
  var fieldList = [];
37
36
  var result = columns.map(function (item) {
@@ -39,7 +38,7 @@ var Group = function Group(props) {
39
38
  disabled: Boolean(props === null || props === void 0 ? void 0 : props.disabled)
40
39
  }, item), {}, {
41
40
  noStyle: (space === null || space === void 0 ? void 0 : space.compact) || (space === null || space === void 0 ? void 0 : space.separator),
42
- parentNames: _parentNames
41
+ parentNames: id
43
42
  });
44
43
  });
45
44
  var node = (0, _jsxRuntime.jsx)(_antd.Button, {
@@ -50,7 +49,7 @@ var Group = function Group(props) {
50
49
  columns: (0, _utils.insertSeparator)(result, space, node, otherProps),
51
50
  fieldList: fieldList
52
51
  };
53
- }, [name, columns, space, props]);
52
+ }, [name, columns, space, props, names]);
54
53
  var _className = (0, _classnames2.default)((0, _defineProperty2.default)({
55
54
  'pro-group': true,
56
55
  'pro-group-diy-width': columns.some(function (item) {
@@ -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
+ }
@@ -6,5 +6,3 @@ 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
- /** 解析name */
10
- export declare const parseName: (name: string) => any[];
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.parseName = exports.insertSeparator = void 0;
7
+ exports.insertSeparator = void 0;
8
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
9
  /**
10
10
  * 插入间隔符
@@ -40,17 +40,4 @@ var insertSeparator = exports.insertSeparator = function insertSeparator(columns
40
40
  }
41
41
  return result;
42
42
  }, []);
43
- };
44
- /** 解析name */
45
- var parseName = exports.parseName = function parseName(name) {
46
- var result = [];
47
- var parts = name.split('_');
48
- parts.forEach(function (part) {
49
- if (!Number.isNaN(Number(part))) {
50
- result.push(Number(part));
51
- } else {
52
- result.push(part);
53
- }
54
- });
55
- return result;
56
43
  };
@@ -653,7 +653,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
653
653
  disabled: disabled,
654
654
  addonAfter: forceAddonAfterRender(),
655
655
  autoComplete: "off"
656
- }, restInputProps)), (0, _jsxRuntime.jsx)(_antd.Input, {
656
+ }, (0, _lodash.omit)(restInputProps, ['otherProps']))), (0, _jsxRuntime.jsx)(_antd.Input, {
657
657
  type: "hidden",
658
658
  value: value
659
659
  })]
@@ -13,7 +13,6 @@ var _antd = require("antd");
13
13
  var _classnames = _interopRequireDefault(require("classnames"));
14
14
  /* eslint-disable @typescript-eslint/no-shadow */
15
15
  /* eslint-disable no-param-reassign */
16
-
17
16
  var positiveInteger = {
18
17
  formatter: function formatter(value) {
19
18
  return value.replace(/[^0-9]/g, '');
@@ -11,7 +11,7 @@ var _jsxRuntime = require("react/jsx-runtime");
11
11
  var _antd = require("antd");
12
12
  var _moment = _interopRequireDefault(require("moment"));
13
13
  var _react = require("react");
14
- var _excluded = ["value", "onChange", "disabled", "isRange", "getPopupContainer", "showForever", "proformmode"];
14
+ var _excluded = ["value", "onChange", "disabled", "isRange", "getPopupContainer", "showForever", "proformmode"]; // @ts-nocheck
15
15
  var RangePicker = _antd.DatePicker.RangePicker;
16
16
  var defaultFormatDate = 'YYYY-MM-DD';
17
17
  var defaultPopupContainer = function defaultPopupContainer(triggerNode) {
@@ -28,9 +28,10 @@ var _useChanged3 = require("../../utils/useChanged");
28
28
  var _tip = _interopRequireDefault(require("../../../assets/tip.svg"));
29
29
  var _useRules = _interopRequireDefault(require("../../utils/useRules"));
30
30
  var _excluded = ["labelWidth", "hiddenNames", "trim", "upperCase", "className", "rules", "required", "labelRequired", "tooltip"];
31
+ /* eslint-disable prefer-destructuring */
31
32
  // 这个组件只管渲染, 参数的整理在外部处理
32
33
  var Render = function Render(props) {
33
- var _classNames, _otherProps$names2;
34
+ var _ref2, _classNames, _otherProps$names2;
34
35
  var component = props.component,
35
36
  originComponent = props.originComponent,
36
37
  _props$formItemProps = props.formItemProps,
@@ -160,8 +161,8 @@ var Render = function Render(props) {
160
161
  }
161
162
  /** 移除多余参数,防止透传给formItem报错 */
162
163
  var _otherFormItemProps = (0, _lodash.omit)(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'switchValue', 'precision', 'clearNotShow']);
163
- // 优先取formDisabled(全局),其次取disabled函数返回值,最后取fieldProps函数返回的disabled
164
- var lastDisabled = componentProps.disabledStrictly ? formDisabled || _disabled || (_fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) : false;
164
+ // 优先取组件上的disabled, 最后取formDisabled(全局
165
+ var lastDisabled = componentProps.disabledStrictly ? (_ref2 = _disabled !== null && _disabled !== void 0 ? _disabled : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref2 !== void 0 ? _ref2 : formDisabled : false;
165
166
  /**
166
167
  * 最新fieldProps: 更新后的组件Props
167
168
  */
@@ -189,8 +190,8 @@ var Render = function Render(props) {
189
190
  var functionArgs = function functionArgs(args) {
190
191
  var _otherFormItemProps$n;
191
192
  var _args = (0, _toConsumableArray2.default)(args);
192
- var _ref2 = otherProps || {},
193
- valueType = _ref2.valueType;
193
+ var _ref3 = otherProps || {},
194
+ valueType = _ref3.valueType;
194
195
  _args[1] = form.getFieldsValue();
195
196
  _args[2] = {
196
197
  form: form
@@ -248,9 +249,10 @@ var Render = function Render(props) {
248
249
  ((_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((0, _toConsumableArray2.default)(_args)))) || ((_lastComponentProps$c = lastComponentProps[changeKey]) === null || _lastComponentProps$c === void 0 ? void 0 : _lastComponentProps$c.call.apply(_lastComponentProps$c, [lastComponentProps].concat((0, _toConsumableArray2.default)(_args))));
249
250
  return false;
250
251
  }
251
- // Group默认校验, 延时校验解决值未同步最新的问题
252
+ // Group默认校验, 延时与重新setFieldValue,为了解决校验值未同步最新的问题,
252
253
  if (formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames) {
253
254
  setTimeout(function () {
255
+ form.setFieldValue(formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames, form.getFieldValue(formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames));
254
256
  form.validateFields([formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames]);
255
257
  }, 60);
256
258
  }
@@ -265,7 +267,7 @@ var Render = function Render(props) {
265
267
  * onBlur参数重置 (value, record, { form, index, namePath, option }) => void
266
268
  */
267
269
  var handleBlur = /*#__PURE__*/function () {
268
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
270
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
269
271
  var _len2,
270
272
  args,
271
273
  _key2,
@@ -292,7 +294,7 @@ var Render = function Render(props) {
292
294
  }, _callee);
293
295
  }));
294
296
  return function handleBlur() {
295
- return _ref3.apply(this, arguments);
297
+ return _ref4.apply(this, arguments);
296
298
  };
297
299
  }();
298
300
  var renderItem = function renderItem() {
@@ -400,7 +402,12 @@ var Render = function Render(props) {
400
402
  shouldUpdate: _otherFormItemProps.shouldUpdate,
401
403
  noStyle: true,
402
404
  children: function children() {
403
- return orgFormItem;
405
+ return (0, _jsxRuntime.jsx)(_antd.Form.Item, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(_otherFormItemProps, filterFormItemKey)), {}, {
406
+ // @ts-ignore
407
+ _internalItemRender: internalItemRender,
408
+ className: _className,
409
+ children: child
410
+ }));
404
411
  }
405
412
  });
406
413
  }
@@ -52,6 +52,7 @@ var RenderFields = function RenderFields(props) {
52
52
  });
53
53
  }
54
54
  var comList = columns.flatMap(function (column, index) {
55
+ var _ref, _formItemProps$disabl;
55
56
  if (!!expand && !openState) {
56
57
  // expand为Number时 过滤掉大于expand 且 非fixed的column
57
58
  if (typeof expand === 'number') {
@@ -130,7 +131,7 @@ var RenderFields = function RenderFields(props) {
130
131
  placeholder = formItemChildProps.placeholder,
131
132
  dataSource = formItemChildProps.dataSource;
132
133
  var formLabel = _formItemProps.label;
133
- var comDisabled = formItemChildProps.disabled || fieldProps.disabled || disabled;
134
+ var comDisabled = (_ref = (_formItemProps$disabl = _formItemProps === null || _formItemProps === void 0 ? void 0 : _formItemProps.disabled) !== null && _formItemProps$disabl !== void 0 ? _formItemProps$disabl : fieldProps.disabled) !== null && _ref !== void 0 ? _ref : disabled;
134
135
  var _disabled = comDisabled === undefined ? formDisabled : comDisabled;
135
136
  // 当前组件是不是一个选择组件
136
137
  var _isSelect = (0, _utils.isSelect)({
@@ -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;
@@ -8,7 +8,6 @@ var _lodash = require("lodash");
8
8
  var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
9
9
  var contrastOriginal = exports.contrastOriginal = function contrastOriginal(params) {
10
10
  var originalValue = params.originalValue,
11
- originalValues = params.originalValues,
12
11
  value = params.value,
13
12
  equalWith = params.equalWith;
14
13
  // 支持传入自定义比较事件
@@ -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[];
@@ -7,30 +7,23 @@ exports.useChanged = void 0;
7
7
  var _antd = require("antd");
8
8
  var _lodash = require("lodash");
9
9
  var _contrastOriginal = require("./contrastOriginal");
10
- var useChanged = exports.useChanged = function useChanged(params) {
11
- var name = params.name,
12
- names = params.names,
13
- namesStr = params.namesStr,
14
- _params$originalName = params.originalName,
15
- originalName = _params$originalName === void 0 ? name : _params$originalName,
16
- _params$originalNames = params.originalNames,
17
- originalNames = _params$originalNames === void 0 ? names : _params$originalNames,
18
- originalValues = params.originalValues,
19
- form = params.form,
20
- equalWith = params.equalWith;
21
- var _form = form;
22
- var originalValue = (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
23
- return (0, _lodash.get)(originalValues, originalName);
24
- }) : (0, _lodash.get)(originalValues, originalName);
10
+ var useChanged = exports.useChanged = function useChanged(_ref) {
11
+ var name = _ref.name,
12
+ names = _ref.names,
13
+ namesStr = _ref.namesStr,
14
+ originalValues = _ref.originalValues,
15
+ form = _ref.form,
16
+ equalWith = _ref.equalWith;
17
+ var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
18
+ return (0, _lodash.get)(originalValues, name);
19
+ }) : (0, _lodash.get)(originalValues, name);
25
20
  var notWatch = !originalValues || originalValue === undefined;
26
- // @ts-ignore
27
- if (notWatch) _form = [];
28
- var value = _antd.Form.useWatch(namesStr || name, _form);
21
+ if (notWatch) form = [];
22
+ var value = _antd.Form.useWatch(namesStr || name, form);
29
23
  if (notWatch) return [false];
30
24
  var changed = (0, _contrastOriginal.contrastOriginal)({
31
- value: value,
32
25
  originalValue: originalValue,
33
- originalValues: originalValues,
26
+ value: value,
34
27
  form: form,
35
28
  equalWith: equalWith
36
29
  });
@@ -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,86 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useListChanged = void 0;
7
+ var _antd = require("antd");
8
+ var _lodash = require("lodash");
9
+ var _contrastOriginal = require("./contrastOriginal");
10
+ var toNamePath = function toNamePath(name) {
11
+ if (Array.isArray(name)) {
12
+ return name;
13
+ }
14
+ return [name];
15
+ };
16
+ var toNamePaths = function toNamePaths(names) {
17
+ return names.map(function (name) {
18
+ return toNamePath(name);
19
+ });
20
+ };
21
+ var getOriginalValue = function getOriginalValue(_ref) {
22
+ var namePath = _ref.namePath,
23
+ originalName = _ref.originalName,
24
+ originalNames = _ref.originalNames,
25
+ originalValues = _ref.originalValues,
26
+ rowKeyPath = _ref.rowKeyPath,
27
+ form = _ref.form;
28
+ if (!originalValues) {
29
+ return undefined;
30
+ }
31
+ if (rowKeyPath) {
32
+ var rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
33
+ var rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
34
+ var rowValue = form.getFieldValue(rowValueNamePath);
35
+ var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
36
+ if (!keyValue) return undefined;
37
+ var originalValueList = (0, _lodash.get)(originalValues, originalName.slice(0, rowKeyPath.length - 2));
38
+ var originalValueRow = originalValueList.find(function (item) {
39
+ return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
40
+ });
41
+ var originalValue = (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
42
+ return (0, _lodash.get)(originalValueRow, originalName.slice(rowKeyPath.length - 1));
43
+ }) : (0, _lodash.get)(originalValueRow, originalName.slice(rowKeyPath.length - 1));
44
+ return originalValue;
45
+ }
46
+ return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
47
+ return (0, _lodash.get)(originalValues, originalName);
48
+ }) : (0, _lodash.get)(originalValues, originalName);
49
+ };
50
+ var useListChanged = exports.useListChanged = function useListChanged(params) {
51
+ var name = params.name,
52
+ names = params.names,
53
+ namesStr = params.namesStr,
54
+ _params$originalName = params.originalName,
55
+ originalName = _params$originalName === void 0 ? name : _params$originalName,
56
+ _params$originalNames = params.originalNames,
57
+ originalNames = _params$originalNames === void 0 ? names : _params$originalNames,
58
+ originalValues = params.originalValues,
59
+ form = params.form,
60
+ equalWith = params.equalWith,
61
+ rowKeyPath = params.rowKeyPath;
62
+ // let _form = form;
63
+ var namePath = toNamePath(namesStr || name);
64
+ var originalNamePath = toNamePath(originalName);
65
+ var originalNamePaths = originalNames && toNamePaths(originalNames);
66
+ var originalValue = getOriginalValue({
67
+ namePath: namePath,
68
+ originalName: originalNamePath,
69
+ originalNames: originalNamePaths,
70
+ originalValues: originalValues,
71
+ rowKeyPath: rowKeyPath,
72
+ form: form
73
+ });
74
+ var notWatch = !originalValues || originalValue === undefined;
75
+ // @ts-ignore
76
+ // if (notWatch) _form = [];
77
+ var value = _antd.Form.useWatch(namePath, form);
78
+ if (notWatch) return [false];
79
+ var changed = (0, _contrastOriginal.contrastOriginal)({
80
+ value: value,
81
+ originalValue: originalValue,
82
+ form: form,
83
+ equalWith: equalWith
84
+ });
85
+ return [changed, originalValue];
86
+ };
@@ -20,7 +20,8 @@ var useShouldUpdate = function useShouldUpdate(props) {
20
20
  required = props.required,
21
21
  fieldProps = props.fieldProps,
22
22
  component = props.component,
23
- originComponent = props.originComponent;
23
+ originComponent = props.originComponent,
24
+ type = props.type;
24
25
  var _shouldUpdate = formItemProps.shouldUpdate,
25
26
  name = formItemProps.name,
26
27
  clearNotShow = formItemProps.clearNotShow,
@@ -67,11 +68,24 @@ var useShouldUpdate = function useShouldUpdate(props) {
67
68
  showRef.current = show;
68
69
  }
69
70
  if ((0, _lodash.isFunction)(disabled)) {
70
- disabledRef.current = Boolean(disabled(values, {
71
+ // RangePicker返回数组时,特殊处理
72
+ if (type === 'RangePicker' && Array.isArray(disabled(values, {
71
73
  form: form,
72
74
  index: index,
73
75
  namePath: namePath
74
- }));
76
+ }))) {
77
+ disabledRef.current = disabled(values, {
78
+ form: form,
79
+ index: index,
80
+ namePath: namePath
81
+ });
82
+ } else {
83
+ disabledRef.current = Boolean(disabled(values, {
84
+ form: form,
85
+ index: index,
86
+ namePath: namePath
87
+ }));
88
+ }
75
89
  } else {
76
90
  disabledRef.current = disabled;
77
91
  }
@@ -30,7 +30,8 @@ var FoldMenu = function FoldMenu(props) {
30
30
  'pro-layout-menu-tooltip-nav-open': collapsed
31
31
  });
32
32
  var _useContext = (0, _react.useContext)(_index2.LayoutContext),
33
- selectedPath = _useContext.selectedPath;
33
+ selectedPath = _useContext.selectedPath,
34
+ onSelected = _useContext.onSelected;
34
35
  return (0, _jsxRuntime.jsx)("div", {
35
36
  className: "pro-layout-menu-fold",
36
37
  style: (0, _objectSpread2.default)({}, style),
@@ -98,10 +99,17 @@ var FoldMenu = function FoldMenu(props) {
98
99
  }, "".concat(id, "-").concat(name)) : !collapsed ? (0, _jsxRuntime.jsx)(_antd.Tooltip, {
99
100
  placement: "right",
100
101
  title: name,
101
- children: (0, _jsxRuntime.jsx)(_reactRouterDom.Link, {
102
- to: toPath,
103
- children: LiNode
104
- }, toPath)
102
+ children: (0, _jsxRuntime.jsx)("span", {
103
+ onClick: function onClick() {
104
+ onSelected({
105
+ selectedPath: toPath
106
+ });
107
+ },
108
+ children: (0, _jsxRuntime.jsx)(_reactRouterDom.Link, {
109
+ to: toPath,
110
+ children: LiNode
111
+ }, toPath)
112
+ })
105
113
  }, toPath) : (0, _jsxRuntime.jsx)(_reactRouterDom.Link, {
106
114
  to: toPath,
107
115
  children: LiNode