@zat-design/sisyphus-react 3.13.8 → 3.13.10-deta.1
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/es/ProAction/index.js +2 -2
- package/es/ProDownload/index.js +4 -3
- package/es/ProDownload/utils.js +5 -4
- package/es/ProDrawerForm/components/ProDrawer/index.js +2 -2
- package/es/ProDrawerForm/components/ProModal/index.js +2 -2
- package/es/ProEditLabel/components/RenderProForm.js +3 -3
- package/es/ProEditLabel/index.js +2 -2
- package/es/ProEditTable/components/ActionButton/index.js +9 -8
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +6 -6
- package/es/ProEditTable/components/RenderField/index.js +20 -16
- package/es/ProEditTable/index.js +10 -7
- package/es/ProEditTable/utils/config.js +3 -3
- package/es/ProEditTable/utils/diffOriginal.js +6 -4
- package/es/ProEditTable/utils/getDefaultProps.js +8 -7
- package/es/ProEditTable/utils/index.js +21 -18
- package/es/ProEditTable/utils/tools.js +32 -24
- package/es/ProEditTable/utils/useEditTableError.js +2 -2
- package/es/ProEnum/index.js +16 -11
- package/es/ProEnum/utils/eventCenter.js +2 -2
- package/es/ProEnum/utils/getEnumLabel.js +5 -4
- package/es/ProEnum/utils/index.js +3 -2
- package/es/ProForm/components/base/DatePicker/index.js +11 -8
- package/es/ProForm/components/base/Input/index.js +3 -3
- package/es/ProForm/components/base/InputNumber/index.js +6 -4
- package/es/ProForm/components/base/RangePicker/index.js +12 -8
- package/es/ProForm/components/base/Select/index.js +2 -2
- package/es/ProForm/components/base/Switch/index.js +3 -2
- package/es/ProForm/components/base/SwitchCheckbox/index.js +3 -2
- package/es/ProForm/components/base/TextArea/index.js +2 -2
- package/es/ProForm/components/combination/Container/index.js +2 -2
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +7 -6
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +2 -2
- package/es/ProForm/components/combination/FormList/components/BlockTitle.js +2 -2
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +5 -4
- package/es/ProForm/components/combination/FormList/index.js +2 -2
- package/es/ProForm/components/combination/FormList/utils.js +2 -2
- package/es/ProForm/components/combination/Group/hooks/index.js +4 -3
- package/es/ProForm/components/combination/Group/index.js +2 -2
- package/es/ProForm/components/combination/Group/utils.js +6 -6
- package/es/ProForm/components/combination/ProCascader/index.js +6 -4
- package/es/ProForm/components/combination/ProCascader/utils/index.js +2 -2
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +3 -3
- package/es/ProForm/components/combination/ProModalSelect/index.js +13 -10
- package/es/ProForm/components/combination/ProNumberRange/index.js +2 -2
- package/es/ProForm/components/combination/ProRangeLimit/index.js +8 -5
- package/es/ProForm/components/combination/ProTimeLimit/index.js +10 -7
- package/es/ProForm/components/old/EnumSelect/hooks/useRequestList.js +3 -3
- package/es/ProForm/components/old/EnumSelect/index.js +3 -3
- package/es/ProForm/components/render/ChangedWrapper.js +3 -3
- package/es/ProForm/components/render/ConfirmWrapper.js +4 -3
- package/es/ProForm/components/render/Render.js +17 -13
- package/es/ProForm/components/render/RenderFields.js +9 -6
- package/es/ProForm/index.js +6 -4
- package/es/ProForm/utils/_useChanged.js +3 -3
- package/es/ProForm/utils/_useListChanged.js +6 -6
- package/es/ProForm/utils/diffOriginal.js +6 -4
- package/es/ProForm/utils/getDefaultProps.js +7 -6
- package/es/ProForm/utils/index.js +20 -15
- package/es/ProForm/utils/rulesCreator.js +4 -3
- package/es/ProForm/utils/transformNames.js +2 -2
- package/es/ProForm/utils/transformValue.js +3 -3
- package/es/ProForm/utils/useDeepCompareMemo.js +2 -2
- package/es/ProForm/utils/useRules.js +4 -3
- package/es/ProForm/utils/useShouldUpdate.js +23 -21
- package/es/ProForm/utils/useWatch.js +2 -2
- package/es/ProForm/utils/valueType.js +2 -2
- package/es/ProIcon/index.js +2 -2
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +2 -2
- package/es/ProLayout/components/ProCollapse/index.js +2 -2
- package/es/ProLayout/components/ProHeader/index.js +12 -9
- package/es/ProLayout/utils/index.js +3 -2
- package/es/ProSelect/index.js +11 -7
- package/es/ProSelect/utils/index.js +5 -3
- package/es/ProStep/components/Item/index.js +2 -2
- package/es/ProStep/components/Listener/index.js +2 -2
- package/es/ProStep/components/Step/index.js +2 -2
- package/es/ProStep/index.js +2 -2
- package/es/ProStep/utils/index.js +4 -3
- package/es/ProStepTab/index.js +3 -3
- package/es/ProTable/components/FormatColumn/index.js +16 -12
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +3 -3
- package/es/ProTable/components/RenderColumn/index.js +2 -2
- package/es/ProTable/components/RenderSummary/index.js +3 -3
- package/es/ProTable/hooks/useAntdTable.js +15 -10
- package/es/ProTable/index.js +12 -7
- package/es/ProTable/utils/index.js +5 -4
- package/es/ProTabs/index.js +2 -2
- package/es/ProThemeTools/index.js +2 -2
- package/es/ProTree/components/ProTree.js +5 -4
- package/es/ProTree/components/ProTreeSelect/index.js +6 -5
- package/es/ProTreeModal/index.js +5 -4
- package/es/ProUpload/components/ImageRender.js +2 -2
- package/es/ProUpload/index.js +5 -4
- package/es/old/ProEditableTable/index.js +7 -7
- package/es/old/ProEditableTable/utils.js +2 -2
- package/lib/ProAction/index.js +8 -5
- package/lib/ProConfigProvider/index.js +3 -2
- package/lib/ProDownload/index.js +7 -6
- package/lib/ProDownload/utils.js +9 -7
- package/lib/ProDrawerForm/components/ProDrawer/index.js +12 -7
- package/lib/ProDrawerForm/components/ProModal/index.js +12 -7
- package/lib/ProEditLabel/components/RenderProForm.js +6 -5
- package/lib/ProEditLabel/index.js +15 -8
- package/lib/ProEditTable/components/ActionButton/index.js +15 -11
- package/lib/ProEditTable/components/RcTable/BaseTable.js +6 -3
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +3 -2
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +14 -11
- package/lib/ProEditTable/components/RenderField/index.js +25 -20
- package/lib/ProEditTable/components/RenderToolbar/index.js +3 -2
- package/lib/ProEditTable/components/Summary/index.js +8 -5
- package/lib/ProEditTable/components/Validator/index.js +7 -3
- package/lib/ProEditTable/index.js +20 -12
- package/lib/ProEditTable/utils/config.js +8 -7
- package/lib/ProEditTable/utils/diffOriginal.js +7 -4
- package/lib/ProEditTable/utils/getDefaultProps.js +8 -7
- package/lib/ProEditTable/utils/index.js +27 -21
- package/lib/ProEditTable/utils/tools.js +32 -24
- package/lib/ProEditTable/utils/useEditTableError.js +2 -2
- package/lib/ProEnum/index.js +31 -19
- package/lib/ProEnum/utils/eventCenter.js +2 -2
- package/lib/ProEnum/utils/getEnumLabel.js +5 -4
- package/lib/ProEnum/utils/index.js +3 -2
- package/lib/ProForm/components/Container.js +3 -2
- package/lib/ProForm/components/FormFooter/index.js +7 -4
- package/lib/ProForm/components/base/Checkbox/index.js +4 -3
- package/lib/ProForm/components/base/DatePicker/index.js +14 -10
- package/lib/ProForm/components/base/Input/index.js +6 -5
- package/lib/ProForm/components/base/InputNumber/index.js +12 -7
- package/lib/ProForm/components/base/Radio/index.js +4 -3
- package/lib/ProForm/components/base/RangePicker/index.js +15 -10
- package/lib/ProForm/components/base/Select/index.js +5 -4
- package/lib/ProForm/components/base/Switch/index.js +6 -4
- package/lib/ProForm/components/base/SwitchCheckbox/index.js +6 -4
- package/lib/ProForm/components/base/TextArea/index.js +5 -4
- package/lib/ProForm/components/base/TimePicker/index.js +3 -2
- package/lib/ProForm/components/combination/Container/index.js +2 -2
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +16 -10
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +8 -5
- package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +2 -2
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +3 -2
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +10 -6
- package/lib/ProForm/components/combination/FormList/index.js +5 -4
- package/lib/ProForm/components/combination/FormList/utils.js +2 -2
- package/lib/ProForm/components/combination/Group/hooks/index.js +4 -3
- package/lib/ProForm/components/combination/Group/index.js +6 -5
- package/lib/ProForm/components/combination/Group/utils.js +10 -9
- package/lib/ProForm/components/combination/ProCascader/index.js +14 -7
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +2 -2
- package/lib/ProForm/components/combination/ProCombination/index.js +9 -4
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +3 -3
- package/lib/ProForm/components/combination/ProModalSelect/index.js +35 -19
- package/lib/ProForm/components/combination/ProNumberRange/index.js +17 -10
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +17 -9
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +19 -11
- package/lib/ProForm/components/old/EnumSelect/hooks/useRequestList.js +3 -3
- package/lib/ProForm/components/old/EnumSelect/index.js +15 -8
- package/lib/ProForm/components/old/InputRange/index.js +8 -5
- package/lib/ProForm/components/old/InputWithSuffix/index.js +4 -3
- package/lib/ProForm/components/old/ProAddress/index.js +18 -11
- package/lib/ProForm/components/old/ProCertNo/index.js +12 -7
- package/lib/ProForm/components/old/ProCertValidity/index.js +11 -6
- package/lib/ProForm/components/old/ProRangeBox/index.js +21 -12
- package/lib/ProForm/components/render/ChangedWrapper.js +11 -8
- package/lib/ProForm/components/render/ConfirmWrapper.js +8 -6
- package/lib/ProForm/components/render/Render.js +34 -23
- package/lib/ProForm/components/render/RenderFields.js +9 -6
- package/lib/ProForm/index.js +21 -12
- package/lib/ProForm/utils/_useChanged.js +7 -5
- package/lib/ProForm/utils/_useListChanged.js +10 -8
- package/lib/ProForm/utils/diffOriginal.js +7 -4
- package/lib/ProForm/utils/getDefaultProps.js +8 -6
- package/lib/ProForm/utils/index.js +20 -15
- package/lib/ProForm/utils/rulesCreator.js +4 -3
- package/lib/ProForm/utils/transformNames.js +3 -2
- package/lib/ProForm/utils/transformValue.js +3 -3
- package/lib/ProForm/utils/useDeepCompareMemo.js +3 -2
- package/lib/ProForm/utils/useForm.js +3 -2
- package/lib/ProForm/utils/useRules.js +4 -3
- package/lib/ProForm/utils/useShouldUpdate.js +23 -21
- package/lib/ProForm/utils/useWatch.js +2 -2
- package/lib/ProForm/utils/valueType.js +2 -2
- package/lib/ProIcon/index.js +13 -8
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +6 -3
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +5 -4
- package/lib/ProLayout/components/ProCollapse/index.js +13 -8
- package/lib/ProLayout/components/ProFooter/index.js +3 -2
- package/lib/ProLayout/components/ProHeader/components/Copy/index.js +3 -2
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/index.js +3 -2
- package/lib/ProLayout/components/ProHeader/index.js +37 -25
- package/lib/ProLayout/index.js +3 -2
- package/lib/ProLayout/utils/index.js +2 -2
- package/lib/ProSelect/components/AdaptiveTooltip.js +3 -2
- package/lib/ProSelect/index.js +25 -14
- package/lib/ProSelect/utils/index.js +4 -4
- package/lib/ProStep/components/Anchor/index.js +3 -2
- package/lib/ProStep/components/Item/index.js +2 -2
- package/lib/ProStep/components/Listener/index.js +2 -2
- package/lib/ProStep/components/Step/index.js +2 -2
- package/lib/ProStep/index.js +2 -2
- package/lib/ProStep/utils/index.js +4 -3
- package/lib/ProStepTab/index.js +3 -3
- package/lib/ProTable/components/FormatColumn/index.js +26 -21
- package/lib/ProTable/components/RcTable/components/BaseTable/index.js +3 -2
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +3 -3
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +3 -2
- package/lib/ProTable/components/RenderColumn/index.js +17 -12
- package/lib/ProTable/components/RenderSummary/index.js +8 -7
- package/lib/ProTable/components/RenderTableHeader/index.js +5 -3
- package/lib/ProTable/components/RenderTabs/index.js +6 -3
- package/lib/ProTable/components/TooltipTitle/index.js +3 -2
- package/lib/ProTable/hooks/useAntdTable.js +21 -13
- package/lib/ProTable/index.js +12 -7
- package/lib/ProTable/utils/index.js +5 -4
- package/lib/ProTabs/components/Card/index.js +11 -5
- package/lib/ProTabs/index.js +5 -4
- package/lib/ProThemeTools/component/ProTools/index.js +19 -12
- package/lib/ProThemeTools/index.js +12 -9
- package/lib/ProThemeTools/utils/index.js +3 -2
- package/lib/ProTooltip/index.js +5 -4
- package/lib/ProTree/components/AdaptiveTooltip.js +4 -2
- package/lib/ProTree/components/List.js +4 -3
- package/lib/ProTree/components/ProTree.js +17 -9
- package/lib/ProTree/components/ProTreeSelect/index.js +22 -14
- package/lib/ProTree/components/Tree.js +6 -3
- package/lib/ProTreeModal/components/Cascader.js +4 -3
- package/lib/ProTreeModal/components/List.js +14 -9
- package/lib/ProTreeModal/components/SortableItem.js +3 -2
- package/lib/ProTreeModal/components/Tree.js +4 -3
- package/lib/ProTreeModal/components/Trigger.js +11 -6
- package/lib/ProTreeModal/index.js +21 -13
- package/lib/ProUpload/components/ButtonRender.js +6 -3
- package/lib/ProUpload/components/DragRender.js +3 -2
- package/lib/ProUpload/components/FileItem.js +15 -10
- package/lib/ProUpload/components/ImageRender.js +19 -10
- package/lib/ProUpload/index.js +9 -7
- package/lib/ProViewer/index.js +9 -4
- package/lib/old/ProCertValidity/index.js +11 -6
- package/lib/old/ProEditableTable/index.js +36 -23
- package/lib/old/ProEditableTable/utils.js +35 -18
- package/package.json +4 -3
@@ -8,11 +8,14 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
8
8
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
9
9
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
10
10
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
11
|
+
import _isEqual from "lodash/isEqual";
|
12
|
+
import _isBoolean from "lodash/isBoolean";
|
13
|
+
import _isArray from "lodash/isArray";
|
14
|
+
import _cloneDeepWith from "lodash/cloneDeepWith";
|
11
15
|
var _excluded = ["type", "label", "show", "needConfirm", "onHandle", "onClick"],
|
12
16
|
_excluded2 = ["title", "icon"];
|
13
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
14
18
|
import React from 'react';
|
15
|
-
import { cloneDeepWith, isArray, isBoolean, isEqual } from 'lodash';
|
16
19
|
import classnames from 'classnames';
|
17
20
|
import { ReactSVG } from 'react-svg';
|
18
21
|
import { tools } from '@zat-design/utils';
|
@@ -24,21 +27,21 @@ import tipSvg from '../../assets/tip.svg';
|
|
24
27
|
import locale from '../../locale';
|
25
28
|
// 渲染操作栏
|
26
29
|
var getActionColumn = function getActionColumn(config) {
|
27
|
-
var
|
30
|
+
var _cloneDeepWith2 = _cloneDeepWith(config, function (value) {
|
28
31
|
if (/*#__PURE__*/React.isValidElement(value)) {
|
29
32
|
return value;
|
30
33
|
}
|
31
34
|
}),
|
32
|
-
disabled =
|
33
|
-
name =
|
34
|
-
form =
|
35
|
-
virtualKey =
|
36
|
-
validateKeys =
|
37
|
-
actionWidth =
|
38
|
-
actionProps =
|
39
|
-
page =
|
40
|
-
rowDisabled =
|
41
|
-
actionDirection =
|
35
|
+
disabled = _cloneDeepWith2.disabled,
|
36
|
+
name = _cloneDeepWith2.name,
|
37
|
+
form = _cloneDeepWith2.form,
|
38
|
+
virtualKey = _cloneDeepWith2.virtualKey,
|
39
|
+
validateKeys = _cloneDeepWith2.validateKeys,
|
40
|
+
actionWidth = _cloneDeepWith2.actionWidth,
|
41
|
+
actionProps = _cloneDeepWith2.actionProps,
|
42
|
+
page = _cloneDeepWith2.page,
|
43
|
+
rowDisabled = _cloneDeepWith2.rowDisabled,
|
44
|
+
actionDirection = _cloneDeepWith2.actionDirection;
|
42
45
|
var pageNum = tools.calc(page.pageNum, '-', 1);
|
43
46
|
var firstIndex = tools.calc(pageNum, '*', page.pageSize);
|
44
47
|
// actionProps配置为false 默认不插入
|
@@ -50,7 +53,7 @@ var getActionColumn = function getActionColumn(config) {
|
|
50
53
|
var defaultActionKeys = virtualKey ? defaultSingleActionKeys : defaultMultipleActionKeys;
|
51
54
|
var nextActionsProps = _toConsumableArray(actionProps);
|
52
55
|
// 不设置actionProps
|
53
|
-
if (
|
56
|
+
if (_isArray(actionProps) && !(actionProps === null || actionProps === void 0 ? void 0 : actionProps.length)) {
|
54
57
|
nextActionsProps = defaultActionKeys.map(function (key) {
|
55
58
|
return {
|
56
59
|
type: key
|
@@ -59,7 +62,7 @@ var getActionColumn = function getActionColumn(config) {
|
|
59
62
|
} else {
|
60
63
|
// 设置部分actionProps 内置的必选按钮会集成进去,可以手动开启show: false来隐藏对应类型的按钮
|
61
64
|
defaultActionKeys.forEach(function (key) {
|
62
|
-
if (
|
65
|
+
if (_isArray(actionProps) && !actionProps.find(function (action) {
|
63
66
|
return action.type === key;
|
64
67
|
})) {
|
65
68
|
nextActionsProps.push({
|
@@ -255,7 +258,7 @@ export var transformColumns = function transformColumns() {
|
|
255
258
|
item.dataIndex = columnName;
|
256
259
|
item.key = columnName;
|
257
260
|
// item.shouldCellUpdate = item.shouldCellUpdate || ((record, perRecord) => !isEqual(record, perRecord));
|
258
|
-
var required =
|
261
|
+
var required = _isBoolean(item.required) ? item.required : false;
|
259
262
|
if (typeof item.required === 'function') {
|
260
263
|
var namePath = getNamePath(name, virtualKey);
|
261
264
|
var namePathArray = Array.isArray(namePath) ? namePath : [namePath];
|
@@ -279,12 +282,12 @@ export var transformColumns = function transformColumns() {
|
|
279
282
|
}
|
280
283
|
var _render = function _render(text, record, index) {
|
281
284
|
var _isEditing = !virtualKey || editingKeys.includes(record.rowKey) || record._addFlag;
|
282
|
-
var namePath =
|
285
|
+
var namePath = _isArray(name) ? name : [name];
|
283
286
|
if (virtualKey && editingKeys.includes(record.rowKey)) {
|
284
287
|
namePath = getNamePath(name, virtualKey);
|
285
288
|
}
|
286
289
|
var namePathArray = Array.isArray(namePath) ? namePath : [namePath];
|
287
|
-
var columnNamePath =
|
290
|
+
var columnNamePath = _isArray(columnName) ? columnName : [columnName];
|
288
291
|
index = tools.calc(firstIndex, '+', index);
|
289
292
|
// 设置单元格formItem的namePath
|
290
293
|
var cellName = columnName ? [].concat(_toConsumableArray(namePathArray), [index], _toConsumableArray(columnNamePath)) : [].concat(_toConsumableArray(namePathArray), [index]);
|
@@ -314,7 +317,7 @@ export var transformColumns = function transformColumns() {
|
|
314
317
|
record['is-view'] = true;
|
315
318
|
// 样式处理
|
316
319
|
cellClassName = classnames({
|
317
|
-
'is-cell': !
|
320
|
+
'is-cell': !_isEqual(cellNamePath, cellName)
|
318
321
|
});
|
319
322
|
}
|
320
323
|
// 单行多行交互有较大差异
|
@@ -2,11 +2,19 @@ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
2
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
3
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
4
4
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
5
|
+
import _get from "lodash/get";
|
6
|
+
import _isBoolean from "lodash/isBoolean";
|
7
|
+
import _isFunction from "lodash/isFunction";
|
8
|
+
import _transform from "lodash/transform";
|
9
|
+
import _isEqual from "lodash/isEqual";
|
10
|
+
import _isObject from "lodash/isObject";
|
11
|
+
import _isString from "lodash/isString";
|
12
|
+
import _cloneDeepWith from "lodash/cloneDeepWith";
|
13
|
+
import _cloneDeep from "lodash/cloneDeep";
|
5
14
|
/* eslint-disable no-await-in-loop */
|
6
15
|
/* eslint-disable no-restricted-syntax */
|
7
16
|
import React from 'react';
|
8
17
|
import { tools, validate } from '@zat-design/utils';
|
9
|
-
import { cloneDeep, cloneDeepWith, isString, isObject, isEqual, transform, isFunction, isBoolean, get } from 'lodash';
|
10
18
|
/**
|
11
19
|
* 生成随机字符串
|
12
20
|
* @returns 随机字符串
|
@@ -22,9 +30,9 @@ export var getRandom = function getRandom() {
|
|
22
30
|
*/
|
23
31
|
export var difference = function difference(object, base) {
|
24
32
|
var _changes = function changes(object, base) {
|
25
|
-
return
|
26
|
-
if (!
|
27
|
-
result[key] =
|
33
|
+
return _transform(object, function (result, value, key) {
|
34
|
+
if (!_isEqual(value, base === null || base === void 0 ? void 0 : base[key])) {
|
35
|
+
result[key] = _isObject(value) && _isObject(base === null || base === void 0 ? void 0 : base[key]) ? _changes(value, base === null || base === void 0 ? void 0 : base[key]) : value;
|
28
36
|
}
|
29
37
|
});
|
30
38
|
};
|
@@ -52,12 +60,12 @@ export var customValidate = function customValidate(validateKeys, form, rowName)
|
|
52
60
|
export var splitNames = function splitNames(names) {
|
53
61
|
var result;
|
54
62
|
var resultArray = [];
|
55
|
-
if (
|
63
|
+
if (_isString(names[0])) {
|
56
64
|
result = names.join('-');
|
57
65
|
return result;
|
58
66
|
}
|
59
67
|
names.forEach(function (item) {
|
60
|
-
if (
|
68
|
+
if (_isString(item[0])) {
|
61
69
|
resultArray.push("".concat(item[0], "_").concat(item[1]));
|
62
70
|
}
|
63
71
|
});
|
@@ -71,7 +79,7 @@ export var splitNames = function splitNames(names) {
|
|
71
79
|
* @returns 完整名称路径数组
|
72
80
|
*/
|
73
81
|
export var getNamePath = function getNamePath(name, virtualKey) {
|
74
|
-
var nextName =
|
82
|
+
var nextName = _cloneDeep(Array.isArray(name) ? name : [name]);
|
75
83
|
var lastIndex = nextName.length - 1;
|
76
84
|
// 确保最后一个元素是字符串类型
|
77
85
|
nextName[lastIndex] = "".concat(nextName[lastIndex]).concat(virtualKey ? "-".concat(virtualKey) : '');
|
@@ -135,14 +143,14 @@ export var getDisabled = function getDisabled(_ref2) {
|
|
135
143
|
};
|
136
144
|
// 判断是否有column的disabled属性
|
137
145
|
var noColumnDisabled = function noColumnDisabled() {
|
138
|
-
if (
|
146
|
+
if (_isFunction(column === null || column === void 0 ? void 0 : column.disabled) || _isFunction(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled) || _isBoolean(column === null || column === void 0 ? void 0 : column.disabled) || _isBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled)) {
|
139
147
|
return false;
|
140
148
|
}
|
141
149
|
// 判断FieldProps是否有disabled属性
|
142
|
-
if (
|
150
|
+
if (_isFunction(columnFieldProps)) {
|
143
151
|
var _columnFieldProps = columnFieldProps.apply(void 0, _toConsumableArray(params)),
|
144
152
|
disabled = _columnFieldProps.disabled;
|
145
|
-
if (
|
153
|
+
if (_isFunction(disabled) || _isBoolean(disabled)) {
|
146
154
|
return false;
|
147
155
|
}
|
148
156
|
}
|
@@ -162,29 +170,29 @@ export var getDisabled = function getDisabled(_ref2) {
|
|
162
170
|
if (Array.isArray(column === null || column === void 0 ? void 0 : column.disabled)) {
|
163
171
|
return column.disabled;
|
164
172
|
}
|
165
|
-
if (
|
173
|
+
if (_isFunction(column === null || column === void 0 ? void 0 : column.disabled)) {
|
166
174
|
return column === null || column === void 0 ? void 0 : column.disabled.apply(column, _toConsumableArray(params));
|
167
175
|
}
|
168
176
|
}
|
169
177
|
// 当表单含有diabled属性时,优先使用表单的disabled
|
170
|
-
if (
|
178
|
+
if (_isFunction(rowDisabled) && noColumnDisabled()) {
|
171
179
|
return rowDisabled(params[1]);
|
172
180
|
}
|
173
|
-
if (
|
181
|
+
if (_isFunction(column === null || column === void 0 ? void 0 : column.disabled)) {
|
174
182
|
return convertToBoolean(column === null || column === void 0 ? void 0 : column.disabled.apply(column, _toConsumableArray(params)));
|
175
183
|
}
|
176
184
|
// 表单FieldProps为函数时
|
177
|
-
if (
|
185
|
+
if (_isFunction(columnFieldProps)) {
|
178
186
|
var _columnFieldProps2 = columnFieldProps.apply(void 0, _toConsumableArray(params)),
|
179
187
|
disabled = _columnFieldProps2.disabled;
|
180
|
-
if (
|
188
|
+
if (_isFunction(disabled)) {
|
181
189
|
return convertToBoolean(disabled.apply(void 0, _toConsumableArray(params)));
|
182
190
|
}
|
183
|
-
if (
|
191
|
+
if (_isBoolean(disabled)) {
|
184
192
|
return convertToBoolean(disabled);
|
185
193
|
}
|
186
194
|
}
|
187
|
-
if (
|
195
|
+
if (_isFunction(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled)) {
|
188
196
|
return convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled.apply(columnFieldProps, _toConsumableArray(params)));
|
189
197
|
}
|
190
198
|
return convertToBoolean((_ref3 = (_column$disabled = column === null || column === void 0 ? void 0 : column.disabled) !== null && _column$disabled !== void 0 ? _column$disabled : columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled) !== null && _ref3 !== void 0 ? _ref3 : tabledDisabled);
|
@@ -244,7 +252,7 @@ export var handleScrollToError = function handleScrollToError() {
|
|
244
252
|
* @returns 深拷贝后的对象,其中的React节点会被保留
|
245
253
|
*/
|
246
254
|
export function cloneDeepFilterNode(value) {
|
247
|
-
return
|
255
|
+
return _cloneDeepWith(value, function (val) {
|
248
256
|
if (/*#__PURE__*/React.isValidElement(val)) {
|
249
257
|
return val;
|
250
258
|
}
|
@@ -272,23 +280,23 @@ var handleCheckCellValue = /*#__PURE__*/function () {
|
|
272
280
|
case 0:
|
273
281
|
value = null;
|
274
282
|
if (column.name) {
|
275
|
-
value =
|
283
|
+
value = _get(record, column.name);
|
276
284
|
}
|
277
285
|
if ((_column$names = column.names) === null || _column$names === void 0 ? void 0 : _column$names.length) {
|
278
286
|
value = column.names.map(function (key) {
|
279
|
-
return
|
287
|
+
return _get(record, key);
|
280
288
|
});
|
281
289
|
}
|
282
290
|
_required = column.required;
|
283
291
|
_rules = column.rules;
|
284
292
|
_labelRequired = column.labelRequired;
|
285
|
-
if (
|
293
|
+
if (_isFunction(column.required)) {
|
286
294
|
_required = column.required(value, record);
|
287
295
|
}
|
288
|
-
if (
|
296
|
+
if (_isFunction(column.rules)) {
|
289
297
|
_rules = column.rules(value, record);
|
290
298
|
}
|
291
|
-
if (
|
299
|
+
if (_isFunction(column.labelRequired)) {
|
292
300
|
_labelRequired = column.labelRequired(value, record);
|
293
301
|
}
|
294
302
|
if (!(((_column$names2 = column.names) === null || _column$names2 === void 0 ? void 0 : _column$names2.length) && _labelRequired !== null && _labelRequired !== undefined && _isNull(value))) {
|
@@ -326,7 +334,7 @@ var handleCheckCellValue = /*#__PURE__*/function () {
|
|
326
334
|
if (rule.required && _isNull(value)) {
|
327
335
|
res = false;
|
328
336
|
}
|
329
|
-
if (!
|
337
|
+
if (!_isFunction(rule.validator)) {
|
330
338
|
_context.next = 32;
|
331
339
|
break;
|
332
340
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
+
import _debounce from "lodash/debounce";
|
2
3
|
import { useState, useEffect } from 'react';
|
3
|
-
import { debounce } from 'lodash';
|
4
4
|
var useEditTableError = function useEditTableError(_ref) {
|
5
5
|
var containerNode = _ref.containerNode,
|
6
6
|
className = _ref.className,
|
@@ -15,7 +15,7 @@ var useEditTableError = function useEditTableError(_ref) {
|
|
15
15
|
return; // 如果未启用监听或容器节点不存在,直接返回
|
16
16
|
}
|
17
17
|
// 防抖处理:将 setErrorLength 函数进行防抖
|
18
|
-
var debouncedSetErrorLength =
|
18
|
+
var debouncedSetErrorLength = _debounce(function (errorCount) {
|
19
19
|
setErrorLength(errorCount); // 更新错误数量
|
20
20
|
}, 300); // 300ms 后更新状态
|
21
21
|
var observer = new MutationObserver(function (mutations) {
|
package/es/ProEnum/index.js
CHANGED
@@ -11,12 +11,17 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
11
11
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
12
12
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
13
13
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
14
|
+
import _isNumber from "lodash/isNumber";
|
15
|
+
import _omit from "lodash/omit";
|
16
|
+
import _isArray from "lodash/isArray";
|
17
|
+
import _isString from "lodash/isString";
|
18
|
+
import _isFunction from "lodash/isFunction";
|
19
|
+
import _cloneDeep from "lodash/cloneDeep";
|
14
20
|
var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component", "onChange", "transformResponse", "otherProps", "isView"],
|
15
21
|
_excluded2 = ["fieldNames", "clear", "cacheKey", "showCodeName"];
|
16
22
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
17
23
|
import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
|
18
24
|
import React, { useState, useEffect, useMemo } from 'react';
|
19
|
-
import { cloneDeep, isFunction, isString, isArray, omit, isNumber } from 'lodash';
|
20
25
|
import ProSelect from '../ProSelect';
|
21
26
|
import { useProConfig } from '../ProConfigProvider';
|
22
27
|
import ProEnumTag from './components/Tag';
|
@@ -113,7 +118,7 @@ var ProEnum = function ProEnum(props) {
|
|
113
118
|
if (Array.isArray(data)) {
|
114
119
|
setData(_toConsumableArray(data));
|
115
120
|
}
|
116
|
-
if (isObject(data) &&
|
121
|
+
if (isObject(data) && _isString(code)) {
|
117
122
|
setData(data[code]);
|
118
123
|
}
|
119
124
|
} else {
|
@@ -134,13 +139,13 @@ var ProEnum = function ProEnum(props) {
|
|
134
139
|
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
|
135
140
|
var enumLists = useMemo(function () {
|
136
141
|
var lists = [];
|
137
|
-
if (
|
142
|
+
if (_isString(code)) {
|
138
143
|
lists = (dics === null || dics === void 0 ? void 0 : dics[code]) || [];
|
139
144
|
}
|
140
|
-
if (
|
145
|
+
if (_isArray(code)) {
|
141
146
|
code.forEach(function (enumCode) {
|
142
147
|
var _lists;
|
143
|
-
|
148
|
+
_isArray(dics === null || dics === void 0 ? void 0 : dics[enumCode]) && (_lists = lists).push.apply(_lists, _toConsumableArray(dics === null || dics === void 0 ? void 0 : dics[enumCode]));
|
144
149
|
});
|
145
150
|
}
|
146
151
|
return lists;
|
@@ -148,7 +153,7 @@ var ProEnum = function ProEnum(props) {
|
|
148
153
|
var renderComponent = function renderComponent() {
|
149
154
|
var list = [];
|
150
155
|
// 优先使用组件内部自己传入的数据源或者请求得到的数据
|
151
|
-
list =
|
156
|
+
list = _cloneDeep(dataList && dataList.length ? dataList : enumLists);
|
152
157
|
// 对数据进行一系列的过滤等操作
|
153
158
|
if (!(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service) && transformResponse) {
|
154
159
|
list = transformResponse(list);
|
@@ -183,7 +188,7 @@ var ProEnum = function ProEnum(props) {
|
|
183
188
|
onChange: onChange
|
184
189
|
}));
|
185
190
|
case 'Radio':
|
186
|
-
return _jsx(_Radio.Group, _objectSpread(_objectSpread({},
|
191
|
+
return _jsx(_Radio.Group, _objectSpread(_objectSpread({}, _omit(enumProps, ['fieldNames', 'showCodeName'])), {}, {
|
187
192
|
options: list,
|
188
193
|
value: value,
|
189
194
|
onChange: onChange,
|
@@ -196,7 +201,7 @@ var ProEnum = function ProEnum(props) {
|
|
196
201
|
})
|
197
202
|
}));
|
198
203
|
case 'Checkbox':
|
199
|
-
return _jsx(_Checkbox.Group, _objectSpread(_objectSpread({},
|
204
|
+
return _jsx(_Checkbox.Group, _objectSpread(_objectSpread({}, _omit(enumProps, ['fieldNames', 'showCodeName'])), {}, {
|
200
205
|
options: list,
|
201
206
|
value: value,
|
202
207
|
onChange: onChange,
|
@@ -218,7 +223,7 @@ var ProEnum = function ProEnum(props) {
|
|
218
223
|
dataSource: list
|
219
224
|
});
|
220
225
|
case 'Group':
|
221
|
-
return _jsx(ProEnumGroup, _objectSpread(_objectSpread({},
|
226
|
+
return _jsx(ProEnumGroup, _objectSpread(_objectSpread({}, _omit(enumProps, ['showCodeName'])), {}, {
|
222
227
|
value: value,
|
223
228
|
onChange: onChange,
|
224
229
|
fieldLabel: label,
|
@@ -274,7 +279,7 @@ var ProEnum = function ProEnum(props) {
|
|
274
279
|
})
|
275
280
|
});
|
276
281
|
};
|
277
|
-
return
|
282
|
+
return _isFunction(props.optionRender) && record.length ? _optionRender() : labelList === null || labelList === void 0 ? void 0 : labelList.join(',');
|
278
283
|
};
|
279
284
|
if (_isView) {
|
280
285
|
var __value = value || _defalutValue;
|
@@ -287,7 +292,7 @@ var ProEnum = function ProEnum(props) {
|
|
287
292
|
}
|
288
293
|
return _jsx(Container, {
|
289
294
|
viewEmpty: viewEmpty,
|
290
|
-
children: __value ||
|
295
|
+
children: __value || _isNumber(__value) ? transToLabel([__value]) : null
|
291
296
|
});
|
292
297
|
}
|
293
298
|
return _jsx(_Fragment, {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
3
|
-
import
|
3
|
+
import _isFunction from "lodash/isFunction";
|
4
4
|
var SimpleEventCenter = /*#__PURE__*/function () {
|
5
5
|
function SimpleEventCenter() {
|
6
6
|
_classCallCheck(this, SimpleEventCenter);
|
@@ -20,7 +20,7 @@ var SimpleEventCenter = /*#__PURE__*/function () {
|
|
20
20
|
value: function publish(eventName, data) {
|
21
21
|
if (this.events.has(eventName)) {
|
22
22
|
this.events.get(eventName).forEach(function (callback) {
|
23
|
-
|
23
|
+
_isFunction(callback) && (callback === null || callback === void 0 ? void 0 : callback(data));
|
24
24
|
});
|
25
25
|
}
|
26
26
|
}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
2
|
+
import _isString from "lodash/isString";
|
3
|
+
import _isArray from "lodash/isArray";
|
2
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
3
5
|
import { useMemo } from 'react';
|
4
|
-
import { isArray, isString } from 'lodash';
|
5
6
|
import { useProConfig } from '../../ProConfigProvider';
|
6
7
|
var EnumLabel = function EnumLabel(props) {
|
7
8
|
var fieldNameLabel = '';
|
@@ -28,13 +29,13 @@ var EnumLabel = function EnumLabel(props) {
|
|
28
29
|
dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
|
29
30
|
var enumLists = useMemo(function () {
|
30
31
|
var lists = [];
|
31
|
-
if (
|
32
|
+
if (_isString(code)) {
|
32
33
|
lists = (dics === null || dics === void 0 ? void 0 : dics[code]) || [];
|
33
34
|
}
|
34
|
-
if (
|
35
|
+
if (_isArray(code)) {
|
35
36
|
code.forEach(function (enumCode) {
|
36
37
|
var _lists;
|
37
|
-
|
38
|
+
_isArray(dics === null || dics === void 0 ? void 0 : dics[enumCode]) && (_lists = lists).push.apply(_lists, _toConsumableArray(dics === null || dics === void 0 ? void 0 : dics[enumCode]));
|
38
39
|
});
|
39
40
|
}
|
40
41
|
return lists;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
2
|
+
import _isUndefined from "lodash/isUndefined";
|
3
|
+
import _isNull from "lodash/isNull";
|
2
4
|
var _excluded = ["children"];
|
3
|
-
import { isNull, isUndefined } from 'lodash';
|
4
5
|
/**
|
5
6
|
* 获取枚举数据
|
6
7
|
* @param storage
|
@@ -104,7 +105,7 @@ export function cacheFieldNames(fieldNames, dataSource) {
|
|
104
105
|
var result = {};
|
105
106
|
Object.keys(restFieldNames).forEach(function (key) {
|
106
107
|
var value = dataSource[restFieldNames[key]] ? dataSource[restFieldNames[key]] : dataSource[key];
|
107
|
-
if (!(
|
108
|
+
if (!(_isUndefined(value) || _isNull(value))) {
|
108
109
|
result[key] = dataSource[restFieldNames[key]] ? dataSource[restFieldNames[key]] : dataSource[key];
|
109
110
|
}
|
110
111
|
});
|
@@ -4,9 +4,12 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
6
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
7
|
+
import _uniq from "lodash/uniq";
|
8
|
+
import _isObject from "lodash/isObject";
|
9
|
+
import _isString from "lodash/isString";
|
10
|
+
import _isFunction from "lodash/isFunction";
|
7
11
|
var _excluded = ["className", "format"];
|
8
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
-
import { isFunction, isString, isObject, uniq } from 'lodash';
|
10
13
|
import classNames from 'classnames';
|
11
14
|
import moment from 'moment';
|
12
15
|
import { useProConfig } from '../../../../ProConfigProvider';
|
@@ -28,10 +31,10 @@ var DatePicker = function DatePicker(props) {
|
|
28
31
|
}, className, !!className));
|
29
32
|
var _viewFormat = Array.isArray(format) ? format[0] : format;
|
30
33
|
var tempFormat = Array.isArray(format) ? format : [format];
|
31
|
-
if (
|
34
|
+
if (_isFunction(format)) {
|
32
35
|
tempFormat = [];
|
33
36
|
}
|
34
|
-
var _format =
|
37
|
+
var _format = _uniq([].concat(_toConsumableArray(tempFormat), ['YYYY-MM-DD', 'YYYYMMDD', 'YYYY/MM/DD', 'YYYY_MM_DD', 'YYYY.MM.DD'])).filter(function (formatKey) {
|
35
38
|
return !!formatKey;
|
36
39
|
});
|
37
40
|
if (isView) {
|
@@ -39,11 +42,11 @@ var DatePicker = function DatePicker(props) {
|
|
39
42
|
var viewChildren = null;
|
40
43
|
if (!value) {
|
41
44
|
viewChildren = null;
|
42
|
-
} else if (typeof format === 'string' &&
|
45
|
+
} else if (typeof format === 'string' && _isObject(value)) {
|
43
46
|
viewChildren = value.format(format);
|
44
|
-
} else if (
|
47
|
+
} else if (_isFunction(format)) {
|
45
48
|
viewChildren = format(value);
|
46
|
-
} else if (
|
49
|
+
} else if (_isString(value)) {
|
47
50
|
viewChildren = moment(value).format(_viewFormat);
|
48
51
|
}
|
49
52
|
return _jsx(Container, {
|
@@ -63,13 +66,13 @@ var DatePicker = function DatePicker(props) {
|
|
63
66
|
}
|
64
67
|
}
|
65
68
|
// 字符串时间格式兼容
|
66
|
-
if (
|
69
|
+
if (_isString(_rest.value)) {
|
67
70
|
_rest.value = moment(_rest.value);
|
68
71
|
}
|
69
72
|
if (_rest.showTime === true) {
|
70
73
|
_rest.showTime = _objectSpread({}, _defaultShowTime);
|
71
74
|
}
|
72
|
-
if (
|
75
|
+
if (_isObject(_rest.showTime)) {
|
73
76
|
_rest.showTime = Object.assign(_defaultShowTime, _rest.showTime);
|
74
77
|
}
|
75
78
|
return _jsx(_DatePicker, _objectSpread(_objectSpread(_objectSpread({}, initialConfig), {}, {
|
@@ -2,10 +2,10 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import "antd/es/input/style";
|
3
3
|
import _Input from "antd/es/input";
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
5
|
+
import _omit from "lodash/omit";
|
5
6
|
var _excluded = ["label", "form", "placeholder", "fieldName", "otherProps", "desensitization"];
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
8
|
import React from 'react';
|
8
|
-
import { omit } from 'lodash';
|
9
9
|
import { useProConfig } from '../../../../ProConfigProvider';
|
10
10
|
import Container from '../../Container';
|
11
11
|
import locale from '../../../../locale';
|
@@ -49,7 +49,7 @@ var Input = function Input(props) {
|
|
49
49
|
allowClear: true,
|
50
50
|
autoComplete: "off",
|
51
51
|
placeholder: placeholder || "".concat(locale.ProForm.inputPlaceholder)
|
52
|
-
},
|
52
|
+
}, _omit(initialConfig, ['trim', 'upperCase'])), rest));
|
53
53
|
// 仅查看模式下进行数据脱敏
|
54
54
|
if ((desensitization === null || desensitization === void 0 ? void 0 : desensitization.length) && (props === null || props === void 0 ? void 0 : props.disabled)) {
|
55
55
|
var _isDesensit = sessionStorage.getItem(otherProps === null || otherProps === void 0 ? void 0 : otherProps.desensitizationKey);
|
@@ -62,7 +62,7 @@ var Input = function Input(props) {
|
|
62
62
|
allowClear: true,
|
63
63
|
autoComplete: 'off',
|
64
64
|
placeholder: placeholder || "".concat(locale.ProForm.inputPlaceholder)
|
65
|
-
},
|
65
|
+
}, _omit(initialConfig, ['trim', 'upperCase'])), rest), {}, {
|
66
66
|
value: maskStringRangeWithRegex(rest.value, desensitization)
|
67
67
|
}));
|
68
68
|
}
|
@@ -6,13 +6,15 @@ import _Space from "antd/es/space";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
8
8
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
9
|
+
import _isUndefined from "lodash/isUndefined";
|
10
|
+
import _isNumber from "lodash/isNumber";
|
11
|
+
import _isNull from "lodash/isNull";
|
9
12
|
var _excluded = ["placeholder", "className", "otherProps", "range", "min", "max", "onBlur", "onFocus"];
|
10
13
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
11
14
|
import { useMemo, useRef } from 'react';
|
12
15
|
import classNames from 'classnames';
|
13
16
|
import Big from 'big.js';
|
14
17
|
import { tools } from '@zat-design/utils';
|
15
|
-
import { isNull, isNumber, isUndefined } from 'lodash';
|
16
18
|
import { useProConfig } from '../../../../ProConfigProvider';
|
17
19
|
import Container from '../../Container';
|
18
20
|
import { getDecimalDigits } from '../../../utils/index';
|
@@ -172,7 +174,7 @@ var InputNumber = function InputNumber(props) {
|
|
172
174
|
var value = rest.value,
|
173
175
|
precision = rest.precision;
|
174
176
|
// 值为空时返回viewEmpty
|
175
|
-
if (
|
177
|
+
if (_isNull(value) || _isUndefined(value)) {
|
176
178
|
return _jsx(_Fragment, {
|
177
179
|
children: viewEmpty
|
178
180
|
});
|
@@ -195,7 +197,7 @@ var InputNumber = function InputNumber(props) {
|
|
195
197
|
}
|
196
198
|
return _jsx(Container, {
|
197
199
|
viewEmpty: viewEmpty,
|
198
|
-
children: Big(value).toNumber().toFixed(
|
200
|
+
children: Big(value).toNumber().toFixed(_isNumber(precision) ? precision : 2)
|
199
201
|
});
|
200
202
|
// 千分比
|
201
203
|
case 'permillage':
|
@@ -213,7 +215,7 @@ var InputNumber = function InputNumber(props) {
|
|
213
215
|
}
|
214
216
|
return _jsx(Container, {
|
215
217
|
viewEmpty: viewEmpty,
|
216
|
-
children: Big(value).toNumber().toFixed(
|
218
|
+
children: Big(value).toNumber().toFixed(_isNumber(precision) ? precision : 2)
|
217
219
|
});
|
218
220
|
// 千分位
|
219
221
|
case 'amount':
|
@@ -3,11 +3,15 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
4
|
import "antd/es/date-picker/style";
|
5
5
|
import _DatePicker from "antd/es/date-picker";
|
6
|
+
import _uniq from "lodash/uniq";
|
7
|
+
import _omit from "lodash/omit";
|
8
|
+
import _isString from "lodash/isString";
|
9
|
+
import _isObject from "lodash/isObject";
|
10
|
+
import _isFunction from "lodash/isFunction";
|
6
11
|
var _excluded = ["format", "otherProps", "separator", "range"];
|
7
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
8
13
|
// @ts-check
|
9
14
|
|
10
|
-
import { isFunction, isObject, isString, omit, uniq } from 'lodash';
|
11
15
|
import moment from 'moment';
|
12
16
|
import { useProConfig } from '../../../../ProConfigProvider';
|
13
17
|
import ProForm from '../../../../ProForm';
|
@@ -44,15 +48,15 @@ var RangePicker = function RangePicker(props) {
|
|
44
48
|
}
|
45
49
|
}
|
46
50
|
// 字符串时间格式兼容
|
47
|
-
if (Array.isArray(_rest.value) &&
|
51
|
+
if (Array.isArray(_rest.value) && _isString(_rest.value[0]) && _isString(_rest.value[1])) {
|
48
52
|
_rest.value = [moment(_rest.value[0]), moment(_rest.value[1])];
|
49
53
|
}
|
50
54
|
var _viewFormat = Array.isArray(format) ? format[0] : format;
|
51
55
|
var tempFormat = Array.isArray(format) ? format : [format];
|
52
|
-
if (
|
56
|
+
if (_isFunction(format)) {
|
53
57
|
tempFormat = [];
|
54
58
|
}
|
55
|
-
var _format =
|
59
|
+
var _format = _uniq([].concat(_toConsumableArray(tempFormat), ['YYYY-MM-DD', 'YYYYMMDD', 'YYYY/MM/DD', 'YYYY_MM_DD', 'YYYY.MM.DD'])).filter(function (formatKey) {
|
56
60
|
return !!formatKey;
|
57
61
|
});
|
58
62
|
var _defaultShowTime = {
|
@@ -66,13 +70,13 @@ var RangePicker = function RangePicker(props) {
|
|
66
70
|
viewChildren = null;
|
67
71
|
} else if (Array.isArray(format)) {
|
68
72
|
var formattedList = format.map(function (formatItem, index) {
|
69
|
-
if (
|
73
|
+
if (_isFunction(formatItem)) {
|
70
74
|
return formatItem(value[index]);
|
71
75
|
}
|
72
76
|
return value[index].format(formatItem);
|
73
77
|
});
|
74
78
|
viewChildren = formattedList.join(separator);
|
75
|
-
} else if (
|
79
|
+
} else if (_isFunction(format)) {
|
76
80
|
viewChildren = "".concat(format(value[0]), " ").concat(separator, " ").concat(format(value[1]));
|
77
81
|
} else {
|
78
82
|
viewChildren = "".concat(value[0].format(_viewFormat), " ").concat(separator, " ").concat(value[1].format(_viewFormat));
|
@@ -85,10 +89,10 @@ var RangePicker = function RangePicker(props) {
|
|
85
89
|
if (_rest.showTime === true) {
|
86
90
|
_rest.showTime = _objectSpread({}, _defaultShowTime);
|
87
91
|
}
|
88
|
-
if (
|
92
|
+
if (_isObject(_rest.showTime)) {
|
89
93
|
_rest.showTime = Object.assign(_defaultShowTime, _rest.showTime);
|
90
94
|
}
|
91
|
-
return _jsx(AntRangePicker, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, initialConfig),
|
95
|
+
return _jsx(AntRangePicker, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, initialConfig), _omit(_rest, ['separator'])), rangeRegulator), {}, {
|
92
96
|
format: _format
|
93
97
|
}));
|
94
98
|
};
|