fast-element-plus 2.0.15 → 2.0.17

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 (145) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/component.d.ts +6570 -2
  3. package/dist/component.mjs.map +1 -1
  4. package/dist/components/avatar/src/avatar.d.ts +19 -7
  5. package/dist/components/avatar/src/avatar.mjs +5 -0
  6. package/dist/components/avatar/src/avatar.mjs.map +1 -1
  7. package/dist/components/button/src/button.d.ts +4 -4
  8. package/dist/components/button/src/button.mjs +3 -4
  9. package/dist/components/button/src/button.mjs.map +1 -1
  10. package/dist/components/carNumber/src/carNumber.mjs +7 -9
  11. package/dist/components/carNumber/src/carNumber.mjs.map +1 -1
  12. package/dist/components/contextMenu/index.d.ts +1 -1
  13. package/dist/components/contextMenu/index.mjs.map +1 -1
  14. package/dist/components/contextMenu/src/contextMenu.d.ts +2 -2
  15. package/dist/components/contextMenu/src/contextMenu.mjs +10 -9
  16. package/dist/components/contextMenu/src/contextMenu.mjs.map +1 -1
  17. package/dist/components/dialog/src/dialog.d.ts +7 -4
  18. package/dist/components/dialog/src/dialog.mjs +10 -11
  19. package/dist/components/dialog/src/dialog.mjs.map +1 -1
  20. package/dist/components/drawer/src/drawer.d.ts +2 -2
  21. package/dist/components/drawer/src/drawer.mjs +18 -18
  22. package/dist/components/drawer/src/drawer.mjs.map +1 -1
  23. package/dist/components/form/src/form.d.ts +34 -16
  24. package/dist/components/form/src/form.mjs +8 -9
  25. package/dist/components/form/src/form.mjs.map +1 -1
  26. package/dist/components/form/src/formItem.d.ts +4 -4
  27. package/dist/components/form/src/formItem.mjs +18 -17
  28. package/dist/components/form/src/formItem.mjs.map +1 -1
  29. package/dist/components/form/utils/form.d.ts +3 -3
  30. package/dist/components/form/utils/form.mjs +6 -10
  31. package/dist/components/form/utils/form.mjs.map +1 -1
  32. package/dist/components/icon/src/icon.mjs.map +1 -1
  33. package/dist/components/iconSelector/src/iconSelector.d.ts +2 -2
  34. package/dist/components/iconSelector/src/iconSelector.mjs +4 -5
  35. package/dist/components/iconSelector/src/iconSelector.mjs.map +1 -1
  36. package/dist/components/image/src/image.d.ts +1 -1
  37. package/dist/components/image/src/image.mjs +3 -3
  38. package/dist/components/image/src/image.mjs.map +1 -1
  39. package/dist/components/inputDialogPage/src/inputDialogPage.d.ts +4 -4
  40. package/dist/components/inputDialogPage/src/inputDialogPage.mjs +11 -15
  41. package/dist/components/inputDialogPage/src/inputDialogPage.mjs.map +1 -1
  42. package/dist/components/layoutGrid/index.d.ts +1 -1
  43. package/dist/components/layoutGrid/index.mjs.map +1 -1
  44. package/dist/components/layoutGrid/src/layoutGrid.d.ts +23 -11
  45. package/dist/components/layoutGrid/src/layoutGrid.mjs +44 -45
  46. package/dist/components/layoutGrid/src/layoutGrid.mjs.map +1 -1
  47. package/dist/components/layoutGrid/src/layoutGrid.type.d.ts +1 -1
  48. package/dist/components/layoutGrid/src/layoutGridItem.mjs +13 -14
  49. package/dist/components/layoutGrid/src/layoutGridItem.mjs.map +1 -1
  50. package/dist/components/select/index.d.ts +1 -1
  51. package/dist/components/select/index.mjs.map +1 -1
  52. package/dist/components/select/src/select.d.ts +29 -14
  53. package/dist/components/select/src/select.mjs +47 -45
  54. package/dist/components/select/src/select.mjs.map +1 -1
  55. package/dist/components/select/src/selectOption.mjs +4 -5
  56. package/dist/components/select/src/selectOption.mjs.map +1 -1
  57. package/dist/components/selectPage/src/selectPage.d.ts +29 -14
  58. package/dist/components/selectPage/src/selectPage.mjs +45 -52
  59. package/dist/components/selectPage/src/selectPage.mjs.map +1 -1
  60. package/dist/components/selectV2/src/selectV2.d.ts +51 -31
  61. package/dist/components/selectV2/src/selectV2.mjs +66 -64
  62. package/dist/components/selectV2/src/selectV2.mjs.map +1 -1
  63. package/dist/components/table/index.d.ts +3 -3
  64. package/dist/components/table/index.mjs +1 -3
  65. package/dist/components/table/index.mjs.map +1 -1
  66. package/dist/components/table/src/table.d.ts +72 -38
  67. package/dist/components/table/src/table.mjs +98 -104
  68. package/dist/components/table/src/table.mjs.map +1 -1
  69. package/dist/components/table/src/table.type.d.ts +2 -2
  70. package/dist/components/table/src/table.type.mjs.map +1 -1
  71. package/dist/components/table/src/tableColumn.d.ts +7 -7
  72. package/dist/components/table/src/tableColumn.mjs +25 -45
  73. package/dist/components/table/src/tableColumn.mjs.map +1 -1
  74. package/dist/components/table/src/tableColumnSettingDialog.mjs +32 -22
  75. package/dist/components/table/src/tableColumnSettingDialog.mjs.map +1 -1
  76. package/dist/components/table/src/tablePagination.mjs +2 -3
  77. package/dist/components/table/src/tablePagination.mjs.map +1 -1
  78. package/dist/components/table/src/tableSearchForm.d.ts +4 -4
  79. package/dist/components/table/src/tableSearchForm.mjs +35 -44
  80. package/dist/components/table/src/tableSearchForm.mjs.map +1 -1
  81. package/dist/components/table/src/tableSearchFormItem.d.ts +1 -7
  82. package/dist/components/table/src/tableSearchFormItem.mjs +3 -6
  83. package/dist/components/table/src/tableSearchFormItem.mjs.map +1 -1
  84. package/dist/components/table/src/useTable.d.ts +4 -4
  85. package/dist/components/table/src/useTable.mjs +19 -20
  86. package/dist/components/table/src/useTable.mjs.map +1 -1
  87. package/dist/components/table/utils/table.mjs +6 -8
  88. package/dist/components/table/utils/table.mjs.map +1 -1
  89. package/dist/components/tree/index.d.ts +1 -1
  90. package/dist/components/tree/index.mjs.map +1 -1
  91. package/dist/components/tree/src/tree.d.ts +9 -9
  92. package/dist/components/tree/src/tree.mjs +29 -27
  93. package/dist/components/tree/src/tree.mjs.map +1 -1
  94. package/dist/components/treeSelect/src/treeSelect.d.ts +38 -35
  95. package/dist/components/treeSelect/src/treeSelect.mjs +47 -45
  96. package/dist/components/treeSelect/src/treeSelect.mjs.map +1 -1
  97. package/dist/components/upload/src/upload.d.ts +1 -1
  98. package/dist/components/upload/src/upload.mjs +5 -6
  99. package/dist/components/upload/src/upload.mjs.map +1 -1
  100. package/dist/components/upload/src/useUpload.mjs +8 -10
  101. package/dist/components/upload/src/useUpload.mjs.map +1 -1
  102. package/dist/components/upload/utils/upload.d.ts +1 -1
  103. package/dist/components/upload/utils/upload.mjs +1 -1
  104. package/dist/components/upload/utils/upload.mjs.map +1 -1
  105. package/dist/components/uploadImage/src/uploadImage.d.ts +8 -5
  106. package/dist/components/uploadImage/src/uploadImage.mjs +18 -13
  107. package/dist/components/uploadImage/src/uploadImage.mjs.map +1 -1
  108. package/dist/components/uploadImages/src/uploadImages.d.ts +8 -5
  109. package/dist/components/uploadImages/src/uploadImages.mjs +16 -11
  110. package/dist/components/uploadImages/src/uploadImages.mjs.map +1 -1
  111. package/dist/directives/click-copy/index.d.ts +1 -1
  112. package/dist/directives/click-copy/index.mjs +5 -9
  113. package/dist/directives/click-copy/index.mjs.map +1 -1
  114. package/dist/directives/click-debounce/index.d.ts +1 -1
  115. package/dist/directives/click-draggable/index.d.ts +1 -1
  116. package/dist/directives/click-icon-copy/index.d.ts +1 -1
  117. package/dist/directives/click-icon-copy/index.mjs.map +1 -1
  118. package/dist/directives/click-longpress/index.d.ts +1 -1
  119. package/dist/directives/click-throttle/index.d.ts +1 -1
  120. package/dist/element-plus.mjs +5 -6
  121. package/dist/element-plus.mjs.map +1 -1
  122. package/dist/hooks/use-screenFull/index.mjs.map +1 -1
  123. package/dist/index.css +1 -1
  124. package/dist/index.css.map +1 -1
  125. package/dist/index.global.min.js +4 -4
  126. package/dist/index.global.min.js.map +1 -1
  127. package/dist/index.mjs +1 -3
  128. package/dist/index.mjs.map +1 -1
  129. package/dist/utils/async/index.mjs +6 -4
  130. package/dist/utils/async/index.mjs.map +1 -1
  131. package/dist/utils/index.d.ts +1 -0
  132. package/dist/utils/object/index.d.ts +8 -0
  133. package/dist/utils/object/index.mjs +113 -0
  134. package/dist/utils/object/index.mjs.map +1 -0
  135. package/dist/utils/string/index.mjs +19 -11
  136. package/dist/utils/string/index.mjs.map +1 -1
  137. package/dist/utils/vue/emits.mjs.map +1 -1
  138. package/dist/utils/vue/install.mjs.map +1 -1
  139. package/dist/utils/vue/render.mjs.map +1 -1
  140. package/dist/version.d.ts +1 -1
  141. package/dist/version.mjs +1 -1
  142. package/dist/version.mjs.map +1 -1
  143. package/package.json +5 -10
  144. package/dist/components/table/src/page.type.mjs +0 -45
  145. package/dist/components/table/src/page.type.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"component.mjs","names":[],"sources":["../src/component.ts"],"sourcesContent":["import { FaAvatar } from \"./components/avatar\";\nimport { FaButton } from \"./components/button\";\nimport { FaCarNumber } from \"./components/carNumber\";\nimport { FaContextMenu } from \"./components/contextMenu\";\nimport { FaDialog } from \"./components/dialog\";\nimport { FaDrawer } from \"./components/drawer\";\nimport { FaForm, FaFormItem } from \"./components/form\";\nimport { FaFormItemTip } from \"./components/formItemTip\";\nimport { FaIcon } from \"./components/icon\";\nimport { FaIconSelector } from \"./components/iconSelector\";\nimport { FaImage } from \"./components/image\";\nimport { FaInputDialogPage } from \"./components/inputDialogPage\";\nimport { FaLayoutGrid, FaLayoutGridItem } from \"./components/layoutGrid\";\nimport { FaSelect, FaSelectOption } from \"./components/select\";\nimport { FaSelectPage } from \"./components/selectPage\";\nimport { FaSelectV2 } from \"./components/selectV2\";\nimport { FaTable, FaTableColumn } from \"./components/table\";\nimport { FaTree } from \"./components/tree\";\nimport { FaTreeSelect } from \"./components/treeSelect\";\nimport { FaUpload } from \"./components/upload\";\nimport { FaUploadImage } from \"./components/uploadImage\";\nimport { FaUploadImages } from \"./components/uploadImages\";\nimport type { Plugin } from \"vue\";\n\n/** 默认安装器注册的全部 Fast.Element.Plus 组件。 */\nexport default [\n\tFaAvatar,\n\tFaButton,\n\tFaCarNumber,\n\tFaContextMenu,\n\tFaDialog,\n\tFaDrawer,\n\tFaForm,\n\tFaFormItem,\n\tFaFormItemTip,\n\tFaIcon,\n\tFaIconSelector,\n\tFaImage,\n\tFaInputDialogPage,\n\tFaLayoutGrid,\n\tFaLayoutGridItem,\n\tFaSelect,\n\tFaSelectOption,\n\tFaSelectPage,\n\tFaSelectV2,\n\tFaTable,\n\tFaTableColumn,\n\tFaTree,\n\tFaTreeSelect,\n\tFaUpload,\n\tFaUploadImage,\n\tFaUploadImages,\n] as Plugin[];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAA,oBAAe;CACd;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD"}
