@zat-design/sisyphus-react 3.4.13 → 3.5.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/LICENSE +201 -21
  2. package/dist/index.esm.css +62 -1
  3. package/dist/less.esm.css +61 -0
  4. package/es/ProEditTable/components/DndWrapper/index.js +1 -0
  5. package/es/ProEditTable/index.d.ts +1 -1
  6. package/es/ProEditTable/index.js +8 -3
  7. package/es/ProEditTable/propsType.d.ts +1 -0
  8. package/es/ProEditTable/style/index.less +1 -0
  9. package/es/ProEditTable/utils/index.js +10 -38
  10. package/es/ProEditTable/utils/tools.d.ts +3 -0
  11. package/es/ProEditTable/utils/tools.js +33 -0
  12. package/es/ProForm/components/combination/FormList/components/ActionButton.js +1 -1
  13. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -1
  14. package/es/ProForm/components/combination/ProModalSelect/index.js +1 -1
  15. package/es/ProForm/components/combination/ProNumberRange/index.js +28 -7
  16. package/es/ProForm/components/combination/ProNumberRange/propsType.d.ts +1 -2
  17. package/es/ProForm/index.js +3 -3
  18. package/es/ProForm/style/index.less +1 -0
  19. package/es/ProForm/utils/useForm.d.ts +5 -1
  20. package/es/ProForm/utils/useForm.js +24 -14
  21. package/es/ProForm/utils/valueType.d.ts +0 -6
  22. package/es/ProForm/utils/valueType.js +30 -2
  23. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +1 -2
  24. package/es/ProLayout/index.js +6 -2
  25. package/es/ProLayout/propTypes.d.ts +4 -0
  26. package/es/ProSelect/index.js +52 -45
  27. package/es/ProSelect/index.less +6 -0
  28. package/es/ProTable/components/DndWrapper/index.d.ts +15 -0
  29. package/es/ProTable/components/DndWrapper/index.js +94 -0
  30. package/es/ProTable/components/index.d.ts +1 -0
  31. package/es/ProTable/components/index.js +2 -1
  32. package/es/ProTable/index.d.ts +3 -0
  33. package/es/ProTable/index.js +177 -74
  34. package/es/ProTable/propsType.d.ts +5 -1
  35. package/es/ProTable/style/index.less +90 -0
  36. package/es/ProTree/components/ProTreeSelect/index.js +6 -2
  37. package/es/ProTree/utils.d.ts +1 -1
  38. package/es/ProTree/utils.js +1 -1
  39. package/es/ProTreeModal/index.js +10 -4
  40. package/es/ProTreeModal/style/index.less +1 -0
  41. package/es/style/theme/antd.less +1 -1
  42. package/lib/ProEditTable/components/DndWrapper/index.js +1 -0
  43. package/lib/ProEditTable/index.d.ts +1 -1
  44. package/lib/ProEditTable/index.js +8 -3
  45. package/lib/ProEditTable/propsType.d.ts +1 -0
  46. package/lib/ProEditTable/style/index.less +1 -0
  47. package/lib/ProEditTable/utils/index.js +9 -37
  48. package/lib/ProEditTable/utils/tools.d.ts +3 -0
  49. package/lib/ProEditTable/utils/tools.js +34 -1
  50. package/lib/ProForm/components/combination/FormList/components/ActionButton.js +1 -1
  51. package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -1
  52. package/lib/ProForm/components/combination/ProModalSelect/index.js +1 -1
  53. package/lib/ProForm/components/combination/ProNumberRange/index.js +28 -7
  54. package/lib/ProForm/components/combination/ProNumberRange/propsType.d.ts +1 -2
  55. package/lib/ProForm/index.js +2 -2
  56. package/lib/ProForm/style/index.less +1 -0
  57. package/lib/ProForm/utils/useForm.d.ts +5 -1
  58. package/lib/ProForm/utils/useForm.js +24 -14
  59. package/lib/ProForm/utils/valueType.d.ts +0 -6
  60. package/lib/ProForm/utils/valueType.js +30 -2
  61. package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +1 -2
  62. package/lib/ProLayout/index.js +6 -2
  63. package/lib/ProLayout/propTypes.d.ts +4 -0
  64. package/lib/ProSelect/index.js +54 -45
  65. package/lib/ProSelect/index.less +6 -0
  66. package/lib/ProTable/components/DndWrapper/index.d.ts +15 -0
  67. package/lib/ProTable/components/DndWrapper/index.js +101 -0
  68. package/lib/ProTable/components/index.d.ts +1 -0
  69. package/lib/ProTable/components/index.js +15 -1
  70. package/lib/ProTable/index.d.ts +3 -0
  71. package/lib/ProTable/index.js +173 -70
  72. package/lib/ProTable/propsType.d.ts +5 -1
  73. package/lib/ProTable/style/index.less +90 -0
  74. package/lib/ProTree/components/ProTreeSelect/index.js +6 -2
  75. package/lib/ProTree/utils.d.ts +1 -1
  76. package/lib/ProTree/utils.js +1 -1
  77. package/lib/ProTreeModal/index.js +10 -4
  78. package/lib/ProTreeModal/style/index.less +1 -0
  79. package/lib/style/theme/antd.less +1 -1
  80. package/package.json +2 -2
