@zat-design/sisyphus-react 3.5.5 → 3.6.0

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 (59) hide show
  1. package/dist/index.esm.css +3 -0
  2. package/dist/less.esm.css +3 -0
  3. package/es/ProEditTable/components/RenderField/index.js +9 -7
  4. package/es/ProEditTable/index.js +35 -20
  5. package/es/ProEditTable/propsType.d.ts +8 -1
  6. package/es/ProEditTable/style/index.less +1 -0
  7. package/es/ProEditTable/utils/index.js +1 -0
  8. package/es/ProEnum/propsType.d.ts +1 -1
  9. package/es/ProForm/components/base/DatePicker/index.js +7 -10
  10. package/es/ProForm/components/base/RangePicker/index.js +22 -12
  11. package/es/ProForm/components/combination/ProCascader/index.js +3 -2
  12. package/es/ProForm/components/combination/ProCascader/propsType.d.ts +2 -0
  13. package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -0
  14. package/es/ProForm/components/combination/ProRangeLimit/index.js +32 -3
  15. package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +6 -2
  16. package/es/ProForm/components/combination/ProTimeLimit/index.js +34 -4
  17. package/es/ProForm/components/render/ConfirmWrapper.js +1 -0
  18. package/es/ProForm/components/render/Render.js +26 -6
  19. package/es/ProForm/components/render/propsType.d.ts +2 -0
  20. package/es/ProForm/utils/useShouldUpdate.js +6 -13
  21. package/es/ProForm/utils/valueType.js +3 -3
  22. package/es/assets/catalog.svg +1 -1
  23. package/es/assets/disabled.svg +1 -1
  24. package/es/assets/drag.svg +1 -1
  25. package/es/assets/fold.svg +1 -1
  26. package/es/assets/input-search.svg +1 -1
  27. package/es/assets/reset.svg +1 -1
  28. package/es/assets/view.svg +1 -1
  29. package/es/locale/en_US.js +1 -1
  30. package/es/locale/zh_CN.js +1 -1
  31. package/lib/ProEditTable/components/RenderField/index.js +9 -7
  32. package/lib/ProEditTable/index.js +31 -18
  33. package/lib/ProEditTable/propsType.d.ts +8 -1
  34. package/lib/ProEditTable/style/index.less +1 -0
  35. package/lib/ProEditTable/utils/index.js +1 -0
  36. package/lib/ProEnum/propsType.d.ts +1 -1
  37. package/lib/ProForm/components/base/DatePicker/index.js +7 -10
  38. package/lib/ProForm/components/base/RangePicker/index.js +21 -11
  39. package/lib/ProForm/components/combination/ProCascader/index.js +3 -2
  40. package/lib/ProForm/components/combination/ProCascader/propsType.d.ts +2 -0
  41. package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -0
  42. package/lib/ProForm/components/combination/ProRangeLimit/index.js +31 -2
  43. package/lib/ProForm/components/combination/ProTimeLimit/index.d.ts +6 -2
  44. package/lib/ProForm/components/combination/ProTimeLimit/index.js +33 -3
  45. package/lib/ProForm/components/render/ConfirmWrapper.js +1 -0
  46. package/lib/ProForm/components/render/Render.js +25 -5
  47. package/lib/ProForm/components/render/propsType.d.ts +2 -0
  48. package/lib/ProForm/utils/useShouldUpdate.js +5 -12
  49. package/lib/ProForm/utils/valueType.js +3 -3
  50. package/lib/assets/catalog.svg +1 -1
  51. package/lib/assets/disabled.svg +1 -1
  52. package/lib/assets/drag.svg +1 -1
  53. package/lib/assets/fold.svg +1 -1
  54. package/lib/assets/input-search.svg +1 -1
  55. package/lib/assets/reset.svg +1 -1
  56. package/lib/assets/view.svg +1 -1
  57. package/lib/locale/en_US.js +1 -1
  58. package/lib/locale/zh_CN.js +1 -1
  59. package/package.json +2 -2
@@ -4481,6 +4481,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
4481
4481
  position: absolute;
4482
4482
  bottom: var(--zaui-space-size-md, 16px);
4483
4483
  }
4484
+ .pro-edit-table-toolbar {
4485
+ background-color: #fff;
4486
+ }
4484
4487
  .pro-edit-table-toolbar .ant-space {
4485
4488
  gap: var(--zaui-space-size-sm, 8px);
4486
4489
  }
package/dist/less.esm.css CHANGED
@@ -4481,6 +4481,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
4481
4481
  position: absolute;
4482
4482
  bottom: var(--zaui-space-size-md, 16px);
4483
4483
  }
