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
@@ -7,10 +7,9 @@ import { makeSlots } from "../../../utils/vue/slots.mjs";
7
7
  import { withDefineType } from "../../../utils/vue/with.mjs";
8
8
  import { FaMimeType } from "../../../constants/mime.mjs";
9
9
  import { useUpload } from "../../upload/src/useUpload.mjs";
10
- import { Fragment, computed, createTextVNode, createVNode, defineComponent, mergeProps, reactive, ref, resolveDirective, withDirectives, withModifiers } from "vue";
10
+ import { Fragment, computed, createTextVNode, createVNode, defineComponent, mergeProps, reactive, resolveDirective, shallowRef, withDirectives, withModifiers } from "vue";
11
11
  import { Delete, Edit, UploadFilled, ZoomIn } from "@element-plus/icons-vue";
12
12
  import { ElIcon, ElImageViewer, ElUpload, uploadProps } from "element-plus";
13
- import { isArray, isNull, isString } from "lodash-unified";
14
13
  //#region src/components/uploadImage/src/uploadImage.tsx
15
14
  /** FaUploadImage 的运行时 Props 定义。 */
16
15
  const faUploadImageProps = {
@@ -33,7 +32,14 @@ const faUploadImageProps = {
33
32
  /** @description whether uploading multiple files is permitted */
34
33
  multiple: {
35
34
  type: Boolean,
36
- default: false
35
+ default: false,
36
+ validator: (value) => {
37
+ if (value) {
38
+ console.warn("[Fast:FaUploadImage]", "'multiple' 属性固定为 false,外部设置不会生效。");
39
+ return false;
40
+ }
41
+ return true;
42
+ }
37
43
  },
38
44
  /** @description whether to show the uploaded file list */
39
45
  showFileList: {
@@ -65,9 +71,9 @@ const faUploadImageProps = {
65
71
  /** FaUploadImage 的运行时 Emits 定义。 */
66
72
  const faUploadImageEmits = {
67
73
  /** @description v-model 回调 */
68
- "update:modelValue": (value) => isString(value) || isNull(value),
74
+ "update:modelValue": (value) => typeof value === "string" || value === null,
69
75
  /** @description v-model:fileList 回调 */
70
- "update:fileList": (value) => isArray(value)
76
+ "update:fileList": (value) => Array.isArray(value)
71
77
  };
72
78
  var uploadImage_default = defineComponent({
73
79
  name: "FaUploadImage",
@@ -86,15 +92,15 @@ var uploadImage_default = defineComponent({
86
92
  return props.uploadUrl || (props.action === uploadProps.action.default ? void 0 : props.action);
87
93
  }
88
94
  });
89
- const disabled = computed(() => {
90
- return props.disabled === true || formContext?.disabled === true;
91
- });
95
+ const uploadRef = shallowRef(null);
92
96
  const state = reactive({
93
97
  uploadKey: `fa-upload-image__${randomString(8)}`,
94
98
  preview: false,
95
99
  previewList: withDefineType([])
96
100
  });
97
- const uploadRef = ref();
101
+ const disabled = computed(() => {
102
+ return props.disabled === true || formContext?.disabled === true;
103
+ });
98
104
  const httpRequest = computed(() => props.httpRequest === uploadProps.httpRequest.default ? handleHttpRequest : props.httpRequest);
99
105
  const handleEdit = () => {
100
106
  document.querySelector(`.${state.uploadKey} .el-upload__input`)?.dispatchEvent(new MouseEvent("click"));
@@ -111,8 +117,7 @@ var uploadImage_default = defineComponent({
111
117
  };
112
118
  const handleBeforeUpload = (rawFile) => {
113
119
  if (!handleOnUpload(rawFile)) return false;
114
- if (props.beforeUpload) return props.beforeUpload(rawFile);
115
- return true;
120
+ return props.beforeUpload(rawFile);
116
121
  };
117
122
  const elUploadProps = useProps(props, uploadProps, [
118
123
  "fileList",
@@ -152,7 +157,7 @@ var uploadImage_default = defineComponent({
152
157
  "onClick": withModifiers(() => {}, ["stop"])
153
158
  }, [createVNode("span", {
154
159
  "class": "el-upload-list__item-icon",
155
- "onClick": () => handlePreview(),
160
+ "onClick": handlePreview,
156
161
  "title": "查看"
157
162
  }, [createVNode(ElIcon, null, { default: () => [createVNode(ZoomIn, null, null)] })]), !disabled.value && createVNode(Fragment, null, [createVNode("span", {
158
163
  "class": "el-upload-list__item-icon",
@@ -160,7 +165,7 @@ var uploadImage_default = defineComponent({
160
165
  "title": "编辑"
161
166
  }, [createVNode(ElIcon, null, { default: () => [createVNode(Edit, null, null)] })]), createVNode("span", {
162
167
  "class": "el-upload-list__item-icon",
163
- "onClick": () => handleRemove(),
168
+ "onClick": handleRemove,
164
169
  "title": "删除"
165
170
  }, [createVNode(ElIcon, null, { default: () => [createVNode(Delete, null, null)] })])])])]) : slots.default ? slots.default() : createVNode(Fragment, null, [createVNode(ElIcon, { "class": "el-icon--upload" }, { default: () => [createVNode(UploadFilled, null, null)] }), createVNode("div", { "class": "el-upload__text" }, [
166
171
  createTextVNode("Drop file here "),
@@ -1 +1 @@
1
- {"version":3,"file":"uploadImage.mjs","names":["update:modelValue","update:fileList"],"sources":["../../../../src/components/uploadImage/src/uploadImage.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, reactive, ref, withModifiers } from \"vue\";\nimport { Delete, Edit, UploadFilled, ZoomIn } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElImageViewer, ElUpload, uploadProps } from \"element-plus\";\nimport { isArray, isNull, isString } from \"lodash-unified\";\nimport { FaMimeType } from \"../../../constants\";\nimport { addCssUnit, definePropType, makeSlots, randomString, useExpose, useProps, useRender, withDefineType } from \"../../../utils\";\nimport { useUpload } from \"../../upload/src/useUpload\";\nimport type { UploadFile, UploadInstance, UploadProps, UploadUserFile, uploadListTypes } from \"element-plus\";\n\n/** FaUploadImage 的运行时 Props 定义。 */\nexport const faUploadImageProps = {\n\t...uploadProps,\n\t/** @description whether to activate drag and drop mode */\n\tdrag: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description accepted [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), will not work when `thumbnail-mode === true` */\n\taccept: {\n\t\ttype: String,\n\t\tdefault: (): string => FaMimeType.Image,\n\t},\n\t/** @description type of file list */\n\tlistType: {\n\t\ttype: definePropType<(typeof uploadListTypes)[number]>(String),\n\t\tdefault: \"picture\",\n\t},\n\t/** @description whether uploading multiple files is permitted */\n\tmultiple: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t},\n\t/** @description whether to show the uploaded file list */\n\tshowFileList: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t},\n\t/** @description v-model绑定值 */\n\tmodelValue: definePropType<string | null>(String),\n\t/** @description 大小限制,单位kb */\n\tmaxSize: {\n\t\ttype: [String, Number],\n\t\tdefault: 2048,\n\t},\n\t/** @description 图片上传接口,优先级最高 */\n\tuploadApi: {\n\t\ttype: definePropType<(formData: FormData) => Promise<string>>(Function),\n\t},\n\t/** @description 图片上传地址 */\n\tuploadUrl: String,\n\t/** @description 宽度 */\n\twidth: {\n\t\ttype: [String, Number],\n\t\tdefault: 150,\n\t},\n\t/** @description 高度 */\n\theight: {\n\t\ttype: [String, Number],\n\t\tdefault: 150,\n\t},\n};\n\n/** FaUploadImage 的运行时 Emits 定义。 */\nexport const faUploadImageEmits = {\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: string | null): boolean => isString(value) || isNull(value),\n\t/** @description v-model:fileList 回调 */\n\t\"update:fileList\": (value: UploadUserFile[]): boolean => isArray(value),\n};\n\n/** FaUploadImage 的插槽参数。 */\nexport interface FaUploadImageSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaUploadImage\",\n\tprops: faUploadImageProps,\n\temits: faUploadImageEmits,\n\tslots: makeSlots<FaUploadImageSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst {\n\t\t\tfileList,\n\t\t\tloading,\n\t\t\tformContext,\n\t\t\tmaxSizeMB,\n\t\t\thandleHttpRequest,\n\t\t\thandleOnSuccess,\n\t\t\thandleOnError,\n\t\t\thandleOnRemove,\n\t\t\thandleOnExceed,\n\t\t\thandleOnUpload,\n\t\t\thandleOnChange,\n\t\t} = useUpload<string>(\"FaUploadImage\", \"图片\", props, emit, {\n\t\t\tget maxSize() {\n\t\t\t\treturn props.maxSize;\n\t\t\t},\n\t\t\tget uploadApi() {\n\t\t\t\treturn props.uploadApi;\n\t\t\t},\n\t\t\tget uploadUrl() {\n\t\t\t\treturn props.uploadUrl || (props.action === uploadProps.action.default ? undefined : props.action);\n\t\t\t},\n\t\t});\n\n\t\tconst disabled = computed(() => {\n\t\t\treturn props.disabled === true || formContext?.disabled === true;\n\t\t});\n\n\t\tconst state = reactive({\n\t\t\tuploadKey: `fa-upload-image__${randomString(8)}`,\n\t\t\tpreview: false,\n\t\t\tpreviewList: withDefineType<string[]>([]),\n\t\t});\n\n\t\tconst uploadRef = ref<UploadInstance>();\n\t\tconst httpRequest = computed(() => (props.httpRequest === uploadProps.httpRequest.default ? handleHttpRequest : props.httpRequest));\n\n\t\tconst handleEdit = (): void => {\n\t\t\tconst uploadInputEl = document.querySelector(`.${state.uploadKey} .el-upload__input`);\n\t\t\tuploadInputEl?.dispatchEvent(new MouseEvent(\"click\"));\n\t\t};\n\n\t\tconst handlePreview = (): void => {\n\t\t\tconst fileUrl = fileList.value[0]?.url;\n\t\t\tif (!fileUrl) return;\n\t\t\tstate.previewList = [fileUrl];\n\t\t\tstate.preview = true;\n\t\t};\n\n\t\tconst handleRemove = (): void => {\n\t\t\tconst file = fileList.value[0];\n\t\t\tif (file) uploadRef.value?.handleRemove(file as UploadFile);\n\t\t};\n\n\t\tconst handleBeforeUpload: UploadProps[\"beforeUpload\"] = (rawFile) => {\n\t\t\tif (!handleOnUpload(rawFile)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (props.beforeUpload) {\n\t\t\t\treturn props.beforeUpload(rawFile);\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\n\t\tconst elUploadProps = useProps(props, uploadProps, [\n\t\t\t\"fileList\",\n\t\t\t\"disabled\",\n\t\t\t\"httpRequest\",\n\t\t\t\"beforeUpload\",\n\t\t\t\"onExceed\",\n\t\t\t\"onSuccess\",\n\t\t\t\"onError\",\n\t\t\t\"onRemove\",\n\t\t\t\"onChange\",\n\t\t]);\n\n\t\tuseRender(() => (\n\t\t\t<Fragment>\n\t\t\t\t<ElUpload\n\t\t\t\t\t{...elUploadProps.value}\n\t\t\t\t\tref={uploadRef}\n\t\t\t\t\tclass={[\"fa-upload-image\", state.uploadKey]}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\"--width\": addCssUnit(props.width),\n\t\t\t\t\t\t\"--height\": addCssUnit(props.height),\n\t\t\t\t\t}}\n\t\t\t\t\tvLoading={loading.value}\n\t\t\t\t\tvModel:fileList={fileList.value}\n\t\t\t\t\tmultiple={false}\n\t\t\t\t\tdisabled={disabled.value}\n\t\t\t\t\thttpRequest={httpRequest.value}\n\t\t\t\t\tbeforeUpload={handleBeforeUpload}\n\t\t\t\t\tonExceed={handleOnExceed}\n\t\t\t\t\tonSuccess={handleOnSuccess}\n\t\t\t\t\tonError={handleOnError}\n\t\t\t\t\tonRemove={handleOnRemove}\n\t\t\t\t\tonChange={handleOnChange}\n\t\t\t\t>\n\t\t\t\t\t{{\n\t\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\t\tfileList.value.length > 0 ? (\n\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t<img class=\"el-upload-list__item-thumbnail\" src={fileList.value[0]?.url} />\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tclass=\"el-upload-list__item-actions\"\n\t\t\t\t\t\t\t\t\t\tonClick={withModifiers(() => {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}, [\"stop\"])}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={() => handlePreview()} title=\"查看\">\n\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t<ZoomIn />\n\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t{!disabled.value && (\n\t\t\t\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={handleEdit} title=\"编辑\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Edit />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={() => handleRemove()} title=\"删除\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Delete />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t) : slots.default ? (\n\t\t\t\t\t\t\t\tslots.default()\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t<ElIcon class=\"el-icon--upload\">\n\t\t\t\t\t\t\t\t\t\t<UploadFilled />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t<div class=\"el-upload__text\">\n\t\t\t\t\t\t\t\t\t\tDrop file here <br />\n\t\t\t\t\t\t\t\t\t\t<em>click to upload</em>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\ttip: () => <div class=\"el-upload__tip\">file with a size less than {maxSizeMB.value.toString()}MB</div>,\n\t\t\t\t\t}}\n\t\t\t\t</ElUpload>\n\t\t\t\t{state.preview && (\n\t\t\t\t\t<ElImageViewer\n\t\t\t\t\t\tcloseOnPressEscape\n\t\t\t\t\t\thideOnClickModal\n\t\t\t\t\t\tteleported\n\t\t\t\t\t\tonClose={() => (state.preview = false)}\n\t\t\t\t\t\turlList={state.previewList}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</Fragment>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 取消上传请求 */\n\t\t\tabort: computed(() => uploadRef.value?.abort),\n\t\t\t/** @description 手动上传文件列表 */\n\t\t\tsubmit: computed(() => uploadRef.value?.submit),\n\t\t\t/** @description 清空已上传的文件列表(该方法不支持在 before-upload 中调用) */\n\t\t\tclearFiles: computed(() => uploadRef.value?.clearFiles),\n\t\t\t/** @description 手动选择文件 */\n\t\t\thandleStart: computed(() => uploadRef.value?.handleStart),\n\t\t\t/** @description 手动移除文件。file 和 rawFile 已被合并。 */\n\t\t\thandleRemove: computed(() => uploadRef.value?.handleRemove),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading,\n\t\t\t/** @description 文件集合 */\n\t\t\tfileList,\n\t\t\t/** @description 预览 */\n\t\t\tpreview: computed(() => state.preview),\n\t\t\t/** @description 预览集合 */\n\t\t\tpreviewList: computed(() => state.previewList),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;AAUA,MAAa,qBAAqB;CACjC,GAAG;;CAEH,MAAM;EACL,MAAM;EACN,SAAS;CACV;;CAEA,QAAQ;EACP,MAAM;EACN,eAAuB,WAAW;CACnC;;CAEA,UAAU;EACT,MAAM,eAAiD,MAAM;EAC7D,SAAS;CACV;;CAEA,UAAU;EACT,MAAM;EACN,SAAS;CACV;;CAEA,cAAc;EACb,MAAM;EACN,SAAS;CACV;;CAEA,YAAY,eAA8B,MAAM;;CAEhD,SAAS;EACR,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;CAEA,WAAW,EACV,MAAM,eAAwD,QAAQ,EACvE;;CAEA,WAAW;;CAEX,OAAO;EACN,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;CAEA,QAAQ;EACP,MAA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ploadImage.mjs","names":["update:modelValue","update:fileList"],"sources":["../../../../src/components/uploadImage/src/uploadImage.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, reactive, shallowRef, withModifiers } from \"vue\";\nimport { Delete, Edit, UploadFilled, ZoomIn } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElImageViewer, ElUpload, uploadProps } from \"element-plus\";\nimport { FaMimeType } from \"../../../constants\";\nimport { addCssUnit, definePropType, makeSlots, randomString, useExpose, useProps, useRender, withDefineType } from \"../../../utils\";\nimport { useUpload } from \"../../upload/src/useUpload\";\nimport type { UploadFile, UploadInstance, UploadProps, UploadUserFile } from \"element-plus\";\n\n/** FaUploadImage 的运行时 Props 定义。 */\nexport const faUploadImageProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...uploadProps,\n\t/** @description whether to activate drag and drop mode */\n\tdrag: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description accepted [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), will not work when `thumbnail-mode === true` */\n\taccept: {\n\t\ttype: String,\n\t\tdefault: () => FaMimeType.Image,\n\t},\n\t/** @description type of file list */\n\tlistType: {\n\t\ttype: definePropType<NonNullable<UploadProps[\"listType\"]>>(String),\n\t\tdefault: \"picture\",\n\t},\n\t/** @description whether uploading multiple files is permitted */\n\tmultiple: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t\tvalidator: (value: boolean) => {\n\t\t\tif (value) {\n\t\t\t\tconsole.warn(\"[Fast:FaUploadImage]\", \"'multiple' 属性固定为 false,外部设置不会生效。\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\t},\n\t/** @description whether to show the uploaded file list */\n\tshowFileList: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t},\n\t/** @description v-model绑定值 */\n\tmodelValue: definePropType<string | null>(String),\n\t/** @description 大小限制,单位kb */\n\tmaxSize: {\n\t\ttype: [String, Number],\n\t\tdefault: 2048,\n\t},\n\t/** @description 图片上传接口,优先级最高 */\n\tuploadApi: {\n\t\ttype: definePropType<(formData: FormData) => Promise<string>>(Function),\n\t},\n\t/** @description 图片上传地址 */\n\tuploadUrl: String,\n\t/** @description 宽度 */\n\twidth: {\n\t\ttype: [String, Number],\n\t\tdefault: 150,\n\t},\n\t/** @description 高度 */\n\theight: {\n\t\ttype: [String, Number],\n\t\tdefault: 150,\n\t},\n};\n\n/** FaUploadImage 的运行时 Emits 定义。 */\nexport const faUploadImageEmits = {\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: string | null) => typeof value === \"string\" || value === null,\n\t/** @description v-model:fileList 回调 */\n\t\"update:fileList\": (value: UploadUserFile[]) => Array.isArray(value),\n};\n\n/** FaUploadImage 的插槽参数。 */\nexport interface FaUploadImageSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaUploadImage\",\n\tprops: faUploadImageProps,\n\temits: faUploadImageEmits,\n\tslots: makeSlots<FaUploadImageSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst {\n\t\t\tfileList,\n\t\t\tloading,\n\t\t\tformContext,\n\t\t\tmaxSizeMB,\n\t\t\thandleHttpRequest,\n\t\t\thandleOnSuccess,\n\t\t\thandleOnError,\n\t\t\thandleOnRemove,\n\t\t\thandleOnExceed,\n\t\t\thandleOnUpload,\n\t\t\thandleOnChange,\n\t\t} = useUpload<string>(\"FaUploadImage\", \"图片\", props, emit, {\n\t\t\tget maxSize() {\n\t\t\t\treturn props.maxSize;\n\t\t\t},\n\t\t\tget uploadApi() {\n\t\t\t\treturn props.uploadApi;\n\t\t\t},\n\t\t\tget uploadUrl() {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 需要与 Element Plus 2.x 的运行时默认 action 比较。\n\t\t\t\treturn props.uploadUrl || (props.action === uploadProps.action.default ? undefined : props.action);\n\t\t\t},\n\t\t});\n\n\t\tconst uploadRef = shallowRef<UploadInstance | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tuploadKey: `fa-upload-image__${randomString(8)}`,\n\t\t\tpreview: false,\n\t\t\tpreviewList: withDefineType<string[]>([]),\n\t\t});\n\n\t\tconst disabled = computed(() => {\n\t\t\treturn props.disabled === true || formContext?.disabled === true;\n\t\t});\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 需要识别 Element Plus 2.x 注入的默认请求实现。\n\t\tconst httpRequest = computed(() => (props.httpRequest === uploadProps.httpRequest.default ? handleHttpRequest : props.httpRequest));\n\n\t\tconst handleEdit = () => {\n\t\t\tconst uploadInputEl = document.querySelector(`.${state.uploadKey} .el-upload__input`);\n\t\t\tuploadInputEl?.dispatchEvent(new MouseEvent(\"click\"));\n\t\t};\n\n\t\tconst handlePreview = () => {\n\t\t\tconst fileUrl = fileList.value[0]?.url;\n\t\t\tif (!fileUrl) return;\n\t\t\tstate.previewList = [fileUrl];\n\t\t\tstate.preview = true;\n\t\t};\n\n\t\tconst handleRemove = () => {\n\t\t\tconst file = fileList.value[0];\n\t\t\tif (file) uploadRef.value?.handleRemove(file as UploadFile);\n\t\t};\n\n\t\tconst handleBeforeUpload: UploadProps[\"beforeUpload\"] = (rawFile) => {\n\t\t\tif (!handleOnUpload(rawFile)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn props.beforeUpload(rawFile);\n\t\t};\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elUploadProps = useProps(props, uploadProps, [\n\t\t\t\"fileList\",\n\t\t\t\"disabled\",\n\t\t\t\"httpRequest\",\n\t\t\t\"beforeUpload\",\n\t\t\t\"onExceed\",\n\t\t\t\"onSuccess\",\n\t\t\t\"onError\",\n\t\t\t\"onRemove\",\n\t\t\t\"onChange\",\n\t\t]);\n\n\t\tuseRender(() => (\n\t\t\t<Fragment>\n\t\t\t\t<ElUpload\n\t\t\t\t\t{...elUploadProps.value}\n\t\t\t\t\tref={uploadRef}\n\t\t\t\t\tclass={[\"fa-upload-image\", state.uploadKey]}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\"--width\": addCssUnit(props.width),\n\t\t\t\t\t\t\"--height\": addCssUnit(props.height),\n\t\t\t\t\t}}\n\t\t\t\t\tvLoading={loading.value}\n\t\t\t\t\tvModel:fileList={fileList.value}\n\t\t\t\t\tmultiple={false}\n\t\t\t\t\tdisabled={disabled.value}\n\t\t\t\t\thttpRequest={httpRequest.value}\n\t\t\t\t\tbeforeUpload={handleBeforeUpload}\n\t\t\t\t\tonExceed={handleOnExceed}\n\t\t\t\t\tonSuccess={handleOnSuccess}\n\t\t\t\t\tonError={handleOnError}\n\t\t\t\t\tonRemove={handleOnRemove}\n\t\t\t\t\tonChange={handleOnChange}\n\t\t\t\t>\n\t\t\t\t\t{{\n\t\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\t\tfileList.value.length > 0 ? (\n\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t<img class=\"el-upload-list__item-thumbnail\" src={fileList.value[0]?.url} />\n\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\tclass=\"el-upload-list__item-actions\"\n\t\t\t\t\t\t\t\t\t\tonClick={withModifiers(() => {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}, [\"stop\"])}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={handlePreview} title=\"查看\">\n\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t<ZoomIn />\n\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t{!disabled.value && (\n\t\t\t\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={handleEdit} title=\"编辑\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Edit />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={handleRemove} title=\"删除\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Delete />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t) : slots.default ? (\n\t\t\t\t\t\t\t\tslots.default()\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t<ElIcon class=\"el-icon--upload\">\n\t\t\t\t\t\t\t\t\t\t<UploadFilled />\n\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t<div class=\"el-upload__text\">\n\t\t\t\t\t\t\t\t\t\tDrop file here <br />\n\t\t\t\t\t\t\t\t\t\t<em>click to upload</em>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\ttip: () => <div class=\"el-upload__tip\">file with a size less than {maxSizeMB.value.toString()}MB</div>,\n\t\t\t\t\t}}\n\t\t\t\t</ElUpload>\n\t\t\t\t{state.preview && (\n\t\t\t\t\t<ElImageViewer\n\t\t\t\t\t\tcloseOnPressEscape\n\t\t\t\t\t\thideOnClickModal\n\t\t\t\t\t\tteleported\n\t\t\t\t\t\tonClose={() => (state.preview = false)}\n\t\t\t\t\t\turlList={state.previewList}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</Fragment>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 取消上传请求 */\n\t\t\tabort: computed(() => uploadRef.value?.abort),\n\t\t\t/** @description 手动上传文件列表 */\n\t\t\tsubmit: computed(() => uploadRef.value?.submit),\n\t\t\t/** @description 清空已上传的文件列表(该方法不支持在 before-upload 中调用) */\n\t\t\tclearFiles: computed(() => uploadRef.value?.clearFiles),\n\t\t\t/** @description 手动选择文件 */\n\t\t\thandleStart: computed(() => uploadRef.value?.handleStart),\n\t\t\t/** @description 手动移除文件。file 和 rawFile 已被合并。 */\n\t\t\thandleRemove: computed(() => uploadRef.value?.handleRemove),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading,\n\t\t\t/** @description 文件集合 */\n\t\t\tfileList,\n\t\t\t/** @description 预览 */\n\t\t\tpreview: computed(() => state.preview),\n\t\t\t/** @description 预览集合 */\n\t\t\tpreviewList: computed(() => state.previewList),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;AASA,MAAa,qBAAqB;CAEjC,GAAG;;CAEH,MAAM;EACL,MAAM;EACN,SAAS;CACV;;CAEA,QAAQ;EACP,MAAM;EACN,eAAe,WAAW;CAC3B;;CAEA,UAAU;EACT,MAAM,eAAqD,MAAM;EACjE,SAAS;CACV;;CAEA,UAAU;EACT,MAAM;EACN,SAAS;EACT,YAAY,UAAmB;GAC9B,IAAI,OAAO;IACV,QAAQ,KAAK,wBAAwB,kCAAkC;IACvE,OAAO;GACR;GACA,OAAO;EACR;CACD;;CAEA,cAAc;EACb,MAAM;EACN,SAAS;CACV;;CAEA,YAAY,eAA8B,MAAM;;CAEhD,SAAS;EACR,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;CAEA,WAAW,EACV,MAA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AO;;GAErC,aAAa,eAAe,MAAM,WAAW;EAC9C,CAAC;CACF;AACD,CAAC"}
@@ -8,13 +8,14 @@ export declare const faUploadImagesProps: {
8
8
  };
9
9
  /** @description type of file list */
10
10
  listType: {
11
- type: import("vue").PropType<"picture" | "text" | "picture-card">;
11
+ type: import("vue").PropType<NonNullable<import("element-plus").ListType | undefined>>;
12
12
  default: string;
13
13
  };
14
14
  /** @description whether uploading multiple files is permitted */
15
15
  multiple: {
16
16
  type: BooleanConstructor;
17
17
  default: boolean;
18
+ validator: (value: boolean) => boolean;
18
19
  };
19
20
  /** @description maximum number of uploads allowed */
20
21
  limit: {
@@ -165,13 +166,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
165
166
  };
166
167
  /** @description type of file list */
167
168
  listType: {
168
- type: import("vue").PropType<"picture" | "text" | "picture-card">;
169
+ type: import("vue").PropType<NonNullable<import("element-plus").ListType | undefined>>;
169
170
  default: string;
170
171
  };
171
172
  /** @description whether uploading multiple files is permitted */
172
173
  multiple: {
173
174
  type: BooleanConstructor;
174
175
  default: boolean;
176
+ validator: (value: boolean) => boolean;
175
177
  };
176
178
  /** @description maximum number of uploads allowed */
177
179
  limit: {
@@ -333,13 +335,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
333
335
  };
334
336
  /** @description type of file list */
335
337
  listType: {
336
- type: import("vue").PropType<"picture" | "text" | "picture-card">;
338
+ type: import("vue").PropType<NonNullable<import("element-plus").ListType | undefined>>;
337
339
  default: string;
338
340
  };
339
341
  /** @description whether uploading multiple files is permitted */
340
342
  multiple: {
341
343
  type: BooleanConstructor;
342
344
  default: boolean;
345
+ validator: (value: boolean) => boolean;
343
346
  };
344
347
  /** @description maximum number of uploads allowed */
345
348
  limit: {
@@ -480,10 +483,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
480
483
  onChange: (uploadFile: UploadFile, uploadFiles: import("element-plus").UploadFiles) => void;
481
484
  onProgress: (evt: import("element-plus").UploadProgressEvent, uploadFile: UploadFile, uploadFiles: import("element-plus").UploadFiles) => void;
482
485
  drag: boolean;
483
- onRemove: (uploadFile: UploadFile, uploadFiles: import("element-plus").UploadFiles) => void;
484
486
  multiple: boolean;
485
487
  fileList: UploadUserFile[];
486
488
  beforeUpload: (rawFile: import("element-plus").UploadRawFile) => import("element-plus/es/utils/typescript.mjs").Awaitable<void | undefined | null | boolean | File | Blob>;
489
+ onRemove: (uploadFile: UploadFile, uploadFiles: import("element-plus").UploadFiles) => void;
487
490
  onPreview: (uploadFile: UploadFile) => void;
488
491
  onSuccess: (response: any, uploadFile: UploadFile, uploadFiles: import("element-plus").UploadFiles) => void;
489
492
  onExceed: (files: File[], uploadFiles: UploadUserFile[]) => void;
@@ -493,7 +496,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
493
496
  showFileList: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
494
497
  accept: string;
495
498
  autoUpload: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
496
- listType: "picture" | "text" | "picture-card";
499
+ listType: NonNullable<import("element-plus").ListType | undefined>;
497
500
  httpRequest: import("element-plus").UploadRequestHandler;
498
501
  limit: number;
499
502
  directory: boolean;
@@ -6,10 +6,9 @@ import { makeSlots } from "../../../utils/vue/slots.mjs";
6
6
  import { withDefineType } from "../../../utils/vue/with.mjs";
7
7
  import { FaMimeType } from "../../../constants/mime.mjs";
8
8
  import { useUpload } from "../../upload/src/useUpload.mjs";
9
- import { Fragment, computed, createTextVNode, createVNode, defineComponent, mergeProps, reactive, ref, resolveDirective, withDirectives } from "vue";
9
+ import { Fragment, computed, createTextVNode, createVNode, defineComponent, mergeProps, reactive, resolveDirective, shallowRef, withDirectives } from "vue";
10
10
  import { Delete, Edit, Plus, ZoomIn } from "@element-plus/icons-vue";
11
11
  import { ElIcon, ElImageViewer, ElUpload, uploadProps } from "element-plus";
12
- import { isArray, isNull } from "lodash-unified";
13
12
  //#region src/components/uploadImages/src/uploadImages.tsx
14
13
  /** FaUploadImages 的运行时 Props 定义。 */
15
14
  const faUploadImagesProps = {
@@ -27,7 +26,14 @@ const faUploadImagesProps = {
27
26
  /** @description whether uploading multiple files is permitted */
28
27
  multiple: {
29
28
  type: Boolean,
30
- default: true
29
+ default: true,
30
+ validator: (value) => {
31
+ if (!value) {
32
+ console.warn("[Fast:FaUploadImages]", "'multiple' 属性固定为 true,外部设置不会生效。");
33
+ return false;
34
+ }
35
+ return true;
36
+ }
31
37
  },
32
38
  /** @description maximum number of uploads allowed */
33
39
  limit: {
@@ -49,9 +55,9 @@ const faUploadImagesProps = {
49
55
  /** FaUploadImages 的运行时 Emits 定义。 */
50
56
  const faUploadImagesEmits = {
51
57
  /** @description v-model 回调 */
52
- "update:modelValue": (value) => isArray(value) || isNull(value),
58
+ "update:modelValue": (value) => Array.isArray(value) || value === null,
53
59
  /** @description v-model:fileList 回调 */
54
- "update:fileList": (value) => isArray(value)
60
+ "update:fileList": (value) => Array.isArray(value)
55
61
  };
56
62
  var uploadImages_default = defineComponent({
57
63
  name: "FaUploadImages",
@@ -70,16 +76,16 @@ var uploadImages_default = defineComponent({
70
76
  return props.uploadUrl || (props.action === uploadProps.action.default ? void 0 : props.action);
71
77
  }
72
78
  });
73
- const disabled = computed(() => {
74
- return props.disabled === true || formContext?.disabled === true;
75
- });
79
+ const uploadRef = shallowRef(null);
76
80
  const state = reactive({
77
81
  uploadKey: `fa-upload-images__${randomString(8)}`,
78
82
  preview: false,
79
83
  previewIndex: -1,
80
84
  previewList: withDefineType([])
81
85
  });
82
- const uploadRef = ref();
86
+ const disabled = computed(() => {
87
+ return props.disabled === true || formContext?.disabled === true;
88
+ });
83
89
  const httpRequest = computed(() => props.httpRequest === uploadProps.httpRequest.default ? handleHttpRequest : props.httpRequest);
84
90
  const handleEdit = () => {
85
91
  document.querySelector(`.${state.uploadKey} .el-upload__input`)?.dispatchEvent(new MouseEvent("click"));
@@ -95,8 +101,7 @@ var uploadImages_default = defineComponent({
95
101
  };
96
102
  const handleBeforeUpload = (rawFile) => {
97
103
  if (!handleOnUpload(rawFile)) return false;
98
- if (props.beforeUpload) return props.beforeUpload(rawFile);
99
- return true;
104
+ return props.beforeUpload(rawFile);
100
105
  };
101
106
  const elUploadProps = useProps(props, uploadProps, [
102
107
  "fileList",
@@ -1 +1 @@
1
- {"version":3,"file":"uploadImages.mjs","names":["update:modelValue","update:fileList"],"sources":["../../../../src/components/uploadImages/src/uploadImages.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, reactive, ref } from \"vue\";\nimport { Delete, Edit, Plus, ZoomIn } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElImageViewer, ElUpload, uploadProps } from \"element-plus\";\nimport { isArray, isNull } from \"lodash-unified\";\nimport { FaMimeType } from \"../../../constants\";\nimport { definePropType, makeSlots, randomString, useExpose, useProps, useRender, withDefineType } from \"../../../utils\";\nimport { useUpload } from \"../../upload/src/useUpload\";\nimport type { UploadFile, UploadInstance, UploadProps, UploadUserFile, uploadListTypes } from \"element-plus\";\n\n/** FaUploadImages 的运行时 Props 定义。 */\nexport const faUploadImagesProps = {\n\t...uploadProps,\n\t/** @description accepted [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), will not work when `thumbnail-mode === true` */\n\taccept: {\n\t\ttype: String,\n\t\tdefault: (): string => FaMimeType.Image,\n\t},\n\t/** @description type of file list */\n\tlistType: {\n\t\ttype: definePropType<(typeof uploadListTypes)[number]>(String),\n\t\tdefault: \"picture-card\",\n\t},\n\t/** @description whether uploading multiple files is permitted */\n\tmultiple: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description maximum number of uploads allowed */\n\tlimit: {\n\t\ttype: Number,\n\t\tdefault: 9,\n\t},\n\t/** @description v-model绑定值 */\n\tmodelValue: definePropType<string[] | null>([Array]),\n\t/** @description 大小限制,单位kb */\n\tmaxSize: {\n\t\ttype: [String, Number],\n\t\tdefault: 2048,\n\t},\n\t/** @description 图片上传接口,优先级最高 */\n\tuploadApi: {\n\t\ttype: definePropType<(formData: FormData) => Promise<string>>(Function),\n\t},\n\t/** @description 图片上传地址 */\n\tuploadUrl: String,\n};\n\n/** FaUploadImages 的运行时 Emits 定义。 */\nexport const faUploadImagesEmits = {\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: string[] | null): boolean => isArray(value) || isNull(value),\n\t/** @description v-model:fileList 回调 */\n\t\"update:fileList\": (value: UploadUserFile[]): boolean => isArray(value),\n};\n\n/** FaUploadImages 的插槽参数。 */\nexport interface FaUploadImagesSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaUploadImages\",\n\tprops: faUploadImagesProps,\n\temits: faUploadImagesEmits,\n\tslots: makeSlots<FaUploadImagesSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst {\n\t\t\tfileList,\n\t\t\tloading,\n\t\t\tformContext,\n\t\t\tmaxSizeMB,\n\t\t\thandleHttpRequest,\n\t\t\thandleOnSuccess,\n\t\t\thandleOnError,\n\t\t\thandleOnRemove,\n\t\t\thandleOnExceed,\n\t\t\thandleOnUpload,\n\t\t\thandleOnChange,\n\t\t} = useUpload<string[]>(\"FaUploadImages\", \"图片\", props, emit, {\n\t\t\tget maxSize() {\n\t\t\t\treturn props.maxSize;\n\t\t\t},\n\t\t\tget uploadApi() {\n\t\t\t\treturn props.uploadApi;\n\t\t\t},\n\t\t\tget uploadUrl() {\n\t\t\t\treturn props.uploadUrl || (props.action === uploadProps.action.default ? undefined : props.action);\n\t\t\t},\n\t\t});\n\n\t\tconst disabled = computed(() => {\n\t\t\treturn props.disabled === true || formContext?.disabled === true;\n\t\t});\n\n\t\tconst state = reactive({\n\t\t\tuploadKey: `fa-upload-images__${randomString(8)}`,\n\t\t\tpreview: false,\n\t\t\tpreviewIndex: -1,\n\t\t\tpreviewList: withDefineType<string[]>([]),\n\t\t});\n\n\t\tconst uploadRef = ref<UploadInstance>();\n\t\tconst httpRequest = computed(() => (props.httpRequest === uploadProps.httpRequest.default ? handleHttpRequest : props.httpRequest));\n\n\t\tconst handleEdit = (): void => {\n\t\t\tconst uploadInputEl = document.querySelector(`.${state.uploadKey} .el-upload__input`);\n\t\t\tuploadInputEl?.dispatchEvent(new MouseEvent(\"click\"));\n\t\t};\n\n\t\tconst handlePreview = (uploadFile: UploadFile): void => {\n\t\t\tstate.previewIndex = fileList.value.findIndex((f) => f.url === uploadFile.url);\n\t\t\tstate.previewList = fileList.value.flatMap((item) => (item.url ? [item.url] : []));\n\t\t\tstate.preview = true;\n\t\t};\n\n\t\tconst handleRemove = (index: number): void => {\n\t\t\tconst file = fileList.value[index];\n\t\t\tif (file) uploadRef.value?.handleRemove(file as UploadFile);\n\t\t};\n\n\t\tconst handleBeforeUpload: UploadProps[\"beforeUpload\"] = (rawFile) => {\n\t\t\tif (!handleOnUpload(rawFile)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (props.beforeUpload) {\n\t\t\t\treturn props.beforeUpload(rawFile);\n\t\t\t}\n\t\t\treturn true;\n\t\t};\n\n\t\tconst elUploadProps = useProps(props, uploadProps, [\n\t\t\t\"fileList\",\n\t\t\t\"multiple\",\n\t\t\t\"disabled\",\n\t\t\t\"httpRequest\",\n\t\t\t\"beforeUpload\",\n\t\t\t\"onExceed\",\n\t\t\t\"onSuccess\",\n\t\t\t\"onError\",\n\t\t\t\"onRemove\",\n\t\t\t\"onChange\",\n\t\t]);\n\n\t\tuseRender(() => (\n\t\t\t<Fragment>\n\t\t\t\t<ElUpload\n\t\t\t\t\t{...elUploadProps.value}\n\t\t\t\t\tref={uploadRef}\n\t\t\t\t\tclass={[\"fa-upload-images\", state.uploadKey, { \"fa-upload-images__hidden-upload\": fileList.value.length >= props.limit }]}\n\t\t\t\t\tvLoading={loading.value}\n\t\t\t\t\tvModel:fileList={fileList.value}\n\t\t\t\t\tmultiple={true}\n\t\t\t\t\tdisabled={disabled.value}\n\t\t\t\t\thttpRequest={httpRequest.value}\n\t\t\t\t\tbeforeUpload={handleBeforeUpload}\n\t\t\t\t\tonExceed={handleOnExceed}\n\t\t\t\t\tonSuccess={handleOnSuccess}\n\t\t\t\t\tonError={handleOnError}\n\t\t\t\t\tonRemove={handleOnRemove}\n\t\t\t\t\tonChange={handleOnChange}\n\t\t\t\t>\n\t\t\t\t\t{{\n\t\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\t\tfileList.value.length < props.limit && slots.default ? (\n\t\t\t\t\t\t\t\tslots.default()\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t<Plus />\n\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\ttip: () => <div class=\"el-upload__tip\">files with a size less than {maxSizeMB.value.toString()}MB</div>,\n\t\t\t\t\t\tfile: ({ file, index }: { file: UploadFile; index: number }) => (\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<img class=\"el-upload-list__item-thumbnail\" src={file.url} />\n\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-actions\">\n\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-preview\" onClick={() => handlePreview(file)} title=\"查看\">\n\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t<ZoomIn />\n\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{!disabled.value && (\n\t\t\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={handleEdit} title=\"编辑\">\n\t\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Edit />\n\t\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={() => handleRemove(index)} title=\"删除\">\n\t\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Delete />\n\t\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t</ElUpload>\n\t\t\t\t{state.preview && (\n\t\t\t\t\t<ElImageViewer\n\t\t\t\t\t\tcloseOnPressEscape\n\t\t\t\t\t\thideOnClickModal\n\t\t\t\t\t\tteleported\n\t\t\t\t\t\tinitialIndex={Math.max(state.previewIndex, 0)}\n\t\t\t\t\t\tonClose={() => (state.preview = false)}\n\t\t\t\t\t\turlList={state.previewList}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</Fragment>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 取消上传请求 */\n\t\t\tabort: computed(() => uploadRef.value?.abort),\n\t\t\t/** @description 手动上传文件列表 */\n\t\t\tsubmit: computed(() => uploadRef.value?.submit),\n\t\t\t/** @description 清空已上传的文件列表(该方法不支持在 before-upload 中调用) */\n\t\t\tclearFiles: computed(() => uploadRef.value?.clearFiles),\n\t\t\t/** @description 手动选择文件 */\n\t\t\thandleStart: computed(() => uploadRef.value?.handleStart),\n\t\t\t/** @description 手动移除文件。file 和 rawFile 已被合并。 */\n\t\t\thandleRemove: computed(() => uploadRef.value?.handleRemove),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading,\n\t\t\t/** @description 文件集合 */\n\t\t\tfileList,\n\t\t\t/** @description 预览 */\n\t\t\tpreview: computed(() => state.preview),\n\t\t\t/** @description 预览集合 */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AE5C,QAAQ,eAAe,UAAU,OAAO,MAAM;;GAE9C,YAAY,eAAe,UAAU,OAAO,UAAU;;GAEtD,aAAa,eAAe,UAAU,OAAO,WAAW;;GAExD,cAAc,eAAe,UAAU,OAAO,YAAY;;GAE1D;;GAEA;;GAEA,SAAS,eAAe,MAAM,OAAO;;GAErC,aAAa,eAAe,MAAM,WAAW;EAC9C,CAAC;CACF;AACD,CAAC"}
1
+ {"version":3,"file":"uploadImages.mjs","names":["update:modelValue","update:fileList"],"sources":["../../../../src/components/uploadImages/src/uploadImages.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, reactive, shallowRef } from \"vue\";\nimport { Delete, Edit, Plus, ZoomIn } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElImageViewer, ElUpload, uploadProps } from \"element-plus\";\nimport { FaMimeType } from \"../../../constants\";\nimport { definePropType, makeSlots, randomString, useExpose, useProps, useRender, withDefineType } from \"../../../utils\";\nimport { useUpload } from \"../../upload/src/useUpload\";\nimport type { UploadFile, UploadInstance, UploadProps, UploadUserFile } from \"element-plus\";\n\n/** FaUploadImages 的运行时 Props 定义。 */\nexport const faUploadImagesProps = {\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- Element Plus 2.x 尚未提供可替代的公开运行时 props 定义。\n\t...uploadProps,\n\t/** @description accepted [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), will not work when `thumbnail-mode === true` */\n\taccept: {\n\t\ttype: String,\n\t\tdefault: () => FaMimeType.Image,\n\t},\n\t/** @description type of file list */\n\tlistType: {\n\t\ttype: definePropType<NonNullable<UploadProps[\"listType\"]>>(String),\n\t\tdefault: \"picture-card\",\n\t},\n\t/** @description whether uploading multiple files is permitted */\n\tmultiple: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t\tvalidator: (value: boolean) => {\n\t\t\tif (!value) {\n\t\t\t\tconsole.warn(\"[Fast:FaUploadImages]\", \"'multiple' 属性固定为 true,外部设置不会生效。\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\t},\n\t/** @description maximum number of uploads allowed */\n\tlimit: {\n\t\ttype: Number,\n\t\tdefault: 9,\n\t},\n\t/** @description v-model绑定值 */\n\tmodelValue: definePropType<string[] | null>([Array]),\n\t/** @description 大小限制,单位kb */\n\tmaxSize: {\n\t\ttype: [String, Number],\n\t\tdefault: 2048,\n\t},\n\t/** @description 图片上传接口,优先级最高 */\n\tuploadApi: {\n\t\ttype: definePropType<(formData: FormData) => Promise<string>>(Function),\n\t},\n\t/** @description 图片上传地址 */\n\tuploadUrl: String,\n};\n\n/** FaUploadImages 的运行时 Emits 定义。 */\nexport const faUploadImagesEmits = {\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: string[] | null) => Array.isArray(value) || value === null,\n\t/** @description v-model:fileList 回调 */\n\t\"update:fileList\": (value: UploadUserFile[]) => Array.isArray(value),\n};\n\n/** FaUploadImages 的插槽参数。 */\nexport interface FaUploadImagesSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaUploadImages\",\n\tprops: faUploadImagesProps,\n\temits: faUploadImagesEmits,\n\tslots: makeSlots<FaUploadImagesSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst {\n\t\t\tfileList,\n\t\t\tloading,\n\t\t\tformContext,\n\t\t\tmaxSizeMB,\n\t\t\thandleHttpRequest,\n\t\t\thandleOnSuccess,\n\t\t\thandleOnError,\n\t\t\thandleOnRemove,\n\t\t\thandleOnExceed,\n\t\t\thandleOnUpload,\n\t\t\thandleOnChange,\n\t\t} = useUpload<string[]>(\"FaUploadImages\", \"图片\", props, emit, {\n\t\t\tget maxSize() {\n\t\t\t\treturn props.maxSize;\n\t\t\t},\n\t\t\tget uploadApi() {\n\t\t\t\treturn props.uploadApi;\n\t\t\t},\n\t\t\tget uploadUrl() {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 需要与 Element Plus 2.x 的运行时默认 action 比较。\n\t\t\t\treturn props.uploadUrl || (props.action === uploadProps.action.default ? undefined : props.action);\n\t\t\t},\n\t\t});\n\n\t\tconst uploadRef = shallowRef<UploadInstance | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tuploadKey: `fa-upload-images__${randomString(8)}`,\n\t\t\tpreview: false,\n\t\t\tpreviewIndex: -1,\n\t\t\tpreviewList: withDefineType<string[]>([]),\n\t\t});\n\n\t\tconst disabled = computed(() => {\n\t\t\treturn props.disabled === true || formContext?.disabled === true;\n\t\t});\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 需要识别 Element Plus 2.x 注入的默认请求实现。\n\t\tconst httpRequest = computed(() => (props.httpRequest === uploadProps.httpRequest.default ? handleHttpRequest : props.httpRequest));\n\n\t\tconst handleEdit = () => {\n\t\t\tconst uploadInputEl = document.querySelector(`.${state.uploadKey} .el-upload__input`);\n\t\t\tuploadInputEl?.dispatchEvent(new MouseEvent(\"click\"));\n\t\t};\n\n\t\tconst handlePreview = (uploadFile: UploadFile) => {\n\t\t\tstate.previewIndex = fileList.value.findIndex((f) => f.url === uploadFile.url);\n\t\t\tstate.previewList = fileList.value.flatMap((item) => (item.url ? [item.url] : []));\n\t\t\tstate.preview = true;\n\t\t};\n\n\t\tconst handleRemove = (index: number) => {\n\t\t\tconst file = fileList.value[index];\n\t\t\tif (file) uploadRef.value?.handleRemove(file as UploadFile);\n\t\t};\n\n\t\tconst handleBeforeUpload: UploadProps[\"beforeUpload\"] = (rawFile) => {\n\t\t\tif (!handleOnUpload(rawFile)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn props.beforeUpload(rawFile);\n\t\t};\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-deprecated -- 透传范围必须与继承的 Element Plus 2.x 运行时 props 保持一致。\n\t\tconst elUploadProps = useProps(props, uploadProps, [\n\t\t\t\"fileList\",\n\t\t\t\"multiple\",\n\t\t\t\"disabled\",\n\t\t\t\"httpRequest\",\n\t\t\t\"beforeUpload\",\n\t\t\t\"onExceed\",\n\t\t\t\"onSuccess\",\n\t\t\t\"onError\",\n\t\t\t\"onRemove\",\n\t\t\t\"onChange\",\n\t\t]);\n\n\t\tuseRender(() => (\n\t\t\t<Fragment>\n\t\t\t\t<ElUpload\n\t\t\t\t\t{...elUploadProps.value}\n\t\t\t\t\tref={uploadRef}\n\t\t\t\t\tclass={[\"fa-upload-images\", state.uploadKey, { \"fa-upload-images__hidden-upload\": fileList.value.length >= props.limit }]}\n\t\t\t\t\tvLoading={loading.value}\n\t\t\t\t\tvModel:fileList={fileList.value}\n\t\t\t\t\tmultiple={true}\n\t\t\t\t\tdisabled={disabled.value}\n\t\t\t\t\thttpRequest={httpRequest.value}\n\t\t\t\t\tbeforeUpload={handleBeforeUpload}\n\t\t\t\t\tonExceed={handleOnExceed}\n\t\t\t\t\tonSuccess={handleOnSuccess}\n\t\t\t\t\tonError={handleOnError}\n\t\t\t\t\tonRemove={handleOnRemove}\n\t\t\t\t\tonChange={handleOnChange}\n\t\t\t\t>\n\t\t\t\t\t{{\n\t\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\t\tfileList.value.length < props.limit && slots.default ? (\n\t\t\t\t\t\t\t\tslots.default()\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t<Plus />\n\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\ttip: () => <div class=\"el-upload__tip\">files with a size less than {maxSizeMB.value.toString()}MB</div>,\n\t\t\t\t\t\tfile: ({ file, index }: { file: UploadFile; index: number }) => (\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<img class=\"el-upload-list__item-thumbnail\" src={file.url} />\n\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-actions\">\n\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-preview\" onClick={() => handlePreview(file)} title=\"查看\">\n\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t<ZoomIn />\n\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{!disabled.value && (\n\t\t\t\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={handleEdit} title=\"编辑\">\n\t\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Edit />\n\t\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"el-upload-list__item-icon\" onClick={() => handleRemove(index)} title=\"删除\">\n\t\t\t\t\t\t\t\t\t\t\t\t<ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Delete />\n\t\t\t\t\t\t\t\t\t\t\t\t</ElIcon>\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t</ElUpload>\n\t\t\t\t{state.preview && (\n\t\t\t\t\t<ElImageViewer\n\t\t\t\t\t\tcloseOnPressEscape\n\t\t\t\t\t\thideOnClickModal\n\t\t\t\t\t\tteleported\n\t\t\t\t\t\tinitialIndex={Math.max(state.previewIndex, 0)}\n\t\t\t\t\t\tonClose={() => (state.preview = false)}\n\t\t\t\t\t\turlList={state.previewList}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</Fragment>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 取消上传请求 */\n\t\t\tabort: computed(() => uploadRef.value?.abort),\n\t\t\t/** @description 手动上传文件列表 */\n\t\t\tsubmit: computed(() => uploadRef.value?.submit),\n\t\t\t/** @description 清空已上传的文件列表(该方法不支持在 before-upload 中调用) */\n\t\t\tclearFiles: computed(() => uploadRef.value?.clearFiles),\n\t\t\t/** @description 手动选择文件 */\n\t\t\thandleStart: computed(() => uploadRef.value?.handleStart),\n\t\t\t/** @description 手动移除文件。file 和 rawFile 已被合并。 */\n\t\t\thandleRemove: computed(() => uploadRef.value?.handleRemove),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading,\n\t\t\t/** @description 文件集合 */\n\t\t\tfileList,\n\t\t\t/** @description 预览 */\n\t\t\tpreview: computed(() => state.preview),\n\t\t\t/** @description 预览集合 */\n\t\t\tpreviewList: computed(() => state.previewList),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;AASA,MAAa,sBAAsB;CAElC,GAAG;;CAEH,QAAQ;EACP,MAAM;EACN,eAAe,WAAW;CAC3B;;CAEA,UAAU;EACT,MAAM,eAAqD,MAAM;EACjE,SAAS;CACV;;CAEA,UAAU;EACT,MAAM;EACN,SAAS;EACT,YAAY,UAAmB;GAC9B,IAAI,CAAC,OAAO;IACX,QAAQ,KAAK,yBAAyB,iCAAiC;IACvE,OAAO;GACR;GACA,OAAO;EACR;CACD;;CAEA,OAAO;EACN,MAAM;EACN,SAAS;CACV;;CAEA,YAAY,eAAgC,CAAC,KAAK,CAAC;;CAEnD,SAAS;EACR,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;CAEA,WAAW,EACV,MAAM,eAAwD,QAAQ,EACvE;;CAEA,WAAW;AACZ;;AAGA,MAAa,sBAAsB;;CAElC,sBAAsB,UAA2B,MAAM,QAAQ,KAAK,KAAK,UAAU;;CAEnF,oBAAoB,UAA4B,MAAM,QAAQ,KAAK;AACpE;AAQA,IAAA,uBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAA+B;CACtC,MAAM,OAAO,EAAE,OAAO,MAAM,UAAU;EACrC,MAAM,EACL,U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AAC,SAAA;GAAA,GAAA,CAAA,YAAA,QAAA,MAAA,EAAA,eAAA,CAAA,YAAA,QAAA,MAAA,IAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAM3E,CAAA,CAAA,CAAA;EAGH,CAAA,GAAA,CAAA,CAAA,iBAAA,SAAA,GA/CQ,QAAQ,KAAK,CAAA,CAAA,GAkDvB,MAAM,WAAO,YAAA,eAAA;GAAA,sBAAA;GAAA,oBAAA;GAAA,cAAA;GAAA,gBAKE,KAAK,IAAI,MAAM,cAAc,CAAC;GAAC,iBAC7B,MAAM,UAAU;GAAM,WAC7B,MAAM;EAAW,GAAA,IAAA,CAE3B,CAAA,CAEF;EAED,OAAO,UAAU,QAAQ;;GAExB,OAAO,eAAe,UAAU,OAAO,KAAK;;GAE5C,QAAQ,eAAe,UAAU,OAAO,MAAM;;GAE9C,YAAY,eAAe,UAAU,OAAO,UAAU;;GAEtD,aAAa,eAAe,UAAU,OAAO,WAAW;;GAExD,cAAc,eAAe,UAAU,OAAO,YAAY;;GAE1D;;GAEA;;GAEA,SAAS,eAAe,MAAM,OAAO;;GAErC,aAAa,eAAe,MAAM,WAAW;EAC9C,CAAC;CACF;AACD,CAAC"}
@@ -1,3 +1,3 @@
1
1
  /** 将绑定值复制到剪贴板的 Vue 指令。 */
2
- export declare const vCopy: import("../../utils").Installable<import("vue").ObjectDirective<any, any, string, any>>;
2
+ export declare const vCopy: import("../../utils").Installable<import("vue").ObjectDirective<any, any, string, string>>;
3
3
  export default vCopy;
@@ -5,25 +5,21 @@ import { ElMessage } from "element-plus";
5
5
  const vCopy = withInstallDirective({
6
6
  mounted(el, binding) {
7
7
  el.copyData = binding.value;
8
- const copy$1 = async () => {
8
+ const copy$1 = () => {
9
9
  if (!el.copyData) return;
10
- try {
11
- await copy(String(el.copyData));
10
+ copy(String(el.copyData)).then(() => {
12
11
  ElMessage({
13
12
  type: "success",
14
13
  message: "复制成功"
15
14
  });
16
- } catch (error) {
15
+ }, () => {
17
16
  ElMessage({
18
17
  type: "error",
19
18
  message: "复制失败"
20
19
  });
21
- throw error;
22
- }
23
- };
24
- el.__handleClick__ = () => {
25
- copy$1();
20
+ });
26
21
  };
22
+ el.__handleClick__ = copy$1;
27
23
  el.addEventListener("click", el.__handleClick__);
28
24
  },
29
25
  updated(el, binding) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["copy","copyToClipboard"],"sources":["../../../src/directives/click-copy/index.ts"],"sourcesContent":["/**\n * v-copy\n * 复制某个值至剪贴板\n * 接收参数:string类型/Ref<string>类型/Reactive<string>类型\n */\nimport { ElMessage } from \"element-plus\";\nimport { copy as copyToClipboard, withInstallDirective } from \"../../utils\";\nimport type { Directive, DirectiveBinding } from \"vue\";\n\ninterface CopyElement extends HTMLElement {\n\tcopyData: string | number;\n\t__handleClick__: () => void;\n}\n\nconst CopyDirective: Directive = {\n\tmounted(el: CopyElement, binding: DirectiveBinding<string | number>) {\n\t\tel.copyData = binding.value;\n\n\t\tconst copy = async (): Promise<void> => {\n\t\t\tif (!el.copyData) return;\n\t\t\ttry {\n\t\t\t\tawait copyToClipboard(String(el.copyData));\n\t\t\t\tElMessage({\n\t\t\t\t\ttype: \"success\",\n\t\t\t\t\tmessage: \"复制成功\",\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tElMessage({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\tmessage: \"复制失败\",\n\t\t\t\t});\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t};\n\t\tel.__handleClick__ = (): void => {\n\t\t\tvoid copy();\n\t\t};\n\t\tel.addEventListener(\"click\", el.__handleClick__);\n\t},\n\tupdated(el: CopyElement, binding: DirectiveBinding<string | number>) {\n\t\tel.copyData = binding.value;\n\t},\n\tbeforeUnmount(el: CopyElement) {\n\t\tel.removeEventListener(\"click\", el.__handleClick__);\n\t},\n};\n\n/** 将绑定值复制到剪贴板的 Vue 指令。 */\nexport const vCopy = withInstallDirective(CopyDirective, \"copy\");\nexport default vCopy;\n"],"mappings":";;;;AAgDA,MAAa,QAAQ,qBAAqB;CAjCzC,QAAQ,IAAiB,SAA4C;EACpE,GAAG,WAAW,QAAQ;EAEtB,MAAMA,SAAO,YAA2B;GACvC,IAAI,CAAC,GAAG,UAAU;GAClB,IAAI;IACH,MAAMC,KAAgB,OAAO,GAAG,QAAQ,CAAC;IACzC,UAAU;KACT,MAAM;KACN,SAAS;IACV,CAAC;GACF,SAAS,OAAO;IACf,UAAU;KACT,MAAM;KACN,SAAS;IACV,CAAC;IACD,MAAM;GACP;EACD;EACA,GAAG,wBAA8B;GAChC,OAAU;EACX;EACA,GAAG,iBAAiB,SAAS,GAAG,eAAe;CAChD;CACA,QAAQ,IAAiB,SAA4C;EACpE,GAAG,WAAW,QAAQ;CACvB;CACA,cAAc,IAAiB;EAC9B,GAAG,oBAAoB,SAAS,GAAG,eAAe;CACnD;AAIyC,GAAe,MAAM"}
1
+ {"version":3,"file":"index.mjs","names":["copy"],"sources":["../../../src/directives/click-copy/index.ts"],"sourcesContent":["/**\n * v-copy\n * 复制某个值至剪贴板\n * 接收参数:string类型/Ref<string>类型/Reactive<string>类型\n */\nimport { ElMessage } from \"element-plus\";\nimport { copy as copyToClipboard, withInstallDirective } from \"../../utils\";\nimport type { Directive, DirectiveBinding } from \"vue\";\n\ninterface CopyElement extends HTMLElement {\n\tcopyData: string | number;\n\t__handleClick__: () => void;\n}\n\nconst CopyDirective: Directive = {\n\tmounted(el: CopyElement, binding: DirectiveBinding<string | number>) {\n\t\tel.copyData = binding.value;\n\n\t\tconst copy = (): void => {\n\t\t\tif (!el.copyData) return;\n\t\t\tcopyToClipboard(String(el.copyData)).then(\n\t\t\t\t() => {\n\t\t\t\t\tElMessage({\n\t\t\t\t\t\ttype: \"success\",\n\t\t\t\t\t\tmessage: \"复制成功\",\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tElMessage({\n\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\tmessage: \"复制失败\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t);\n\t\t};\n\t\tel.__handleClick__ = copy;\n\t\tel.addEventListener(\"click\", el.__handleClick__);\n\t},\n\tupdated(el: CopyElement, binding: DirectiveBinding<string | number>) {\n\t\tel.copyData = binding.value;\n\t},\n\tbeforeUnmount(el: CopyElement) {\n\t\tel.removeEventListener(\"click\", el.__handleClick__);\n\t},\n};\n\n/** 将绑定值复制到剪贴板的 Vue 指令。 */\nexport const vCopy = withInstallDirective(CopyDirective, \"copy\");\nexport default vCopy;\n"],"mappings":";;;;AA+CA,MAAa,QAAQ,qBAAqB;CAhCzC,QAAQ,IAAiB,SAA4C;EACpE,GAAG,WAAW,QAAQ;EAEtB,MAAMA,eAAmB;GACxB,IAAI,CAAC,GAAG,UAAU;GAClB,KAAgB,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,WAC9B;IACL,UAAU;KACT,MAAM;KACN,SAAS;IACV,CAAC;GACF,SACM;IACL,UAAU;KACT,MAAM;KACN,SAAS;IACV,CAAC;GACF,CACD;EACD;EACA,GAAG,kBAAkBA;EACrB,GAAG,iBAAiB,SAAS,GAAG,eAAe;CAChD;CACA,QAAQ,IAAiB,SAA4C;EACpE,GAAG,WAAW,QAAQ;CACvB;CACA,cAAc,IAAiB;EAC9B,GAAG,oBAAoB,SAAS,GAAG,eAAe;CACnD;AAIyC,GAAe,MAAM"}
@@ -3,5 +3,5 @@ interface DebounceElement extends HTMLElement {
3
3
  __debounce_originClick__?: (...arguments_: unknown[]) => unknown;
4
4
  }
5
5
  /** 对点击回调进行防抖处理的 Vue 指令。 */
6
- export declare const vDebounce: import("../../utils").Installable<import("vue").ObjectDirective<DebounceElement, any, string, any>>;
6
+ export declare const vDebounce: import("../../utils").Installable<import("vue").ObjectDirective<DebounceElement, any, string, string>>;
7
7
  export default vDebounce;
@@ -1,3 +1,3 @@
1
1
  /** 使元素可在父元素范围内拖拽的 Vue 指令。 */
2
- export declare const vDraggable: import("../../utils").Installable<import("vue").ObjectDirective<HTMLElement, any, string, any>>;
2
+ export declare const vDraggable: import("../../utils").Installable<import("vue").ObjectDirective<HTMLElement, any, string, string>>;
3
3
  export default vDraggable;
@@ -1,3 +1,3 @@
1
1
  /** 在目标元素前渲染复制图标的 Vue 指令。 */
2
- export declare const vIconCopy: import("../../utils").Installable<import("vue").ObjectDirective<any, any, string, any>>;
2
+ export declare const vIconCopy: import("../../utils").Installable<import("vue").ObjectDirective<any, any, string, string>>;
3
3
  export default vIconCopy;
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["copyToClipboard"],"sources":["../../../src/directives/click-icon-copy/index.ts"],"sourcesContent":["/**\n * v-iconCopy\n * 左侧插入复制图标,复制某个值至剪贴板\n * 接收参数:string类型/Ref<string>类型/Reactive<string>类型\n */\nimport { h, render } from \"vue\";\nimport { CopyDocument } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElMessage } from \"element-plus\";\nimport { copy as copyToClipboard, withInstallDirective } from \"../../utils\";\nimport type { Directive, DirectiveBinding } from \"vue\";\n\ninterface IconCopyElement extends HTMLElement {\n\tcopyData: string | number;\n\t__iconElement__: Node;\n}\n\nconst IconCopyDirective: Directive = {\n\tmounted(el: IconCopyElement, binding: DirectiveBinding<string | number>) {\n\t\tel.copyData = binding.value;\n\n\t\tif (!el.copyData) return;\n\n\t\tconst handleCopyClick = (): void => {\n\t\t\tvoid copyToClipboard(String(el.copyData)).then(\n\t\t\t\t() => {\n\t\t\t\t\tElMessage({\n\t\t\t\t\t\ttype: \"success\",\n\t\t\t\t\t\tmessage: \"复制成功\",\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tElMessage({\n\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\tmessage: \"复制失败\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t);\n\t\t};\n\n\t\t// 创建 ELIcon 组件\n\t\tconst iconEl = h(\n\t\t\tElIcon,\n\t\t\t{\n\t\t\t\tclass: \"fa__copy-icon\",\n\t\t\t\ttitle: \"复制\",\n\t\t\t\tonClick: handleCopyClick,\n\t\t\t},\n\t\t\t{\n\t\t\t\tdefault: () => h(CopyDocument),\n\t\t\t}\n\t\t);\n\n\t\tconst tempDiv = document.createElement(\"div\");\n\t\trender(iconEl, tempDiv);\n\n\t\tconst iconElement = tempDiv.firstChild;\n\t\tconst parentElement = el.parentElement;\n\t\tif (iconElement === null || parentElement === null) return;\n\t\tel.__iconElement__ = iconElement;\n\t\tparentElement.insertBefore(iconElement, el);\n\t},\n\tupdated(el: IconCopyElement, binding: DirectiveBinding<string | number>) {\n\t\tel.copyData = binding.value;\n\t},\n\tbeforeUnmount(el: IconCopyElement) {\n\t\tif (el.__iconElement__ && el.parentElement) {\n\t\t\tel.parentElement.removeChild(el.__iconElement__);\n\t\t}\n\t},\n};\n\n/** 在目标元素前渲染复制图标的 Vue 指令。 */\nexport const vIconCopy = withInstallDirective(IconCopyDirective, \"iconCopy\");\nexport default vIconCopy;\n"],"mappings":";;;;;;AAwEA,MAAa,YAAY,qBAAqB;CAvD7C,QAAQ,IAAqB,SAA4C;EACxE,GAAG,WAAW,QAAQ;EAEtB,IAAI,CAAC,GAAG,UAAU;EAElB,MAAM,wBAA8B;GACnC,KAAqB,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,WACnC;IACL,UAAU;KACT,MAAM;KACN,SAAS;IACV,CAAC;GACF,SACM;IACL,UAAU;KACT,MAAM;KACN,SAAS;IACV,CAAC;GACF,CACD;EACD;EAGA,MAAM,SAAS,EACd,QACA;GACC,OAAO;GACP,OAAO;GACP,SAAS;EACV,GACA,EACC,eAAe,EAAE,YAAY,EAC9B,CACD;EAEA,MAAM,UAAU,SAAS,cAAc,KAAK;EAC5C,OAAO,QAAQ,OAAO;EAEtB,MAAM,cAAc,QAAQ;EAC5B,MAAM,gBAAgB,GAAG;EACzB,IAAI,gBAAgB,QAAQ,kBAAkB,MAAM;EACpD,GAAG,kBAAkB;EACrB,cAAc,aAAa,aAAa,EAAE;CAC3C;CACA,QAAQ,IAAqB,SAA4C;EACxE,GAAG,WAAW,QAAQ;CACvB;CACA,cAAc,IAAqB;EAClC,IAAI,GAAG,mBAAmB,GAAG,eAC5B,GAAG,cAAc,YAAY,GAAG,eAAe;CAEjD;AAI6C,GAAmB,UAAU"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/directives/click-icon-copy/index.ts"],"sourcesContent":["/**\n * v-iconCopy\n * 左侧插入复制图标,复制某个值至剪贴板\n * 接收参数:string类型/Ref<string>类型/Reactive<string>类型\n */\nimport { h, render } from \"vue\";\nimport { CopyDocument } from \"@element-plus/icons-vue\";\nimport { ElIcon, ElMessage } from \"element-plus\";\nimport { copy as copyToClipboard, withInstallDirective } from \"../../utils\";\nimport type { Directive, DirectiveBinding } from \"vue\";\n\ninterface IconCopyElement extends HTMLElement {\n\tcopyData: string | number;\n\t__iconElement__?: Node;\n}\n\nconst IconCopyDirective: Directive = {\n\tmounted(el: IconCopyElement, binding: DirectiveBinding<string | number>) {\n\t\tel.copyData = binding.value;\n\n\t\tif (!el.copyData) return;\n\n\t\tconst handleCopyClick = (): void => {\n\t\t\tcopyToClipboard(String(el.copyData)).then(\n\t\t\t\t() => {\n\t\t\t\t\tElMessage({\n\t\t\t\t\t\ttype: \"success\",\n\t\t\t\t\t\tmessage: \"复制成功\",\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tElMessage({\n\t\t\t\t\t\ttype: \"error\",\n\t\t\t\t\t\tmessage: \"复制失败\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t);\n\t\t};\n\n\t\t// 创建 ELIcon 组件\n\t\tconst iconEl = h(\n\t\t\tElIcon,\n\t\t\t{\n\t\t\t\tclass: \"fa__copy-icon\",\n\t\t\t\ttitle: \"复制\",\n\t\t\t\tonClick: handleCopyClick,\n\t\t\t},\n\t\t\t{\n\t\t\t\tdefault: () => h(CopyDocument),\n\t\t\t}\n\t\t);\n\n\t\tconst tempDiv = document.createElement(\"div\");\n\t\trender(iconEl, tempDiv);\n\n\t\tconst iconElement = tempDiv.firstChild;\n\t\tconst parentElement = el.parentElement;\n\t\tif (iconElement === null || parentElement === null) return;\n\t\tel.__iconElement__ = iconElement;\n\t\tparentElement.insertBefore(iconElement, el);\n\t},\n\tupdated(el: IconCopyElement, binding: DirectiveBinding<string | number>) {\n\t\tel.copyData = binding.value;\n\t},\n\tbeforeUnmount(el: IconCopyElement) {\n\t\tif (el.__iconElement__ && el.parentElement) {\n\t\t\tel.parentElement.removeChild(el.__iconElement__);\n\t\t}\n\t},\n};\n\n/** 在目标元素前渲染复制图标的 Vue 指令。 */\nexport const vIconCopy = withInstallDirective(IconCopyDirective, \"iconCopy\");\nexport default vIconCopy;\n"],"mappings":";;;;;;AAwEA,MAAa,YAAY,qBAAqB;CAvD7C,QAAQ,IAAqB,SAA4C;EACxE,GAAG,WAAW,QAAQ;EAEtB,IAAI,CAAC,GAAG,UAAU;EAElB,MAAM,wBAA8B;GACnC,KAAgB,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,WAC9B;IACL,UAAU;KACT,MAAM;KACN,SAAS;IACV,CAAC;GACF,SACM;IACL,UAAU;KACT,MAAM;KACN,SAAS;IACV,CAAC;GACF,CACD;EACD;EAGA,MAAM,SAAS,EACd,QACA;GACC,OAAO;GACP,OAAO;GACP,SAAS;EACV,GACA,EACC,eAAe,EAAE,YAAY,EAC9B,CACD;EAEA,MAAM,UAAU,SAAS,cAAc,KAAK;EAC5C,OAAO,QAAQ,OAAO;EAEtB,MAAM,cAAc,QAAQ;EAC5B,MAAM,gBAAgB,GAAG;EACzB,IAAI,gBAAgB,QAAQ,kBAAkB,MAAM;EACpD,GAAG,kBAAkB;EACrB,cAAc,aAAa,aAAa,EAAE;CAC3C;CACA,QAAQ,IAAqB,SAA4C;EACxE,GAAG,WAAW,QAAQ;CACvB;CACA,cAAc,IAAqB;EAClC,IAAI,GAAG,mBAAmB,GAAG,eAC5B,GAAG,cAAc,YAAY,GAAG,eAAe;CAEjD;AAI6C,GAAmB,UAAU"}
@@ -1,3 +1,3 @@
1
1
  /** 长按时触发绑定回调的 Vue 指令。 */
2
- export declare const vLongpress: import("../../utils").Installable<import("vue").ObjectDirective<any, any, string, any>>;
2
+ export declare const vLongpress: import("../../utils").Installable<import("vue").ObjectDirective<any, any, string, string>>;
3
3
  export default vLongpress;
@@ -3,5 +3,5 @@ interface ThrottleElement extends HTMLElement {
3
3
  disabled: boolean;
4
4
  }
5
5
  /** 对点击回调进行节流处理的 Vue 指令。 */
6
- export declare const vThrottle: import("../../utils").Installable<import("vue").ObjectDirective<ThrottleElement, (...arguments_: unknown[]) => void, string, any>>;
6
+ export declare const vThrottle: import("../../utils").Installable<import("vue").ObjectDirective<ThrottleElement, (...arguments_: unknown[]) => void, string, string>>;
7
7
  export default vThrottle;
@@ -2,7 +2,6 @@ import { callOptionalFunction } from "./utils/vue/func.mjs";
2
2
  import { useOverlay } from "./hooks/use-overlay/index.mjs";
3
3
  import * as ElementPlusIconsVue from "@element-plus/icons-vue";
4
4
  import ElementPlus, { ElDialog, ElForm, ElInput, ElInputNumber, ElMessageBox, ElSelect, ElTable, ElTree, ElTreeSelect } from "element-plus";
5
- import { isNil, isString } from "lodash-unified";
6
5
  //#region src/element-plus.ts
7
6
  /** Element Plus 组件全局配置 */
8
7
  ElDialog.setPropsDefaults({
@@ -73,12 +72,12 @@ ElTreeSelect.setPropsDefaults({
73
72
  const elMessageBox = (type, message, options, appContext) => {
74
73
  const resolvedOptions = { ...options ?? {} };
75
74
  resolvedOptions.title ??= "温馨提示";
76
- if (isNil(resolvedOptions.draggable)) resolvedOptions.draggable = true;
75
+ resolvedOptions.draggable ??= true;
77
76
  resolvedOptions.cancelButtonText ??= "取消";
78
77
  resolvedOptions.confirmButtonText ??= "确定";
79
- if (isNil(resolvedOptions.closeOnClickModal)) resolvedOptions.closeOnClickModal = false;
80
- if (isNil(resolvedOptions.closeOnPressEscape)) resolvedOptions.closeOnPressEscape = false;
81
- if (!isNil(resolvedOptions.beforeClose)) {
78
+ resolvedOptions.closeOnClickModal ??= false;
79
+ resolvedOptions.closeOnPressEscape ??= false;
80
+ if (resolvedOptions.beforeClose != null) {
82
81
  const localBeforeClose = resolvedOptions.beforeClose;
83
82
  const localConfirmButtonText = resolvedOptions.confirmButtonText;
84
83
  const localShowCancelButton = resolvedOptions.showCancelButton;
@@ -135,7 +134,7 @@ const MESSAGE_BOX_DEFAULT_OPTS = {
135
134
  const isAppContext = (value) => typeof value === "object" && value !== null && "app" in value && "config" in value;
136
135
  const createMessageBoxShortcut = (type) => {
137
136
  function shortcut(message, titleOrOptions, optionsOrContext, appContext) {
138
- if (isString(titleOrOptions)) {
137
+ if (typeof titleOrOptions === "string") {
139
138
  const options = isAppContext(optionsOrContext) ? void 0 : optionsOrContext;
140
139
  return elMessageBox(type, message, {
141
140
  ...MESSAGE_BOX_DEFAULT_OPTS[type],
@@ -1 +1 @@
1
- {"version":3,"file":"element-plus.mjs","names":[],"sources":["../src/element-plus.ts"],"sourcesContent":["/** Element Plus 组件全局配置 */\n\nimport * as ElementPlusIconsVue from \"@element-plus/icons-vue\";\nimport ElementPlus, { ElDialog, ElForm, ElInput, ElInputNumber, ElMessageBox, ElSelect, ElTable, ElTree, ElTreeSelect } from \"element-plus\";\nimport { isNil, isString } from \"lodash-unified\";\nimport { useOverlay } from \"./hooks\";\nimport { callOptionalFunction } from \"./utils\";\nimport type { Action, ElMessageBoxOptions, ElMessageBoxShortcutMethod, MessageBoxData, MessageBoxState } from \"element-plus\";\nimport type { App, AppContext } from \"vue\";\n\n/* Element Plus 默认值设置。 */\nElDialog.setPropsDefaults({\n\t/** 默认拖拽。 */\n\tdraggable: true,\n});\n\nElForm.setPropsDefaults({\n\t/** 默认标签宽度。 */\n\tlabelWidth: \"auto\",\n\t/** 默认标签后缀。 */\n\tlabelSuffix: \":\",\n\t/** 校验失败时默认滚动到第一个错误表单项。 */\n\tscrollToError: true,\n});\n\nElInput.setPropsDefaults({\n\t/** 默认显示字数统计。 */\n\tshowWordLimit: true,\n});\n\nElInputNumber.setPropsDefaults({\n\t/** 默认不显示控制按钮。 */\n\tcontrols: false,\n});\n\nElSelect.setPropsDefaults({\n\t/** 默认加载提示。 */\n\tloadingText: \"加载中...\",\n\t/** 默认无匹配数据提示。 */\n\tnoMatchText: \"暂无匹配的数据\",\n\t/** 默认无数据提示。 */\n\tnoDataText: \"暂无数据\",\n\t/** 多选时默认折叠标签。 */\n\tcollapseTags: true,\n\t/** 默认在悬停折叠标签时显示完整内容。 */\n\tcollapseTagsTooltip: true,\n});\n\nElTable.setPropsDefaults({\n\t/** 默认显示边框。 */\n\tborder: true,\n\t/** 默认高亮当前行。 */\n\thighlightCurrentRow: true,\n\t/** 默认行 Key。 */\n\trowKey: \"id\",\n});\n\nElTree.setPropsDefaults({\n\t/** 默认展开所有节点。 */\n\tdefaultExpandAll: true,\n\t/** 默认点击时选中节点。 */\n\tcheckOnClickNode: true,\n\t/** 默认高亮当前节点。 */\n\thighlightCurrent: true,\n});\n\nElTreeSelect.setPropsDefaults({\n\t/** 默认加载提示。 */\n\tloadingText: \"加载中...\",\n\t/** 默认无匹配数据提示。 */\n\tnoMatchText: \"暂无匹配的数据\",\n\t/** 默认无数据提示。 */\n\tnoDataText: \"暂无数据\",\n\t/** 多选时默认折叠标签。 */\n\tcollapseTags: true,\n\t/** 默认在悬停折叠标签时显示完整内容。 */\n\tcollapseTagsTooltip: true,\n\t/** 默认展开所有节点。 */\n\tdefaultExpandAll: true,\n\t/** 默认点击时选中节点。 */\n\tcheckOnClickNode: true,\n\t/** 默认高亮当前节点。 */\n\thighlightCurrent: true,\n\t/** 默认仅通过箭头展开或收起节点。 */\n\texpandOnClickNode: false,\n});\n\n// ElMessageBox 默认配置\nconst elMessageBox = (\n\ttype: \"alert\" | \"confirm\" | \"prompt\",\n\tmessage: ElMessageBoxOptions[\"message\"],\n\toptions?: ElMessageBoxOptions,\n\tappContext?: AppContext | null\n): Promise<MessageBoxData> => {\n\t// 不直接修改调用方传入的配置,避免复用同一个 Options 对象时残留本次默认值和 beforeClose 包装。\n\tconst resolvedOptions: ElMessageBoxOptions = { ...(options ?? {}) };\n\t// 默认提示\n\tresolvedOptions.title ??= \"温馨提示\";\n\tif (isNil(resolvedOptions.draggable)) {\n\t\t// 默认拖拽\n\t\tresolvedOptions.draggable = true;\n\t}\n\t// 默认 取消按钮的文本内容\n\tresolvedOptions.cancelButtonText ??= \"取消\";\n\t// 默认 确定按钮的文本内容\n\tresolvedOptions.confirmButtonText ??= \"确定\";\n\tif (isNil(resolvedOptions.closeOnClickModal)) {\n\t\t// 默认 是否可通过点击遮罩层关闭 MessageBox\n\t\tresolvedOptions.closeOnClickModal = false;\n\t}\n\tif (isNil(resolvedOptions.closeOnPressEscape)) {\n\t\t// 默认 是否可通过按下 ESC 键关闭 MessageBox\n\t\tresolvedOptions.closeOnPressEscape = false;\n\t}\n\n\t// 关闭之前的判断逻辑\n\tif (!isNil(resolvedOptions.beforeClose)) {\n\t\tconst localBeforeClose = resolvedOptions.beforeClose;\n\t\tconst localConfirmButtonText = resolvedOptions.confirmButtonText;\n\t\tconst localShowCancelButton = resolvedOptions.showCancelButton;\n\t\tresolvedOptions.beforeClose = (action: Action, instance: MessageBoxState, done: () => void): void => {\n\t\t\tif (action === \"confirm\") {\n\t\t\t\tuseOverlay.show(0);\n\t\t\t\tinstance.confirmButtonLoading = true;\n\t\t\t\tinstance.showCancelButton = false;\n\t\t\t\tinstance.confirmButtonText = \"加载中...\";\n\t\t\t\tlet completed = false;\n\n\t\t\t\tconst cancelLoading = (): void => {\n\t\t\t\t\tinstance.confirmButtonLoading = false;\n\t\t\t\t\tinstance.showCancelButton = localShowCancelButton ?? false;\n\t\t\t\t\tinstance.confirmButtonText = localConfirmButtonText;\n\t\t\t\t\tuseOverlay.hide();\n\t\t\t\t};\n\n\t\t\t\tconst newDone = (): void => {\n\t\t\t\t\tif (completed) return;\n\t\t\t\t\tcompleted = true;\n\t\t\t\t\tcancelLoading();\n\t\t\t\t\tdone();\n\t\t\t\t};\n\n\t\t\t\tcallOptionalFunction(localBeforeClose, action, instance, newDone)\n\t\t\t\t\t.then(() => newDone())\n\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\tif (!completed) cancelLoading();\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tdone();\n\t\t\t}\n\t\t};\n\t}\n\n\t// 根据类型有一些判断\n\tswitch (type) {\n\t\tcase \"alert\":\n\t\t\tbreak;\n\t\tcase \"confirm\":\n\t\t\tresolvedOptions.showCancelButton ??= true;\n\t\t\tbreak;\n\t\tcase \"prompt\":\n\t\t\tresolvedOptions.showCancelButton ??= true;\n\t\t\tbreak;\n\t}\n\n\treturn ElMessageBox({ message, ...resolvedOptions, boxType: type }, appContext);\n};\n\ntype MESSAGE_BOX_TYPE = \"alert\" | \"confirm\" | \"prompt\";\nconst MESSAGE_BOX_DEFAULT_OPTS: Record<MESSAGE_BOX_TYPE, Partial<ElMessageBoxOptions>> = {\n\talert: { closeOnPressEscape: false, closeOnClickModal: false },\n\tconfirm: { showCancelButton: true },\n\tprompt: { showCancelButton: true, showInput: true },\n};\n\nconst isAppContext = (value: ElMessageBoxOptions | AppContext | null | undefined): value is AppContext =>\n\ttypeof value === \"object\" && value !== null && \"app\" in value && \"config\" in value;\n\nconst createMessageBoxShortcut = (type: MESSAGE_BOX_TYPE): ElMessageBoxShortcutMethod => {\n\tfunction shortcut(\n\t\tmessage: ElMessageBoxOptions[\"message\"],\n\t\toptions?: ElMessageBoxOptions,\n\t\tappContext?: AppContext | null\n\t): Promise<MessageBoxData>;\n\tfunction shortcut(\n\t\tmessage: ElMessageBoxOptions[\"message\"],\n\t\ttitle: ElMessageBoxOptions[\"title\"],\n\t\toptions?: ElMessageBoxOptions,\n\t\tappContext?: AppContext | null\n\t): Promise<MessageBoxData>;\n\tfunction shortcut(\n\t\tmessage: ElMessageBoxOptions[\"message\"],\n\t\ttitleOrOptions?: string | ElMessageBoxOptions,\n\t\toptionsOrContext?: ElMessageBoxOptions | AppContext | null,\n\t\tappContext?: AppContext | null\n\t): Promise<MessageBoxData> {\n\t\tif (isString(titleOrOptions)) {\n\t\t\tconst options = isAppContext(optionsOrContext) ? undefined : optionsOrContext;\n\t\t\treturn elMessageBox(type, message, { ...MESSAGE_BOX_DEFAULT_OPTS[type], title: titleOrOptions, ...(options ?? {}) }, appContext);\n\t\t}\n\n\t\tconst context = optionsOrContext === null || isAppContext(optionsOrContext) ? optionsOrContext : undefined;\n\t\treturn elMessageBox(type, message, { ...MESSAGE_BOX_DEFAULT_OPTS[type], ...(titleOrOptions ?? {}) }, context);\n\t}\n\n\treturn shortcut;\n};\n\nElMessageBox.alert = createMessageBoxShortcut(\"alert\");\nElMessageBox.prompt = createMessageBoxShortcut(\"prompt\");\nElMessageBox.confirm = createMessageBoxShortcut(\"confirm\");\n\n/**\n * 注册 Element Plus 及其全部图标。\n *\n * @param app - Vue 应用实例。\n */\nexport const installElementPlus = (app: App): void => {\n\t/** 注册 Element Plus 全部图标,供 FaIcon 按名称解析。 */\n\tfor (const [key, component] of Object.entries(ElementPlusIconsVue)) app.component(`el-icon-${key}`, component);\n\n\t/** Element Plus 组件完整引入 */\n\tapp.use(ElementPlus);\n};\n"],"mappings":";;;;;;;AAWA,SAAS,iBAAiB;;AAEzB,WAAW,KACZ,CAAC;AAED,OAAO,iBAAiB;;CAEvB,YAAY;;CAEZ,aAAa;;CAEb,eAAe;AAChB,CAAC;AAED,QAAQ,iBAAiB;;AAExB,eAAe,KAChB,CAAC;AAED,cAAc,iBAAiB;;AAE9B,UAAU,MACX,CAAC;AAED,SAAS,iBAAiB;;CAEzB,aAAa;;CAEb,aAAa;;CAEb,YAAY;;CAEZ,cAAc;;CAEd,qBAAqB;AACtB,CAAC;AAED,QAAQ,iBAAiB;;CAExB,QAAQ;;CAER,qBAAqB;;C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.ts"],"sourcesContent":["/** Element Plus 组件全局配置 */\n\nimport * as ElementPlusIconsVue from \"@element-plus/icons-vue\";\nimport ElementPlus, { ElDialog, ElForm, ElInput, ElInputNumber, ElMessageBox, ElSelect, ElTable, ElTree, ElTreeSelect } from \"element-plus\";\nimport { useOverlay } from \"./hooks\";\nimport { callOptionalFunction } from \"./utils\";\nimport type { Action, ElMessageBoxOptions, ElMessageBoxShortcutMethod, MessageBoxData, MessageBoxState } from \"element-plus\";\nimport type { App, AppContext } from \"vue\";\n\n/* Element Plus 默认值设置。 */\nElDialog.setPropsDefaults({\n\t/** 默认拖拽。 */\n\tdraggable: true,\n});\n\nElForm.setPropsDefaults({\n\t/** 默认标签宽度。 */\n\tlabelWidth: \"auto\",\n\t/** 默认标签后缀。 */\n\tlabelSuffix: \":\",\n\t/** 校验失败时默认滚动到第一个错误表单项。 */\n\tscrollToError: true,\n});\n\nElInput.setPropsDefaults({\n\t/** 默认显示字数统计。 */\n\tshowWordLimit: true,\n});\n\nElInputNumber.setPropsDefaults({\n\t/** 默认不显示控制按钮。 */\n\tcontrols: false,\n});\n\nElSelect.setPropsDefaults({\n\t/** 默认加载提示。 */\n\tloadingText: \"加载中...\",\n\t/** 默认无匹配数据提示。 */\n\tnoMatchText: \"暂无匹配的数据\",\n\t/** 默认无数据提示。 */\n\tnoDataText: \"暂无数据\",\n\t/** 多选时默认折叠标签。 */\n\tcollapseTags: true,\n\t/** 默认在悬停折叠标签时显示完整内容。 */\n\tcollapseTagsTooltip: true,\n});\n\nElTable.setPropsDefaults({\n\t/** 默认显示边框。 */\n\tborder: true,\n\t/** 默认高亮当前行。 */\n\thighlightCurrentRow: true,\n\t/** 默认行 Key。 */\n\trowKey: \"id\",\n});\n\nElTree.setPropsDefaults({\n\t/** 默认展开所有节点。 */\n\tdefaultExpandAll: true,\n\t/** 默认点击时选中节点。 */\n\tcheckOnClickNode: true,\n\t/** 默认高亮当前节点。 */\n\thighlightCurrent: true,\n});\n\nElTreeSelect.setPropsDefaults({\n\t/** 默认加载提示。 */\n\tloadingText: \"加载中...\",\n\t/** 默认无匹配数据提示。 */\n\tnoMatchText: \"暂无匹配的数据\",\n\t/** 默认无数据提示。 */\n\tnoDataText: \"暂无数据\",\n\t/** 多选时默认折叠标签。 */\n\tcollapseTags: true,\n\t/** 默认在悬停折叠标签时显示完整内容。 */\n\tcollapseTagsTooltip: true,\n\t/** 默认展开所有节点。 */\n\tdefaultExpandAll: true,\n\t/** 默认点击时选中节点。 */\n\tcheckOnClickNode: true,\n\t/** 默认高亮当前节点。 */\n\thighlightCurrent: true,\n\t/** 默认仅通过箭头展开或收起节点。 */\n\texpandOnClickNode: false,\n});\n\n// ElMessageBox 默认配置\nconst elMessageBox = (\n\ttype: \"alert\" | \"confirm\" | \"prompt\",\n\tmessage: ElMessageBoxOptions[\"message\"],\n\toptions?: ElMessageBoxOptions,\n\tappContext?: AppContext | null\n): Promise<MessageBoxData> => {\n\t// 不直接修改调用方传入的配置,避免复用同一个 Options 对象时残留本次默认值和 beforeClose 包装。\n\tconst resolvedOptions: ElMessageBoxOptions = { ...(options ?? {}) };\n\t// 默认提示\n\tresolvedOptions.title ??= \"温馨提示\";\n\t// 默认拖拽\n\tresolvedOptions.draggable ??= true;\n\t// 默认 取消按钮的文本内容\n\tresolvedOptions.cancelButtonText ??= \"取消\";\n\t// 默认 确定按钮的文本内容\n\tresolvedOptions.confirmButtonText ??= \"确定\";\n\t// 默认 是否可通过点击遮罩层关闭 MessageBox\n\tresolvedOptions.closeOnClickModal ??= false;\n\t// 默认 是否可通过按下 ESC 键关闭 MessageBox\n\tresolvedOptions.closeOnPressEscape ??= false;\n\n\t// 关闭之前的判断逻辑\n\tif (resolvedOptions.beforeClose != null) {\n\t\tconst localBeforeClose = resolvedOptions.beforeClose;\n\t\tconst localConfirmButtonText = resolvedOptions.confirmButtonText;\n\t\tconst localShowCancelButton = resolvedOptions.showCancelButton;\n\t\tresolvedOptions.beforeClose = (action: Action, instance: MessageBoxState, done: () => void): void => {\n\t\t\tif (action === \"confirm\") {\n\t\t\t\tuseOverlay.show(0);\n\t\t\t\tinstance.confirmButtonLoading = true;\n\t\t\t\tinstance.showCancelButton = false;\n\t\t\t\tinstance.confirmButtonText = \"加载中...\";\n\t\t\t\tlet completed = false;\n\n\t\t\t\tconst cancelLoading = (): void => {\n\t\t\t\t\tinstance.confirmButtonLoading = false;\n\t\t\t\t\tinstance.showCancelButton = localShowCancelButton ?? false;\n\t\t\t\t\tinstance.confirmButtonText = localConfirmButtonText;\n\t\t\t\t\tuseOverlay.hide();\n\t\t\t\t};\n\n\t\t\t\tconst newDone = (): void => {\n\t\t\t\t\tif (completed) return;\n\t\t\t\t\tcompleted = true;\n\t\t\t\t\tcancelLoading();\n\t\t\t\t\tdone();\n\t\t\t\t};\n\n\t\t\t\tcallOptionalFunction(localBeforeClose, action, instance, newDone)\n\t\t\t\t\t.then(() => newDone())\n\t\t\t\t\t.catch((error: unknown) => {\n\t\t\t\t\t\tif (!completed) cancelLoading();\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tdone();\n\t\t\t}\n\t\t};\n\t}\n\n\t// 根据类型有一些判断\n\tswitch (type) {\n\t\tcase \"alert\":\n\t\t\tbreak;\n\t\tcase \"confirm\":\n\t\t\tresolvedOptions.showCancelButton ??= true;\n\t\t\tbreak;\n\t\tcase \"prompt\":\n\t\t\tresolvedOptions.showCancelButton ??= true;\n\t\t\tbreak;\n\t}\n\n\treturn ElMessageBox({ message, ...resolvedOptions, boxType: type }, appContext);\n};\n\ntype MESSAGE_BOX_TYPE = \"alert\" | \"confirm\" | \"prompt\";\nconst MESSAGE_BOX_DEFAULT_OPTS: Record<MESSAGE_BOX_TYPE, Partial<ElMessageBoxOptions>> = {\n\talert: { closeOnPressEscape: false, closeOnClickModal: false },\n\tconfirm: { showCancelButton: true },\n\tprompt: { showCancelButton: true, showInput: true },\n};\n\nconst isAppContext = (value: ElMessageBoxOptions | AppContext | null | undefined): value is AppContext =>\n\ttypeof value === \"object\" && value !== null && \"app\" in value && \"config\" in value;\n\nconst createMessageBoxShortcut = (type: MESSAGE_BOX_TYPE): ElMessageBoxShortcutMethod => {\n\tfunction shortcut(\n\t\tmessage: ElMessageBoxOptions[\"message\"],\n\t\toptions?: ElMessageBoxOptions,\n\t\tappContext?: AppContext | null\n\t): Promise<MessageBoxData>;\n\tfunction shortcut(\n\t\tmessage: ElMessageBoxOptions[\"message\"],\n\t\ttitle: ElMessageBoxOptions[\"title\"],\n\t\toptions?: ElMessageBoxOptions,\n\t\tappContext?: AppContext | null\n\t): Promise<MessageBoxData>;\n\tfunction shortcut(\n\t\tmessage: ElMessageBoxOptions[\"message\"],\n\t\ttitleOrOptions?: string | ElMessageBoxOptions,\n\t\toptionsOrContext?: ElMessageBoxOptions | AppContext | null,\n\t\tappContext?: AppContext | null\n\t): Promise<MessageBoxData> {\n\t\tif (typeof titleOrOptions === \"string\") {\n\t\t\tconst options = isAppContext(optionsOrContext) ? undefined : optionsOrContext;\n\t\t\treturn elMessageBox(type, message, { ...MESSAGE_BOX_DEFAULT_OPTS[type], title: titleOrOptions, ...(options ?? {}) }, appContext);\n\t\t}\n\n\t\tconst context = optionsOrContext === null || isAppContext(optionsOrContext) ? optionsOrContext : undefined;\n\t\treturn elMessageBox(type, message, { ...MESSAGE_BOX_DEFAULT_OPTS[type], ...(titleOrOptions ?? {}) }, context);\n\t}\n\n\treturn shortcut;\n};\n\nElMessageBox.alert = createMessageBoxShortcut(\"alert\");\nElMessageBox.prompt = createMessageBoxShortcut(\"prompt\");\nElMessageBox.confirm = createMessageBoxShortcut(\"confirm\");\n\n/**\n * 注册 Element Plus 及其全部图标。\n *\n * @param app - Vue 应用实例。\n */\nexport const installElementPlus = (app: App): void => {\n\t/** 注册 Element Plus 全部图标,供 FaIcon 按名称解析。 */\n\tfor (const [key, component] of Object.entries(ElementPlusIconsVue)) app.component(`el-icon-${key}`, component);\n\n\t/** Element Plus 组件完整引入 */\n\t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BAAyB,OAAO;AACrD,aAAa,SAAS,yBAAyB,QAAQ;AACvD,aAAa,UAAU,yBAAyB,SAAS;;;;;;AAOzD,MAAa,sBAAsB,QAAmB;;CAErD,KAAK,MAAM,CAAC,KAAK,cAAc,OAAO,QAAQ,mBAAmB,GAAG,IAAI,UAAU,WAAW,OAAO,SAAS;;CAG7G,IAAI,IAAI,WAAW;AACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/hooks/use-screenFull/index.ts"],"sourcesContent":["import { ref } from \"vue\";\nimport { ElMessage } from \"element-plus\";\nimport screenfull from \"screenfull\";\n\nconst isFullscreen = ref(false);\nlet initialized = false;\n\nconst handleFullscreenChange = (): void => {\n\tisFullscreen.value = screenfull.isEnabled && screenfull.isFullscreen;\n};\n\n/** 浏览器全屏状态控制器。 */\nexport const useScreenFull = {\n\t/** 获取当前全屏状态。 */\n\tisFullscreen: (): boolean => isFullscreen.value,\n\t/** 初始化全屏状态监听。 */\n\tinit: (): void => {\n\t\tif (!screenfull.isEnabled || initialized) return;\n\t\tinitialized = true;\n\t\thandleFullscreenChange();\n\t\tscreenfull.on(\"change\", handleFullscreenChange);\n\t},\n\t/** 释放全屏状态监听。 */\n\tdispose: (): void => {\n\t\tif (!screenfull.isEnabled || !initialized) return;\n\t\tscreenfull.off(\"change\", handleFullscreenChange);\n\t\tinitialized = false;\n\t},\n\t/** 切换全屏状态。 */\n\ttoggle: (): void => {\n\t\tif (!screenfull.isEnabled) {\n\t\t\tElMessage.warning(\"当前您的浏览器不支持全屏 ❌\");\n\t\t\treturn;\n\t\t}\n\t\tvoid screenfull.toggle();\n\t},\n\t/** 进入全屏状态。 */\n\tfull: (): void => {\n\t\tif (!screenfull.isEnabled) {\n\t\t\tElMessage.warning(\"当前您的浏览器不支持全屏 ❌\");\n\t\t\treturn;\n\t\t}\n\t\tif (screenfull.isFullscreen) {\n\t\t\treturn;\n\t\t}\n\t\t// const htmlEl = document.querySelector(\"html\");\n\t\t// screenfull.request(htmlEl);\n\t\tvoid screenfull.request();\n\t},\n\t/** 退出全屏状态。 */\n\texit: (): void => {\n\t\tif (!screenfull.isEnabled) {\n\t\t\tElMessage.warning(\"当前您的浏览器不支持全屏 ❌\");\n\t\t\treturn;\n\t\t}\n\t\tif (screenfull.isFullscreen) {\n\t\t\tvoid screenfull.exit();\n\t\t}\n\t},\n};\n"],"mappings":";;;;AAIA,MAAM,eAAe,IAAI,KAAK;AAC9B,IAAI,cAAc;AAElB,MAAM,+BAAqC;CAC1C,aAAa,QAAQ,WAAW,aAAa,WAAW;AACzD;;AAGA,MAAa,gBAAgB;;CAE5B,oBAA6B,aAAa;;CAE1C,YAAkB;EACjB,IAAI,CAAC,WAAW,aAAa,aAAa;EAC1C,cAAc;EACd,uBAAuB;EACvB,WAAW,GAAG,UAAU,sBAAsB;CAC/C;;CAEA,eAAqB;EACpB,IAAI,CAAC,WAAW,aAAa,CAAC,aAAa;EAC3C,WAAW,IAAI,UAAU,sBAAsB;EAC/C,cAAc;CACf;;CAEA,cAAoB;EACnB,IAAI,CAAC,WAAW,WAAW;GAC1B,UAAU,QAAQ,gBAAgB;GAClC;EACD;EACA,WAAgB,OAAO;CACxB;;CAEA,YAAkB;EACjB,IAAI,CAAC,WAAW,WAAW;GAC1B,UAAU,QAAQ,gBAAgB;GAClC;EACD;EACA,IAAI,WAAW,cACd;EAID,WAAgB,QAAQ;CACzB;;CAEA,YAAkB;EACjB,IAAI,CAAC,WAAW,WAAW;GAC1B,UAAU,QAAQ,gBAAgB;GAClC;EACD;EACA,IAAI,WAAW,cACd,WAAgB,KAAK;CAEvB;AACD"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/hooks/use-screenFull/index.ts"],"sourcesContent":["import { ref } from \"vue\";\nimport { ElMessage } from \"element-plus\";\nimport screenfull from \"screenfull\";\n\nconst isFullscreen = ref(false);\nlet initialized = false;\n\nconst handleFullscreenChange = (): void => {\n\tisFullscreen.value = screenfull.isEnabled && screenfull.isFullscreen;\n};\n\n/** 浏览器全屏状态控制器。 */\nexport const useScreenFull = {\n\t/** 获取当前全屏状态。 */\n\tisFullscreen: (): boolean => isFullscreen.value,\n\t/** 初始化全屏状态监听。 */\n\tinit: (): void => {\n\t\tif (!screenfull.isEnabled || initialized) return;\n\t\tinitialized = true;\n\t\thandleFullscreenChange();\n\t\tscreenfull.on(\"change\", handleFullscreenChange);\n\t},\n\t/** 释放全屏状态监听。 */\n\tdispose: (): void => {\n\t\tif (!screenfull.isEnabled || !initialized) return;\n\t\tscreenfull.off(\"change\", handleFullscreenChange);\n\t\tinitialized = false;\n\t},\n\t/** 切换全屏状态。 */\n\ttoggle: (): void => {\n\t\tif (!screenfull.isEnabled) {\n\t\t\tElMessage.warning(\"当前您的浏览器不支持全屏 ❌\");\n\t\t\treturn;\n\t\t}\n\t\tscreenfull.toggle();\n\t},\n\t/** 进入全屏状态。 */\n\tfull: (): void => {\n\t\tif (!screenfull.isEnabled) {\n\t\t\tElMessage.warning(\"当前您的浏览器不支持全屏 ❌\");\n\t\t\treturn;\n\t\t}\n\t\tif (screenfull.isFullscreen) {\n\t\t\treturn;\n\t\t}\n\t\tscreenfull.request();\n\t},\n\t/** 退出全屏状态。 */\n\texit: (): void => {\n\t\tif (!screenfull.isEnabled) {\n\t\t\tElMessage.warning(\"当前您的浏览器不支持全屏 ❌\");\n\t\t\treturn;\n\t\t}\n\t\tif (screenfull.isFullscreen) {\n\t\t\tscreenfull.exit();\n\t\t}\n\t},\n};\n"],"mappings":";;;;AAIA,MAAM,eAAe,IAAI,KAAK;AAC9B,IAAI,cAAc;AAElB,MAAM,+BAAqC;CAC1C,aAAa,QAAQ,WAAW,aAAa,WAAW;AACzD;;AAGA,MAAa,gBAAgB;;CAE5B,oBAA6B,aAAa;;CAE1C,YAAkB;EACjB,IAAI,CAAC,WAAW,aAAa,aAAa;EAC1C,cAAc;EACd,uBAAuB;EACvB,WAAW,GAAG,UAAU,sBAAsB;CAC/C;;CAEA,eAAqB;EACpB,IAAI,CAAC,WAAW,aAAa,CAAC,aAAa;EAC3C,WAAW,IAAI,UAAU,sBAAsB;EAC/C,cAAc;CACf;;CAEA,cAAoB;EACnB,IAAI,CAAC,WAAW,WAAW;GAC1B,UAAU,QAAQ,gBAAgB;GAClC;EACD;EACA,WAAW,OAAO;CACnB;;CAEA,YAAkB;EACjB,IAAI,CAAC,WAAW,WAAW;GAC1B,UAAU,QAAQ,gBAAgB;GAClC;EACD;EACA,IAAI,WAAW,cACd;EAED,WAAW,QAAQ;CACpB;;CAEA,YAAkB;EACjB,IAAI,CAAC,WAAW,WAAW;GAC1B,UAAU,QAAQ,gBAAgB;GAClC;EACD;EACA,IAAI,WAAW,cACd,WAAW,KAAK;CAElB;AACD"}