@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.
Files changed (174) hide show
  1. package/CHANGELOG.md +123 -0
  2. package/README.md +80 -2
  3. package/dist/autoFocusToFirstChild/index.d.ts +9 -0
  4. package/dist/autoFocusToFirstChild/index.js +36 -0
  5. package/dist/childrenToArray/index.d.ts +7 -0
  6. package/dist/childrenToArray/index.js +8 -0
  7. package/dist/components/CopyToClipboard/copy/index.d.ts +10 -0
  8. package/dist/components/CopyToClipboard/copy/index.js +84 -0
  9. package/dist/components/CopyToClipboard/copy/toggle-selection.d.ts +4 -0
  10. package/dist/components/CopyToClipboard/copy/toggle-selection.js +27 -0
  11. package/dist/components/CopyToClipboard/index.d.ts +14 -0
  12. package/dist/components/CopyToClipboard/index.js +13 -0
  13. package/dist/components/Draggable/Draggable.d.ts +62 -0
  14. package/dist/components/Draggable/Draggable.js +162 -0
  15. package/dist/components/Draggable/DraggableCore.d.ts +40 -0
  16. package/dist/components/Draggable/DraggableCore.js +149 -0
  17. package/dist/components/Draggable/index.d.ts +4 -0
  18. package/dist/components/Draggable/index.js +3 -0
  19. package/dist/components/Draggable/types.d.ts +30 -0
  20. package/dist/components/Draggable/types.js +1 -0
  21. package/dist/components/Draggable/utils/domFns.d.ts +36 -0
  22. package/dist/components/Draggable/utils/domFns.js +165 -0
  23. package/dist/components/Draggable/utils/getPrefix.d.ts +6 -0
  24. package/dist/components/Draggable/utils/getPrefix.js +31 -0
  25. package/dist/components/Draggable/utils/positionFns.d.ts +13 -0
  26. package/dist/components/Draggable/utils/positionFns.js +96 -0
  27. package/dist/components/Draggable/utils/shims.d.ts +7 -0
  28. package/dist/components/Draggable/utils/shims.js +19 -0
  29. package/dist/components/DropdownFooter/index.d.ts +20 -0
  30. package/dist/components/DropdownFooter/index.js +80 -0
  31. package/dist/components/DropdownFooter/style/index.d.ts +8 -0
  32. package/dist/components/DropdownFooter/style/index.js +18 -0
  33. package/dist/components/ErrorBoundary/index.d.ts +25 -0
  34. package/dist/components/ErrorBoundary/index.js +65 -0
  35. package/dist/components/FieldLabel/index.d.ts +31 -0
  36. package/dist/components/FieldLabel/index.js +212 -0
  37. package/dist/components/FieldLabel/style/index.d.ts +8 -0
  38. package/dist/components/FieldLabel/style/index.js +146 -0
  39. package/dist/components/FilterDropdown/index.d.ts +38 -0
  40. package/dist/components/FilterDropdown/index.js +91 -0
  41. package/dist/components/FilterDropdown/style/index.d.ts +8 -0
  42. package/dist/components/FilterDropdown/style/index.js +21 -0
  43. package/dist/components/FormItem/FormItemInput.d.ts +34 -0
  44. package/dist/components/FormItem/FormItemInput.js +163 -0
  45. package/dist/components/FormItem/ItemHolder.d.ts +58 -0
  46. package/dist/components/FormItem/ItemHolder.js +289 -0
  47. package/dist/components/FormItem/index.d.ts +64 -0
  48. package/dist/components/FormItem/index.js +591 -0
  49. package/dist/components/FormList/Field.d.ts +29 -0
  50. package/dist/components/FormList/Field.js +106 -0
  51. package/dist/components/FormList/FieldContext.d.ts +15 -0
  52. package/dist/components/FormList/FieldContext.js +11 -0
  53. package/dist/components/FormList/InternalField.d.ts +51 -0
  54. package/dist/components/FormList/InternalField.js +149 -0
  55. package/dist/components/FormList/ListContext.d.ts +12 -0
  56. package/dist/components/FormList/ListContext.js +11 -0
  57. package/dist/components/FormList/index.d.ts +36 -0
  58. package/dist/components/FormList/index.js +145 -0
  59. package/dist/components/FormList/interface.d.ts +9 -0
  60. package/dist/components/FormList/interface.js +1 -0
  61. package/dist/components/FormList/namePathType.d.ts +9 -0
  62. package/dist/components/FormList/namePathType.js +1 -0
  63. package/dist/components/FormList/utils/index.d.ts +15 -0
  64. package/dist/components/FormList/utils/index.js +37 -0
  65. package/dist/components/InlineErrorFormItem/InlineErrorFormItemPopover.d.ts +21 -0
  66. package/dist/components/InlineErrorFormItem/InlineErrorFormItemPopover.js +95 -0
  67. package/dist/components/InlineErrorFormItem/index.d.ts +14 -0
  68. package/dist/components/InlineErrorFormItem/index.js +44 -0
  69. package/dist/components/InlineErrorFormItem/style/index.d.ts +8 -0
  70. package/dist/components/InlineErrorFormItem/style/index.js +46 -0
  71. package/dist/components/LabelIconTip/index.d.ts +16 -0
  72. package/dist/components/LabelIconTip/index.js +79 -0
  73. package/dist/components/LabelIconTip/style/index.d.ts +8 -0
  74. package/dist/components/LabelIconTip/style/index.js +38 -0
  75. package/dist/components/ProFormContext/index.d.ts +51 -0
  76. package/dist/components/ProFormContext/index.js +11 -0
  77. package/dist/conversionMomentValue/index.d.ts +48 -0
  78. package/dist/conversionMomentValue/index.js +103 -0
  79. package/dist/dateArrayFormatter/index.d.ts +14 -0
  80. package/dist/dateArrayFormatter/index.js +38 -0
  81. package/dist/deepMerge/index.d.ts +4 -0
  82. package/dist/deepMerge/index.js +17 -0
  83. package/dist/genCopyable/index.d.ts +27 -0
  84. package/dist/genCopyable/index.js +82 -0
  85. package/dist/getFieldPropsOrFormItemProps/index.d.ts +18 -0
  86. package/dist/getFieldPropsOrFormItemProps/index.js +15 -0
  87. package/dist/getSlot/index.d.ts +8 -0
  88. package/dist/getSlot/index.js +11 -0
  89. package/dist/hooks/index.d.ts +9 -0
  90. package/dist/hooks/index.js +9 -0
  91. package/dist/hooks/useDebounceFn/index.d.ts +12 -0
  92. package/dist/hooks/useDebounceFn/index.js +34 -0
  93. package/dist/hooks/useDebounceValue/index.d.ts +12 -0
  94. package/dist/hooks/useDebounceValue/index.js +21 -0
  95. package/dist/hooks/useDocumentTitle/index.d.ts +10 -0
  96. package/dist/hooks/useDocumentTitle/index.js +12 -0
  97. package/dist/hooks/useEffect/index.d.ts +6 -0
  98. package/dist/hooks/useEffect/index.js +17 -0
  99. package/dist/hooks/useFetchData/index.d.ts +12 -0
  100. package/dist/hooks/useFetchData/index.js +35 -0
  101. package/dist/hooks/useLayoutEffect/index.d.ts +6 -0
  102. package/dist/hooks/useLayoutEffect/index.js +21 -0
  103. package/dist/hooks/useMemo/index.d.ts +6 -0
  104. package/dist/hooks/useMemo/index.js +13 -0
  105. package/dist/hooks/useState/index.d.ts +6 -0
  106. package/dist/hooks/useState/index.js +11 -0
  107. package/dist/index.d.ts +61 -0
  108. package/dist/index.js +58 -0
  109. package/dist/isBrowser/index.d.ts +4 -0
  110. package/dist/isBrowser/index.js +8 -0
  111. package/dist/isDropdownValueType/index.d.ts +4 -0
  112. package/dist/isDropdownValueType/index.js +8 -0
  113. package/dist/isImg/index.d.ts +5 -0
  114. package/dist/isImg/index.js +7 -0
  115. package/dist/isNil/index.d.ts +4 -0
  116. package/dist/isNil/index.js +6 -0
  117. package/dist/isUrl/index.d.ts +9 -0
  118. package/dist/isUrl/index.js +17 -0
  119. package/dist/merge/index.d.ts +9 -0
  120. package/dist/merge/index.js +20 -0
  121. package/dist/nanoid/index.d.ts +9 -0
  122. package/dist/nanoid/index.js +25 -0
  123. package/dist/normalizeProps/index.d.ts +6 -0
  124. package/dist/normalizeProps/index.js +6 -0
  125. package/dist/omitBoolean/index.d.ts +9 -0
  126. package/dist/omitBoolean/index.js +11 -0
  127. package/dist/omitUndefined/index.d.ts +5 -0
  128. package/dist/omitUndefined/index.js +11 -0
  129. package/dist/omitUndefinedAndEmptyArr/index.d.ts +4 -0
  130. package/dist/omitUndefinedAndEmptyArr/index.js +12 -0
  131. package/dist/parseValueToDay/index.d.ts +7 -0
  132. package/dist/parseValueToDay/index.js +21 -0
  133. package/dist/pickProFormItemProps/index.d.ts +34 -0
  134. package/dist/pickProFormItemProps/index.js +42 -0
  135. package/dist/pickProProps/index.d.ts +4 -0
  136. package/dist/pickProProps/index.js +14 -0
  137. package/dist/pro-utils.esm.js +3672 -0
  138. package/dist/proFieldParsingText/index.d.ts +25 -0
  139. package/dist/proFieldParsingText/index.js +100 -0
  140. package/dist/runFunction/index.d.ts +5 -0
  141. package/dist/runFunction/index.js +8 -0
  142. package/dist/stringify/index.d.ts +7 -0
  143. package/dist/stringify/index.js +10 -0
  144. package/dist/transformBooleanProps/index.d.ts +4 -0
  145. package/dist/transformBooleanProps/index.js +9 -0
  146. package/dist/transformKeySubmitValue/index.d.ts +24 -0
  147. package/dist/transformKeySubmitValue/index.js +200 -0
  148. package/dist/transformVueNodeType/index.d.ts +14 -0
  149. package/dist/transformVueNodeType/index.js +14 -0
  150. package/dist/typing.d.ts +562 -0
  151. package/dist/typing.js +1 -0
  152. package/dist/useEditableArray/components/CancelEditableAction.d.ts +47 -0
  153. package/dist/useEditableArray/components/CancelEditableAction.js +90 -0
  154. package/dist/useEditableArray/components/DeleteEditableAction.d.ts +33 -0
  155. package/dist/useEditableArray/components/DeleteEditableAction.js +63 -0
  156. package/dist/useEditableArray/components/SaveEditableAction.d.ts +33 -0
  157. package/dist/useEditableArray/components/SaveEditableAction.js +79 -0
  158. package/dist/useEditableArray/index.d.ts +66 -0
  159. package/dist/useEditableArray/index.js +584 -0
  160. package/dist/useEditableArray/typing.d.ts +130 -0
  161. package/dist/useEditableArray/typing.js +1 -0
  162. package/dist/useEditableMap/index.d.ts +32 -0
  163. package/dist/useEditableMap/index.js +147 -0
  164. package/dist/useMediaQuery/index.d.ts +44 -0
  165. package/dist/useMediaQuery/index.js +99 -0
  166. package/dist/useMediaQuery/query.d.ts +6 -0
  167. package/dist/useMediaQuery/query.js +17 -0
  168. package/dist/useMountMergeState/index.d.ts +11 -0
  169. package/dist/useMountMergeState/index.js +26 -0
  170. package/dist/usePrevious/index.d.ts +6 -0
  171. package/dist/usePrevious/index.js +11 -0
  172. package/dist/useRefFunction/index.d.ts +4 -0
  173. package/dist/useRefFunction/index.js +11 -0
  174. package/package.json +69 -3