@@ -102,35 +102,7 @@ var getActionColumn = function getActionColumn(config) {
102
102
  case 8:
103
103
  _context.prev = 8;
104
104
  _context.t0 = _context["catch"](3);
105
- setTimeout(function () {
106
- var errorDom = document.querySelector('.ant-form-item-has-error');
107
- if (errorDom) {
108
- var tableBody = errorDom.closest('.ant-table-content') || errorDom.closest('.ant-table-body');
109
- var tableCell = errorDom.closest('.ant-table-cell');
110
- if (tableBody && tableCell) {
111
- var previousSibling = tableCell.previousElementSibling;
112
- var childOffsetLeft = 0;
113
- var childFixedLeft = 0;
114
- while (previousSibling) {
115
- if (previousSibling.nodeType === 1) {
116
- var _previousSibling, _previousSibling$clas, _previousSibling$clas2, _previousSibling$clas3;
117
- var _ref2 = previousSibling.getBoundingClientRect() || {},
118
- _ref2$width = _ref2.width,
119
- width = _ref2$width === void 0 ? 0 : _ref2$width;
120
- childOffsetLeft += width;
121
- if ((_previousSibling = previousSibling) === null || _previousSibling === void 0 ? void 0 : (_previousSibling$clas = _previousSibling.classList) === null || _previousSibling$clas === void 0 ? void 0 : (_previousSibling$clas2 = (_previousSibling$clas3 = _previousSibling$clas).contains) === null || _previousSibling$clas2 === void 0 ? void 0 : _previousSibling$clas2.call(_previousSibling$clas3, 'ant-table-cell-fix-left')) {
122
- childFixedLeft += width;
123
- }
124
- }
125
- previousSibling = previousSibling.previousElementSibling;
126
- }
127
- tableBody.scrollTo({
128
- left: childOffsetLeft - childFixedLeft,
129
- behavior: 'smooth'
130
- });
131
- }
132
- }
133
- }, 0);
105
+ (0, _tools.handleScrollToError)();
134
106
  return _context.abrupt("return", Promise.reject(_context.t0));
135
107
  case 12:
136
108
  // 编辑状态使用自定义form值,非编辑状态直接使用行数据
@@ -258,10 +230,10 @@ var transformColumns = exports.transformColumns = function transformColumns() {
258
230
  if (typeof columnTitle === 'string') {
259
231
  item.originTitle = columnTitle;
260
232
  if (tooltip) {
261
- var _ref3 = tooltip || {},
262
- tooltipTitle = _ref3.title,
263
- icon = _ref3.icon,
264
- resetProps = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
233
+ var _ref2 = tooltip || {},
234
+ tooltipTitle = _ref2.title,
235
+ icon = _ref2.icon,
236
+ resetProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
265
237
  item.title = (0, _jsxRuntime.jsxs)("span", {
266
238
  className: "pro-edit-table-title pro-edit-table-tooltip",
267
239
  children: [before, columnTitle, (0, _jsxRuntime.jsx)(_antd.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({
@@ -413,13 +385,13 @@ var transformColumns = exports.transformColumns = function transformColumns() {
413
385
  // cacheMap 用来存储缓存值,若有值后不再请求
414
386
  if (JSON.stringify(cacheMap.current) === '{}') {
415
387
  Promise.all(Object.entries(_cacheMap).map( /*#__PURE__*/function () {
416
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(item) {
417
- var _item, key, value, _ref5, service, option;
388
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(item) {
389
+ var _item, key, value, _ref4, service, option;
418
390
  return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
419
391
  while (1) switch (_context2.prev = _context2.next) {
420
392
  case 0:
421
393
  _item = (0, _slicedToArray2.default)(item, 2), key = _item[0], value = _item[1];
422
- _ref5 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref5.service, option = _ref5.option;
394
+ _ref4 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref4.service, option = _ref4.option;
423
395
  if (!service) {
424
396
  _context2.next = 8;
425
397
  break;
@@ -439,7 +411,7 @@ var transformColumns = exports.transformColumns = function transformColumns() {
439
411
  }, _callee2);
440
412
  }));
441
413
  return function (_x3) {
442
- return _ref4.apply(this, arguments);
414
+ return _ref3.apply(this, arguments);
443
415
  };
444
416
  }())).then(function (res) {
445
417
  res.forEach(function (item) {
@@ -26,3 +26,6 @@ export declare const onDelete: ({ name, form, virtualKey, selectedRowKeys }: {
26
26
  * @param rowDisabled 行禁用参数
27
27
  */
28
28
  export declare const getDisabled: ({ globalControl, formDisabled, column, tabledDisabled, columnFieldProps, params, rowDisabled }: any) => any;
29
+ /** 表格自动滚动到报错位置
30
+ */
31
+ export declare const handleScrollToError: () => void;
@@ -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.splitNames = exports.onDelete = exports.getRandom = exports.getNamePath = exports.getDisabled = exports.difference = exports.customValidate = void 0;
7
+ exports.splitNames = exports.onDelete = exports.handleScrollToError = exports.getRandom = exports.getNamePath = exports.getDisabled = exports.difference = exports.customValidate = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _lodash = require("lodash");
10
10
  var getRandom = exports.getRandom = function getRandom() {
@@ -158,4 +158,37 @@ var getDisabled = exports.getDisabled = function getDisabled(_ref2) {
158
158
  return convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled.apply(columnFieldProps, (0, _toConsumableArray2.default)(params)));
159
159
  }
160
160
  return convertToBoolean(column === null || column === void 0 ? void 0 : column.disabled) || convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled) || convertToBoolean(tabledDisabled);
161
+ };
162
+ /** 表格自动滚动到报错位置
163
+ */
164
+ var handleScrollToError = exports.handleScrollToError = function handleScrollToError() {
165
+ setTimeout(function () {
166
+ var errorDom = document.querySelector('.ant-form-item-has-error');
167
+ if (errorDom) {
168
+ var tableBody = errorDom.closest('.ant-table-content') || errorDom.closest('.ant-table-body');
169
+ var tableCell = errorDom.closest('.ant-table-cell');
170
+ if (tableBody && tableCell) {
171
+ var previousSibling = tableCell.previousElementSibling;
172
+ var childOffsetLeft = 0;
173
+ var childFixedLeft = 0;
174
+ while (previousSibling) {
175
+ if (previousSibling.nodeType === 1) {
176
+ var _previousSibling, _previousSibling$clas, _previousSibling$clas2, _previousSibling$clas3;
177
+ var _ref3 = previousSibling.getBoundingClientRect() || {},
178
+ _ref3$width = _ref3.width,
179
+ width = _ref3$width === void 0 ? 0 : _ref3$width;
180
+ childOffsetLeft += width;
181
+ if ((_previousSibling = previousSibling) === null || _previousSibling === void 0 ? void 0 : (_previousSibling$clas = _previousSibling.classList) === null || _previousSibling$clas === void 0 ? void 0 : (_previousSibling$clas2 = (_previousSibling$clas3 = _previousSibling$clas).contains) === null || _previousSibling$clas2 === void 0 ? void 0 : _previousSibling$clas2.call(_previousSibling$clas3, 'ant-table-cell-fix-left')) {
182
+ childFixedLeft += width;
183
+ }
184
+ }
185
+ previousSibling = previousSibling.previousElementSibling;
186
+ }
187
+ tableBody.scrollTo({
188
+ left: childOffsetLeft - childFixedLeft,
189
+ behavior: 'smooth'
190
+ });
191
+ }
192
+ }
193
+ }, 0);
161
194
  };
@@ -123,7 +123,7 @@ var ActionButton = function ActionButton(props) {
123
123
  var _actionProps = (_props$actionProps = props.actionProps) === null || _props$actionProps === void 0 ? void 0 : _props$actionProps.map(function (item) {
124
124
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
125
125
  // @ts-ignore
126
- type: item.actionType
126
+ type: item.actionType || item.type
127
127
  });
128
128
  });
129
129
  if (!(_actionProps === null || _actionProps === void 0 ? void 0 : _actionProps.find(function (item) {
@@ -50,7 +50,7 @@ var ToolbarButton = function ToolbarButton(props) {
50
50
  var _toolbarProps = (_props$toolbarProps = props.toolbarProps) === null || _props$toolbarProps === void 0 ? void 0 : _props$toolbarProps.map(function (item) {
51
51
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
52
52
  // @ts-ignore
53
- type: item.actionType
53
+ type: item.actionType || item.type
54
54
  });
55
55
  });
56
56
  if (!(_toolbarProps === null || _toolbarProps === void 0 ? void 0 : _toolbarProps.find(function (item) {
@@ -652,7 +652,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
652
652
  selectedRows: []
653
653
  });
654
654
  }
655
- if (!labelInValue && (_value === null || _value === void 0 ? void 0 : _value[valueKey]) && !(0, _lodash.isEqual)(value, _value === null || _value === void 0 ? void 0 : _value[valueKey])) {
655
+ if (!labelInValue && !(0, _lodash.isEqual)(value, _value === null || _value === void 0 ? void 0 : _value[valueKey])) {
656
656
  setState({
657
657
  _value: value,
658
658
  selectedRowKeys: [],
@@ -21,6 +21,7 @@ var formatAmount = _utils.tools.formatAmount,
21
21
  formatPercent = _utils.tools.formatPercent,
22
22
  formatPerMill = _utils.tools.formatPerMill;
23
23
  var ProNumberRange = function ProNumberRange(props) {
24
+ var _valueProps, _valueProps2, _valueProps3, _valueProps4;
24
25
  var _props$value = props.value,
25
26
  value = _props$value === void 0 ? [] : _props$value,
26
27
  _props$onChange = props.onChange,
@@ -138,8 +139,26 @@ var ProNumberRange = function ProNumberRange(props) {
138
139
  }
139
140
  };
140
141
  break;
142
+ // 百分比
143
+ case 'percentage':
144
+ valueProps = {
145
+ min: 0,
146
+ max: 100,
147
+ step: 1
148
+ };
149
+ break;
150
+ // 千分比
151
+ case 'permillage':
152
+ valueProps = {
153
+ min: 0,
154
+ max: 1000,
155
+ step: 1
156
+ };
157
+ break;
141
158
  default:
142
- valueProps = {};
159
+ valueProps = {
160
+ max: 999999999999
161
+ };
143
162
  }
144
163
  }
145
164
  /**
@@ -161,15 +180,16 @@ var ProNumberRange = function ProNumberRange(props) {
161
180
  className: "range-left",
162
181
  value: (value === null || value === void 0 ? void 0 : value[0]) || range[0],
163
182
  placeholder: "".concat(_locale.default.ProForm.inputPlaceholder),
164
- min: min,
165
- max: (value === null || value === void 0 ? void 0 : value[1]) || max || range[1],
166
183
  precision: precision,
167
184
  disabled: getDisabled(disabled, 0),
168
185
  onChange: function onChange(e) {
169
186
  firstHandleChange(e);
170
187
  },
171
188
  addonBefore: addonBefore
172
- }, valueProps), childProps === null || childProps === void 0 ? void 0 : childProps[0])), (0, _jsxRuntime.jsx)(_antd.Input, {
189
+ }, valueProps), {}, {
190
+ min: min || ((_valueProps = valueProps) === null || _valueProps === void 0 ? void 0 : _valueProps.min),
191
+ max: (value === null || value === void 0 ? void 0 : value[1]) || range[1] || max || ((_valueProps2 = valueProps) === null || _valueProps2 === void 0 ? void 0 : _valueProps2.max)
192
+ }, childProps === null || childProps === void 0 ? void 0 : childProps[0])), (0, _jsxRuntime.jsx)(_antd.Input, {
173
193
  className: (0, _classnames.default)({
174
194
  'range-split': true,
175
195
  'range-split-disabled': !!disabled
@@ -180,15 +200,16 @@ var ProNumberRange = function ProNumberRange(props) {
180
200
  className: "range-right",
181
201
  value: (value === null || value === void 0 ? void 0 : value[1]) || range[1],
182
202
  placeholder: "".concat(_locale.default.ProForm.inputPlaceholder),
183
- min: (value === null || value === void 0 ? void 0 : value[0]) || min || range[0],
184
- max: max,
185
203
  precision: precision,
186
204
  disabled: getDisabled(disabled, 1),
187
205
  onChange: function onChange(e) {
188
206
  lastHandleChange(e);
189
207
  },
190
208
  addonAfter: addonAfter
191
- }, valueProps), childProps === null || childProps === void 0 ? void 0 : childProps[1]))]
209
+ }, valueProps), {}, {
210
+ max: max || ((_valueProps3 = valueProps) === null || _valueProps3 === void 0 ? void 0 : _valueProps3.max),
211
+ min: (value === null || value === void 0 ? void 0 : value[0]) || range[0] || min || ((_valueProps4 = valueProps) === null || _valueProps4 === void 0 ? void 0 : _valueProps4.min)
212
+ }, childProps === null || childProps === void 0 ? void 0 : childProps[1]))]
192
213
  });
193
214
  };
194
215
  var _default = exports.default = ProNumberRange;
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { ProFormOtherProps } from '../../../propsType';
3
- export type ValueTypeEnum = 'percentage' | 'permillage' | 'thousandth';
4
3
  export interface ProNumberRangeProps {
5
4
  /**
6
5
  * @description 组件的值,[最小值,最大值]
@@ -46,7 +45,7 @@ export interface ProNumberRangeProps {
46
45
  * @description 值类型,回显时区分金额与百分比
47
46
  * @default '-'
48
47
  */
49
- valueType?: ValueTypeEnum;
48
+ valueType?: 'percentage' | 'permillage' | 'thousandth';
50
49
  /**
51
50
  * @description 空值查看时默认展示内容
52
51
  * @default '-'
@@ -164,7 +164,7 @@ var ProForm = function ProForm(props, ref) {
164
164
  // 暂时通过'-'区分组合组件字段和普通字段
165
165
  var keys = Object.keys(changedValue);
166
166
  if (!keys.length) {
167
- onValuesChange(changedValue, form.getFieldsValue());
167
+ onValuesChange((0, _index.filterInternalFields)(changedValue), form.getFieldsValue());
168
168
  } else {
169
169
  var values = keys.map(function (key) {
170
170
  if (key.includes('-')) {
@@ -176,7 +176,7 @@ var ProForm = function ProForm(props, ref) {
176
176
  }
177
177
  return {};
178
178
  });
179
- onValuesChange(_lodash.merge.apply(void 0, [changedValue].concat((0, _toConsumableArray2.default)(values))), form.getFieldsValue());
179
+ onValuesChange((0, _index.filterInternalFields)(_lodash.merge.apply(void 0, [changedValue].concat((0, _toConsumableArray2.default)(values)))), form.getFieldsValue());
180
180
  }
181
181
  };
182
182
  // 包装一层兼容 names 改变
@@ -215,6 +215,7 @@
215
215
  .@{ant-prefix}-form-item-label {
216
216
  > label {
217
217
  white-space: pre-wrap;
218
+ word-break: break-all;
218
219
  }
219
220
  }
220
221
 
@@ -1,2 +1,6 @@
1
1
  import { FormInstance } from 'antd';
2
- export declare const useForm: <T>(originForm: FormInstance<T>) => [FormInstance<T>];
2
+ type ModifiedFormInstance<T> = FormInstance<T> & {
3
+ isModified?: boolean;
4
+ };
5
+ export declare const useForm: <T>(originForm: ModifiedFormInstance<T>) => [ModifiedFormInstance<T>];
6
+ export {};
@@ -10,13 +10,16 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
  var _antd = require("antd");
12
12
  var _index = require("./index");
13
+ var _tools = require("../../ProEditTable/utils/tools");
13
14
  var useForm = exports.useForm = function useForm(originForm) {
14
15
  var _Form$useForm = _antd.Form.useForm(originForm),
15
16
  _Form$useForm2 = (0, _slicedToArray2.default)(_Form$useForm, 1),
16
17
  form = _Form$useForm2[0];
17
18
  var getFieldsValue = form.getFieldsValue,
18
19
  validateFields = form.validateFields,
19
- setFieldsValue = form.setFieldsValue;
20
+ setFieldsValue = form.setFieldsValue,
21
+ isModified = form.isModified;
22
+ if (isModified) return [form];
20
23
  // @ts-ignore
21
24
  var _getFieldsValue = function _getFieldsValue(nameList, filterFunc) {
22
25
  // 全部查询
@@ -44,7 +47,6 @@ var useForm = exports.useForm = function useForm(originForm) {
44
47
  _form$getInternalHook,
45
48
  getFields,
46
49
  fieldsList,
47
- _error$errorFields,
48
50
  _error$errorFields$,
49
51
  _args = arguments;
50
52
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
@@ -58,7 +60,7 @@ var useForm = exports.useForm = function useForm(originForm) {
58
60
  isRecursive = rest === null || rest === void 0 ? void 0 : (_rest$ = rest[0]) === null || _rest$ === void 0 ? void 0 : _rest$.recursive;
59
61
  validateNames = []; // 前缀校验模式
60
62
  if (!isRecursive) {
61
- _context.next = 10;
63
+ _context.next = 12;
62
64
  break;
63
65
  }
64
66
  // @ts-ignore
@@ -72,28 +74,35 @@ var useForm = exports.useForm = function useForm(originForm) {
72
74
  });
73
75
  // @ts-ignore
74
76
  delete rest[0].recursive;
75
- return _context.abrupt("return", validateFields.apply(void 0, [validateNames].concat(rest)).then(function (values) {
77
+ _context.next = 11;
78
+ return validateFields.apply(void 0, [validateNames].concat(rest)).then(function (values) {
76
79
  return (0, _index.filterInternalFields)(values);
77
- }));
78
- case 10:
79
- return _context.abrupt("return", validateFields.apply(void 0, [nameList].concat(rest)).then(function (values) {
80
+ });
81
+ case 11:
82
+ return _context.abrupt("return", _context.sent);
83
+ case 12:
84
+ _context.next = 14;
85
+ return validateFields.apply(void 0, [nameList].concat(rest)).then(function (values) {
80
86
  return nameList ? values : _getFieldsValue();
81
- }));
82
- case 13:
83
- _context.prev = 13;
87
+ });
88
+ case 14:
89
+ return _context.abrupt("return", _context.sent);
90
+ case 17:
91
+ _context.prev = 17;
84
92
  _context.t0 = _context["catch"](0);
85
- if (_context.t0 && (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.errorFields)) {
86
- form === null || form === void 0 ? void 0 : form.scrollToField(_context.t0 === null || _context.t0 === void 0 ? void 0 : (_error$errorFields = _context.t0.errorFields) === null || _error$errorFields === void 0 ? void 0 : (_error$errorFields$ = _error$errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name, {
93
+ if (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.errorFields) {
94
+ form.scrollToField((_error$errorFields$ = _context.t0.errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name, {
87
95
  block: 'center',
88
96
  behavior: 'smooth'
89
97
  });
90
98
  }
99
+ (0, _tools.handleScrollToError)();
91
100
  throw _context.t0;
92
- case 17:
101
+ case 22:
93
102
  case "end":
94
103
  return _context.stop();
95
104
  }
96
- }, _callee, null, [[0, 13]]);
105
+ }, _callee, null, [[0, 17]]);
97
106
  }));
98
107
  return function _validateFields(_x) {
99
108
  return _ref.apply(this, arguments);
@@ -101,6 +110,7 @@ var useForm = exports.useForm = function useForm(originForm) {
101
110
  }();
102
111
  form.getFieldsValue = _getFieldsValue;
103
112
  form.validateFields = _validateFields;
113
+ form.isModified = true;
104
114
  // form.setFieldsValue = _setFieldsValue;
105
115
  return [form];
106
116
  };
@@ -34,9 +34,6 @@ declare const _default: {
34
34
  type: any;
35
35
  valueType: any;
36
36
  }) => {
37
- normalize?: undefined;
38
- getValueProps?: undefined;
39
- } | {
40
37
  normalize: (value: any) => any;
41
38
  getValueProps: (value: any) => {
42
39
  value: any;
@@ -47,9 +44,6 @@ declare const _default: {
47
44
  type: any;
48
45
  valueType: any;
49
46
  }) => {
50
- normalize?: undefined;
51
- getValueProps?: undefined;
52
- } | {
53
47
  normalize: (value: any) => any;
54
48
  getValueProps: (value: any) => {
55
49
  value: any;
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
9
  var _big = _interopRequireDefault(require("big.js"));
10
+ var _lodash = require("lodash");
10
11
  var _utils = require("@zat-design/utils");
11
12
  var transformDate = _utils.transforms.transformDate,
12
13
  transformSwitch = _utils.transforms.transformSwitch;
@@ -20,8 +21,35 @@ var transformRatio = function transformRatio(_ref) {
20
21
  precision = _ref$precision === void 0 ? 2 : _ref$precision,
21
22
  valueType = _ref.valueType;
22
23
  if (type === 'ProNumberRange' && ['permillage', 'percentage'].includes(valueType)) {
23
- console.error('Warning: ProNumberRange valueType can only be set to [thousandth]');
24
- return {};
24
+ var ref = null;
25
+ return {
26
+ normalize: function normalize(value) {
27
+ if (!value || !value.some(function (item) {
28
+ return item;
29
+ })) {
30
+ return {};
31
+ }
32
+ return [(value[0] || value[0] === 0) && Number.isFinite(value[0] - 0) ? (0, _big.default)(value[0] - 0).div(Math.pow(10, precision)).toNumber() : null, (value[1] || value[1] === 0) && Number.isFinite(value[1] - 0) ? (0, _big.default)(value[1] - 0).div(Math.pow(10, precision)).toNumber() : null];
33
+ },
34
+ getValueProps: function getValueProps(value) {
35
+ if (!value || !value.some(function (item) {
36
+ return item;
37
+ })) {
38
+ return {
39
+ value: []
40
+ };
41
+ }
42
+ if ((0, _lodash.isEqual)(ref, value)) {
43
+ return {
44
+ value: [(value[0] || value[0] === 0) && Number.isFinite(value[0] - 0) ? (0, _big.default)(value[0] - 0).times(Math.pow(10, precision)).toNumber() : null, (value[1] || value[1] === 0) && Number.isFinite(value[1] - 0) ? (0, _big.default)(value[1] - 0).times(Math.pow(10, precision)).toNumber() : null]
45
+ };
46
+ }
47
+ ref = value;
48
+ return {
49
+ value: [(value[0] || value[0] === 0) && Number.isFinite(value[0] - 0) ? (0, _big.default)(value[0] - 0).times(Math.pow(10, precision)).toNumber() : null, (value[1] || value[1] === 0) && Number.isFinite(value[1] - 0) ? (0, _big.default)(value[1] - 0).times(Math.pow(10, precision)).toNumber() : null]
50
+ };
51
+ }
52
+ };
25
53
  }
26
54
  return {
27
55
  normalize: function normalize(value) {
@@ -24,8 +24,7 @@ var OpenMenu = function OpenMenu(props) {
24
24
  dataSource = props.dataSource,
25
25
  style = props.style,
26
26
  _props$theme = props.theme,
27
- theme = _props$theme === void 0 ? 'dark' : _props$theme,
28
- otherProps = props.otherProps;
27
+ theme = _props$theme === void 0 ? 'dark' : _props$theme;
29
28
  var _ref = dataSource || {},
30
29
  menus = _ref.menus,
31
30
  sideMenu = _ref.sideMenu;
@@ -31,7 +31,8 @@ var ProLayout = function ProLayout(props) {
31
31
  headerNotice = props.headerNotice,
32
32
  noticeIn = props.notice,
33
33
  dataSource = props.dataSource,
34
- theme = props.theme;
34
+ theme = props.theme,
35
+ onCollapsedChange = props.onCollapsedChange;
35
36
  var _useSetState = (0, _ahooks.useSetState)({
36
37
  notice: headerNotice || noticeIn,
37
38
  menus: [],
@@ -92,7 +93,10 @@ var ProLayout = function ProLayout(props) {
92
93
  dataSource: menus,
93
94
  notice: notice,
94
95
  collapsed: collapsed,
95
- onToggle: toggle
96
+ onToggle: function onToggle() {
97
+ toggle();
98
+ onCollapsedChange && onCollapsedChange(!collapsed);
99
+ }
96
100
  })), (0, _jsxRuntime.jsx)("div", {
97
101
  className: "pro-layout-content",
98
102
  style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, contentStyle), {}, {
@@ -51,6 +51,10 @@ export interface ProLayoutProps {
51
51
  contentStyle?: CSSProperties;
52
52
  waterMarkProps?: ProWaterMarkProps;
53
53
  theme?: themeEnum;
54
+ /**
55
+ * 折叠回调事件
56
+ */
57
+ onCollapsedChange?: (collapsed: any) => void;
54
58
  [key: string]: any;
55
59
  }
56
60
  export interface ProLayoutStates {
@@ -28,7 +28,8 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
28
28
  var _ref = (0, _ProConfigProvider.useProConfig)('ProSelect') || {},
29
29
  _ref$fieldNames = _ref.fieldNames,
30
30
  proSelectFieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames,
31
- showCodeName = _ref.showCodeName;
31
+ showCodeName = _ref.showCodeName,
32
+ gViewportReady = _ref.viewportReady;
32
33
  var label = 'label';
33
34
  var code = 'value';
34
35
  if (proSelectFieldNames && Object.keys(proSelectFieldNames).length) {
@@ -55,16 +56,16 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
55
56
  updateDataSource = props.updateDataSource,
56
57
  transformResponse = props.transformResponse,
57
58
  isViewPro = props.isView,
58
- _props$viewportReady = props.viewportReady,
59
- viewportReady = _props$viewportReady === void 0 ? false : _props$viewportReady,
59
+ __viewportReady = props.viewportReady,
60
60
  selectProps = (0, _objectWithoutProperties2.default)(props, _excluded);
61
+ var viewportReady = __viewportReady || gViewportReady;
61
62
  /** 是否在可视区域出现过 */
62
63
  var _useState = (0, _react.useState)(false),
63
64
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
64
65
  viewFlag = _useState2[0],
65
66
  setViewFlag = _useState2[1];
66
- var refSelect = (0, _react.useRef)();
67
- var _useInViewport = (0, _ahooks.useInViewport)(refSelect),
67
+ var refSelect1 = (0, _react.useRef)();
68
+ var _useInViewport = (0, _ahooks.useInViewport)(refSelect1),
68
69
  _useInViewport2 = (0, _slicedToArray2.default)(_useInViewport, 1),
69
70
  inViewport = _useInViewport2[0];
70
71
  selectProps.showCodeName = (_selectProps$showCode = selectProps.showCodeName) !== null && _selectProps$showCode !== void 0 ? _selectProps$showCode : showCodeName;
@@ -300,45 +301,53 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
300
301
  fieldNames: fieldNames
301
302
  });
302
303
  }
303
- return (0, _jsxRuntime.jsx)(_antd.Select, (0, _objectSpread2.default)((0, _objectSpread2.default)({
304
- placeholder: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProSelect = _locale.default.ProSelect) === null || _locale$ProSelect === void 0 ? void 0 : _locale$ProSelect.select,
305
- allowClear: true,
306
- showArrow: true,
307
- loading: fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.loading,
308
- onChange: handleChange,
309
- optionLabelProp: "children" // 解决warning报错,添加默认值
310
- ,
311
- showSearch: true,
312
- filterOption: (0, _lodash.isFunction)(_onSearch) ? false : function (input, option) {
313
- var _option$children, _option$children$prop;
314
- var value = (0, _lodash.isString)(option === null || option === void 0 ? void 0 : option.children) ? option === null || option === void 0 ? void 0 : option.children : option === null || option === void 0 ? void 0 : (_option$children = option.children) === null || _option$children === void 0 ? void 0 : (_option$children$prop = _option$children.props) === null || _option$children$prop === void 0 ? void 0 : _option$children$prop.title;
315
- return value.toLowerCase().includes(input.toLowerCase());
316
- },
317
- onSearch: function onSearch(value) {
318
- _onSearch && _onSearch(value, (0, _objectSpread2.default)({}, fetchFunction));
319
- },
320
- getPopupContainer: function getPopupContainer(trigger) {
321
- return scrollFollowParent ? trigger.parentElement : document.body;
322
- }
323
- }, (0, _lodash.omit)((0, _lodash.cloneDeep)(selectProps), ['isView', 'showCodeName', 'form', 'name'])), {}, {
324
- value: transformValue(),
325
- children: Array.isArray(newSelectList) && newSelectList.map(function (item) {
326
- return (0, _jsxRuntime.jsx)(Option, {
327
- value: item[code],
328
- record: item,
329
- disabled: !!item.disabled,
330
- children: (0, _jsxRuntime.jsx)(TooltipOption, {
331
- title: OptionRender ? OptionRender(item) : selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label],
332
- children: OptionRender ? (0, _jsxRuntime.jsx)("span", {
333
- title: OptionRender(item),
334
- children: OptionRender(item)
335
- }) : (0, _jsxRuntime.jsx)("span", {
336
- title: "".concat(item[code], "-").concat(item[label]),
337
- children: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label]
338
- })
339
- }, item[code])
340
- }, item[code]);
341
- })
342
- }));
304
+ return (0, _jsxRuntime.jsx)("div", {
305
+ ref: refSelect1,
306
+ style: props.style,
307
+ className: "ant-select-compact-item-div",
308
+ children: (0, _jsxRuntime.jsx)(_antd.Select
309
+ // id={refSelect1.current}
310
+ , (0, _objectSpread2.default)((0, _objectSpread2.default)({
311
+ // id={refSelect1.current}
312
+ placeholder: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProSelect = _locale.default.ProSelect) === null || _locale$ProSelect === void 0 ? void 0 : _locale$ProSelect.select,
313
+ allowClear: true,
314
+ showArrow: true,
315
+ loading: fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.loading,
316
+ onChange: handleChange,
317
+ optionLabelProp: "children" // 解决warning报错,添加默认值
318
+ ,
319
+ showSearch: true,
320
+ filterOption: (0, _lodash.isFunction)(_onSearch) ? false : function (input, option) {
321
+ var _option$children, _option$children$prop;
322
+ var value = (0, _lodash.isString)(option === null || option === void 0 ? void 0 : option.children) ? option === null || option === void 0 ? void 0 : option.children : option === null || option === void 0 ? void 0 : (_option$children = option.children) === null || _option$children === void 0 ? void 0 : (_option$children$prop = _option$children.props) === null || _option$children$prop === void 0 ? void 0 : _option$children$prop.title;
323
+ return value.toLowerCase().includes(input.toLowerCase());
324
+ },
325
+ onSearch: function onSearch(value) {
326
+ _onSearch && _onSearch(value, (0, _objectSpread2.default)({}, fetchFunction));
327
+ },
328
+ getPopupContainer: function getPopupContainer(trigger) {
329
+ return scrollFollowParent ? trigger.parentElement : document.body;
330
+ }
331
+ }, (0, _lodash.omit)((0, _lodash.cloneDeep)(selectProps), ['isView', 'showCodeName', 'form', 'name', 'style'])), {}, {
332
+ value: transformValue(),
333
+ children: Array.isArray(newSelectList) && newSelectList.map(function (item) {
334
+ return (0, _jsxRuntime.jsx)(Option, {
335
+ value: item[code],
336
+ record: item,
337
+ disabled: !!item.disabled,
338
+ children: (0, _jsxRuntime.jsx)(TooltipOption, {
339
+ title: OptionRender ? OptionRender(item) : selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label],
340
+ children: OptionRender ? (0, _jsxRuntime.jsx)("span", {
341
+ title: OptionRender(item),
342
+ children: OptionRender(item)
343
+ }) : (0, _jsxRuntime.jsx)("span", {
344
+ title: "".concat(item[code], "-").concat(item[label]),
345
+ children: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label]
346
+ })
347
+ }, item[code])
348
+ }, item[code]);
349
+ })
350
+ }))
351
+ });
343
352
  };
344
353
  var _default = exports.default = /*#__PURE__*/(0, _react.forwardRef)(ProSelect);
@@ -9,3 +9,9 @@
9
9
  text-overflow: ellipsis;
10
10
  word-break: keep-all;
11
11
  }
12
+ .ant-select-compact-item-div {
13
+ width: 100%;
14
+ >.ant-select {
15
+ width: 100%;
16
+ }
17
+ }