@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.
- 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 +35 -20
- package/es/ProEditTable/propsType.d.ts +8 -1
- package/es/ProEditTable/style/index.less +1 -0
- package/es/ProEditTable/utils/index.js +1 -0
- package/es/ProEnum/propsType.d.ts +1 -1
- 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/useShouldUpdate.js +6 -13
- 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 +31 -18
- package/lib/ProEditTable/propsType.d.ts +8 -1
- package/lib/ProEditTable/style/index.less +1 -0
- package/lib/ProEditTable/utils/index.js +1 -0
- package/lib/ProEnum/propsType.d.ts +1 -1
- 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/useShouldUpdate.js +5 -12
- 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
|
@@ -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
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import { useRef, useState } from 'react';
|
|
3
|
-
import { isFunction, isEqualWith } from 'lodash';
|
|
3
|
+
import { isFunction, isEqualWith, isEqual } from 'lodash';
|
|
4
4
|
import { customEqualForFun, equalDependencies } from './index';
|
|
5
5
|
// 代理shouldUpdate事件, 执行函数值的[show, disabled], 当[show, disabled]与上一次值不相同时更新状态
|
|
6
6
|
var useShouldUpdate = function useShouldUpdate(props) {
|
|
@@ -148,11 +148,9 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
148
148
|
index: index,
|
|
149
149
|
namePath: namePath
|
|
150
150
|
}) : rules;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
namePath: namePath
|
|
155
|
-
}) : newComponent;
|
|
151
|
+
// const _component = isFunction(originComponent)
|
|
152
|
+
// ? originComponent(_currentValues, { form, index, namePath })
|
|
153
|
+
// : newComponent;
|
|
156
154
|
var _fieldProps = isFunction(fieldProps) ? fieldProps(_currentValues, {
|
|
157
155
|
form: form,
|
|
158
156
|
index: index,
|
|
@@ -174,14 +172,9 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
|
174
172
|
clearTimeout(timerRef.current);
|
|
175
173
|
}
|
|
176
174
|
}
|
|
177
|
-
// // 当校验规则改变的时候 重新执行校验 导致: 第一次进页面直接触发校验
|
|
178
|
-
// if (
|
|
179
|
-
// _required !== requiredRef.current ||
|
|
180
|
-
// !isEqualWith(rulesRef.current, _rules, customEqualForFun)
|
|
181
|
-
// ) {
|
|
182
|
-
// form.validateFields([name]);
|
|
183
|
-
// }
|
|
184
175
|
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !isEqualWith(rulesRef.current, _rules, customEqualForFun) || !isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) ||
|
|
176
|
+
// 值变更,需要同步更新函数式的fieldProps
|
|
177
|
+
isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun) && !isEqual(prevValues, currentValues) ||
|
|
185
178
|
// !isEqualWith(originComponentRef.current, _component, customEqualForFun) ||
|
|
186
179
|
equalDependencies(dependencies, prevValues, _currentValues)) {
|
|
187
180
|
showRef.current = _show;
|
|
@@ -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)">
|
package/es/assets/drag.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>编组 34</title>
|
|
3
|
+
<!-- <title>编组 34</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, -259.000000)">
|
|
6
6
|
<g id="编组-31" transform="translate(712.000000, 60.000000)">
|
package/es/assets/fold.svg
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<svg width="16px" height="15px" viewBox="0 0 16 15" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<title>编组 2</title>
|
|
3
|
+
<!-- <title>编组 2</title> -->
|
|
4
4
|
<defs>
|
|
5
5
|
<linearGradient x1="100%" y1="50%" x2="0%" y2="50%" id="linearGradient-1">
|
|
6
6
|
<stop stop-color="#ADDDFF" stop-opacity="0" offset="0%"></stop>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<title>Combined Shape</title>
|
|
3
|
+
<!-- <title>Combined Shape</title> -->
|
|
4
4
|
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
5
|
<g id="业务归属机构选择-多选说明" transform="translate(-284.000000, -941.000000)" fill="#909090">
|
|
6
6
|
<g id="Search备份-7" transform="translate(276.000000, 931.000000)">
|
package/es/assets/reset.svg
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<svg width="13px" height="15px" viewBox="0 0 13 15" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<title>形状</title>
|
|
3
|
+
<!-- <title>形状</title> -->
|
|
4
4
|
<g id="控件" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
5
|
<g id="数据展示/表格/可选择/多选-批量操作" transform="translate(-1040.000000, -24.072313)" fill="#0A0A0A" fill-rule="nonzero">
|
|
6
6
|
<g id="Group-6备份-4" transform="translate(1022.000000, 16.000000)">
|
package/es/assets/view.svg
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<svg width="19px" height="15px" viewBox="0 0 19 15" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<title>icon-dropdown-searchlist</title>
|
|
3
|
+
<!-- <title>icon-dropdown-searchlist</title> -->
|
|
4
4
|
<g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
5
|
<g id="询报价录入交互说明" transform="translate(-531, -308)" fill="currentColor" fill-rule="nonzero">
|
|
6
6
|
<g id="Dropdown/下拉弹窗切换/default备份-2" transform="translate(215, 299)">
|
package/es/locale/en_US.js
CHANGED
package/es/locale/zh_CN.js
CHANGED
|
@@ -29,11 +29,12 @@ var _useFieldProps = require("../../../ProForm/utils/useFieldProps");
|
|
|
29
29
|
var _useListChanged3 = require("../../../ProForm/utils/useListChanged");
|
|
30
30
|
var _useRules = _interopRequireDefault(require("../../../ProForm/utils/useRules"));
|
|
31
31
|
var _utils = require("../../../ProForm/utils");
|
|
32
|
-
var
|
|
32
|
+
var _ConfirmWrapper = _interopRequireDefault(require("../../../ProForm/components/render/ConfirmWrapper"));
|
|
33
|
+
var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className", "trim", "confirm"];
|
|
33
34
|
/* eslint-disable prefer-destructuring */
|
|
34
35
|
/* eslint-disable prefer-const */
|
|
35
36
|
var RenderField = function RenderField(_ref) {
|
|
36
|
-
var _type, _type$replace, _fieldProps2, _names, _TargetComponent4, _componentProps;
|
|
37
|
+
var _type, _type$replace, _fieldProps2, _names, _TargetComponent4, _componentProps, _componentProps2;
|
|
37
38
|
var value = _ref.text,
|
|
38
39
|
record = _ref.record,
|
|
39
40
|
index = _ref.index,
|
|
@@ -61,12 +62,10 @@ var RenderField = function RenderField(_ref) {
|
|
|
61
62
|
equalWith = column.equalWith,
|
|
62
63
|
className = column.className,
|
|
63
64
|
trim = column.trim,
|
|
65
|
+
confirm = column.confirm,
|
|
64
66
|
resetProps = (0, _objectWithoutProperties2.default)(column, _excluded);
|
|
65
67
|
// editRender弃用使用component同ProForm
|
|
66
68
|
var _editRender = component || editRender;
|
|
67
|
-
if (type && _editRender) {
|
|
68
|
-
console.warn('type和component为互斥关系, type将不会生效');
|
|
69
|
-
}
|
|
70
69
|
var mode = config.mode,
|
|
71
70
|
cellName = config.cellName,
|
|
72
71
|
cellNamePath = config.cellNamePath,
|
|
@@ -501,6 +500,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
501
500
|
onChange: _onChange,
|
|
502
501
|
onBlur: _onblur,
|
|
503
502
|
index: index,
|
|
503
|
+
confirm: confirm,
|
|
504
504
|
otherProps: {
|
|
505
505
|
form: form,
|
|
506
506
|
names: names,
|
|
@@ -543,7 +543,9 @@ var RenderField = function RenderField(_ref) {
|
|
|
543
543
|
}, (0, _lodash.omit)(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
544
544
|
className: _className,
|
|
545
545
|
name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName,
|
|
546
|
-
children:
|
|
546
|
+
children: ((_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.confirm) ? (0, _jsxRuntime.jsx)(_ConfirmWrapper.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, componentProps), {}, {
|
|
547
|
+
children: /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, componentProps)) : (0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)({}, componentProps))
|
|
548
|
+
})) : /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, componentProps)) : (0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)({}, componentProps))
|
|
547
549
|
})) : (0, _jsxRuntime.jsx)(_Container.default, {
|
|
548
550
|
viewEmpty: viewEmpty
|
|
549
551
|
});
|
|
@@ -573,7 +575,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
573
575
|
}))]
|
|
574
576
|
}) : null;
|
|
575
577
|
return (0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
|
|
576
|
-
value: (
|
|
578
|
+
value: (_componentProps2 = componentProps) === null || _componentProps2 === void 0 ? void 0 : _componentProps2.otherProps,
|
|
577
579
|
children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
578
580
|
title: originalTitle,
|
|
579
581
|
placement: "topLeft",
|
|
@@ -23,7 +23,7 @@ var _components = require("./components");
|
|
|
23
23
|
var _ProForm = _interopRequireDefault(require("../ProForm"));
|
|
24
24
|
var _empty = _interopRequireDefault(require("../assets/empty.png"));
|
|
25
25
|
var _locale = _interopRequireWildcard(require("../locale"));
|
|
26
|
-
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"];
|
|
26
|
+
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"];
|
|
27
27
|
var ProEditTable = function ProEditTable(_ref, ref) {
|
|
28
28
|
var _resetProps$id, _resetProps$id$split, _themeConfig$data2, _value$;
|
|
29
29
|
var value = _ref.value,
|
|
@@ -41,6 +41,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
41
41
|
actionWidth = _ref.actionWidth,
|
|
42
42
|
actionProps = _ref.actionProps,
|
|
43
43
|
toolbarProps = _ref.toolbarProps,
|
|
44
|
+
toolbarSticky = _ref.toolbarSticky,
|
|
44
45
|
rowSelection = _ref.rowSelection,
|
|
45
46
|
onlyOneLineMsg = _ref.onlyOneLineMsg,
|
|
46
47
|
deletePoConfirmMsg = _ref.deletePoConfirmMsg,
|
|
@@ -62,6 +63,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
62
63
|
// 上下文form
|
|
63
64
|
var contentForm = _antd.Form.useFormInstance();
|
|
64
65
|
var formFieldProps = _ProForm.default.useFieldProps() || {};
|
|
66
|
+
var affixRef = (0, _react.useRef)(null);
|
|
65
67
|
var form = contentForm || (formFieldProps === null || formFieldProps === void 0 ? void 0 : formFieldProps.form) || (resetProps === null || resetProps === void 0 ? void 0 : resetProps.form);
|
|
66
68
|
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, '_'));
|
|
67
69
|
var _formFieldProps$isVie = formFieldProps.isView,
|
|
@@ -75,6 +77,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
75
77
|
disabled = (formFieldProps === null || formFieldProps === void 0 ? void 0 : formFieldProps.disabled) || disabled; // formFieldProps?.disabled可能是函数??
|
|
76
78
|
}
|
|
77
79
|
var tableRef = (0, _react.useRef)(null);
|
|
80
|
+
var valueChangeRef = (0, _react.useRef)(null);
|
|
81
|
+
valueChangeRef.current = 0;
|
|
78
82
|
var _React$useContext = _react.default.useContext(_antd.ConfigProvider.ConfigContext),
|
|
79
83
|
getPrefixCls = _React$useContext.getPrefixCls;
|
|
80
84
|
var prefixCls = getPrefixCls();
|
|
@@ -265,24 +269,13 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
265
269
|
}
|
|
266
270
|
return null;
|
|
267
271
|
};
|
|
272
|
+
(0, _ahooks.useDeepCompareEffect)(function () {
|
|
273
|
+
valueChangeRef.current += 1;
|
|
274
|
+
// 在这里根据需要计算新的数组
|
|
275
|
+
}, [value, config.name]);
|
|
268
276
|
var _columns = (0, _react.useMemo)(function () {
|
|
269
277
|
return (0, _utils.transformColumns)(columns, config);
|
|
270
|
-
}, [
|
|
271
|
-
// const setColumns = async () => {
|
|
272
|
-
// const nextColumns = transformColumns(columns, config);
|
|
273
|
-
// setState({
|
|
274
|
-
// _columns: nextColumns,
|
|
275
|
-
// });
|
|
276
|
-
// };
|
|
277
|
-
// useDebounceEffect(
|
|
278
|
-
// () => {
|
|
279
|
-
// setColumns();
|
|
280
|
-
// },
|
|
281
|
-
// [value, cellNamePath, forceUpdate, editingKeys, disabled, actionProps, columns, page], // columns更新修复外部表单无法控制内部表单的问题
|
|
282
|
-
// {
|
|
283
|
-
// wait: 60,
|
|
284
|
-
// },
|
|
285
|
-
// );
|
|
278
|
+
}, [valueChangeRef.current, disabled, forceUpdate, columns, page, actionProps, editingKeys, cellNamePath]);
|
|
286
279
|
(0, _react.useEffect)(function () {
|
|
287
280
|
var isAllHasKey = value.every(function (item) {
|
|
288
281
|
return item.rowKey;
|
|
@@ -313,6 +306,19 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
313
306
|
setInternalState: setState
|
|
314
307
|
};
|
|
315
308
|
});
|
|
309
|
+
(0, _react.useEffect)(function () {
|
|
310
|
+
if (toolbarSticky) {
|
|
311
|
+
var updatePos = function updatePos() {
|
|
312
|
+
var _affixRef$current;
|
|
313
|
+
affixRef === null || affixRef === void 0 ? void 0 : (_affixRef$current = affixRef.current) === null || _affixRef$current === void 0 ? void 0 : _affixRef$current.updatePosition();
|
|
314
|
+
};
|
|
315
|
+
window.addEventListener('scroll', updatePos, true);
|
|
316
|
+
return function () {
|
|
317
|
+
window.removeEventListener('scroll', updatePos, true);
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
}, [toolbarSticky]);
|
|
321
|
+
var _toolbarSticky = (0, _lodash.isBoolean)(toolbarSticky) ? {} : toolbarSticky;
|
|
316
322
|
var _summary = (0, _typeof2.default)(summary) === 'object' ? function (data) {
|
|
317
323
|
return (0, _jsxRuntime.jsx)(_components.Summary, {
|
|
318
324
|
data: data,
|
|
@@ -375,7 +381,14 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
375
381
|
},
|
|
376
382
|
summary: _summary
|
|
377
383
|
}))]
|
|
378
|
-
}), !isView && (value === null || value === void 0 ? void 0 : value.length) ? (0, _jsxRuntime.jsx)(
|
|
384
|
+
}), !isView && (value === null || value === void 0 ? void 0 : value.length) ? toolbarSticky ? (0, _jsxRuntime.jsx)(_antd.Affix, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
385
|
+
ref: affixRef
|
|
386
|
+
}, _toolbarSticky), {}, {
|
|
387
|
+
children: (0, _jsxRuntime.jsx)("div", {
|
|
388
|
+
className: "pro-edit-table-toolbar".concat(pagination ? ' pro-edit-table-toolbar-fixed' : ''),
|
|
389
|
+
children: (0, _jsxRuntime.jsx)(_components.RenderToolbar, (0, _objectSpread2.default)({}, config))
|
|
390
|
+
})
|
|
391
|
+
})) : (0, _jsxRuntime.jsx)("div", {
|
|
379
392
|
className: "pro-edit-table-toolbar".concat(pagination ? ' pro-edit-table-toolbar-fixed' : ''),
|
|
380
393
|
children: (0, _jsxRuntime.jsx)(_components.RenderToolbar, (0, _objectSpread2.default)({}, config))
|
|
381
394
|
}) : null, footerRender ? (0, _jsxRuntime.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 -
|
|
@@ -260,6 +260,7 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
260
260
|
var columnName = (item === null || item === void 0 ? void 0 : item.name) || dataIndex || key;
|
|
261
261
|
item.dataIndex = columnName;
|
|
262
262
|
item.key = columnName;
|
|
263
|
+
// item.shouldCellUpdate = item.shouldCellUpdate || ((record, perRecord) => !isEqual(record, perRecord));
|
|
263
264
|
var required = (0, _lodash.isBoolean)(item.required) ? item.required : false;
|
|
264
265
|
if (typeof item.required === 'function') {
|
|
265
266
|
var namePath = (0, _tools.getNamePath)(name, virtualKey);
|
|
@@ -69,20 +69,17 @@ var DatePicker = function DatePicker(props) {
|
|
|
69
69
|
format: 'HH:mm:ss'
|
|
70
70
|
};
|
|
71
71
|
// dateTime模式下默认开启time选择
|
|
72
|
-
var _rest = (0, _objectSpread2.default)(
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
var _rest = (0, _objectSpread2.default)({}, rest);
|
|
73
|
+
// showTime默认值受valueType属性影响
|
|
74
|
+
if (rest.showTime === undefined) {
|
|
75
|
+
if (valueType === 'dateTime') {
|
|
76
|
+
_rest.showTime = true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
75
79
|
// 字符串时间格式兼容
|
|
76
80
|
if ((0, _lodash.isString)(_rest.value)) {
|
|
77
81
|
_rest.value = (0, _moment.default)(_rest.value);
|
|
78
82
|
}
|
|
79
|
-
if (['dateStartTime', 'dateEndTime'].includes(valueType) && rest.showTime === undefined) {
|
|
80
|
-
_rest.showTime = {
|
|
81
|
-
value: (0, _moment.default)(valueType === 'dateStartTime' ? '00:00:00' : '23:59:59', 'HH:mm:ss'),
|
|
82
|
-
disabled: true,
|
|
83
|
-
_defaultShowTime: _defaultShowTime
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
83
|
if (_rest.showTime === true) {
|
|
87
84
|
_rest.showTime = (0, _objectSpread2.default)({}, _defaultShowTime);
|
|
88
85
|
}
|
|
@@ -46,12 +46,19 @@ var RangePicker = function RangePicker(props) {
|
|
|
46
46
|
disabledDate: rest.disabledDate
|
|
47
47
|
});
|
|
48
48
|
var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon;
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
var _rest = (0, _objectSpread2.default)({}, rest);
|
|
50
|
+
// showTime默认值受valueType属性影响
|
|
51
|
+
if (rest.showTime === undefined) {
|
|
52
|
+
if (valueType === 'dateTime') {
|
|
53
|
+
_rest.showTime = true;
|
|
54
|
+
}
|
|
55
|
+
if (valueType === 'dateStartEndTime') {
|
|
56
|
+
_rest.showTime = false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
52
59
|
// 字符串时间格式兼容
|
|
53
|
-
if (Array.isArray(
|
|
54
|
-
|
|
60
|
+
if (Array.isArray(_rest.value) && (0, _lodash.isString)(_rest.value[0]) && (0, _lodash.isString)(_rest.value[1])) {
|
|
61
|
+
_rest.value = [(0, _moment.default)(_rest.value[0]), (0, _moment.default)(_rest.value[1])];
|
|
55
62
|
}
|
|
56
63
|
var _viewFormat = Array.isArray(format) ? format[0] : format;
|
|
57
64
|
var tempFormat = Array.isArray(format) ? format : [format];
|
|
@@ -62,11 +69,11 @@ var RangePicker = function RangePicker(props) {
|
|
|
62
69
|
return !!formatKey;
|
|
63
70
|
});
|
|
64
71
|
var _defaultShowTime = {
|
|
65
|
-
format: '
|
|
72
|
+
format: 'HH:mm:ss'
|
|
66
73
|
};
|
|
67
74
|
if (isView) {
|
|
68
|
-
var
|
|
69
|
-
value =
|
|
75
|
+
var _rest$value = _rest.value,
|
|
76
|
+
value = _rest$value === void 0 ? [] : _rest$value;
|
|
70
77
|
var viewChildren = null;
|
|
71
78
|
if (!value || !value[0] || !value[1]) {
|
|
72
79
|
viewChildren = null;
|
|
@@ -88,10 +95,13 @@ var RangePicker = function RangePicker(props) {
|
|
|
88
95
|
children: viewChildren
|
|
89
96
|
});
|
|
90
97
|
}
|
|
91
|
-
if (
|
|
92
|
-
|
|
98
|
+
if (_rest.showTime === true) {
|
|
99
|
+
_rest.showTime = (0, _objectSpread2.default)({}, _defaultShowTime);
|
|
100
|
+
}
|
|
101
|
+
if ((0, _lodash.isObject)(_rest.showTime)) {
|
|
102
|
+
_rest.showTime = Object.assign(_defaultShowTime, _rest.showTime);
|
|
93
103
|
}
|
|
94
|
-
return (0, _jsxRuntime.jsx)(AntRangePicker, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, initialConfig), (0, _lodash.omit)(
|
|
104
|
+
return (0, _jsxRuntime.jsx)(AntRangePicker, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, initialConfig), (0, _lodash.omit)(_rest, ['separator'])), rangeRegulator), {}, {
|
|
95
105
|
format: _format
|
|
96
106
|
}));
|
|
97
107
|
};
|
|
@@ -21,7 +21,7 @@ var _ProConfigProvider = require("../../../../ProConfigProvider");
|
|
|
21
21
|
var _useEnum = _interopRequireDefault(require("../../../../ProEnum/hooks/useEnum"));
|
|
22
22
|
var _locale = _interopRequireDefault(require("../../../../locale"));
|
|
23
23
|
var _ = _interopRequireDefault(require("../../.."));
|
|
24
|
-
var _excluded = ["className", "hasDetail", "detailMaxLength", "fieldNames", "value", "disabled", "dataSource", "onChange", "useRequest", "transformResponse", "level", "isView", "enumCode", "code", "tooltip", "separator"];
|
|
24
|
+
var _excluded = ["className", "hasDetail", "detailMaxLength", "fieldNames", "value", "disabled", "dataSource", "onChange", "useRequest", "transformResponse", "level", "isView", "enumCode", "code", "tooltip", "separator", "detailPlaceholder"];
|
|
25
25
|
var Text = _antd.Typography.Text;
|
|
26
26
|
var defaultFieldNames = {
|
|
27
27
|
label: 'name',
|
|
@@ -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 = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
83
84
|
var _ref3 = _.default.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.default === null || _locale.default === void 0 ? void 0 : (_locale$ProAddressBar2 = _locale.default.ProAddressBar) === null || _locale$ProAddressBar2 === void 0 ? void 0 : _locale$ProAddressBar2.detailPlaceholder,
|
|
251
|
+
placeholder: detailPlaceholder || (_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProAddressBar2 = _locale.default.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;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
8
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -81,6 +82,28 @@ var ProRangeLimit = function ProRangeLimit(props) {
|
|
|
81
82
|
'forever-checkbox': true
|
|
82
83
|
});
|
|
83
84
|
var _foreverDate = foreverDate || (initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig.foreverDate);
|
|
85
|
+
var _rest = (0, _objectSpread2.default)({}, rest);
|
|
86
|
+
// showTime默认值受valueType属性影响
|
|
87
|
+
if (rest.showTime === undefined) {
|
|
88
|
+
var valueType = props.valueType;
|
|
89
|
+
if (valueType === 'dateTime') {
|
|
90
|
+
_rest.showTime = true;
|
|
91
|
+
}
|
|
92
|
+
if (valueType === 'dateStartEndTime') {
|
|
93
|
+
_rest.showTime = false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
var _viewFormat = Array.isArray(format) ? format[0] : format;
|
|
97
|
+
var tempFormat = Array.isArray(format) ? format : [format];
|
|
98
|
+
if ((0, _lodash.isFunction)(format)) {
|
|
99
|
+
tempFormat = [];
|
|
100
|
+
}
|
|
101
|
+
var _format = (0, _lodash.uniq)([].concat((0, _toConsumableArray2.default)(tempFormat), ['YYYY-MM-DD', 'YYYYMMDD', 'YYYY/MM/DD', 'YYYY_MM_DD', 'YYYY.MM.DD'])).filter(function (formatKey) {
|
|
102
|
+
return !!formatKey;
|
|
103
|
+
});
|
|
104
|
+
var _defaultShowTime = {
|
|
105
|
+
format: 'HH:mm:ss'
|
|
106
|
+
};
|
|
84
107
|
var _isForever = (0, _react.useMemo)(function () {
|
|
85
108
|
return (0, _moment.default)(_foreverDate, format).isSame(endDate);
|
|
86
109
|
}, [value]);
|
|
@@ -136,6 +159,12 @@ var ProRangeLimit = function ProRangeLimit(props) {
|
|
|
136
159
|
onChange([start, null]);
|
|
137
160
|
}
|
|
138
161
|
};
|
|
162
|
+
if (_rest.showTime === true) {
|
|
163
|
+
_rest.showTime = (0, _objectSpread2.default)({}, _defaultShowTime);
|
|
164
|
+
}
|
|
165
|
+
if ((0, _lodash.isObject)(_rest.showTime)) {
|
|
166
|
+
_rest.showTime = Object.assign(_defaultShowTime, _rest.showTime);
|
|
167
|
+
}
|
|
139
168
|
return (0, _jsxRuntime.jsxs)(_antd.Input.Group, {
|
|
140
169
|
compact: true,
|
|
141
170
|
className: "pro-range-limit",
|
|
@@ -143,8 +172,8 @@ var ProRangeLimit = function ProRangeLimit(props) {
|
|
|
143
172
|
allowClear: true,
|
|
144
173
|
disabled: [_disabled === null || _disabled === void 0 ? void 0 : _disabled[0], (_disabled === null || _disabled === void 0 ? void 0 : _disabled[1]) || _isForever],
|
|
145
174
|
defaultPickerValue: defaultPickerValue
|
|
146
|
-
}, initialConfig), (0, _lodash.omit)(
|
|
147
|
-
format:
|
|
175
|
+
}, initialConfig), (0, _lodash.omit)(_rest, ['placeholder', 'separator'])), {}, {
|
|
176
|
+
format: _format,
|
|
148
177
|
value: value,
|
|
149
178
|
onChange: handleRangeChange
|
|
150
179
|
})), (0, _jsxRuntime.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 & {
|