@zat-design/sisyphus-react 3.3.0 → 3.3.1-beta.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 (48) hide show
  1. package/dist/index.esm.css +13 -2
  2. package/es/ProEditTable/components/RenderField/index.js +6 -4
  3. package/es/ProEditTable/index.js +29 -18
  4. package/es/ProEnum/index.js +7 -18
  5. package/es/ProEnum/propsType.d.ts +1 -0
  6. package/es/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
  7. package/es/ProForm/components/combination/FormList/index.js +1 -1
  8. package/es/ProForm/components/combination/Group/index.js +4 -4
  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 +22 -25
  12. package/es/ProForm/components/combination/ProTimeLimit/style/index.less +9 -2
  13. package/es/ProForm/components/render/Render.js +17 -24
  14. package/es/ProForm/components/render/RenderFields.js +7 -3
  15. package/es/ProForm/utils/rulesCreator.js +2 -1
  16. package/es/ProForm/utils/useForm.js +15 -7
  17. package/es/ProForm/utils/useRules.js +6 -5
  18. package/es/ProStep/index.js +2 -2
  19. package/es/ProTable/style/index.less +6 -6
  20. package/es/ProTreeModal/components/Trigger.js +2 -0
  21. package/es/ProTreeModal/index.js +3 -3
  22. package/es/ProTreeModal/style/index.less +85 -84
  23. package/es/ProUpload/components/DragRender.js +2 -1
  24. package/es/ProUpload/components/ImageRender.js +4 -5
  25. package/lib/ProEditTable/components/RenderField/index.js +6 -4
  26. package/lib/ProEditTable/index.js +29 -18
  27. package/lib/ProEnum/index.js +6 -17
  28. package/lib/ProEnum/propsType.d.ts +1 -0
  29. package/lib/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
  30. package/lib/ProForm/components/combination/FormList/index.js +1 -1
  31. package/lib/ProForm/components/combination/Group/index.js +3 -3
  32. package/lib/ProForm/components/combination/Group/utils.d.ts +0 -2
  33. package/lib/ProForm/components/combination/Group/utils.js +1 -14
  34. package/lib/ProForm/components/combination/ProModalSelect/index.js +22 -25
  35. package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +9 -2
  36. package/lib/ProForm/components/render/Render.js +17 -24
  37. package/lib/ProForm/components/render/RenderFields.js +6 -2
  38. package/lib/ProForm/utils/rulesCreator.js +2 -1
  39. package/lib/ProForm/utils/useForm.js +15 -7
  40. package/lib/ProForm/utils/useRules.js +5 -4
  41. package/lib/ProStep/index.js +1 -1
  42. package/lib/ProTable/style/index.less +6 -6
  43. package/lib/ProTreeModal/components/Trigger.js +2 -0
  44. package/lib/ProTreeModal/index.js +3 -3
  45. package/lib/ProTreeModal/style/index.less +85 -84
  46. package/lib/ProUpload/components/DragRender.js +2 -1
  47. package/lib/ProUpload/components/ImageRender.js +4 -5
  48. package/package.json +1 -1
@@ -1629,6 +1629,12 @@
1629
1629
  .pro-table .ant-table-tbody .ant-table-cell-fix-right {
1630
1630
  background: unset !important;
1631
1631
  }
