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/lib/zartui.cjs.js CHANGED
@@ -16334,11 +16334,29 @@ var stdin_default$D = vue.defineComponent({
16334
16334
  const gridRef = vue.ref();
16335
16335
  const mediaListPlaceholder = vue.ref([]);
16336
16336
  const sort2 = vue.ref();
16337
- vue.watch(() => props.mediaList.length, () => {
16337
+ const shouldIsolateSortableTouch = () => props.sortable && props.mediaList.length > 0;
16338
+ const stopSortableTouchStartPropagation = (event) => {
16339
+ if (!shouldIsolateSortableTouch()) {
16340
+ return;
16341
+ }
16342
+ event.stopPropagation();
16343
+ };
16344
+ const destroySortable = () => {
16338
16345
  var _a;
16339
- if (sort2.value || !props.sortable)
16346
+ if ((_a = sort2.value) == null ? void 0 : _a.destroy) {
16347
+ sort2.value.destroy();
16348
+ }
16349
+ sort2.value = void 0;
16350
+ };
16351
+ const initSortable = () => __async$2(this, null, function* () {
16352
+ var _a;
16353
+ if (sort2.value || !props.sortable || !props.mediaList.length)
16354
+ return;
16355
+ yield vue.nextTick();
16356
+ const gridEl = (_a = gridRef.value) == null ? void 0 : _a.$el;
16357
+ if (!gridEl)
16340
16358
  return;
16341
- sort2.value = Sortable.create((_a = gridRef.value) == null ? void 0 : _a.$el, {
16359
+ sort2.value = Sortable.create(gridEl, {
16342
16360
  animation: 200,
16343
16361
  handle: ".zt-grid-item",
16344
16362
  onEnd: (evt) => {
@@ -17069,6 +17087,18 @@ var stdin_default$D = vue.defineComponent({
17069
17087
  actionVisible.value = false;
17070
17088
  action.func && action.func();
17071
17089
  };
17090
+ vue.watch(() => [props.sortable, props.mediaList.length], (_0) => __async$2(this, [_0], function* ([sortable, mediaCount]) {
17091
+ if (!sortable || !mediaCount) {
17092
+ destroySortable();
17093
+ return;
17094
+ }
17095
+ yield initSortable();
17096
+ }), {
17097
+ immediate: true
17098
+ });
17099
+ vue.onBeforeUnmount(() => {
17100
+ destroySortable();
17101
+ });
17072
17102
  useExpose({
17073
17103
  mediaPickAction,
17074
17104
  handleInputFiles,
@@ -17106,7 +17136,8 @@ var stdin_default$D = vue.defineComponent({
17106
17136
  "border": false,
17107
17137
  "square": true,
17108
17138
  "gutter": "4",
17109
- "class": bem$v("grid")
17139
+ "class": bem$v("grid"),
17140
+ "onTouchstart": stopSortableTouchStartPropagation
17110
17141
  }, {
17111
17142
  default: () => [renderMediaList()]
17112
17143
  }), [[vue.vShow, props.mediaList.length]]), vue.withDirectives(vue.createVNode(stdin_default$Y, {
@@ -23829,7 +23860,7 @@ const Lazyload = {
23829
23860
  });
23830
23861
  }
23831
23862
  };
23832
- const version = "3.1.85";
23863
+ const version = "3.1.86";
23833
23864
  function install(app) {
23834
23865
  const components = [
23835
23866
  ActionSheet,
package/lib/zartui.es.js CHANGED
@@ -16332,11 +16332,29 @@ var stdin_default$D = defineComponent({
16332
16332
  const gridRef = ref();
16333
16333
  const mediaListPlaceholder = ref([]);
16334
16334
  const sort2 = ref();
16335
- watch(() => props.mediaList.length, () => {
16335
+ const shouldIsolateSortableTouch = () => props.sortable && props.mediaList.length > 0;
16336
+ const stopSortableTouchStartPropagation = (event) => {
16337
+ if (!shouldIsolateSortableTouch()) {
16338
+ return;
16339
+ }
16340
+ event.stopPropagation();
16341
+ };
16342
+ const destroySortable = () => {
16336
16343
  var _a;
16337
- if (sort2.value || !props.sortable)
16344
+ if ((_a = sort2.value) == null ? void 0 : _a.destroy) {
16345
+ sort2.value.destroy();
16346
+ }
16347
+ sort2.value = void 0;
16348
+ };
16349
+ const initSortable = () => __async$2(this, null, function* () {
16350
+ var _a;
16351
+ if (sort2.value || !props.sortable || !props.mediaList.length)
16352
+ return;
16353
+ yield nextTick();
16354
+ const gridEl = (_a = gridRef.value) == null ? void 0 : _a.$el;
16355
+ if (!gridEl)
16338
16356
  return;
16339
- sort2.value = Sortable.create((_a = gridRef.value) == null ? void 0 : _a.$el, {
16357
+ sort2.value = Sortable.create(gridEl, {
16340
16358
  animation: 200,
16341
16359
  handle: ".zt-grid-item",
16342
16360
  onEnd: (evt) => {
@@ -17067,6 +17085,18 @@ var stdin_default$D = defineComponent({
17067
17085
  actionVisible.value = false;
17068
17086
  action.func && action.func();
17069
17087
  };
17088
+ watch(() => [props.sortable, props.mediaList.length], (_0) => __async$2(this, [_0], function* ([sortable, mediaCount]) {
17089
+ if (!sortable || !mediaCount) {
17090
+ destroySortable();
17091
+ return;
17092
+ }
17093
+ yield initSortable();
17094
+ }), {
17095
+ immediate: true
17096
+ });
17097
+ onBeforeUnmount(() => {
17098
+ destroySortable();
17099
+ });
17070
17100
  useExpose({
17071
17101
  mediaPickAction,
17072
17102
  handleInputFiles,
@@ -17104,7 +17134,8 @@ var stdin_default$D = defineComponent({
17104
17134
  "border": false,
17105
17135
  "square": true,
17106
17136
  "gutter": "4",
17107
- "class": bem$v("grid")
17137
+ "class": bem$v("grid"),
17138
+ "onTouchstart": stopSortableTouchStartPropagation
17108
17139
  }, {
17109
17140
  default: () => [renderMediaList()]
17110
17141
  }), [[vShow, props.mediaList.length]]), withDirectives(createVNode(stdin_default$Y, {
@@ -23827,7 +23858,7 @@ const Lazyload = {
23827
23858
  });
23828
23859
  }
23829
23860
  };
23830
- const version = "3.1.85";
23861
+ const version = "3.1.86";
23831
23862
  function install(app) {
23832
23863
  const components = [
23833
23864
  ActionSheet,
package/lib/zartui.js CHANGED
@@ -21563,11 +21563,29 @@ var __publicField = (obj, key, value) => {
21563
21563
  const gridRef = vue.ref();
21564
21564
  const mediaListPlaceholder = vue.ref([]);
21565
21565
  const sort = vue.ref();
21566
- vue.watch(() => props.mediaList.length, () => {
21566
+ const shouldIsolateSortableTouch = () => props.sortable && props.mediaList.length > 0;
21567
+ const stopSortableTouchStartPropagation = (event) => {
21568
+ if (!shouldIsolateSortableTouch()) {
21569
+ return;
21570
+ }
21571
+ event.stopPropagation();
21572
+ };
21573
+ const destroySortable = () => {
21567
21574
  var _a;
21568
- if (sort.value || !props.sortable)
21575
+ if ((_a = sort.value) == null ? void 0 : _a.destroy) {
21576
+ sort.value.destroy();
21577
+ }
21578
+ sort.value = void 0;
21579
+ };
21580
+ const initSortable = () => __async$2(this, null, function* () {
21581
+ var _a;
21582
+ if (sort.value || !props.sortable || !props.mediaList.length)
21583
+ return;
21584
+ yield vue.nextTick();
21585
+ const gridEl = (_a = gridRef.value) == null ? void 0 : _a.$el;
21586
+ if (!gridEl)
21569
21587
  return;
21570
- sort.value = Sortable.create((_a = gridRef.value) == null ? void 0 : _a.$el, {
21588
+ sort.value = Sortable.create(gridEl, {
21571
21589
  animation: 200,
21572
21590
  handle: ".zt-grid-item",
21573
21591
  onEnd: (evt) => {
@@ -22298,6 +22316,18 @@ var __publicField = (obj, key, value) => {
22298
22316
  actionVisible.value = false;
22299
22317
  action.func && action.func();
22300
22318
  };
22319
+ vue.watch(() => [props.sortable, props.mediaList.length], (_0) => __async$2(this, [_0], function* ([sortable, mediaCount]) {
22320
+ if (!sortable || !mediaCount) {
22321
+ destroySortable();
22322
+ return;
22323
+ }
22324
+ yield initSortable();
22325
+ }), {
22326
+ immediate: true
22327
+ });
22328
+ vue.onBeforeUnmount(() => {
22329
+ destroySortable();
22330
+ });
22301
22331
  useExpose({
22302
22332
  mediaPickAction,
22303
22333
  handleInputFiles,
@@ -22335,7 +22365,8 @@ var __publicField = (obj, key, value) => {
22335
22365
  "border": false,
22336
22366
  "square": true,
22337
22367
  "gutter": "4",
22338
- "class": bem$v("grid")
22368
+ "class": bem$v("grid"),
22369
+ "onTouchstart": stopSortableTouchStartPropagation
22339
22370
  }, {
22340
22371
  default: () => [renderMediaList()]
22341
22372
  }), [[vue.vShow, props.mediaList.length]]), vue.withDirectives(vue.createVNode(stdin_default$Y, {
@@ -31342,7 +31373,7 @@ var __publicField = (obj, key, value) => {
31342
31373
  });
31343
31374
  }
31344
31375
  };
31345
- const version = "3.1.85";
31376
+ const version = "3.1.86";
31346
31377
  function install(app) {
31347
31378
  const components = [
31348
31379
  ActionSheet,