@vtx/components 4.0.0-beta.72 → 4.0.0-beta.74
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/README.md +19 -19
- package/es/utils/components/LabelIconTip/index.js +7 -7
- package/es/utils/conversionMomentValue/index.js +25 -25
- package/es/utils/filterSpecialCharacters.js +6 -6
- package/es/utils/genCopyable/index.js +6 -6
- package/es/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/es/utils/hooks/useDebounceFn/index.js +4 -4
- package/es/utils/hooks/useDebounceValue/index.js +6 -6
- package/es/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/es/utils/hooks/useLatest/index.js +2 -2
- package/es/utils/hooks/useRefCallback/index.js +5 -5
- package/es/utils/isBrowser/index.js +7 -7
- package/es/utils/isUrl/index.js +4 -4
- package/es/utils/merge/index.js +4 -4
- package/es/utils/nanoid/index.js +4 -4
- package/es/utils/omitBoolean/index.js +4 -4
- package/es/utils/parseValueToMoment/index.js +4 -4
- package/es/utils/proFieldParsingText/index.js +10 -10
- package/es/utils/transformKeySubmitValue/index.js +57 -57
- package/es/utils/useEditableArray/index.js +46 -46
- package/es/utils/useEditableMap/index.js +22 -22
- package/es/utils/useMediaQuery/index.js +5 -5
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +4 -4
- package/es/vtx-datagrid/style/index.js +17 -17
- package/es/vtx-datagrid/style/index.less +242 -242
- package/es/vtx-date-picker/style/index.less +39 -39
- package/es/vtx-export/index.js +8 -8
- package/es/vtx-icon/index.js1 +90 -90
- package/es/vtx-modal/index.js +2 -2
- package/es/vtx-page-layout/Basic.js +2 -2
- package/es/vtx-page-layout/TabLayout.js +6 -6
- package/es/vtx-page-layout/TableLayout.js +10 -10
- package/es/vtx-page-layout/TreeLayout.js +6 -6
- package/es/vtx-page-layout/container.js +2 -2
- package/es/vtx-provider/index.js +30 -30
- package/es/vtx-provider/intl.js +9 -9
- package/es/vtx-provider/useStyle/index.js +17 -17
- package/es/vtx-split-pane/SplitPane.js +16 -17
- package/es/vtx-wang-editor/style/index.less +12 -12
- package/lib/utils/components/LabelIconTip/index.js +7 -7
- package/lib/utils/conversionMomentValue/index.js +25 -25
- package/lib/utils/filterSpecialCharacters.js +6 -6
- package/lib/utils/genCopyable/index.js +6 -6
- package/lib/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/lib/utils/hooks/useDebounceFn/index.js +4 -4
- package/lib/utils/hooks/useDebounceValue/index.js +6 -6
- package/lib/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/lib/utils/hooks/useLatest/index.js +2 -2
- package/lib/utils/hooks/useRefCallback/index.js +5 -5
- package/lib/utils/isBrowser/index.js +7 -7
- package/lib/utils/isUrl/index.js +4 -4
- package/lib/utils/merge/index.js +4 -4
- package/lib/utils/nanoid/index.js +4 -4
- package/lib/utils/omitBoolean/index.js +4 -4
- package/lib/utils/parseValueToMoment/index.js +4 -4
- package/lib/utils/proFieldParsingText/index.js +10 -10
- package/lib/utils/transformKeySubmitValue/index.js +57 -57
- package/lib/utils/useEditableArray/index.js +46 -46
- package/lib/utils/useEditableMap/index.js +22 -22
- package/lib/utils/useMediaQuery/index.js +5 -5
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +4 -4
- package/lib/vtx-datagrid/style/index.js +17 -17
- package/lib/vtx-datagrid/style/index.less +242 -242
- package/lib/vtx-date-picker/style/index.less +39 -39
- package/lib/vtx-export/index.js +8 -8
- package/lib/vtx-icon/index.js1 +90 -90
- package/lib/vtx-modal/index.js +2 -2
- package/lib/vtx-page-layout/Basic.js +2 -2
- package/lib/vtx-page-layout/TabLayout.js +6 -6
- package/lib/vtx-page-layout/TableLayout.js +10 -10
- package/lib/vtx-page-layout/TreeLayout.js +6 -6
- package/lib/vtx-page-layout/container.js +2 -2
- package/lib/vtx-provider/index.js +30 -30
- package/lib/vtx-provider/intl.js +9 -9
- package/lib/vtx-provider/useStyle/index.js +17 -17
- package/lib/vtx-split-pane/SplitPane.js +15 -15
- package/lib/vtx-wang-editor/style/index.less +12 -12
- package/package.json +238 -238
package/README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
# @vtx/components
|
|
2
|
-
|
|
3
|
-
> 公司 PC 端基础组件库
|
|
4
|
-
|
|
5
|
-
## 安装
|
|
6
|
-
|
|
7
|
-
```shell
|
|
8
|
-
$ pnpm add @vtx/components -S
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## 使用
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
import { VtxDatePicker } from '@vtx/components';
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Doc
|
|
18
|
-
|
|
19
|
-
[在线示例文档](http://front-end.pages.cloudhw.cn:8000/react-components/)
|
|
1
|
+
# @vtx/components
|
|
2
|
+
|
|
3
|
+
> 公司 PC 端基础组件库
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
$ pnpm add @vtx/components -S
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import { VtxDatePicker } from '@vtx/components';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Doc
|
|
18
|
+
|
|
19
|
+
[在线示例文档](http://front-end.pages.cloudhw.cn:8000/react-components/)
|
|
@@ -10,13 +10,13 @@ import classnames from 'classnames';
|
|
|
10
10
|
import React, { useContext } from 'react';
|
|
11
11
|
import { useStyle } from "./style";
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* 在 form 的 label 后面增加一个 tips 来展示一些说明文案
|
|
15
|
-
* @param {Object} props
|
|
16
|
-
* @param {React.ReactNode} props.label
|
|
17
|
-
* @param {React.ReactNode} [props.subTitle]
|
|
18
|
-
* @param {string|Object} [props.tooltip]
|
|
19
|
-
* @param {boolean|Object} [props.ellipsis]
|
|
13
|
+
/**
|
|
14
|
+
* 在 form 的 label 后面增加一个 tips 来展示一些说明文案
|
|
15
|
+
* @param {Object} props
|
|
16
|
+
* @param {React.ReactNode} props.label
|
|
17
|
+
* @param {React.ReactNode} [props.subTitle]
|
|
18
|
+
* @param {string|Object} [props.tooltip]
|
|
19
|
+
* @param {boolean|Object} [props.ellipsis]
|
|
20
20
|
*/
|
|
21
21
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -17,19 +17,19 @@ var dateFormatterMap = {
|
|
|
17
17
|
dateTimeRange: 'YYYY-MM-DD HH:mm:ss'
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* 判断是不是一个 object
|
|
22
|
-
* @param {any} o
|
|
23
|
-
* @returns boolean
|
|
20
|
+
/**
|
|
21
|
+
* 判断是不是一个 object
|
|
22
|
+
* @param {any} o
|
|
23
|
+
* @returns boolean
|
|
24
24
|
*/
|
|
25
25
|
function isObject(o) {
|
|
26
26
|
return Object.prototype.toString.call(o) === '[object Object]';
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* 判断是否是一个的简单的 object
|
|
31
|
-
* @param {{constructor:any}} o
|
|
32
|
-
* @returns boolean
|
|
29
|
+
/**
|
|
30
|
+
* 判断是否是一个的简单的 object
|
|
31
|
+
* @param {{constructor:any}} o
|
|
32
|
+
* @returns boolean
|
|
33
33
|
*/
|
|
34
34
|
export function isPlainObject(o) {
|
|
35
35
|
if (isObject(o) === false) return false;
|
|
@@ -51,20 +51,20 @@ export function isPlainObject(o) {
|
|
|
51
51
|
return true;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
/**
|
|
55
|
-
* 一个比较hack的moment判断工具
|
|
56
|
-
* @param {any} value
|
|
57
|
-
* @returns boolean
|
|
54
|
+
/**
|
|
55
|
+
* 一个比较hack的moment判断工具
|
|
56
|
+
* @param {any} value
|
|
57
|
+
* @returns boolean
|
|
58
58
|
*/
|
|
59
59
|
var isMoment = function isMoment(value) {
|
|
60
60
|
return !!(value !== null && value !== void 0 && value._isAMomentObject);
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
/**
|
|
64
|
-
* 根据不同的格式转化 dayjs
|
|
65
|
-
* @param {dayjs.Dayjs} value
|
|
66
|
-
* @param {string|((value:dayjs.Dayjs} dateFormatter
|
|
67
|
-
* @param {string} valueType
|
|
63
|
+
/**
|
|
64
|
+
* 根据不同的格式转化 dayjs
|
|
65
|
+
* @param {dayjs.Dayjs} value
|
|
66
|
+
* @param {string|((value:dayjs.Dayjs} dateFormatter
|
|
67
|
+
* @param {string} valueType
|
|
68
68
|
*/
|
|
69
69
|
export var convertMoment = function convertMoment(value, dateFormatter, valueType) {
|
|
70
70
|
if (!dateFormatter) {
|
|
@@ -87,14 +87,14 @@ export var convertMoment = function convertMoment(value, dateFormatter, valueTyp
|
|
|
87
87
|
return value;
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
/**
|
|
91
|
-
* 这里主要是来转化一下数据 将 dayjs 转化为 string 将 all 默认删除
|
|
92
|
-
* @param {T} value
|
|
93
|
-
* @param {DateFormatter} dateFormatter
|
|
94
|
-
* @param {Record<string} valueTypeMap
|
|
95
|
-
* @param {ProFieldValueType;dateFormat:string;}|any>} |{valueType
|
|
96
|
-
* @param {boolean} omitNil?
|
|
97
|
-
* @param {NamePath} parentKey?
|
|
90
|
+
/**
|
|
91
|
+
* 这里主要是来转化一下数据 将 dayjs 转化为 string 将 all 默认删除
|
|
92
|
+
* @param {T} value
|
|
93
|
+
* @param {DateFormatter} dateFormatter
|
|
94
|
+
* @param {Record<string} valueTypeMap
|
|
95
|
+
* @param {ProFieldValueType;dateFormat:string;}|any>} |{valueType
|
|
96
|
+
* @param {boolean} omitNil?
|
|
97
|
+
* @param {NamePath} parentKey?
|
|
98
98
|
*/
|
|
99
99
|
export var conversionMomentValue = function conversionMomentValue(value, dateFormatter, valueTypeMap, omitNil, parentKey) {
|
|
100
100
|
var tmpValue = {};
|
|
@@ -55,12 +55,12 @@ export var SpecialCharacters = [
|
|
|
55
55
|
'%', '%',
|
|
56
56
|
// 其它
|
|
57
57
|
'@', '#', '`', '~', '*', '^', '……', '|', '&'];
|
|
58
|
-
/**
|
|
59
|
-
* 过滤特殊字符
|
|
60
|
-
* @param {String} value 值
|
|
61
|
-
* @param {Object} option
|
|
62
|
-
* @param {Array} [option.include] 新增
|
|
63
|
-
* @param {Array} [option.exclude] 排除
|
|
58
|
+
/**
|
|
59
|
+
* 过滤特殊字符
|
|
60
|
+
* @param {String} value 值
|
|
61
|
+
* @param {Object} option
|
|
62
|
+
* @param {Array} [option.include] 新增
|
|
63
|
+
* @param {Array} [option.exclude] 排除
|
|
64
64
|
*/
|
|
65
65
|
export default function filterSpecialCharacters(value) {
|
|
66
66
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
@@ -19,12 +19,12 @@ var getEllipsis = function getEllipsis(item) {
|
|
|
19
19
|
return item.ellipsis;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* 生成 Copyable 或 Ellipsis 的 dom
|
|
24
|
-
*
|
|
25
|
-
* @param dom
|
|
26
|
-
* @param item
|
|
27
|
-
* @param text
|
|
22
|
+
/**
|
|
23
|
+
* 生成 Copyable 或 Ellipsis 的 dom
|
|
24
|
+
*
|
|
25
|
+
* @param dom
|
|
26
|
+
* @param item
|
|
27
|
+
* @param text
|
|
28
28
|
*/
|
|
29
29
|
export var genCopyable = function genCopyable(dom, item, text) {
|
|
30
30
|
if (item.copyable || item.ellipsis) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { runFunction } from "../runFunction";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* 因为 fieldProps 支持了 function 所以新增了这个方法
|
|
5
|
-
*
|
|
6
|
-
* @param {any} fieldProps
|
|
7
|
-
* @param {any} [form]
|
|
8
|
-
* @param {any} [extraProps]
|
|
9
|
-
* @returns {Record<string, any> & { onChange: any, colSize: number }}
|
|
3
|
+
/**
|
|
4
|
+
* 因为 fieldProps 支持了 function 所以新增了这个方法
|
|
5
|
+
*
|
|
6
|
+
* @param {any} fieldProps
|
|
7
|
+
* @param {any} [form]
|
|
8
|
+
* @param {any} [extraProps]
|
|
9
|
+
* @returns {Record<string, any> & { onChange: any, colSize: number }}
|
|
10
10
|
*/
|
|
11
11
|
export var getFieldPropsOrFormItemProps = function getFieldPropsOrFormItemProps(fieldProps, form, extraProps) {
|
|
12
12
|
if (form === undefined) {
|
|
@@ -4,10 +4,10 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
4
4
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
5
|
import { useCallback, useEffect, useRef } from 'react';
|
|
6
6
|
import { useRefFunction } from "../useRefFunction";
|
|
7
|
-
/**
|
|
8
|
-
* 一个去抖的 hook,传入一个 function,返回一个去抖后的 function
|
|
9
|
-
* @param {(...args:T) => Promise<any>} fn
|
|
10
|
-
* @param {number} wait?
|
|
7
|
+
/**
|
|
8
|
+
* 一个去抖的 hook,传入一个 function,返回一个去抖后的 function
|
|
9
|
+
* @param {(...args:T) => Promise<any>} fn
|
|
10
|
+
* @param {number} wait?
|
|
11
11
|
*/
|
|
12
12
|
export function useDebounceFn(fn, wait) {
|
|
13
13
|
var callback = useRefFunction(fn);
|
|
@@ -11,12 +11,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
11
11
|
import { useEffect, useState } from 'react';
|
|
12
12
|
import { useLatest } from "../useLatest";
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* 一个去抖的setState,减少更新的频率
|
|
16
|
-
* @param {any} value
|
|
17
|
-
* @param {number} [delay=100]
|
|
18
|
-
* @param {any[]} deps
|
|
19
|
-
* @returns {any}
|
|
14
|
+
/**
|
|
15
|
+
* 一个去抖的setState,减少更新的频率
|
|
16
|
+
* @param {any} value
|
|
17
|
+
* @param {number} [delay=100]
|
|
18
|
+
* @param {any[]} deps
|
|
19
|
+
* @returns {any}
|
|
20
20
|
*/
|
|
21
21
|
export function useDebounceValue(value) {
|
|
22
22
|
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useDeepCompareMemoize } from "../useDeepCompareEffect";
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* `useDeepCompareMemo` will only recompute the memoized value when one of the
|
|
6
|
-
* `deps` has changed.
|
|
7
|
-
*
|
|
8
|
-
* Usage note: only use this if `deps` are objects or arrays that contain
|
|
9
|
-
* objects. Otherwise you should just use React.useMemo.
|
|
10
|
-
*
|
|
4
|
+
/**
|
|
5
|
+
* `useDeepCompareMemo` will only recompute the memoized value when one of the
|
|
6
|
+
* `deps` has changed.
|
|
7
|
+
*
|
|
8
|
+
* Usage note: only use this if `deps` are objects or arrays that contain
|
|
9
|
+
* objects. Otherwise you should just use React.useMemo.
|
|
10
|
+
*
|
|
11
11
|
*/
|
|
12
12
|
function useDeepCompareMemo(factory, dependencies) {
|
|
13
13
|
return React.useMemo(factory, useDeepCompareMemoize(dependencies));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRef } from 'react';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @see https://github.com/streamich/react-use/blob/master/docs/useLatest.md
|
|
3
|
+
/**
|
|
4
|
+
* @see https://github.com/streamich/react-use/blob/master/docs/useLatest.md
|
|
5
5
|
*/
|
|
6
6
|
export var useLatest = function useLatest(value) {
|
|
7
7
|
var ref = useRef(value);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* useRefCallback
|
|
5
|
-
* @param {Function} callback ref.current 变化时触发
|
|
6
|
-
* @param {any} [initialValue] 初始值
|
|
7
|
-
* @returns {Object} 代理后的 ref 对象
|
|
3
|
+
/**
|
|
4
|
+
* useRefCallback
|
|
5
|
+
* @param {Function} callback ref.current 变化时触发
|
|
6
|
+
* @param {any} [initialValue] 初始值
|
|
7
|
+
* @returns {Object} 代理后的 ref 对象
|
|
8
8
|
*/
|
|
9
9
|
export function useRefCallback(callback, initialValue) {
|
|
10
10
|
var ref = useMemo(function () {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* 用于判断当前是否在浏览器环境中。
|
|
5
|
-
* 首先会判断当前是否处于测试环境中(通过 process.env.NODE_ENV === 'TEST' 判断),
|
|
6
|
-
* 如果是,则返回 true。否则,会进一步判断是否存在 window 对象、document 对象以及 matchMedia 方法
|
|
7
|
-
* 同时通过 !isNode 判断当前不是在服务器(Node.js)环境下执行,
|
|
8
|
-
* 如果都符合,则返回 true 表示当前处于浏览器环境中。
|
|
9
|
-
* @returns boolean
|
|
3
|
+
/**
|
|
4
|
+
* 用于判断当前是否在浏览器环境中。
|
|
5
|
+
* 首先会判断当前是否处于测试环境中(通过 process.env.NODE_ENV === 'TEST' 判断),
|
|
6
|
+
* 如果是,则返回 true。否则,会进一步判断是否存在 window 对象、document 对象以及 matchMedia 方法
|
|
7
|
+
* 同时通过 !isNode 判断当前不是在服务器(Node.js)环境下执行,
|
|
8
|
+
* 如果都符合,则返回 true 表示当前处于浏览器环境中。
|
|
9
|
+
* @returns boolean
|
|
10
10
|
*/
|
|
11
11
|
export var isBrowser = function isBrowser() {
|
|
12
12
|
if (typeof process !== 'undefined' && process.env.NODE_ENV === 'TEST') {
|
package/es/utils/isUrl/index.js
CHANGED
package/es/utils/merge/index.js
CHANGED
|
@@ -6,10 +6,10 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
6
6
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
7
7
|
/* eslint-disable prefer-rest-params */
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* 用于合并 n 个对象
|
|
11
|
-
* @param {any[]} ...rest
|
|
12
|
-
* @returns T
|
|
9
|
+
/**
|
|
10
|
+
* 用于合并 n 个对象
|
|
11
|
+
* @param {any[]} ...rest
|
|
12
|
+
* @returns T
|
|
13
13
|
*/
|
|
14
14
|
var merge = function merge() {
|
|
15
15
|
var obj = {};
|
package/es/utils/nanoid/index.js
CHANGED
|
@@ -15,10 +15,10 @@ var genNanoid = function genNanoid() {
|
|
|
15
15
|
return e;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* 生成uuid,如果不支持 randomUUID,就用 genNanoid
|
|
20
|
-
*
|
|
21
|
-
* @returns string
|
|
18
|
+
/**
|
|
19
|
+
* 生成uuid,如果不支持 randomUUID,就用 genNanoid
|
|
20
|
+
*
|
|
21
|
+
* @returns string
|
|
22
22
|
*/
|
|
23
23
|
export var nanoid = function nanoid() {
|
|
24
24
|
if (typeof window === 'undefined') return genNanoid();
|
|
@@ -3,10 +3,10 @@ import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
|
3
3
|
import { isNil } from "../isNil";
|
|
4
4
|
dayjs.extend(customParseFormat);
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* 一个比较hack的moment判断工具
|
|
8
|
-
* @param value
|
|
9
|
-
* @returns
|
|
6
|
+
/**
|
|
7
|
+
* 一个比较hack的moment判断工具
|
|
8
|
+
* @param value
|
|
9
|
+
* @returns
|
|
10
10
|
*/
|
|
11
11
|
var isMoment = function isMoment(value) {
|
|
12
12
|
return !!(value !== null && value !== void 0 && value._isAMomentObject);
|
|
@@ -2,10 +2,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
2
|
import { Badge, Space } from 'antd';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* 获取类型的 type
|
|
7
|
-
*
|
|
8
|
-
* @param obj
|
|
5
|
+
/**
|
|
6
|
+
* 获取类型的 type
|
|
7
|
+
*
|
|
8
|
+
* @param obj
|
|
9
9
|
*/
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
function getType(obj) {
|
|
@@ -103,12 +103,12 @@ var TableStatus = {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
-
/**
|
|
107
|
-
* 转化 text 和 valueEnum 通过 type 来添加 Status
|
|
108
|
-
*
|
|
109
|
-
* @param text
|
|
110
|
-
* @param valueEnum
|
|
111
|
-
* @param pure 纯净模式,不增加 status
|
|
106
|
+
/**
|
|
107
|
+
* 转化 text 和 valueEnum 通过 type 来添加 Status
|
|
108
|
+
*
|
|
109
|
+
* @param text
|
|
110
|
+
* @param valueEnum
|
|
111
|
+
* @param pure 纯净模式,不增加 status
|
|
112
112
|
*/
|
|
113
113
|
export var proFieldParsingText = function proFieldParsingText(text, valueEnumParams, key) {
|
|
114
114
|
if (Array.isArray(text)) {
|
|
@@ -10,12 +10,12 @@ import { get } from '@rc-component/util';
|
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { isNil } from "../isNil";
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* 判断一个值是否为普通对象(可以被遍历的对象)
|
|
15
|
-
* 暂时还不支持 Set 和 Map 结构
|
|
16
|
-
*
|
|
17
|
-
* @param itemValue - 要检查的值
|
|
18
|
-
* @returns 如果是普通对象返回 true,否则返回 false
|
|
13
|
+
/**
|
|
14
|
+
* 判断一个值是否为普通对象(可以被遍历的对象)
|
|
15
|
+
* 暂时还不支持 Set 和 Map 结构
|
|
16
|
+
*
|
|
17
|
+
* @param itemValue - 要检查的值
|
|
18
|
+
* @returns 如果是普通对象返回 true,否则返回 false
|
|
19
19
|
*/
|
|
20
20
|
export function isPlainObj(itemValue) {
|
|
21
21
|
// 如果不是对象类型,直接返回 false
|
|
@@ -40,12 +40,12 @@ export function isPlainObj(itemValue) {
|
|
|
40
40
|
return true;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
/**
|
|
44
|
-
* 将点号路径字符串转换为路径数组
|
|
45
|
-
* 例如: 'users.0.name' => ['users', 0, 'name']
|
|
46
|
-
*
|
|
47
|
-
* @param dotPath - 点号分隔的路径字符串
|
|
48
|
-
* @returns 路径数组,数字会被转换为数字类型
|
|
43
|
+
/**
|
|
44
|
+
* 将点号路径字符串转换为路径数组
|
|
45
|
+
* 例如: 'users.0.name' => ['users', 0, 'name']
|
|
46
|
+
*
|
|
47
|
+
* @param dotPath - 点号分隔的路径字符串
|
|
48
|
+
* @returns 路径数组,数字会被转换为数字类型
|
|
49
49
|
*/
|
|
50
50
|
function parseDotPath(dotPath) {
|
|
51
51
|
return dotPath.split('.').map(function (segment) {
|
|
@@ -54,11 +54,11 @@ function parseDotPath(dotPath) {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
/**
|
|
58
|
-
* 过滤掉空值的转换配置
|
|
59
|
-
*
|
|
60
|
-
* @param dataFormatMapRaw - 原始转换配置
|
|
61
|
-
* @returns 过滤后的转换配置
|
|
57
|
+
/**
|
|
58
|
+
* 过滤掉空值的转换配置
|
|
59
|
+
*
|
|
60
|
+
* @param dataFormatMapRaw - 原始转换配置
|
|
61
|
+
* @returns 过滤后的转换配置
|
|
62
62
|
*/
|
|
63
63
|
function filterNilTransforms(dataFormatMapRaw) {
|
|
64
64
|
var filtered = {};
|
|
@@ -71,11 +71,11 @@ function filterNilTransforms(dataFormatMapRaw) {
|
|
|
71
71
|
return filtered;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
/**
|
|
75
|
-
* 将转换配置分为点号路径格式和传统嵌套对象格式
|
|
76
|
-
*
|
|
77
|
-
* @param dataFormatMapRaw - 原始转换配置
|
|
78
|
-
* @returns 包含两种格式转换配置的对象
|
|
74
|
+
/**
|
|
75
|
+
* 将转换配置分为点号路径格式和传统嵌套对象格式
|
|
76
|
+
*
|
|
77
|
+
* @param dataFormatMapRaw - 原始转换配置
|
|
78
|
+
* @returns 包含两种格式转换配置的对象
|
|
79
79
|
*/
|
|
80
80
|
function separateTransformFormats(dataFormatMapRaw) {
|
|
81
81
|
var dotPathTransforms = {};
|
|
@@ -95,12 +95,12 @@ function separateTransformFormats(dataFormatMapRaw) {
|
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
/**
|
|
99
|
-
* 处理点号路径格式的转换
|
|
100
|
-
* 例如: 'users.0.name' => 转换 users[0].name 的值
|
|
101
|
-
*
|
|
102
|
-
* @param result - 要转换的数据对象
|
|
103
|
-
* @param dotPathTransforms - 点号路径转换配置
|
|
98
|
+
/**
|
|
99
|
+
* 处理点号路径格式的转换
|
|
100
|
+
* 例如: 'users.0.name' => 转换 users[0].name 的值
|
|
101
|
+
*
|
|
102
|
+
* @param result - 要转换的数据对象
|
|
103
|
+
* @param dotPathTransforms - 点号路径转换配置
|
|
104
104
|
*/
|
|
105
105
|
function processDotPathTransforms(result, dotPathTransforms) {
|
|
106
106
|
for (var dotPath in dotPathTransforms) {
|
|
@@ -143,13 +143,13 @@ function processDotPathTransforms(result, dotPathTransforms) {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
/**
|
|
147
|
-
* 在嵌套转换配置中查找转换函数
|
|
148
|
-
*
|
|
149
|
-
* @param currentTransforms - 当前转换配置
|
|
150
|
-
* @param parentsKey - 父级路径
|
|
151
|
-
* @param entityKey - 当前实体键
|
|
152
|
-
* @returns 找到的转换函数或 undefined
|
|
146
|
+
/**
|
|
147
|
+
* 在嵌套转换配置中查找转换函数
|
|
148
|
+
*
|
|
149
|
+
* @param currentTransforms - 当前转换配置
|
|
150
|
+
* @param parentsKey - 父级路径
|
|
151
|
+
* @param entityKey - 当前实体键
|
|
152
|
+
* @returns 找到的转换函数或 undefined
|
|
153
153
|
*/
|
|
154
154
|
function findNestedTransformFunction(currentTransforms, parentsKey, entityKey) {
|
|
155
155
|
var nestedTransforms = currentTransforms;
|
|
@@ -177,11 +177,11 @@ function findNestedTransformFunction(currentTransforms, parentsKey, entityKey) {
|
|
|
177
177
|
return undefined;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
/**
|
|
181
|
-
* 检查路径是否包含数组索引
|
|
182
|
-
*
|
|
183
|
-
* @param parentsKey - 父级路径数组
|
|
184
|
-
* @returns 如果包含数组索引返回 true
|
|
180
|
+
/**
|
|
181
|
+
* 检查路径是否包含数组索引
|
|
182
|
+
*
|
|
183
|
+
* @param parentsKey - 父级路径数组
|
|
184
|
+
* @returns 如果包含数组索引返回 true
|
|
185
185
|
*/
|
|
186
186
|
function isInArrayPath(parentsKey) {
|
|
187
187
|
return parentsKey.some(function (key) {
|
|
@@ -189,14 +189,14 @@ function isInArrayPath(parentsKey) {
|
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
/**
|
|
193
|
-
* 递归处理嵌套对象转换(传统格式)
|
|
194
|
-
*
|
|
195
|
-
* @param tempValues - 要处理的值
|
|
196
|
-
* @param parentsKey - 父级路径
|
|
197
|
-
* @param currentTransforms - 当前转换配置
|
|
198
|
-
* @param rootMergeObjects - 存储需要在根级别合并的对象
|
|
199
|
-
* @returns 处理后的结果
|
|
192
|
+
/**
|
|
193
|
+
* 递归处理嵌套对象转换(传统格式)
|
|
194
|
+
*
|
|
195
|
+
* @param tempValues - 要处理的值
|
|
196
|
+
* @param parentsKey - 父级路径
|
|
197
|
+
* @param currentTransforms - 当前转换配置
|
|
198
|
+
* @param rootMergeObjects - 存储需要在根级别合并的对象
|
|
199
|
+
* @returns 处理后的结果
|
|
200
200
|
*/
|
|
201
201
|
function processNestedObjectTransforms(tempValues, parentsKey, currentTransforms, rootMergeObjects) {
|
|
202
202
|
var isArrayValues = Array.isArray(tempValues);
|
|
@@ -271,15 +271,15 @@ function processNestedObjectTransforms(tempValues, parentsKey, currentTransforms
|
|
|
271
271
|
return tempResult;
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
/**
|
|
275
|
-
* 转换提交值中的键名
|
|
276
|
-
* 支持两种格式的转换配置:
|
|
277
|
-
* 1. 点号路径格式:'users.0.name' => 转换嵌套路径的值
|
|
278
|
-
* 2. 传统嵌套对象格式:{ users: { 0: { name: transformFn } } }
|
|
279
|
-
*
|
|
280
|
-
* @param values - 要转换的值对象
|
|
281
|
-
* @param dataFormatMapRaw - 转换配置映射
|
|
282
|
-
* @returns 转换后的值对象
|
|
274
|
+
/**
|
|
275
|
+
* 转换提交值中的键名
|
|
276
|
+
* 支持两种格式的转换配置:
|
|
277
|
+
* 1. 点号路径格式:'users.0.name' => 转换嵌套路径的值
|
|
278
|
+
* 2. 传统嵌套对象格式:{ users: { 0: { name: transformFn } } }
|
|
279
|
+
*
|
|
280
|
+
* @param values - 要转换的值对象
|
|
281
|
+
* @param dataFormatMapRaw - 转换配置映射
|
|
282
|
+
* @returns 转换后的值对象
|
|
283
283
|
*/
|
|
284
284
|
export var transformKeySubmitValue = function transformKeySubmitValue(values, dataFormatMapRaw) {
|
|
285
285
|
// 过滤掉空值的转换配置
|