1632
+ .pro-table .ant-table-body .ant-table-tbody .ant-table-row:nth-child(odd).new-cell {
1633
+ background: #d2fff4 !important;
1634
+ }
1635
+ .pro-table .ant-table-body .ant-table-tbody .ant-table-row:nth-child(odd).new-cell td {
1636
+ background: #d2fff4 !important;
1637
+ }
1632
1638
  .pro-table .ant-table-body .ant-table-cell .varied-cell {
1633
1639
  margin-left: -8px;
1634
1640
  background: var(--zaui-contract-bg, #fffaa1);
@@ -1996,11 +2002,11 @@ div.pro-textarea-view::after {
1996
2002
  .pro-form-list-action .ant-btn-text:hover {
1997
2003
  background: transparent;
1998
2004
  }
1999
- .ant-form-item-has-error .ant-picker-status-error ~ .forever-checkbox:not(.ant-input-disabled):not(.ant-input-borderless).ant-input {
2005
+ .ant-form-item-has-error .ant-picker-status-error ~ .forever-checkbox:not(.ant-input-disabled):not( .ant-input-borderless).ant-input {
2000
2006
  background: var(--zaui-base-bg, #ffffff);
2001
2007
  border-color: var(--ant-error-color);
2002
2008
  }
2003
- .ant-form-item-has-error .forever-checkbox:not(.ant-input-disabled):not(.ant-input-borderless).ant-input:focus {
2009
+ .ant-form-item-has-error .forever-checkbox:not(.ant-input-disabled):not( .ant-input-borderless).ant-input:focus {
2004
2010
  border-color: var(--ant-error-color-hover);
2005
2011
  border-right-width: 1px;
2006
2012
  outline: 0;
@@ -2021,6 +2027,10 @@ span.ant-input-group-compact.pro-range-limit .ant-picker {
2021
2027
  -ms-flex: 1;
2022
2028
  flex: 1;
2023
2029
  }
2030
+ span.ant-input-group-compact.pro-time-limit .ant-picker-focused,
2031
+ span.ant-input-group-compact.pro-range-limit .ant-picker-focused {
2032
+ z-index: 1;
2033
+ }
2024
2034
  span.ant-input-group-compact.pro-time-limit .forever-checkbox,
2025
2035
  span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2026
2036
  -webkit-box-flex: 0;
@@ -3324,6 +3334,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
3324
3334
  }
3325
3335
  .pro-tree-modal-checkbox-close {
3326
3336
  padding-left: var(--zaui-space-size-sm, 8px);
3337
+ color: #c5c7cd;
3327
3338
  font-size: var(--zaui-font-size-sm, 12px);
3328
3339
  }
3329
3340
  .pro-tree-modal-tree-node {
@@ -506,7 +506,7 @@ var RenderField = function RenderField(_ref) {
506
506
  delete _formItemProps.rules;
507
507
  }
508
508
  var _className = classNames((_classNames = {}, _defineProperty(_classNames, className, className), _defineProperty(_classNames, 'pro-form-item-changed', changed), _classNames));
509
- var originalTitle = _jsxs(_Space, {
509
+ var originalTitle = originalTip ? _jsxs(_Space, {
510
510
  children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({}, omit(componentProps, ['onFieldChange'])), {}, {
511
511
  isView: true,
512
512
  value: originalValue,
@@ -516,14 +516,16 @@ var RenderField = function RenderField(_ref) {
516
516
  value: originalValue,
517
517
  checked: type === 'Switch' ? originalValue : undefined
518
518
  }))]
519
- });
520
- var FormItem = _jsx(_Form.Item, _objectSpread(_objectSpread({
519
+ }) : null;
520
+ var FormItem = TargetComponent ? _jsx(_Form.Item, _objectSpread(_objectSpread({
521
521
  validateFirst: true
522
522
  }, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
523
523
  className: _className,
524
524
  name: cellName,
525
525
  children: /*#__PURE__*/React.isValidElement(TargetComponent) ? /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread({}, omit(componentProps, ['onFieldChange']))) : _jsx(TargetComponent, _objectSpread({}, omit(componentProps, ['onFieldChange'])))
526
- }));
526
+ })) : _jsx(Container, {
527
+ viewEmpty: viewEmpty
528
+ });
527
529
  return _jsx(FieldProvider, {
528
530
  value: componentProps === null || componentProps === void 0 ? void 0 : componentProps.otherProps,
529
531
  children: !originalTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
@@ -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"];
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
16
  import { isArray } from 'lodash';
@@ -50,6 +50,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
50
50
  pagination = _ref.pagination,
51
51
  originalValues = _ref.originalValues,
52
52
  originalTip = _ref.originalTip,
53
+ rowKey = _ref.rowKey,
53
54
  resetProps = _objectWithoutProperties(_ref, _excluded);
54
55
  // 上下文form
55
56
  var contentForm = _Form.useFormInstance();
@@ -97,21 +98,14 @@ var ProEditTable = function ProEditTable(_ref, ref) {
97
98
  'pro-table-no-stripe': !stripe,
98
99
  className: className
99
100
  });
100
- // 编辑行设置下样式
101
- var _rowClassName = function _rowClassName(record) {
102
- return !virtualKey || editingKeys.includes(record.rowKey) ? 'is-editing' : '';
103
- };
104
- // 复选框
105
- var _rowSelection = _objectSpread({
106
- fixed: true,
107
- selectedRowKeys: selectedRowKeys,
108
- onChange: function onChange(selectedRowKeys, selectedRows) {
109
- setState({
110
- selectedRowKeys: selectedRowKeys,
111
- selectedRows: selectedRows
112
- });
101
+ var getRowKey = function getRowKey(record) {
102
+ var key = record.rowKey || getRandom();
103
+ if (rowKey) {
104
+ var _ref2;
105
+ key = (_ref2 = typeof rowKey === 'function' ? rowKey(record) : record[rowKey]) !== null && _ref2 !== void 0 ? _ref2 : key;
113
106
  }
114
- }, rowSelection);
107
+ return key;
108
+ };
115
109
  var config = {
116
110
  form: form,
117
111
  mode: mode,
@@ -144,6 +138,23 @@ var ProEditTable = function ProEditTable(_ref, ref) {
144
138
  originalTip: originalTip,
145
139
  prefixCls: prefixCls
146
140
  };
141
+ // 编辑行设置下样式
142
+ var _rowClassName = function _rowClassName(record) {
143
+ var isEdit = !virtualKey || editingKeys.includes(record.rowKey);
144
+ var className = isEdit ? 'is-editing' : '';
145
+ return className;
146
+ };
147
+ // 复选框
148
+ var _rowSelection = _objectSpread({
149
+ fixed: true,
150
+ selectedRowKeys: selectedRowKeys,
151
+ onChange: function onChange(selectedRowKeys, selectedRows) {
152
+ setState({
153
+ selectedRowKeys: selectedRowKeys,
154
+ selectedRows: selectedRows
155
+ });
156
+ }
157
+ }, rowSelection);
147
158
  // 判断是否禁止添加、批量删除
148
159
  var isForbiddenBtn = useCallback(function (type) {
149
160
  // 当工具栏不渲染时,都不渲染
@@ -202,7 +213,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
202
213
  return isForbiddenBtn('mulDelete') ? rowSelection : _rowSelection;
203
214
  };
204
215
  var setColumns = /*#__PURE__*/function () {
205
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
216
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
206
217
  var nextColumns;
207
218
  return _regeneratorRuntime().wrap(function _callee$(_context) {
208
219
  while (1) switch (_context.prev = _context.next) {
@@ -221,7 +232,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
221
232
  }, _callee);
222
233
  }));
223
234
  return function setColumns() {
224
- return _ref2.apply(this, arguments);
235
+ return _ref3.apply(this, arguments);
225
236
  };
226
237
  }();
227
238
  useDebounceEffect(function () {
@@ -237,7 +248,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
237
248
  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)) {
238
249
  var nextValues = value === null || value === void 0 ? void 0 : value.map(function (item) {
239
250
  return _objectSpread(_objectSpread({}, item), {}, {
240
- rowKey: getRandom()
251
+ rowKey: getRowKey(item)
241
252
  });
242
253
  });
243
254
  onChange(nextValues);
@@ -16,7 +16,7 @@ var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component
16
16
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
17
17
  import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
18
18
  import React, { useState, useEffect, useMemo } from 'react';
19
- import { cloneDeep, isFunction, isString, isArray } from 'lodash';
19
+ import { cloneDeep, isFunction, isString, isArray, omit } from 'lodash';
20
20
  import ProSelect from '../ProSelect';
21
21
  import { useProConfig } from '../ProConfigProvider';
22
22
  import ProEnumTag from './components/Tag';
@@ -79,7 +79,6 @@ var ProEnum = function ProEnum(props) {
79
79
  var _useProConfig = useProConfig('ProEnum'),
80
80
  _useProConfig$dics = _useProConfig.dics,
81
81
  dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
82
- // const enumList = dics?.[code] || [];
83
82
  var _useRequestFunc = useRequestFunc(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread(_objectSpread({
84
83
  manual: true,
85
84
  cacheTime: -1
@@ -173,26 +172,16 @@ var ProEnum = function ProEnum(props) {
173
172
  onChange: onChange
174
173
  }));
175
174
  case 'Radio':
176
- return _jsx(_Radio.Group, _objectSpread(_objectSpread({}, enumProps), {}, {
175
+ return _jsx(_Radio.Group, _objectSpread(_objectSpread({}, omit(enumProps, ['fieldNames'])), {}, {
176
+ options: list,
177
177
  value: value,
178
- onChange: onChange,
179
- children: list.map(function (item) {
180
- return _jsx(_Radio, {
181
- value: item[fieldValue],
182
- children: item[label]
183
- }, item[fieldValue]);
184
- })
178
+ onChange: onChange
185
179
  }));
186
180
  case 'Checkbox':
187
- return _jsx(_Checkbox.Group, _objectSpread(_objectSpread({}, enumProps), {}, {
181
+ return _jsx(_Checkbox.Group, _objectSpread(_objectSpread({}, omit(enumProps, ['fieldNames'])), {}, {
182
+ options: list,
188
183
  value: value,
189
- onChange: onChange,
190
- children: list.map(function (item) {
191
- return _jsx(_Checkbox, {
192
- value: item[fieldValue],
193
- children: item[label]
194
- }, item[fieldValue]);
195
- })
184
+ onChange: onChange
196
185
  }));
197
186
  case 'Tag':
198
187
  return _jsx(ProEnumTag, {
@@ -6,6 +6,7 @@ import { PropSelectProps } from '../ProSelect/propsType';
6
6
  export interface DataOption {
7
7
  label?: string;
8
8
  value?: string;
9
+ disabled?: boolean;
9
10
  [key: string]: any;
10
11
  }
11
12
  export interface ProEnumConfig {
@@ -145,13 +145,13 @@ var ActionButton = function ActionButton(props) {
145
145
  align: "start",
146
146
  className: "pro-form-list-action",
147
147
  children: actionProps === null || actionProps === void 0 ? void 0 : actionProps.map(function (item) {
148
- if (item.show === false) return _jsx(_Fragment, {});
148
+ if (item.show === false) return _jsx("span", {}, "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index));
149
149
  if (isFunction(item.show) && !item.show(form.getFieldValue(namePath), {
150
150
  namePath: namePath,
151
151
  index: index,
152
152
  form: form
153
153
  })) {
154
- return _jsx(_Fragment, {});
154
+ return _jsx("span", {}, "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index));
155
155
  }
156
156
  var label = item.label,
157
157
  onClick = item.onClick,
@@ -62,7 +62,7 @@ var FormList = function FormList(props, ref) {
62
62
  var handleDragEnd = function handleDragEnd(drag) {
63
63
  var active = drag.active,
64
64
  over = drag.over;
65
- if (active.id !== over.id) {
65
+ if (_fields.length > 1 && active.id !== over.id) {
66
66
  var activeIndex = _fields.findIndex(function (item) {
67
67
  return item.key === active.id;
68
68
  });
@@ -9,7 +9,7 @@ import { useMemo } from 'react';
9
9
  import { omit } from 'lodash';
10
10
  import classnames from 'classnames';
11
11
  import RenderFields from '../../render/RenderFields';
12
- import { insertSeparator, parseName } from './utils';
12
+ import { insertSeparator } from './utils';
13
13
  import ProForm from '../../../../ProForm';
14
14
  var Group = function Group(props) {
15
15
  var columns = props.children,
@@ -27,7 +27,6 @@ var Group = function Group(props) {
27
27
  if (!Array.isArray(names)) {
28
28
  console.error('Warning: Composite form components whose type is Group must be configured with names');
29
29
  }
30
- var _parentNames = parseName(id);
31
30
  var data = useMemo(function () {
32
31
  var fieldList = [];
33
32
  var result = columns.map(function (item) {
@@ -35,7 +34,7 @@ var Group = function Group(props) {
35
34
  disabled: Boolean(props === null || props === void 0 ? void 0 : props.disabled)
36
35
  }, item), {}, {
37
36
  noStyle: (space === null || space === void 0 ? void 0 : space.compact) || (space === null || space === void 0 ? void 0 : space.separator),
38
- parentNames: _parentNames
37
+ parentNames: id
39
38
  });
40
39
  });
41
40
  var node = _jsx(_Button, {
@@ -46,7 +45,7 @@ var Group = function Group(props) {
46
45
  columns: insertSeparator(result, space, node, otherProps),
47
46
  fieldList: fieldList
48
47
  };
49
- }, [name, columns, space, props]);
48
+ }, [name, columns, space, props, names]);
50
49
  var _className = classnames(_defineProperty({
51
50
  'pro-group': true,
52
51
  'pro-group-diy-width': columns.some(function (item) {
@@ -54,6 +53,7 @@ var Group = function Group(props) {
54
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;
55
54
  })
56
55
  }, "".concat(className), className));
56
+ console.log('name', name, data);
57
57
  return _jsx("div", {
58
58
  className: _className,
59
59
  children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? _jsx(_Space.Compact, {
@@ -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[];
@@ -33,17 +33,4 @@ export var insertSeparator = function insertSeparator(columns, space, separatorN
33
33
  }
34
34
  return result;
35
35
  }, []);
36
- };
37
- /** 解析name */
38
- export var parseName = function parseName(name) {
39
- var result = [];
40
- var parts = name.split('_');
41
- parts.forEach(function (part) {
42
- if (!Number.isNaN(Number(part))) {
43
- result.push(Number(part));
44
- } else {
45
- result.push(part);
46
- }
47
- });
48
- return result;
49
36
  };
@@ -419,19 +419,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
419
419
  useRequest.initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams(value, contentForm === null || contentForm === void 0 ? void 0 : (_contentForm$getField = contentForm.getFieldsValue) === null || _contentForm$getField === void 0 ? void 0 : _contentForm$getField.call(contentForm));
420
420
  }
421
421
  if (!((useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || defaultOne)) {
422
- _context4.next = 13;
422
+ _context4.next = 10;
423
423
  break;
424
424
  }
425
- if (readOnly) {
426
- _context4.next = 5;
427
- break;
428
- }
429
- setState({
430
- _value: value,
431
- isInit: false
432
- });
433
- return _context4.abrupt("return");
434
- case 5:
435
425
  queryBean = _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.defaultParams), (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || {});
436
426
  page = _objectSpread({
437
427
  pageNum: 1,
@@ -441,9 +431,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
441
431
  queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
442
432
  }) : queryBean;
443
433
  params = transformParams ? transformParams(params) : params;
444
- _context4.next = 11;
434
+ _context4.next = 8;
445
435
  return runAsync(params);
446
- case 11:
436
+ case 8:
447
437
  res = _context4.sent;
448
438
  if (res === null || res === void 0 ? void 0 : res.data) {
449
439
  list = [];
@@ -453,19 +443,27 @@ var ProModalSelect = function ProModalSelect(props, ref) {
453
443
  list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list : res === null || res === void 0 ? void 0 : res.data;
454
444
  }
455
445
  _data2 = isMultiple ? list : (_list = list) === null || _list === void 0 ? void 0 : _list[0];
456
- nextSelectRowKeys = isMultiple ? value : [value];
457
- if (labelInValue) {
458
- onChange(_data2);
446
+ if (_data2) {
447
+ nextSelectRowKeys = isMultiple ? value : [value];
448
+ if (labelInValue) {
449
+ onChange(_data2);
450
+ }
451
+ // 更新内部展示值
452
+ setState({
453
+ _value: _data2,
454
+ isInit: false,
455
+ selectedRows: list,
456
+ selectedRowKeys: nextSelectRowKeys
457
+ });
458
+ } else if (!readOnly) {
459
+ // 当传入initParams且文本框非只读时,不调用接口获取初始化数据
460
+ setState({
461
+ _value: value,
462
+ isInit: false
463
+ });
459
464
  }
460
- // 更新内部展示值
461
- setState({
462
- _value: _data2,
463
- isInit: false,
464
- selectedRows: list,
465
- selectedRowKeys: nextSelectRowKeys
466
- });
467
465
  }
468
- case 13:
466
+ case 10:
469
467
  case "end":
470
468
  return _context4.stop();
471
469
  }
@@ -653,7 +651,6 @@ var ProModalSelect = function ProModalSelect(props, ref) {
653
651
  onChange: handleChangeValue,
654
652
  disabled: disabled,
655
653
  addonAfter: forceAddonAfterRender(),
656
- placeholder: locale.ProModalSelect.select,
657
654
  autoComplete: "off"
658
655
  }, restInputProps)), _jsx(_Input, {
659
656
  type: "hidden",
@@ -3,11 +3,15 @@
3
3
 
4
4
  .@{ant-prefix}-form-item-has-error {
5
5
  .@{ant-prefix}-picker-status-error
6
- ~ .forever-checkbox:not(.@{ant-prefix}-input-disabled):not(.@{ant-prefix}-input-borderless).@{ant-prefix}-input {
6
+ ~ .forever-checkbox:not(.@{ant-prefix}-input-disabled):not(
7
+ .@{ant-prefix}-input-borderless
8
+ ).@{ant-prefix}-input {
7
9
  background: @zaui-base-bg;
8
10
  border-color: var(--ant-error-color);
9
11
  }
10
- .forever-checkbox:not(.@{ant-prefix}-input-disabled):not(.@{ant-prefix}-input-borderless).@{ant-prefix}-input:focus {
12
+ .forever-checkbox:not(.@{ant-prefix}-input-disabled):not(
13
+ .@{ant-prefix}-input-borderless
14
+ ).@{ant-prefix}-input:focus {
11
15
  border-color: var(--ant-error-color-hover);
12
16
  border-right-width: 1px;
13
17
  outline: 0;
@@ -24,6 +28,9 @@ span.@{ant-prefix}-input-group-compact {
24
28
  flex: 1;
25
29
  }
26
30
 
31
+ .@{ant-prefix}-picker-focused {
32
+ z-index: 1;
33
+ }
27
34
  .forever-checkbox {
28
35
  flex: 0;
29
36
  min-width: unset;
@@ -363,13 +363,13 @@ var Render = function Render(props) {
363
363
  };
364
364
  }
365
365
  // 需要过滤掉的form_item的key
366
- var filterFormItemKey = ['onFieldChange',
367
- // 'shouldUpdate',
368
- 'namePath', 'isView', 'parentNames', 'space', 'before', 'after'];
366
+ var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after'];
369
367
  if (type === 'FormList') {
370
368
  lastComponentProps.disabled = lastDisabled;
371
369
  var lessMode = lastComponentProps.mode === 'less';
372
- child = _jsx(_Form.List, _objectSpread(_objectSpread({}, _otherFormItemProps), {}, {
370
+ child = _jsx(_Form.List, _objectSpread(_objectSpread({
371
+ name: _otherFormItemProps.name
372
+ }, omit(_otherFormItemProps, ['rules'])), {}, {
373
373
  children: function children(fields, operation, meta) {
374
374
  return _jsx(AutoComponent, _objectSpread(_objectSpread({}, omit(lastComponentProps, ['onFieldChange', 'disabledStrictly'])), {}, {
375
375
  otherProps: otherProps,
@@ -389,31 +389,24 @@ var Render = function Render(props) {
389
389
  span: 24 // 默认占一行
390
390
  });
391
391
  }
392
- // 当存在shouldUpdate时补货所有form变更(防止表单onchange设置form值时无法更新的问题)
393
- // if (_otherFormItemProps.shouldUpdate) {
394
- // return (
395
- // <Form.Item shouldUpdate={_otherFormItemProps.shouldUpdate} noStyle>
396
- // {() => {
397
- // return (
398
- // <Form.Item
399
- // {...omit(_otherFormItemProps, filterFormItemKey)}
400
- // // @ts-ignore
401
- // _internalItemRender={internalItemRender}
402
- // className={_className}
403
- // >
404
- // {child}
405
- // </Form.Item>
406
- // );
407
- // }}
408
- // </Form.Item>
409
- // );
410
- // }
411
- var formItem = _jsx(_Form.Item, _objectSpread(_objectSpread({}, omit(_otherFormItemProps, filterFormItemKey)), {}, {
392
+
393
+ var orgFormItem = _jsx(_Form.Item, _objectSpread(_objectSpread({}, omit(_otherFormItemProps, filterFormItemKey)), {}, {
412
394
  // @ts-ignore
413
395
  _internalItemRender: internalItemRender,
414
396
  className: _className,
415
397
  children: child
416
398
  }));
399
+ var formItem = orgFormItem;
400
+ // 当存在shouldUpdate时捕获所有form变更(防止表单onchange设置form值时无法更新的问题)
401
+ if (_otherFormItemProps.shouldUpdate) {
402
+ formItem = _jsx(_Form.Item, {
403
+ shouldUpdate: _otherFormItemProps.shouldUpdate,
404
+ noStyle: true,
405
+ children: function children() {
406
+ return orgFormItem;
407
+ }
408
+ });
409
+ }
417
410
  // 不渲染tooltip
418
411
  if (!originalTip || ['FormList', 'ProEditTable'].includes(type)) {
419
412
  return formItem;
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
3
3
  var _excluded = ["show", "type", "viewRender", "viewType", "valueType", "formItemProps", "colProps", "formItemChildProps", "fieldProps", "disabled", "equalWith", "clearNotShow", "required"];
4
4
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
5
5
  import React from 'react';
6
- import { isBoolean, isFunction, union } from 'lodash';
6
+ import { isBoolean, isFunction, union, isString } from 'lodash';
7
7
  import Render from './Render';
8
8
  import * as componentMap from '../index';
9
9
  import { isSelect } from '../../utils';
@@ -129,7 +129,11 @@ var RenderFields = function RenderFields(props) {
129
129
  dataSource: dataSource,
130
130
  type: _type
131
131
  });
132
- var _placeholder = placeholder || "".concat(_isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(label || formLabel || '');
132
+ var placeholderHandle = function placeholderHandle() {
133
+ var _label = isString(label) ? label : '';
134
+ var _formLabel = isString(formLabel) ? formLabel : '';
135
+ return placeholder || "".concat(_isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(_label || _formLabel || '');
136
+ };
133
137
  // 表单组件Props 兼容2.0版本
134
138
  var _fieldProps = _objectSpread(_objectSpread({}, formItemChildProps), fieldProps);
135
139
  if (isBoolean(formDisabled)) {
@@ -137,7 +141,7 @@ var RenderFields = function RenderFields(props) {
137
141
  }
138
142
  var componentProps = _objectSpread(_objectSpread({
139
143
  disabledStrictly: true,
140
- placeholder: _placeholder
144
+ placeholder: placeholderHandle()
141
145
  }, _fieldProps), {}, {
142
146
  disabled: _disabled
143
147
  });
@@ -1,10 +1,11 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import { validate, regExp } from '@zat-design/utils';
3
+ import { isString } from 'lodash';
3
4
  import { isNullValue } from './index';
4
5
  import locale from '../../locale';
5
6
  export var rulesCreator = function rulesCreator(rules, label, isSelect) {
6
7
  var _result;
7
- var message = "".concat(isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(locale.ProForm.ruleText).concat(label || '');
8
+ var message = "".concat(isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(locale.ProForm.ruleText).concat(isString(label) ? label : '');
8
9
  var result = [];
9
10
  result = rules.map(function (ruleItem) {
10
11
  var rule = _objectSpread({}, ruleItem);
@@ -47,23 +47,31 @@ export var useForm = function useForm(originForm) {
47
47
  };
48
48
  var _validateFields = /*#__PURE__*/function () {
49
49
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(nameList) {
50
- var values, _values;
50
+ var _len,
51
+ rest,
52
+ _key,
53
+ values,
54
+ _values,
55
+ _args = arguments;
51
56
  return _regeneratorRuntime().wrap(function _callee$(_context) {
52
57
  while (1) switch (_context.prev = _context.next) {
53
58
  case 0:
54
- _context.next = 2;
55
- return validateFields(nameList);
56
- case 2:
59
+ for (_len = _args.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
60
+ rest[_key - 1] = _args[_key];
61
+ }
62
+ _context.next = 3;
63
+ return validateFields.apply(void 0, [nameList].concat(rest));
64
+ case 3:
57
65
  values = _context.sent;
58
66
  if (!nameList) {
59
- _context.next = 5;
67
+ _context.next = 6;
60
68
  break;
61
69
  }
62
70
  return _context.abrupt("return", values);
63
- case 5:
71
+ case 6:
64
72
  _values = _getFieldsValue();
65
73
  return _context.abrupt("return", _values);
66
- case 7:
74
+ case 8:
67
75
  case "end":
68
76
  return _context.stop();
69
77
  }
@@ -1,6 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import { useEffect, useMemo } from 'react';
3
- import { isBoolean } from 'lodash';
3
+ import { isBoolean, isString } from 'lodash';
4
4
  import { rulesCreator } from './rulesCreator';
5
5
  import { isNotFullArray, isNullArray } from './index';
6
6
  import locale from '../../locale';
@@ -12,6 +12,7 @@ var useRules = function useRules(props) {
12
12
  names = props.names,
13
13
  labelRequired = props.labelRequired,
14
14
  type = props.type;
15
+ var _label = isString(label) ? label : '';
15
16
  // 根据 required 添加 rules, names 字段会添加数组的必填校验
16
17
  var internalRule = useMemo(function () {
17
18
  var result = {
@@ -22,7 +23,7 @@ var useRules = function useRules(props) {
22
23
  return 'required' in rule;
23
24
  }));
24
25
  if (!requiredRule) {
25
- var message = isSelect ? "".concat(locale.ProForm.selectPlaceHolder).concat(label || '') : "".concat(locale.ProForm.inputPlaceholder).concat(label || '');
26
+ var message = isSelect ? "".concat(locale.ProForm.selectPlaceHolder).concat(_label) : "".concat(locale.ProForm.inputPlaceholder).concat(_label);
26
27
  var rule = {
27
28
  required: required,
28
29
  message: message
@@ -31,7 +32,7 @@ var useRules = function useRules(props) {
31
32
  if (names === null || names === void 0 ? void 0 : names.length) {
32
33
  rule.validator = function (_, value) {
33
34
  if (!value || isNullArray(value)) {
34
- return Promise.reject(new Error("".concat(locale.ProForm.inputPlaceholder).concat(label)));
35
+ return Promise.reject(new Error("".concat(locale.ProForm.inputPlaceholder).concat(_label)));
35
36
  }
36
37
  return Promise.resolve();
37
38
  };
@@ -42,7 +43,7 @@ var useRules = function useRules(props) {
42
43
  return result;
43
44
  }, [rules, required]);
44
45
  // type转换为内置rules
45
- internalRule.rules = internalRule.rules && rulesCreator(internalRule.rules, label, isSelect);
46
+ internalRule.rules = internalRule.rules && rulesCreator(internalRule.rules, _label, isSelect);
46
47
  useEffect(function () {
47
48
  // 添加完整性校验
48
49
  if (names && !isBoolean(labelRequired) || type === 'Group' && Array.isArray(names) && required) {
@@ -50,7 +51,7 @@ var useRules = function useRules(props) {
50
51
  validator: function validator(rules, value) {
51
52
  // 完整性校验, 空数组不校验, 数组有值且值不完整则校验不通过
52
53
  if (Array.isArray(value) && !isNullArray(value) && isNotFullArray(value, names.length)) {
53
- return Promise.reject(new Error("".concat(locale.ProForm.completeText).concat(label || '')));
54
+ return Promise.reject(new Error("".concat(locale.ProForm.completeText).concat(_label)));
54
55
  }
55
56
  return Promise.resolve();
56
57
  }
@@ -7,7 +7,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
7
7
  var _excluded = ["children"];
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  import { createContext, useContext, useEffect, useMemo, useState } from 'react';
10
- import { useEventEmitter, useSetState, useLocalStorageState } from 'ahooks';
10
+ import { useEventEmitter, useSetState, useLocalStorageState, useDeepCompareEffect } from 'ahooks';
11
11
  import { handleScroll } from './utils';
12
12
  import Step from './components/Step';
13
13
  import Item from './components/Item';
@@ -163,7 +163,7 @@ var ProStep = function ProStep(_ref) {
163
163
 
164
164
  observer.observe(targetElement, config);
165
165
  };
166
- useEffect(function () {
166
+ useDeepCompareEffect(function () {
167
167
  var errorModuleKeys = Object.keys(errorCollection).reverse();
168
168
  if (errorModuleKeys === null || errorModuleKeys === void 0 ? void 0 : errorModuleKeys.length) {
169
169
  var _dataSource$find;