zartui 3.1.88 → 3.1.90

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.
@@ -0,0 +1,539 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name2 in all)
9
+ __defProp(target, name2, { get: all[name2], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var __async = (__this, __arguments, generator) => {
29
+ return new Promise((resolve, reject) => {
30
+ var fulfilled = (value) => {
31
+ try {
32
+ step(generator.next(value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ };
37
+ var rejected = (value) => {
38
+ try {
39
+ step(generator.throw(value));
40
+ } catch (e) {
41
+ reject(e);
42
+ }
43
+ };
44
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
+ step((generator = generator.apply(__this, __arguments)).next());
46
+ });
47
+ };
48
+ var stdin_exports = {};
49
+ __export(stdin_exports, {
50
+ default: () => stdin_default
51
+ });
52
+ module.exports = __toCommonJS(stdin_exports);
53
+ var import_vue = require("vue");
54
+ var import_utils = require("../utils");
55
+ var import_action_sheet = __toESM(require("../action-sheet"));
56
+ var import_loading = __toESM(require("../loading"));
57
+ var import_icon = __toESM(require("../icon"));
58
+ var import_image = __toESM(require("../image"));
59
+ var import_toast = require("../toast");
60
+ var import_image_preview = require("../image-preview");
61
+ var import_utils2 = require("../field/utils");
62
+ var import_use_expose = require("../composables/use-expose");
63
+ var import_file_type = require("file-type");
64
+ var import_app_media_utils = require("@egova-mobile/app-media-utils");
65
+ var import_media_util = require("../media-picker/util/media-util");
66
+ var import_wx_util = require("../media-picker/util/wx-util");
67
+ const [name, bem] = (0, import_utils.createNamespace)("photo-picker");
68
+ const FILE_SIZE_LIMIT = 100;
69
+ const COMPATIBLE_TYPE_MAPPINGS = {
70
+ gif: /* @__PURE__ */ new Set(["png"]),
71
+ jpeg: /* @__PURE__ */ new Set(["jpg"]),
72
+ jpg: /* @__PURE__ */ new Set(["jpeg"])
73
+ };
74
+ const photoPickerProps = {
75
+ disabled: Boolean,
76
+ showTitle: Boolean,
77
+ showDownload: Boolean,
78
+ downloadAction: Function,
79
+ useFileNameAsLabel: Boolean,
80
+ title: (0, import_utils.makeStringProp)("\u6DFB\u52A0\u9644\u4EF6"),
81
+ mediaList: (0, import_utils.makeArrayProp)(),
82
+ attachmentHeight: [Number, String],
83
+ maxAttachmentCount: (0, import_utils.makeNumberProp)(Number.MAX_VALUE),
84
+ maxImageSideLength: (0, import_utils.makeNumberProp)(1920),
85
+ maxImageFileSize: (0, import_utils.makeNumberProp)(1024),
86
+ maxFileSize: (0, import_utils.makeNumberProp)(FILE_SIZE_LIMIT * 1024),
87
+ keepFileType: {
88
+ type: Boolean,
89
+ default: false
90
+ },
91
+ watermarkOptions: {
92
+ type: Object,
93
+ default: () => null
94
+ },
95
+ allowTakePhoto: import_utils.truthProp,
96
+ allowPickPhoto: import_utils.truthProp,
97
+ preview: Function,
98
+ mediaPick: Function,
99
+ beforeRead: Function,
100
+ afterRead: Function,
101
+ beforeDelete: Function,
102
+ useWx: Boolean,
103
+ imageSizeType: (0, import_utils.makeStringProp)("compressed")
104
+ };
105
+ var stdin_default = (0, import_vue.defineComponent)({
106
+ name,
107
+ props: photoPickerProps,
108
+ emits: ["update:mediaList", "delete", "processing"],
109
+ setup(props, {
110
+ emit,
111
+ slots
112
+ }) {
113
+ const actionVisible = (0, import_vue.ref)(false);
114
+ const mediaListPlaceholder = (0, import_vue.ref)([]);
115
+ const cameraInputRef = (0, import_vue.ref)();
116
+ const imageInputRef = (0, import_vue.ref)();
117
+ const itemSizeStyle = (0, import_vue.computed)(() => {
118
+ if (!(0, import_utils.isDef)(props.attachmentHeight)) {
119
+ return void 0;
120
+ }
121
+ const size = typeof props.attachmentHeight === "number" ? `${props.attachmentHeight}px` : props.attachmentHeight;
122
+ return {
123
+ "--zt-photo-picker-item-size": size
124
+ };
125
+ });
126
+ const photoList = (0, import_vue.computed)(() => props.mediaList.filter((media) => media.type === "photo"));
127
+ const placeholderList = (0, import_vue.computed)(() => mediaListPlaceholder.value.filter((media) => media.type === "photo"));
128
+ const photoCount = (0, import_vue.computed)(() => photoList.value.length + placeholderList.value.length);
129
+ const canAddPhoto = (0, import_vue.computed)(() => photoCount.value < props.maxAttachmentCount);
130
+ const checkFileCountBeforeAdd = () => {
131
+ if (!canAddPhoto.value) {
132
+ (0, import_toast.showFailToast)(`\u6700\u591A\u53EA\u80FD\u4E0A\u4F20${props.maxAttachmentCount}\u4E2A\u9644\u4EF6`);
133
+ return false;
134
+ }
135
+ return true;
136
+ };
137
+ const triggerHiddenInput = (refEl) => {
138
+ refEl && refEl.click();
139
+ };
140
+ const mediaPickAction = (mediaType, mediaAddType) => {
141
+ if (props.disabled || mediaType !== "photo") {
142
+ return;
143
+ }
144
+ if (!checkFileCountBeforeAdd()) {
145
+ return;
146
+ }
147
+ if (props.mediaPick && props.mediaPick(mediaType, mediaAddType)) {
148
+ return;
149
+ }
150
+ if (props.useWx && (0, import_utils.isWeixin)() && window.wx) {
151
+ const type = mediaAddType === "take" ? "camera" : "album";
152
+ (0, import_wx_util.wxUploadImage)(type).then((newMedias) => {
153
+ emit("update:mediaList", [...props.mediaList, ...newMedias]);
154
+ });
155
+ return;
156
+ }
157
+ if (mediaAddType === "take") {
158
+ triggerHiddenInput(cameraInputRef.value);
159
+ } else if (mediaAddType === "pick") {
160
+ triggerHiddenInput(imageInputRef.value);
161
+ }
162
+ };
163
+ const resetInput = (mediaType, mediaAddType) => {
164
+ if (mediaType !== "photo") {
165
+ return;
166
+ }
167
+ if (mediaAddType === "take" && cameraInputRef.value instanceof HTMLInputElement) {
168
+ cameraInputRef.value.value = "";
169
+ } else if (mediaAddType === "pick" && imageInputRef.value instanceof HTMLInputElement) {
170
+ imageInputRef.value.value = "";
171
+ }
172
+ };
173
+ const checkFileExist = (file) => props.mediaList.some((media) => media.uniqueCode === (0, import_media_util.getFileUniqueCode)(file));
174
+ const filterValidFiles = (files) => {
175
+ const validFiles = [];
176
+ for (let i = 0; i < files.length; i++) {
177
+ const file = files[i];
178
+ if (file.size > props.maxFileSize * 1024) {
179
+ (0, import_toast.showFailToast)(`\u8BF7\u52FF\u6DFB\u52A0\u5927\u4E8E${props.maxFileSize}K\u7684\u6587\u4EF6`);
180
+ return validFiles;
181
+ }
182
+ if (!(0, import_media_util.isImageType)(file)) {
183
+ (0, import_toast.showFailToast)("\u53EA\u80FD\u4E0A\u4F20\u56FE\u7247\u9644\u4EF6");
184
+ return validFiles;
185
+ }
186
+ if (checkFileExist(file)) {
187
+ (0, import_toast.showFailToast)("\u8BF7\u52FF\u91CD\u590D\u6DFB\u52A0\u6587\u4EF6");
188
+ return validFiles;
189
+ }
190
+ validFiles.push(file);
191
+ }
192
+ return validFiles;
193
+ };
194
+ const checkFileCountAfterAdd = (files) => {
195
+ if (photoCount.value + files.length > props.maxAttachmentCount) {
196
+ (0, import_toast.showFailToast)(`\u6700\u591A\u53EA\u80FD\u4E0A\u4F20${props.maxAttachmentCount}\u4E2A\u9644\u4EF6`);
197
+ return false;
198
+ }
199
+ return true;
200
+ };
201
+ const transformImageFilesWithoutCompress = (files) => {
202
+ const mediaList = files.map((file) => (0, import_media_util.file2DataURL)(file).then((base64) => ({
203
+ showSrc: base64,
204
+ type: "photo",
205
+ file,
206
+ uniqueCode: (0, import_media_util.getFileUniqueCode)(file),
207
+ lastModified: file.lastModified,
208
+ fileSize: file.size,
209
+ fileName: file.name,
210
+ deletable: true,
211
+ message: "",
212
+ originalName: file.name,
213
+ originalSize: file.size,
214
+ originalFile: file
215
+ })));
216
+ return Promise.all(mediaList);
217
+ };
218
+ const getExtensionFromMimeType = (mimeType) => {
219
+ const mimeToExt = {
220
+ "image/jpeg": "jpg",
221
+ "image/jpg": "jpg",
222
+ "image/png": "png",
223
+ "image/gif": "gif",
224
+ "image/webp": "webp",
225
+ "image/bmp": "bmp",
226
+ "image/svg+xml": "svg"
227
+ };
228
+ return mimeToExt[mimeType] || "jpg";
229
+ };
230
+ const transformImageFiles = (files) => {
231
+ const resizeOptions = new import_app_media_utils.ResizeOptions(props.maxImageSideLength);
232
+ const compressOptions = new import_app_media_utils.CompressOptions(props.maxImageFileSize, props.keepFileType);
233
+ const promisesTodo = files.map((file) => {
234
+ const watermarkEnabled = props.watermarkOptions && props.watermarkOptions.watermarkConfigString && (0, import_app_media_utils.checkWatermarkConfigSupported)(props.watermarkOptions.watermarkConfigString);
235
+ let watermarkOpt;
236
+ if (watermarkEnabled) {
237
+ watermarkOpt = {
238
+ enabled: true,
239
+ watermarkConfigString: props.watermarkOptions.watermarkConfigString,
240
+ context: {
241
+ address: props.watermarkOptions.address || "",
242
+ humanName: props.watermarkOptions.humanName || "",
243
+ projectName: props.watermarkOptions.projectName || "",
244
+ watermarkTime: /* @__PURE__ */ new Date()
245
+ }
246
+ };
247
+ } else {
248
+ watermarkOpt = {
249
+ enabled: false
250
+ };
251
+ }
252
+ return new import_app_media_utils.ImageProcessor(file, resizeOptions, watermarkOpt, compressOptions).process().then((f) => {
253
+ if (!f) {
254
+ return null;
255
+ }
256
+ return (0, import_media_util.file2DataURL)(f).then((base64) => {
257
+ const ext = props.keepFileType ? getExtensionFromMimeType(f.type) : "jpg";
258
+ const uniqueFileName = (0, import_media_util.getUniqueFileName)(f, ext);
259
+ return {
260
+ showSrc: base64,
261
+ type: "photo",
262
+ file: new File([f], uniqueFileName, {
263
+ lastModified: f.lastModified,
264
+ type: f.type
265
+ }),
266
+ uniqueCode: (0, import_media_util.getFileUniqueCode)(file),
267
+ lastModified: f.lastModified,
268
+ fileSize: f.size,
269
+ fileName: f.name,
270
+ deletable: true,
271
+ message: "",
272
+ originalName: file.name,
273
+ originalSize: file.size
274
+ };
275
+ });
276
+ });
277
+ });
278
+ return Promise.all(promisesTodo).then((medias) => medias.filter(import_utils.isDef));
279
+ };
280
+ const readFiles = (files) => {
281
+ emit("processing", true);
282
+ mediaListPlaceholder.value = files.map((file) => ({
283
+ file,
284
+ message: "\u5904\u7406\u4E2D...",
285
+ status: "processing",
286
+ type: "photo",
287
+ uniqueCode: (0, import_media_util.getFileUniqueCode)(file),
288
+ lastModified: file.lastModified,
289
+ fileSize: file.size,
290
+ fileName: file.name,
291
+ originalName: file.name,
292
+ originalSize: file.size,
293
+ deletable: true
294
+ }));
295
+ const promise = props.imageSizeType === "original" ? transformImageFilesWithoutCompress(files) : transformImageFiles(files);
296
+ promise.then((newMedias) => {
297
+ if (props.useFileNameAsLabel) {
298
+ newMedias.forEach((newMedia) => {
299
+ newMedia.label = newMedia.originalName;
300
+ });
301
+ }
302
+ emit("update:mediaList", [...props.mediaList, ...newMedias]);
303
+ if (props.afterRead) {
304
+ props.afterRead(newMedias);
305
+ }
306
+ }).finally(() => {
307
+ mediaListPlaceholder.value = [];
308
+ emit("processing", false);
309
+ });
310
+ };
311
+ const handleInputFiles = (event) => __async(this, null, function* () {
312
+ const inputFiles = event.target.files;
313
+ if (!inputFiles || inputFiles.length === 0) {
314
+ return;
315
+ }
316
+ const files = filterValidFiles(inputFiles);
317
+ if (files.length === 0) {
318
+ return;
319
+ }
320
+ if (!checkFileCountAfterAdd(files)) {
321
+ return;
322
+ }
323
+ if (props.keepFileType) {
324
+ try {
325
+ for (const file of files) {
326
+ const buffer = yield file.slice(0, 4100).arrayBuffer();
327
+ const fileType = yield (0, import_file_type.fileTypeFromBuffer)(new Uint8Array(buffer));
328
+ const fileName = file.name.toLowerCase();
329
+ const extensionMatch = fileName.match(/\.([^.]+)$/);
330
+ const extension = extensionMatch ? extensionMatch[1] : "";
331
+ if (fileType && extension && fileType.ext !== extension) {
332
+ const compatibleTypes = COMPATIBLE_TYPE_MAPPINGS[extension];
333
+ const isCompatible = compatibleTypes && compatibleTypes.has(fileType.ext);
334
+ if (!isCompatible) {
335
+ (0, import_toast.showFailToast)({
336
+ message: `\u6587\u4EF6\u540E\u7F00\u4E0E\u5B9E\u9645\u6587\u4EF6\u7C7B\u578B\u4E0D\u5339\u914D\uFF1A${file.name}`,
337
+ duration: 5e3
338
+ });
339
+ return;
340
+ }
341
+ }
342
+ }
343
+ } catch (error) {
344
+ console.error("\u6587\u4EF6\u7C7B\u578B\u6821\u9A8C\u5931\u8D25:", error);
345
+ }
346
+ }
347
+ if (props.beforeRead) {
348
+ try {
349
+ const response = yield props.beforeRead(files);
350
+ if (!response) {
351
+ return;
352
+ }
353
+ if (Array.isArray(response)) {
354
+ readFiles(response.filter((file) => !!file));
355
+ } else {
356
+ readFiles(files);
357
+ }
358
+ } catch (error) {
359
+ (0, import_toast.showFailToast)(error == null ? void 0 : error.message);
360
+ }
361
+ } else {
362
+ readFiles(files);
363
+ }
364
+ });
365
+ const genThumbnailMask = (media) => {
366
+ const {
367
+ status,
368
+ message
369
+ } = media;
370
+ if (status === "processing" || status === "uploading" || status === "failed") {
371
+ const MaskIcon = status === "failed" ? (0, import_vue.createVNode)(import_icon.default, {
372
+ "name": "close",
373
+ "class": bem("mask-icon")
374
+ }, null) : (0, import_vue.createVNode)(import_loading.default, {
375
+ "class": bem("loading")
376
+ }, null);
377
+ const showMessage = (0, import_utils.isDef)(message) && message !== "";
378
+ return (0, import_vue.createVNode)("div", {
379
+ "class": bem("mask")
380
+ }, [MaskIcon, showMessage && (0, import_vue.createVNode)("div", {
381
+ "class": bem("mask-message")
382
+ }, [message])]);
383
+ }
384
+ };
385
+ const renderThumb = (media) => {
386
+ if (slots.thumbnail) {
387
+ return slots.thumbnail({
388
+ file: media
389
+ });
390
+ }
391
+ return (0, import_vue.createVNode)(import_image.default, {
392
+ "src": media.showSrc || media.url,
393
+ "fit": "cover",
394
+ "radius": "4"
395
+ }, null);
396
+ };
397
+ const renderLabel = (media) => {
398
+ if (slots["preview-cover"]) {
399
+ return slots["preview-cover"]({
400
+ file: media
401
+ });
402
+ }
403
+ if (!(0, import_utils2.isEmptyValue)(media.label)) {
404
+ return (0, import_vue.createVNode)("div", {
405
+ "class": bem("label")
406
+ }, [media.label]);
407
+ }
408
+ };
409
+ const deleteMedia = (media, index) => {
410
+ const list = props.mediaList.slice(0);
411
+ list.splice(index, 1);
412
+ emit("update:mediaList", list);
413
+ emit("delete", media, index);
414
+ };
415
+ const onDelete = (media, index) => __async(this, null, function* () {
416
+ if (props.beforeDelete) {
417
+ const response = yield props.beforeDelete(media);
418
+ if (!response) {
419
+ return;
420
+ }
421
+ }
422
+ deleteMedia(media, index);
423
+ });
424
+ const previewMedia = (index) => __async(this, null, function* () {
425
+ if (props.preview && (yield props.preview(props.mediaList, index))) {
426
+ return;
427
+ }
428
+ (0, import_image_preview.showImagePreview)({
429
+ images: photoList.value.map((image) => ({
430
+ url: image.url || image.showSrc || ""
431
+ })),
432
+ showDownload: props.showDownload,
433
+ downloadAction: props.downloadAction,
434
+ startPosition: photoList.value.indexOf(props.mediaList[index]),
435
+ closeable: true
436
+ });
437
+ });
438
+ const renderDelete = (media, index) => {
439
+ if (props.disabled || !media.deletable || media.status === "uploading") {
440
+ return;
441
+ }
442
+ return (0, import_vue.createVNode)("button", {
443
+ "type": "button",
444
+ "class": bem("delete"),
445
+ "onClick": (event) => {
446
+ event.stopPropagation();
447
+ onDelete(media, index);
448
+ }
449
+ }, [(0, import_vue.createTextVNode)("\xD7")]);
450
+ };
451
+ const renderPhoto = (media) => {
452
+ const index = props.mediaList.indexOf(media);
453
+ return (0, import_vue.createVNode)("div", {
454
+ "key": media.uniqueCode,
455
+ "class": bem("item"),
456
+ "onClick": () => previewMedia(index)
457
+ }, [renderThumb(media), renderLabel(media), genThumbnailMask(media), renderDelete(media, index)]);
458
+ };
459
+ const renderPlaceholder = (media) => (0, import_vue.createVNode)("div", {
460
+ "key": media.uniqueCode || media.fileName,
461
+ "class": bem("item")
462
+ }, [renderThumb(media), renderLabel(media), genThumbnailMask(media)]);
463
+ const renderAdd = () => {
464
+ if (!canAddPhoto.value || props.disabled || !props.allowTakePhoto && !props.allowPickPhoto) {
465
+ return;
466
+ }
467
+ return (0, import_vue.createVNode)("button", {
468
+ "type": "button",
469
+ "class": bem("add"),
470
+ "disabled": props.disabled,
471
+ "onClick": () => {
472
+ if (props.allowTakePhoto && props.allowPickPhoto) {
473
+ actionVisible.value = true;
474
+ return;
475
+ }
476
+ mediaPickAction("photo", props.allowTakePhoto ? "take" : "pick");
477
+ }
478
+ }, [(0, import_vue.createVNode)("span", {
479
+ "class": bem("add-icon")
480
+ }, [(0, import_vue.createTextVNode)("+")])]);
481
+ };
482
+ const hiddenInput = () => [(0, import_vue.createVNode)("input", {
483
+ "type": "file",
484
+ "accept": "image/*",
485
+ "ref": cameraInputRef,
486
+ "multiple": true,
487
+ "onChange": handleInputFiles,
488
+ "class": bem("hidden"),
489
+ "onClick": () => resetInput("photo", "take"),
490
+ "capture": "environment"
491
+ }, null), (0, import_vue.createVNode)("input", {
492
+ "type": "file",
493
+ "accept": "image/*,image/exact",
494
+ "ref": imageInputRef,
495
+ "multiple": true,
496
+ "onChange": handleInputFiles,
497
+ "class": bem("hidden"),
498
+ "onClick": () => resetInput("photo", "pick")
499
+ }, null)];
500
+ const selectAction = (action) => {
501
+ actionVisible.value = false;
502
+ action.func && action.func();
503
+ };
504
+ (0, import_use_expose.useExpose)({
505
+ mediaPickAction,
506
+ handleInputFiles,
507
+ transformImageFiles,
508
+ resetInput,
509
+ previewMedia
510
+ });
511
+ return () => {
512
+ const title = props.showTitle && (0, import_vue.createVNode)("div", {
513
+ "class": bem("title")
514
+ }, [props.title]);
515
+ const actions = [{
516
+ name: "\u62CD\u7167",
517
+ callback: () => mediaPickAction("photo", "take")
518
+ }, {
519
+ name: "\u7167\u7247",
520
+ callback: () => mediaPickAction("photo", "pick")
521
+ }];
522
+ return (0, import_vue.createVNode)("div", {
523
+ "class": bem(),
524
+ "style": itemSizeStyle.value
525
+ }, [title, hiddenInput(), (0, import_vue.createVNode)(import_action_sheet.default, {
526
+ "show": actionVisible.value,
527
+ "onUpdate:show": ($event) => actionVisible.value = $event,
528
+ "actions": actions,
529
+ "description": "\u8BF7\u9009\u62E9",
530
+ "cancel-text": "\u53D6\u6D88",
531
+ "teleport": "body",
532
+ "close-on-click-action": true,
533
+ "onSelect": selectAction
534
+ }, null), (0, import_vue.createVNode)("div", {
535
+ "class": bem("track")
536
+ }, [photoList.value.map(renderPhoto), placeholderList.value.map(renderPlaceholder), renderAdd()])]);
537
+ };
538
+ }
539
+ });
@@ -0,0 +1 @@
1
+ :root{--zt-photo-picker-padding: 12px;--zt-photo-picker-gap: 16px;--zt-photo-picker-item-size: 140px;--zt-photo-picker-radius: 10px;--zt-photo-picker-add-border: 1px dashed #d7deee;--zt-photo-picker-add-color: #9aa8c0;--zt-photo-picker-add-background: #f8f9fc;--zt-photo-picker-delete-background: var(--zt-primary-color);--zt-photo-picker-delete-color: var(--zt-white);--zt-photo-picker-label-background: rgba(var(--zt-gray-rgb), .5);--zt-photo-picker-label-color: var(--zt-white);--zt-photo-picker-title-height: 44px}.zt-photo-picker{box-sizing:border-box;width:100%;height:100%;padding:var(--zt-photo-picker-padding);overflow:hidden}.zt-photo-picker__hidden{display:none}.zt-photo-picker__title{position:relative;height:var(--zt-photo-picker-title-height);line-height:var(--zt-photo-picker-title-height);font-weight:700;font-size:var(--zt-font-size-lg);color:var(--zt-text-color);padding:0 16px}.zt-photo-picker__track{display:flex;flex-wrap:nowrap;align-items:flex-start;gap:var(--zt-photo-picker-gap);width:100%;height:100%;overflow-x:auto;overflow-y:hidden}.zt-photo-picker__track::-webkit-scrollbar{width:0;height:0}.zt-photo-picker__item,.zt-photo-picker__add{position:relative;flex:0 0 var(--zt-photo-picker-item-size);width:var(--zt-photo-picker-item-size);height:var(--zt-photo-picker-item-size);border-radius:var(--zt-photo-picker-radius);box-sizing:border-box;overflow:hidden}.zt-photo-picker__add{display:flex;align-items:center;justify-content:center;padding:0;color:var(--zt-photo-picker-add-color);background:var(--zt-photo-picker-add-background);border:var(--zt-photo-picker-add-border)}.zt-photo-picker__add:disabled{opacity:var(--zt-disabled-opacity)}.zt-photo-picker__add-icon{font-size:48px;line-height:1;font-weight:300}.zt-photo-picker__delete{position:absolute;top:8px;right:8px;display:flex;align-items:center;justify-content:center;width:calc(var(--zt-photo-picker-item-size) * .2);height:calc(var(--zt-photo-picker-item-size) * .2);padding:0;color:var(--zt-photo-picker-delete-color);font-size:calc(var(--zt-photo-picker-item-size) * .15);line-height:1;background:var(--zt-photo-picker-delete-background);border:0;border-radius:50%}.zt-photo-picker .zt-image,.zt-photo-picker__thumbnail{width:100%;height:100%}.zt-photo-picker__label{position:absolute;bottom:0;left:0;box-sizing:border-box;width:100%;height:var(--zt-line-height-lg);line-height:var(--zt-line-height-lg);padding:0 var(--zt-padding-xs);overflow:hidden;text-align:center;border-radius:0 0 4px 4px;font-size:var(--zt-font-size-sm);text-overflow:ellipsis;word-break:break-all;white-space:nowrap;color:var(--zt-photo-picker-label-color);background-color:var(--zt-photo-picker-label-background)}.zt-photo-picker__mask{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--zt-white);background-color:var(--zt-uploader-mask-background);border-radius:4px}.zt-photo-picker__mask-icon{font-size:var(--zt-font-size-xxxl)}.zt-photo-picker__mask-message{margin-top:6px;padding:0 var(--zt-padding-base);font-size:var(--zt-font-size-sm);line-height:var(--zt-uploader-mask-message-line-height)}.zt-photo-picker__loading{width:var(--zt-uploader-loading-icon-size);height:var(--zt-uploader-loading-icon-size);color:var(--zt-uploader-icon-color)}
@@ -0,0 +1,145 @@
1
+ export declare const PhotoPicker: import("../utils").WithInstall<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ disabled: BooleanConstructor;
3
+ showTitle: BooleanConstructor;
4
+ showDownload: BooleanConstructor;
5
+ downloadAction: import("vue").PropType<(params: import("../image-preview/ImagePreview").DownloadActionParams) => boolean>;
6
+ useFileNameAsLabel: BooleanConstructor;
7
+ title: {
8
+ type: import("vue").PropType<string>;
9
+ default: string;
10
+ };
11
+ mediaList: {
12
+ type: import("vue").PropType<import("../media-picker/type").Media[]>;
13
+ default: () => import("../media-picker/type").Media[];
14
+ };
15
+ attachmentHeight: import("vue").PropType<string | number>;
16
+ maxAttachmentCount: {
17
+ type: NumberConstructor;
18
+ default: number;
19
+ };
20
+ maxImageSideLength: {
21
+ type: NumberConstructor;
22
+ default: number;
23
+ };
24
+ maxImageFileSize: {
25
+ type: NumberConstructor;
26
+ default: number;
27
+ };
28
+ maxFileSize: {
29
+ type: NumberConstructor;
30
+ default: number;
31
+ };
32
+ keepFileType: {
33
+ type: BooleanConstructor;
34
+ default: boolean;
35
+ };
36
+ watermarkOptions: {
37
+ type: ObjectConstructor;
38
+ default: () => null;
39
+ };
40
+ allowTakePhoto: {
41
+ type: BooleanConstructor;
42
+ default: true;
43
+ };
44
+ allowPickPhoto: {
45
+ type: BooleanConstructor;
46
+ default: true;
47
+ };
48
+ preview: import("vue").PropType<import("../media-picker/type").MediaPreview>;
49
+ mediaPick: import("vue").PropType<import("../media-picker/type").MediaPick>;
50
+ beforeRead: import("vue").PropType<import("../media-picker/type").MediaBeforeRead>;
51
+ afterRead: import("vue").PropType<import("../media-picker/type").MediaAfterRead>;
52
+ beforeDelete: import("vue").PropType<import("../media-picker/type").MediaBeforeDelete>;
53
+ useWx: BooleanConstructor;
54
+ imageSizeType: {
55
+ type: import("vue").PropType<import("../media-picker/type").MediaSizeType>;
56
+ default: import("../media-picker/type").MediaSizeType;
57
+ };
58
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "processing" | "update:mediaList")[], "delete" | "processing" | "update:mediaList", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
59
+ disabled: BooleanConstructor;
60
+ showTitle: BooleanConstructor;
61
+ showDownload: BooleanConstructor;
62
+ downloadAction: import("vue").PropType<(params: import("../image-preview/ImagePreview").DownloadActionParams) => boolean>;
63
+ useFileNameAsLabel: BooleanConstructor;
64
+ title: {
65
+ type: import("vue").PropType<string>;
66
+ default: string;
67
+ };
68
+ mediaList: {
69
+ type: import("vue").PropType<import("../media-picker/type").Media[]>;
70
+ default: () => import("../media-picker/type").Media[];
71
+ };
72
+ attachmentHeight: import("vue").PropType<string | number>;
73
+ maxAttachmentCount: {
74
+ type: NumberConstructor;
75
+ default: number;
76
+ };
77
+ maxImageSideLength: {
78
+ type: NumberConstructor;
79
+ default: number;
80
+ };
81
+ maxImageFileSize: {
82
+ type: NumberConstructor;
83
+ default: number;
84
+ };
85
+ maxFileSize: {
86
+ type: NumberConstructor;
87
+ default: number;
88
+ };
89
+ keepFileType: {
90
+ type: BooleanConstructor;
91
+ default: boolean;
92
+ };
93
+ watermarkOptions: {
94
+ type: ObjectConstructor;
95
+ default: () => null;
96
+ };
97
+ allowTakePhoto: {
98
+ type: BooleanConstructor;
99
+ default: true;
100
+ };
101
+ allowPickPhoto: {
102
+ type: BooleanConstructor;
103
+ default: true;
104
+ };
105
+ preview: import("vue").PropType<import("../media-picker/type").MediaPreview>;
106
+ mediaPick: import("vue").PropType<import("../media-picker/type").MediaPick>;
107
+ beforeRead: import("vue").PropType<import("../media-picker/type").MediaBeforeRead>;
108
+ afterRead: import("vue").PropType<import("../media-picker/type").MediaAfterRead>;
109
+ beforeDelete: import("vue").PropType<import("../media-picker/type").MediaBeforeDelete>;
110
+ useWx: BooleanConstructor;
111
+ imageSizeType: {
112
+ type: import("vue").PropType<import("../media-picker/type").MediaSizeType>;
113
+ default: import("../media-picker/type").MediaSizeType;
114
+ };
115
+ }>> & Readonly<{
116
+ onDelete?: ((...args: any[]) => any) | undefined;
117
+ onProcessing?: ((...args: any[]) => any) | undefined;
118
+ "onUpdate:mediaList"?: ((...args: any[]) => any) | undefined;
119
+ }>, {
120
+ title: string;
121
+ disabled: boolean;
122
+ showTitle: boolean;
123
+ showDownload: boolean;
124
+ useFileNameAsLabel: boolean;
125
+ mediaList: import("../media-picker/type").Media[];
126
+ maxImageSideLength: number;
127
+ maxImageFileSize: number;
128
+ maxFileSize: number;
129
+ keepFileType: boolean;
130
+ watermarkOptions: Record<string, any>;
131
+ allowTakePhoto: boolean;
132
+ allowPickPhoto: boolean;
133
+ useWx: boolean;
134
+ imageSizeType: import("../media-picker/type").MediaSizeType;
135
+ maxAttachmentCount: number;
136
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
137
+ export default PhotoPicker;
138
+ export type { PhotoPickerProps, PhotoPickerInstance } from './PhotoPicker';
139
+ export type { Media, MediaType, MediaAddType, MediaUploadStatus, MediaPreview, MediaPick, MediaBeforeRead, MediaAfterRead, MediaBeforeDelete, MediaSizeType, } from '../media-picker/type';
140
+ export { defaultMedia } from '../media-picker/type';
141
+ declare module 'vue' {
142
+ interface GlobalComponents {
143
+ ZtPhotoPicker: typeof PhotoPicker;
144
+ }
145
+ }