4484
+ .pro-edit-table-toolbar {
4485
+ background-color: #fff;
4486
+ }
4484
4487
  .pro-edit-table-toolbar .ant-space {
4485
4488
  gap: var(--zaui-space-size-sm, 8px);
4486
4489
  }
@@ -11,7 +11,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
11
11
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
12
12
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
13
13
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
14
- var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className", "trim"];
14
+ var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className", "trim", "confirm"];
15
15
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
16
  /* eslint-disable prefer-destructuring */
17
17
  /* eslint-disable prefer-const */
@@ -29,8 +29,9 @@ import { FieldProvider } from '../../../ProForm/utils/useFieldProps';
29
29
  import { useListChanged } from '../../../ProForm/utils/useListChanged';
30
30
  import useRules from '../../../ProForm/utils/useRules';
31
31
  import { isSelect, isTrim } from '../../../ProForm/utils';
32
+ import ConfirmWrapper from '../../../ProForm/components/render/ConfirmWrapper';
32
33
  var RenderField = function RenderField(_ref) {
33
- var _type, _type$replace, _fieldProps2, _names, _TargetComponent4, _componentProps;
34
+ var _type, _type$replace, _fieldProps2, _names, _TargetComponent4, _componentProps, _componentProps2;
34
35
  var value = _ref.text,
35
36
  record = _ref.record,
36
37
  index = _ref.index,
@@ -58,12 +59,10 @@ var RenderField = function RenderField(_ref) {
58
59
  equalWith = column.equalWith,
59
60
  className = column.className,
60
61
  trim = column.trim,
62
+ confirm = column.confirm,
61
63
  resetProps = _objectWithoutProperties(column, _excluded);
62
64
  // editRender弃用使用component同ProForm
63
65
  var _editRender = component || editRender;
64
- if (type && _editRender) {
65
- console.warn('type和component为互斥关系, type将不会生效');
66
- }
67
66
  var mode = config.mode,
68
67
  cellName = config.cellName,
69
68
  cellNamePath = config.cellNamePath,
@@ -498,6 +497,7 @@ var RenderField = function RenderField(_ref) {
498
497
  onChange: _onChange,
499
498
  onBlur: _onblur,
500
499
  index: index,
500
+ confirm: confirm,
501
501
  otherProps: {
502
502
  form: form,
503
503
  names: names,
@@ -540,7 +540,9 @@ var RenderField = function RenderField(_ref) {
540
540
  }, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
541
541
  className: _className,
542
542
  name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName,
543
- children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
543
+ children: ((_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.confirm) ? _jsx(ConfirmWrapper, _objectSpread(_objectSpread({}, componentProps), {}, {
544
+ children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
545
+ })) : /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
544
546
  })) : _jsx(Container, {
545
547
  viewEmpty: viewEmpty
546
548
  });
@@ -570,7 +572,7 @@ var RenderField = function RenderField(_ref) {
570
572
  }))]
571
573
  }) : null;