@@ -0,0 +1,95 @@
1
+ import { useEffect } from "../../hooks/useEffect/index.js";
2
+ import { useState } from "../../hooks/useState/index.js";
3
+ import style_default from "./style/index.js";
4
+ import { Fragment, computed, createVNode, defineComponent, mergeProps } from "vue";
5
+ import { classNames } from "@v-c/util";
6
+ import { Popover } from "antdv-next";
7
+ import { LoadingOutlined } from "@antdv-next/icons";
8
+ import { useConfig as useConfig$1 } from "antdv-next/config-provider/context";
9
+ //#region src/components/InlineErrorFormItem/InlineErrorFormItemPopover.tsx
10
+ const InlineErrorFormItemPopover = /* @__PURE__ */ defineComponent((props) => {
11
+ const [open, setOpen] = useState(false);
12
+ const [messages, setMessages] = useState({
13
+ errors: [],
14
+ warnings: []
15
+ });
16
+ const config = useConfig$1();
17
+ const prefixCls = computed(() => props.prefixCls || config.value.getPrefixCls());
18
+ useEffect(() => {
19
+ if (props.inputProps.validateStatus !== "validating") setMessages({
20
+ errors: props.inputProps.errors ?? [],
21
+ warnings: props.inputProps.warnings ?? []
22
+ });
23
+ }, [
24
+ () => props.inputProps.errors,
25
+ () => props.inputProps.warnings,
26
+ () => props.inputProps.validateStatus
27
+ ]);
28
+ const baseClassName = computed(() => `${prefixCls.value}-form-item`);
29
+ const [hashId, cssVarCls] = style_default(baseClassName);
30
+ return () => {
31
+ const { popoverProps, inputProps, input, extra, errorList } = props;
32
+ const loading = inputProps.validateStatus === "validating";
33
+ const hasMessages = (messages.value.errors?.length ?? 0) + (messages.value.warnings?.length ?? 0) >= 1;
34
+ setOpen(!hasMessages ? false : open.value);
35
+ return createVNode(Popover, mergeProps({ "key": "popover" }, popoverProps, {
36
+ "open": open.value,
37
+ "onUpdate:open": (_open) => {
38
+ popoverProps?.["onUpdate:open"]?.(_open);
39
+ setOpen(_open);
40
+ },
41
+ "onOpenChange": (changeOpen) => {
42
+ popoverProps?.onOpenChange?.(changeOpen);
43
+ setOpen(changeOpen);
44
+ },
45
+ "trigger": popoverProps?.trigger || ["click"],
46
+ "placement": popoverProps?.placement || "topLeft",
47
+ "getPopupContainer": popoverProps?.getPopupContainer,
48
+ "getTooltipContainer": popoverProps?.getTooltipContainer,
49
+ "content": createVNode("div", {
50
+ "class": classNames(baseClassName.value, hashId.value, cssVarCls.value),
51
+ "style": {
52
+ margin: 0,
53
+ padding: 0
54
+ }
55
+ }, [createVNode("div", { "class": classNames(`${baseClassName.value}-with-help`, hashId.value, cssVarCls.value) }, [loading ? createVNode(LoadingOutlined, null, null) : null, hasMessages ? createVNode(Fragment, null, [messages.value.errors?.map((error, index) => createVNode("div", {
56
+ "key": `error-${index}`,
57
+ "class": classNames(`${baseClassName.value}-explain-error`, hashId.value, cssVarCls.value)
58
+ }, [error])), messages.value.warnings?.map((warning, index) => createVNode("div", {
59
+ "key": `warning-${index}`,
60
+ "class": classNames(`${baseClassName.value}-explain-warning`, hashId.value, cssVarCls.value)
61
+ }, [warning]))]) : errorList])])
62
+ }), { default: () => [createVNode(Fragment, null, [input, extra])] });
63
+ };
64
+ }, {
65
+ props: {
66
+ prefixCls: {
67
+ type: String,
68
+ required: false
69
+ },
70
+ inputProps: {
71
+ type: Object,
72
+ required: true
73
+ },
74
+ input: {
75
+ type: [Object, null],
76
+ required: false
77
+ },
78
+ errorList: {
79
+ type: [Object, null],
80
+ required: false
81
+ },
82
+ extra: {
83
+ type: [Object, null],
84
+ required: false
85
+ },
86
+ popoverProps: {
87
+ type: Object,
88
+ required: false
89
+ }
90
+ },
91
+ name: "InlineErrorFormItemPopover",
92
+ inheritAttrs: false
93
+ });
94
+ //#endregion
95
+ export { InlineErrorFormItemPopover as default };
@@ -0,0 +1,14 @@
1
+ import { FormItemProps as FormItemProps$1 } from "../FormItem/index.js";
2
+ import { CSSProperties, FunctionalComponent } from "vue";
3
+ import { PopoverProps } from "antdv-next";
4
+
5
+ //#region src/components/InlineErrorFormItem/index.d.ts
6
+ type InlineErrorFormItemProps = FormItemProps$1 & {
7
+ errorType?: 'popover' | 'default';
8
+ popoverProps?: PopoverProps;
9
+ style?: CSSProperties;
10
+ class?: string;
11
+ };
12
+ declare const InlineErrorFormItem: FunctionalComponent<InlineErrorFormItemProps>;
13
+ //#endregion
14
+ export { InlineErrorFormItem as default };
@@ -0,0 +1,44 @@
1
+ import FormItem from "../FormItem/index.js";
2
+ import InlineErrorFormItemPopover from "./InlineErrorFormItemPopover.js";
3
+ import { createVNode, mergeProps } from "vue";
4
+ import { unit } from "@antdv-next/cssinjs";
5
+ //#region src/components/InlineErrorFormItem/index.tsx
6
+ const FIX_INLINE_STYLE = {
7
+ marginBlockStart: unit(-5),
8
+ marginBlockEnd: unit(-5),
9
+ marginInlineStart: 0,
10
+ marginInlineEnd: 0
11
+ };
12
+ const InternalFormItemFunction = ({ rules, name, popoverProps, style, ...rest }, { slots }) => createVNode(FormItem, mergeProps(rest, {
13
+ "name": name,
14
+ "_internalItemRender": {
15
+ mark: "pro_table_render",
16
+ render: (inputProps, doms) => createVNode(InlineErrorFormItemPopover, mergeProps({
17
+ "inputProps": inputProps,
18
+ "popoverProps": popoverProps
19
+ }, doms), null)
20
+ },
21
+ "rules": rules,
22
+ "hasFeedback": false,
23
+ "style": {
24
+ ...FIX_INLINE_STYLE,
25
+ ...style
26
+ }
27
+ }), slots);
28
+ const InlineErrorFormItem = ({ errorType, rules = [], name, popoverProps, style, ...rest }, { slots }) => {
29
+ if (name && Array.isArray(rules) && rules?.length && errorType === "popover") return createVNode(InternalFormItemFunction, mergeProps({
30
+ "name": name,
31
+ "rules": rules,
32
+ "popoverProps": popoverProps
33
+ }, rest), slots);
34
+ return createVNode(FormItem, mergeProps(rest, {
35
+ "rules": rules,
36
+ "name": name,
37
+ "style": {
38
+ ...FIX_INLINE_STYLE,
39
+ ...style
40
+ }
41
+ }), slots);
42
+ };
43
+ //#endregion
44
+ export { InlineErrorFormItem as default };
@@ -0,0 +1,8 @@
1
+ import * as _$vue from "vue";
2
+ import { ProAliasCssVarToken } from "@antdv-vue/pro-provider";
3
+
4
+ //#region src/components/InlineErrorFormItem/style/index.d.ts
5
+ interface ProInlineErrorFormItemToken extends ProAliasCssVarToken {}
6
+ declare const _default: (prefixCls: _$vue.Ref<string>, rootCls?: _$vue.Ref<string | undefined>) => readonly [_$vue.Ref<string, string>, _$vue.ComputedRef<string | undefined>];
7
+ //#endregion
8
+ export { ProInlineErrorFormItemToken, _default as default };
@@ -0,0 +1,46 @@
1
+ import { useStyle } from "@antdv-vue/pro-provider";
2
+ import { mergeToken } from "@antdv-next/cssinjs";
3
+ //#region src/components/InlineErrorFormItem/style/index.ts
4
+ const genProInlineErrorFormItemStyle = (token) => {
5
+ const progressBgCls = `${token.antCls}-progress-bg`;
6
+ return { [token.componentCls]: { "&-with-help": {
7
+ "&-multiple": {
8
+ paddingBlockStart: 6,
9
+ paddingBlockEnd: 12,
10
+ paddingInline: 8
11
+ },
12
+ "&-progress": {
13
+ "&-success": { [progressBgCls]: { backgroundColor: token.colorSuccess } },
14
+ "&-error": { [progressBgCls]: { backgroundColor: token.colorError } },
15
+ "&-warning": { [progressBgCls]: { backgroundColor: token.colorWarning } }
16
+ },
17
+ "&-rule": {
18
+ display: "flex",
19
+ alignItems: "center",
20
+ "&-icon": {
21
+ "&-default": {
22
+ display: "flex",
23
+ alignItems: "center",
24
+ justifyContent: "center",
25
+ width: 14,
26
+ height: 22,
27
+ "&-circle": {
28
+ width: 6,
29
+ height: 6,
30
+ backgroundColor: token.colorTextSecondary,
31
+ borderRadius: 4
32
+ }
33
+ },
34
+ "&-loading": { color: token.colorPrimary },
35
+ "&-error": { color: token.colorError },
36
+ "&-success": { color: token.colorSuccess }
37
+ },
38
+ "&-text": { color: token.colorText }
39
+ }
40
+ } } };
41
+ };
42
+ var style_default = useStyle("InlineErrorFormItem", (token) => {
43
+ return [genProInlineErrorFormItemStyle(mergeToken(token, {}))];
44
+ });
45
+ //#endregion
46
+ export { style_default as default };
@@ -0,0 +1,16 @@
1
+ import * as _$vue from "vue";
2
+ import { VueNode } from "@v-c/util";
3
+ import { FormItemTooltipType } from "antdv-next/dist/form/FormItemLabel";
4
+
5
+ //#region src/components/LabelIconTip/index.d.ts
6
+ interface LabelIconTipProps {
7
+ label?: VueNode;
8
+ subTitle?: VueNode;
9
+ tooltip?: FormItemTooltipType;
10
+ ellipsis?: boolean | {
11
+ showTitle?: boolean;
12
+ };
13
+ }
14
+ declare const LabelIconTip: _$vue.DefineSetupFnComponent<LabelIconTipProps, {}, {}, LabelIconTipProps & {}, _$vue.PublicProps>;
15
+ //#endregion
16
+ export { LabelIconTipProps, LabelIconTip as default };
@@ -0,0 +1,79 @@
1
+ import style_default from "./style/index.js";
2
+ import { Fragment, computed, createVNode, defineComponent, isVNode } from "vue";
3
+ import { classNames } from "@v-c/util";
4
+ import { Tooltip } from "antdv-next";
5
+ import { InfoCircleOutlined } from "@antdv-next/icons";
6
+ import { useConfig as useConfig$1 } from "antdv-next/config-provider/context";
7
+ //#region src/components/LabelIconTip/index.tsx
8
+ const LabelIconTip = /* @__PURE__ */ defineComponent((props) => {
9
+ const config = useConfig$1();
10
+ const prefixCls = computed(() => config.value.getPrefixCls("pro"));
11
+ const baseClassName = computed(() => `${prefixCls.value}-core-label-tip`);
12
+ const [hashId, cssVarCls] = style_default(baseClassName);
13
+ return () => {
14
+ const { tooltip, subTitle, label, ellipsis } = props;
15
+ if (!tooltip && !subTitle) return createVNode(Fragment, null, [label]);
16
+ const tooltipProps = typeof tooltip === "string" || isVNode(tooltip) ? { title: tooltip } : tooltip;
17
+ const icon = tooltipProps?.icon || createVNode(InfoCircleOutlined, null, null);
18
+ return createVNode("div", {
19
+ "class": classNames(baseClassName.value, hashId.value, cssVarCls.value),
20
+ "onMousedown": (e) => e.stopPropagation(),
21
+ "onMouseleave": (e) => e.stopPropagation(),
22
+ "onMousemove": (e) => e.stopPropagation()
23
+ }, [
24
+ createVNode("div", { "class": classNames(`${baseClassName.value}-title`, hashId.value, cssVarCls.value, { [`${baseClassName.value}-title-ellipsis`]: ellipsis }) }, [label]),
25
+ subTitle && createVNode("div", { "class": classNames(`${baseClassName.value}-subtitle`, hashId.value, cssVarCls.value) }, [subTitle]),
26
+ tooltip && createVNode(Tooltip, tooltipProps, { default: () => [createVNode("span", { "class": classNames(`${baseClassName.value}-icon`, hashId.value, cssVarCls.value) }, [icon])] })
27
+ ]);
28
+ };
29
+ }, {
30
+ props: {
31
+ label: {
32
+ type: [
33
+ Object,
34
+ Function,
35
+ String,
36
+ Number,
37
+ null,
38
+ Boolean,
39
+ Array
40
+ ],
41
+ required: false,
42
+ default: void 0
43
+ },
44
+ subTitle: {
45
+ type: [
46
+ Object,
47
+ Function,
48
+ String,
49
+ Number,
50
+ null,
51
+ Boolean,
52
+ Array
53
+ ],
54
+ required: false,
55
+ default: void 0
56
+ },
57
+ tooltip: {
58
+ type: [
59
+ Object,
60
+ Function,
61
+ String,
62
+ Number,
63
+ null,
64
+ Boolean
65
+ ],
66
+ required: false,
67
+ default: void 0
68
+ },
69
+ ellipsis: {
70
+ type: [Boolean, Object],
71
+ required: false,
72
+ default: void 0
73
+ }
74
+ },
75
+ name: "LabelIconTip",
76
+ inheritAttrs: false
77
+ });
78
+ //#endregion
79
+ export { LabelIconTip as default };
@@ -0,0 +1,8 @@
1
+ import * as _$vue from "vue";
2
+ import { ProAliasCssVarToken } from "@antdv-vue/pro-provider";
3
+
4
+ //#region src/components/LabelIconTip/style/index.d.ts
5
+ interface ProLabelIconTipToken extends ProAliasCssVarToken {}
6
+ declare const _default: (prefixCls: _$vue.Ref<string>, rootCls?: _$vue.Ref<string | undefined>) => readonly [_$vue.Ref<string, string>, _$vue.ComputedRef<string | undefined>];
7
+ //#endregion
8
+ export { ProLabelIconTipToken, _default as default };
@@ -0,0 +1,38 @@
1
+ import { useStyle } from "@antdv-vue/pro-provider";
2
+ import { mergeToken } from "@antdv-next/cssinjs";
3
+ //#region src/components/LabelIconTip/style/index.ts
4
+ const genProLabelIconTipStyle = (token) => {
5
+ return { [token.componentCls]: {
6
+ display: "inline-flex",
7
+ alignItems: "center",
8
+ maxWidth: "100%",
9
+ "&-icon": {
10
+ display: "block",
11
+ marginInlineStart: 4,
12
+ cursor: "pointer",
13
+ "&:hover": { color: token.colorPrimary }
14
+ },
15
+ "&-title": {
16
+ display: "inline-flex",
17
+ flex: "1"
18
+ },
19
+ "&-subtitle ": {
20
+ marginInlineStart: 8,
21
+ color: token.colorTextSecondary,
22
+ fontWeight: "normal",
23
+ fontSize: token.fontSize,
24
+ whiteSpace: "nowrap"
25
+ },
26
+ "&-title-ellipsis": {
27
+ overflow: "hidden",
28
+ whiteSpace: "nowrap",
29
+ textOverflow: "ellipsis",
30
+ wordBreak: "keep-all"
31
+ }
32
+ } };
33
+ };
34
+ var style_default = useStyle("LabelIconTip", (token) => {
35
+ return [genProLabelIconTipStyle(mergeToken(token, {}))];
36
+ });
37
+ //#endregion
38
+ export { style_default as default };
@@ -0,0 +1,51 @@
1
+ import { InjectionKey, ShallowRef } from "vue";
2
+ import { FormInstance } from "antdv-next";
3
+ import { NamePath } from "antdv-next/dist/form/types";
4
+
5
+ //#region src/components/ProFormContext/index.d.ts
6
+ interface ProFormInstanceType<T> {
7
+ /**
8
+ * 获取被 ProForm 格式化后的所有数据
9
+ * @param nameList boolean
10
+ * @returns T
11
+ *
12
+ * @example getFieldsFormatValue() ->返回所有数据
13
+ * @example getFieldsFormatValue(true) ->返回所有数据,即使没有被 form 托管的
14
+ */
15
+ getFieldsFormatValue?: (nameList?: true, omitNil?: boolean) => T;
16
+ /**
17
+ * 获取被 ProForm 格式化后的单个数据
18
+ * @param nameList (string|number)[]
19
+ * @returns T
20
+ *
21
+ * @example {a:{b:value}} -> getFieldFormatValue(['a', 'b']) -> value
22
+ */
23
+ getFieldFormatValue?: (nameList?: NamePath<string | number | boolean>, omitNilParam?: boolean) => T | undefined;
24
+ /**
25
+ * 获取被 ProForm 格式化后的单个数据, 包含他的 name
26
+ * @param nameList (string|number)[]
27
+ * @returns T
28
+ *
29
+ * @example {a:{b:value}}->getFieldFormatValueObject(['a','b'])->{a:{b:value}}
30
+ */
31
+ getFieldFormatValueObject?: (nameList?: NamePath<string | number | boolean>, omitNilParam?: boolean) => T;
32
+ /**
33
+ *验字段后返回格式化之后的所有数据
34
+ * @param nameList (string|number)[]
35
+ * @returns T
36
+ *
37
+ * @example validateFieldsReturnFormatValue -> {a:{b:value}}
38
+ */
39
+ validateFieldsReturnFormatValue?: (nameList?: NamePath<string | number | boolean>[], omitNilParam?: boolean) => Promise<T>;
40
+ }
41
+ declare const proFormContextKey: InjectionKey<ProFormInstanceType<any> & {
42
+ formRef?: ShallowRef<FormInstance | null>;
43
+ }>;
44
+ declare function useProFormContextProvider(props: ProFormInstanceType<any> & {
45
+ formRef?: ShallowRef<FormInstance | null>;
46
+ }): void;
47
+ declare function useProFormContextInject(): ProFormInstanceType<any> & {
48
+ formRef?: ShallowRef<FormInstance | null>;
49
+ };
50
+ //#endregion
51
+ export { ProFormInstanceType, proFormContextKey, useProFormContextInject, useProFormContextProvider };
@@ -0,0 +1,11 @@
1
+ import { inject, provide } from "vue";
2
+ //#region src/components/ProFormContext/index.ts
3
+ const proFormContextKey = Symbol("proFormContext");
4
+ function useProFormContextProvider(props) {
5
+ return provide(proFormContextKey, props);
6
+ }
7
+ function useProFormContextInject() {
8
+ return inject(proFormContextKey, {});
9
+ }
10
+ //#endregion
11
+ export { proFormContextKey, useProFormContextInject, useProFormContextProvider };
@@ -0,0 +1,48 @@
1
+ import { ProFieldValueType } from "../typing.js";
2
+ import { ShallowRef } from "vue";
3
+ import dayjs from "dayjs";
4
+ import { NamePath } from "antdv-next/dist/form/types";
5
+
6
+ //#region src/conversionMomentValue/index.d.ts
7
+ type DateFormatter = (string & Record<string, any>) | 'number' | 'string' | ((value: dayjs.Dayjs, valueType: string) => string | number) | false;
8
+ declare const dateFormatterMap: {
9
+ time: string;
10
+ timeRange: string;
11
+ date: string;
12
+ dateWeek: string;
13
+ dateMonth: string;
14
+ dateQuarter: string;
15
+ dateYear: string;
16
+ dateRange: string;
17
+ dateTime: string;
18
+ dateTimeRange: string;
19
+ };
20
+ /**
21
+ * 判断是否是一个的简单的 object
22
+ * @param {{constructor:any}} o
23
+ * @returns boolean
24
+ */
25
+ declare function isPlainObject(o: {
26
+ constructor: any;
27
+ }): boolean;
28
+ /**
29
+ * 根据不同的格式转化 dayjs
30
+ * @param {dayjs.Dayjs} value
31
+ * @param {string|((value:dayjs.Dayjs} dateFormatter
32
+ * @param {string} valueType
33
+ */
34
+ declare function convertMoment(value: dayjs.Dayjs, dateFormatter: DateFormatter, valueType: string): string | number | dayjs.Dayjs;
35
+ /**
36
+ * 这里主要是来转化一下数据 将 dayjs 转化为 string 将 all 默认删除
37
+ * @param {object} value
38
+ * @param {DateFormatter} dateFormatter
39
+ * @param {Record<string} valueTypeMap
40
+ * @param {boolean} omitNil
41
+ * @param {NamePath} parentKey
42
+ */
43
+ declare function conversionMomentValue<T extends Record<string, any> = any>(value: T, dateFormatter: DateFormatter, valueTypeMap: ShallowRef<Record<string, {
44
+ valueType: ProFieldValueType;
45
+ dateFormat: string;
46
+ } | any>>, omitNil?: boolean, parentKey?: NamePath): T;
47
+ //#endregion
48
+ export { conversionMomentValue, convertMoment, dateFormatterMap, isPlainObject };
@@ -0,0 +1,103 @@
1
+ import { isNil } from "../isNil/index.js";
2
+ import dayjs from "dayjs";
3
+ import { get } from "@v-c/util";
4
+ import quarterOfYear from "dayjs/plugin/quarterOfYear";
5
+ //#region src/conversionMomentValue/index.ts
6
+ dayjs.extend(quarterOfYear);
7
+ const dateFormatterMap = {
8
+ time: "HH:mm:ss",
9
+ timeRange: "HH:mm:ss",
10
+ date: "YYYY-MM-DD",
11
+ dateWeek: "YYYY-wo",
12
+ dateMonth: "YYYY-MM",
13
+ dateQuarter: "YYYY-[Q]Q",
14
+ dateYear: "YYYY",
15
+ dateRange: "YYYY-MM-DD",
16
+ dateTime: "YYYY-MM-DD HH:mm:ss",
17
+ dateTimeRange: "YYYY-MM-DD HH:mm:ss"
18
+ };
19
+ /**
20
+ * 判断是不是一个 object
21
+ * @param {any} o
22
+ * @returns boolean
23
+ */
24
+ function isObject(o) {
25
+ return Object.prototype.toString.call(o) === "[object Object]";
26
+ }
27
+ /**
28
+ * 判断是否是一个的简单的 object
29
+ * @param {{constructor:any}} o
30
+ * @returns boolean
31
+ */
32
+ function isPlainObject(o) {
33
+ if (!isObject(o)) return false;
34
+ const ctor = o.constructor;
35
+ if (ctor === void 0) return true;
36
+ const prot = ctor.prototype;
37
+ if (!isObject(prot)) return false;
38
+ if (!Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf")) return false;
39
+ return true;
40
+ }
41
+ /**
42
+ * 一个比较hack的moment判断工具
43
+ * @param {any} value
44
+ * @returns boolean
45
+ */
46
+ const isMoment = (value) => !!value?._isAMomentObject;
47
+ /**
48
+ * 根据不同的格式转化 dayjs
49
+ * @param {dayjs.Dayjs} value
50
+ * @param {string|((value:dayjs.Dayjs} dateFormatter
51
+ * @param {string} valueType
52
+ */
53
+ function convertMoment(value, dateFormatter, valueType) {
54
+ if (!dateFormatter) return value;
55
+ if (dayjs.isDayjs(value) || isMoment(value)) {
56
+ if (dateFormatter === "number") return value.valueOf();
57
+ if (dateFormatter === "string") return value.format(dateFormatterMap[valueType] || "YYYY-MM-DD HH:mm:ss");
58
+ if (typeof dateFormatter === "string" && dateFormatter !== "string") return value.format(dateFormatter);
59
+ if (typeof dateFormatter === "function") return dateFormatter(value, valueType);
60
+ }
61
+ return value;
62
+ }
63
+ /**
64
+ * 这里主要是来转化一下数据 将 dayjs 转化为 string 将 all 默认删除
65
+ * @param {object} value
66
+ * @param {DateFormatter} dateFormatter
67
+ * @param {Record<string} valueTypeMap
68
+ * @param {boolean} omitNil
69
+ * @param {NamePath} parentKey
70
+ */
71
+ function conversionMomentValue(value, dateFormatter, valueTypeMap, omitNil, parentKey) {
72
+ const tmpValue = {};
73
+ if (typeof window === "undefined") return value;
74
+ if (typeof value !== "object" || isNil(value) || value instanceof Blob || Array.isArray(value)) return value;
75
+ Object.keys(value).forEach((valueKey) => {
76
+ const namePath = parentKey ? [parentKey, valueKey].flat(1) : [valueKey];
77
+ const valueFormatMap = get(valueTypeMap.value, namePath) || "text";
78
+ let valueType = "text";
79
+ let dateFormat;
80
+ if (typeof valueFormatMap === "string") valueType = valueFormatMap;
81
+ else if (valueFormatMap) {
82
+ valueType = valueFormatMap.valueType;
83
+ dateFormat = valueFormatMap.dateFormat;
84
+ }
85
+ const itemValue = value[valueKey];
86
+ if (isNil(itemValue) && omitNil) return;
87
+ if (isPlainObject(itemValue) && !Array.isArray(itemValue) && !dayjs.isDayjs(itemValue) && !isMoment(itemValue)) {
88
+ tmpValue[valueKey] = conversionMomentValue(itemValue, dateFormatter, valueTypeMap, omitNil, namePath);
89
+ return;
90
+ }
91
+ if (Array.isArray(itemValue)) {
92
+ tmpValue[valueKey] = itemValue.map((arrayValue, index) => {
93
+ if (dayjs.isDayjs(arrayValue) || isMoment(arrayValue)) return convertMoment(arrayValue, dateFormat || dateFormatter, valueType);
94
+ return conversionMomentValue(arrayValue, dateFormatter, valueTypeMap, omitNil, [valueKey, `${index}`].flat(1));
95
+ });
96
+ return;
97
+ }
98
+ tmpValue[valueKey] = convertMoment(itemValue, dateFormat || dateFormatter, valueType);
99
+ });
100
+ return tmpValue;
101
+ }
102
+ //#endregion
103
+ export { conversionMomentValue, convertMoment, dateFormatterMap, isPlainObject };
@@ -0,0 +1,14 @@
1
+ //#region src/dateArrayFormatter/index.d.ts
2
+ type FormatType = ((dayjs: any) => string) | string;
3
+ /**
4
+ * 格式化区域日期,如果是一个数组,会返回 start ~ end
5
+ * @param {any} value
6
+ * @param {FormatType | FormatType[]} format
7
+ * returns string
8
+ */
9
+ declare function dateArrayFormatter(value: any[], format: FormatType | FormatType[] | {
10
+ format: string;
11
+ type?: 'mask';
12
+ }): string;
13
+ //#endregion
14
+ export { dateArrayFormatter };
@@ -0,0 +1,38 @@
1
+ import dayjs from "dayjs";
2
+ //#region src/dateArrayFormatter/index.ts
3
+ /**
4
+ * 通过 format 来格式化日期,因为支持了function 所以需要单独的方法来处理
5
+ * @param {any} endText
6
+ * @param {FormatType} format
7
+ * @return string
8
+ */
9
+ function formatString(endText, format) {
10
+ if (typeof format === "function") return format(dayjs(endText));
11
+ return dayjs(endText).format(format);
12
+ }
13
+ /**
14
+ * 格式化区域日期,如果是一个数组,会返回 start ~ end
15
+ * @param {any} value
16
+ * @param {FormatType | FormatType[]} format
17
+ * returns string
18
+ */
19
+ function dateArrayFormatter(value, format) {
20
+ const [startText, endText] = Array.isArray(value) ? value : [];
21
+ let formatFirst;
22
+ let formatEnd;
23
+ if (Array.isArray(format)) {
24
+ formatFirst = format[0];
25
+ formatEnd = format[1];
26
+ } else if (typeof format === "object" && format.type === "mask") {
27
+ formatFirst = format.format;
28
+ formatEnd = format.format;
29
+ } else {
30
+ formatFirst = format;
31
+ formatEnd = format;
32
+ }
33
+ const parsedStartText = startText ? formatString(startText, formatFirst) : "";
34
+ const parsedEndText = endText ? formatString(endText, formatEnd) : "";
35
+ return parsedStartText && parsedEndText ? `${parsedStartText} ~ ${parsedEndText}` : "";
36
+ }
37
+ //#endregion
38
+ export { dateArrayFormatter };
@@ -0,0 +1,4 @@
1
+ //#region src/deepMerge/index.d.ts
2
+ declare function deepMerge<T = any>(...objs: any[]): T;
3
+ //#endregion
4
+ export { deepMerge };
@@ -0,0 +1,17 @@
1
+ //#region src/deepMerge/index.ts
2
+ function deepMerge(...objs) {
3
+ const result = {};
4
+ for (const obj of objs) {
5
+ if (!obj || typeof obj !== "object") continue;
6
+ for (const key in obj) {
7
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
8
+ const val = obj[key];
9
+ const existing = result[key];
10
+ if (val && typeof val === "object" && !Array.isArray(val) && existing && typeof existing === "object" && !Array.isArray(existing)) result[key] = deepMerge(existing, val);
11
+ else result[key] = val;
12
+ }
13
+ }
14
+ return result;
15
+ }
16
+ //#endregion
17
+ export { deepMerge };