@zat-design/sisyphus-react 3.5.5-beta.1 → 3.5.5-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.css +3 -0
- package/dist/less.esm.css +3 -0
- package/es/ProEditTable/components/RenderField/index.js +9 -7
- package/es/ProEditTable/index.js +27 -3
- package/es/ProEditTable/propsType.d.ts +8 -1
- package/es/ProEditTable/style/index.less +1 -0
- package/es/ProForm/components/base/DatePicker/index.js +7 -10
- package/es/ProForm/components/base/RangePicker/index.js +22 -12
- package/es/ProForm/components/combination/ProCascader/index.js +3 -2
- package/es/ProForm/components/combination/ProCascader/propsType.d.ts +2 -0
- package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -0
- package/es/ProForm/components/combination/ProRangeLimit/index.js +32 -3
- package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +6 -2
- package/es/ProForm/components/combination/ProTimeLimit/index.js +34 -4
- package/es/ProForm/components/render/ConfirmWrapper.js +1 -0
- package/es/ProForm/components/render/Render.js +26 -6
- package/es/ProForm/components/render/propsType.d.ts +2 -0
- package/es/ProForm/utils/valueType.js +3 -3
- package/es/assets/catalog.svg +1 -1
- package/es/assets/disabled.svg +1 -1
- package/es/assets/drag.svg +1 -1
- package/es/assets/fold.svg +1 -1
- package/es/assets/input-search.svg +1 -1
- package/es/assets/reset.svg +1 -1
- package/es/assets/view.svg +1 -1
- package/es/locale/en_US.js +1 -1
- package/es/locale/zh_CN.js +1 -1
- package/lib/ProEditTable/components/RenderField/index.js +9 -7
- package/lib/ProEditTable/index.js +24 -2
- package/lib/ProEditTable/propsType.d.ts +8 -1
- package/lib/ProEditTable/style/index.less +1 -0
- package/lib/ProForm/components/base/DatePicker/index.js +7 -10
- package/lib/ProForm/components/base/RangePicker/index.js +21 -11
- package/lib/ProForm/components/combination/ProCascader/index.js +3 -2
- package/lib/ProForm/components/combination/ProCascader/propsType.d.ts +2 -0
- package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -0
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +31 -2
- package/lib/ProForm/components/combination/ProTimeLimit/index.d.ts +6 -2
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +33 -3
- package/lib/ProForm/components/render/ConfirmWrapper.js +1 -0
- package/lib/ProForm/components/render/Render.js +25 -5
- package/lib/ProForm/components/render/propsType.d.ts +2 -0
- package/lib/ProForm/utils/valueType.js +3 -3
- package/lib/assets/catalog.svg +1 -1
- package/lib/assets/disabled.svg +1 -1
- package/lib/assets/drag.svg +1 -1
- package/lib/assets/fold.svg +1 -1
- package/lib/assets/input-search.svg +1 -1
- package/lib/assets/reset.svg +1 -1
- package/lib/assets/view.svg +1 -1
- package/lib/locale/en_US.js +1 -1
- package/lib/locale/zh_CN.js +1 -1
- package/package.json +2 -2
package/dist/index.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
|
}
|
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:
|
|
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: (
|
|
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",
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -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,10 +11,10 @@ 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';
|
|
17
|
+
import { get, isArray, isBoolean } from 'lodash';
|
|
16
18
|
import { useLocalStorageState, useSetState } from 'ahooks';
|
|
17
19
|
import classnames from 'classnames';
|
|
18
20
|
import { transformColumns } from './utils';
|
|
@@ -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,
|
|
@@ -310,6 +314,19 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
310
314
|
setInternalState: setState
|
|
311
315
|
};
|
|
312
316
|
});
|
|
317
|
+
useEffect(function () {
|
|
318
|
+
if (toolbarSticky) {
|
|
319
|
+
var updatePos = function updatePos() {
|
|
320
|
+
var _affixRef$current;
|
|
321
|
+
affixRef === null || affixRef === void 0 ? void 0 : (_affixRef$current = affixRef.current) === null || _affixRef$current === void 0 ? void 0 : _affixRef$current.updatePosition();
|
|
322
|
+
};
|
|
323
|
+
window.addEventListener('scroll', updatePos, true);
|
|
324
|
+
return function () {
|
|
325
|
+
window.removeEventListener('scroll', updatePos, true);
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
}, [toolbarSticky]);
|
|
329
|
+
var _toolbarSticky = isBoolean(toolbarSticky) ? {} : toolbarSticky;
|
|
313
330
|
var _summary = _typeof(summary) === 'object' ? function (data) {
|
|
314
331
|
return _jsx(Summary, {
|
|
315
332
|
data: data,
|
|
@@ -372,7 +389,14 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
372
389
|
},
|
|
373
390
|
summary: _summary
|
|
374
391
|
}))]
|
|
375
|
-
}), !isView && (value === null || value === void 0 ? void 0 : value.length) ? _jsx(
|
|
392
|
+
}), !isView && (value === null || value === void 0 ? void 0 : value.length) ? toolbarSticky ? _jsx(_Affix, _objectSpread(_objectSpread({
|
|
393
|
+
ref: affixRef
|
|
394
|
+
}, _toolbarSticky), {}, {
|
|
395
|
+
children: _jsx("div", {
|
|
396
|
+
className: "pro-edit-table-toolbar".concat(pagination ? ' pro-edit-table-toolbar-fixed' : ''),
|
|
397
|
+
children: _jsx(RenderToolbar, _objectSpread({}, config))
|
|
398
|
+
})
|
|
399
|
+
})) : _jsx("div", {
|
|
376
400
|
className: "pro-edit-table-toolbar".concat(pagination ? ' pro-edit-table-toolbar-fixed' : ''),
|
|
377
401
|
children: _jsx(RenderToolbar, _objectSpread({}, config))
|
|
378
402
|
}) : 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 -
|
|
@@ -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(
|
|
68
|
-
|
|
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
|
|
45
|
-
|
|
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(
|
|
49
|
-
|
|
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: '
|
|
67
|
+
format: 'HH:mm:ss'
|
|
61
68
|
};
|
|
62
69
|
if (isView) {
|
|
63
|
-
var
|
|
64
|
-
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 (
|
|
87
|
-
|
|
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(
|
|
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
|
});
|
|
@@ -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(
|
|
145
|
-
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(
|
|
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(
|
|
128
|
+
}, initialConfig), omit(_rest, ['placeholder'])), {}, {
|
|
129
|
+
format: _format,
|
|
100
130
|
value: value,
|
|
101
131
|
onChange: onChange
|
|
102
132
|
})), _jsx("div", {
|
|
@@ -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
|
|
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
|
|
310
|
+
var _len3,
|
|
291
311
|
args,
|
|
292
|
-
|
|
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 (
|
|
299
|
-
args[
|
|
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;
|
|
@@ -219,6 +219,8 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
|
|
|
219
219
|
/** 是否固定字段, 不隐藏 */
|
|
220
220
|
fixed?: boolean;
|
|
221
221
|
confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps | void>;
|
|
222
|
+
/** 防抖模式 */
|
|
223
|
+
debounceWait?: number;
|
|
222
224
|
}
|
|
223
225
|
export type ProColumnProps<T = any> = ProFormColumnProps<T> & ColumnPropsMap<T, 'ProForm'>;
|
|
224
226
|
/**
|
|
@@ -133,7 +133,7 @@ var dateTransform = function dateTransform(_ref2) {
|
|
|
133
133
|
if (_valueType === 'dateStartTime') {
|
|
134
134
|
result = transformDate({
|
|
135
135
|
type: 'DatePicker',
|
|
136
|
-
format: 'YYYY-MM-DD
|
|
136
|
+
format: 'YYYY-MM-DD',
|
|
137
137
|
valueType: newValueType,
|
|
138
138
|
timeType: 'startTime'
|
|
139
139
|
});
|
|
@@ -141,7 +141,7 @@ var dateTransform = function dateTransform(_ref2) {
|
|
|
141
141
|
if (_valueType === 'dateEndTime') {
|
|
142
142
|
result = transformDate({
|
|
143
143
|
type: 'DatePicker',
|
|
144
|
-
format: 'YYYY-MM-DD
|
|
144
|
+
format: 'YYYY-MM-DD',
|
|
145
145
|
valueType: newValueType,
|
|
146
146
|
timeType: 'endTime'
|
|
147
147
|
});
|
|
@@ -165,7 +165,7 @@ var dateTransform = function dateTransform(_ref2) {
|
|
|
165
165
|
if (_valueType === 'dateStartEndTime') {
|
|
166
166
|
result = transformDate({
|
|
167
167
|
type: 'RangePicker',
|
|
168
|
-
format: 'YYYY-MM-DD
|
|
168
|
+
format: 'YYYY-MM-DD',
|
|
169
169
|
valueType: newValueType,
|
|
170
170
|
timeType: 'startEndTime'
|
|
171
171
|
});
|
package/es/assets/catalog.svg
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<title>编组 52@1x</title>
|
|
3
|
+
<!-- <title>编组 52@1x</title> -->
|
|
4
4
|
<defs>
|
|
5
5
|
<rect id="path-1" x="0" y="4" width="24" height="18" rx="2"></rect>
|
|
6
6
|
<filter x="-14.6%" y="-13.9%" width="129.2%" height="138.9%" filterUnits="objectBoundingBox" id="filter-2">
|
package/es/assets/disabled.svg
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<title>编组 33</title>
|
|
3
|
+
<!-- <title>编组 33</title> -->
|
|
4
4
|
<g id="--11.表格-Table" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
5
|
<g id="自定义列" transform="translate(-1204.000000, -219.000000)">
|
|
6
6
|
<g id="编组-31" transform="translate(712.000000, 60.000000)">
|