572
574
  return _jsx(FieldProvider, {
573
- value: (_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.otherProps,
575
+ value: (_componentProps2 = componentProps) === null || _componentProps2 === void 0 ? void 0 : _componentProps2.otherProps,
574
576
  children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
575
577
  title: originalTitle,
576
578
  placement: "topLeft",
@@ -1,3 +1,5 @@
1
+ import "antd/es/affix/style";
2
+ import _Affix from "antd/es/affix";
1
3
  import "antd/es/table/style";
2
4
  import _Table from "antd/es/table";
3
5
  import _typeof from "@babel/runtime/helpers/esm/typeof";
@@ -9,11 +11,11 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
9
11
  import "antd/es/form/style";
10
12
  import _Form from "antd/es/form";
11
13
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
12
- var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection"];
14
+ var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "toolbarSticky", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll", "actionDirection"];
13
15
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
14
16
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
15
- import { get, isArray } from 'lodash';
16
- import { useLocalStorageState, useSetState } from 'ahooks';
17
+ import { get, isArray, isBoolean } from 'lodash';
18
+ import { useDeepCompareEffect, useLocalStorageState, useSetState } from 'ahooks';
17
19
  import classnames from 'classnames';
18
20
  import { transformColumns } from './utils';
19
21
  import { getRandom, getNamePath } from './utils/tools';
@@ -38,6 +40,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
38
40
  actionWidth = _ref.actionWidth,
39
41
  actionProps = _ref.actionProps,
40
42
  toolbarProps = _ref.toolbarProps,
43
+ toolbarSticky = _ref.toolbarSticky,
41
44
  rowSelection = _ref.rowSelection,
42
45
  onlyOneLineMsg = _ref.onlyOneLineMsg,
43
46
  deletePoConfirmMsg = _ref.deletePoConfirmMsg,
@@ -59,6 +62,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
59
62
  // 上下文form
60
63
  var contentForm = _Form.useFormInstance();
61
64
  var formFieldProps = ProForm.useFieldProps() || {};
65
+ var affixRef = useRef(null);
62
66
  var form = contentForm || (formFieldProps === null || formFieldProps === void 0 ? void 0 : formFieldProps.form) || (resetProps === null || resetProps === void 0 ? void 0 : resetProps.form);
63
67
  var name = (formFieldProps === null || formFieldProps === void 0 ? void 0 : formFieldProps.name) || (resetProps === null || resetProps === void 0 ? void 0 : resetProps.name) || (resetProps === null || resetProps === void 0 ? void 0 : (_resetProps$id = resetProps.id) === null || _resetProps$id === void 0 ? void 0 : (_resetProps$id$split = _resetProps$id.split) === null || _resetProps$id$split === void 0 ? void 0 : _resetProps$id$split.call(_resetProps$id, '_'));
64
68
  var _formFieldProps$isVie = formFieldProps.isView,
@@ -72,6 +76,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
72
76
  disabled = (formFieldProps === null || formFieldProps === void 0 ? void 0 : formFieldProps.disabled) || disabled; // formFieldProps?.disabled可能是函数??
73
77
  }
74
78
  var tableRef = useRef(null);
79
+ var valueChangeRef = useRef(null);
80
+ valueChangeRef.current = 0;
75
81
  var _React$useContext = React.useContext(_ConfigProvider.ConfigContext),
76
82
  getPrefixCls = _React$useContext.getPrefixCls;
77
83
  var prefixCls = getPrefixCls();
@@ -262,24 +268,13 @@ var ProEditTable = function ProEditTable(_ref, ref) {
262
268
  }
263
269
  return null;
264
270
  };
271
+ useDeepCompareEffect(function () {
272
+ valueChangeRef.current += 1;
273
+ // 在这里根据需要计算新的数组
274
+ }, [value, config.name]);
265
275
  var _columns = useMemo(function () {
266
276
  return transformColumns(columns, config);
267
- }, [value, cellNamePath, forceUpdate, editingKeys, disabled, actionProps, columns, page, config.name]);
268
- // const setColumns = async () => {
269
- // const nextColumns = transformColumns(columns, config);
270
- // setState({
271
- // _columns: nextColumns,
272
- // });
273
- // };
274
- // useDebounceEffect(
275
- // () => {
276
- // setColumns();
277
- // },
278
- // [value, cellNamePath, forceUpdate, editingKeys, disabled, actionProps, columns, page], // columns更新修复外部表单无法控制内部表单的问题
279
- // {
280
- // wait: 60,
281
- // },
282
- // );
277
+ }, [valueChangeRef.current, disabled, forceUpdate, columns, page, actionProps, editingKeys, cellNamePath]);
283
278
  useEffect(function () {
284
279
  var isAllHasKey = value.every(function (item) {
285
280
  return item.rowKey;
@@ -310,6 +305,19 @@ var ProEditTable = function ProEditTable(_ref, ref) {
310
305
  setInternalState: setState
311
306
  };
312
307
  });
308
+ useEffect(function () {
309
+ if (toolbarSticky) {
310
+ var updatePos = function updatePos() {
311
+ var _affixRef$current;
312
+ affixRef === null || affixRef === void 0 ? void 0 : (_affixRef$current = affixRef.current) === null || _affixRef$current === void 0 ? void 0 : _affixRef$current.updatePosition();
313
+ };
314
+ window.addEventListener('scroll', updatePos, true);
315
+ return function () {
316
+ window.removeEventListener('scroll', updatePos, true);
317
+ };
318
+ }
319
+ }, [toolbarSticky]);
320
+ var _toolbarSticky = isBoolean(toolbarSticky) ? {} : toolbarSticky;
313
321
  var _summary = _typeof(summary) === 'object' ? function (data) {
314
322
  return _jsx(Summary, {
315
323
  data: data,
@@ -372,7 +380,14 @@ var ProEditTable = function ProEditTable(_ref, ref) {
372
380
  },
373
381
  summary: _summary
374
382
  }))]
375
- }), !isView && (value === null || value === void 0 ? void 0 : value.length) ? _jsx("div", {
383
+ }), !isView && (value === null || value === void 0 ? void 0 : value.length) ? toolbarSticky ? _jsx(_Affix, _objectSpread(_objectSpread({
384
+ ref: affixRef
385
+ }, _toolbarSticky), {}, {
386
+ children: _jsx("div", {
387
+ className: "pro-edit-table-toolbar".concat(pagination ? ' pro-edit-table-toolbar-fixed' : ''),
388
+ children: _jsx(RenderToolbar, _objectSpread({}, config))
389
+ })
390
+ })) : _jsx("div", {
376
391
  className: "pro-edit-table-toolbar".concat(pagination ? ' pro-edit-table-toolbar-fixed' : ''),
377
392
  children: _jsx(RenderToolbar, _objectSpread({}, config))
378
393
  }) : null, footerRender ? _jsx("div", {
@@ -1,3 +1,4 @@
1
+ import { AffixProps, ModalFuncProps } from 'antd';
1
2
  import { Key, ReactNode } from 'react';
2
3
  import { DragEndEvent } from '@dnd-kit/core';
3
4
  import type { ButtonProps } from 'antd/es/button';
@@ -5,7 +6,7 @@ import type { TooltipProps } from 'antd/es/tooltip';
5
6
  import type { NamePath } from 'antd/es/form/interface';
6
7
  import type { ColumnType, TableProps } from 'antd/es/table';
7
8
  import type { FormInstance, FormItemProps } from 'antd/es/form';
8
- import type { ProRule } from '../ProForm/propsType';
9
+ import type { FunctionArgs, ProRule } from '../ProForm/propsType';
9
10
  import { ProFormValueType, ColumnPropsMap } from '../ProForm/components/render/propsType';
10
11
  export type ActionType = 'edit' | 'delete' | 'save' | 'cancel' | 'add' | 'mulDelete' | 'custom';
11
12
  export type ShowFunction<T> = (record?: T, options?: {
@@ -98,6 +99,7 @@ export interface ProColumnsProps<Values = any, T = any> extends Omit<FormItemPro
98
99
  viewRender?: string | number | ReactNode | viewRenderFn<T>;
99
100
  hiddenNames?: NamePath[] | NamePath[][];
100
101
  rules?: ProRule[] | RulesFn<T>;
102
+ confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps | void>;
101
103
  [key: string]: any;
102
104
  }
103
105
  export type ProEditTableColumnsProps<K = any> = ProColumnsProps & ColumnPropsMap<K, 'ProEditTable'>;
@@ -229,6 +231,11 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
229
231
  * @default -
230
232
  */
231
233
  toolbarProps?: BaseActionProps<T>[] | boolean;
234
+ /**
235
+ * @description 自定义底部操作栏跟随页面滚动
236
+ * @default -
237
+ */
238
+ toolbarSticky?: boolean | Omit<AffixProps, 'children'>;
232
239
  /**
233
240
  * @description 最大可添加数量
234
241
  * @default -
@@ -303,6 +303,7 @@
303
303
  }
304
304
 
305
305
  .pro-edit-table-toolbar {
306
+ background-color: #fff;
306
307
  .@{ant-prefix}-space {
307
308
  gap: var(--zaui-space-size-sm, 8px);
308
309
 
@@ -256,6 +256,7 @@ export var transformColumns = function transformColumns() {
256
256
  var columnName = (item === null || item === void 0 ? void 0 : item.name) || dataIndex || key;
257
257
  item.dataIndex = columnName;
258
258
  item.key = columnName;
259
+ // item.shouldCellUpdate = item.shouldCellUpdate || ((record, perRecord) => !isEqual(record, perRecord));
259
260
  var required = isBoolean(item.required) ? item.required : false;
260
261
  if (typeof item.required === 'function') {
261
262
  var namePath = getNamePath(name, virtualKey);
@@ -49,7 +49,7 @@ export interface ProEnum {
49
49
  /** 用于自定义组件 */
50
50
  component?: ReactNode;
51
51
  /** 用于提交 code */
52
- code: string | string[];
52
+ code?: string | string[];
53
53
  /** 字段别名 */
54
54
  fieldNames?: Record<string, string>;
55
55
  /** 是否查看模式 */
@@ -64,20 +64,17 @@ var DatePicker = function DatePicker(props) {
64
64
  format: 'HH:mm:ss'
65
65
  };
66
66
  // dateTime模式下默认开启time选择
67
- var _rest = _objectSpread(_objectSpread({}, rest), {}, {
68
- showTime: rest.showTime === undefined && valueType === 'dateTime' || rest.showTime
69
- });
67
+ var _rest = _objectSpread({}, rest);
68
+ // showTime默认值受valueType属性影响
69
+ if (rest.showTime === undefined) {
70
+ if (valueType === 'dateTime') {
71
+ _rest.showTime = true;
72
+ }
73
+ }
70
74
  // 字符串时间格式兼容
71
75
  if (isString(_rest.value)) {
72
76
  _rest.value = moment(_rest.value);
73
77
  }
74
- if (['dateStartTime', 'dateEndTime'].includes(valueType) && rest.showTime === undefined) {
75
- _rest.showTime = {
76
- value: moment(valueType === 'dateStartTime' ? '00:00:00' : '23:59:59', 'HH:mm:ss'),
77
- disabled: true,
78
- _defaultShowTime: _defaultShowTime
79
- };
80
- }
81
78
  if (_rest.showTime === true) {
82
79
  _rest.showTime = _objectSpread({}, _defaultShowTime);
83
80
  }
@@ -15,7 +15,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
15
15
  */
16
16
  // @ts-check
17
17
 
18
- import { isFunction, isString, omit, uniq } from 'lodash';
18
+ import { isFunction, isObject, isString, omit, uniq } from 'lodash';
19
19
  import moment from 'moment';
20
20
  import { useProConfig } from '../../../../ProConfigProvider';
21
21
  import ProForm from '../../../../ProForm';
@@ -41,12 +41,19 @@ var RangePicker = function RangePicker(props) {
41
41
  disabledDate: rest.disabledDate
42
42
  });
43
43
  var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon;
44
- var _res = _objectSpread(_objectSpread({}, rest), {}, {
45
- showTime: !rest.showTime && valueType === 'dateTime' || rest.showTime
46
- });
44
+ var _rest = _objectSpread({}, rest);
45
+ // showTime默认值受valueType属性影响
46
+ if (rest.showTime === undefined) {
47
+ if (valueType === 'dateTime') {
48
+ _rest.showTime = true;
49
+ }
50
+ if (valueType === 'dateStartEndTime') {
51
+ _rest.showTime = false;
52
+ }
53
+ }
47
54
  // 字符串时间格式兼容
48
- if (Array.isArray(_res.value) && isString(_res.value[0]) && isString(_res.value[1])) {
49
- _res.value = [moment(_res.value[0]), moment(_res.value[1])];
55
+ if (Array.isArray(_rest.value) && isString(_rest.value[0]) && isString(_rest.value[1])) {
56
+ _rest.value = [moment(_rest.value[0]), moment(_rest.value[1])];
50
57
  }
51
58
  var _viewFormat = Array.isArray(format) ? format[0] : format;
52
59
  var tempFormat = Array.isArray(format) ? format : [format];
@@ -57,11 +64,11 @@ var RangePicker = function RangePicker(props) {
57
64
  return !!formatKey;
58
65
  });
59
66
  var _defaultShowTime = {
60
- format: 'YYYY-MM-DD HH:mm:ss'
67
+ format: 'HH:mm:ss'
61
68
  };
62
69
  if (isView) {
63
- var _res$value = _res.value,
64
- value = _res$value === void 0 ? [] : _res$value;
70
+ var _rest$value = _rest.value,
71
+ value = _rest$value === void 0 ? [] : _rest$value;
65
72
  var viewChildren = null;
66
73
  if (!value || !value[0] || !value[1]) {
67
74
  viewChildren = null;
@@ -83,10 +90,13 @@ var RangePicker = function RangePicker(props) {
83
90
  children: viewChildren
84
91
  });
85
92
  }
86
- if (_res.showTime === true) {
87
- _res.showTime = _objectSpread({}, _defaultShowTime);
93
+ if (_rest.showTime === true) {
94
+ _rest.showTime = _objectSpread({}, _defaultShowTime);
95
+ }
96
+ if (isObject(_rest.showTime)) {
97
+ _rest.showTime = Object.assign(_defaultShowTime, _rest.showTime);
88
98
  }
89
- return _jsx(AntRangePicker, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, initialConfig), omit(_res, ['separator'])), rangeRegulator), {}, {
99
+ return _jsx(AntRangePicker, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, initialConfig), omit(_rest, ['separator'])), rangeRegulator), {}, {
90
100
  format: _format
91
101
  }));
