@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,80 @@
1
+ import style_default from "./style/index.js";
2
+ import { computed, createVNode, defineComponent, isVNode } from "vue";
3
+ import { classNames } from "@v-c/util";
4
+ import { Button } from "antdv-next";
5
+ import { useIntl } from "@antdv-vue/pro-provider";
6
+ import { useConfig as useConfig$1 } from "antdv-next/config-provider/context";
7
+ //#region src/components/DropdownFooter/index.tsx
8
+ function _isSlot(s) {
9
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
10
+ }
11
+ const DropdownFooter = /* @__PURE__ */ defineComponent((props) => {
12
+ const intl = useIntl();
13
+ const config = useConfig$1();
14
+ const prefixCls = computed(() => props.prefixCls || config.value.getPrefixCls("pro"));
15
+ const baseClassName = computed(() => `${prefixCls.value}-core-field-dropdown-footer`);
16
+ const [hashId, cssVarCls] = style_default(baseClassName);
17
+ return () => {
18
+ let _slot, _slot2;
19
+ const { onClear, onConfirm, disabled, footerRender } = props;
20
+ const defaultFooter = [createVNode(Button, {
21
+ "key": "clear",
22
+ "style": { visibility: onClear ? "visible" : "hidden" },
23
+ "type": "link",
24
+ "size": "small",
25
+ "disabled": disabled,
26
+ "onClick": (e) => {
27
+ if (onClear) onClear(e);
28
+ e.stopPropagation();
29
+ }
30
+ }, _isSlot(_slot = intl.value.getMessage({
31
+ id: "form.lightFilter.clear",
32
+ defaultMessage: "清除"
33
+ })) ? _slot : { default: () => [_slot] }), createVNode(Button, {
34
+ "key": "confirm",
35
+ "data-type": "confirm",
36
+ "type": "primary",
37
+ "size": "small",
38
+ "onClick": onConfirm,
39
+ "disabled": disabled
40
+ }, _isSlot(_slot2 = intl.value.getMessage({
41
+ id: "form.lightFilter.confirm",
42
+ defaultMessage: "确认"
43
+ })) ? _slot2 : { default: () => [_slot2] })];
44
+ if (footerRender === false || footerRender?.(onConfirm, onClear) === false) return null;
45
+ const renderDom = footerRender?.(onConfirm, onClear) || defaultFooter;
46
+ return createVNode("div", {
47
+ "class": classNames(baseClassName.value, hashId.value, cssVarCls.value),
48
+ "onClick": (e) => e.target.getAttribute("data-type") !== "confirm" && e.stopPropagation()
49
+ }, [renderDom]);
50
+ };
51
+ }, {
52
+ props: {
53
+ onClear: {
54
+ type: Function,
55
+ required: false
56
+ },
57
+ onConfirm: {
58
+ type: Function,
59
+ required: false
60
+ },
61
+ disabled: {
62
+ type: Boolean,
63
+ required: false,
64
+ default: void 0
65
+ },
66
+ prefixCls: {
67
+ type: String,
68
+ required: false
69
+ },
70
+ footerRender: {
71
+ type: [Function, Boolean],
72
+ required: false,
73
+ default: void 0
74
+ }
75
+ },
76
+ name: "DropdownFooter",
77
+ inheritAttrs: false
78
+ });
79
+ //#endregion
80
+ export { DropdownFooter 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/DropdownFooter/style/index.d.ts
5
+ interface ProDropdownFooterToken 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 { ProDropdownFooterToken, _default as default };
@@ -0,0 +1,18 @@
1
+ import { useStyle } from "@antdv-vue/pro-provider";
2
+ import { mergeToken, unit } from "@antdv-next/cssinjs";
3
+ //#region src/components/DropdownFooter/style/index.ts
4
+ const genProDropdownFooterStyle = (token) => {
5
+ return { [token.componentCls]: {
6
+ display: "flex",
7
+ justifyContent: "space-between",
8
+ paddingBlock: 8,
9
+ paddingInlineStart: 8,
10
+ paddingInlineEnd: 8,
11
+ borderBlockStart: `${unit(token.lineWidth)} ${token.lineType} ${token.colorSplit}`
12
+ } };
13
+ };
14
+ var style_default = useStyle("DropdownFooter", (token) => {
15
+ return [genProDropdownFooterStyle(mergeToken(token, {}))];
16
+ });
17
+ //#endregion
18
+ export { style_default as default };
@@ -0,0 +1,25 @@
1
+ import { VueNode as VueNode$1 } from "../../typing.js";
2
+ import * as _$vue from "vue";
3
+ import { onErrorCaptured } from "vue";
4
+ import { CustomSlotsType } from "@v-c/util/dist/type";
5
+
6
+ //#region src/components/ErrorBoundary/index.d.ts
7
+ declare const ErrorBoundary: _$vue.DefineSetupFnComponent<{
8
+ fallback?: (options: {
9
+ error: Error;
10
+ info: string;
11
+ }) => VueNode$1;
12
+ onError?: (error: Error) => void;
13
+ onErrorCaptured?: Parameters<typeof onErrorCaptured>[0];
14
+ }, {}, CustomSlotsType<{
15
+ default?: () => VueNode$1[];
16
+ }>, {
17
+ fallback?: (options: {
18
+ error: Error;
19
+ info: string;
20
+ }) => VueNode$1;
21
+ onError?: (error: Error) => void;
22
+ onErrorCaptured?: Parameters<typeof onErrorCaptured>[0];
23
+ } & {}, _$vue.PublicProps>;
24
+ //#endregion
25
+ export { ErrorBoundary as default };
@@ -0,0 +1,65 @@
1
+ import { Fragment, createTextVNode, createVNode, defineComponent, isVNode, onErrorCaptured, ref } from "vue";
2
+ import { Result, TypographyText } from "antdv-next";
3
+ //#region src/components/ErrorBoundary/index.tsx
4
+ function _isSlot(s) {
5
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
6
+ }
7
+ const ErrorBoundary = /* @__PURE__ */ defineComponent((props, { slots }) => {
8
+ const hasError = ref(false);
9
+ const errorInfo = ref();
10
+ const $error = ref();
11
+ onErrorCaptured((error, vm, info) => {
12
+ console.log("ErrorBoundary captured an error:", error, vm, info);
13
+ if (!info.includes("render")) return false;
14
+ hasError.value = true;
15
+ errorInfo.value = info;
16
+ $error.value = error;
17
+ props.onError?.(error);
18
+ props.onErrorCaptured?.(error, vm, info);
19
+ return false;
20
+ });
21
+ return () => {
22
+ let _slot;
23
+ return createVNode(Fragment, null, [hasError.value ? createVNode(Fragment, null, [props.fallback ? createVNode(Fragment, null, [typeof props.fallback === "function" ? props.fallback?.({
24
+ error: $error.value,
25
+ info: errorInfo.value
26
+ }) : props.fallback]) : createVNode(Result, {
27
+ "status": "error",
28
+ "title": "Something went wrong.",
29
+ "style": { zIndex: 1 }
30
+ }, { default: () => [createVNode("div", { "style": {
31
+ display: "flex",
32
+ flexDirection: "column",
33
+ gap: "12px"
34
+ } }, [createVNode(TypographyText, null, { default: () => [
35
+ errorInfo.value,
36
+ createTextVNode(":"),
37
+ createVNode(TypographyText, null, _isSlot(_slot = $error.value.toString()) ? _slot : { default: () => [_slot] })
38
+ ] }), createVNode("div", { "style": {
39
+ display: "flex",
40
+ flexDirection: "column"
41
+ } }, [($error.value?.stack || "").replace($error.value.toString(), "")?.split("\n").map((stack, i) => createVNode("div", {
42
+ "key": stack + i,
43
+ "style": {
44
+ textAlign: "left",
45
+ fontSize: "10px"
46
+ }
47
+ }, [createVNode(TypographyText, { "type": "secondary" }, _isSlot(stack) ? stack : { default: () => [stack] })])) ?? null])])] })]) : createVNode(Fragment, null, [slots.default?.()])]);
48
+ };
49
+ }, {
50
+ props: {
51
+ fallback: {
52
+ type: Function,
53
+ required: false
54
+ },
55
+ onError: {
56
+ type: Function,
57
+ required: false
58
+ },
59
+ onErrorCaptured: { required: false }
60
+ },
61
+ name: "ErrorBoundary",
62
+ inheritAttrs: false
63
+ });
64
+ //#endregion
65
+ export { ErrorBoundary as default };
@@ -0,0 +1,31 @@
1
+ import { VueNode as VueNode$1 } from "../../typing.js";
2
+ import * as _$vue from "vue";
3
+ import { VNode } from "vue";
4
+ import { SizeType } from "antdv-next";
5
+ import { CustomSlotsType } from "@v-c/util/dist/type";
6
+
7
+ //#region src/components/FieldLabel/index.d.ts
8
+ interface FieldLabelProps {
9
+ label?: VueNode$1;
10
+ value?: VueNode$1;
11
+ disabled?: boolean;
12
+ onClear?: () => void;
13
+ size?: SizeType;
14
+ ellipsis?: boolean;
15
+ placeholder?: VueNode$1;
16
+ formatter?: (value: any) => VueNode$1;
17
+ variant?: 'outlined' | 'borderless' | 'filled' | 'underlined';
18
+ allowClear?: boolean;
19
+ downIcon?: VueNode$1;
20
+ onClick?: () => void;
21
+ valueMaxLength?: number;
22
+ /**
23
+ * 点击标签的事件,用来唤醒 down menu 状态
24
+ */
25
+ onLabelClick?: () => void;
26
+ }
27
+ declare const FieldLabel: _$vue.DefineSetupFnComponent<FieldLabelProps, {}, CustomSlotsType<{
28
+ default?: () => VNode[];
29
+ }>, FieldLabelProps & {}, _$vue.PublicProps>;
30
+ //#endregion
31
+ export { FieldLabelProps, FieldLabel as default };
@@ -0,0 +1,212 @@
1
+ import style_default from "./style/index.js";
2
+ import { computed, createVNode, defineComponent, shallowRef } from "vue";
3
+ import { classNames } from "@v-c/util";
4
+ import { useConfig } from "antdv-next";
5
+ import { useIntl } from "@antdv-vue/pro-provider";
6
+ import { CloseCircleFilled, DownOutlined } from "@antdv-next/icons";
7
+ import { useConfig as useConfig$1 } from "antdv-next/config-provider/context";
8
+ //#region src/components/FieldLabel/index.tsx
9
+ const FieldLabel = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
10
+ const config = useConfig$1();
11
+ const { componentSize } = useConfig();
12
+ const prefixCls = computed(() => config.value.getPrefixCls("pro"));
13
+ const baseClassName = computed(() => `${prefixCls.value}-core-field-label`);
14
+ const [hashId, cssVarCls] = style_default(baseClassName);
15
+ const intl = useIntl();
16
+ const clearRef = shallowRef(null);
17
+ const labelRef = shallowRef(null);
18
+ const wrapElements = (array) => {
19
+ if (array.every((item) => typeof item === "string")) return array.join(",");
20
+ return array.map((item, index) => {
21
+ const comma = index === array.length - 1 ? "" : ",";
22
+ if (typeof item === "string") return createVNode("span", { "key": index }, [item, comma]);
23
+ return createVNode("span", {
24
+ "key": index,
25
+ "style": { display: "flex" }
26
+ }, [item, comma]);
27
+ });
28
+ };
29
+ const formatterText = (aValue) => {
30
+ if (props.formatter) return props.formatter(aValue);
31
+ return Array.isArray(aValue) ? wrapElements(aValue) : aValue;
32
+ };
33
+ const getTextByValue = (aLabel, aValue) => {
34
+ if (aValue !== void 0 && aValue !== null && aValue !== "" && (!Array.isArray(aValue) || aValue.length)) {
35
+ const prefix = aLabel ? createVNode("span", {
36
+ "onClick": () => props.onLabelClick?.(),
37
+ "class": `${baseClassName.value}-text`
38
+ }, [aLabel, ": "]) : "";
39
+ const str = formatterText(aValue);
40
+ if (!props.ellipsis) return createVNode("span", { "style": {
41
+ display: "inline-flex",
42
+ alignItems: "center"
43
+ } }, [prefix, formatterText(aValue)]);
44
+ const getText = () => {
45
+ const isArrayValue = Array.isArray(aValue) && aValue.length > 1;
46
+ const unitText = intl.value.getMessage({
47
+ id: "form.lightFilter.itemUnit",
48
+ defaultMessage: "项"
49
+ });
50
+ if (typeof str === "string" && str.length > props.valueMaxLength && isArrayValue) return `...${aValue.length}${unitText}`;
51
+ return "";
52
+ };
53
+ const tail = getText();
54
+ return createVNode("span", {
55
+ "title": typeof str === "string" ? str : void 0,
56
+ "style": {
57
+ display: "inline-flex",
58
+ alignItems: "center"
59
+ }
60
+ }, [
61
+ prefix,
62
+ createVNode("span", { "style": {
63
+ paddingInlineStart: "4px",
64
+ display: "flex"
65
+ } }, [typeof str === "string" ? str?.toString()?.slice?.(0, props.valueMaxLength) : str]),
66
+ tail
67
+ ]);
68
+ }
69
+ return aLabel || props.placeholder;
70
+ };
71
+ expose({
72
+ labelRef,
73
+ clearRef
74
+ });
75
+ return () => {
76
+ const { label, onClear, value, disabled, variant = "borderless", size: propsSize, downIcon, allowClear = true } = props;
77
+ const size = componentSize.value ? componentSize.value : "middle";
78
+ return createVNode("span", {
79
+ "class": classNames(baseClassName.value, hashId.value, cssVarCls.value, `${baseClassName.value}-${propsSize ?? size ?? "middle"}`, {
80
+ [`${baseClassName.value}-${variant}-active`]: (Array.isArray(value) ? value.length > 0 : !!value) || value === 0,
81
+ [`${baseClassName.value}-active`]: (Array.isArray(value) ? value.length > 0 : !!value) || value === 0,
82
+ [`${baseClassName.value}-disabled`]: disabled,
83
+ [`${baseClassName.value}-${variant}`]: variant,
84
+ [`${baseClassName.value}-allow-clear`]: allowClear
85
+ }, attrs.class),
86
+ "style": attrs.style,
87
+ "ref": labelRef,
88
+ "onClick": () => {
89
+ props?.onClick?.();
90
+ }
91
+ }, [
92
+ getTextByValue(label, value),
93
+ (value || value === 0) && allowClear && createVNode("span", {
94
+ "role": "button",
95
+ "class": classNames(`${baseClassName.value}-icon`, hashId.value, cssVarCls.value, `${baseClassName.value}-close`),
96
+ "title": intl.value.getMessage({
97
+ id: "form.lightFilter.clear",
98
+ defaultMessage: "清除"
99
+ }),
100
+ "onClick": (e) => {
101
+ if (!disabled) onClear?.();
102
+ e.stopPropagation();
103
+ },
104
+ "ref": clearRef
105
+ }, [createVNode(CloseCircleFilled, null, null)]),
106
+ downIcon !== false ? downIcon ?? createVNode(DownOutlined, { "class": classNames(`${baseClassName.value}-icon`, hashId.value, cssVarCls.value, `${baseClassName.value}-arrow`) }, null) : null
107
+ ]);
108
+ };
109
+ }, {
110
+ props: {
111
+ label: {
112
+ type: [
113
+ Object,
114
+ Function,
115
+ String,
116
+ Number,
117
+ null,
118
+ Boolean,
119
+ Array
120
+ ],
121
+ required: false,
122
+ default: void 0
123
+ },
124
+ value: {
125
+ type: [
126
+ Object,
127
+ Function,
128
+ String,
129
+ Number,
130
+ null,
131
+ Boolean,
132
+ Array
133
+ ],
134
+ required: false,
135
+ default: void 0
136
+ },
137
+ disabled: {
138
+ type: Boolean,
139
+ required: false,
140
+ default: void 0
141
+ },
142
+ onClear: {
143
+ type: Function,
144
+ required: false
145
+ },
146
+ size: {
147
+ type: [String, null],
148
+ required: false
149
+ },
150
+ ellipsis: {
151
+ type: Boolean,
152
+ required: false,
153
+ default: void 0
154
+ },
155
+ placeholder: {
156
+ type: [
157
+ Object,
158
+ Function,
159
+ String,
160
+ Number,
161
+ null,
162
+ Boolean,
163
+ Array
164
+ ],
165
+ required: false,
166
+ default: void 0
167
+ },
168
+ formatter: {
169
+ type: Function,
170
+ required: false
171
+ },
172
+ variant: {
173
+ type: String,
174
+ required: false
175
+ },
176
+ allowClear: {
177
+ type: Boolean,
178
+ required: false,
179
+ default: void 0
180
+ },
181
+ downIcon: {
182
+ type: [
183
+ Object,
184
+ Function,
185
+ String,
186
+ Number,
187
+ null,
188
+ Boolean,
189
+ Array
190
+ ],
191
+ required: false,
192
+ default: void 0
193
+ },
194
+ onClick: {
195
+ type: Function,
196
+ required: false
197
+ },
198
+ valueMaxLength: {
199
+ type: Number,
200
+ required: false,
201
+ default: 41
202
+ },
203
+ onLabelClick: {
204
+ type: Function,
205
+ required: false
206
+ }
207
+ },
208
+ name: "FieldLabel",
209
+ inheritAttrs: false
210
+ });
211
+ //#endregion
212
+ export { FieldLabel 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/FieldLabel/style/index.d.ts
5
+ interface ProFieldLabelToken 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 { ProFieldLabelToken, _default as default };
@@ -0,0 +1,146 @@
1
+ import { useStyle } from "@antdv-vue/pro-provider";
2
+ import { mergeToken, unit } from "@antdv-next/cssinjs";
3
+ //#region src/components/FieldLabel/style/index.ts
4
+ const genProStyle = (token) => {
5
+ return { [token.componentCls]: {
6
+ boxSizing: "border-box",
7
+ display: "inline-flex",
8
+ gap: token.marginXXS,
9
+ alignItems: "center",
10
+ height: 30,
11
+ paddingBlock: 0,
12
+ paddingInline: token.paddingXS,
13
+ fontSize: token.fontSize,
14
+ lineHeight: token.lineHeight,
15
+ borderRadius: token.borderRadius,
16
+ cursor: "pointer",
17
+ "&:hover": { backgroundColor: token.colorBgTextHover },
18
+ "&-active": {
19
+ paddingBlock: 0,
20
+ paddingInline: 8,
21
+ [`&${token.componentCls}-allow-clear:hover:not(${token.componentCls}-disabled)`]: {
22
+ [`${token.componentCls}-arrow`]: { display: "none" },
23
+ [`${token.componentCls}-close`]: { display: "inline-flex" }
24
+ }
25
+ },
26
+ [`${token.antCls}-select`]: { [`${token.antCls}-select-clear`]: { borderRadius: "50%" } },
27
+ [`${token.antCls}-picker`]: { [`${token.antCls}-picker-clear`]: { borderRadius: "50%" } },
28
+ "&-icon": {
29
+ color: token.colorIcon,
30
+ transition: `color ${token.motionDurationSlow}`,
31
+ fontSize: token.fontSizeIcon,
32
+ verticalAlign: "middle",
33
+ [`&${token.componentCls}-close`]: {
34
+ display: "none",
35
+ fontSize: token.fontSizeIcon,
36
+ alignItems: "center",
37
+ justifyContent: "center",
38
+ color: token.colorTextQuaternary,
39
+ borderRadius: "50%"
40
+ },
41
+ "&:hover": { color: token.colorIconHover }
42
+ },
43
+ "&-disabled": {
44
+ color: token.colorTextPlaceholder,
45
+ cursor: "not-allowed",
46
+ [`${token.componentCls}-icon`]: { color: token.colorTextPlaceholder }
47
+ },
48
+ "&-outlined": {
49
+ height: 34,
50
+ lineHeight: "34px",
51
+ paddingBlock: 0,
52
+ paddingInline: 8,
53
+ border: `${unit(token.lineWidth)} ${token.lineType} ${token.colorBorder}`,
54
+ borderRadius: token.borderRadius,
55
+ "&:hover": {
56
+ backgroundColor: "transparent",
57
+ borderColor: token.colorPrimary
58
+ },
59
+ "&-active": {
60
+ backgroundColor: "transparent",
61
+ "&:focus-visible,&:has(input:focus-visible)": {
62
+ outline: `${unit(token.lineWidth)} ${token.lineType} ${token.colorPrimary}`,
63
+ outlineOffset: token.calc(token.lineWidth).mul(-1).equal({ unit: false }),
64
+ transition: "outline-offset 0s, outline 0s"
65
+ }
66
+ },
67
+ [`${token.antCls}-picker`]: { [`&${token.antCls}-picker-borderless:focus-visible,&${token.antCls}-picker-borderless:has(input:focus-visible),&${token.antCls}-picker-borderless:has(textarea:focus-visible)`]: { outline: "none" } },
68
+ [`${token.antCls}-select`]: { [`&${token.antCls}-select-borderless:not(&${token.antCls}-select-disabled):has(input:focus-visible)`]: { outline: "none" } }
69
+ },
70
+ "&-borderless": {
71
+ height: 30,
72
+ lineHeight: "34px",
73
+ boxSizing: "border-box",
74
+ border: `${unit(token.lineWidth)} ${token.lineType} transparent`,
75
+ "&:hover": {
76
+ backgroundColor: "transparent",
77
+ borderColor: token.colorPrimary
78
+ },
79
+ "&-active": { "&:focus-visible,&:has(input:focus-visible)": {
80
+ outline: `${unit(token.lineWidth)} ${token.lineType} ${token.colorPrimary}`,
81
+ outlineOffset: token.calc(token.lineWidth).mul(-1).equal({ unit: false }),
82
+ transition: "outline-offset 0s, outline 0s"
83
+ } },
84
+ [`${token.antCls}-select`]: { [`&${token.antCls}-select-borderless:not(&${token.antCls}-select-disabled):has(input:focus-visible)`]: { outline: "none" } },
85
+ [`${token.antCls}-picker`]: { [`&${token.antCls}-picker-borderless:focus-visible,&${token.antCls}-picker-borderless:has(input:focus-visible)`]: { outline: "none" } }
86
+ },
87
+ "&-filled": {
88
+ height: 34,
89
+ lineHeight: "34px",
90
+ backgroundColor: token.colorBgTextHover,
91
+ border: `${unit(token.lineWidth)} ${token.lineType} transparent`,
92
+ "&:hover": {
93
+ border: `${unit(token.lineWidth)} ${token.lineType} ${token.colorPrimary}`,
94
+ backgroundColor: token.colorBgTextHover
95
+ },
96
+ [`${token.antCls}-picker`]: { [`&${token.antCls}-picker-borderless:focus-visible,&${token.antCls}-picker-borderless:has(input:focus-visible),&${token.antCls}-picker-borderless:has(textarea:focus-visible)`]: { outline: "none" } },
97
+ [`${token.antCls}-select`]: { [`&${token.antCls}-select-borderless:not(&${token.antCls}-select-disabled):has(input:focus-visible)`]: { outline: "none" } }
98
+ },
99
+ "&-underlined": {
100
+ height: 34,
101
+ lineHeight: "34px",
102
+ borderRadius: 0,
103
+ borderBottom: `${unit(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
104
+ "&:hover": {
105
+ borderBottom: `${unit(token.lineWidth)} ${token.lineType} ${token.colorPrimary}`,
106
+ backgroundColor: token.colorBgTextHover
107
+ },
108
+ [`${token.antCls}-picker`]: { [`&${token.antCls}-picker-borderless:focus-visible,&${token.antCls}-picker-borderless:has(input:focus-visible),&${token.antCls}-picker-borderless:has(textarea:focus-visible)`]: { outline: "none" } },
109
+ [`${token.antCls}-select`]: { [`&${token.antCls}-select-borderless:not(&${token.antCls}-select-disabled):has(input:focus-visible)`]: { outline: "none" } }
110
+ },
111
+ "&-bordered&-small": {
112
+ height: 24,
113
+ lineHeight: "24px",
114
+ paddingBlock: 0,
115
+ paddingInline: 8
116
+ },
117
+ "&-bordered&-active": { backgroundColor: token.colorBgContainer },
118
+ "&-small": {
119
+ height: 24,
120
+ lineHeight: "24px",
121
+ paddingBlock: 0,
122
+ paddingInline: 4,
123
+ fontSize: token.fontSizeSM,
124
+ [`${token.antCls}-select-borderless`]: { paddingBlock: 0 },
125
+ [`${token.antCls}-picker-borderless`]: { paddingBlock: 0 },
126
+ [`&${token.componentCls}-active`]: {
127
+ paddingBlock: 0,
128
+ paddingInline: 8
129
+ },
130
+ [`${token.componentCls}-icon`]: {
131
+ paddingBlock: 0,
132
+ paddingInline: 0
133
+ },
134
+ [`${token.componentCls}-close`]: {
135
+ marginBlockStart: -2,
136
+ paddingBlock: 4,
137
+ paddingInline: 4
138
+ }
139
+ }
140
+ } };
141
+ };
142
+ var style_default = useStyle("FieldLabel", (token) => {
143
+ return [genProStyle(mergeToken(token, {}))];
144
+ });
145
+ //#endregion
146
+ export { style_default as default };
@@ -0,0 +1,38 @@
1
+ import { VueNode as VueNode$1 } from "../../typing.js";
2
+ import { DropdownFooterProps } from "../DropdownFooter/index.js";
3
+ import * as _$vue from "vue";
4
+ import { CSSProperties } from "vue";
5
+ import { PopoverProps, TooltipPlacement } from "antdv-next";
6
+ import { CustomSlotsType } from "@v-c/util/dist/type";
7
+
8
+ //#region src/components/FilterDropdown/index.d.ts
9
+ type FooterRender = ((onConfirm?: (e?: MouseEvent) => void, onClear?: (e?: MouseEvent) => void) => VueNode$1) | false;
10
+ interface FilterDropdownProps {
11
+ label?: VueNode$1;
12
+ footer?: DropdownFooterProps;
13
+ footerRender?: FooterRender;
14
+ padding?: number;
15
+ disabled?: boolean;
16
+ onOpenChange?: (open: boolean) => void;
17
+ open?: boolean;
18
+ placement?: TooltipPlacement;
19
+ /**
20
+ * @name 透传给 Popover 的属性
21
+ *
22
+ * @description
23
+ * 用于给弹层(portal 到 body 的容器)设置自定义类名/样式等,例如通过 classNames.root 控制样式范围。
24
+ *
25
+ * @example
26
+ * popoverProps={{ classNames: { root: 'my-lightfilter-popover' } } }
27
+ */
28
+ popoverProps?: Omit<PopoverProps, 'content' | 'trigger' | 'styles' | 'open' | 'onOpenChange' | 'placement'> & {
29
+ styles?: PopoverProps['styles'] & {
30
+ container?: CSSProperties;
31
+ };
32
+ };
33
+ }
34
+ declare const FilterDropdown: _$vue.DefineSetupFnComponent<FilterDropdownProps, {}, CustomSlotsType<{
35
+ default?: () => VueNode$1;
36
+ }>, FilterDropdownProps & {}, _$vue.PublicProps>;
37
+ //#endregion
38
+ export { FilterDropdownProps, FooterRender, FilterDropdown as default };