zartui 3.1.85 → 3.1.86
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.mjs +36 -5
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/media-picker/MediaPicker.js +35 -4
- package/lib/web-types.json +1 -1
- package/lib/zartui.cjs.js +36 -5
- package/lib/zartui.es.js +36 -5
- package/lib/zartui.js +36 -5
- package/lib/zartui.min.js +1 -1
- package/package.json +4 -4
package/es/index.d.ts
CHANGED
package/es/index.mjs
CHANGED
|
@@ -78,7 +78,7 @@ import { Timeline } from "./timeline/index.mjs";
|
|
|
78
78
|
import { Toast } from "./toast/index.mjs";
|
|
79
79
|
import { Uploader } from "./uploader/index.mjs";
|
|
80
80
|
import { Video } from "./video/index.mjs";
|
|
81
|
-
const version = "3.1.
|
|
81
|
+
const version = "3.1.86";
|
|
82
82
|
function install(app) {
|
|
83
83
|
const components = [
|
|
84
84
|
ActionSheet,
|
|
@@ -20,7 +20,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20
20
|
};
|
|
21
21
|
import { createVNode as _createVNode, mergeProps as _mergeProps, vShow as _vShow, withDirectives as _withDirectives } from "vue";
|
|
22
22
|
import { createNamespace, isDef, isWeixin, makeArrayProp, makeNumberProp, makeStringProp, truthProp } from "../utils/index.mjs";
|
|
23
|
-
import { computed, defineComponent, ref, watch } from "vue";
|
|
23
|
+
import { computed, defineComponent, nextTick, onBeforeUnmount, ref, watch } from "vue";
|
|
24
24
|
import { showFailToast, showLoadingToast, closeToast } from "../toast/index.mjs";
|
|
25
25
|
import DeleteIcon from "./image/DeleteIcon.mjs";
|
|
26
26
|
import { fileTypeFromBuffer } from "file-type";
|
|
@@ -147,11 +147,29 @@ var stdin_default = defineComponent({
|
|
|
147
147
|
const gridRef = ref();
|
|
148
148
|
const mediaListPlaceholder = ref([]);
|
|
149
149
|
const sort = ref();
|
|
150
|
-
|
|
150
|
+
const shouldIsolateSortableTouch = () => props.sortable && props.mediaList.length > 0;
|
|
151
|
+
const stopSortableTouchStartPropagation = (event) => {
|
|
152
|
+
if (!shouldIsolateSortableTouch()) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
event.stopPropagation();
|
|
156
|
+
};
|
|
157
|
+
const destroySortable = () => {
|
|
158
|
+
var _a;
|
|
159
|
+
if ((_a = sort.value) == null ? void 0 : _a.destroy) {
|
|
160
|
+
sort.value.destroy();
|
|
161
|
+
}
|
|
162
|
+
sort.value = void 0;
|
|
163
|
+
};
|
|
164
|
+
const initSortable = () => __async(this, null, function* () {
|
|
151
165
|
var _a;
|
|
152
|
-
if (sort.value || !props.sortable)
|
|
166
|
+
if (sort.value || !props.sortable || !props.mediaList.length)
|
|
153
167
|
return;
|
|
154
|
-
|
|
168
|
+
yield nextTick();
|
|
169
|
+
const gridEl = (_a = gridRef.value) == null ? void 0 : _a.$el;
|
|
170
|
+
if (!gridEl)
|
|
171
|
+
return;
|
|
172
|
+
sort.value = Sortable.create(gridEl, {
|
|
155
173
|
animation: 200,
|
|
156
174
|
handle: ".zt-grid-item",
|
|
157
175
|
onEnd: (evt) => {
|
|
@@ -882,6 +900,18 @@ var stdin_default = defineComponent({
|
|
|
882
900
|
actionVisible.value = false;
|
|
883
901
|
action.func && action.func();
|
|
884
902
|
};
|
|
903
|
+
watch(() => [props.sortable, props.mediaList.length], (_0) => __async(this, [_0], function* ([sortable, mediaCount]) {
|
|
904
|
+
if (!sortable || !mediaCount) {
|
|
905
|
+
destroySortable();
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
908
|
+
yield initSortable();
|
|
909
|
+
}), {
|
|
910
|
+
immediate: true
|
|
911
|
+
});
|
|
912
|
+
onBeforeUnmount(() => {
|
|
913
|
+
destroySortable();
|
|
914
|
+
});
|
|
885
915
|
useExpose({
|
|
886
916
|
mediaPickAction,
|
|
887
917
|
handleInputFiles,
|
|
@@ -919,7 +949,8 @@ var stdin_default = defineComponent({
|
|
|
919
949
|
"border": false,
|
|
920
950
|
"square": true,
|
|
921
951
|
"gutter": "4",
|
|
922
|
-
"class": bem("grid")
|
|
952
|
+
"class": bem("grid"),
|
|
953
|
+
"onTouchstart": stopSortableTouchStartPropagation
|
|
923
954
|
}, {
|
|
924
955
|
default: () => [renderMediaList()]
|
|
925
956
|
}), [[_vShow, props.mediaList.length]]), _withDirectives(_createVNode(ZtGrid, {
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -184,7 +184,7 @@ __reExport(stdin_exports, require("./timeline"), module.exports);
|
|
|
184
184
|
__reExport(stdin_exports, require("./toast"), module.exports);
|
|
185
185
|
__reExport(stdin_exports, require("./uploader"), module.exports);
|
|
186
186
|
__reExport(stdin_exports, require("./video"), module.exports);
|
|
187
|
-
const version = "3.1.
|
|
187
|
+
const version = "3.1.86";
|
|
188
188
|
function install(app) {
|
|
189
189
|
const components = [
|
|
190
190
|
import_action_sheet.ActionSheet,
|
|
@@ -179,11 +179,29 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
179
179
|
const gridRef = (0, import_vue2.ref)();
|
|
180
180
|
const mediaListPlaceholder = (0, import_vue2.ref)([]);
|
|
181
181
|
const sort = (0, import_vue2.ref)();
|
|
182
|
-
|
|
182
|
+
const shouldIsolateSortableTouch = () => props.sortable && props.mediaList.length > 0;
|
|
183
|
+
const stopSortableTouchStartPropagation = (event) => {
|
|
184
|
+
if (!shouldIsolateSortableTouch()) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
event.stopPropagation();
|
|
188
|
+
};
|
|
189
|
+
const destroySortable = () => {
|
|
190
|
+
var _a;
|
|
191
|
+
if ((_a = sort.value) == null ? void 0 : _a.destroy) {
|
|
192
|
+
sort.value.destroy();
|
|
193
|
+
}
|
|
194
|
+
sort.value = void 0;
|
|
195
|
+
};
|
|
196
|
+
const initSortable = () => __async(this, null, function* () {
|
|
183
197
|
var _a;
|
|
184
|
-
if (sort.value || !props.sortable)
|
|
198
|
+
if (sort.value || !props.sortable || !props.mediaList.length)
|
|
185
199
|
return;
|
|
186
|
-
|
|
200
|
+
yield (0, import_vue2.nextTick)();
|
|
201
|
+
const gridEl = (_a = gridRef.value) == null ? void 0 : _a.$el;
|
|
202
|
+
if (!gridEl)
|
|
203
|
+
return;
|
|
204
|
+
sort.value = import_sortablejs.default.create(gridEl, {
|
|
187
205
|
animation: 200,
|
|
188
206
|
handle: ".zt-grid-item",
|
|
189
207
|
onEnd: (evt) => {
|
|
@@ -914,6 +932,18 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
914
932
|
actionVisible.value = false;
|
|
915
933
|
action.func && action.func();
|
|
916
934
|
};
|
|
935
|
+
(0, import_vue2.watch)(() => [props.sortable, props.mediaList.length], (_0) => __async(this, [_0], function* ([sortable, mediaCount]) {
|
|
936
|
+
if (!sortable || !mediaCount) {
|
|
937
|
+
destroySortable();
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
yield initSortable();
|
|
941
|
+
}), {
|
|
942
|
+
immediate: true
|
|
943
|
+
});
|
|
944
|
+
(0, import_vue2.onBeforeUnmount)(() => {
|
|
945
|
+
destroySortable();
|
|
946
|
+
});
|
|
917
947
|
(0, import_use_expose.useExpose)({
|
|
918
948
|
mediaPickAction,
|
|
919
949
|
handleInputFiles,
|
|
@@ -951,7 +981,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
951
981
|
"border": false,
|
|
952
982
|
"square": true,
|
|
953
983
|
"gutter": "4",
|
|
954
|
-
"class": bem("grid")
|
|
984
|
+
"class": bem("grid"),
|
|
985
|
+
"onTouchstart": stopSortableTouchStartPropagation
|
|
955
986
|
}, {
|
|
956
987
|
default: () => [renderMediaList()]
|
|
957
988
|
}), [[import_vue.vShow, props.mediaList.length]]), (0, import_vue.withDirectives)((0, import_vue.createVNode)(import_grid.default, {
|