92
102
  };
@@ -13,7 +13,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
13
13
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
14
14
  import "antd/es/typography/style";
15
15
  import _Typography from "antd/es/typography";
16
- var _excluded = ["className", "hasDetail", "detailMaxLength", "fieldNames", "value", "disabled", "dataSource", "onChange", "useRequest", "transformResponse", "level", "isView", "enumCode", "code", "tooltip", "separator"];
16
+ var _excluded = ["className", "hasDetail", "detailMaxLength", "fieldNames", "value", "disabled", "dataSource", "onChange", "useRequest", "transformResponse", "level", "isView", "enumCode", "code", "tooltip", "separator", "detailPlaceholder"];
17
17
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
18
  import { useEffect, useState, memo, useMemo } from 'react';
19
19
  import { omit } from 'lodash';
@@ -79,6 +79,7 @@ var ProCascader = function ProCascader(props) {
79
79
  tooltip = props.tooltip,
80
80
  _props$separator = props.separator,
81
81
  separator = _props$separator === void 0 ? '' : _props$separator,
82
+ detailPlaceholder = props.detailPlaceholder,
82
83
  otherProps = _objectWithoutProperties(props, _excluded);
83
84
  var _ref3 = ProForm.useFieldProps() || {},
84
85
  isViewCon = _ref3.isView;
@@ -247,7 +248,7 @@ var ProCascader = function ProCascader(props) {
247
248
  disabled: disabled,
248
249
  value: detail,
249
250
  maxLength: detailMaxLength,
250
- placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProAddressBar2 = locale.ProAddressBar) === null || _locale$ProAddressBar2 === void 0 ? void 0 : _locale$ProAddressBar2.detailPlaceholder,
251
+ placeholder: detailPlaceholder || (locale === null || locale === void 0 ? void 0 : (_locale$ProAddressBar2 = locale.ProAddressBar) === null || _locale$ProAddressBar2 === void 0 ? void 0 : _locale$ProAddressBar2.detailPlaceholder),
251
252
  onChange: handleAddressChange
252
253
  }))]
