@fangzhongya/fang-ui 0.0.98 → 0.0.99

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 (221) hide show
  1. package/dist/components/alert/src/index2.cjs +11 -11
  2. package/dist/components/array/src/index2.cjs +45 -45
  3. package/dist/components/audios/src/index2.cjs +54 -54
  4. package/dist/components/autocomplete/src/index2.cjs +11 -11
  5. package/dist/components/box/src/index2.cjs +21 -21
  6. package/dist/components/box-adjust/index.css +17 -0
  7. package/dist/components/box-adjust/index.scss +18 -0
  8. package/dist/components/box-adjust/src/data.cjs +17 -1
  9. package/dist/components/box-adjust/src/data.d.ts +16 -0
  10. package/dist/components/box-adjust/src/data.js +17 -1
  11. package/dist/components/box-adjust/src/index2.cjs +69 -35
  12. package/dist/components/box-adjust/src/index2.js +37 -3
  13. package/dist/components/box-local/src/index2.cjs +20 -20
  14. package/dist/components/box-mask/src/index2.cjs +5 -5
  15. package/dist/components/box-teleport/src/index2.cjs +5 -5
  16. package/dist/components/box-title/src/index2.cjs +15 -15
  17. package/dist/components/button/src/index2.cjs +11 -11
  18. package/dist/components/buttons/src/index2.cjs +20 -20
  19. package/dist/components/card/src/index2.cjs +11 -11
  20. package/dist/components/cascader/src/index2.cjs +11 -11
  21. package/dist/components/cascader-panel/src/index2.cjs +11 -11
  22. package/dist/components/cascaders/src/index2.cjs +17 -17
  23. package/dist/components/checkbox/src/index2.cjs +11 -11
  24. package/dist/components/checkbox-button/src/index2.cjs +11 -11
  25. package/dist/components/checkbox-group/src/index2.cjs +11 -11
  26. package/dist/components/checks/src/index2.cjs +31 -31
  27. package/dist/components/choice-select/src/index2.cjs +5 -5
  28. package/dist/components/collapse/src/index2.cjs +11 -11
  29. package/dist/components/collapse-item/src/index2.cjs +11 -11
  30. package/dist/components/color-picker/src/index2.cjs +11 -11
  31. package/dist/components/common/list.cjs +5 -5
  32. package/dist/components/common/use.cjs +5 -5
  33. package/dist/components/company-select/src/index2.cjs +19 -19
  34. package/dist/components/config-provider/src/index2.cjs +11 -11
  35. package/dist/components/date-picker/src/index2.cjs +11 -11
  36. package/dist/components/date-picker/style/element.scss +1 -1
  37. package/dist/components/date-picker-panel/src/index2.cjs +11 -11
  38. package/dist/components/dates/src/index2.cjs +12 -12
  39. package/dist/components/dates-divide/src/index2.cjs +20 -20
  40. package/dist/components/dates-picker/src/index2.cjs +15 -15
  41. package/dist/components/dates2/src/index2.cjs +26 -26
  42. package/dist/components/department-select/src/index2.cjs +10 -10
  43. package/dist/components/dialog/src/index2.cjs +11 -11
  44. package/dist/components/dialogs/src/index2.cjs +23 -23
  45. package/dist/components/divider/src/index2.cjs +11 -11
  46. package/dist/components/drawer/src/index2.cjs +11 -11
  47. package/dist/components/dropdown/src/index2.cjs +11 -11
  48. package/dist/components/dropdown-item/src/index2.cjs +11 -11
  49. package/dist/components/dropdown-menu/src/index2.cjs +11 -11
  50. package/dist/components/edit/src/index2.cjs +24 -24
  51. package/dist/components/edit-float/src/index2.cjs +40 -40
  52. package/dist/components/form/src/index2.cjs +11 -11
  53. package/dist/components/form-item/src/index2.cjs +11 -11
  54. package/dist/components/forms/index.css +22 -0
  55. package/dist/components/forms/src/index2.cjs +65 -65
  56. package/dist/components/forms/src/setup.cjs +12 -12
  57. package/dist/components/forms-div/src/index2.cjs +11 -11
  58. package/dist/components/forms-drag/src/index2.cjs +73 -73
  59. package/dist/components/forms-item/src/index2.cjs +45 -45
  60. package/dist/components/forms-item/src/label.cjs +4 -4
  61. package/dist/components/forms-items/src/index2.cjs +23 -23
  62. package/dist/components/full-screen/src/index2.cjs +11 -11
  63. package/dist/components/global-config/src/index.cjs +5 -5
  64. package/dist/components/history/src/index2.cjs +26 -26
  65. package/dist/components/icon/src/index2.cjs +23 -23
  66. package/dist/components/icon-picker/src/index2.cjs +52 -52
  67. package/dist/components/iframe/src/data.cjs +1 -1
  68. package/dist/components/iframe/src/data.js +1 -1
  69. package/dist/components/iframe/src/index2.cjs +15 -10
  70. package/dist/components/iframe/src/index2.js +5 -0
  71. package/dist/components/image/src/index2.cjs +11 -11
  72. package/dist/components/image-viewer/src/index2.cjs +11 -11
  73. package/dist/components/images/src/index2.cjs +17 -17
  74. package/dist/components/input/src/index2.cjs +11 -11
  75. package/dist/components/input-array/src/index2.cjs +38 -38
  76. package/dist/components/input-history/src/index2.cjs +47 -47
  77. package/dist/components/input-history/src/util.cjs +4 -4
  78. package/dist/components/input-num/src/index2.cjs +17 -17
  79. package/dist/components/input-number/src/index2.cjs +11 -11
  80. package/dist/components/input-select/src/index2.cjs +51 -51
  81. package/dist/components/input-tag/src/index2.cjs +11 -11
  82. package/dist/components/inputs/src/index2.cjs +17 -17
  83. package/dist/components/keep-com/src/index2.cjs +16 -16
  84. package/dist/components/labels/src/index2.cjs +13 -13
  85. package/dist/components/list/src/index2.cjs +24 -24
  86. package/dist/components/lists/src/index2.cjs +51 -51
  87. package/dist/components/listsp/src/index2.cjs +35 -35
  88. package/dist/components/mention/src/index2.cjs +11 -11
  89. package/dist/components/menu/src/index2.cjs +11 -11
  90. package/dist/components/menu-item/src/index2.cjs +11 -11
  91. package/dist/components/menu-item-group/src/index2.cjs +11 -11
  92. package/dist/components/menus/src/index2.cjs +16 -16
  93. package/dist/components/menus/src/menu-ll2.cjs +11 -11
  94. package/dist/components/no-data/src/index2.cjs +5 -5
  95. package/dist/components/option/src/index2.cjs +10 -10
  96. package/dist/components/option-group/src/index2.cjs +11 -11
  97. package/dist/components/page/index.css +22 -0
  98. package/dist/components/page/src/index2.cjs +77 -77
  99. package/dist/components/page/src/set-column2.cjs +54 -54
  100. package/dist/components/pagination/src/index2.cjs +11 -11
  101. package/dist/components/paging/src/index2.cjs +13 -13
  102. package/dist/components/popconfirm/src/index2.cjs +11 -11
  103. package/dist/components/popover/src/index2.cjs +11 -11
  104. package/dist/components/popup/src/index2.cjs +29 -29
  105. package/dist/components/radio/src/index2.cjs +11 -11
  106. package/dist/components/radio-button/src/index2.cjs +11 -11
  107. package/dist/components/radio-group/src/index2.cjs +11 -11
  108. package/dist/components/retract/src/index2.cjs +14 -14
  109. package/dist/components/right-key/src/index2.cjs +30 -30
  110. package/dist/components/role-select/src/index2.cjs +38 -38
  111. package/dist/components/scrollbar/src/index2.cjs +11 -11
  112. package/dist/components/seamless-scroll/src/index2.cjs +24 -24
  113. package/dist/components/select/src/index2.cjs +11 -11
  114. package/dist/components/select-dialog/src/index2.cjs +65 -65
  115. package/dist/components/select-popover/src/index2.cjs +41 -41
  116. package/dist/components/select-scroll/src/index2.cjs +30 -30
  117. package/dist/components/selector/src/index2.cjs +39 -39
  118. package/dist/components/selects/src/index2.cjs +20 -20
  119. package/dist/components/slider/src/index2.cjs +11 -11
  120. package/dist/components/sliders/src/index2.cjs +13 -13
  121. package/dist/components/stick-div/src/index2.cjs +17 -17
  122. package/dist/components/stick-edge/src/index2.cjs +10 -10
  123. package/dist/components/stick-window/src/index2.cjs +22 -22
  124. package/dist/components/sub-menu/src/index2.cjs +10 -10
  125. package/dist/components/switch/src/index2.cjs +11 -11
  126. package/dist/components/switchs/src/index2.cjs +15 -15
  127. package/dist/components/tab-pane/src/index2.cjs +11 -11
  128. package/dist/components/table/src/index2.cjs +11 -11
  129. package/dist/components/table-column/src/index2.cjs +11 -11
  130. package/dist/components/tables/common/img2.cjs +7 -7
  131. package/dist/components/tables/common/pagin.cjs +16 -16
  132. package/dist/components/tables/common/table-but2.cjs +10 -10
  133. package/dist/components/tables/common/table-color2.cjs +7 -7
  134. package/dist/components/tables/common/table-list2.cjs +9 -9
  135. package/dist/components/tables/common/util.cjs +2 -2
  136. package/dist/components/tables/src/column.cjs +5 -5
  137. package/dist/components/tables/src/columns2.cjs +2 -2
  138. package/dist/components/tables/src/columns3.cjs +2 -2
  139. package/dist/components/tables/src/index2.cjs +29 -29
  140. package/dist/components/tablesp/src/index2.cjs +36 -36
  141. package/dist/components/tabless/src/index2.cjs +49 -49
  142. package/dist/components/tablesv/src/column.cjs +16 -16
  143. package/dist/components/tablesv/src/columns2.cjs +2 -2
  144. package/dist/components/tablesv/src/columns3.cjs +2 -2
  145. package/dist/components/tablesv/src/index2.cjs +30 -30
  146. package/dist/components/tablesvp/src/index2.cjs +30 -30
  147. package/dist/components/tabs/src/index2.cjs +11 -11
  148. package/dist/components/tag/src/index2.cjs +11 -11
  149. package/dist/components/text/src/index2.cjs +11 -11
  150. package/dist/components/text/style/element.scss +1 -1
  151. package/dist/components/texts/src/index2.cjs +8 -8
  152. package/dist/components/time-picker/src/index2.cjs +11 -11
  153. package/dist/components/time-select/src/index2.cjs +11 -11
  154. package/dist/components/tooltip/src/index2.cjs +11 -11
  155. package/dist/components/transfer/src/index2.cjs +11 -11
  156. package/dist/components/tree/src/index2.cjs +11 -11
  157. package/dist/components/tree-select/src/index2.cjs +11 -11
  158. package/dist/components/tree-select-box/src/index2.cjs +29 -29
  159. package/dist/components/upload/src/index2.cjs +11 -11
  160. package/dist/components/uploads/index.css +22 -0
  161. package/dist/components/uploads/index.scss +23 -0
  162. package/dist/components/uploads/src/index2.cjs +128 -138
  163. package/dist/components/uploads/src/index2.js +61 -71
  164. package/dist/components/uploads/src/util.cjs +80 -0
  165. package/dist/components/uploads/src/util.d.ts +10 -0
  166. package/dist/components/uploads/src/util.js +80 -0
  167. package/dist/components/uploads/src/views.cjs +4 -0
  168. package/dist/components/uploads/src/views.js +4 -0
  169. package/dist/components/uploads/src/views2.cjs +77 -0
  170. package/dist/components/uploads/src/views2.js +77 -0
  171. package/dist/components/user-select/src/index2.cjs +99 -99
  172. package/dist/components/videos/src/index2.cjs +97 -97
  173. package/dist/components/window/src/index2.cjs +61 -61
  174. package/dist/css/box-adjust.css +17 -0
  175. package/dist/css/forms.css +22 -0
  176. package/dist/css/index.css +39 -0
  177. package/dist/css/page.css +22 -0
  178. package/dist/css/uploads.css +22 -0
  179. package/dist/directives/scroll/index.cjs +6 -24
  180. package/dist/directives/scroll/index.js +1 -3
  181. package/dist/hooks/event-aliass/index.cjs +2 -2
  182. package/dist/hooks/full-screen/index.cjs +5 -5
  183. package/dist/hooks/global-config/index.cjs +8 -8
  184. package/dist/hooks/inherit/index.cjs +2 -2
  185. package/dist/hooks/locale/index.cjs +7 -7
  186. package/dist/icons/iconify.cjs +3 -3
  187. package/dist/icons/index.css +79 -79
  188. package/dist/icons/index.json +35 -35
  189. package/dist/icons/vue/bar.cjs +3 -3
  190. package/dist/icons/vue/below.cjs +3 -3
  191. package/dist/icons/vue/bicycle.cjs +3 -3
  192. package/dist/icons/vue/bottom-left.cjs +4 -4
  193. package/dist/icons/vue/bottom-right.cjs +4 -4
  194. package/dist/icons/vue/bottom.cjs +3 -3
  195. package/dist/icons/vue/catalogue.cjs +5 -5
  196. package/dist/icons/vue/clear.cjs +5 -5
  197. package/dist/icons/vue/close.cjs +3 -3
  198. package/dist/icons/vue/delete.cjs +3 -3
  199. package/dist/icons/vue/document.cjs +5 -5
  200. package/dist/icons/vue/down.cjs +3 -3
  201. package/dist/icons/vue/download.cjs +3 -3
  202. package/dist/icons/vue/edit.cjs +5 -5
  203. package/dist/icons/vue/enter.cjs +3 -3
  204. package/dist/icons/vue/frame.cjs +3 -3
  205. package/dist/icons/vue/left.cjs +3 -3
  206. package/dist/icons/vue/mute.cjs +3 -3
  207. package/dist/icons/vue/pause.cjs +4 -4
  208. package/dist/icons/vue/play.cjs +3 -3
  209. package/dist/icons/vue/plus.cjs +3 -3
  210. package/dist/icons/vue/retreat.cjs +3 -3
  211. package/dist/icons/vue/right.cjs +3 -3
  212. package/dist/icons/vue/sound.cjs +4 -4
  213. package/dist/icons/vue/star.cjs +4 -4
  214. package/dist/icons/vue/up.cjs +3 -3
  215. package/dist/icons/vue/views.cjs +5 -5
  216. package/dist/icons/vue/views.js +2 -2
  217. package/dist/index.css +39 -0
  218. package/dist/utils/vues/common.cjs +2 -2
  219. package/package.json +3 -3
  220. /package/dist/components/{alert → divider}/index.css +0 -0
  221. /package/dist/css/{alert.css → divider.css} +0 -0
