persagy-vant 0.0.36 → 0.0.37

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 (97) hide show
  1. package/es/cell/Cell.d.ts +9 -0
  2. package/es/cell/Cell.mjs +15 -3
  3. package/es/cell/index.css +1 -1
  4. package/es/cell/index.d.ts +5 -0
  5. package/es/cell/index.less +24 -2
  6. package/es/cell/var.less +6 -0
  7. package/es/cell-group/CellGroup.d.ts +4 -0
  8. package/es/cell-group/CellGroup.mjs +4 -2
  9. package/es/cell-group/index.css +1 -1
  10. package/es/cell-group/index.d.ts +3 -0
  11. package/es/cell-group/index.less +27 -0
  12. package/es/cell-group/var.less +3 -0
  13. package/es/collapse-item/CollapseItem.d.ts +7 -0
  14. package/es/collapse-item/index.d.ts +5 -0
  15. package/es/field/Field.d.ts +7 -0
  16. package/es/field/index.d.ts +5 -0
  17. package/es/index.d.ts +1 -1
  18. package/es/index.mjs +1 -1
  19. package/es/loading/index.css +1 -1
  20. package/es/loading/index.less +1 -1
  21. package/es/object-select/ObjectSelect.mjs +13 -1
  22. package/es/style/base.css +1 -1
  23. package/es/style/base.less +5 -0
  24. package/es/style/css-variables.css +1 -1
  25. package/es/style/css-variables.less +1 -0
  26. package/es/style/var.less +1 -0
  27. package/es/title-bar/TitleBar.d.ts +5 -1
  28. package/es/title-bar/TitleBar.mjs +5 -3
  29. package/es/title-bar/index.css +1 -1
  30. package/es/title-bar/index.d.ts +4 -1
  31. package/es/title-bar/index.less +6 -1
  32. package/es/title-bar/var.less +2 -0
  33. package/es/uploader/Uploader.d.ts +7 -0
  34. package/es/uploader/Uploader.mjs +55 -30
  35. package/es/uploader/UploaderPreviewItem.d.ts +2 -1
  36. package/es/uploader/UploaderPreviewItem.mjs +13 -6
  37. package/es/uploader/index.css +1 -1
  38. package/es/uploader/index.d.ts +5 -0
  39. package/es/uploader/index.less +30 -0
  40. package/es/uploader/types.d.ts +1 -0
  41. package/es/uploader/utils.d.ts +2 -0
  42. package/es/uploader/utils.mjs +74 -0
  43. package/es/uploader/var.less +5 -0
  44. package/lib/cell/Cell.d.ts +9 -0
  45. package/lib/cell/Cell.js +15 -3
  46. package/lib/cell/index.css +1 -1
  47. package/lib/cell/index.d.ts +5 -0
  48. package/lib/cell/index.less +24 -2
  49. package/lib/cell/var.less +6 -0
  50. package/lib/cell-group/CellGroup.d.ts +4 -0
  51. package/lib/cell-group/CellGroup.js +4 -2
  52. package/lib/cell-group/index.css +1 -1
  53. package/lib/cell-group/index.d.ts +3 -0
  54. package/lib/cell-group/index.less +27 -0
  55. package/lib/cell-group/var.less +3 -0
  56. package/lib/collapse-item/CollapseItem.d.ts +7 -0
  57. package/lib/collapse-item/index.d.ts +5 -0
  58. package/lib/field/Field.d.ts +7 -0
  59. package/lib/field/index.d.ts +5 -0
  60. package/lib/index.css +1 -1
  61. package/lib/index.d.ts +1 -1
  62. package/lib/index.js +1 -1
  63. package/lib/loading/index.css +1 -1
  64. package/lib/loading/index.less +1 -1
  65. package/lib/object-select/ObjectSelect.js +13 -1
  66. package/lib/style/base.css +1 -1
  67. package/lib/style/base.less +5 -0
  68. package/lib/style/css-variables.css +1 -1
  69. package/lib/style/css-variables.less +1 -0
  70. package/lib/style/var.less +1 -0
  71. package/lib/title-bar/TitleBar.d.ts +5 -1
  72. package/lib/title-bar/TitleBar.js +5 -3
  73. package/lib/title-bar/index.css +1 -1
  74. package/lib/title-bar/index.d.ts +4 -1
  75. package/lib/title-bar/index.less +6 -1
  76. package/lib/title-bar/var.less +2 -0
  77. package/lib/uploader/Uploader.d.ts +7 -0
  78. package/lib/uploader/Uploader.js +53 -28
  79. package/lib/uploader/UploaderPreviewItem.d.ts +2 -1
  80. package/lib/uploader/UploaderPreviewItem.js +12 -5
  81. package/lib/uploader/index.css +1 -1
  82. package/lib/uploader/index.d.ts +5 -0
  83. package/lib/uploader/index.less +30 -0
  84. package/lib/uploader/types.d.ts +1 -0
  85. package/lib/uploader/utils.d.ts +2 -0
  86. package/lib/uploader/utils.js +74 -0
  87. package/lib/uploader/var.less +5 -0
  88. package/lib/vant.cjs.js +175 -43
  89. package/lib/vant.es.js +175 -43
  90. package/lib/vant.js +175 -43
  91. package/lib/vant.min.js +1 -1
  92. package/lib/web-types.json +1 -1
  93. package/package.json +1 -1
  94. package/skills/use-persagy-vant/SKILL.md +4 -3
  95. package/skills/use-persagy-vant/references/component-documentation.md +4 -4
  96. package/skills/use-persagy-vant/references/component-variant-selection.md +53 -0
  97. package/skills/use-persagy-vant/references/reuse-policy.md +7 -4