253
254
  });
@@ -32,4 +32,6 @@ export interface ProCascaderProps {
32
32
  otherProps?: any;
33
33
  /** 查看分隔符 */
34
34
  separator?: string;
35
+ /** 详情框占位符 */
36
+ detailPlaceholder?: string;
35
37
  }
@@ -11,6 +11,8 @@ export type Props = Omit<RangePickerProps, 'value' | 'onChange' | 'format' | 'se
11
11
  format?: string;
12
12
  separator?: any;
13
13
  isView?: boolean;
14
+ showTime?: any;
15
+ valueType?: any;
14
16
  };
15
17
  type Value = [Moment?, Moment?, boolean?] | null;
16
18
  type ValueStr = [string?, string?, string?] | null;
@@ -2,6 +2,7 @@ import "antd/es/checkbox/style";
2
2
  import _Checkbox from "antd/es/checkbox";
3
3
  import "antd/es/input/style";
4
4
  import _Input from "antd/es/input";
5
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
5
6
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
6
7
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
8
  import "antd/es/date-picker/style";
@@ -10,7 +11,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
10
11
  var _excluded = ["disabled", "foreverText", "foreverDate", "format", "otherProps", "separator"];
11
12
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
12
13
  import { useMemo, useState } from 'react';
13
- import { omit } from 'lodash';
14
+ import { omit, isFunction, uniq, isObject } from 'lodash';
14
15
  import classNames from 'classnames';
