zartui 3.1.25 → 3.1.27

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
@@ -14462,11 +14462,15 @@ var stdin_default$A = vue.defineComponent({
14462
14462
  emit,
14463
14463
  slots
14464
14464
  }) {
14465
+ const currentOptions2 = vue.computed(() => {
14466
+ return props.initialOptions;
14467
+ });
14465
14468
  const state = vue.reactive({
14466
- options: props.initialOptions,
14467
14469
  confirmed: false
14468
14470
  });
14469
- const currentIndexes = vue.ref(props.currentIndexes);
14471
+ const currentIndexes = vue.computed(() => {
14472
+ return props.currentIndexes;
14473
+ });
14470
14474
  const columnCounts = vue.ref(props.columnCounts);
14471
14475
  const onClickItem = (index) => {
14472
14476
  if (props.readonly) {
@@ -14504,7 +14508,7 @@ var stdin_default$A = vue.defineComponent({
14504
14508
  height: `${props.itemHeight + 8}px`,
14505
14509
  width: `${1 / columnCounts.value * 100}%`
14506
14510
  };
14507
- return state.options.map((option, index) => {
14511
+ return currentOptions2.value.map((option, index) => {
14508
14512
  const text = getOptionText(option);
14509
14513
  const disabled = isOptionDisabled(option);
14510
14514
  const childData = {
@@ -14575,13 +14579,36 @@ var stdin_default$z = vue.defineComponent({
14575
14579
  emit,
14576
14580
  slots
14577
14581
  }) {
14582
+ const currentOptions2 = vue.ref(props.options);
14583
+ const currentSelectedIndex = vue.computed(() => props.selectedIndex);
14584
+ const currentSelectedValue = vue.computed(() => props.selectedValue);
14578
14585
  const confirmIndexes = vue.ref(props.selectedIndex);
14579
14586
  const confirmValues = vue.ref(props.selectedValue);
14587
+ const resetOptions = (props2) => {
14588
+ currentOptions2.value = props2.options;
14589
+ confirmIndexes.value = props2.selectedIndex;
14590
+ if (confirmIndexes.value.length > 0) {
14591
+ getValuesByIndexes();
14592
+ } else {
14593
+ confirmValues.value = [];
14594
+ }
14595
+ emit("update:selectedValue", confirmValues.value);
14596
+ };
14597
+ const onUpdateCurrentIndexes = (newVal) => {
14598
+ confirmIndexes.value = newVal;
14599
+ if (newVal.length > 0) {
14600
+ getValuesByIndexes();
14601
+ } else {
14602
+ confirmValues.value = [];
14603
+ }
14604
+ getValuesByIndexes();
14605
+ emit("update:selectedValue", confirmValues.value);
14606
+ };
14580
14607
  const getIndexesByValues = () => {
14581
14608
  var _a;
14582
14609
  if (confirmValues.value && confirmValues.value.length > 0) {
14583
14610
  confirmIndexes.value.splice(0, confirmIndexes.value.length);
14584
- (_a = props.options) == null ? void 0 : _a.forEach((option, index) => {
14611
+ (_a = currentOptions2.value) == null ? void 0 : _a.forEach((option, index) => {
14585
14612
  if (option.value && confirmValues.value.includes(option.value)) {
14586
14613
  confirmIndexes.value.push(index);
14587
14614
  }
@@ -14589,6 +14616,16 @@ var stdin_default$z = vue.defineComponent({
14589
14616
  }
14590
14617
  };
14591
14618
  getIndexesByValues();
14619
+ const getValuesByIndexes = () => {
14620
+ if (confirmIndexes.value && confirmIndexes.value.length > 0) {
14621
+ confirmValues.value.splice(0, confirmValues.value.length);
14622
+ confirmIndexes.value.forEach((index) => {
14623
+ if (index > -1 && index < currentOptions2.value.length) {
14624
+ confirmValues.value.push(currentOptions2.value[index].value);
14625
+ }
14626
+ });
14627
+ }
14628
+ };
14592
14629
  const pickerOptions = vue.ref();
14593
14630
  const currentShow = vue.ref(props.showPicker);
14594
14631
  const DEFAULT_ITEM_HEIGHT = vue.ref(36);
@@ -14596,8 +14633,8 @@ var stdin_default$z = vue.defineComponent({
14596
14633
  if (newValue !== props.showPicker) {
14597
14634
  emit("update:showPicker", newValue);
14598
14635
  }
14599
- confirmIndexes.value = deepClone(props.selectedIndex);
14600
- confirmValues.value = deepClone(props.selectedValue);
14636
+ confirmIndexes.value = deepClone(currentSelectedIndex.value);
14637
+ confirmValues.value = deepClone(currentSelectedValue.value);
14601
14638
  getIndexesByValues();
14602
14639
  });
14603
14640
  vue.watch(() => props.showPicker, (newValue) => {
@@ -14619,10 +14656,10 @@ var stdin_default$z = vue.defineComponent({
14619
14656
  const indexes = confirmIndexes.value;
14620
14657
  const result = [];
14621
14658
  indexes == null ? void 0 : indexes.forEach((index) => {
14622
- if (index > -1 && index < props.options.length && props.options[index]) {
14659
+ if (index > -1 && index < currentOptions2.value.length && currentOptions2.value[index]) {
14623
14660
  result.push({
14624
- [props.textKey]: props.options[index][props.textKey],
14625
- value: props.options[index].value,
14661
+ [props.textKey]: currentOptions2.value[index][props.textKey],
14662
+ value: currentOptions2.value[index].value,
14626
14663
  initialIndex: index
14627
14664
  });
14628
14665
  }
@@ -14678,20 +14715,20 @@ var stdin_default$z = vue.defineComponent({
14678
14715
  }, [slots.toolbar ? slots.toolbar() : [genCancel(), genConfirm()]]);
14679
14716
  }
14680
14717
  };
14681
- const genOptionItems = () => {
14718
+ const genOptionItems = vue.computed(() => {
14682
14719
  let formatOptions = [];
14683
- if (props.options && props.options[0] && typeof props.options[0] !== "object") {
14684
- formatOptions = props.options.map((v) => ({
14720
+ if (currentOptions2.value && currentOptions2.value[0] && typeof currentOptions2.value[0] !== "object") {
14721
+ formatOptions = currentOptions2.value.map((v) => ({
14685
14722
  value: v,
14686
14723
  text: v
14687
14724
  }));
14688
14725
  } else {
14689
- formatOptions = props.options;
14726
+ formatOptions = currentOptions2.value;
14690
14727
  }
14691
14728
  return vue.createVNode(stdin_default$A, {
14692
14729
  "ref": pickerOptions,
14693
14730
  "currentIndexes": confirmIndexes.value,
14694
- "onUpdate:currentIndexes": ($event) => confirmIndexes.value = $event,
14731
+ "onUpdate:currentIndexes": [($event) => confirmIndexes.value = $event, onUpdateCurrentIndexes],
14695
14732
  "columnCounts": props.columnCounts,
14696
14733
  "initialOptions": formatOptions,
14697
14734
  "allowHtml": props.allowHtml,
@@ -14702,15 +14739,18 @@ var stdin_default$z = vue.defineComponent({
14702
14739
  }, {
14703
14740
  option: slots.option
14704
14741
  });
14705
- };
14742
+ });
14706
14743
  const genOptions2 = () => vue.createVNode("div", {
14707
14744
  "class": bem$r("options")
14708
- }, [genOptionItems()]);
14745
+ }, [genOptionItems.value]);
14709
14746
  const renderMultiplePicker = () => vue.createVNode("div", {
14710
14747
  "class": bem$r()
14711
14748
  }, [genTitle(), props.loading ? vue.createVNode(stdin_default$1Q, {
14712
14749
  "class": bem$r("loading")
14713
14750
  }, null) : "", genOptions2(), props.toolbarPosition === "bottom" ? genToolbar() : ""]);
14751
+ useExpose({
14752
+ resetOptions
14753
+ });
14714
14754
  return () => {
14715
14755
  if (props.popup) {
14716
14756
  return vue.createVNode(stdin_default$1S, {
@@ -20501,7 +20541,7 @@ const Lazyload = {
20501
20541
  });
20502
20542
  }
20503
20543
  };
20504
- const version = "3.1.25";
20544
+ const version = "3.1.27";
20505
20545
  function install(app) {
20506
20546
  const components = [
20507
20547
  ActionSheet,
package/lib/zartui.es.js CHANGED
@@ -14460,11 +14460,15 @@ var stdin_default$A = defineComponent({
14460
14460
  emit,
14461
14461
  slots
14462
14462
  }) {
14463
+ const currentOptions2 = computed(() => {
14464
+ return props.initialOptions;
14465
+ });
14463
14466
  const state = reactive({
14464
- options: props.initialOptions,
14465
14467
  confirmed: false
14466
14468
  });
14467
- const currentIndexes = ref(props.currentIndexes);
14469
+ const currentIndexes = computed(() => {
14470
+ return props.currentIndexes;
14471
+ });
14468
14472
  const columnCounts = ref(props.columnCounts);
14469
14473
  const onClickItem = (index) => {
14470
14474
  if (props.readonly) {
@@ -14502,7 +14506,7 @@ var stdin_default$A = defineComponent({
14502
14506
  height: `${props.itemHeight + 8}px`,
14503
14507
  width: `${1 / columnCounts.value * 100}%`
14504
14508
  };
14505
- return state.options.map((option, index) => {
14509
+ return currentOptions2.value.map((option, index) => {
14506
14510
  const text = getOptionText(option);
14507
14511
  const disabled = isOptionDisabled(option);
14508
14512
  const childData = {
@@ -14573,13 +14577,36 @@ var stdin_default$z = defineComponent({
14573
14577
  emit,
14574
14578
  slots
14575
14579
  }) {
14580
+ const currentOptions2 = ref(props.options);
14581
+ const currentSelectedIndex = computed(() => props.selectedIndex);
14582
+ const currentSelectedValue = computed(() => props.selectedValue);
14576
14583
  const confirmIndexes = ref(props.selectedIndex);
14577
14584
  const confirmValues = ref(props.selectedValue);
14585
+ const resetOptions = (props2) => {
14586
+ currentOptions2.value = props2.options;
14587
+ confirmIndexes.value = props2.selectedIndex;
14588
+ if (confirmIndexes.value.length > 0) {
14589
+ getValuesByIndexes();
14590
+ } else {
14591
+ confirmValues.value = [];
14592
+ }
14593
+ emit("update:selectedValue", confirmValues.value);
14594
+ };
14595
+ const onUpdateCurrentIndexes = (newVal) => {
14596
+ confirmIndexes.value = newVal;
14597
+ if (newVal.length > 0) {
14598
+ getValuesByIndexes();
14599
+ } else {
14600
+ confirmValues.value = [];
14601
+ }
14602
+ getValuesByIndexes();
14603
+ emit("update:selectedValue", confirmValues.value);
14604
+ };
14578
14605
  const getIndexesByValues = () => {
14579
14606
  var _a;
14580
14607
  if (confirmValues.value && confirmValues.value.length > 0) {
14581
14608
  confirmIndexes.value.splice(0, confirmIndexes.value.length);
14582
- (_a = props.options) == null ? void 0 : _a.forEach((option, index) => {
14609
+ (_a = currentOptions2.value) == null ? void 0 : _a.forEach((option, index) => {
14583
14610
  if (option.value && confirmValues.value.includes(option.value)) {
14584
14611
  confirmIndexes.value.push(index);
14585
14612
  }
@@ -14587,6 +14614,16 @@ var stdin_default$z = defineComponent({
14587
14614
  }
14588
14615
  };
14589
14616
  getIndexesByValues();
14617
+ const getValuesByIndexes = () => {
14618
+ if (confirmIndexes.value && confirmIndexes.value.length > 0) {
14619
+ confirmValues.value.splice(0, confirmValues.value.length);
14620
+ confirmIndexes.value.forEach((index) => {
14621
+ if (index > -1 && index < currentOptions2.value.length) {
14622
+ confirmValues.value.push(currentOptions2.value[index].value);
14623
+ }
14624
+ });
14625
+ }
14626
+ };
14590
14627
  const pickerOptions = ref();
14591
14628
  const currentShow = ref(props.showPicker);
14592
14629
  const DEFAULT_ITEM_HEIGHT = ref(36);
@@ -14594,8 +14631,8 @@ var stdin_default$z = defineComponent({
14594
14631
  if (newValue !== props.showPicker) {
14595
14632
  emit("update:showPicker", newValue);
14596
14633
  }
14597
- confirmIndexes.value = deepClone(props.selectedIndex);
14598
- confirmValues.value = deepClone(props.selectedValue);
14634
+ confirmIndexes.value = deepClone(currentSelectedIndex.value);
14635
+ confirmValues.value = deepClone(currentSelectedValue.value);
14599
14636
  getIndexesByValues();
14600
14637
  });
14601
14638
  watch(() => props.showPicker, (newValue) => {
@@ -14617,10 +14654,10 @@ var stdin_default$z = defineComponent({
14617
14654
  const indexes = confirmIndexes.value;
14618
14655
  const result = [];
14619
14656
  indexes == null ? void 0 : indexes.forEach((index) => {
14620
- if (index > -1 && index < props.options.length && props.options[index]) {
14657
+ if (index > -1 && index < currentOptions2.value.length && currentOptions2.value[index]) {
14621
14658
  result.push({
14622
- [props.textKey]: props.options[index][props.textKey],
14623
- value: props.options[index].value,
14659
+ [props.textKey]: currentOptions2.value[index][props.textKey],
14660
+ value: currentOptions2.value[index].value,
14624
14661
  initialIndex: index
14625
14662
  });
14626
14663
  }
@@ -14676,20 +14713,20 @@ var stdin_default$z = defineComponent({
14676
14713
  }, [slots.toolbar ? slots.toolbar() : [genCancel(), genConfirm()]]);
14677
14714
  }
14678
14715
  };
14679
- const genOptionItems = () => {
14716
+ const genOptionItems = computed(() => {
14680
14717
  let formatOptions = [];
14681
- if (props.options && props.options[0] && typeof props.options[0] !== "object") {
14682
- formatOptions = props.options.map((v) => ({
14718
+ if (currentOptions2.value && currentOptions2.value[0] && typeof currentOptions2.value[0] !== "object") {
14719
+ formatOptions = currentOptions2.value.map((v) => ({
14683
14720
  value: v,
14684
14721
  text: v
14685
14722
  }));
14686
14723
  } else {
14687
- formatOptions = props.options;
14724
+ formatOptions = currentOptions2.value;
14688
14725
  }
14689
14726
  return createVNode(stdin_default$A, {
14690
14727
  "ref": pickerOptions,
14691
14728
  "currentIndexes": confirmIndexes.value,
14692
- "onUpdate:currentIndexes": ($event) => confirmIndexes.value = $event,
14729
+ "onUpdate:currentIndexes": [($event) => confirmIndexes.value = $event, onUpdateCurrentIndexes],
14693
14730
  "columnCounts": props.columnCounts,
14694
14731
  "initialOptions": formatOptions,
14695
14732
  "allowHtml": props.allowHtml,
@@ -14700,15 +14737,18 @@ var stdin_default$z = defineComponent({
14700
14737
  }, {
14701
14738
  option: slots.option
14702
14739
  });
14703
- };
14740
+ });
14704
14741
  const genOptions2 = () => createVNode("div", {
14705
14742
  "class": bem$r("options")
14706
- }, [genOptionItems()]);
14743
+ }, [genOptionItems.value]);
14707
14744
  const renderMultiplePicker = () => createVNode("div", {
14708
14745
  "class": bem$r()
14709
14746
  }, [genTitle(), props.loading ? createVNode(stdin_default$1Q, {
14710
14747
  "class": bem$r("loading")
14711
14748
  }, null) : "", genOptions2(), props.toolbarPosition === "bottom" ? genToolbar() : ""]);
14749
+ useExpose({
14750
+ resetOptions
14751
+ });
14712
14752
  return () => {
14713
14753
  if (props.popup) {
14714
14754
  return createVNode(stdin_default$1S, {
@@ -20499,7 +20539,7 @@ const Lazyload = {
20499
20539
  });
20500
20540
  }
20501
20541
  };
20502
- const version = "3.1.25";
20542
+ const version = "3.1.27";
20503
20543
  function install(app) {
20504
20544
  const components = [
20505
20545
  ActionSheet,
package/lib/zartui.js CHANGED
@@ -16207,11 +16207,15 @@
16207
16207
  emit,
16208
16208
  slots
16209
16209
  }) {
16210
+ const currentOptions2 = vue.computed(() => {
16211
+ return props.initialOptions;
16212
+ });
16210
16213
  const state = vue.reactive({
16211
- options: props.initialOptions,
16212
16214
  confirmed: false
16213
16215
  });
16214
- const currentIndexes = vue.ref(props.currentIndexes);
16216
+ const currentIndexes = vue.computed(() => {
16217
+ return props.currentIndexes;
16218
+ });
16215
16219
  const columnCounts = vue.ref(props.columnCounts);
16216
16220
  const onClickItem = (index) => {
16217
16221
  if (props.readonly) {
@@ -16249,7 +16253,7 @@
16249
16253
  height: `${props.itemHeight + 8}px`,
16250
16254
  width: `${1 / columnCounts.value * 100}%`
16251
16255
  };
16252
- return state.options.map((option, index) => {
16256
+ return currentOptions2.value.map((option, index) => {
16253
16257
  const text = getOptionText(option);
16254
16258
  const disabled = isOptionDisabled(option);
16255
16259
  const childData = {
@@ -16320,13 +16324,36 @@
16320
16324
  emit,
16321
16325
  slots
16322
16326
  }) {
16327
+ const currentOptions2 = vue.ref(props.options);
16328
+ const currentSelectedIndex = vue.computed(() => props.selectedIndex);
16329
+ const currentSelectedValue = vue.computed(() => props.selectedValue);
16323
16330
  const confirmIndexes = vue.ref(props.selectedIndex);
16324
16331
  const confirmValues = vue.ref(props.selectedValue);
16332
+ const resetOptions = (props2) => {
16333
+ currentOptions2.value = props2.options;
16334
+ confirmIndexes.value = props2.selectedIndex;
16335
+ if (confirmIndexes.value.length > 0) {
16336
+ getValuesByIndexes();
16337
+ } else {
16338
+ confirmValues.value = [];
16339
+ }
16340
+ emit("update:selectedValue", confirmValues.value);
16341
+ };
16342
+ const onUpdateCurrentIndexes = (newVal) => {
16343
+ confirmIndexes.value = newVal;
16344
+ if (newVal.length > 0) {
16345
+ getValuesByIndexes();
16346
+ } else {
16347
+ confirmValues.value = [];
16348
+ }
16349
+ getValuesByIndexes();
16350
+ emit("update:selectedValue", confirmValues.value);
16351
+ };
16325
16352
  const getIndexesByValues = () => {
16326
16353
  var _a;
16327
16354
  if (confirmValues.value && confirmValues.value.length > 0) {
16328
16355
  confirmIndexes.value.splice(0, confirmIndexes.value.length);
16329
- (_a = props.options) == null ? void 0 : _a.forEach((option, index) => {
16356
+ (_a = currentOptions2.value) == null ? void 0 : _a.forEach((option, index) => {
16330
16357
  if (option.value && confirmValues.value.includes(option.value)) {
16331
16358
  confirmIndexes.value.push(index);
16332
16359
  }
@@ -16334,6 +16361,16 @@
16334
16361
  }
16335
16362
  };
16336
16363
  getIndexesByValues();
16364
+ const getValuesByIndexes = () => {
16365
+ if (confirmIndexes.value && confirmIndexes.value.length > 0) {
16366
+ confirmValues.value.splice(0, confirmValues.value.length);
16367
+ confirmIndexes.value.forEach((index) => {
16368
+ if (index > -1 && index < currentOptions2.value.length) {
16369
+ confirmValues.value.push(currentOptions2.value[index].value);
16370
+ }
16371
+ });
16372
+ }
16373
+ };
16337
16374
  const pickerOptions = vue.ref();
16338
16375
  const currentShow = vue.ref(props.showPicker);
16339
16376
  const DEFAULT_ITEM_HEIGHT = vue.ref(36);
@@ -16341,8 +16378,8 @@
16341
16378
  if (newValue !== props.showPicker) {
16342
16379
  emit("update:showPicker", newValue);
16343
16380
  }
16344
- confirmIndexes.value = deepClone(props.selectedIndex);
16345
- confirmValues.value = deepClone(props.selectedValue);
16381
+ confirmIndexes.value = deepClone(currentSelectedIndex.value);
16382
+ confirmValues.value = deepClone(currentSelectedValue.value);
16346
16383
  getIndexesByValues();
16347
16384
  });
16348
16385
  vue.watch(() => props.showPicker, (newValue) => {
@@ -16364,10 +16401,10 @@
16364
16401
  const indexes = confirmIndexes.value;
16365
16402
  const result = [];
16366
16403
  indexes == null ? void 0 : indexes.forEach((index) => {
16367
- if (index > -1 && index < props.options.length && props.options[index]) {
16404
+ if (index > -1 && index < currentOptions2.value.length && currentOptions2.value[index]) {
16368
16405
  result.push({
16369
- [props.textKey]: props.options[index][props.textKey],
16370
- value: props.options[index].value,
16406
+ [props.textKey]: currentOptions2.value[index][props.textKey],
16407
+ value: currentOptions2.value[index].value,
16371
16408
  initialIndex: index
16372
16409
  });
16373
16410
  }
@@ -16423,20 +16460,20 @@
16423
16460
  }, [slots.toolbar ? slots.toolbar() : [genCancel(), genConfirm()]]);
16424
16461
  }
16425
16462
  };
16426
- const genOptionItems = () => {
16463
+ const genOptionItems = vue.computed(() => {
16427
16464
  let formatOptions = [];
16428
- if (props.options && props.options[0] && typeof props.options[0] !== "object") {
16429
- formatOptions = props.options.map((v) => ({
16465
+ if (currentOptions2.value && currentOptions2.value[0] && typeof currentOptions2.value[0] !== "object") {
16466
+ formatOptions = currentOptions2.value.map((v) => ({
16430
16467
  value: v,
16431
16468
  text: v
16432
16469
  }));
16433
16470
  } else {
16434
- formatOptions = props.options;
16471
+ formatOptions = currentOptions2.value;
16435
16472
  }
16436
16473
  return vue.createVNode(stdin_default$A, {
16437
16474
  "ref": pickerOptions,
16438
16475
  "currentIndexes": confirmIndexes.value,
16439
- "onUpdate:currentIndexes": ($event) => confirmIndexes.value = $event,
16476
+ "onUpdate:currentIndexes": [($event) => confirmIndexes.value = $event, onUpdateCurrentIndexes],
16440
16477
  "columnCounts": props.columnCounts,
16441
16478
  "initialOptions": formatOptions,
16442
16479
  "allowHtml": props.allowHtml,
@@ -16447,15 +16484,18 @@
16447
16484
  }, {
16448
16485
  option: slots.option
16449
16486
  });
16450
- };
16487
+ });
16451
16488
  const genOptions2 = () => vue.createVNode("div", {
16452
16489
  "class": bem$r("options")
16453
- }, [genOptionItems()]);
16490
+ }, [genOptionItems.value]);
16454
16491
  const renderMultiplePicker = () => vue.createVNode("div", {
16455
16492
  "class": bem$r()
16456
16493
  }, [genTitle(), props.loading ? vue.createVNode(stdin_default$1Q, {
16457
16494
  "class": bem$r("loading")
16458
16495
  }, null) : "", genOptions2(), props.toolbarPosition === "bottom" ? genToolbar() : ""]);
16496
+ useExpose({
16497
+ resetOptions
16498
+ });
16459
16499
  return () => {
16460
16500
  if (props.popup) {
16461
16501
  return vue.createVNode(stdin_default$1S, {
@@ -24499,7 +24539,7 @@
24499
24539
  });
24500
24540
  }
24501
24541
  };
24502
- const version = "3.1.25";
24542
+ const version = "3.1.27";
24503
24543
  function install(app) {
24504
24544
  const components = [
24505
24545
  ActionSheet,