1
+ {"version":3,"file":"component.mjs","names":[],"sources":["../src/component.ts"],"sourcesContent":["import { FaAvatar } from \"./components/avatar\";\nimport { FaButton } from \"./components/button\";\nimport { FaCarNumber } from \"./components/carNumber\";\nimport { FaContextMenu } from \"./components/contextMenu\";\nimport { FaDialog } from \"./components/dialog\";\nimport { FaDrawer } from \"./components/drawer\";\nimport { FaForm, FaFormItem } from \"./components/form\";\nimport { FaFormItemTip } from \"./components/formItemTip\";\nimport { FaIcon } from \"./components/icon\";\nimport { FaIconSelector } from \"./components/iconSelector\";\nimport { FaImage } from \"./components/image\";\nimport { FaInputDialogPage } from \"./components/inputDialogPage\";\nimport { FaLayoutGrid, FaLayoutGridItem } from \"./components/layoutGrid\";\nimport { FaSelect, FaSelectOption } from \"./components/select\";\nimport { FaSelectPage } from \"./components/selectPage\";\nimport { FaSelectV2 } from \"./components/selectV2\";\nimport { FaTable, FaTableColumn } from \"./components/table\";\nimport { FaTree } from \"./components/tree\";\nimport { FaTreeSelect } from \"./components/treeSelect\";\nimport { FaUpload } from \"./components/upload\";\nimport { FaUploadImage } from \"./components/uploadImage\";\nimport { FaUploadImages } from \"./components/uploadImages\";\n\n/** 默认安装器注册的全部 Fast.Element.Plus 组件。 */\nexport default [\n\tFaAvatar,\n\tFaButton,\n\tFaCarNumber,\n\tFaContextMenu,\n\tFaDialog,\n\tFaDrawer,\n\tFaForm,\n\tFaFormItem,\n\tFaFormItemTip,\n\tFaIcon,\n\tFaIconSelector,\n\tFaImage,\n\tFaInputDialogPage,\n\tFaLayoutGrid,\n\tFaLayoutGridItem,\n\tFaSelect,\n\tFaSelectOption,\n\tFaSelectPage,\n\tFaSelectV2,\n\tFaTable,\n\tFaTableColumn,\n\tFaTree,\n\tFaTreeSelect,\n\tFaUpload,\n\tFaUploadImage,\n\tFaUploadImages,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAA,oBAAe;CACd;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD"}
@@ -1,10 +1,15 @@
1
1
  import type { Component } from "vue";
2
2
  /** FaAvatar 的运行时 Props 定义。 */
3
3
  export declare const faAvatarProps: {
4
+ /** @description set how the image fit its container for an image avatar. */
5
+ fit: {
6
+ type: import("vue").PropType<"cover" | "fill" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "none" | "contain" | "scale-down">;
7
+ default: string;
8
+ };
4
9
  /** @description representation type to icon, more info on icon component. */
5
10
  icon: {
6
11
  type: import("vue").PropType<string | Component>;
7
- default: () => string | Component;
12
+ default: () => import("vue").DefineComponent<{}, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
13
  };
9
14
  /** @description Base64图片 */
10
15
  base64: BooleanConstructor;
@@ -31,7 +36,6 @@ export declare const faAvatarProps: {
31
36
  src: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
32
37
  alt: StringConstructor;
33
38
  srcSet: StringConstructor;
34
- fit: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<(new (...args: any[]) => "fill" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "none" | "contain" | "cover" | "scale-down") | (() => import("csstype").Property.ObjectFit | undefined) | (((new (...args: any[]) => "fill" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "none" | "contain" | "cover" | "scale-down") | (() => import("csstype").Property.ObjectFit | undefined)) | null)[], unknown, unknown, "cover", boolean>;
35
39
  };
36
40
  /** FaAvatar 的运行时 Emits 定义。 */
37
41
  export declare const faAvatarEmits: {
@@ -45,10 +49,15 @@ export interface FaAvatarSlots extends Record<string, unknown> {
45
49
  };
46
50
  }
47
51
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
52
+ /** @description set how the image fit its container for an image avatar. */
53
+ fit: {
54
+ type: import("vue").PropType<"cover" | "fill" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "none" | "contain" | "scale-down">;
55
+ default: string;
56
+ };
48
57
  /** @description representation type to icon, more info on icon component. */
49
58
  icon: {
50
59
  type: import("vue").PropType<string | Component>;
51
- default: () => string | Component;
60
+ default: () => import("vue").DefineComponent<{}, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
52
61
  };
53
62
  /** @description Base64图片 */
54
63
  base64: BooleanConstructor;
@@ -75,17 +84,21 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
75
84
  src: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
76
85
  alt: StringConstructor;
77
86
  srcSet: StringConstructor;
78
- fit: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<(new (...args: any[]) => "fill" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "none" | "contain" | "cover" | "scale-down") | (() => import("csstype").Property.ObjectFit | undefined) | (((new (...args: any[]) => "fill" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "none" | "contain" | "cover" | "scale-down") | (() => import("csstype").Property.ObjectFit | undefined)) | null)[], unknown, unknown, "cover", boolean>;
79
87
  }>, {
80
88
  /** @description 图片路径 */
81
89
  src: string | undefined;
82
90
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
83
91
  error: (evt: Event) => boolean;
84
92
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
93
+ /** @description set how the image fit its container for an image avatar. */
94
+ fit: {
95
+ type: import("vue").PropType<"cover" | "fill" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "none" | "contain" | "scale-down">;
96
+ default: string;
97
+ };
85
98
  /** @description representation type to icon, more info on icon component. */
86
99
  icon: {
87
100
  type: import("vue").PropType<string | Component>;
88
- default: () => string | Component;
101
+ default: () => import("vue").DefineComponent<{}, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
89
102
  };
90
103
  /** @description Base64图片 */
91
104
  base64: BooleanConstructor;
@@ -112,17 +125,16 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
112
125
  src: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
113
126
  alt: StringConstructor;
114
127
  srcSet: StringConstructor;
115
- fit: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<(new (...args: any[]) => "fill" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "none" | "contain" | "cover" | "scale-down") | (() => import("csstype").Property.ObjectFit | undefined) | (((new (...args: any[]) => "fill" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "none" | "contain" | "cover" | "scale-down") | (() => import("csstype").Property.ObjectFit | undefined)) | null)[], unknown, unknown, "cover", boolean>;
116
128
  }>> & Readonly<{
117
129
  onError?: ((evt: Event) => any) | undefined;
118
130
  }>, {
119
131
  small: boolean;
132
+ fit: "cover" | "fill" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "none" | "contain" | "scale-down";
120
133
  icon: string | Component;
121
134
  base64: boolean;
122
135
  original: boolean;
123
136
  normal: boolean;
124
137
  thumb: boolean;
125
138
  src: string;
126
- fit: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...args: any[]) => "fill" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "none" | "contain" | "cover" | "scale-down") | (() => import("csstype").Property.ObjectFit | undefined) | ((new (...args: any[]) => "fill" | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "none" | "contain" | "cover" | "scale-down") | (() => import("csstype").Property.ObjectFit | undefined) | null)[], unknown, unknown>;
127
139
  }, import("../../../utils").TypedSlotsDeclaration<FaAvatarSlots>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
128
140
  export default _default;
@@ -10,6 +10,11 @@ import { ElAvatar, avatarEmits, avatarProps } from "element-plus";
10
10
  /** FaAvatar 的运行时 Props 定义。 */