15
16
  import moment from 'moment';
16
17
  import { useProConfig } from '../../../../ProConfigProvider';
@@ -79,6 +80,28 @@ var ProRangeLimit = function ProRangeLimit(props) {
79
80
  'forever-checkbox': true
80
81
  });
81
82
  var _foreverDate = foreverDate || (initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig.foreverDate);
83
+ var _rest = _objectSpread({}, rest);
84
+ // showTime默认值受valueType属性影响
85
+ if (rest.showTime === undefined) {
86
+ var valueType = props.valueType;
87
+ if (valueType === 'dateTime') {
88
+ _rest.showTime = true;
89
+ }
90
+ if (valueType === 'dateStartEndTime') {
91
+ _rest.showTime = false;
92
+ }
93
+ }
94
+ var _viewFormat = Array.isArray(format) ? format[0] : format;
95
+ var tempFormat = Array.isArray(format) ? format : [format];
96
+ if (isFunction(format)) {
97
+ tempFormat = [];
98
+ }
99
+ var _format = uniq([].concat(_toConsumableArray(tempFormat), ['YYYY-MM-DD', 'YYYYMMDD', 'YYYY/MM/DD', 'YYYY_MM_DD', 'YYYY.MM.DD'])).filter(function (formatKey) {
100
+ return !!formatKey;
101
+ });
102
+ var _defaultShowTime = {
103
+ format: 'HH:mm:ss'
104
+ };
82
105
  var _isForever = useMemo(function () {
83
106
  return moment(_foreverDate, format).isSame(endDate);
84
107
  }, [value]);
@@ -134,6 +157,12 @@ var ProRangeLimit = function ProRangeLimit(props) {
134
157
  onChange([start, null]);
135
158
  }
136
159
  };
