zartui 3.1.87 → 3.1.89
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.
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/media-picker/MediaPicker.d.ts +14 -1
- package/es/media-picker/MediaPicker.mjs +95 -8
- package/es/media-picker/index.css +1 -1
- package/es/media-picker/index.d.ts +10 -1
- package/es/media-picker/type.d.ts +10 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/media-picker/MediaPicker.d.ts +14 -1
- package/lib/media-picker/MediaPicker.js +94 -7
- package/lib/media-picker/index.css +1 -1
- package/lib/media-picker/index.d.ts +10 -1
- package/lib/media-picker/type.d.ts +10 -0
- package/lib/web-types.json +1 -1
- package/lib/zartui.cjs.js +95 -8
- package/lib/zartui.es.js +95 -8
- package/lib/zartui.js +95 -8
- package/lib/zartui.min.js +1 -1
- package/package.json +28 -28
package/lib/zartui.cjs.js
CHANGED
|
@@ -16251,6 +16251,7 @@ const COMPATIBLE_TYPE_MAPPINGS = {
|
|
|
16251
16251
|
"m4a": /* @__PURE__ */ new Set(["mp4", "mp4a", "x-m4a"])
|
|
16252
16252
|
};
|
|
16253
16253
|
const mediaPickerProps = {
|
|
16254
|
+
variant: makeStringProp("default"),
|
|
16254
16255
|
sortable: {
|
|
16255
16256
|
type: Boolean,
|
|
16256
16257
|
default: false
|
|
@@ -16324,6 +16325,7 @@ var stdin_default$D = vue.defineComponent({
|
|
|
16324
16325
|
}) {
|
|
16325
16326
|
const videoOptionsVisible = vue.ref(false);
|
|
16326
16327
|
const audioOptionsVisible = vue.ref(false);
|
|
16328
|
+
const photoOptionsVisible = vue.ref(false);
|
|
16327
16329
|
const actionVisible = vue.ref(false);
|
|
16328
16330
|
const mediaPlayerVisible = vue.ref(false);
|
|
16329
16331
|
const mediaTypeToPlay = vue.ref("file");
|
|
@@ -16338,7 +16340,10 @@ var stdin_default$D = vue.defineComponent({
|
|
|
16338
16340
|
const gridRef = vue.ref();
|
|
16339
16341
|
const mediaListPlaceholder = vue.ref([]);
|
|
16340
16342
|
const sort2 = vue.ref();
|
|
16341
|
-
const
|
|
16343
|
+
const isAttachmentVariant = vue.computed(() => props.variant === "attachment");
|
|
16344
|
+
const attachmentMediaList = vue.computed(() => props.mediaList.filter((media) => media.type === "photo"));
|
|
16345
|
+
const attachmentMediaListPlaceholder = vue.computed(() => mediaListPlaceholder.value.filter((media) => media.type === "photo"));
|
|
16346
|
+
const shouldIsolateSortableTouch = () => !isAttachmentVariant.value && props.sortable && props.mediaList.length > 0;
|
|
16342
16347
|
const stopSortableTouchStartPropagation = (event) => {
|
|
16343
16348
|
if (!shouldIsolateSortableTouch()) {
|
|
16344
16349
|
return;
|
|
@@ -16354,7 +16359,7 @@ var stdin_default$D = vue.defineComponent({
|
|
|
16354
16359
|
};
|
|
16355
16360
|
const initSortable = () => __async$2(this, null, function* () {
|
|
16356
16361
|
var _a;
|
|
16357
|
-
if (sort2.value || !props.sortable || !props.mediaList.length)
|
|
16362
|
+
if (sort2.value || isAttachmentVariant.value || !props.sortable || !props.mediaList.length)
|
|
16358
16363
|
return;
|
|
16359
16364
|
yield vue.nextTick();
|
|
16360
16365
|
const gridEl = (_a = gridRef.value) == null ? void 0 : _a.$el;
|
|
@@ -16470,6 +16475,19 @@ var stdin_default$D = vue.defineComponent({
|
|
|
16470
16475
|
};
|
|
16471
16476
|
const imageList = vue.computed(() => props.mediaList.filter((media) => media.type === "photo"));
|
|
16472
16477
|
const actionOptions = vue.computed(() => {
|
|
16478
|
+
if (photoOptionsVisible.value) {
|
|
16479
|
+
return [{
|
|
16480
|
+
name: "拍照",
|
|
16481
|
+
callback: () => {
|
|
16482
|
+
mediaPickAction("photo", "take");
|
|
16483
|
+
}
|
|
16484
|
+
}, {
|
|
16485
|
+
name: "照片",
|
|
16486
|
+
callback: () => {
|
|
16487
|
+
mediaPickAction("photo", "pick");
|
|
16488
|
+
}
|
|
16489
|
+
}];
|
|
16490
|
+
}
|
|
16473
16491
|
if (videoOptionsVisible.value) {
|
|
16474
16492
|
return [{
|
|
16475
16493
|
name: "拍摄",
|
|
@@ -16921,6 +16939,40 @@ var stdin_default$D = vue.defineComponent({
|
|
|
16921
16939
|
}
|
|
16922
16940
|
return buttons;
|
|
16923
16941
|
};
|
|
16942
|
+
const renderAttachmentAdd = () => {
|
|
16943
|
+
const canTakePhoto = props.allowTakePhoto;
|
|
16944
|
+
const canPickPhoto = props.allowPickPhoto;
|
|
16945
|
+
if (!canTakePhoto && !canPickPhoto) {
|
|
16946
|
+
return;
|
|
16947
|
+
}
|
|
16948
|
+
if (props.allowTakePhoto && props.allowPickPhoto) {
|
|
16949
|
+
return vue.createVNode("button", {
|
|
16950
|
+
"type": "button",
|
|
16951
|
+
"class": bem$v("attachment-add"),
|
|
16952
|
+
"disabled": props.disabled,
|
|
16953
|
+
"onClick": () => {
|
|
16954
|
+
if (props.disabled) {
|
|
16955
|
+
return;
|
|
16956
|
+
}
|
|
16957
|
+
actionVisible.value = true;
|
|
16958
|
+
photoOptionsVisible.value = true;
|
|
16959
|
+
videoOptionsVisible.value = false;
|
|
16960
|
+
audioOptionsVisible.value = false;
|
|
16961
|
+
}
|
|
16962
|
+
}, [vue.createVNode("span", {
|
|
16963
|
+
"class": bem$v("attachment-add-icon")
|
|
16964
|
+
}, [vue.createTextVNode("+")])]);
|
|
16965
|
+
}
|
|
16966
|
+
const addType = canTakePhoto ? "take" : "pick";
|
|
16967
|
+
return vue.createVNode("button", {
|
|
16968
|
+
"type": "button",
|
|
16969
|
+
"class": bem$v("attachment-add"),
|
|
16970
|
+
"disabled": props.disabled,
|
|
16971
|
+
"onClick": () => mediaPickAction("photo", addType)
|
|
16972
|
+
}, [vue.createVNode("span", {
|
|
16973
|
+
"class": bem$v("attachment-add-icon")
|
|
16974
|
+
}, [vue.createTextVNode("+")])]);
|
|
16975
|
+
};
|
|
16924
16976
|
const genThumbnailMask = (media) => {
|
|
16925
16977
|
const {
|
|
16926
16978
|
status,
|
|
@@ -17087,12 +17139,45 @@ var stdin_default$D = vue.defineComponent({
|
|
|
17087
17139
|
default: () => [renderMediaThumbnail(media), renderMediaLabel(media), genThumbnailMask(media), deleteIcon]
|
|
17088
17140
|
});
|
|
17089
17141
|
});
|
|
17142
|
+
const renderAttachmentDelete = (media, index2) => {
|
|
17143
|
+
if (!media.deletable || media.status === "uploading") {
|
|
17144
|
+
return;
|
|
17145
|
+
}
|
|
17146
|
+
return vue.createVNode("button", {
|
|
17147
|
+
"type": "button",
|
|
17148
|
+
"class": bem$v("attachment-delete"),
|
|
17149
|
+
"onClick": (event) => {
|
|
17150
|
+
event.stopPropagation();
|
|
17151
|
+
onDelete(media, index2);
|
|
17152
|
+
}
|
|
17153
|
+
}, [vue.createTextVNode("×")]);
|
|
17154
|
+
};
|
|
17155
|
+
const renderAttachmentMedia = (media) => {
|
|
17156
|
+
const index2 = props.mediaList.indexOf(media);
|
|
17157
|
+
return vue.createVNode("div", {
|
|
17158
|
+
"key": media.uniqueCode,
|
|
17159
|
+
"class": bem$v("attachment-item"),
|
|
17160
|
+
"onClick": () => previewMedia(index2)
|
|
17161
|
+
}, [renderMediaThumbnail(media), renderMediaLabel(media), genThumbnailMask(media), renderAttachmentDelete(media, index2)]);
|
|
17162
|
+
};
|
|
17163
|
+
const renderAttachmentPlaceholder = (media) => vue.createVNode("div", {
|
|
17164
|
+
"key": media.uniqueCode || media.fileName,
|
|
17165
|
+
"class": bem$v("attachment-item")
|
|
17166
|
+
}, [renderMediaThumbnail(media), renderMediaLabel(media), genThumbnailMask(media)]);
|
|
17167
|
+
const renderAttachment = () => vue.createVNode("div", {
|
|
17168
|
+
"class": bem$v("attachment")
|
|
17169
|
+
}, [vue.createVNode("div", {
|
|
17170
|
+
"class": bem$v("attachment-track")
|
|
17171
|
+
}, [attachmentMediaList.value.map(renderAttachmentMedia), attachmentMediaListPlaceholder.value.map(renderAttachmentPlaceholder), renderAttachmentAdd()])]);
|
|
17090
17172
|
const selectAction = (action) => {
|
|
17091
17173
|
actionVisible.value = false;
|
|
17174
|
+
photoOptionsVisible.value = false;
|
|
17175
|
+
videoOptionsVisible.value = false;
|
|
17176
|
+
audioOptionsVisible.value = false;
|
|
17092
17177
|
action.func && action.func();
|
|
17093
17178
|
};
|
|
17094
|
-
vue.watch(() => [props.sortable, props.mediaList.length], (_0) => __async$2(this, [_0], function* ([sortable, mediaCount]) {
|
|
17095
|
-
if (!sortable || !mediaCount) {
|
|
17179
|
+
vue.watch(() => [props.sortable, props.mediaList.length, props.variant], (_0) => __async$2(this, [_0], function* ([sortable, mediaCount]) {
|
|
17180
|
+
if (isAttachmentVariant.value || !sortable || !mediaCount) {
|
|
17096
17181
|
destroySortable();
|
|
17097
17182
|
return;
|
|
17098
17183
|
}
|
|
@@ -17116,7 +17201,9 @@ var stdin_default$D = vue.defineComponent({
|
|
|
17116
17201
|
}, [props.title]);
|
|
17117
17202
|
const showButtons = props.allowTakePhoto || props.allowPickPhoto || props.allowTakeVideo || props.allowPickVideo || props.allowTakeAudio || props.allowPickAudio || props.allowPickFile;
|
|
17118
17203
|
return vue.createVNode("div", {
|
|
17119
|
-
"class": bem$v(
|
|
17204
|
+
"class": bem$v({
|
|
17205
|
+
attachment: isAttachmentVariant.value
|
|
17206
|
+
})
|
|
17120
17207
|
}, [title, hiddenInput(), vue.createVNode(stdin_default$M, vue.mergeProps({
|
|
17121
17208
|
"show": mediaPlayerVisible.value,
|
|
17122
17209
|
"onUpdate:show": ($event) => mediaPlayerVisible.value = $event,
|
|
@@ -17132,7 +17219,7 @@ var stdin_default$D = vue.defineComponent({
|
|
|
17132
17219
|
"teleport": "body",
|
|
17133
17220
|
"close-on-click-action": true,
|
|
17134
17221
|
"onSelect": selectAction
|
|
17135
|
-
}, null), vue.withDirectives(vue.createVNode("div", {
|
|
17222
|
+
}, null), isAttachmentVariant.value ? renderAttachment() : vue.createVNode(vue.Fragment, null, [vue.withDirectives(vue.createVNode("div", {
|
|
17136
17223
|
"class": bem$v("line")
|
|
17137
17224
|
}, [renderButtons(), slots["extend"] ? slots.extend() : ""]), [[vue.vShow, showButtons]]), vue.withDirectives(vue.createVNode(stdin_default$Y, {
|
|
17138
17225
|
"ref": gridRef,
|
|
@@ -17152,7 +17239,7 @@ var stdin_default$D = vue.defineComponent({
|
|
|
17152
17239
|
"class": bem$v("grid")
|
|
17153
17240
|
}, {
|
|
17154
17241
|
default: () => [renderMediaListPlaceholder()]
|
|
17155
|
-
}), [[vue.vShow, mediaListPlaceholder.value.length]])]);
|
|
17242
|
+
}), [[vue.vShow, mediaListPlaceholder.value.length]])])]);
|
|
17156
17243
|
};
|
|
17157
17244
|
}
|
|
17158
17245
|
});
|
|
@@ -23864,7 +23951,7 @@ const Lazyload = {
|
|
|
23864
23951
|
});
|
|
23865
23952
|
}
|
|
23866
23953
|
};
|
|
23867
|
-
const version = "3.1.
|
|
23954
|
+
const version = "3.1.89";
|
|
23868
23955
|
function install(app) {
|
|
23869
23956
|
const components = [
|
|
23870
23957
|
ActionSheet,
|
package/lib/zartui.es.js
CHANGED
|
@@ -16249,6 +16249,7 @@ const COMPATIBLE_TYPE_MAPPINGS = {
|
|
|
16249
16249
|
"m4a": /* @__PURE__ */ new Set(["mp4", "mp4a", "x-m4a"])
|
|
16250
16250
|
};
|
|
16251
16251
|
const mediaPickerProps = {
|
|
16252
|
+
variant: makeStringProp("default"),
|
|
16252
16253
|
sortable: {
|
|
16253
16254
|
type: Boolean,
|
|
16254
16255
|
default: false
|
|
@@ -16322,6 +16323,7 @@ var stdin_default$D = defineComponent({
|
|
|
16322
16323
|
}) {
|
|
16323
16324
|
const videoOptionsVisible = ref(false);
|
|
16324
16325
|
const audioOptionsVisible = ref(false);
|
|
16326
|
+
const photoOptionsVisible = ref(false);
|
|
16325
16327
|
const actionVisible = ref(false);
|
|
16326
16328
|
const mediaPlayerVisible = ref(false);
|
|
16327
16329
|
const mediaTypeToPlay = ref("file");
|
|
@@ -16336,7 +16338,10 @@ var stdin_default$D = defineComponent({
|
|
|
16336
16338
|
const gridRef = ref();
|
|
16337
16339
|
const mediaListPlaceholder = ref([]);
|
|
16338
16340
|
const sort2 = ref();
|
|
16339
|
-
const
|
|
16341
|
+
const isAttachmentVariant = computed(() => props.variant === "attachment");
|
|
16342
|
+
const attachmentMediaList = computed(() => props.mediaList.filter((media) => media.type === "photo"));
|
|
16343
|
+
const attachmentMediaListPlaceholder = computed(() => mediaListPlaceholder.value.filter((media) => media.type === "photo"));
|
|
16344
|
+
const shouldIsolateSortableTouch = () => !isAttachmentVariant.value && props.sortable && props.mediaList.length > 0;
|
|
16340
16345
|
const stopSortableTouchStartPropagation = (event) => {
|
|
16341
16346
|
if (!shouldIsolateSortableTouch()) {
|
|
16342
16347
|
return;
|
|
@@ -16352,7 +16357,7 @@ var stdin_default$D = defineComponent({
|
|
|
16352
16357
|
};
|
|
16353
16358
|
const initSortable = () => __async$2(this, null, function* () {
|
|
16354
16359
|
var _a;
|
|
16355
|
-
if (sort2.value || !props.sortable || !props.mediaList.length)
|
|
16360
|
+
if (sort2.value || isAttachmentVariant.value || !props.sortable || !props.mediaList.length)
|
|
16356
16361
|
return;
|
|
16357
16362
|
yield nextTick();
|
|
16358
16363
|
const gridEl = (_a = gridRef.value) == null ? void 0 : _a.$el;
|
|
@@ -16468,6 +16473,19 @@ var stdin_default$D = defineComponent({
|
|
|
16468
16473
|
};
|
|
16469
16474
|
const imageList = computed(() => props.mediaList.filter((media) => media.type === "photo"));
|
|
16470
16475
|
const actionOptions = computed(() => {
|
|
16476
|
+
if (photoOptionsVisible.value) {
|
|
16477
|
+
return [{
|
|
16478
|
+
name: "拍照",
|
|
16479
|
+
callback: () => {
|
|
16480
|
+
mediaPickAction("photo", "take");
|
|
16481
|
+
}
|
|
16482
|
+
}, {
|
|
16483
|
+
name: "照片",
|
|
16484
|
+
callback: () => {
|
|
16485
|
+
mediaPickAction("photo", "pick");
|
|
16486
|
+
}
|
|
16487
|
+
}];
|
|
16488
|
+
}
|
|
16471
16489
|
if (videoOptionsVisible.value) {
|
|
16472
16490
|
return [{
|
|
16473
16491
|
name: "拍摄",
|
|
@@ -16919,6 +16937,40 @@ var stdin_default$D = defineComponent({
|
|
|
16919
16937
|
}
|
|
16920
16938
|
return buttons;
|
|
16921
16939
|
};
|
|
16940
|
+
const renderAttachmentAdd = () => {
|
|
16941
|
+
const canTakePhoto = props.allowTakePhoto;
|
|
16942
|
+
const canPickPhoto = props.allowPickPhoto;
|
|
16943
|
+
if (!canTakePhoto && !canPickPhoto) {
|
|
16944
|
+
return;
|
|
16945
|
+
}
|
|
16946
|
+
if (props.allowTakePhoto && props.allowPickPhoto) {
|
|
16947
|
+
return createVNode("button", {
|
|
16948
|
+
"type": "button",
|
|
16949
|
+
"class": bem$v("attachment-add"),
|
|
16950
|
+
"disabled": props.disabled,
|
|
16951
|
+
"onClick": () => {
|
|
16952
|
+
if (props.disabled) {
|
|
16953
|
+
return;
|
|
16954
|
+
}
|
|
16955
|
+
actionVisible.value = true;
|
|
16956
|
+
photoOptionsVisible.value = true;
|
|
16957
|
+
videoOptionsVisible.value = false;
|
|
16958
|
+
audioOptionsVisible.value = false;
|
|
16959
|
+
}
|
|
16960
|
+
}, [createVNode("span", {
|
|
16961
|
+
"class": bem$v("attachment-add-icon")
|
|
16962
|
+
}, [createTextVNode("+")])]);
|
|
16963
|
+
}
|
|
16964
|
+
const addType = canTakePhoto ? "take" : "pick";
|
|
16965
|
+
return createVNode("button", {
|
|
16966
|
+
"type": "button",
|
|
16967
|
+
"class": bem$v("attachment-add"),
|
|
16968
|
+
"disabled": props.disabled,
|
|
16969
|
+
"onClick": () => mediaPickAction("photo", addType)
|
|
16970
|
+
}, [createVNode("span", {
|
|
16971
|
+
"class": bem$v("attachment-add-icon")
|
|
16972
|
+
}, [createTextVNode("+")])]);
|
|
16973
|
+
};
|
|
16922
16974
|
const genThumbnailMask = (media) => {
|
|
16923
16975
|
const {
|
|
16924
16976
|
status,
|
|
@@ -17085,12 +17137,45 @@ var stdin_default$D = defineComponent({
|
|
|
17085
17137
|
default: () => [renderMediaThumbnail(media), renderMediaLabel(media), genThumbnailMask(media), deleteIcon]
|
|
17086
17138
|
});
|
|
17087
17139
|
});
|
|
17140
|
+
const renderAttachmentDelete = (media, index2) => {
|
|
17141
|
+
if (!media.deletable || media.status === "uploading") {
|
|
17142
|
+
return;
|
|
17143
|
+
}
|
|
17144
|
+
return createVNode("button", {
|
|
17145
|
+
"type": "button",
|
|
17146
|
+
"class": bem$v("attachment-delete"),
|
|
17147
|
+
"onClick": (event) => {
|
|
17148
|
+
event.stopPropagation();
|
|
17149
|
+
onDelete(media, index2);
|
|
17150
|
+
}
|
|
17151
|
+
}, [createTextVNode("×")]);
|
|
17152
|
+
};
|
|
17153
|
+
const renderAttachmentMedia = (media) => {
|
|
17154
|
+
const index2 = props.mediaList.indexOf(media);
|
|
17155
|
+
return createVNode("div", {
|
|
17156
|
+
"key": media.uniqueCode,
|
|
17157
|
+
"class": bem$v("attachment-item"),
|
|
17158
|
+
"onClick": () => previewMedia(index2)
|
|
17159
|
+
}, [renderMediaThumbnail(media), renderMediaLabel(media), genThumbnailMask(media), renderAttachmentDelete(media, index2)]);
|
|
17160
|
+
};
|
|
17161
|
+
const renderAttachmentPlaceholder = (media) => createVNode("div", {
|
|
17162
|
+
"key": media.uniqueCode || media.fileName,
|
|
17163
|
+
"class": bem$v("attachment-item")
|
|
17164
|
+
}, [renderMediaThumbnail(media), renderMediaLabel(media), genThumbnailMask(media)]);
|
|
17165
|
+
const renderAttachment = () => createVNode("div", {
|
|
17166
|
+
"class": bem$v("attachment")
|
|
17167
|
+
}, [createVNode("div", {
|
|
17168
|
+
"class": bem$v("attachment-track")
|
|
17169
|
+
}, [attachmentMediaList.value.map(renderAttachmentMedia), attachmentMediaListPlaceholder.value.map(renderAttachmentPlaceholder), renderAttachmentAdd()])]);
|
|
17088
17170
|
const selectAction = (action) => {
|
|
17089
17171
|
actionVisible.value = false;
|
|
17172
|
+
photoOptionsVisible.value = false;
|
|
17173
|
+
videoOptionsVisible.value = false;
|
|
17174
|
+
audioOptionsVisible.value = false;
|
|
17090
17175
|
action.func && action.func();
|
|
17091
17176
|
};
|
|
17092
|
-
watch(() => [props.sortable, props.mediaList.length], (_0) => __async$2(this, [_0], function* ([sortable, mediaCount]) {
|
|
17093
|
-
if (!sortable || !mediaCount) {
|
|
17177
|
+
watch(() => [props.sortable, props.mediaList.length, props.variant], (_0) => __async$2(this, [_0], function* ([sortable, mediaCount]) {
|
|
17178
|
+
if (isAttachmentVariant.value || !sortable || !mediaCount) {
|
|
17094
17179
|
destroySortable();
|
|
17095
17180
|
return;
|
|
17096
17181
|
}
|
|
@@ -17114,7 +17199,9 @@ var stdin_default$D = defineComponent({
|
|
|
17114
17199
|
}, [props.title]);
|
|
17115
17200
|
const showButtons = props.allowTakePhoto || props.allowPickPhoto || props.allowTakeVideo || props.allowPickVideo || props.allowTakeAudio || props.allowPickAudio || props.allowPickFile;
|
|
17116
17201
|
return createVNode("div", {
|
|
17117
|
-
"class": bem$v(
|
|
17202
|
+
"class": bem$v({
|
|
17203
|
+
attachment: isAttachmentVariant.value
|
|
17204
|
+
})
|
|
17118
17205
|
}, [title, hiddenInput(), createVNode(stdin_default$M, mergeProps({
|
|
17119
17206
|
"show": mediaPlayerVisible.value,
|
|
17120
17207
|
"onUpdate:show": ($event) => mediaPlayerVisible.value = $event,
|
|
@@ -17130,7 +17217,7 @@ var stdin_default$D = defineComponent({
|
|
|
17130
17217
|
"teleport": "body",
|
|
17131
17218
|
"close-on-click-action": true,
|
|
17132
17219
|
"onSelect": selectAction
|
|
17133
|
-
}, null), withDirectives(createVNode("div", {
|
|
17220
|
+
}, null), isAttachmentVariant.value ? renderAttachment() : createVNode(Fragment, null, [withDirectives(createVNode("div", {
|
|
17134
17221
|
"class": bem$v("line")
|
|
17135
17222
|
}, [renderButtons(), slots["extend"] ? slots.extend() : ""]), [[vShow, showButtons]]), withDirectives(createVNode(stdin_default$Y, {
|
|
17136
17223
|
"ref": gridRef,
|
|
@@ -17150,7 +17237,7 @@ var stdin_default$D = defineComponent({
|
|
|
17150
17237
|
"class": bem$v("grid")
|
|
17151
17238
|
}, {
|
|
17152
17239
|
default: () => [renderMediaListPlaceholder()]
|
|
17153
|
-
}), [[vShow, mediaListPlaceholder.value.length]])]);
|
|
17240
|
+
}), [[vShow, mediaListPlaceholder.value.length]])])]);
|
|
17154
17241
|
};
|
|
17155
17242
|
}
|
|
17156
17243
|
});
|
|
@@ -23862,7 +23949,7 @@ const Lazyload = {
|
|
|
23862
23949
|
});
|
|
23863
23950
|
}
|
|
23864
23951
|
};
|
|
23865
|
-
const version = "3.1.
|
|
23952
|
+
const version = "3.1.89";
|
|
23866
23953
|
function install(app) {
|
|
23867
23954
|
const components = [
|
|
23868
23955
|
ActionSheet,
|
package/lib/zartui.js
CHANGED
|
@@ -21480,6 +21480,7 @@ var __publicField = (obj, key, value) => {
|
|
|
21480
21480
|
"m4a": /* @__PURE__ */ new Set(["mp4", "mp4a", "x-m4a"])
|
|
21481
21481
|
};
|
|
21482
21482
|
const mediaPickerProps = {
|
|
21483
|
+
variant: makeStringProp("default"),
|
|
21483
21484
|
sortable: {
|
|
21484
21485
|
type: Boolean,
|
|
21485
21486
|
default: false
|
|
@@ -21553,6 +21554,7 @@ var __publicField = (obj, key, value) => {
|
|
|
21553
21554
|
}) {
|
|
21554
21555
|
const videoOptionsVisible = vue.ref(false);
|
|
21555
21556
|
const audioOptionsVisible = vue.ref(false);
|
|
21557
|
+
const photoOptionsVisible = vue.ref(false);
|
|
21556
21558
|
const actionVisible = vue.ref(false);
|
|
21557
21559
|
const mediaPlayerVisible = vue.ref(false);
|
|
21558
21560
|
const mediaTypeToPlay = vue.ref("file");
|
|
@@ -21567,7 +21569,10 @@ var __publicField = (obj, key, value) => {
|
|
|
21567
21569
|
const gridRef = vue.ref();
|
|
21568
21570
|
const mediaListPlaceholder = vue.ref([]);
|
|
21569
21571
|
const sort = vue.ref();
|
|
21570
|
-
const
|
|
21572
|
+
const isAttachmentVariant = vue.computed(() => props.variant === "attachment");
|
|
21573
|
+
const attachmentMediaList = vue.computed(() => props.mediaList.filter((media) => media.type === "photo"));
|
|
21574
|
+
const attachmentMediaListPlaceholder = vue.computed(() => mediaListPlaceholder.value.filter((media) => media.type === "photo"));
|
|
21575
|
+
const shouldIsolateSortableTouch = () => !isAttachmentVariant.value && props.sortable && props.mediaList.length > 0;
|
|
21571
21576
|
const stopSortableTouchStartPropagation = (event) => {
|
|
21572
21577
|
if (!shouldIsolateSortableTouch()) {
|
|
21573
21578
|
return;
|
|
@@ -21583,7 +21588,7 @@ var __publicField = (obj, key, value) => {
|
|
|
21583
21588
|
};
|
|
21584
21589
|
const initSortable = () => __async$2(this, null, function* () {
|
|
21585
21590
|
var _a;
|
|
21586
|
-
if (sort.value || !props.sortable || !props.mediaList.length)
|
|
21591
|
+
if (sort.value || isAttachmentVariant.value || !props.sortable || !props.mediaList.length)
|
|
21587
21592
|
return;
|
|
21588
21593
|
yield vue.nextTick();
|
|
21589
21594
|
const gridEl = (_a = gridRef.value) == null ? void 0 : _a.$el;
|
|
@@ -21699,6 +21704,19 @@ var __publicField = (obj, key, value) => {
|
|
|
21699
21704
|
};
|
|
21700
21705
|
const imageList = vue.computed(() => props.mediaList.filter((media) => media.type === "photo"));
|
|
21701
21706
|
const actionOptions = vue.computed(() => {
|
|
21707
|
+
if (photoOptionsVisible.value) {
|
|
21708
|
+
return [{
|
|
21709
|
+
name: "拍照",
|
|
21710
|
+
callback: () => {
|
|
21711
|
+
mediaPickAction("photo", "take");
|
|
21712
|
+
}
|
|
21713
|
+
}, {
|
|
21714
|
+
name: "照片",
|
|
21715
|
+
callback: () => {
|
|
21716
|
+
mediaPickAction("photo", "pick");
|
|
21717
|
+
}
|
|
21718
|
+
}];
|
|
21719
|
+
}
|
|
21702
21720
|
if (videoOptionsVisible.value) {
|
|
21703
21721
|
return [{
|
|
21704
21722
|
name: "拍摄",
|
|
@@ -22150,6 +22168,40 @@ var __publicField = (obj, key, value) => {
|
|
|
22150
22168
|
}
|
|
22151
22169
|
return buttons;
|
|
22152
22170
|
};
|
|
22171
|
+
const renderAttachmentAdd = () => {
|
|
22172
|
+
const canTakePhoto = props.allowTakePhoto;
|
|
22173
|
+
const canPickPhoto = props.allowPickPhoto;
|
|
22174
|
+
if (!canTakePhoto && !canPickPhoto) {
|
|
22175
|
+
return;
|
|
22176
|
+
}
|
|
22177
|
+
if (props.allowTakePhoto && props.allowPickPhoto) {
|
|
22178
|
+
return vue.createVNode("button", {
|
|
22179
|
+
"type": "button",
|
|
22180
|
+
"class": bem$v("attachment-add"),
|
|
22181
|
+
"disabled": props.disabled,
|
|
22182
|
+
"onClick": () => {
|
|
22183
|
+
if (props.disabled) {
|
|
22184
|
+
return;
|
|
22185
|
+
}
|
|
22186
|
+
actionVisible.value = true;
|
|
22187
|
+
photoOptionsVisible.value = true;
|
|
22188
|
+
videoOptionsVisible.value = false;
|
|
22189
|
+
audioOptionsVisible.value = false;
|
|
22190
|
+
}
|
|
22191
|
+
}, [vue.createVNode("span", {
|
|
22192
|
+
"class": bem$v("attachment-add-icon")
|
|
22193
|
+
}, [vue.createTextVNode("+")])]);
|
|
22194
|
+
}
|
|
22195
|
+
const addType = canTakePhoto ? "take" : "pick";
|
|
22196
|
+
return vue.createVNode("button", {
|
|
22197
|
+
"type": "button",
|
|
22198
|
+
"class": bem$v("attachment-add"),
|
|
22199
|
+
"disabled": props.disabled,
|
|
22200
|
+
"onClick": () => mediaPickAction("photo", addType)
|
|
22201
|
+
}, [vue.createVNode("span", {
|
|
22202
|
+
"class": bem$v("attachment-add-icon")
|
|
22203
|
+
}, [vue.createTextVNode("+")])]);
|
|
22204
|
+
};
|
|
22153
22205
|
const genThumbnailMask = (media) => {
|
|
22154
22206
|
const {
|
|
22155
22207
|
status,
|
|
@@ -22316,12 +22368,45 @@ var __publicField = (obj, key, value) => {
|
|
|
22316
22368
|
default: () => [renderMediaThumbnail(media), renderMediaLabel(media), genThumbnailMask(media), deleteIcon]
|
|
22317
22369
|
});
|
|
22318
22370
|
});
|
|
22371
|
+
const renderAttachmentDelete = (media, index2) => {
|
|
22372
|
+
if (!media.deletable || media.status === "uploading") {
|
|
22373
|
+
return;
|
|
22374
|
+
}
|
|
22375
|
+
return vue.createVNode("button", {
|
|
22376
|
+
"type": "button",
|
|
22377
|
+
"class": bem$v("attachment-delete"),
|
|
22378
|
+
"onClick": (event) => {
|
|
22379
|
+
event.stopPropagation();
|
|
22380
|
+
onDelete(media, index2);
|
|
22381
|
+
}
|
|
22382
|
+
}, [vue.createTextVNode("×")]);
|
|
22383
|
+
};
|
|
22384
|
+
const renderAttachmentMedia = (media) => {
|
|
22385
|
+
const index2 = props.mediaList.indexOf(media);
|
|
22386
|
+
return vue.createVNode("div", {
|
|
22387
|
+
"key": media.uniqueCode,
|
|
22388
|
+
"class": bem$v("attachment-item"),
|
|
22389
|
+
"onClick": () => previewMedia(index2)
|
|
22390
|
+
}, [renderMediaThumbnail(media), renderMediaLabel(media), genThumbnailMask(media), renderAttachmentDelete(media, index2)]);
|
|
22391
|
+
};
|
|
22392
|
+
const renderAttachmentPlaceholder = (media) => vue.createVNode("div", {
|
|
22393
|
+
"key": media.uniqueCode || media.fileName,
|
|
22394
|
+
"class": bem$v("attachment-item")
|
|
22395
|
+
}, [renderMediaThumbnail(media), renderMediaLabel(media), genThumbnailMask(media)]);
|
|
22396
|
+
const renderAttachment = () => vue.createVNode("div", {
|
|
22397
|
+
"class": bem$v("attachment")
|
|
22398
|
+
}, [vue.createVNode("div", {
|
|
22399
|
+
"class": bem$v("attachment-track")
|
|
22400
|
+
}, [attachmentMediaList.value.map(renderAttachmentMedia), attachmentMediaListPlaceholder.value.map(renderAttachmentPlaceholder), renderAttachmentAdd()])]);
|
|
22319
22401
|
const selectAction = (action) => {
|
|
22320
22402
|
actionVisible.value = false;
|
|
22403
|
+
photoOptionsVisible.value = false;
|
|
22404
|
+
videoOptionsVisible.value = false;
|
|
22405
|
+
audioOptionsVisible.value = false;
|
|
22321
22406
|
action.func && action.func();
|
|
22322
22407
|
};
|
|
22323
|
-
vue.watch(() => [props.sortable, props.mediaList.length], (_0) => __async$2(this, [_0], function* ([sortable, mediaCount]) {
|
|
22324
|
-
if (!sortable || !mediaCount) {
|
|
22408
|
+
vue.watch(() => [props.sortable, props.mediaList.length, props.variant], (_0) => __async$2(this, [_0], function* ([sortable, mediaCount]) {
|
|
22409
|
+
if (isAttachmentVariant.value || !sortable || !mediaCount) {
|
|
22325
22410
|
destroySortable();
|
|
22326
22411
|
return;
|
|
22327
22412
|
}
|
|
@@ -22345,7 +22430,9 @@ var __publicField = (obj, key, value) => {
|
|
|
22345
22430
|
}, [props.title]);
|
|
22346
22431
|
const showButtons = props.allowTakePhoto || props.allowPickPhoto || props.allowTakeVideo || props.allowPickVideo || props.allowTakeAudio || props.allowPickAudio || props.allowPickFile;
|
|
22347
22432
|
return vue.createVNode("div", {
|
|
22348
|
-
"class": bem$v(
|
|
22433
|
+
"class": bem$v({
|
|
22434
|
+
attachment: isAttachmentVariant.value
|
|
22435
|
+
})
|
|
22349
22436
|
}, [title, hiddenInput(), vue.createVNode(stdin_default$M, vue.mergeProps({
|
|
22350
22437
|
"show": mediaPlayerVisible.value,
|
|
22351
22438
|
"onUpdate:show": ($event) => mediaPlayerVisible.value = $event,
|
|
@@ -22361,7 +22448,7 @@ var __publicField = (obj, key, value) => {
|
|
|
22361
22448
|
"teleport": "body",
|
|
22362
22449
|
"close-on-click-action": true,
|
|
22363
22450
|
"onSelect": selectAction
|
|
22364
|
-
}, null), vue.withDirectives(vue.createVNode("div", {
|
|
22451
|
+
}, null), isAttachmentVariant.value ? renderAttachment() : vue.createVNode(vue.Fragment, null, [vue.withDirectives(vue.createVNode("div", {
|
|
22365
22452
|
"class": bem$v("line")
|
|
22366
22453
|
}, [renderButtons(), slots["extend"] ? slots.extend() : ""]), [[vue.vShow, showButtons]]), vue.withDirectives(vue.createVNode(stdin_default$Y, {
|
|
22367
22454
|
"ref": gridRef,
|
|
@@ -22381,7 +22468,7 @@ var __publicField = (obj, key, value) => {
|
|
|
22381
22468
|
"class": bem$v("grid")
|
|
22382
22469
|
}, {
|
|
22383
22470
|
default: () => [renderMediaListPlaceholder()]
|
|
22384
|
-
}), [[vue.vShow, mediaListPlaceholder.value.length]])]);
|
|
22471
|
+
}), [[vue.vShow, mediaListPlaceholder.value.length]])])]);
|
|
22385
22472
|
};
|
|
22386
22473
|
}
|
|
22387
22474
|
});
|
|
@@ -31377,7 +31464,7 @@ var __publicField = (obj, key, value) => {
|
|
|
31377
31464
|
});
|
|
31378
31465
|
}
|
|
31379
31466
|
};
|
|
31380
|
-
const version = "3.1.
|
|
31467
|
+
const version = "3.1.89";
|
|
31381
31468
|
function install(app) {
|
|
31382
31469
|
const components = [
|
|
31383
31470
|
ActionSheet,
|