@@ -28,12 +28,42 @@
28
28
  --van-uploader-loading-icon-size: @uploader-loading-icon-size;
29
29
  --van-uploader-loading-icon-color: @uploader-loading-icon-color;
30
30
  --van-uploader-disabled-opacity: @uploader-disabled-opacity;
31
+ --van-uploader-required-color: @uploader-required-color;
32
+ --van-uploader-label-color: @uploader-label-color;
33
+ --van-uploader-label-font-size: @uploader-label-font-size;
34
+ --van-uploader-label-line-height: @uploader-label-line-height;
35
+ --van-uploader-label-margin-bottom: @uploader-label-margin-bottom;
31
36
  }
32
37
 
33
38
  .van-uploader {
34
39
  position: relative;
35
40
  display: inline-block;
36
41
 
42
+ &--required::before {
43
+ position: absolute;
44
+ top: 0;
45
+ left: calc(-1 * var(--van-padding-sm));
46
+ color: var(--van-uploader-required-color);
47
+ font-size: var(--van-font-size-md);
48
+ line-height: var(--van-line-height-md);
49
+ content: '*';
50
+ }
51
+
52
+ &__label {
53
+ position: relative;
54
+ margin-bottom: var(--van-uploader-label-margin-bottom);
55
+ color: var(--van-uploader-label-color);
56
+ font-size: var(--van-uploader-label-font-size);
57
+ line-height: var(--van-uploader-label-line-height);
58
+ }
59
+
60
+ &__required {
61
+ position: absolute;
62
+ top: 0;
63
+ left: calc(-1 * (var(--van-padding-md) - var(--van-padding-xs)));
64
+ color: var(--van-uploader-required-color);
65
+ }
66
+
37
67
  &__wrapper {
38
68
  display: flex;
39
69
  flex-wrap: wrap;
@@ -8,6 +8,7 @@ export declare type UploaderFileListItem = {
8
8
  file?: File;
9
9
  content?: string;
10
10
  isImage?: boolean;
11
+ videoThumbnail?: string;
11
12
  status?: '' | 'uploading' | 'done' | 'failed';
12
13
  message?: string;
13
14
  imageFit?: ImageFit;
@@ -9,3 +9,5 @@ export declare function filterFiles(items: UploaderFileListItem[], maxSize: Uplo
9
9
  };
10
10
  export declare const isImageUrl: (url: string) => boolean;
11
11
  export declare function isImageFile(item: UploaderFileListItem): boolean;
12
+ export declare function isVideoFile(item: UploaderFileListItem): boolean;
13
+ export declare function createVideoThumbnail(file: File): Promise<string | undefined>;
@@ -18,10 +18,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
18
18
  var stdin_exports = {};
19
19
  __export(stdin_exports, {
20
20
  bem: () => bem,
21
+ createVideoThumbnail: () => createVideoThumbnail,
21
22
  filterFiles: () => filterFiles,
22
23
  isImageFile: () => isImageFile,
23
24
  isImageUrl: () => isImageUrl,
24
25
  isOversize: () => isOversize,
26
+ isVideoFile: () => isVideoFile,
25
27
  name: () => name,
26
28
  readFileContent: () => readFileContent,
27
29
  t: () => t
@@ -70,6 +72,7 @@ function filterFiles(items, maxSize) {
70
72
  return { valid, invalid };
71
73
  }
72
74
  const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
75
+ const VIDEO_REGEXP = /\.(mp4|webm|ogg|mov)(?:$|\?)/i;
73
76
  const isImageUrl = (url) => IMAGE_REGEXP.test(url);
74
77
  function isImageFile(item) {
75
78
  if (item.isImage) {
@@ -86,3 +89,74 @@ function isImageFile(item) {
86
89
  }
87
90
  return false;
88
91
  }
92
+ function isVideoFile(item) {
93
+ var _a;
94
+ if ((_a = item.file) == null ? void 0 : _a.type) {
95
+ return item.file.type.indexOf("video/") === 0;
96
+ }
97
+ if (item.url) {
98
+ return VIDEO_REGEXP.test(item.url);
99
+ }
100
+ return typeof item.content === "string" && item.content.indexOf("data:video") === 0;
101
+ }
102
+ function createVideoThumbnail(file) {
103
+ if (typeof document === "undefined" || typeof URL === "undefined" || typeof URL.createObjectURL !== "function") {
104
+ return Promise.resolve(void 0);
105
+ }
106
+ return new Promise((resolve) => {
107
+ const video = document.createElement("video");
108
+ const objectUrl = URL.createObjectURL(file);
109
+ let settled = false;
110
+ let timeout;
111
+ const cleanup = () => {
112
+ if (timeout !== void 0) {
113
+ window.clearTimeout(timeout);
114
+ }
115
+ URL.revokeObjectURL(objectUrl);
116
+ video.removeAttribute("src");
117
+ try {
118
+ video.load();
119
+ } catch (e) {
120
+ }
121
+ };
122
+ const done = (thumbnail) => {
123
+ if (settled)
124
+ return;
125
+ settled = true;
126
+ cleanup();
127
+ resolve(thumbnail);
128
+ };
129
+ const captureFrame = () => {
130
+ if (!video.videoWidth || !video.videoHeight) {
131
+ done();
132
+ return;
133
+ }
134
+ const canvas = document.createElement("canvas");
135
+ canvas.width = video.videoWidth;
136
+ canvas.height = video.videoHeight;
137
+ const context = canvas.getContext("2d");
138
+ if (!context) {
139
+ done();
140
+ return;
141
+ }
142
+ context.drawImage(video, 0, 0, canvas.width, canvas.height);
143
+ done(canvas.toDataURL("image/jpeg", 0.8));
144
+ };
145
+ video.muted = true;
146
+ video.playsInline = true;
147
+ video.preload = "auto";
148
+ video.onloadedmetadata = () => {
149
+ const duration = Number.isFinite(video.duration) ? video.duration : 0.1;
150
+ const frameTime = Math.min(0.1, Math.max(duration - 0.01, 0));
151
+ if (frameTime) {
152
+ video.currentTime = frameTime;
153
+ } else {
154
+ captureFrame();
155
+ }
156
+ };
157
+ video.onseeked = captureFrame;
158
+ video.onerror = () => done();
159
+ video.src = objectUrl;
160
+ timeout = window.setTimeout(() => done(), 3e3);
161
+ });
162
+ }
@@ -27,3 +27,8 @@
27
27
  @uploader-loading-icon-size: 22px;
28
28
  @uploader-loading-icon-color: var(--van-white);
29
29
  @uploader-disabled-opacity: var(--van-disabled-opacity);
30
+ @uploader-required-color: var(--van-danger-color);
31
+ @uploader-label-color: var(--van-text-color);
32
+ @uploader-label-font-size: var(--van-font-size-md);
33
+ @uploader-label-line-height: var(--van-line-height-md);
34
+ @uploader-label-margin-bottom: var(--van-padding-sm);
package/lib/vant.cjs.js CHANGED
@@ -2722,6 +2722,8 @@ const cellSharedProps = {
2722
2722
  title: numericProp,
2723
2723
  value: numericProp,
2724
2724
  label: numericProp,
2725
+ description: numericProp,
2726
+ threeLine: Boolean,
2725
2727
  labelSize: numericProp,
2726
2728
  avatar: String,
2727
2729
  rightAvatar: String,
@@ -2821,6 +2823,14 @@ var stdin_default$1O = vue.defineComponent({
2821
2823
  }, [slots.label ? slots.label() : props2.label]);
2822
2824
  }
2823
2825
  };
2826
+ const renderDescription = () => {
2827
+ const showDescription = slots.description || isDef(props2.description);
2828
+ if (showDescription) {
2829
+ return vue.createVNode("div", {
2830
+ "class": bem$1B("description")
2831
+ }, [slots.description ? slots.description() : props2.description]);
2832
+ }
2833
+ };
2824
2834
  const renderTitle = () => {
2825
2835
  if (slots.title || isDef(props2.title)) {
2826
2836
  return vue.createVNode("div", {
@@ -2828,7 +2838,7 @@ var stdin_default$1O = vue.defineComponent({
2828
2838
  "style": props2.titleStyle
2829
2839
  }, [vue.createVNode("div", {
2830
2840
  "class": bem$1B("title-row")
2831
- }, [slots.title ? slots.title() : vue.createVNode("span", null, [props2.title]), renderTags(), renderTitleIcon()]), renderLabel()]);
2841
+ }, [slots.title ? slots.title() : vue.createVNode("span", null, [props2.title]), renderTags(), renderTitleIcon()]), renderLabel(), props2.threeLine && renderDescription()]);
2832
2842
  }
2833
2843
  };
2834
2844
  const renderValue = () => {
@@ -3016,7 +3026,8 @@ var stdin_default$1O = vue.defineComponent({
3016
3026
  isLink,
3017
3027
  required,
3018
3028
  rightIcon,
3019
- titleBold
3029
+ titleBold,
3030
+ threeLine
3020
3031
  } = props2;
3021
3032
  const clickable = (_a2 = props2.clickable) != null ? _a2 : isLink || rightIcon === "arrow" || hasSelect("left") || hasSelect("right");
3022
3033
  const hasBadge = !!slots.badge || isDef(props2.badge);
@@ -3026,7 +3037,8 @@ var stdin_default$1O = vue.defineComponent({
3026
3037
  required,
3027
3038
  "title-bold": titleBold,
3028
3039
  clickable,
3029
- borderless: !border
3040
+ borderless: !border,
3041
+ "three-line": threeLine
3030
3042
  };
3031
3043
  if (cellSize) {
3032
3044
  classes[cellSize] = !!cellSize;
@@ -8004,6 +8016,7 @@ const [name$1a, bem$19] = createNamespace("cell-group");
8004
8016
  const cellGroupProps = {
8005
8017
  title: String,
8006
8018
  inset: Boolean,
8019
+ grayCard: Boolean,
8007
8020
  border: truthProp
8008
8021
  };
8009
8022
  var stdin_default$1j = vue.defineComponent({
@@ -8018,9 +8031,10 @@ var stdin_default$1j = vue.defineComponent({
8018
8031
  var _a;
8019
8032
  return vue.createVNode("div", vue.mergeProps({
8020
8033
  "class": [bem$19({
8021
- inset: props2.inset
8034
+ inset: props2.inset,
8035
+ "gray-card": props2.grayCard
8022
8036
  }), {
8023
- [BORDER_TOP_BOTTOM]: props2.border && !props2.inset
8037
+ [BORDER_TOP_BOTTOM]: props2.border && !props2.inset && !props2.grayCard
8024
8038
  }]
8025
8039
  }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
8026
8040
  };
@@ -15576,6 +15590,15 @@ var stdin_default$s = vue.defineComponent({
15576
15590
  const expandedSelected = vue.ref(false);
15577
15591
  const searching = vue.ref(false);
15578
15592
  const keyword = vue.ref("");
15593
+ const currentSpecialtyItems = (specialty) => specialtyType.value === 0 ? specialty.deviceItems : specialty.systemItems;
15594
+ const expandOnlySpecialty = () => {
15595
+ if (props2.specialties.length === 1) {
15596
+ const [specialty] = props2.specialties;
15597
+ expandedSpecialties.value = extend({}, expandedSpecialties.value, {
15598
+ [specialty.id]: true
15599
+ });
15600
+ }
15601
+ };
15579
15602
  const reset = () => {
15580
15603
  view.value = 0;
15581
15604
  specialtyType.value = 0;
@@ -15585,6 +15608,7 @@ var stdin_default$s = vue.defineComponent({
15585
15608
  expandedSpecialties.value = {
15586
15609
  "strong-electricity": true
15587
15610
  };
15611
+ expandOnlySpecialty();
15588
15612
  };
15589
15613
  vue.watch(() => props2.show, (show) => show && reset(), {
15590
15614
  immediate: true
@@ -15652,7 +15676,7 @@ var stdin_default$s = vue.defineComponent({
15652
15676
  const renderSpecialty = (specialty) => {
15653
15677
  var _a;
15654
15678
  const expanded = (_a = expandedSpecialties.value[specialty.id]) != null ? _a : false;
15655
- const items = specialtyType.value === 0 ? specialty.deviceItems : specialty.systemItems;
15679
+ const items = currentSpecialtyItems(specialty);
15656
15680
  return vue.createVNode("section", {
15657
15681
  "class": bem$n("specialty"),
15658
15682
  "key": specialty.id
@@ -15740,6 +15764,7 @@ var stdin_default$s = vue.defineComponent({
15740
15764
  "selected": specialtyType.value === 0,
15741
15765
  "onClick": () => {
15742
15766
  specialtyType.value = 0;
15767
+ expandOnlySpecialty();
15743
15768
  }
15744
15769
  }, {
15745
15770
  default: () => [vue.createTextVNode("设备")]
@@ -15747,6 +15772,7 @@ var stdin_default$s = vue.defineComponent({
15747
15772
  "selected": specialtyType.value === 1,
15748
15773
  "onClick": () => {
15749
15774
  specialtyType.value = 1;
15775
+ expandOnlySpecialty();
15750
15776
  }
15751
15777
  }, {
15752
15778
  default: () => [vue.createTextVNode("系统")]
@@ -18027,7 +18053,8 @@ const titleBarProps = {
18027
18053
  showAction: Boolean,
18028
18054
  size: makeStringProp("default"),
18029
18055
  expandable: Boolean,
18030
- modelValue: truthProp
18056
+ modelValue: truthProp,
18057
+ required: Boolean
18031
18058
  };
18032
18059
  var stdin_default$9 = vue.defineComponent({
18033
18060
  name: name$4,
@@ -18064,7 +18091,8 @@ var stdin_default$9 = vue.defineComponent({
18064
18091
  return vue.createVNode("section", {
18065
18092
  "class": bem$4({
18066
18093
  mini: props2.size === "mini",
18067
- expandable: props2.expandable
18094
+ expandable: props2.expandable,
18095
+ required: props2.required
18068
18096
  })
18069
18097
  }, [vue.createVNode("div", {
18070
18098
  "class": bem$4("header"),
@@ -18086,7 +18114,7 @@ var stdin_default$9 = vue.defineComponent({
18086
18114
  "class": bem$4("action-divider")
18087
18115
  }, null), vue.createVNode(Button, {
18088
18116
  "type": "text",
18089
- "size": "small",
18117
+ "size": "normal",
18090
18118
  "text": props2.actionText,
18091
18119
  "onClick": onActionClick
18092
18120
  }, null)])]), props2.size !== "mini" && props2.showDescription && props2.description && vue.createVNode("span", {
@@ -18143,6 +18171,7 @@ function filterFiles(items, maxSize) {
18143
18171
  return { valid, invalid };
18144
18172
  }
18145
18173
  const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
18174
+ const VIDEO_REGEXP = /\.(mp4|webm|ogg|mov)(?:$|\?)/i;
18146
18175
  const isImageUrl = (url) => IMAGE_REGEXP.test(url);
18147
18176
  function isImageFile(item) {
18148
18177
  if (item.isImage) {
@@ -18159,6 +18188,77 @@ function isImageFile(item) {
18159
18188
  }
18160
18189
  return false;
18161
18190
  }
18191
+ function isVideoFile(item) {
18192
+ var _a;
18193
+ if ((_a = item.file) == null ? void 0 : _a.type) {
18194
+ return item.file.type.indexOf("video/") === 0;
18195
+ }
18196
+ if (item.url) {
18197
+ return VIDEO_REGEXP.test(item.url);
18198
+ }
18199
+ return typeof item.content === "string" && item.content.indexOf("data:video") === 0;
18200
+ }
18201
+ function createVideoThumbnail(file) {
18202
+ if (typeof document === "undefined" || typeof URL === "undefined" || typeof URL.createObjectURL !== "function") {
18203
+ return Promise.resolve(void 0);
18204
+ }
18205
+ return new Promise((resolve) => {
18206
+ const video = document.createElement("video");
18207
+ const objectUrl = URL.createObjectURL(file);
18208
+ let settled = false;
18209
+ let timeout;
18210
+ const cleanup = () => {
18211
+ if (timeout !== void 0) {
18212
+ window.clearTimeout(timeout);
18213
+ }
18214
+ URL.revokeObjectURL(objectUrl);
18215
+ video.removeAttribute("src");
18216
+ try {
18217
+ video.load();
18218
+ } catch (e) {
18219
+ }
18220
+ };
18221
+ const done = (thumbnail) => {
18222
+ if (settled)
18223
+ return;
18224
+ settled = true;
18225
+ cleanup();
18226
+ resolve(thumbnail);
18227
+ };
18228
+ const captureFrame = () => {
18229
+ if (!video.videoWidth || !video.videoHeight) {
18230
+ done();
18231
+ return;
18232
+ }
18233
+ const canvas = document.createElement("canvas");
18234
+ canvas.width = video.videoWidth;
18235
+ canvas.height = video.videoHeight;
18236
+ const context = canvas.getContext("2d");
18237
+ if (!context) {
18238
+ done();
18239
+ return;
18240
+ }
18241
+ context.drawImage(video, 0, 0, canvas.width, canvas.height);
18242
+ done(canvas.toDataURL("image/jpeg", 0.8));
18243
+ };
18244
+ video.muted = true;
18245
+ video.playsInline = true;
18246
+ video.preload = "auto";
18247
+ video.onloadedmetadata = () => {
18248
+ const duration = Number.isFinite(video.duration) ? video.duration : 0.1;
18249
+ const frameTime = Math.min(0.1, Math.max(duration - 0.01, 0));
18250
+ if (frameTime) {
18251
+ video.currentTime = frameTime;
18252
+ } else {
18253
+ captureFrame();
18254
+ }
18255
+ };
18256
+ video.onseeked = captureFrame;
18257
+ video.onerror = () => done();
18258
+ video.src = objectUrl;
18259
+ timeout = window.setTimeout(() => done(), 3e3);
18260
+ });
18261
+ }
18162
18262
  var stdin_default$8 = vue.defineComponent({
18163
18263
  props: {
18164
18264
  name: numericProp,
@@ -18170,7 +18270,7 @@ var stdin_default$8 = vue.defineComponent({
18170
18270
  previewSize: [Number, String, Array],
18171
18271
  beforeDelete: Function
18172
18272
  },
18173
- emits: ["delete", "preview"],
18273
+ emits: ["delete", "preview", "click"],
18174
18274
  setup(props2, {
18175
18275
  emit,
18176
18276
  slots
@@ -18211,7 +18311,11 @@ var stdin_default$8 = vue.defineComponent({
18211
18311
  done: () => emit("delete")
18212
18312
  });
18213
18313
  };
18214
- const onPreview = () => emit("preview");
18314
+ const onPreview = () => {
18315
+ emit("preview");
18316
+ emit("click");
18317
+ };
18318
+ const onFilePreview = () => emit("click");
18215
18319
  const renderDeleteIcon = () => {
18216
18320
  if (props2.deletable && props2.item.status !== "uploading") {
18217
18321
  const slot = slots["preview-delete"];
@@ -18249,10 +18353,12 @@ var stdin_default$8 = vue.defineComponent({
18249
18353
  imageFit,
18250
18354
  previewSize
18251
18355
  } = props2;
18252
- if (isImageFile(item)) {
18356
+ const isImage2 = isImageFile(item);
18357
+ const isVideo = isVideoFile(item);
18358
+ if (isImage2 || isVideo && item.videoThumbnail) {
18253
18359
  return vue.createVNode(Image$1, {
18254
18360
  "fit": imageFit,
18255
- "src": item.content || item.url,
18361
+ "src": isVideo ? item.videoThumbnail : item.content || item.url,
18256
18362
  "class": bem$3("preview-image"),
18257
18363
  "width": Array.isArray(previewSize) ? previewSize[0] : previewSize,
18258
18364
  "height": Array.isArray(previewSize) ? previewSize[1] : previewSize,
@@ -18264,7 +18370,8 @@ var stdin_default$8 = vue.defineComponent({
18264
18370
  }
18265
18371
  return vue.createVNode("div", {
18266
18372
  "class": bem$3("file"),
18267
- "style": getSizeStyle(props2.previewSize)
18373
+ "style": getSizeStyle(props2.previewSize),
18374
+ "onClick": onFilePreview
18268
18375
  }, [vue.createVNode(Icon, {
18269
18376
  "class": bem$3("file-icon"),
18270
18377
  "name": "description"
@@ -18277,11 +18384,33 @@ var stdin_default$8 = vue.defineComponent({
18277
18384
  }, [renderPreview(), renderMask(), renderDeleteIcon()]);
18278
18385
  }
18279
18386
  });
18387
+ var __async$1 = (__this, __arguments, generator) => {
18388
+ return new Promise((resolve, reject) => {
18389
+ var fulfilled = (value) => {
18390
+ try {
18391
+ step(generator.next(value));
18392
+ } catch (e) {
18393
+ reject(e);
18394
+ }
18395
+ };
18396
+ var rejected = (value) => {
18397
+ try {
18398
+ step(generator.throw(value));
18399
+ } catch (e) {
18400
+ reject(e);
18401
+ }
18402
+ };
18403
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18404
+ step((generator = generator.apply(__this, __arguments)).next());
18405
+ });
18406
+ };
18280
18407
  const uploaderProps = {
18281
18408
  name: makeNumericProp(""),
18282
18409
  accept: makeStringProp("image/*"),
18283
18410
  capture: String,
18284
18411
  multiple: Boolean,
18412
+ label: String,
18413
+ required: Boolean,
18285
18414
  disabled: Boolean,
18286
18415
  readonly: Boolean,
18287
18416
  lazyLoad: Boolean,
@@ -18351,37 +18480,29 @@ var stdin_default$7 = vue.defineComponent({
18351
18480
  modelValue,
18352
18481
  resultType
18353
18482
  } = props2;
18483
+ const createFileItem = (file) => __async$1(this, null, function* () {
18484
+ const content = yield readFileContent(file, resultType);
18485
+ const result = {
18486
+ file,
18487
+ status: "",
18488
+ message: ""
18489
+ };
18490
+ if (content) {
18491
+ result.content = content;
18492
+ }
18493
+ if (isVideoFile(result)) {
18494
+ result.videoThumbnail = yield createVideoThumbnail(file);
18495
+ }
18496
+ return result;
18497
+ });
18354
18498
  if (Array.isArray(files)) {
18355
18499
  const remainCount = +maxCount - modelValue.length;
18356
18500
  if (files.length > remainCount) {
18357
18501
  files = files.slice(0, remainCount);
18358
18502
  }
18359
- Promise.all(files.map((file) => readFileContent(file, resultType))).then((contents) => {
18360
- const fileList = files.map((file, index) => {
18361
- const result = {
18362
- file,
18363
- status: "",
18364
- message: ""
18365
- };
18366
- if (contents[index]) {
18367
- result.content = contents[index];
18368
- }
18369
- return result;
18370
- });
18371
- onAfterRead(fileList);
18372
- });
18503
+ Promise.all(files.map(createFileItem)).then(onAfterRead);
18373
18504
  } else {
18374
- readFileContent(files, resultType).then((content) => {
18375
- const result = {
18376
- file: files,
18377
- status: "",
18378
- message: ""
18379
- };
18380
- if (content) {
18381
- result.content = content;
18382
- }
18383
- onAfterRead(result);
18384
- });
18505
+ createFileItem(files).then(onAfterRead);
18385
18506
  }
18386
18507
  };
18387
18508
  const onChange = (event) => {
@@ -18414,7 +18535,7 @@ var stdin_default$7 = vue.defineComponent({
18414
18535
  let imagePreview;
18415
18536
  const onClosePreview = () => emit("close-preview");
18416
18537
  const previewImage = (item) => {
18417
- if (props2.previewFullImage) {
18538
+ if (props2.previewFullImage && isImageFile(item)) {
18418
18539
  const imageFiles = props2.modelValue.filter(isImageFile);
18419
18540
  const images = imageFiles.map((item2) => {
18420
18541
  if (item2.file && !item2.url && item2.status !== "failed") {
@@ -18457,6 +18578,15 @@ var stdin_default$7 = vue.defineComponent({
18457
18578
  return props2.modelValue.map(renderPreviewItem);
18458
18579
  }
18459
18580
  };
18581
+ const renderLabel = () => {
18582
+ if (!props2.label)
18583
+ return;
18584
+ return vue.createVNode("div", {
18585
+ "class": bem$3("label")
18586
+ }, [props2.required && vue.createVNode("span", {
18587
+ "class": bem$3("required")
18588
+ }, [vue.createTextVNode("*")]), props2.label]);
18589
+ };
18460
18590
  const onClickUpload = (event) => emit("click-upload", event);
18461
18591
  const renderUpload = () => {
18462
18592
  if (props2.modelValue.length >= props2.maxCount || !props2.showUpload) {
@@ -18505,8 +18635,10 @@ var stdin_default$7 = vue.defineComponent({
18505
18635
  });
18506
18636
  use.useCustomFieldValue(() => props2.modelValue);
18507
18637
  return () => vue.createVNode("div", {
18508
- "class": bem$3()
18509
- }, [vue.createVNode("div", {
18638
+ "class": bem$3({
18639
+ required: props2.required && !props2.label
18640
+ })
18641
+ }, [renderLabel(), vue.createVNode("div", {
18510
18642
  "class": bem$3("wrapper", {
18511
18643
  disabled: props2.disabled
18512
18644
  })
@@ -20350,7 +20482,7 @@ const Lazyload = {
20350
20482
  });
20351
20483
  }
20352
20484
  };
20353
- const version = "0.0.36";
20485
+ const version = "0.0.37";
20354
20486
  function install(app) {
20355
20487
  const components = [
20356
20488
  ActionBar,