@@ -2,13 +2,12 @@ import { defineComponent, ref, useAttrs, computed, reactive, createElementBlock,
2
2
  import Document from "../../../icons/vue/document.js";
3
3
  import Download from "../../../icons/vue/download.js";
4
4
  import Plus from "../../../icons/vue/plus.js";
5
- import Views from "../../../icons/vue/views.js";
5
+ import IconViews from "../../../icons/vue/views.js";
6
6
  import Delete from "../../../icons/vue/delete.js";
7
7
  import { Icon } from "../../icon/index.js";
8
8
  import { Upload } from "../../upload/index.js";
9
9
  import { Message } from "../../message/index.js";
10
10
  import { Image } from "../../image/index.js";
11
- import { ImageViewer } from "../../image-viewer/index.js";
12
11
  import { useInherit } from "../../../hooks/inherit/index.js";
13
12
  import { useCssName } from "../../../hooks/cssname/index.js";
14
13
  import { useExpose } from "../../../hooks/expose/index.js";
@@ -17,6 +16,10 @@ import { useLocale } from "../../../hooks/locale/index.js";
17
16
  import { getUrlCatalogueObj } from "@fangzhongya/utils/urls/getUrlCatalogueObj";
18
17
  import { downloadFromURL } from "@fangzhongya/utils/window/download";
19
18
  import { getListValue } from "../../players/common/util.js";
19
+ import { getType, getListType } from "./util.js";
20
+ import { useDisabled } from "element-plus/es/components/form/index";
21
+ import "./views.js";
22
+ import _sfc_main$1 from "./views2.js";
20
23
  const _hoisted_1 = ["title"];
21
24
  const _hoisted_2 = ["onClick", "title"];
22
25
  const _hoisted_3 = ["onClick", "title"];
@@ -38,6 +41,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
38
41
  const value = listFuObj.value;
39
42
  const multiple = listFuObj.multiple;
40
43
  const isloading = ref(false);
44
+ const disabled = useDisabled();
41
45
  const accept = computed(() => {
42
46
  if (props.accept) {
43
47
  return props.accept;
@@ -57,54 +61,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
57
61
  return "";
58
62
  }
59
63
  });
60
- const getExtension = (fileName) => {
61
- const extension = fileName.toLowerCase();
62
- if (extension) {
63
- const ks = Object.keys(types);
64
- for (let index = 0; index < ks.length; index++) {
65
- const key = ks[index];
66
- if (types[key].includes(extension)) {
67
- return key;
68
- }
69
- }
70
- }
71
- return "";
72
- };
73
- const getType = (accept2 = "") => {
74
- if (accept2) {
75
- if (accept2.includes("image/")) {
76
- return "i";
77
- } else if (accept2.includes("audio/")) {
78
- return "a";
79
- } else if (accept2.includes("video/")) {
80
- return "v";
81
- } else {
82
- const extension = accept2.toLowerCase().split(",")[0];
83
- return getExtension(extension);
84
- }
85
- }
86
- return "";
87
- };
88
64
  const type = computed(() => {
89
65
  return props.type ?? getType(accept.value);
90
66
  });
91
- const getListType = (obj) => {
92
- if (props.type) {
93
- return props.type;
94
- }
95
- if (obj) {
96
- if (obj.type) {
97
- return obj.type;
98
- } else {
99
- let v = getUrlCatalogueObj(obj.url);
100
- if (v.suffix) {
101
- return getExtension("." + v.suffix);
102
- }
103
- return getType(accept.value);
104
- }
105
- }
106
- return "";
107
- };
108
67
  const getFileList = (arr) => {
109
68
  if (props.formatter) {
110
69
  return arr.map((v) => {
@@ -125,11 +84,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
125
84
  }
126
85
  });
127
86
  const isUp = computed(() => {
128
- if (props.disabled) {
129
- return false;
87
+ if (disabled.value) {
88
+ if (value.value && value.value.length > 0) {
89
+ return false;
90
+ } else {
91
+ return true;
92
+ }
130
93
  }
131
94
  if (multiple.value) {
132
- if (!value.value) {
95
+ if (!value.value || value.value.length == 0) {
133
96
  return true;
134
97
  }
135
98
  if (props.limit) {
@@ -158,7 +121,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
158
121
  if (typeof props.isViews === "boolean") {
159
122
  return true;
160
123
  } else {
161
- const type2 = getListType(item);
124
+ const type2 = getListType(item, props.type, accept.value);
162
125
  if (props.isViews.includes(type2)) {
163
126
  return true;
164
127
  }
@@ -293,7 +256,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
293
256
  class: normalizeClass(unref(cs).z("list-li")),
294
257
  key: index
295
258
  }, [
296
- renderSlot(_ctx.$slots, unref(dataSlot).default, { value: item }, () => {
259
+ renderSlot(_ctx.$slots, unref(dataSlot).default, {
260
+ value: item,
261
+ type: props.type,
262
+ accept: accept.value,
263
+ disabled: unref(disabled)
264
+ }, () => {
297
265
  var _a;
298
266
  return [
299
267
  createElementVNode("div", {
@@ -312,19 +280,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
312
280
  _: 1
313
281
  })
314
282
  ], 8, _hoisted_2)) : createCommentVNode("", true),
315
- getIsViews(item) ? (openBlock(), createElementBlock("span", {
283
+ props.isViews ? (openBlock(), createElementBlock("span", {
316
284
  key: 1,
317
285
  onClick: ($event) => onViews(item, index),
318
286
  title: unref(getLocale)("upload.views")
319
287
  }, [
320
288
  createVNode(unref(Icon), null, {
321
289
  default: withCtx(() => [
322
- createVNode(Views)
290
+ createVNode(IconViews)
323
291
  ]),
324
292
  _: 1
325
293
  })
326
294
  ], 8, _hoisted_3)) : createCommentVNode("", true),
327
- !(props.disabled || item.disabled) ? (openBlock(), createElementBlock("span", {
295
+ !(unref(disabled) || item.disabled) ? (openBlock(), createElementBlock("span", {
328
296
  key: 2,
329
297
  class: normalizeClass(unref(cs).z("list-li-operation-delete")),
330
298
  onClick: ($event) => onDelete(item, index),
@@ -341,12 +309,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
341
309
  createElementVNode("div", {
342
310
  class: normalizeClass(unref(cs).z("list-li-value"))
343
311
  }, [
344
- getListType(item).startsWith("i") ? (openBlock(), createBlock(unref(Image), {
312
+ unref(getListType)(
313
+ item,
314
+ props.type,
315
+ accept.value
316
+ ).startsWith("i") ? (openBlock(), createBlock(unref(Image), {
345
317
  key: 0,
346
318
  class: normalizeClass(unref(cs).z("list-li-value-img")),
347
319
  fit: "cover",
348
320
  src: item.url
349
- }, null, 8, ["class", "src"])) : (openBlock(), createElementBlock("div", {
321
+ }, {
322
+ error: withCtx(() => {
323
+ var _a2;
324
+ return [
325
+ createElementVNode("div", {
326
+ class: normalizeClass(unref(cs).z("list-li-value-img-error"))
327
+ }, toDisplayString(((_a2 = unref(getUrlCatalogueObj)(item.url)) == null ? void 0 : _a2.name) || item.url), 3)
328
+ ];
329
+ }),
330
+ _: 2
331
+ }, 1032, ["class", "src"])) : (openBlock(), createElementBlock("div", {
350
332
  key: 1,
351
333
  class: normalizeClass(unref(cs).z("list-li-value-document"))
352
334
  }, [
@@ -364,27 +346,32 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
364
346
  })
365
347
  ], 2);
366
348
  }), 128)),
367
- views.show ? (openBlock(), createElementBlock("div", {
349
+ props.isViews ? (openBlock(), createElementBlock("div", {
368
350
  key: 0,
369
351
  class: normalizeClass(unref(cs).z("list-views"))
370
352
  }, [
371
- renderSlot(_ctx.$slots, unref(dataSlot).views, { views }, () => {
372
- var _a;
373
- return [
374
- getListType(views.value).startsWith("i") ? (openBlock(), createBlock(unref(ImageViewer), {
375
- key: 0,
376
- "url-list": [(_a = views.value) == null ? void 0 : _a.url],
377
- "show-progress": "",
378
- onClose: _cache[0] || (_cache[0] = ($event) => views.show = false)
379
- }, null, 8, ["url-list"])) : createCommentVNode("", true)
380
- ];
381
- })
353
+ renderSlot(_ctx.$slots, unref(dataSlot).views, {
354
+ type: props.type,
355
+ accept: accept.value,
356
+ value: views.value,
357
+ show: views.show,
358
+ onClose: _cache[0] || (_cache[0] = ($event) => views.show = false)
359
+ }, () => [
360
+ createVNode(_sfc_main$1, {
361
+ name: unref(dataSlot).views,
362
+ type: props.type,
363
+ accept: accept.value,
364
+ value: views.value,
365
+ show: views.show,
366
+ onClose: _cache[1] || (_cache[1] = ($event) => views.show = false)
367
+ }, null, 8, ["name", "type", "accept", "value", "show"])
368
+ ])
382
369
  ], 2)) : createCommentVNode("", true)
383
370
  ], 2),
384
371
  isUp.value ? (openBlock(), createBlock(unref(Upload), mergeProps({ key: 0 }, unref(attrs).assem, {
385
372
  ref_key: "elRef",
386
373
  ref: elRef,
387
- disabled: isloading.value,
374
+ disabled: unref(disabled) || isloading.value,
388
375
  class: unref(cs).z("upload"),
389
376
  action: "#",
390
377
  multiple: unref(multiple),
@@ -396,7 +383,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
396
383
  }), {
397
384
  trigger: withCtx(() => [
398
385
  createElementVNode("div", {
399
- class: normalizeClass(unref(cs).z("upload-trigger"))
386
+ class: normalizeClass([
387
+ unref(cs).z("upload-trigger"),
388
+ unref(cs).is("disabled", unref(disabled))
389
+ ])
400
390
  }, [
401
391
  createVNode(unref(Icon), null, {
402
392
  default: withCtx(() => [
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const getUrlCatalogueObj = require("@fangzhongya/utils/urls/getUrlCatalogueObj");
4
+ const data = require("./data.cjs");
5
+ require("../../players/common/util.cjs");
6
+ const getExtension = (fileName) => {
7
+ const extension = fileName.toLowerCase();
8
+ if (extension) {
9
+ const ks = Object.keys(data.types);
10
+ for (let index = 0; index < ks.length; index++) {
11
+ const key = ks[index];
12
+ if (data.types[key].includes(extension)) {
13
+ return key;
14
+ }
15
+ }
16
+ }
17
+ return "";
18
+ };
19
+ const getType = (accept = "") => {
20
+ if (accept) {
21
+ if (accept.includes("image/")) {
22
+ return "i";
23
+ } else if (accept.includes("audio/")) {
24
+ return "a";
25
+ } else if (accept.includes("video/")) {
26
+ return "v";
27
+ } else {
28
+ const extension = accept.toLowerCase().split(",")[0];
29
+ return getExtension(extension);
30
+ }
31
+ }
32
+ return "";
33
+ };
34
+ const getListType = (obj, type, accept) => {
35
+ if (type) {
36
+ return type;
37
+ }
38
+ if (obj) {
39
+ if (obj.type) {
40
+ return obj.type;
41
+ } else {
42
+ if (obj.url) {
43
+ let v = getUrlCatalogueObj.getUrlCatalogueObj(obj.url);
44
+ if (v.suffix) {
45
+ return getExtension("." + v.suffix);
46
+ }
47
+ }
48
+ return getType(accept);
49
+ }
50
+ }
51
+ return "";
52
+ };
53
+ function downloadFromURL(url, filename) {
54
+ const link = document.createElement("a");
55
+ link.href = url;
56
+ if (filename) {
57
+ link.download = filename;
58
+ }
59
+ document.body.appendChild(link);
60
+ link.click();
61
+ document.body.removeChild(link);
62
+ }
63
+ function smartFileHandler(url) {
64
+ const iframe = document.createElement("iframe");
65
+ iframe.style.display = "none";
66
+ iframe.src = url;
67
+ iframe.onload = function() {
68
+ window.open(url, "_blank");
69
+ document.body.removeChild(iframe);
70
+ };
71
+ iframe.onerror = function() {
72
+ downloadFromURL(url);
73
+ document.body.removeChild(iframe);
74
+ };
75
+ document.body.appendChild(iframe);
76
+ }
77
+ exports.downloadFromURL = downloadFromURL;
78
+ exports.getListType = getListType;
79
+ exports.getType = getType;
80
+ exports.smartFileHandler = smartFileHandler;
@@ -0,0 +1,10 @@
1
+ import { ListValue } from '../../players/common/util';
2
+ export declare const getType: (accept?: string) => string;
3
+ export declare const getListType: (obj?: ListValue, type?: string, accept?: string) => string;
4
+ /**
5
+ * 从 URL 下载文件
6
+ * @param url 文件 URL
7
+ * @param filename 文件名
8
+ */
9
+ export declare function downloadFromURL(url: string, filename?: string): void;
10
+ export declare function smartFileHandler(url: string): void;
@@ -0,0 +1,80 @@
1
+ import { getUrlCatalogueObj } from "@fangzhongya/utils/urls/getUrlCatalogueObj";
2
+ import { types } from "./data.js";
3
+ import "../../players/common/util.js";
4
+ const getExtension = (fileName) => {
5
+ const extension = fileName.toLowerCase();
6
+ if (extension) {
7
+ const ks = Object.keys(types);
8
+ for (let index = 0; index < ks.length; index++) {
9
+ const key = ks[index];
10
+ if (types[key].includes(extension)) {
11
+ return key;
12
+ }
13
+ }
14
+ }
15
+ return "";
16
+ };
17
+ const getType = (accept = "") => {
18
+ if (accept) {
19
+ if (accept.includes("image/")) {
20
+ return "i";
21
+ } else if (accept.includes("audio/")) {
22
+ return "a";
23
+ } else if (accept.includes("video/")) {
24
+ return "v";
25
+ } else {
26
+ const extension = accept.toLowerCase().split(",")[0];
27
+ return getExtension(extension);
28
+ }
29
+ }
30
+ return "";
31
+ };
32
+ const getListType = (obj, type, accept) => {
33
+ if (type) {
34
+ return type;
35
+ }
36
+ if (obj) {
37
+ if (obj.type) {
38
+ return obj.type;
39
+ } else {
40
+ if (obj.url) {
41
+ let v = getUrlCatalogueObj(obj.url);
42
+ if (v.suffix) {
43
+ return getExtension("." + v.suffix);
44
+ }
45
+ }
46
+ return getType(accept);
47
+ }
48
+ }
49
+ return "";
50
+ };
51
+ function downloadFromURL(url, filename) {
52
+ const link = document.createElement("a");
53
+ link.href = url;
54
+ if (filename) {
55
+ link.download = filename;
56
+ }
57
+ document.body.appendChild(link);
58
+ link.click();
59
+ document.body.removeChild(link);
60
+ }
61
+ function smartFileHandler(url) {
62
+ const iframe = document.createElement("iframe");
63
+ iframe.style.display = "none";
64
+ iframe.src = url;
65
+ iframe.onload = function() {
66
+ window.open(url, "_blank");
67
+ document.body.removeChild(iframe);
68
+ };
69
+ iframe.onerror = function() {
70
+ downloadFromURL(url);
71
+ document.body.removeChild(iframe);
72
+ };
73
+ document.body.appendChild(iframe);
74
+ }
75
+ export {
76
+ downloadFromURL,
77
+ getListType,
78
+ getType,
79
+ smartFileHandler
80
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const views_vue_vue_type_script_setup_true_lang = require("./views2.cjs");
4
+ exports.default = views_vue_vue_type_script_setup_true_lang.default;
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./views2.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const vue = require("vue");
4
+ const index = require("../../../hooks/cssname/index.cjs");
5
+ const index$2 = require("../../box-adjust/index.cjs");
6
+ const index$3 = require("../../iframe/index.cjs");
7
+ const index$1 = require("../../image-viewer/index.cjs");
8
+ const util = require("./util.cjs");
9
+ require("../../players/common/util.cjs");
10
+ const _hoisted_1 = { key: 1 };
11
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
12
+ __name: "views",
13
+ props: {
14
+ value: {
15
+ type: Object
16
+ },
17
+ show: Boolean,
18
+ type: String,
19
+ accept: String
20
+ },
21
+ emits: ["close"],
22
+ setup(__props, { emit: __emit }) {
23
+ const cs = index.useCssName("uploads-views");
24
+ const emit = __emit;
25
+ const props = __props;
26
+ const value = vue.computed({
27
+ set(v) {
28
+ if (!v) {
29
+ close();
30
+ }
31
+ },
32
+ get() {
33
+ return props.show;
34
+ }
35
+ });
36
+ const close = () => {
37
+ emit("close");
38
+ };
39
+ const onError = () => {
40
+ console.log("error");
41
+ };
42
+ return (_ctx, _cache) => {
43
+ var _a;
44
+ return props.show ? (vue.openBlock(), vue.createElementBlock("div", {
45
+ key: 0,
46
+ class: vue.normalizeClass(vue.unref(cs).z())
47
+ }, [
48
+ vue.unref(util.getListType)(props.value, props.type, props.accept).startsWith(
49
+ "i"
50
+ ) ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.ImageViewer), {
51
+ key: 0,
52
+ "url-list": [(_a = props.value) == null ? void 0 : _a.url],
53
+ "show-progress": "",
54
+ onClose: close
55
+ }, null, 8, ["url-list"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
56
+ vue.createVNode(vue.unref(index$2.BoxAdjust), {
57
+ isMax: "",
58
+ modelValue: value.value,
59
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event)
60
+ }, {
61
+ default: vue.withCtx(() => {
62
+ var _a2;
63
+ return [
64
+ vue.createVNode(vue.unref(index$3.Iframe), {
65
+ onError,
66
+ url: (_a2 = props.value) == null ? void 0 : _a2.url
67
+ }, null, 8, ["url"])
68
+ ];
69
+ }),
70
+ _: 1
71
+ }, 8, ["modelValue"])
72
+ ]))
73
+ ], 2)) : vue.createCommentVNode("", true);
74
+ };
75
+ }
76
+ });
77
+ exports.default = _sfc_main;
@@ -0,0 +1,77 @@
1
+ import { defineComponent, computed, createElementBlock, createCommentVNode, openBlock, normalizeClass, unref, createBlock, createVNode, withCtx } from "vue";
2
+ import { useCssName } from "../../../hooks/cssname/index.js";
3
+ import { BoxAdjust } from "../../box-adjust/index.js";
4
+ import { Iframe } from "../../iframe/index.js";
5
+ import { ImageViewer } from "../../image-viewer/index.js";
6
+ import { getListType } from "./util.js";
7
+ import "../../players/common/util.js";
8
+ const _hoisted_1 = { key: 1 };
9
+ const _sfc_main = /* @__PURE__ */ defineComponent({
10
+ __name: "views",
11
+ props: {
12
+ value: {
13
+ type: Object
14
+ },
15
+ show: Boolean,
16
+ type: String,
17
+ accept: String
18
+ },
19
+ emits: ["close"],
20
+ setup(__props, { emit: __emit }) {
21
+ const cs = useCssName("uploads-views");
22
+ const emit = __emit;
23
+ const props = __props;
24
+ const value = computed({
25
+ set(v) {
26
+ if (!v) {
27
+ close();
28
+ }
29
+ },
30
+ get() {
31
+ return props.show;
32
+ }
33
+ });
34
+ const close = () => {
35
+ emit("close");
36
+ };
37
+ const onError = () => {
38
+ console.log("error");
39
+ };
40
+ return (_ctx, _cache) => {
41
+ var _a;
42
+ return props.show ? (openBlock(), createElementBlock("div", {
43
+ key: 0,
44
+ class: normalizeClass(unref(cs).z())
45
+ }, [
46
+ unref(getListType)(props.value, props.type, props.accept).startsWith(
47
+ "i"
48
+ ) ? (openBlock(), createBlock(unref(ImageViewer), {
49
+ key: 0,
50
+ "url-list": [(_a = props.value) == null ? void 0 : _a.url],
51
+ "show-progress": "",
52
+ onClose: close
53
+ }, null, 8, ["url-list"])) : (openBlock(), createElementBlock("div", _hoisted_1, [
54
+ createVNode(unref(BoxAdjust), {
55
+ isMax: "",
56
+ modelValue: value.value,
57
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event)
58
+ }, {
59
+ default: withCtx(() => {
60
+ var _a2;
61
+ return [
62
+ createVNode(unref(Iframe), {
63
+ onError,
64
+ url: (_a2 = props.value) == null ? void 0 : _a2.url
65
+ }, null, 8, ["url"])
66
+ ];
67
+ }),
68
+ _: 1
69
+ }, 8, ["modelValue"])
70
+ ]))
71
+ ], 2)) : createCommentVNode("", true);
72
+ };
73
+ }
74
+ });
75
+ export {
76
+ _sfc_main as default
77
+ };