@antdv-vue/pro-utils 0.0.0-stage → 2.1.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/CHANGELOG.md +123 -0
- package/README.md +80 -2
- package/dist/autoFocusToFirstChild/index.d.ts +9 -0
- package/dist/autoFocusToFirstChild/index.js +36 -0
- package/dist/childrenToArray/index.d.ts +7 -0
- package/dist/childrenToArray/index.js +8 -0
- package/dist/components/CopyToClipboard/copy/index.d.ts +10 -0
- package/dist/components/CopyToClipboard/copy/index.js +84 -0
- package/dist/components/CopyToClipboard/copy/toggle-selection.d.ts +4 -0
- package/dist/components/CopyToClipboard/copy/toggle-selection.js +27 -0
- package/dist/components/CopyToClipboard/index.d.ts +14 -0
- package/dist/components/CopyToClipboard/index.js +13 -0
- package/dist/components/Draggable/Draggable.d.ts +62 -0
- package/dist/components/Draggable/Draggable.js +162 -0
- package/dist/components/Draggable/DraggableCore.d.ts +40 -0
- package/dist/components/Draggable/DraggableCore.js +149 -0
- package/dist/components/Draggable/index.d.ts +4 -0
- package/dist/components/Draggable/index.js +3 -0
- package/dist/components/Draggable/types.d.ts +30 -0
- package/dist/components/Draggable/types.js +1 -0
- package/dist/components/Draggable/utils/domFns.d.ts +36 -0
- package/dist/components/Draggable/utils/domFns.js +165 -0
- package/dist/components/Draggable/utils/getPrefix.d.ts +6 -0
- package/dist/components/Draggable/utils/getPrefix.js +31 -0
- package/dist/components/Draggable/utils/positionFns.d.ts +13 -0
- package/dist/components/Draggable/utils/positionFns.js +96 -0
- package/dist/components/Draggable/utils/shims.d.ts +7 -0
- package/dist/components/Draggable/utils/shims.js +19 -0
- package/dist/components/DropdownFooter/index.d.ts +20 -0
- package/dist/components/DropdownFooter/index.js +80 -0
- package/dist/components/DropdownFooter/style/index.d.ts +8 -0
- package/dist/components/DropdownFooter/style/index.js +18 -0
- package/dist/components/ErrorBoundary/index.d.ts +25 -0
- package/dist/components/ErrorBoundary/index.js +65 -0
- package/dist/components/FieldLabel/index.d.ts +31 -0
- package/dist/components/FieldLabel/index.js +212 -0
- package/dist/components/FieldLabel/style/index.d.ts +8 -0
- package/dist/components/FieldLabel/style/index.js +146 -0
- package/dist/components/FilterDropdown/index.d.ts +38 -0
- package/dist/components/FilterDropdown/index.js +91 -0
- package/dist/components/FilterDropdown/style/index.d.ts +8 -0
- package/dist/components/FilterDropdown/style/index.js +21 -0
- package/dist/components/FormItem/FormItemInput.d.ts +34 -0
- package/dist/components/FormItem/FormItemInput.js +163 -0
- package/dist/components/FormItem/ItemHolder.d.ts +58 -0
- package/dist/components/FormItem/ItemHolder.js +289 -0
- package/dist/components/FormItem/index.d.ts +64 -0
- package/dist/components/FormItem/index.js +591 -0
- package/dist/components/FormList/Field.d.ts +29 -0
- package/dist/components/FormList/Field.js +106 -0
- package/dist/components/FormList/FieldContext.d.ts +15 -0
- package/dist/components/FormList/FieldContext.js +11 -0
- package/dist/components/FormList/InternalField.d.ts +51 -0
- package/dist/components/FormList/InternalField.js +149 -0
- package/dist/components/FormList/ListContext.d.ts +12 -0
- package/dist/components/FormList/ListContext.js +11 -0
- package/dist/components/FormList/index.d.ts +36 -0
- package/dist/components/FormList/index.js +145 -0
- package/dist/components/FormList/interface.d.ts +9 -0
- package/dist/components/FormList/interface.js +1 -0
- package/dist/components/FormList/namePathType.d.ts +9 -0
- package/dist/components/FormList/namePathType.js +1 -0
- package/dist/components/FormList/utils/index.d.ts +15 -0
- package/dist/components/FormList/utils/index.js +37 -0
- package/dist/components/InlineErrorFormItem/InlineErrorFormItemPopover.d.ts +21 -0
- package/dist/components/InlineErrorFormItem/InlineErrorFormItemPopover.js +95 -0
- package/dist/components/InlineErrorFormItem/index.d.ts +14 -0
- package/dist/components/InlineErrorFormItem/index.js +44 -0
- package/dist/components/InlineErrorFormItem/style/index.d.ts +8 -0
- package/dist/components/InlineErrorFormItem/style/index.js +46 -0
- package/dist/components/LabelIconTip/index.d.ts +16 -0
- package/dist/components/LabelIconTip/index.js +79 -0
- package/dist/components/LabelIconTip/style/index.d.ts +8 -0
- package/dist/components/LabelIconTip/style/index.js +38 -0
- package/dist/components/ProFormContext/index.d.ts +51 -0
- package/dist/components/ProFormContext/index.js +11 -0
- package/dist/conversionMomentValue/index.d.ts +48 -0
- package/dist/conversionMomentValue/index.js +103 -0
- package/dist/dateArrayFormatter/index.d.ts +14 -0
- package/dist/dateArrayFormatter/index.js +38 -0
- package/dist/deepMerge/index.d.ts +4 -0
- package/dist/deepMerge/index.js +17 -0
- package/dist/genCopyable/index.d.ts +27 -0
- package/dist/genCopyable/index.js +82 -0
- package/dist/getFieldPropsOrFormItemProps/index.d.ts +18 -0
- package/dist/getFieldPropsOrFormItemProps/index.js +15 -0
- package/dist/getSlot/index.d.ts +8 -0
- package/dist/getSlot/index.js +11 -0
- package/dist/hooks/index.d.ts +9 -0
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/useDebounceFn/index.d.ts +12 -0
- package/dist/hooks/useDebounceFn/index.js +34 -0
- package/dist/hooks/useDebounceValue/index.d.ts +12 -0
- package/dist/hooks/useDebounceValue/index.js +21 -0
- package/dist/hooks/useDocumentTitle/index.d.ts +10 -0
- package/dist/hooks/useDocumentTitle/index.js +12 -0
- package/dist/hooks/useEffect/index.d.ts +6 -0
- package/dist/hooks/useEffect/index.js +17 -0
- package/dist/hooks/useFetchData/index.d.ts +12 -0
- package/dist/hooks/useFetchData/index.js +35 -0
- package/dist/hooks/useLayoutEffect/index.d.ts +6 -0
- package/dist/hooks/useLayoutEffect/index.js +21 -0
- package/dist/hooks/useMemo/index.d.ts +6 -0
- package/dist/hooks/useMemo/index.js +13 -0
- package/dist/hooks/useState/index.d.ts +6 -0
- package/dist/hooks/useState/index.js +11 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +58 -0
- package/dist/isBrowser/index.d.ts +4 -0
- package/dist/isBrowser/index.js +8 -0
- package/dist/isDropdownValueType/index.d.ts +4 -0
- package/dist/isDropdownValueType/index.js +8 -0
- package/dist/isImg/index.d.ts +5 -0
- package/dist/isImg/index.js +7 -0
- package/dist/isNil/index.d.ts +4 -0
- package/dist/isNil/index.js +6 -0
- package/dist/isUrl/index.d.ts +9 -0
- package/dist/isUrl/index.js +17 -0
- package/dist/merge/index.d.ts +9 -0
- package/dist/merge/index.js +20 -0
- package/dist/nanoid/index.d.ts +9 -0
- package/dist/nanoid/index.js +25 -0
- package/dist/normalizeProps/index.d.ts +6 -0
- package/dist/normalizeProps/index.js +6 -0
- package/dist/omitBoolean/index.d.ts +9 -0
- package/dist/omitBoolean/index.js +11 -0
- package/dist/omitUndefined/index.d.ts +5 -0
- package/dist/omitUndefined/index.js +11 -0
- package/dist/omitUndefinedAndEmptyArr/index.d.ts +4 -0
- package/dist/omitUndefinedAndEmptyArr/index.js +12 -0
- package/dist/parseValueToDay/index.d.ts +7 -0
- package/dist/parseValueToDay/index.js +21 -0
- package/dist/pickProFormItemProps/index.d.ts +34 -0
- package/dist/pickProFormItemProps/index.js +42 -0
- package/dist/pickProProps/index.d.ts +4 -0
- package/dist/pickProProps/index.js +14 -0
- package/dist/pro-utils.esm.js +3672 -0
- package/dist/proFieldParsingText/index.d.ts +25 -0
- package/dist/proFieldParsingText/index.js +100 -0
- package/dist/runFunction/index.d.ts +5 -0
- package/dist/runFunction/index.js +8 -0
- package/dist/stringify/index.d.ts +7 -0
- package/dist/stringify/index.js +10 -0
- package/dist/transformBooleanProps/index.d.ts +4 -0
- package/dist/transformBooleanProps/index.js +9 -0
- package/dist/transformKeySubmitValue/index.d.ts +24 -0
- package/dist/transformKeySubmitValue/index.js +200 -0
- package/dist/transformVueNodeType/index.d.ts +14 -0
- package/dist/transformVueNodeType/index.js +14 -0
- package/dist/typing.d.ts +562 -0
- package/dist/typing.js +1 -0
- package/dist/useEditableArray/components/CancelEditableAction.d.ts +47 -0
- package/dist/useEditableArray/components/CancelEditableAction.js +90 -0
- package/dist/useEditableArray/components/DeleteEditableAction.d.ts +33 -0
- package/dist/useEditableArray/components/DeleteEditableAction.js +63 -0
- package/dist/useEditableArray/components/SaveEditableAction.d.ts +33 -0
- package/dist/useEditableArray/components/SaveEditableAction.js +79 -0
- package/dist/useEditableArray/index.d.ts +66 -0
- package/dist/useEditableArray/index.js +584 -0
- package/dist/useEditableArray/typing.d.ts +130 -0
- package/dist/useEditableArray/typing.js +1 -0
- package/dist/useEditableMap/index.d.ts +32 -0
- package/dist/useEditableMap/index.js +147 -0
- package/dist/useMediaQuery/index.d.ts +44 -0
- package/dist/useMediaQuery/index.js +99 -0
- package/dist/useMediaQuery/query.d.ts +6 -0
- package/dist/useMediaQuery/query.js +17 -0
- package/dist/useMountMergeState/index.d.ts +11 -0
- package/dist/useMountMergeState/index.js +26 -0
- package/dist/usePrevious/index.d.ts +6 -0
- package/dist/usePrevious/index.js +11 -0
- package/dist/useRefFunction/index.d.ts +4 -0
- package/dist/useRefFunction/index.js +11 -0
- package/package.json +69 -3
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { VueNode } from "../typing.js";
|
|
2
|
+
import { TooltipProps } from "antdv-next";
|
|
3
|
+
import { FormItemTooltipType } from "antdv-next/dist/form/FormItemLabel";
|
|
4
|
+
|
|
5
|
+
//#region src/genCopyable/index.d.ts
|
|
6
|
+
interface ProEllipsisTooltip {
|
|
7
|
+
showTitle?: boolean;
|
|
8
|
+
tooltip?: TooltipProps;
|
|
9
|
+
}
|
|
10
|
+
type ProEllipsis = ProEllipsisTooltip | boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 生成 Copyable 或 Ellipsis 的 dom
|
|
13
|
+
* @param {T} dom 渲染后的 DOM 节点
|
|
14
|
+
* @param {object} item 列配置
|
|
15
|
+
* @param {boolean} item.copyable
|
|
16
|
+
* @param {ProEllipsis} item.ellipsis
|
|
17
|
+
* @param {FormItemTooltipType} item.tooltip
|
|
18
|
+
* @param {string} text renderText 的返回值,可能是 string/number 或 React 元素
|
|
19
|
+
* @param {AntVueNode} copyText 用于复制的原始文本,当 renderText 返回 JSX 时避免复制 [object Object]
|
|
20
|
+
*/
|
|
21
|
+
declare function genCopyable(dom: VueNode, item: {
|
|
22
|
+
copyable?: boolean;
|
|
23
|
+
ellipsis?: ProEllipsis;
|
|
24
|
+
tooltip?: FormItemTooltipType;
|
|
25
|
+
}, text: VueNode, copyText?: VueNode): VueNode;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { ProEllipsis, ProEllipsisTooltip, genCopyable };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createVNode, isVNode } from "vue";
|
|
2
|
+
import { TypographyText } from "antdv-next";
|
|
3
|
+
import { isObject } from "@v-c/util/dist/utils/set";
|
|
4
|
+
//#region src/genCopyable/index.tsx
|
|
5
|
+
function _isSlot(s) {
|
|
6
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
7
|
+
}
|
|
8
|
+
function isNeedTranText(item) {
|
|
9
|
+
if (item?.valueType?.toString().startsWith("date")) return true;
|
|
10
|
+
return !!(item?.valueType === "select" || item?.valueEnum);
|
|
11
|
+
}
|
|
12
|
+
function getEllipsis(item) {
|
|
13
|
+
if (typeof item.ellipsis !== "boolean" && item.ellipsis?.showTitle === false) return false;
|
|
14
|
+
return item.ellipsis;
|
|
15
|
+
}
|
|
16
|
+
function normalizeCopyText(text) {
|
|
17
|
+
return text === null || text === void 0 ? "" : String(text).trimEnd();
|
|
18
|
+
}
|
|
19
|
+
function genEllipsis(dom, item, text, rawText) {
|
|
20
|
+
const ellipsis = getEllipsis(item);
|
|
21
|
+
if (!ellipsis) return false;
|
|
22
|
+
/** 有些 valueType 需要设置copy的为string */
|
|
23
|
+
const needTranText = isNeedTranText(item);
|
|
24
|
+
const isRenderTextReturningJsx = isVNode(rawText);
|
|
25
|
+
if ((needTranText || isRenderTextReturningJsx) && item?.tooltip !== false) {
|
|
26
|
+
const tooltipTitle = createVNode("div", { "class": "pro-table-tooltip-text" }, [dom]);
|
|
27
|
+
if (typeof ellipsis !== "boolean" && isObject(ellipsis.tooltip)) return { tooltip: {
|
|
28
|
+
title: tooltipTitle,
|
|
29
|
+
...ellipsis.tooltip
|
|
30
|
+
} };
|
|
31
|
+
return { tooltip: tooltipTitle };
|
|
32
|
+
}
|
|
33
|
+
if (!text) return false;
|
|
34
|
+
if (typeof ellipsis !== "boolean" && isObject(ellipsis) && isObject(ellipsis.tooltip)) return { tooltip: {
|
|
35
|
+
title: text,
|
|
36
|
+
...ellipsis.tooltip
|
|
37
|
+
} };
|
|
38
|
+
return { tooltip: text };
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 生成 Copyable 或 Ellipsis 的 dom
|
|
42
|
+
* @param {T} dom 渲染后的 DOM 节点
|
|
43
|
+
* @param {object} item 列配置
|
|
44
|
+
* @param {boolean} item.copyable
|
|
45
|
+
* @param {ProEllipsis} item.ellipsis
|
|
46
|
+
* @param {FormItemTooltipType} item.tooltip
|
|
47
|
+
* @param {string} text renderText 的返回值,可能是 string/number 或 React 元素
|
|
48
|
+
* @param {AntVueNode} copyText 用于复制的原始文本,当 renderText 返回 JSX 时避免复制 [object Object]
|
|
49
|
+
*/
|
|
50
|
+
function genCopyable(dom, item, text, copyText) {
|
|
51
|
+
if (!item.copyable && !item.ellipsis) return dom;
|
|
52
|
+
const normalizedText = normalizeCopyText(text);
|
|
53
|
+
const resolvedCopyText = copyText !== void 0 ? normalizeCopyText(copyText) : normalizedText;
|
|
54
|
+
const ellipsis = genEllipsis(dom, item, normalizedText, text);
|
|
55
|
+
if (item.copyable) return createVNode("span", { "style": {
|
|
56
|
+
display: "inline-flex",
|
|
57
|
+
alignItems: "center",
|
|
58
|
+
maxWidth: "100%"
|
|
59
|
+
} }, [createVNode(TypographyText, {
|
|
60
|
+
"ellipsis": ellipsis,
|
|
61
|
+
"style": {
|
|
62
|
+
flex: 1,
|
|
63
|
+
minWidth: 0,
|
|
64
|
+
margin: 0,
|
|
65
|
+
padding: 0
|
|
66
|
+
},
|
|
67
|
+
"copyable": resolvedCopyText ? {
|
|
68
|
+
text: resolvedCopyText,
|
|
69
|
+
tooltips: ["", ""]
|
|
70
|
+
} : false
|
|
71
|
+
}, _isSlot(dom) ? dom : { default: () => [dom] })]);
|
|
72
|
+
return createVNode(TypographyText, {
|
|
73
|
+
"style": {
|
|
74
|
+
width: "100%",
|
|
75
|
+
margin: 0,
|
|
76
|
+
padding: 0
|
|
77
|
+
},
|
|
78
|
+
"ellipsis": ellipsis
|
|
79
|
+
}, _isSlot(dom) ? dom : { default: () => [dom] });
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { genCopyable };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ProFormInstanceType } from "../components/ProFormContext/index.js";
|
|
2
|
+
import { FormInstance } from "antdv-next";
|
|
3
|
+
|
|
4
|
+
//#region src/getFieldPropsOrFormItemProps/index.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* 因为 fieldProps 支持了 function 所以新增了这个方法
|
|
7
|
+
*
|
|
8
|
+
* @param fieldProps
|
|
9
|
+
* @param form
|
|
10
|
+
* @param extraProps
|
|
11
|
+
*/
|
|
12
|
+
declare function getFieldPropsOrFormItemProps(fieldProps: any, form?: (ProFormInstanceType<any> & FormInstance) | null, extraProps?: any): {
|
|
13
|
+
onChange: any;
|
|
14
|
+
colSize: number;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { getFieldPropsOrFormItemProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { runFunction } from "../runFunction/index.js";
|
|
2
|
+
//#region src/getFieldPropsOrFormItemProps/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* 因为 fieldProps 支持了 function 所以新增了这个方法
|
|
5
|
+
*
|
|
6
|
+
* @param fieldProps
|
|
7
|
+
* @param form
|
|
8
|
+
* @param extraProps
|
|
9
|
+
*/
|
|
10
|
+
function getFieldPropsOrFormItemProps(fieldProps, form, extraProps) {
|
|
11
|
+
if (form === void 0) return fieldProps;
|
|
12
|
+
return runFunction(fieldProps, form, extraProps);
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getFieldPropsOrFormItemProps };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { VueNode } from "../typing.js";
|
|
2
|
+
import { Slots } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/getSlot/index.d.ts
|
|
5
|
+
declare function getSlotVNode<T>(slots: Slots, props: Record<string, unknown>, prop?: string): T | false;
|
|
6
|
+
declare function getSlot<T extends Record<string, any>, K extends keyof T>(slots: T, props: Partial<Record<K, T[K] | VueNode>>, prop: K): T[K] | false | undefined;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { getSlot, getSlotVNode };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/getSlot/index.ts
|
|
2
|
+
function getSlotVNode(slots, props, prop = "default") {
|
|
3
|
+
if (props[prop] === false) return false;
|
|
4
|
+
return props[prop] || slots[prop]?.();
|
|
5
|
+
}
|
|
6
|
+
function getSlot(slots, props, prop) {
|
|
7
|
+
if (props[prop] === false) return false;
|
|
8
|
+
return props[prop] || slots[prop];
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { getSlot, getSlotVNode };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useMemo } from "./useMemo/index.js";
|
|
2
|
+
import { useEffect } from "./useEffect/index.js";
|
|
3
|
+
import { useLayoutEffect } from "./useLayoutEffect/index.js";
|
|
4
|
+
import { useState } from "./useState/index.js";
|
|
5
|
+
import { useDebounceFn } from "./useDebounceFn/index.js";
|
|
6
|
+
import { ProRequestData, useFetchData } from "./useFetchData/index.js";
|
|
7
|
+
import { useDebounceValue } from "./useDebounceValue/index.js";
|
|
8
|
+
import { useDocumentTitle } from "./useDocumentTitle/index.js";
|
|
9
|
+
export { type ProRequestData, useDebounceFn, useDebounceValue, useDocumentTitle, useEffect, useFetchData, useLayoutEffect, useMemo, useState };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useMemo } from "./useMemo/index.js";
|
|
2
|
+
import { useEffect } from "./useEffect/index.js";
|
|
3
|
+
import { useLayoutEffect } from "./useLayoutEffect/index.js";
|
|
4
|
+
import { useState } from "./useState/index.js";
|
|
5
|
+
import { useDebounceFn } from "./useDebounceFn/index.js";
|
|
6
|
+
import { useFetchData } from "./useFetchData/index.js";
|
|
7
|
+
import { useDebounceValue } from "./useDebounceValue/index.js";
|
|
8
|
+
import { useDocumentTitle } from "./useDocumentTitle/index.js";
|
|
9
|
+
export { useDebounceFn, useDebounceValue, useDocumentTitle, useEffect, useFetchData, useLayoutEffect, useMemo, useState };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/hooks/useDebounceFn/index.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* 一个去抖的 hook,传入一个 function,返回一个去抖后的 function
|
|
4
|
+
* @param fn
|
|
5
|
+
* @param wait
|
|
6
|
+
*/
|
|
7
|
+
declare function useDebounceFn<T extends any[], U = any>(fn: (...args: T) => Promise<any>, wait?: number): {
|
|
8
|
+
run: (...args: T) => Promise<U | undefined>;
|
|
9
|
+
cancel: () => void;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { useDebounceFn };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { onUnmounted, ref } from "vue";
|
|
2
|
+
//#region src/hooks/useDebounceFn/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* 一个去抖的 hook,传入一个 function,返回一个去抖后的 function
|
|
5
|
+
* @param fn
|
|
6
|
+
* @param wait
|
|
7
|
+
*/
|
|
8
|
+
function useDebounceFn(fn, wait) {
|
|
9
|
+
const timer = ref(null);
|
|
10
|
+
const cancel = () => {
|
|
11
|
+
if (timer.value !== null) {
|
|
12
|
+
clearTimeout(timer.value);
|
|
13
|
+
timer.value = null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const run = async (...args) => {
|
|
17
|
+
if (wait === 0 || wait === void 0) return fn(...args);
|
|
18
|
+
cancel();
|
|
19
|
+
return new Promise((resolve) => {
|
|
20
|
+
timer.value = setTimeout(async () => {
|
|
21
|
+
resolve(await fn(...args));
|
|
22
|
+
}, wait);
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
onUnmounted(() => {
|
|
26
|
+
cancel();
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
run,
|
|
30
|
+
cancel
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { useDebounceFn };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Ref } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/hooks/useDebounceValue/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* 一个去抖的setState 减少更新的频率
|
|
6
|
+
* @param value
|
|
7
|
+
* @param delay
|
|
8
|
+
* @param deps
|
|
9
|
+
*/
|
|
10
|
+
declare function useDebounceValue<T>(value: T, delay?: number, deps?: readonly unknown[]): Ref<T>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { useDebounceValue };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useEffect } from "../useEffect/index.js";
|
|
2
|
+
import { useState } from "../useState/index.js";
|
|
3
|
+
import { ref } from "vue";
|
|
4
|
+
//#region src/hooks/useDebounceValue/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* 一个去抖的setState 减少更新的频率
|
|
7
|
+
* @param value
|
|
8
|
+
* @param delay
|
|
9
|
+
* @param deps
|
|
10
|
+
*/
|
|
11
|
+
function useDebounceValue(value, delay = 100, deps) {
|
|
12
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
13
|
+
const valueRef = ref(value);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const handler = setTimeout(() => setDebouncedValue(valueRef.value), delay);
|
|
16
|
+
return () => clearTimeout(handler);
|
|
17
|
+
}, deps ? [() => delay, ...deps] : void 0);
|
|
18
|
+
return debouncedValue;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { useDebounceValue };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComputedRef } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/hooks/useDocumentTitle/index.d.ts
|
|
4
|
+
declare function useDocumentTitle(titleInfo: ComputedRef<{
|
|
5
|
+
title: string;
|
|
6
|
+
id: string;
|
|
7
|
+
pageName?: string;
|
|
8
|
+
}>, appDefaultTitle: ComputedRef<string | false>): void;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { useDocumentTitle };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useEffect } from "../useEffect/index.js";
|
|
2
|
+
import { isBrowser } from "../../isBrowser/index.js";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
//#region src/hooks/useDocumentTitle/index.ts
|
|
5
|
+
function useDocumentTitle(titleInfo, appDefaultTitle) {
|
|
6
|
+
const titleText = computed(() => typeof titleInfo.value.pageName === "string" ? titleInfo.value.title : appDefaultTitle.value);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (isBrowser() && titleText.value) document.title = titleText.value;
|
|
9
|
+
}, [() => titleInfo.value.title, () => titleText.value]);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { useDocumentTitle };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/hooks/useEffect/index.d.ts
|
|
2
|
+
type CleanupFunction = () => void;
|
|
3
|
+
type EffectCallback = () => void | CleanupFunction;
|
|
4
|
+
declare function useEffect(effect: EffectCallback, dependencies?: readonly unknown[]): void;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { EffectCallback, useEffect };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
2
|
+
//#region src/hooks/useEffect/index.ts
|
|
3
|
+
function useEffect(effect, dependencies) {
|
|
4
|
+
const cleanupRef = ref();
|
|
5
|
+
const executeEffect = async () => {
|
|
6
|
+
if (cleanupRef.value) cleanupRef.value();
|
|
7
|
+
await nextTick();
|
|
8
|
+
cleanupRef.value = effect();
|
|
9
|
+
};
|
|
10
|
+
onMounted(executeEffect);
|
|
11
|
+
if (dependencies && dependencies.length > 0) watch(dependencies, executeEffect);
|
|
12
|
+
onBeforeUnmount(() => {
|
|
13
|
+
if (cleanupRef.value) cleanupRef.value();
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { useEffect };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Key } from "../../typing.js";
|
|
2
|
+
import { Ref } from "vue";
|
|
3
|
+
|
|
4
|
+
//#region src/hooks/useFetchData/index.d.ts
|
|
5
|
+
type ProRequestData<T, U = Record<string, any>> = (params: U, props: any) => Promise<T>;
|
|
6
|
+
declare function useFetchData<T, U = Record<string, any>>(props: {
|
|
7
|
+
proFieldKey?: Ref<Key>;
|
|
8
|
+
params: Ref<U | undefined>;
|
|
9
|
+
request?: ProRequestData<T, U>;
|
|
10
|
+
}): [Ref<T | undefined>, Ref<boolean>];
|
|
11
|
+
//#endregion
|
|
12
|
+
export { ProRequestData, useFetchData };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useState } from "../useState/index.js";
|
|
2
|
+
import { stringify } from "../../stringify/index.js";
|
|
3
|
+
import { ref, shallowRef } from "vue";
|
|
4
|
+
import useSWRV from "swrv";
|
|
5
|
+
//#region src/hooks/useFetchData/index.ts
|
|
6
|
+
let testId = 0;
|
|
7
|
+
function useFetchData(props) {
|
|
8
|
+
const abortRef = shallowRef(null);
|
|
9
|
+
/** Key 是用来缓存请求的,如果不在是有问题 */
|
|
10
|
+
const [cacheKey] = useState(() => {
|
|
11
|
+
if (props.proFieldKey?.value) return props.proFieldKey.value.toString();
|
|
12
|
+
testId += 1;
|
|
13
|
+
return testId.toString();
|
|
14
|
+
});
|
|
15
|
+
const fetchData = async () => {
|
|
16
|
+
abortRef.value?.abort();
|
|
17
|
+
const abort = new AbortController();
|
|
18
|
+
abortRef.value = abort;
|
|
19
|
+
try {
|
|
20
|
+
if (!props.request) return;
|
|
21
|
+
return await props.request(props.params?.value, abort.signal);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (error.name === "AbortError") return;
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const { data, isValidating } = useSWRV(() => props.request ? `${cacheKey.value}-${stringify(props.params?.value)}` : null, fetchData, {
|
|
28
|
+
revalidateOnFocus: false,
|
|
29
|
+
shouldRetryOnError: false
|
|
30
|
+
});
|
|
31
|
+
if (!props.request) return [ref(void 0), ref(false)];
|
|
32
|
+
return [data, isValidating];
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { useFetchData };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/hooks/useLayoutEffect/index.d.ts
|
|
2
|
+
type CleanupFunction = () => void;
|
|
3
|
+
type EffectCallback = () => void | CleanupFunction;
|
|
4
|
+
declare function useLayoutEffect(effect: EffectCallback, dependencies?: readonly unknown[]): void;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { useLayoutEffect };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
2
|
+
//#region src/hooks/useLayoutEffect/index.ts
|
|
3
|
+
function useLayoutEffect(effect, dependencies) {
|
|
4
|
+
const cleanupRef = ref();
|
|
5
|
+
const executeEffect = () => {
|
|
6
|
+
if (cleanupRef.value) cleanupRef.value();
|
|
7
|
+
cleanupRef.value = effect();
|
|
8
|
+
};
|
|
9
|
+
onMounted(() => {
|
|
10
|
+
executeEffect();
|
|
11
|
+
});
|
|
12
|
+
if (dependencies && dependencies.length > 0) watch(dependencies, executeEffect, {
|
|
13
|
+
flush: "post",
|
|
14
|
+
deep: false
|
|
15
|
+
});
|
|
16
|
+
onBeforeUnmount(() => {
|
|
17
|
+
if (cleanupRef.value) cleanupRef.value();
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { useLayoutEffect };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Ref, WatchSource } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/hooks/useMemo/index.d.ts
|
|
4
|
+
declare function useMemo<T>(getValue: () => T, condition: (WatchSource<unknown> | object)[], shouldUpdate?: (prev: any[], next: any[]) => boolean): Ref<T, T>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { useMemo };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ref, watch } from "vue";
|
|
2
|
+
//#region src/hooks/useMemo/index.ts
|
|
3
|
+
function useMemo(getValue, condition, shouldUpdate) {
|
|
4
|
+
const cacheRef = ref(getValue());
|
|
5
|
+
watch(condition, (next, pre) => {
|
|
6
|
+
if (shouldUpdate) {
|
|
7
|
+
if (shouldUpdate(next, pre)) cacheRef.value = getValue();
|
|
8
|
+
} else cacheRef.value = getValue();
|
|
9
|
+
});
|
|
10
|
+
return cacheRef;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { useMemo };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
//#region src/hooks/useState/index.ts
|
|
3
|
+
function useState(defaultStateValue) {
|
|
4
|
+
const innerValue = ref(typeof defaultStateValue === "function" ? defaultStateValue() : defaultStateValue);
|
|
5
|
+
function triggerChange(newValue) {
|
|
6
|
+
innerValue.value = newValue;
|
|
7
|
+
}
|
|
8
|
+
return [innerValue, triggerChange];
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { useState };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { autoFocusToFirstChild } from "./autoFocusToFirstChild/index.js";
|
|
2
|
+
import { childrenToArray, isSpecialNode } from "./childrenToArray/index.js";
|
|
3
|
+
import CopyToClipboard from "./components/CopyToClipboard/index.js";
|
|
4
|
+
import { Bounds, ControlPosition, DraggableData, DraggableEvent, DraggableEventHandler, EventHandler, MouseTouchEvent, PositionOffsetControlPosition } from "./components/Draggable/types.js";
|
|
5
|
+
import DraggableCore, { DraggableCoreProps } from "./components/Draggable/DraggableCore.js";
|
|
6
|
+
import Draggable, { DraggableProps } from "./components/Draggable/Draggable.js";
|
|
7
|
+
import { ActionRenderConfig, ActionRenderFunction, ActionTypeText, AddLineOptions, NewLineConfig, RecordKey, RowEditableConfig, RowEditableType, SaveEditableActionRef } from "./useEditableArray/typing.js";
|
|
8
|
+
import { recordKeyToString } from "./useEditableArray/components/CancelEditableAction.js";
|
|
9
|
+
import { UseEditableType, UseEditableUtilType, defaultActionRender, editableRowByKey, useEditableArray } from "./useEditableArray/index.js";
|
|
10
|
+
import { CommomProFieldProps, Key, PageInfo, ProCoreActionType, ProFieldRequestData, ProFieldTextType, ProFieldValueEnumType, ProFieldValueObject, ProFieldValueObjectType, ProFieldValueType, ProFieldValueTypeWithFieldProps, ProFormBaseGroupProps, ProSchema, ProSchemaComponentTypes, ProSchemaFieldProps, ProSchemaValueEnumMap, ProSchemaValueEnumObj, ProTableEditableFnType, RequestOptionsType, SearchConvertKeyFn, SearchTransformKeyFn, Value, ValuePair, ValueTypeWithFieldProps, VueNode, WithFalse } from "./typing.js";
|
|
11
|
+
import DropdownFooter from "./components/DropdownFooter/index.js";
|
|
12
|
+
import ErrorBoundary from "./components/ErrorBoundary/index.js";
|
|
13
|
+
import FieldLabel from "./components/FieldLabel/index.js";
|
|
14
|
+
import FilterDropdown from "./components/FilterDropdown/index.js";
|
|
15
|
+
import FormItem, { FormItemProps } from "./components/FormItem/index.js";
|
|
16
|
+
import { FieldContextProps, useFormFieldContextInject, useFormFieldContextProvider } from "./components/FormList/FieldContext.js";
|
|
17
|
+
import FormList, { FormListFieldData, FormListOperation, FormListProps } from "./components/FormList/index.js";
|
|
18
|
+
import { defaultGetValueFromEvent } from "./components/FormList/utils/index.js";
|
|
19
|
+
import InlineErrorFormItem from "./components/InlineErrorFormItem/index.js";
|
|
20
|
+
import LabelIconTip from "./components/LabelIconTip/index.js";
|
|
21
|
+
import { ProFormInstanceType, useProFormContextInject, useProFormContextProvider } from "./components/ProFormContext/index.js";
|
|
22
|
+
import { conversionMomentValue, convertMoment, dateFormatterMap, isPlainObject } from "./conversionMomentValue/index.js";
|
|
23
|
+
import { dateArrayFormatter } from "./dateArrayFormatter/index.js";
|
|
24
|
+
import { deepMerge } from "./deepMerge/index.js";
|
|
25
|
+
import { genCopyable } from "./genCopyable/index.js";
|
|
26
|
+
import { getFieldPropsOrFormItemProps } from "./getFieldPropsOrFormItemProps/index.js";
|
|
27
|
+
import { getSlot, getSlotVNode } from "./getSlot/index.js";
|
|
28
|
+
import { useMemo } from "./hooks/useMemo/index.js";
|
|
29
|
+
import { useEffect } from "./hooks/useEffect/index.js";
|
|
30
|
+
import { useLayoutEffect } from "./hooks/useLayoutEffect/index.js";
|
|
31
|
+
import { useState } from "./hooks/useState/index.js";
|
|
32
|
+
import { useDebounceFn } from "./hooks/useDebounceFn/index.js";
|
|
33
|
+
import { ProRequestData, useFetchData } from "./hooks/useFetchData/index.js";
|
|
34
|
+
import { useDebounceValue } from "./hooks/useDebounceValue/index.js";
|
|
35
|
+
import { useDocumentTitle } from "./hooks/useDocumentTitle/index.js";
|
|
36
|
+
import { isBrowser } from "./isBrowser/index.js";
|
|
37
|
+
import { isImg } from "./isImg/index.js";
|
|
38
|
+
import { isNil } from "./isNil/index.js";
|
|
39
|
+
import { isUrl } from "./isUrl/index.js";
|
|
40
|
+
import { isDropdownValueType } from "./isDropdownValueType/index.js";
|
|
41
|
+
import { omitUndefined } from "./omitUndefined/index.js";
|
|
42
|
+
import { useMountMergeState } from "./useMountMergeState/index.js";
|
|
43
|
+
import { parseValueToDay } from "./parseValueToDay/index.js";
|
|
44
|
+
import { merge } from "./merge/index.js";
|
|
45
|
+
import { nanoid } from "./nanoid/index.js";
|
|
46
|
+
import { omitBoolean } from "./omitBoolean/index.js";
|
|
47
|
+
import { omitUndefinedAndEmptyArr } from "./omitUndefinedAndEmptyArr/index.js";
|
|
48
|
+
import { normalizeProps } from "./normalizeProps/index.js";
|
|
49
|
+
import { pickProFormItemProps } from "./pickProFormItemProps/index.js";
|
|
50
|
+
import { pickProProps } from "./pickProProps/index.js";
|
|
51
|
+
import { ProFieldBadgeColor, objectToMap, proFieldParsingText } from "./proFieldParsingText/index.js";
|
|
52
|
+
import { runFunction } from "./runFunction/index.js";
|
|
53
|
+
import { configure, stringify } from "./stringify/index.js";
|
|
54
|
+
import { DataFormatMapType, isPlainObj, transformKeySubmitValue } from "./transformKeySubmitValue/index.js";
|
|
55
|
+
import { UseEditableMapType, UseEditableMapUtilType, useEditableMap } from "./useEditableMap/index.js";
|
|
56
|
+
import { usePrevious } from "./usePrevious/index.js";
|
|
57
|
+
import { useRefFunction } from "./useRefFunction/index.js";
|
|
58
|
+
import { transformBooleanProps } from "./transformBooleanProps/index.js";
|
|
59
|
+
import { transformVueNodeType } from "./transformVueNodeType/index.js";
|
|
60
|
+
import { useMedia } from "./useMediaQuery/index.js";
|
|
61
|
+
export { ActionRenderConfig, ActionRenderFunction, ActionTypeText, AddLineOptions, Bounds, CommomProFieldProps, ControlPosition, CopyToClipboard, DataFormatMapType, Draggable, DraggableCore, DraggableCoreProps, DraggableData, DraggableEvent, DraggableEventHandler, DraggableProps, DropdownFooter, ErrorBoundary, EventHandler, type FieldContextProps, FieldLabel, FilterDropdown, FormItem, type FormItemProps, FormList, type FormListFieldData, type FormListOperation, type FormListProps, InlineErrorFormItem, Key, LabelIconTip, MouseTouchEvent, NewLineConfig, PageInfo, PositionOffsetControlPosition, ProCoreActionType, ProFieldBadgeColor, ProFieldRequestData, ProFieldTextType, ProFieldValueEnumType, ProFieldValueObject, ProFieldValueObjectType, ProFieldValueType, ProFieldValueTypeWithFieldProps, ProFormBaseGroupProps, type ProFormInstanceType, ProRequestData, ProSchema, ProSchemaComponentTypes, ProSchemaFieldProps, ProSchemaValueEnumMap, ProSchemaValueEnumObj, ProTableEditableFnType, RecordKey, RequestOptionsType, RowEditableConfig, RowEditableType, SaveEditableActionRef, SearchConvertKeyFn, SearchTransformKeyFn, UseEditableMapType, UseEditableMapUtilType, UseEditableType, UseEditableUtilType, Value, ValuePair, ValueTypeWithFieldProps, VueNode, WithFalse, autoFocusToFirstChild, childrenToArray, configure, conversionMomentValue, convertMoment, dateArrayFormatter, dateFormatterMap, deepMerge, defaultActionRender, defaultGetValueFromEvent, editableRowByKey, genCopyable, getFieldPropsOrFormItemProps, getSlot, getSlotVNode, isBrowser, isDropdownValueType, isImg, isNil, isPlainObj, isPlainObject, isSpecialNode, isUrl, merge, nanoid, normalizeProps, objectToMap, omitBoolean, omitUndefined, omitUndefinedAndEmptyArr, parseValueToDay, pickProFormItemProps, pickProProps, proFieldParsingText, recordKeyToString, runFunction, stringify, transformBooleanProps, transformKeySubmitValue, transformVueNodeType, useMedia as useBreakpoint, useDebounceFn, useDebounceValue, useDocumentTitle, useEditableArray, useEditableMap, useEffect, useFetchData, useFormFieldContextInject, useFormFieldContextProvider, useLayoutEffect, useMemo, useMountMergeState, usePrevious, useProFormContextInject, useProFormContextProvider, useRefFunction, useState };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useMemo } from "./hooks/useMemo/index.js";
|
|
2
|
+
import { useEffect } from "./hooks/useEffect/index.js";
|
|
3
|
+
import { useLayoutEffect } from "./hooks/useLayoutEffect/index.js";
|
|
4
|
+
import { useState } from "./hooks/useState/index.js";
|
|
5
|
+
import { useDebounceFn } from "./hooks/useDebounceFn/index.js";
|
|
6
|
+
import { configure, stringify } from "./stringify/index.js";
|
|
7
|
+
import { useFetchData } from "./hooks/useFetchData/index.js";
|
|
8
|
+
import { useDebounceValue } from "./hooks/useDebounceValue/index.js";
|
|
9
|
+
import { isBrowser } from "./isBrowser/index.js";
|
|
10
|
+
import { useDocumentTitle } from "./hooks/useDocumentTitle/index.js";
|
|
11
|
+
import { isImg } from "./isImg/index.js";
|
|
12
|
+
import { isNil } from "./isNil/index.js";
|
|
13
|
+
import { isUrl } from "./isUrl/index.js";
|
|
14
|
+
import { isDropdownValueType } from "./isDropdownValueType/index.js";
|
|
15
|
+
import { getSlot, getSlotVNode } from "./getSlot/index.js";
|
|
16
|
+
import { omitUndefined } from "./omitUndefined/index.js";
|
|
17
|
+
import { useMountMergeState } from "./useMountMergeState/index.js";
|
|
18
|
+
import { parseValueToDay } from "./parseValueToDay/index.js";
|
|
19
|
+
import { conversionMomentValue, convertMoment, dateFormatterMap, isPlainObject } from "./conversionMomentValue/index.js";
|
|
20
|
+
import { dateArrayFormatter } from "./dateArrayFormatter/index.js";
|
|
21
|
+
import { deepMerge } from "./deepMerge/index.js";
|
|
22
|
+
import { runFunction } from "./runFunction/index.js";
|
|
23
|
+
import { getFieldPropsOrFormItemProps } from "./getFieldPropsOrFormItemProps/index.js";
|
|
24
|
+
import { merge } from "./merge/index.js";
|
|
25
|
+
import { nanoid } from "./nanoid/index.js";
|
|
26
|
+
import { omitBoolean } from "./omitBoolean/index.js";
|
|
27
|
+
import { omitUndefinedAndEmptyArr } from "./omitUndefinedAndEmptyArr/index.js";
|
|
28
|
+
import { normalizeProps } from "./normalizeProps/index.js";
|
|
29
|
+
import { pickProFormItemProps } from "./pickProFormItemProps/index.js";
|
|
30
|
+
import { pickProProps } from "./pickProProps/index.js";
|
|
31
|
+
import { ProFieldBadgeColor, objectToMap, proFieldParsingText } from "./proFieldParsingText/index.js";
|
|
32
|
+
import { autoFocusToFirstChild } from "./autoFocusToFirstChild/index.js";
|
|
33
|
+
import { isPlainObj, transformKeySubmitValue } from "./transformKeySubmitValue/index.js";
|
|
34
|
+
import { usePrevious } from "./usePrevious/index.js";
|
|
35
|
+
import { useProFormContextInject, useProFormContextProvider } from "./components/ProFormContext/index.js";
|
|
36
|
+
import { recordKeyToString } from "./useEditableArray/components/CancelEditableAction.js";
|
|
37
|
+
import { defaultActionRender, editableRowByKey, useEditableArray } from "./useEditableArray/index.js";
|
|
38
|
+
import { useEditableMap } from "./useEditableMap/index.js";
|
|
39
|
+
import { childrenToArray, isSpecialNode } from "./childrenToArray/index.js";
|
|
40
|
+
import { useRefFunction } from "./useRefFunction/index.js";
|
|
41
|
+
import { transformBooleanProps } from "./transformBooleanProps/index.js";
|
|
42
|
+
import { transformVueNodeType } from "./transformVueNodeType/index.js";
|
|
43
|
+
import { genCopyable } from "./genCopyable/index.js";
|
|
44
|
+
import DraggableCore from "./components/Draggable/DraggableCore.js";
|
|
45
|
+
import Draggable from "./components/Draggable/Draggable.js";
|
|
46
|
+
import { useMedia } from "./useMediaQuery/index.js";
|
|
47
|
+
import ErrorBoundary from "./components/ErrorBoundary/index.js";
|
|
48
|
+
import CopyToClipboard from "./components/CopyToClipboard/index.js";
|
|
49
|
+
import FieldLabel from "./components/FieldLabel/index.js";
|
|
50
|
+
import LabelIconTip from "./components/LabelIconTip/index.js";
|
|
51
|
+
import { useFormFieldContextInject, useFormFieldContextProvider } from "./components/FormList/FieldContext.js";
|
|
52
|
+
import { defaultGetValueFromEvent } from "./components/FormList/utils/index.js";
|
|
53
|
+
import FormList from "./components/FormList/index.js";
|
|
54
|
+
import DropdownFooter from "./components/DropdownFooter/index.js";
|
|
55
|
+
import FormItem from "./components/FormItem/index.js";
|
|
56
|
+
import InlineErrorFormItem from "./components/InlineErrorFormItem/index.js";
|
|
57
|
+
import FilterDropdown from "./components/FilterDropdown/index.js";
|
|
58
|
+
export { CopyToClipboard, Draggable, DraggableCore, DropdownFooter, ErrorBoundary, FieldLabel, FilterDropdown, FormItem, FormList, InlineErrorFormItem, LabelIconTip, ProFieldBadgeColor, autoFocusToFirstChild, childrenToArray, configure, conversionMomentValue, convertMoment, dateArrayFormatter, dateFormatterMap, deepMerge, defaultActionRender, defaultGetValueFromEvent, editableRowByKey, genCopyable, getFieldPropsOrFormItemProps, getSlot, getSlotVNode, isBrowser, isDropdownValueType, isImg, isNil, isPlainObj, isPlainObject, isSpecialNode, isUrl, merge, nanoid, normalizeProps, objectToMap, omitBoolean, omitUndefined, omitUndefinedAndEmptyArr, parseValueToDay, pickProFormItemProps, pickProProps, proFieldParsingText, recordKeyToString, runFunction, stringify, transformBooleanProps, transformKeySubmitValue, transformVueNodeType, useMedia as useBreakpoint, useDebounceFn, useDebounceValue, useDocumentTitle, useEditableArray, useEditableMap, useEffect, useFetchData, useFormFieldContextInject, useFormFieldContextProvider, useLayoutEffect, useMemo, useMountMergeState, usePrevious, useProFormContextInject, useProFormContextProvider, useRefFunction, useState };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/isBrowser/index.ts
|
|
2
|
+
const isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
3
|
+
function isBrowser() {
|
|
4
|
+
if (typeof process !== "undefined" && process.env.NODE_ENV === "TEST") return true;
|
|
5
|
+
return typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.matchMedia !== "undefined" && !isNode;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { isBrowser };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/isDropdownValueType/index.ts
|
|
2
|
+
function isDropdownValueType(valueType) {
|
|
3
|
+
let isDropdown = false;
|
|
4
|
+
if (typeof valueType === "string" && valueType.startsWith("date") && !valueType.endsWith("Range") || valueType === "select" || valueType === "time") isDropdown = true;
|
|
5
|
+
return isDropdown;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { isDropdownValueType };
|