160
+ if (_rest.showTime === true) {
161
+ _rest.showTime = _objectSpread({}, _defaultShowTime);
162
+ }
163
+ if (isObject(_rest.showTime)) {
164
+ _rest.showTime = Object.assign(_defaultShowTime, _rest.showTime);
165
+ }
137
166
  return _jsxs(_Input.Group, {
138
167
  compact: true,
139
168
  className: "pro-range-limit",
@@ -141,8 +170,8 @@ var ProRangeLimit = function ProRangeLimit(props) {
141
170
  allowClear: true,
142
171
  disabled: [_disabled === null || _disabled === void 0 ? void 0 : _disabled[0], (_disabled === null || _disabled === void 0 ? void 0 : _disabled[1]) || _isForever],
143
172
  defaultPickerValue: defaultPickerValue
144
- }, initialConfig), omit(rest, ['placeholder', 'separator'])), {}, {
145
- format: format,
173
+ }, initialConfig), omit(_rest, ['placeholder', 'separator'])), {}, {
174
+ format: _format,
146
175
  value: value,
147
176
  onChange: handleRangeChange
148
177
  })), _jsx("div", {
@@ -1,4 +1,5 @@
1
- import { DatePickerProps } from 'antd';
1
+ import { DatePickerProps, TimePickerProps } from 'antd';
2
+ import { PickerPanelDateProps } from 'antd/lib/calendar/generateCalendar';
2
3
  import { Moment } from 'moment';
3
4
  import React from 'react';
4
5
  import { ProFormOtherProps } from '../../../propsType';
@@ -13,10 +14,13 @@ export type ProTimeLimitProps = DistributiveOmit<DatePickerProps, 'value' | 'onC
13
14
  foreverText?: string;
14
15
  viewEmpty?: React.ReactNode;
15
16
  format?: string;
16
- valueType?: 'moment' | 'format' | 'ISO';
17
+ valueType?: 'moment' | 'format' | 'ISO' | 'dateTime' | 'dateStartEndTime';
17
18
  otherProps?: ProFormOtherProps;
18
19
  mode?: 'DatePicker';
19
20
  isView?: boolean;
21
+ } & TimePickerProps & {
22
+ showTime?: PickerPanelDateProps<Moment>['showTime'];
23
+ showNow?: boolean;
20
24
  };
21
25
  export declare const ProTimeLimit: React.FC<ProTimeLimitProps>;
22
26
  export type ProLimitProps = ProTimeLimitProps | (ProRangeLimitProps & {
@@ -4,14 +4,15 @@ import "antd/es/date-picker/style";
4
4
  import _DatePicker from "antd/es/date-picker";
5
5
  import "antd/es/input/style";
6
6
  import _Input from "antd/es/input";
7
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
8
7
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
8
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
9
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
9
10
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
10
11
  var _excluded = ["format", "disabled", "foreverDate", "foreverText", "valueType", "otherProps"],
11
12
  _excluded2 = ["mode"];
12
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
14
  import classNames from 'classnames';
14
- import { omit, isObject } from 'lodash';
15
+ import { omit, isObject, uniq, isFunction } from 'lodash';
15
16
  import moment from 'moment';
16
17
  import { useMemo } from 'react';
17
18
  import { useProConfig } from '../../../../ProConfigProvider';
@@ -39,6 +40,28 @@ export var ProTimeLimit = function ProTimeLimit(props) {
39
40
  var initialConfig = useProConfig('ProTimeLimit');
40
41
  var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
41
42
  var _foreverDate = foreverDate || (initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig.foreverDate);
43
+ var _viewFormat = Array.isArray(format) ? format[0] : format;
44
+ var tempFormat = Array.isArray(format) ? format : [format];
45
+ if (isFunction(format)) {
46
+ tempFormat = [];
47
+ }
48
+ var _format = uniq([].concat(_toConsumableArray(tempFormat), ['YYYY-MM-DD', 'YYYYMMDD', 'YYYY/MM/DD', 'YYYY_MM_DD', 'YYYY.MM.DD'])).filter(function (formatKey) {
49
+ return !!formatKey;
50
+ });
51
+ // dateTime模式下默认开启time选择
52
+ var _rest = _objectSpread({}, rest);
53
+ // showTime默认值受valueType属性影响
54
+ if (rest.showTime === undefined) {
55
+ if (valueType === 'dateTime') {
56
+ _rest.showTime = true;
57
+ }
58
+ if (valueType === 'dateStartEndTime') {
59
+ _rest.showTime = false;
60
+ }
61
+ }
62
+ var _defaultShowTime = {
63
+ format: 'HH:mm:ss'
64
+ };
42
65
  var _useMemo = useMemo(function () {
43
66
  var foreverMoment = moment(_foreverDate, format);
44
67
  var foreverString = _foreverDate || foreverMoment.format(format);
@@ -78,7 +101,7 @@ export var ProTimeLimit = function ProTimeLimit(props) {
78
101
  if (isObject(value)) {
79
102
  return _jsx(Container, {
80
103
  viewEmpty: viewEmpty,
81
- children: value.format(format)
104
+ children: value.format(_viewFormat)
82
105
  });
83
106
  }
84
107
  return _jsx(Container, {
@@ -86,6 +109,12 @@ export var ProTimeLimit = function ProTimeLimit(props) {
86
109
  children: props.value
87
110
  });
88
111
  }
112
+ if (_rest.showTime === true) {
113
+ _rest.showTime = _objectSpread({}, _defaultShowTime);
114
+ }
115
+ if (isObject(_rest.showTime)) {
116
+ _rest.showTime = Object.assign(_defaultShowTime, _rest.showTime);
117
+ }
89
118
  var className = classNames({
90
119
  'ant-input': true,
91
120
  'ant-input-disabled': disabled,
@@ -96,7 +125,8 @@ export var ProTimeLimit = function ProTimeLimit(props) {
96
125
  className: "pro-time-limit",
97
126
  children: [_jsx(_DatePicker, _objectSpread(_objectSpread(_objectSpread({
98
127
  disabled: disabled || isForever
99
- }, initialConfig), omit(rest, ['placeholder'])), {}, {
128
+ }, initialConfig), omit(_rest, ['placeholder'])), {}, {
129
+ format: _format,
100
130
  value: value,
101
131
  onChange: onChange
102
132
  })), _jsx("div", {
@@ -45,6 +45,7 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
45
45
  option: other[0],
46
46
  form: form,
47
47
  namePath: otherProps.namePath,
48
+ name: otherProps.name,
48
49
  index: otherProps.index
49
50
  });
50
51
  case 5:
@@ -22,7 +22,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
22
22
  import React, { useMemo } from 'react';
23
23
  import classNames from 'classnames';
24
24
  import { ReactSVG } from 'react-svg';
25
- import { isFunction, isString, omit, set } from 'lodash';
25
+ import { isFunction, isString, omit, set, debounce } from 'lodash';
26
26
  import useShouldUpdate from '../../utils/useShouldUpdate';
27
27
  import { isTrim, isUpperCase, findOptionByValue, parseNamePath } from '../../utils/index';
28
28
  import { useProConfig } from '../../../ProConfigProvider';
@@ -241,7 +241,7 @@ var Render = function Render(props) {
241
241
  /**
242
242
  * onChange参数重置 (value, record, { form, index, namePath, option }) => void
243
243
  */
244
- var handleChange = function handleChange() {
244
+ var defaultHandleChange = function defaultHandleChange() {
245
245
  var _otherFormItemProps$n3, _lastComponentProps$c2;
246
246
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
247
247
  args[_key] = arguments[_key];
@@ -282,21 +282,41 @@ var Render = function Render(props) {
282
282
  }
283
283
  (_lastComponentProps$c2 = lastComponentProps[changeKey]) === null || _lastComponentProps$c2 === void 0 ? void 0 : _lastComponentProps$c2.call.apply(_lastComponentProps$c2, [lastComponentProps].concat(_toConsumableArray(_args)));
284
284
  };
285
+ var debouncedHandleChange = debounce(defaultHandleChange, lastComponentProps === null || lastComponentProps === void 0 ? void 0 : lastComponentProps.debounceWait);
286
+ var handleChange = function handleChange() {
287
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
288
+ args[_key2] = arguments[_key2];
289
+ }
290
+ var _args = [].concat(args);
291
+ if (lastComponentProps === null || lastComponentProps === void 0 ? void 0 : lastComponentProps.debounceWait) {
292
+ // 为了兼容 Input 和 TextArea 的 onChange 事件,需要将 event 对象转换为 value
293
+ if (['Input', 'TextArea'].includes(type)) {
294
+ _args[0] = {
295
+ target: {
296
+ value: _args[0].target.value
297
+ }
298
+ };
299
+ }
300
+ debouncedHandleChange.apply(void 0, _toConsumableArray(_args));
301
+ } else {
302
+ defaultHandleChange.apply(void 0, _toConsumableArray(_args));
303
+ }
304
+ };
285
305
  /**
286
306
  * onBlur参数重置 (value, record, { form, index, namePath, option }) => void
287
307
  */
288
308
  var handleBlur = /*#__PURE__*/function () {
289
309
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
290
- var _len2,
310
+ var _len3,
291
311
  args,
292
- _key2,
312
+ _key3,
293
313
  _args,
294
314
  _args3 = arguments;
295
315
  return _regeneratorRuntime().wrap(function _callee$(_context) {
296
316
  while (1) switch (_context.prev = _context.next) {
297
317
  case 0:
298
- for (_len2 = _args3.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
299
- args[_key2] = _args3[_key2];
318
+ for (_len3 = _args3.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
319
+ args[_key3] = _args3[_key3];
300
320
  }
301
321
  _args = functionArgs([].concat(args));
302
322
  _context.t0 = lastComponentProps === null || lastComponentProps === void 0 ? void 0 : lastComponentProps.onBlur;