11
11
  const faAvatarProps = {
12
12
  ...avatarProps,
13
+ /** @description set how the image fit its container for an image avatar. */
14
+ fit: {
15
+ type: definePropType(String),
16
+ default: "cover"
17
+ },
13
18
  /** @description representation type to icon, more info on icon component. */
14
19
  icon: {
15
20
  type: definePropType([
@@ -1 +1 @@
1
- {"version":3,"file":"avatar.mjs","names":[],"sources":["../../../../src/components/avatar/src/avatar.tsx"],"sourcesContent":["import { computed, defineComponent, reactive } from \"vue\";\nimport { Picture } from \"@element-plus/icons-vue\";\nimport { ElAvatar, avatarEmits, avatarProps } from \"element-plus\";\nimport { definePropType, makeSlots, useEmits, useExpose, useProps, useRender } from \"../../../utils\";\nimport type { Component } from \"vue\";\n\n/** FaAvatar 的运行时 Props 定义。 */\nexport const faAvatarProps = {\n\t...avatarProps,\n\t/** @description representation type to icon, more info on icon component. */\n\ticon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: (): string | Component => Picture,\n\t},\n\t/** @description Base64图片 */\n\tbase64: Boolean,\n\t/** @description 原图 */\n\toriginal: Boolean,\n\t/** @description 标准 */\n\tnormal: Boolean,\n\t/** @description 小图 */\n\tsmall: Boolean,\n\t/** @description 缩略图 */\n\tthumb: Boolean,\n};\n\n/** FaAvatar 的运行时 Emits 定义。 */\nexport const faAvatarEmits = {\n\t...avatarEmits,\n};\n\n/** FaAvatar 的插槽参数。 */\nexport interface FaAvatarSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: { src?: string };\n}\n\nexport default defineComponent({\n\tname: \"FaAvatar\",\n\tprops: faAvatarProps,\n\temits: faAvatarEmits,\n\tslots: makeSlots<FaAvatarSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst state = reactive({\n\t\t\tsrc: computed(() => {\n\t\t\t\tif (!props.src) return undefined;\n\t\t\t\tif (props.base64) {\n\t\t\t\t\treturn `data:image/png;base64,${props.src}`;\n\t\t\t\t} else if (props.original) {\n\t\t\t\t\treturn props.src;\n\t\t\t\t} else if (props.normal) {\n\t\t\t\t\treturn `${props.src}@!normal`;\n\t\t\t\t} else if (props.small) {\n\t\t\t\t\treturn `${props.src}@!small`;\n\t\t\t\t} else if (props.thumb) {\n\t\t\t\t\treturn `${props.src}@!thumb`;\n\t\t\t\t} else {\n\t\t\t\t\t// 默认使用缩略图\n\t\t\t\t\treturn `${props.src}@!thumb`;\n\t\t\t\t}\n\t\t\t}),\n\t\t});\n\n\t\tconst elAvatarProps = useProps(props, avatarProps, [\"src\"]);\n\t\tconst elAvatarEmits = useEmits(avatarEmits, emit);\n\n\t\tuseRender(() => (\n\t\t\t<ElAvatar {...elAvatarProps.value} {...elAvatarEmits.value} class=\"fa-avatar\" src={state.src}>\n\t\t\t\t{slots.default?.({ src: state.src })}\n\t\t\t</ElAvatar>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 图片路径 */\n\t\t\tsrc: state.src,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;AAOA,MAAa,gBAAgB;CAC5B,GAAG;;CAEH,MAAM;EACL,MAAM,eAAmC;GAAC;GAAQ;GAAQ;EAAQ,CAAC;EACnE,eAAmC;CACpC;;CAEA,QAAQ;;CAER,UAAU;;CAEV,QAAQ;;CAER,OAAO;;CAEP,OAAO;AACR;;AAGA,MAAa,gBAAgB,EAC5B,GAAG,YACJ;AAQA,IAAA,iBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAAyB;CAChC,MAAM,OAAO,EAAE,OAAO,MAAM,UAAU;EACrC,MAAM,QAAQ,SAAS,EACtB,KAAK,eAAe;GACnB,IAAI,CAAC,MAAM,KAAK,OAAO,KAAA;GACvB,IAAI,MAAM,QACT,OAAO,yBAAyB,MAAM;QAChC,IAAI,MAAM,UAChB,OAAO,MAAM;QACP,IAAI,MAAM,QAChB,OAAO,GAAG,MAAM,IAAG;QACb,IAAI,MAAM,OAChB,OAAO,GAAG,MAAM,IAAG;QACb,IAAI,MAAM,OAChB,OAAO,GAAG,MAAM,IAAG;QAGnB,OAAO,GAAG,MAAM,IAAG;EAErB,CAAC,EACF,CAAC;EAED,MAAM,gBAAgB,SAAS,OAAO,aAAa,CAAC,KAAK,CAAC;EAC1D,MAAM,gBAAgB,SAAS,aAAa,IAAI;EAEhD,gBAAU,YAAA,UAAA,WACK,cAAc,OAAW,cAAc,OAAK;GAAA,SAAA;GAAA,OAAyB,MAAM;EAAG,CAAA,GAAA,EAAA,eAAA,CAC1F,MAAM,UAAU,EAAE,KAAK,MAAM,IAAI,CAAC,CAAC,EAAA,CAAA,CAErC;EAED,OAAO,UAAU,QAAQ;;AAExB,KAAK,MAAM,IACZ,CAAC;CACF;AACD,CAAC"}
1
+ {"version":3,"file":"avatar.mjs","names":[],"sources":["../../../../src/components/avatar/src/avatar.tsx"],"sourcesContent":["import { computed, defineComponent, reactive } from \"vue\";\nimport { Picture } from \"@element-plus/icons-vue\";\nimport { ElAvatar, avatarEmits, avatarProps } from \"element-plus\";\nimport { definePropType, makeSlots, useEmits, useExpose, useProps, useRender } from \"../../../utils\";\nimport type { Component } from \"vue\";\n\n/** FaAvatar 的运行时 Props 定义。 */\nexport const faAvatarProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...avatarProps,\n\t/** @description set how the image fit its container for an image avatar. */\n\tfit: {\n\t\ttype: definePropType<\n\t\t\t\"fill\" | \"-moz-initial\" | \"inherit\" | \"initial\" | \"revert\" | \"revert-layer\" | \"unset\" | \"none\" | \"contain\" | \"cover\" | \"scale-down\"\n\t\t>(String),\n\t\tdefault: \"cover\",\n\t},\n\t/** @description representation type to icon, more info on icon component. */\n\ticon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: () => Picture,\n\t},\n\t/** @description Base64图片 */\n\tbase64: Boolean,\n\t/** @description 原图 */\n\toriginal: Boolean,\n\t/** @description 标准 */\n\tnormal: Boolean,\n\t/** @description 小图 */\n\tsmall: Boolean,\n\t/** @description 缩略图 */\n\tthumb: Boolean,\n};\n\n/** FaAvatar 的运行时 Emits 定义。 */\nexport const faAvatarEmits = {\n\t...avatarEmits,\n};\n\n/** FaAvatar 的插槽参数。 */\nexport interface FaAvatarSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: { src?: string };\n}\n\nexport default defineComponent({\n\tname: \"FaAvatar\",\n\tprops: faAvatarProps,\n\temits: faAvatarEmits,\n\tslots: makeSlots<FaAvatarSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst state = reactive({\n\t\t\tsrc: computed(() => {\n\t\t\t\tif (!props.src) return undefined;\n\t\t\t\tif (props.base64) {\n\t\t\t\t\treturn `data:image/png;base64,${props.src}`;\n\t\t\t\t} else if (props.original) {\n\t\t\t\t\treturn props.src;\n\t\t\t\t} else if (props.normal) {\n\t\t\t\t\treturn `${props.src}@!normal`;\n\t\t\t\t} else if (props.small) {\n\t\t\t\t\treturn `${props.src}@!small`;\n\t\t\t\t} else if (props.thumb) {\n\t\t\t\t\treturn `${props.src}@!thumb`;\n\t\t\t\t} else {\n\t\t\t\t\t// 默认使用缩略图\n\t\t\t\t\treturn `${props.src}@!thumb`;\n\t\t\t\t}\n\t\t\t}),\n\t\t});\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elAvatarProps = useProps(props, avatarProps, [\"src\"]);\n\t\tconst elAvatarEmits = useEmits(avatarEmits, emit);\n\n\t\tuseRender(() => (\n\t\t\t<ElAvatar {...elAvatarProps.value} {...elAvatarEmits.value} class=\"fa-avatar\" src={state.src}>\n\t\t\t\t{slots.default?.({ src: state.src })}\n\t\t\t</ElAvatar>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 图片路径 */\n\t\t\tsrc: state.src,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;AAOA,MAAa,gBAAgB;CAE5B,GAAG;;CAEH,KAAK;EACJ,MAAM,eAEJ,MAAM;EACR,SAAS;CACV;;CAEA,MAAM;EACL,MAAM,eAAmC;GAAC;GAAQ;GAAQ;EAAQ,CAAC;EACnE,eAAe;CAChB;;CAEA,QAAQ;;CAER,UAAU;;CAEV,QAAQ;;CAER,OAAO;;CAEP,OAAO;AACR;;AAGA,MAAa,gBAAgB,EAC5B,GAAG,YACJ;AAQA,IAAA,iBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAAyB;CAChC,MAAM,OAAO,EAAE,OAAO,MAAM,UAAU;EACrC,MAAM,QAAQ,SAAS,EACtB,KAAK,eAAe;GACnB,IAAI,CAAC,MAAM,KAAK,OAAO,KAAA;GACvB,IAAI,MAAM,QACT,OAAO,yBAAyB,MAAM;QAChC,IAAI,MAAM,UAChB,OAAO,MAAM;QACP,IAAI,MAAM,QAChB,OAAO,GAAG,MAAM,IAAG;QACb,IAAI,MAAM,OAChB,OAAO,GAAG,MAAM,IAAG;QACb,IAAI,MAAM,OAChB,OAAO,GAAG,MAAM,IAAG;QAGnB,OAAO,GAAG,MAAM,IAAG;EAErB,CAAC,EACF,CAAC;EAGD,MAAM,gBAAgB,SAAS,OAAO,aAAa,CAAC,KAAK,CAAC;EAC1D,MAAM,gBAAgB,SAAS,aAAa,IAAI;EAEhD,gBAAU,YAAA,UAAA,WACK,cAAc,OAAW,cAAc,OAAK;GAAA,SAAA;GAAA,OAAyB,MAAM;EAAG,CAAA,GAAA,EAAA,eAAA,CAC1F,MAAM,UAAU,EAAE,KAAK,MAAM,IAAI,CAAC,CAAC,EAAA,CAAA,CAErC;EAED,OAAO,UAAU,QAAQ;;AAExB,KAAK,MAAM,IACZ,CAAC;CACF;AACD,CAAC"}
@@ -7,7 +7,7 @@ export declare const faButtonProps: {
7
7
  */
8
8
  loadingIcon: {
9
9
  type: import("vue").PropType<string | Component>;
10
- default: () => string | Component;
10
+ default: () => import("vue").DefineComponent<{}, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
11
  };
12
12
  /** @description 禁用加载 */
13
13
  disabledLoading: BooleanConstructor;
@@ -64,7 +64,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
64
64
  */
65
65
  loadingIcon: {
66
66
  type: import("vue").PropType<string | Component>;
67
- default: () => string | Component;
67
+ default: () => import("vue").DefineComponent<{}, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
68
68
  };
69
69
  /** @description 禁用加载 */
70
70
  disabledLoading: BooleanConstructor;
@@ -124,7 +124,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
124
124
  */
125
125
  loadingIcon: {
126
126
  type: import("vue").PropType<string | Component>;
127
- default: () => string | Component;
127
+ default: () => import("vue").DefineComponent<{}, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
128
128
  };
129
129
  /** @description 禁用加载 */
130
130
  disabledLoading: BooleanConstructor;
@@ -160,11 +160,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
160
160
  onClick?: ((event: MouseEvent, done?: (() => void) | undefined) => any) | undefined;
161
161
  }>, {
162
162
  link: boolean;
163
+ loading: boolean;
163
164
  type: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<StringConstructor, "" | "default" | "text" | "primary" | "success" | "warning" | "info" | "danger", unknown>;
164
165
  circle: boolean;
165
166
  text: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
166
167
  plain: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
167
- loading: boolean;
168
168
  loadingIcon: string | Component;
169
169
  disabledLoading: boolean;
170
170
  disabled: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
@@ -4,10 +4,9 @@ import { definePropType, useProps } from "../../../utils/vue/props.mjs";
4
4
  import { useRender } from "../../../utils/vue/render.mjs";
5
5
  import { makeSlots } from "../../../utils/vue/slots.mjs";
6
6
  import { useOverlay } from "../../../hooks/use-overlay/index.mjs";
7
- import { computed, createVNode, defineComponent, mergeProps, reactive, ref, watch, withModifiers } from "vue";
7
+ import { computed, createVNode, defineComponent, mergeProps, reactive, shallowRef, watch, withModifiers } from "vue";
8
8
  import { Eleme } from "@element-plus/icons-vue";
9
9
  import { ElButton, buttonEmits, buttonProps } from "element-plus";
10
- import { isFunction } from "lodash-unified";
11
10
  //#region src/components/button/src/button.tsx
12
11
  /** FaButton 的运行时 Props 定义。 */
13
12
  const faButtonProps = {
@@ -34,7 +33,7 @@ const faButtonEmits = {
34
33
  * @description 点击事件
35
34
  * @param done 需要手动隐藏Loading
36
35
  */
37
- click: (event, done = () => {}) => event instanceof MouseEvent && isFunction(done)
36
+ click: (event, done = () => void 0) => event instanceof MouseEvent && typeof done === "function"
38
37
  };
39
38
  var button_default = defineComponent({
40
39
  name: "FaButton",
@@ -42,8 +41,8 @@ var button_default = defineComponent({
42
41
  emits: faButtonEmits,
43
42
  slots: makeSlots(),
44
43
  setup(props, { slots, emit, expose }) {
44
+ const buttonRef = shallowRef(null);
45
45
  const state = reactive({ loading: false });
46
- const buttonRef = ref();
47
46
  const showLoading = () => {
48
47
  state.loading = true;
49
48
  useOverlay.show(0);
@@ -1 +1 @@
1
- {"version":3,"file":"button.mjs","names":[],"sources":["../../../../src/components/button/src/button.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, ref, watch, withModifiers } from \"vue\";\nimport { Eleme } from \"@element-plus/icons-vue\";\nimport { ElButton, buttonEmits, buttonProps } from \"element-plus\";\nimport { isFunction } from \"lodash-unified\";\nimport { useOverlay } from \"../../../hooks\";\nimport { callOptionalFunction, definePropType, makeSlots, useExpose, useProps, useRender } from \"../../../utils\";\nimport type { ButtonInstance } from \"element-plus\";\nimport type { Component, VNode } from \"vue\";\n\n/** FaButton 的运行时 Props 定义。 */\nexport const faButtonProps = {\n\t...buttonProps,\n\t/**\n\t * @description customize loading icon component\n\t * @default Eleme\n\t */\n\tloadingIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: (): string | Component => Eleme,\n\t},\n\t/** @description 禁用加载 */\n\tdisabledLoading: Boolean,\n};\n\n/** FaButton 的运行时 Emits 定义。 */\nexport const faButtonEmits = {\n\t...buttonEmits,\n\t/**\n\t * @description 点击事件\n\t * @param done 需要手动隐藏Loading\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tclick: (event: MouseEvent, done: () => void = () => {}): boolean => event instanceof MouseEvent && isFunction(done),\n};\n\n/** FaButton 的插槽参数。 */\nexport interface FaButtonSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n\t/** @description 自定义加载中组件 */\n\tloading: never;\n\t/** @description 自定义图标组件 */\n\ticon: never;\n}\n\nexport default defineComponent({\n\tname: \"FaButton\",\n\tprops: faButtonProps,\n\temits: faButtonEmits,\n\tslots: makeSlots<FaButtonSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst state = reactive({\n\t\t\tloading: false,\n\t\t});\n\n\t\tconst buttonRef = ref<ButtonInstance>();\n\n\t\tconst showLoading = (): void => {\n\t\t\tstate.loading = true;\n\t\t\t// 这里默认透明\n\t\t\tuseOverlay.show(0);\n\t\t};\n\n\t\tconst hideLoading = (): void => {\n\t\t\tstate.loading = false;\n\t\t\tuseOverlay.hide();\n\t\t};\n\n\t\tconst handleLoading = async (loadingFunction: () => void | Promise<void>): Promise<void> => {\n\t\t\tshowLoading();\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(loadingFunction);\n\t\t\t} finally {\n\t\t\t\thideLoading();\n\t\t\t}\n\t\t};\n\n\t\tconst handleClick = (event: MouseEvent): void => {\n\t\t\tif (props.disabledLoading) {\n\t\t\t\t// 回调点击事件\n\t\t\t\temit(\"click\", event);\n\t\t\t} else {\n\t\t\t\tshowLoading();\n\t\t\t\t// 回调点击事件\n\t\t\t\temit(\"click\", event, hideLoading);\n\t\t\t}\n\t\t};\n\n\t\t/**\n\t\t * 监听外部 loading 的值\n\t\t */\n\t\twatch(\n\t\t\t() => props.loading,\n\t\t\t(newValue) => {\n\t\t\t\tif (props.disabledLoading) return;\n\t\t\t\tif (newValue) {\n\t\t\t\t\tshowLoading();\n\t\t\t\t} else {\n\t\t\t\t\thideLoading();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\timmediate: true,\n\t\t\t}\n\t\t);\n\n\t\tconst elButtonProps = useProps(props, buttonProps, [\"loading\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElButton\n\t\t\t\t{...elButtonProps.value}\n\t\t\t\tref={buttonRef}\n\t\t\t\tclass=\"fa-button\"\n\t\t\t\tloading={state.loading}\n\t\t\t\tonClick={withModifiers((event: Event) => handleClick(event as MouseEvent), [\"prevent\"])}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\tdefault: () => slots.default?.(),\n\t\t\t\t\t...(slots.loading && { loading: (): VNode[] => slots.loading?.() ?? [] }),\n\t\t\t\t\t...(slots.icon && { icon: (): VNode[] => slots.icon?.() ?? [] }),\n\t\t\t\t}}\n\t\t\t</ElButton>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 按钮 html 元素 */\n\t\t\tref: computed(() => buttonRef.value?.ref),\n\t\t\t/** @description 按钮尺寸 */\n\t\t\tsize: computed(() => buttonRef.value?.size),\n\t\t\t/** @description 按钮类型 */\n\t\t\ttype: computed(() => buttonRef.value?.type),\n\t\t\t/** @description 按钮已禁用 */\n\t\t\tdisabled: computed(() => buttonRef.value?.disabled),\n\t\t\t/** @description 是否在两个字符之间插入空格 */\n\t\t\tshouldAddSpace: computed(() => buttonRef.value?.shouldAddSpace),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading: computed(() => state.loading),\n\t\t\t/** @description 按钮加载 */\n\t\t\tdoLoading: handleLoading,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,gBAAgB;CAC5B,GAAG;;;;;CAKH,aAAa;EACZ,MAAM,eAAmC;GAAC;GAAQ;GAAQ;EAAQ,CAAC;EACnE,eAAmC;CACpC;;CAEA,iBAAiB;AAClB;;AAGA,MAAa,gBAAgB;CAC5B,GAAG;;;;;CAMH,QAAQ,OAAmB,aAAyB,CAAC,MAAe,iBAAiB,cAAc,WAA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M,eAAe,UAAU,OAAO,IAAI;;GAE1C,UAAU,eAAe,UAAU,OAAO,QAAQ;;GAElD,gBAAgB,eAAe,UAAU,OAAO,cAAc;;GAE9D,SAAS,eAAe,MAAM,OAAO;;GAErC,WAAW;EACZ,CAAC;CACF;AACD,CAAC"}
1
+ {"version":3,"file":"button.mjs","names":[],"sources":["../../../../src/components/button/src/button.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, shallowRef, watch, withModifiers } from \"vue\";\nimport { Eleme } from \"@element-plus/icons-vue\";\nimport { ElButton, buttonEmits, buttonProps } from \"element-plus\";\nimport { useOverlay } from \"../../../hooks\";\nimport { callOptionalFunction, definePropType, makeSlots, useExpose, useProps, useRender } from \"../../../utils\";\nimport type { ButtonInstance } from \"element-plus\";\nimport type { Component } from \"vue\";\n\n/** FaButton 的运行时 Props 定义。 */\nexport const faButtonProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...buttonProps,\n\t/**\n\t * @description customize loading icon component\n\t * @default Eleme\n\t */\n\tloadingIcon: {\n\t\ttype: definePropType<string | Component>([String, Object, Function]),\n\t\tdefault: () => Eleme,\n\t},\n\t/** @description 禁用加载 */\n\tdisabledLoading: Boolean,\n};\n\n/** FaButton 的运行时 Emits 定义。 */\nexport const faButtonEmits = {\n\t...buttonEmits,\n\t/**\n\t * @description 点击事件\n\t * @param done 需要手动隐藏Loading\n\t */\n\tclick: (event: MouseEvent, done: () => void = () => undefined) => event instanceof MouseEvent && typeof done === \"function\",\n};\n\n/** FaButton 的插槽参数。 */\nexport interface FaButtonSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n\t/** @description 自定义加载中组件 */\n\tloading: never;\n\t/** @description 自定义图标组件 */\n\ticon: never;\n}\n\nexport default defineComponent({\n\tname: \"FaButton\",\n\tprops: faButtonProps,\n\temits: faButtonEmits,\n\tslots: makeSlots<FaButtonSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst buttonRef = shallowRef<ButtonInstance | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tloading: false,\n\t\t});\n\n\t\tconst showLoading = () => {\n\t\t\tstate.loading = true;\n\t\t\t// 这里默认透明\n\t\t\tuseOverlay.show(0);\n\t\t};\n\n\t\tconst hideLoading = () => {\n\t\t\tstate.loading = false;\n\t\t\tuseOverlay.hide();\n\t\t};\n\n\t\tconst handleLoading = async (loadingFunction: () => void | Promise<void>) => {\n\t\t\tshowLoading();\n\t\t\ttry {\n\t\t\t\tawait callOptionalFunction(loadingFunction);\n\t\t\t} finally {\n\t\t\t\thideLoading();\n\t\t\t}\n\t\t};\n\n\t\tconst handleClick = (event: MouseEvent) => {\n\t\t\tif (props.disabledLoading) {\n\t\t\t\t// 回调点击事件\n\t\t\t\temit(\"click\", event);\n\t\t\t} else {\n\t\t\t\tshowLoading();\n\t\t\t\t// 回调点击事件\n\t\t\t\temit(\"click\", event, hideLoading);\n\t\t\t}\n\t\t};\n\n\t\t/**\n\t\t * 监听外部 loading 的值\n\t\t */\n\t\twatch(\n\t\t\t() => props.loading,\n\t\t\t(newValue) => {\n\t\t\t\tif (props.disabledLoading) return;\n\t\t\t\tif (newValue) {\n\t\t\t\t\tshowLoading();\n\t\t\t\t} else {\n\t\t\t\t\thideLoading();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\timmediate: true,\n\t\t\t}\n\t\t);\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elButtonProps = useProps(props, buttonProps, [\"loading\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElButton\n\t\t\t\t{...elButtonProps.value}\n\t\t\t\tref={buttonRef}\n\t\t\t\tclass=\"fa-button\"\n\t\t\t\tloading={state.loading}\n\t\t\t\tonClick={withModifiers((event: Event) => handleClick(event as MouseEvent), [\"prevent\"])}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\tdefault: () => slots.default?.(),\n\t\t\t\t\t...(slots.loading && { loading: () => slots.loading?.() ?? [] }),\n\t\t\t\t\t...(slots.icon && { icon: () => slots.icon?.() ?? [] }),\n\t\t\t\t}}\n\t\t\t</ElButton>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 按钮 html 元素 */\n\t\t\tref: computed(() => buttonRef.value?.ref),\n\t\t\t/** @description 按钮尺寸 */\n\t\t\tsize: computed(() => buttonRef.value?.size),\n\t\t\t/** @description 按钮类型 */\n\t\t\ttype: computed(() => buttonRef.value?.type),\n\t\t\t/** @description 按钮已禁用 */\n\t\t\tdisabled: computed(() => buttonRef.value?.disabled),\n\t\t\t/** @description 是否在两个字符之间插入空格 */\n\t\t\tshouldAddSpace: computed(() => buttonRef.value?.shouldAddSpace),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading: computed(() => state.loading),\n\t\t\t/** @description 按钮加载 */\n\t\t\tdoLoading: handleLoading,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;AASA,MAAa,gBAAgB;CAE5B,GAAG;;;;;CAKH,aAAa;EACZ,MAAM,eAAmC;GAAC;GAAQ;GAAQ;EAAQ,CAAC;EACnE,eAAe;CAChB;;CAEA,iBAAiB;AAClB;;AAGA,MAAa,gBAAgB;CAC5B,GAAG;;;;;CAKH,QAAQ,OAAmB,aAAyB,KAAA,MAAc,iBAAiB,cAAc,OAAO,SAAS;AAClH;AAYA,IAAA,iBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAAyB;CAChC,MAAM,OAAO,EAAE,OAAO,MAAM,UAAU;EACrC,MAAM,YAAY,WAAkC,IAAI;EAExD,MAAM,QAAQ,SAAS,EACtB,SAAS,MACV,CAAC;EAED,MAAM,oBAAoB;GACzB,MAAM,UAAU;GAEhB,WAAW,KAAK,CAAC;EAClB;EAEA,MAAM,oBAAoB;GACzB,MAAM,UAAU;GAChB,WAAW,KAAK;EACjB;EAEA,MAAM,gBAAgB,OAAO,oBAAgD;GAC5E,YAAY;GACZ,IAAI;IACH,MAAM,qBAAqB,eAAe;GAC3C,UAAU;IACT,YAAY;GACb;EACD;EAEA,MAAM,eAAe,UAAsB;GAC1C,IAAI,MAAM,iBAET,KAAK,SAAS,KAAK;QACb;IACN,YAAY;IAEZ,KAAK,SAAS,OAAO,WAAW;GACjC;EACD;;;;EAKA,YACO,MAAM,UACX,aAAa;GACb,IAAI,MAAM,iBAAiB;GAC3B,IAAI,UACH,YAAY;QAEZ,YAAY;EAEd,GACA,EACC,WAAW,KACZ,CACD;EAGA,MAAM,gBAAgB,SAAS,OAAO,aAAa,CAAC,SAAS,CAAC;EAE9D,gBAAU,YAAA,UAAA,WAEJ,cAAc,OAAK;GAAA,OAClB;GAAS,SAAA;GAAA,WAEL,MAAM;GAAO,WACb,eAAe,UAAiB,YAAY,KAAmB,GAAG,CAAC,SAAS,CAAC;EAAC,CAAA,GAAA;GAGtF,eAAe,MAAM,UAAU;GAC/B,GAAI,MAAM,WAAW,EAAE,eAAe,MAAM,UAAU,KAAK,CAAA,EAAG;GAC9D,GAAI,MAAM,QAAQ,EAAE,YAAY,MAAM,OAAO,KAAK,CAAA,EAAG;EAAE,CAAA,CAGzD;EAED,OAAO,UAAU,QAAQ;;GAExB,KAAK,eAAe,UAAU,OAAO,GAAG;;GAExC,MAAM,eAAe,UAAU,OAAO,IAAI;;GAE1C,MAAM,eAAe,UAAU,OAAO,IAAI;;GAE1C,UAAU,eAAe,UAAU,OAAO,QAAQ;;GAElD,gBAAgB,eAAe,UAAU,OAAO,cAAc;;GAE9D,SAAS,eAAe,MAAM,OAAO;;GAErC,WAAW;EACZ,CAAC;CACF;AACD,CAAC"}
@@ -2,11 +2,9 @@ import { definePropType, useProps } from "../../../utils/vue/props.mjs";
2
2
  import { useRender } from "../../../utils/vue/render.mjs";
3
3
  import { RegExps } from "../../../constants/regex.mjs";
4
4
  import { CarNumberArea, CarNumberDigit, CarNumberLetter } from "./common.mjs";
5
- import { Fragment, computed, createTextVNode, createVNode, defineComponent, inject, isVNode, mergeProps, reactive, ref } from "vue";
5
+ import { Fragment, computed, createTextVNode, createVNode, defineComponent, inject, isVNode, mergeProps, reactive, shallowRef, useModel } from "vue";
6
6
  import { Back } from "@element-plus/icons-vue";
7
7
  import { ElButton, ElInput, ElMessage, ElPopover, formContextKey, formItemContextKey, inputProps } from "element-plus";
8
- import { isNull, isString } from "lodash-unified";
9
- import { useVModel } from "@vueuse/core";
10
8
  //#region src/components/carNumber/src/carNumber.tsx
11
9
  function _isSlot(s) {
12
10
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
@@ -33,12 +31,15 @@ var carNumber_default = defineComponent({
33
31
  },
34
32
  emits: {
35
33
  /** @description v-model 回调 */
36
- "update:modelValue": (value) => isString(value) || isNull(value),
34
+ "update:modelValue": (value) => typeof value === "string" || value === null,
37
35
  /** @description 改变 */
38
- change: (value) => isString(value) || isNull(value)
36
+ change: (value) => typeof value === "string" || value === null
39
37
  },
40
38
  setup(props, { emit }) {
41
- const modelValue = useVModel(props, "modelValue", emit, { passive: true });
39
+ const modelValue = useModel(props, "modelValue");
40
+ const popoverRef = shallowRef(null);
41
+ const formContext = inject(formContextKey, void 0);
42
+ const formItemContext = inject(formItemContextKey, void 0);
42
43
  const state = reactive({
43
44
  switchLetter: computed(() => {
44
45
  if ((modelValue.value?.length ?? 0) >= 1) return true;
@@ -49,9 +50,6 @@ var carNumber_default = defineComponent({
49
50
  return false;
50
51
  })
51
52
  });
52
- const popoverRef = ref();
53
- const formContext = inject(formContextKey, void 0);
54
- const formItemContext = inject(formItemContextKey, void 0);
55
53
  const handleInputFormatter = (value) => {
56
54
  if (value.length === 2) return `${value} ● `;
57
55
  else if (value.length > 2) return `${value.slice(0, 2)} ● ${value.slice(2)}`;
@@ -1 +1 @@
1
- {"version":3,"file":"carNumber.mjs","names":["update:modelValue"],"sources":["../../../../src/components/carNumber/src/carNumber.tsx"],"sourcesContent":["import { useVModel } from \"@vueuse/core\";\nimport { Fragment, computed, defineComponent, inject, reactive, ref } from \"vue\";\nimport { Back } from \"@element-plus/icons-vue\";\nimport { ElButton, ElInput, ElMessage, ElPopover, formContextKey, formItemContextKey, inputProps } from \"element-plus\";\nimport { isNull, isString } from \"lodash-unified\";\nimport { RegExps } from \"../../../constants\";\nimport { definePropType, useProps, useRender } from \"../../../utils\";\nimport { CarNumberArea, CarNumberDigit, CarNumberLetter } from \"./common\";\nimport type { PopoverInstance } from \"element-plus\";\n\nexport default defineComponent({\n\tname: \"FaCarNumber\",\n\tprops: {\n\t\t...inputProps,\n\t\t/** @description value conversion function */\n\t\tparser: {\n\t\t\t...inputProps.parser,\n\t\t\ttype: definePropType<(value: string) => string>(Function),\n\t\t},\n\t\t/** @description v-model绑定值 */\n\t\tmodelValue: {\n\t\t\ttype: definePropType<string | null>(String),\n\t\t\tdefault: undefined,\n\t\t},\n\t\t/** @description placeholder */\n\t\tplaceholder: {\n\t\t\ttype: String,\n\t\t\tdefault: \"请选择\",\n\t\t},\n\t},\n\temits: {\n\t\t/** @description v-model 回调 */\n\t\t\"update:modelValue\": (value: string | null) => isString(value) || isNull(value),\n\t\t/** @description 改变 */\n\t\tchange: (value: string | null) => isString(value) || isNull(value),\n\t},\n\tsetup(props, { emit }) {\n\t\tconst modelValue = useVModel(props, \"modelValue\", emit, { passive: true });\n\n\t\tconst state = reactive({\n\t\t\tswitchLetter: computed(() => {\n\t\t\t\tif ((modelValue.value?.length ?? 0) >= 1) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}),\n\t\t\tdisabledButton: computed(() => {\n\t\t\t\tif ((modelValue.value?.length ?? 0) >= 8) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}),\n\t\t});\n\n\t\tconst popoverRef = ref<PopoverInstance>();\n\t\t// 获取 el-form 组件上下文\n\t\tconst formContext = inject(formContextKey, undefined);\n\t\t// 获取 el-form-item 组件上下文\n\t\tconst formItemContext = inject(formItemContextKey, undefined);\n\n\t\tconst handleInputFormatter = (value: string): string => {\n\t\t\tif (value.length === 2) {\n\t\t\t\treturn `${value} ● `;\n\t\t\t} else if (value.length > 2) {\n\t\t\t\treturn `${value.slice(0, 2)} ● ${value.slice(2)}`;\n\t\t\t} else {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t};\n\n\t\tconst handleSelectCarNumber = (value: string): void => {\n\t\t\tmodelValue.value ??= \"\";\n\t\t\tmodelValue.value += value;\n\t\t};\n\n\t\tconst handleBackClick = (): void => {\n\t\t\tconst value = modelValue.value ?? \"\";\n\t\t\tif (value.length === 0) return;\n\t\t\tmodelValue.value = value.substring(0, value.length - 1);\n\t\t};\n\n\t\tconst handleConfirmClick = (): void => {\n\t\t\tlet success = false;\n\t\t\tconst value = modelValue.value ?? \"\";\n\t\t\tif (value.length === 7) {\n\t\t\t\tsuccess = RegExps.CarNumber.test(value);\n\t\t\t} else if (value.length === 8) {\n\t\t\t\tsuccess = RegExps.NewEnergyCarNumber.test(value);\n\t\t\t}\n\t\t\tif (success) {\n\t\t\t\temit(\"change\", value);\n\t\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\t\tif (formItemContext?.prop) void formContext?.validateField([formItemContext.prop]);\n\t\t\t} else {\n\t\t\t\tif (formItemContext?.prop && formContext) {\n\t\t\t\t\temit(\"change\", value);\n\t\t\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\t\t\tvoid formContext.validateField([formItemContext.prop]);\n\t\t\t\t} else {\n\t\t\t\t\tElMessage.error(\"车牌号格式不正确\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tpopoverRef.value?.hide();\n\t\t};\n\n\t\tconst handleClearClick = (): void => {\n\t\t\tmodelValue.value = null;\n\t\t\temit(\"change\", null);\n\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\tif (formItemContext?.prop) void formContext?.validateField([formItemContext.prop]);\n\t\t};\n\n\t\tconst elInputProps = useProps(props, inputProps, [\"modelValue\", \"readonly\", \"formatter\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElPopover\n\t\t\t\tref={popoverRef}\n\t\t\t\twidth=\"auto\"\n\t\t\t\tpopperClass=\"fa-car-number__popover\"\n\t\t\t\ttrigger=\"click\"\n\t\t\t\tshowArrow={false}\n\t\t\t\tshowAfter={0}\n\t\t\t\thideAfter={0}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\treference: () => (\n\t\t\t\t\t\t<ElInput\n\t\t\t\t\t\t\t{...elInputProps.value}\n\t\t\t\t\t\t\tclass=\"fa-car-number__input\"\n\t\t\t\t\t\t\tvModel={modelValue.value}\n\t\t\t\t\t\t\treadonly\n\t\t\t\t\t\t\tformatter={handleInputFormatter}\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tdefault: () => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<div class={[\"fa-car-number__popover__area\", state.switchLetter ? \"fa-car-number__popover__hide\" : \"\"]}>\n\t\t\t\t\t\t\t\t{CarNumberArea.map((area) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(area)}>\n\t\t\t\t\t\t\t\t\t\t{area}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class={[\"fa-car-number__popover__digit-letter\", state.switchLetter ? \"\" : \"fa-car-number__popover__hide\"]}>\n\t\t\t\t\t\t\t\t{CarNumberDigit.map((digit) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(digit)}>\n\t\t\t\t\t\t\t\t\t\t{digit}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t{CarNumberLetter.map((letter) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(letter)}>\n\t\t\t\t\t\t\t\t\t\t{letter}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class=\"fa-car-number__popover__btn\">\n\t\t\t\t\t\t\t\t<ElButton class=\"fa-car-number__popover__btn__clear\" disabled={!modelValue.value} onClick={handleClearClick}>\n\t\t\t\t\t\t\t\t\t清除\n\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__back\"\n\t\t\t\t\t\t\t\t\ttype=\"danger\"\n\t\t\t\t\t\t\t\t\ticon={Back}\n\t\t\t\t\t\t\t\t\tdisabled={!modelValue.value}\n\t\t\t\t\t\t\t\t\tonClick={handleBackClick}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__confirm\"\n\t\t\t\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\t\t\t\tdisabled={!modelValue.value || modelValue.value.length < 7}\n\t\t\t\t\t\t\t\t\tonClick={handleConfirmClick}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t确认\n\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t</ElPopover>\n\t\t));\n\t},\n});\n"],"mappings":";;;;;;;;;;AAQoD,SAAA,QAAA,GAAA;CAAA,OAAA,OAAA,MAAA,cAAA,OAAA,UAAA,SAAA,KAAA,CAAA,MAAA,qBAAA,CAAA,QAAA,CAAA;AAAA;AAEpD,IAAA,oBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;EACN,GAAG;;EAEH,QAAQ;GACP,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A;KAAA,YACL,MAAM;KAAc,iBAAiB,sBAAsB,KAAK;IAAC,GAAA,QACnF,KAAK,IAAL,QAAK,EAAA,eAAA,CAAL,KAAK,EAAA,CAAA,CAEP,GACA,gBAAgB,KAAK,WAAM,YAAA,UAAA;KAAA,YACP,MAAM;KAAc,iBAAiB,sBAAsB,MAAM;IAAC,GAAA,QACpF,MAAM,IAAN,SAAM,EAAA,eAAA,CAAN,MAAM,EAAA,CAAA,CAER,CAAC,CAAA;IAAA,YAAA,OAAA,EAAA,SAAA,8BAAA,GAAA;KAAA,YAAA,UAAA;MAAA,SAAA;MAAA,YAG6D,CAAC,WAAW;MAAK,WAAW;KAAgB,GAAA,EAAA,eAAA,CAAA,gBAAA,IAAA,CAAA,EAAA,CAAA;KAAA,YAAA,UAAA;MAAA,SAAA;MAAA,QAAA;MAAA,QAMpG;MAAI,YACA,CAAC,WAAW;MAAK,WAClB;KAAe,GAAA,IAAA;KAAA,YAAA,UAAA;MAAA,SAAA;MAAA,QAAA;MAAA,YAKd,CAAC,WAAW,SAAS,WAAW,MAAM,SAAS;MAAC,WACjD;KAAkB,GAAA,EAAA,eAAA,CAAA,gBAAA,IAAA,CAAA,EAAA,CAAA;IAAA,CAAA;GAAA,CAAA;EAM9B,CAAA,CAGH;CACF;AACD,CAAC"}
1
+ {"version":3,"file":"carNumber.mjs","names":["update:modelValue"],"sources":["../../../../src/components/carNumber/src/carNumber.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, inject, reactive, shallowRef, useModel } from \"vue\";\nimport { Back } from \"@element-plus/icons-vue\";\nimport { ElButton, ElInput, ElMessage, ElPopover, formContextKey, formItemContextKey, inputProps } from \"element-plus\";\nimport { RegExps } from \"../../../constants\";\nimport { definePropType, useProps, useRender } from \"../../../utils\";\nimport { CarNumberArea, CarNumberDigit, CarNumberLetter } from \"./common\";\nimport type { PopoverInstance } from \"element-plus\";\n\nexport default defineComponent({\n\tname: \"FaCarNumber\",\n\tprops: {\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t\t...inputProps,\n\t\t/** @description value conversion function */\n\t\tparser: {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 保留 Element Plus 2.x parser 的运行时约束。\n\t\t\t...inputProps.parser,\n\t\t\ttype: definePropType<(value: string) => string>(Function),\n\t\t},\n\t\t/** @description v-model绑定值 */\n\t\tmodelValue: {\n\t\t\ttype: definePropType<string | null>(String),\n\t\t\tdefault: undefined,\n\t\t},\n\t\t/** @description placeholder */\n\t\tplaceholder: {\n\t\t\ttype: String,\n\t\t\tdefault: \"请选择\",\n\t\t},\n\t},\n\temits: {\n\t\t/** @description v-model 回调 */\n\t\t\"update:modelValue\": (value: string | null) => typeof value === \"string\" || value === null,\n\t\t/** @description 改变 */\n\t\tchange: (value: string | null) => typeof value === \"string\" || value === null,\n\t},\n\tsetup(props, { emit }) {\n\t\tconst modelValue = useModel(props, \"modelValue\");\n\n\t\tconst popoverRef = shallowRef<PopoverInstance | null>(null);\n\t\t// 获取 el-form 组件上下文\n\t\tconst formContext = inject(formContextKey, undefined);\n\t\t// 获取 el-form-item 组件上下文\n\t\tconst formItemContext = inject(formItemContextKey, undefined);\n\n\t\tconst state = reactive({\n\t\t\tswitchLetter: computed(() => {\n\t\t\t\tif ((modelValue.value?.length ?? 0) >= 1) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}),\n\t\t\tdisabledButton: computed(() => {\n\t\t\t\tif ((modelValue.value?.length ?? 0) >= 8) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}),\n\t\t});\n\n\t\tconst handleInputFormatter = (value: string) => {\n\t\t\tif (value.length === 2) {\n\t\t\t\treturn `${value} ● `;\n\t\t\t} else if (value.length > 2) {\n\t\t\t\treturn `${value.slice(0, 2)} ● ${value.slice(2)}`;\n\t\t\t} else {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t};\n\n\t\tconst handleSelectCarNumber = (value: string) => {\n\t\t\tmodelValue.value ??= \"\";\n\t\t\tmodelValue.value += value;\n\t\t};\n\n\t\tconst handleBackClick = () => {\n\t\t\tconst value = modelValue.value ?? \"\";\n\t\t\tif (value.length === 0) return;\n\t\t\tmodelValue.value = value.substring(0, value.length - 1);\n\t\t};\n\n\t\tconst handleConfirmClick = () => {\n\t\t\tlet success = false;\n\t\t\tconst value = modelValue.value ?? \"\";\n\t\t\tif (value.length === 7) {\n\t\t\t\tsuccess = RegExps.CarNumber.test(value);\n\t\t\t} else if (value.length === 8) {\n\t\t\t\tsuccess = RegExps.NewEnergyCarNumber.test(value);\n\t\t\t}\n\t\t\tif (success) {\n\t\t\t\temit(\"change\", value);\n\t\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\t\tif (formItemContext?.prop) formContext?.validateField([formItemContext.prop]);\n\t\t\t} else {\n\t\t\t\tif (formItemContext?.prop && formContext) {\n\t\t\t\t\temit(\"change\", value);\n\t\t\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\t\t\tformContext.validateField([formItemContext.prop]);\n\t\t\t\t} else {\n\t\t\t\t\tElMessage.error(\"车牌号格式不正确\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tpopoverRef.value?.hide();\n\t\t};\n\n\t\tconst handleClearClick = () => {\n\t\t\tmodelValue.value = null;\n\t\t\temit(\"change\", null);\n\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\tif (formItemContext?.prop) formContext?.validateField([formItemContext.prop]);\n\t\t};\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elInputProps = useProps(props, inputProps, [\"modelValue\", \"readonly\", \"formatter\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElPopover\n\t\t\t\tref={popoverRef}\n\t\t\t\twidth=\"auto\"\n\t\t\t\tpopperClass=\"fa-car-number__popover\"\n\t\t\t\ttrigger=\"click\"\n\t\t\t\tshowArrow={false}\n\t\t\t\tshowAfter={0}\n\t\t\t\thideAfter={0}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\treference: () => (\n\t\t\t\t\t\t<ElInput\n\t\t\t\t\t\t\t{...elInputProps.value}\n\t\t\t\t\t\t\tclass=\"fa-car-number__input\"\n\t\t\t\t\t\t\tvModel={modelValue.value}\n\t\t\t\t\t\t\treadonly\n\t\t\t\t\t\t\tformatter={handleInputFormatter}\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tdefault: () => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<div class={[\"fa-car-number__popover__area\", state.switchLetter ? \"fa-car-number__popover__hide\" : \"\"]}>\n\t\t\t\t\t\t\t\t{CarNumberArea.map((area) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(area)}>\n\t\t\t\t\t\t\t\t\t\t{area}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class={[\"fa-car-number__popover__digit-letter\", state.switchLetter ? \"\" : \"fa-car-number__popover__hide\"]}>\n\t\t\t\t\t\t\t\t{CarNumberDigit.map((digit) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(digit)}>\n\t\t\t\t\t\t\t\t\t\t{digit}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t{CarNumberLetter.map((letter) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(letter)}>\n\t\t\t\t\t\t\t\t\t\t{letter}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class=\"fa-car-number__popover__btn\">\n\t\t\t\t\t\t\t\t<ElButton class=\"fa-car-number__popover__btn__clear\" disabled={!modelValue.value} onClick={handleClearClick}>\n\t\t\t\t\t\t\t\t\t清除\n\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__back\"\n\t\t\t\t\t\t\t\t\ttype=\"danger\"\n\t\t\t\t\t\t\t\t\ticon={Back}\n\t\t\t\t\t\t\t\t\tdisabled={!modelValue.value}\n\t\t\t\t\t\t\t\t\tonClick={handleBackClick}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__confirm\"\n\t\t\t\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\t\t\t\tdisabled={!modelValue.value || modelValue.value.length < 7}\n\t\t\t\t\t\t\t\t\tonClick={handleConfirmClick}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t确认\n\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t</ElPopover>\n\t\t));\n\t},\n});\n"],"mappings":";;;;;;;;AAMoD,SAAA,QAAA,GAAA;CAAA,OAAA,OAAA,MAAA,cAAA,OAAA,UAAA,SAAA,KAAA,CAAA,MAAA,qBAAA,CAAA,QAAA,CAAA;AAAA;AAEpD,IAAA,oBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;EAEN,GAAG;;EAEH,QAAQ;GAEP,GAAG,WAAW;GACd,MAAM,eAA0C,QAAQ;EACzD;;EAEA,YAAY;GACX,MAAM,eAA8B,MAAM;GAC1C,SAAS,KAAA;EACV;;EAEA,aAAa;GACZ,MAAM;GACN,SAAS;EACV;CACD;CACA,OAAO;;EAEN,sBAAsB,UAAyB,OAAO,UA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pF,MAAM,IAAN,SAAM,EAAA,eAAA,CAAN,MAAM,EAAA,CAAA,CAER,CAAC,CAAA;IAAA,YAAA,OAAA,EAAA,SAAA,8BAAA,GAAA;KAAA,YAAA,UAAA;MAAA,SAAA;MAAA,YAG6D,CAAC,WAAW;MAAK,WAAW;KAAgB,GAAA,EAAA,eAAA,CAAA,gBAAA,IAAA,CAAA,EAAA,CAAA;KAAA,YAAA,UAAA;MAAA,SAAA;MAAA,QAAA;MAAA,QAMpG;MAAI,YACA,CAAC,WAAW;MAAK,WAClB;KAAe,GAAA,IAAA;KAAA,YAAA,UAAA;MAAA,SAAA;MAAA,QAAA;MAAA,YAKd,CAAC,WAAW,SAAS,WAAW,MAAM,SAAS;MAAC,WACjD;KAAkB,GAAA,EAAA,eAAA,CAAA,gBAAA,IAAA,CAAA,EAAA,CAAA;IAAA,CAAA;GAAA,CAAA;EAM9B,CAAA,CAGH;CACF;AACD,CAAC"}
@@ -3,6 +3,6 @@ import type { TSXWithInstall } from "../../utils";
3
3
  /** 支持定位和嵌套操作项的右键菜单组件。 */
4
4
  export declare const FaContextMenu: TSXWithInstall<typeof ContextMenu>;
5
5
  export default FaContextMenu;
6
- export * from "./src/contextMenu.type";
6
+ export type * from "./src/contextMenu.type";
7
7
  /** FaContextMenu 暴露的组件实例类型。 */
8
8
  export type FaContextMenuInstance = InstanceType<typeof ContextMenu>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["ContextMenu"],"sources":["../../../src/components/contextMenu/index.ts"],"sourcesContent":["import { withInstall } from \"../../utils\";\nimport ContextMenu from \"./src/contextMenu\";\nimport type { TSXWithInstall } from \"../../utils\";\n\n/** 支持定位和嵌套操作项的右键菜单组件。 */\nexport const FaContextMenu: TSXWithInstall<typeof ContextMenu> = withInstall(ContextMenu);\nexport default FaContextMenu;\n\nexport * from \"./src/contextMenu.type\";\n\n/** FaContextMenu 暴露的组件实例类型。 */\nexport type FaContextMenuInstance = InstanceType<typeof ContextMenu>;\n"],"mappings":";;;;AAKA,MAAa,gBAAoD,YAAYA,mBAAW"}
1
+ {"version":3,"file":"index.mjs","names":["ContextMenu"],"sources":["../../../src/components/contextMenu/index.ts"],"sourcesContent":["import { withInstall } from \"../../utils\";\nimport ContextMenu from \"./src/contextMenu\";\nimport type { TSXWithInstall } from \"../../utils\";\n\n/** 支持定位和嵌套操作项的右键菜单组件。 */\nexport const FaContextMenu: TSXWithInstall<typeof ContextMenu> = withInstall(ContextMenu);\nexport default FaContextMenu;\n\nexport type * from \"./src/contextMenu.type\";\n\n/** FaContextMenu 暴露的组件实例类型。 */\nexport type FaContextMenuInstance = InstanceType<typeof ContextMenu>;\n"],"mappings":";;;;AAKA,MAAa,gBAAoD,YAAYA,mBAAW"}
@@ -17,7 +17,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
17
17
  close: () => void;
18
18
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
19
  /** @description 点击事件 */
20
- click: (event: MouseEvent, data: FaContextMenuData) => boolean;
20
+ click: (event: MouseEvent, data: FaContextMenuData | null) => boolean;
21
21
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
22
22
  /** @description 数据 */
23
23
  data: {
@@ -25,7 +25,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
25
25
  default: () => never[];
26
26
  };
27
27
  }>> & Readonly<{
28
- onClick?: ((event: MouseEvent, data: FaContextMenuData<any>) => any) | undefined;
28
+ onClick?: ((event: MouseEvent, data: FaContextMenuData<any> | null) => any) | undefined;
29
29
  }>, {
30
30
  data: FaContextMenuData<any>[];
31
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -2,10 +2,8 @@ import { useExpose } from "../../../utils/vue/expose.mjs";
2
2
  import { definePropType } from "../../../utils/vue/props.mjs";
3
3
  import { useRender } from "../../../utils/vue/render.mjs";
4
4
  import { FaIcon } from "../../icon/index.mjs";
5
- import { Transition, computed, createVNode, defineComponent, onMounted, reactive, vShow, withDirectives } from "vue";
5
+ import { Transition, computed, createVNode, defineComponent, onBeforeUnmount, onMounted, reactive, vShow, withDirectives } from "vue";
6
6
  import { useGlobalSize } from "element-plus";
7
- import { isObject } from "lodash-unified";
8
- import { useEventListener } from "@vueuse/core";
9
7
  //#region src/components/contextMenu/src/contextMenu.tsx
10
8
  var contextMenu_default = defineComponent({
11
9
  name: "FaContextMenu",
@@ -17,9 +15,9 @@ data: {
17
15
  } },
18
16
  emits: {
19
17
  /** @description 点击事件 */
20
- click: (event, data) => event instanceof MouseEvent && isObject(data) },
18
+ click: (event, data) => event instanceof MouseEvent && typeof data === "object" && data !== null },
21
19
  setup(props, { emit, expose }) {
22
- const _globalSize = useGlobalSize();
20
+ const globalSize = useGlobalSize();
23
21
  const state = reactive({
24
22
  visible: false,
25
23
  axis: {
@@ -43,12 +41,15 @@ click: (event, data) => event instanceof MouseEvent && isObject(data) },
43
41
  state.visible = false;
44
42
  };
45
43
  onMounted(() => {
46
- useEventListener(document, "click", close);
44
+ document.addEventListener("click", close);
45
+ });
46
+ onBeforeUnmount(() => {
47
+ document.removeEventListener("click", close);
47
48
  });
48
49
  useRender(() => createVNode(Transition, { "name": "el-zoom-in-top" }, { default: () => [withDirectives(createVNode("div", {
49
50
  "class": [
50
51
  "fa-context-menu",
51
- `fa-context-menu-${_globalSize.value}`,
52
+ `fa-context-menu-${globalSize.value}`,
52
53
  "el-popper el-dropdown__popper"
53
54
  ],
54
55
  "style": {
@@ -57,12 +58,12 @@ click: (event, data) => event instanceof MouseEvent && isObject(data) },
57
58
  },
58
59
  "key": Math.random()
59
60
  }, [createVNode("ul", { "class": "el-dropdown-menu" }, [props.data.filter((f) => !f.hide).map((item) => createVNode("li", {
60
- "class": ["el-dropdown-menu__item", item?.disabled === true ? "is-disabled" : ""],
61
+ "class": ["el-dropdown-menu__item", item.disabled === true ? "is-disabled" : ""],
61
62
  "tabindex": "-1",
62
63
  "onClick": (event) => {
63
64
  handleClick(event, item);
64
65
  }
65
- }, [item?.icon ? createVNode(FaIcon, { "name": item?.icon }, null) : null, createVNode("span", null, [item.label])]))])]), [[vShow, state.visible]])] }));
66
+ }, [item.icon ? createVNode(FaIcon, { "name": item.icon }, null) : null, createVNode("span", null, [item.label])]))])]), [[vShow, state.visible]])] }));
66
67
  return useExpose(expose, {
67
68
  /** @description 是否显示 */
68
69
  visible: computed(() => state.visible),
@@ -1 +1 @@
1
- {"version":3,"file":"contextMenu.mjs","names":[],"sources":["../../../../src/components/contextMenu/src/contextMenu.tsx"],"sourcesContent":["import { useEventListener } from \"@vueuse/core\";\nimport { Transition, computed, defineComponent, onMounted, reactive } from \"vue\";\nimport { useGlobalSize } from \"element-plus\";\nimport { isObject } from \"lodash-unified\";\nimport { definePropType, useExpose, useRender } from \"../../../utils\";\nimport { FaIcon } from \"../../icon\";\nimport type { FaContextMenuData } from \"./contextMenu.type\";\n\nexport default defineComponent({\n\tname: \"FaContextMenu\",\n\tprops: {\n\t\t/** @description 数据 */\n\t\tdata: {\n\t\t\ttype: definePropType<FaContextMenuData[]>(Array),\n\t\t\tdefault: () => [],\n\t\t},\n\t},\n\temits: {\n\t\t/** @description 点击事件 */\n\t\tclick: (event: MouseEvent, data: FaContextMenuData) => event instanceof MouseEvent && isObject(data),\n\t},\n\tsetup(props, { emit, expose }) {\n\t\tconst _globalSize = useGlobalSize();\n\n\t\tconst state = reactive({\n\t\t\tvisible: false,\n\t\t\taxis: {\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t},\n\t\t});\n\n\t\tconst handleClick = (event: MouseEvent, data: FaContextMenuData): void => {\n\t\t\tif (data?.disabled) return;\n\t\t\tvoid data?.click?.(event, data);\n\t\t\temit(\"click\", event, data);\n\t\t};\n\n\t\tconst open = (axis: { x: number; y: number } = { x: 0, y: 0 }): void => {\n\t\t\tstate.axis = axis;\n\t\t\tstate.visible = true;\n\t\t};\n\n\t\tconst close = (): void => {\n\t\t\tstate.visible = false;\n\t\t};\n\n\t\tonMounted(() => {\n\t\t\tuseEventListener(document, \"click\", close);\n\t\t});\n\n\t\tuseRender(() => (\n\t\t\t<Transition name=\"el-zoom-in-top\">\n\t\t\t\t<div\n\t\t\t\t\tclass={[\"fa-context-menu\", `fa-context-menu-${_globalSize.value}`, \"el-popper el-dropdown__popper\"]}\n\t\t\t\t\tstyle={{ top: `${state.axis.y + 5}px`, left: `${state.axis.x + 14}px` }}\n\t\t\t\t\tvShow={state.visible}\n\t\t\t\t\tkey={Math.random()}\n\t\t\t\t>\n\t\t\t\t\t<ul class=\"el-dropdown-menu\">\n\t\t\t\t\t\t{props.data\n\t\t\t\t\t\t\t.filter((f) => !f.hide)\n\t\t\t\t\t\t\t.map((item) => (\n\t\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t\tclass={[\"el-dropdown-menu__item\", item?.disabled === true ? \"is-disabled\" : \"\"]}\n\t\t\t\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\t\t\t\tonClick={(event: MouseEvent) => {\n\t\t\t\t\t\t\t\t\t\thandleClick(event, item);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{item?.icon ? <FaIcon name={item?.icon} /> : null}\n\t\t\t\t\t\t\t\t\t<span>{item.label}</span>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</Transition>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 是否显示 */\n\t\t\tvisible: computed(() => state.visible),\n\t\t\t/** @description 打开菜单 */\n\t\t\topen,\n\t\t\t/** @description 关闭菜单 */\n\t\t\tclose,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;AAQA,IAAA,sBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;;AAEN,MAAM;EACL,MAAM,eAAoC,KAAK;EAC/C,eAAe,CAAA;CAChB,EACD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AAC,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,OAjBG,MAAM,OAAO,CAAA,CAAA,CAAA,EAAA,CAAA,CAqBtB;EAED,OAAO,UAAU,QAAQ;;GAExB,SAAS,eAAe,MAAM,OAAO;;GAErC;;GAEA;EACD,CAAC;CACF;AACD,CAAC"}
1
+ {"version":3,"file":"contextMenu.mjs","names":[],"sources":["../../../../src/components/contextMenu/src/contextMenu.tsx"],"sourcesContent":["import { Transition, computed, defineComponent, onBeforeUnmount, onMounted, reactive } from \"vue\";\nimport { useGlobalSize } from \"element-plus\";\nimport { definePropType, useExpose, useRender } from \"../../../utils\";\nimport { FaIcon } from \"../../icon\";\nimport type { FaContextMenuData } from \"./contextMenu.type\";\n\nexport default defineComponent({\n\tname: \"FaContextMenu\",\n\tprops: {\n\t\t/** @description 数据 */\n\t\tdata: {\n\t\t\ttype: definePropType<FaContextMenuData[]>(Array),\n\t\t\tdefault: () => [],\n\t\t},\n\t},\n\temits: {\n\t\t/** @description 点击事件 */\n\t\tclick: (event: MouseEvent, data: FaContextMenuData | null) => event instanceof MouseEvent && typeof data === \"object\" && data !== null,\n\t},\n\tsetup(props, { emit, expose }) {\n\t\tconst globalSize = useGlobalSize();\n\n\t\tconst state = reactive({\n\t\t\tvisible: false,\n\t\t\taxis: {\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t},\n\t\t});\n\n\t\tconst handleClick = (event: MouseEvent, data: FaContextMenuData | null) => {\n\t\t\tif (data?.disabled) return;\n\t\t\tdata?.click?.(event, data);\n\t\t\temit(\"click\", event, data);\n\t\t};\n\n\t\tconst open = (axis: { x: number; y: number } = { x: 0, y: 0 }) => {\n\t\t\tstate.axis = axis;\n\t\t\tstate.visible = true;\n\t\t};\n\n\t\tconst close = () => {\n\t\t\tstate.visible = false;\n\t\t};\n\n\t\tonMounted(() => {\n\t\t\tdocument.addEventListener(\"click\", close);\n\t\t});\n\n\t\tonBeforeUnmount(() => {\n\t\t\tdocument.removeEventListener(\"click\", close);\n\t\t});\n\n\t\tuseRender(() => (\n\t\t\t<Transition name=\"el-zoom-in-top\">\n\t\t\t\t<div\n\t\t\t\t\tclass={[\"fa-context-menu\", `fa-context-menu-${globalSize.value}`, \"el-popper el-dropdown__popper\"]}\n\t\t\t\t\tstyle={{ top: `${state.axis.y + 5}px`, left: `${state.axis.x + 14}px` }}\n\t\t\t\t\tvShow={state.visible}\n\t\t\t\t\tkey={Math.random()}\n\t\t\t\t>\n\t\t\t\t\t<ul class=\"el-dropdown-menu\">\n\t\t\t\t\t\t{props.data\n\t\t\t\t\t\t\t.filter((f) => !f.hide)\n\t\t\t\t\t\t\t.map((item) => (\n\t\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t\tclass={[\"el-dropdown-menu__item\", item.disabled === true ? \"is-disabled\" : \"\"]}\n\t\t\t\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\t\t\t\tonClick={(event: MouseEvent) => {\n\t\t\t\t\t\t\t\t\t\thandleClick(event, item);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{item.icon ? <FaIcon name={item.icon} /> : null}\n\t\t\t\t\t\t\t\t\t<span>{item.label}</span>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</Transition>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 是否显示 */\n\t\t\tvisible: computed(() => state.visible),\n\t\t\t/** @description 打开菜单 */\n\t\t\topen,\n\t\t\t/** @description 关闭菜单 */\n\t\t\tclose,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;AAMA,IAAA,sBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;;AAEN,MAAM;EACL,MAAM,eAAoC,KAAK;EAC/C,eAAe,CAAA;CAChB,EACD;CACA,OAAO;;AAEN,QAAQ,OAAmB,SAAmC,iBAAiB,cAAc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A,CAAA,CAElB,CAAC,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,OAjBG,MAAM,OAAO,CAAA,CAAA,CAAA,EAAA,CAAA,CAqBtB;EAED,OAAO,UAAU,QAAQ;;GAExB,SAAS,eAAe,MAAM,OAAO;;GAErC;;GAEA;EACD,CAAC;CACF;AACD,CAAC"}
@@ -277,7 +277,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
277
277
  /** @description 调用原生关闭流程,并执行 beforeClose。 */
278
278
  handleClose: import("vue").ComputedRef<(() => void) | undefined>;
279
279
  /** @description 弹窗内容引用 */
280
- dialogContentRef: import("vue").ComputedRef<unknown>;
280
+ dialogContentRef: import("vue").ComputedRef<{
281
+ resetPosition: () => void;
282
+ updatePosition: () => void;
283
+ } | undefined>;
281
284
  /** @description 重置位置 */
282
285
  resetPosition: import("vue").ComputedRef<(() => void) | undefined>;
283
286
  /** @description 加载状态 */
@@ -423,14 +426,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
423
426
  }>> & Readonly<{
424
427
  onClose?: (() => any) | undefined;
425
428
  onOpen?: (() => any) | undefined;
426
- onClosed?: (() => any) | undefined;
427
429
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
428
430
  onConfirmClick?: (() => any) | undefined;
429
431
  onOpened?: (() => any) | undefined;
432
+ onClosed?: (() => any) | undefined;
430
433
  onOpenAutoFocus?: (() => any) | undefined;
431
434
  onCloseAutoFocus?: (() => any) | undefined;
432
435
  }>, {
433
- top: string;
436
+ fullscreen: boolean;
434
437
  title: string;
435
438
  center: boolean;
436
439
  showClose: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
@@ -438,7 +441,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
438
441
  modelValue: boolean;
439
442
  transition: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...args: any[]) => string | import("vue").TransitionProps) | (() => import("element-plus").DialogTransition) | ((new (...args: any[]) => string | import("vue").TransitionProps) | (() => import("element-plus").DialogTransition) | null)[], unknown, unknown>;
440
443
  width: string | number;
441
- fullscreen: boolean;
444
+ top: string;
442
445
  alignCenter: boolean;
443
446
  appendToBody: boolean;
444
447
  draggable: boolean;
@@ -5,10 +5,9 @@ import { definePropType, useProps } from "../../../utils/vue/props.mjs";
5
5
  import { useRender } from "../../../utils/vue/render.mjs";
6
6
  import { makeSlots } from "../../../utils/vue/slots.mjs";
7
7
  import { FullScreen, FullScreenExit } from "@fast-element-plus/icons-vue";
8
- import { Fragment, computed, createVNode, defineComponent, mergeProps, nextTick, reactive, ref, resolveDirective, watch, withDirectives } from "vue";
8
+ import { Fragment, computed, createVNode, defineComponent, mergeProps, nextTick, reactive, resolveDirective, shallowRef, watch, withDirectives } from "vue";
9
9
  import { Close, Eleme, Refresh } from "@element-plus/icons-vue";
10
10
  import { ElButton, ElDialog, ElIcon, ElMessage, ElMessageBox, ElScrollbar, dialogEmits, dialogProps, useGlobalSize } from "element-plus";
11
- import { isBoolean } from "lodash-unified";
12
11
  //#region src/components/dialog/src/dialog.tsx
13
12
  /** FaDialog 的运行时 Props 定义。 */
14
13
  const faDialogProps = {
@@ -93,7 +92,7 @@ const faDialogProps = {
93
92
  const faDialogEmits = {
94
93
  ...dialogEmits,
95
94
  /** @description v-model 回调 */
96
- "update:modelValue": (value) => isBoolean(value),
95
+ "update:modelValue": (value) => typeof value === "boolean",
97
96
  /** @description 确认按钮点击事件 */
98
97
  confirmClick: () => true
99
98
  };
@@ -103,14 +102,14 @@ var dialog_default = defineComponent({
103
102
  emits: faDialogEmits,
104
103
  slots: makeSlots(),
105
104
  setup(props, { slots, emit, expose }) {
106
- const _globalSize = useGlobalSize();
105
+ const globalSize = useGlobalSize();
106
+ const dialogRef = shallowRef(null);
107
107
  const state = reactive({
108
108
  loading: false,
109
109
  visible: false,
110
110
  fullscreen: false,
111
111
  refreshing: false
112
112
  });
113
- const dialogRef = ref();
114
113
  let cacheOpenFunction;
115
114
  const handleOpen = async (openFunction) => {
116
115
  state.visible = true;
@@ -150,7 +149,9 @@ var dialog_default = defineComponent({
150
149
  state.refreshing = true;
151
150
  state.loading = true;
152
151
  try {
153
- await new Promise((resolve) => setTimeout(resolve, 500));
152
+ await new Promise((resolve) => {
153
+ setTimeout(resolve, 500);
154
+ });
154
155
  state.refreshing = false;
155
156
  await handleOpen(cacheOpenFunction);
156
157
  ElMessage.success("刷新成功");
@@ -163,7 +164,7 @@ var dialog_default = defineComponent({
163
164
  if (state.loading) return;
164
165
  if (document.querySelector(".el-image-viewer__wrapper")) return;
165
166
  const newDone = () => {
166
- return callOptionalFunction(props.beforeClose).then(() => {
167
+ return callOptionalFunction(props.beforeClose, done).then(() => {
167
168
  emit("close");
168
169
  done();
169
170
  });
@@ -201,7 +202,7 @@ var dialog_default = defineComponent({
201
202
  "ref": dialogRef,
202
203
  "class": [
203
204
  "fa-dialog",
204
- `fa-dialog-${_globalSize.value}`,
205
+ `fa-dialog-${globalSize.value}`,
205
206
  {
206
207
  "fa-dialog__full-height": props.fullHeight,
207
208
  "fa-dialog__fullscreen": state.fullscreen
@@ -231,9 +232,7 @@ var dialog_default = defineComponent({
231
232
  props.showRefresh && createVNode("div", {
232
233
  "title": "刷新",
233
234
  "class": ["fa-dialog__header-icon", state.loading ? "fa__click__disabled fa__click__disabled__cursor " : "fa__hover__twinkle"],
234
- "onClick": () => {
235
- handleRefresh();
236
- }
235
+ "onClick": handleRefresh
237
236
  }, [createVNode(ElIcon, null, { default: () => [createVNode(Refresh, null, null)] })]),
238
237
  props.showFullscreen && createVNode("div", {
239
238
  "title": state.fullscreen ? "关闭全屏显示" : "全屏显示",