zartui 3.1.24 → 3.1.26

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,37 @@ var stdin_default$z = vue.defineComponent({
14575
14579
  emit,
14576
14580
  slots
14577
14581
  }) {
14582
+ const currentOptions2 = vue.ref(props.options);
14583
+ vue.watch(props.options, (newVal) => {
14584
+ currentOptions2.value = newVal;
14585
+ });
14578
14586
  const confirmIndexes = vue.ref(props.selectedIndex);
14579
14587
  const confirmValues = vue.ref(props.selectedValue);
14588
+ const resetOptions = (props2) => {
14589
+ currentOptions2.value = props2.options;
14590
+ confirmIndexes.value = props2.selectedIndex;
14591
+ if (confirmIndexes.value.length > 0) {
14592
+ getValuesByIndexes();
14593
+ } else {
14594
+ confirmValues.value = [];
14595
+ }
14596
+ emit("update:selectedValue", confirmValues.value);
14597
+ };
14598
+ const onUpdateCurrentIndexes = (newVal) => {
14599
+ confirmIndexes.value = newVal;
14600
+ if (newVal.length > 0) {
14601
+ getValuesByIndexes();
14602
+ } else {
14603
+ confirmValues.value = [];
14604
+ }
14605
+ getValuesByIndexes();
14606
+ emit("update:selectedValue", confirmValues.value);
14607
+ };
14580
14608
  const getIndexesByValues = () => {
14581
14609
  var _a;
14582
14610
  if (confirmValues.value && confirmValues.value.length > 0) {
14583
14611
  confirmIndexes.value.splice(0, confirmIndexes.value.length);
14584
- (_a = props.options) == null ? void 0 : _a.forEach((option, index) => {
14612
+ (_a = currentOptions2.value) == null ? void 0 : _a.forEach((option, index) => {
14585
14613
  if (option.value && confirmValues.value.includes(option.value)) {
14586
14614
  confirmIndexes.value.push(index);
14587
14615
  }
@@ -14589,6 +14617,16 @@ var stdin_default$z = vue.defineComponent({
14589
14617
  }
14590
14618
  };
14591
14619
  getIndexesByValues();
14620
+ const getValuesByIndexes = () => {
14621
+ if (confirmIndexes.value && confirmIndexes.value.length > 0) {
14622
+ confirmValues.value.splice(0, confirmValues.value.length);
14623
+ confirmIndexes.value.forEach((index) => {
14624
+ if (index > -1 && index < currentOptions2.value.length) {
14625
+ confirmValues.value.push(currentOptions2.value[index].value);
14626
+ }
14627
+ });
14628
+ }
14629
+ };
14592
14630
  const pickerOptions = vue.ref();
14593
14631
  const currentShow = vue.ref(props.showPicker);
14594
14632
  const DEFAULT_ITEM_HEIGHT = vue.ref(36);
@@ -14619,10 +14657,10 @@ var stdin_default$z = vue.defineComponent({
14619
14657
  const indexes = confirmIndexes.value;
14620
14658
  const result = [];
14621
14659
  indexes == null ? void 0 : indexes.forEach((index) => {
14622
- if (index > -1 && index < props.options.length && props.options[index]) {
14660
+ if (index > -1 && index < currentOptions2.value.length && currentOptions2.value[index]) {
14623
14661
  result.push({
14624
- [props.textKey]: props.options[index][props.textKey],
14625
- value: props.options[index].value,
14662
+ [props.textKey]: currentOptions2.value[index][props.textKey],
14663
+ value: currentOptions2.value[index].value,
14626
14664
  initialIndex: index
14627
14665
  });
14628
14666
  }
@@ -14678,20 +14716,20 @@ var stdin_default$z = vue.defineComponent({
14678
14716
  }, [slots.toolbar ? slots.toolbar() : [genCancel(), genConfirm()]]);
14679
14717
  }
14680
14718
  };
14681
- const genOptionItems = () => {
14719
+ const genOptionItems = vue.computed(() => {
14682
14720
  let formatOptions = [];
14683
- if (props.options && props.options[0] && typeof props.options[0] !== "object") {
14684
- formatOptions = props.options.map((v) => ({
14721
+ if (currentOptions2.value && currentOptions2.value[0] && typeof currentOptions2.value[0] !== "object") {
14722
+ formatOptions = currentOptions2.value.map((v) => ({
14685
14723
  value: v,
14686
14724
  text: v
14687
14725
  }));
14688
14726
  } else {
14689
- formatOptions = props.options;
14727
+ formatOptions = currentOptions2.value;
14690
14728
  }
14691
14729
  return vue.createVNode(stdin_default$A, {
14692
14730
  "ref": pickerOptions,
14693
14731
  "currentIndexes": confirmIndexes.value,
14694
- "onUpdate:currentIndexes": ($event) => confirmIndexes.value = $event,
14732
+ "onUpdate:currentIndexes": [($event) => confirmIndexes.value = $event, onUpdateCurrentIndexes],
14695
14733
  "columnCounts": props.columnCounts,
14696
14734
  "initialOptions": formatOptions,
14697
14735
  "allowHtml": props.allowHtml,
@@ -14702,15 +14740,18 @@ var stdin_default$z = vue.defineComponent({
14702
14740
  }, {
14703
14741
  option: slots.option
14704
14742
  });
14705
- };
14743
+ });
14706
14744
  const genOptions2 = () => vue.createVNode("div", {
14707
14745
  "class": bem$r("options")
14708
- }, [genOptionItems()]);
14746
+ }, [genOptionItems.value]);
14709
14747
  const renderMultiplePicker = () => vue.createVNode("div", {
14710
14748
  "class": bem$r()
14711
14749
  }, [genTitle(), props.loading ? vue.createVNode(stdin_default$1Q, {
14712
14750
  "class": bem$r("loading")
14713
14751
  }, null) : "", genOptions2(), props.toolbarPosition === "bottom" ? genToolbar() : ""]);
14752
+ useExpose({
14753
+ resetOptions
14754
+ });
14714
14755
  return () => {
14715
14756
  if (props.popup) {
14716
14757
  return vue.createVNode(stdin_default$1S, {
@@ -20501,7 +20542,7 @@ const Lazyload = {
20501
20542
  });
20502
20543
  }
20503
20544
  };
20504
- const version = "3.1.24";
20545
+ const version = "3.1.26";
20505
20546
  function install(app) {
20506
20547
  const components = [
20507
20548
  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,37 @@ var stdin_default$z = defineComponent({
14573
14577
  emit,
14574
14578
  slots
14575
14579
  }) {
14580
+ const currentOptions2 = ref(props.options);
14581
+ watch(props.options, (newVal) => {
14582
+ currentOptions2.value = newVal;
14583
+ });
14576
14584
  const confirmIndexes = ref(props.selectedIndex);
14577
14585
  const confirmValues = ref(props.selectedValue);
14586
+ const resetOptions = (props2) => {
14587
+ currentOptions2.value = props2.options;
14588
+ confirmIndexes.value = props2.selectedIndex;
14589
+ if (confirmIndexes.value.length > 0) {
14590
+ getValuesByIndexes();
14591
+ } else {
14592
+ confirmValues.value = [];
14593
+ }
14594
+ emit("update:selectedValue", confirmValues.value);
14595
+ };
14596
+ const onUpdateCurrentIndexes = (newVal) => {
14597
+ confirmIndexes.value = newVal;
14598
+ if (newVal.length > 0) {
14599
+ getValuesByIndexes();
14600
+ } else {
14601
+ confirmValues.value = [];
14602
+ }
14603
+ getValuesByIndexes();
14604
+ emit("update:selectedValue", confirmValues.value);
14605
+ };
14578
14606
  const getIndexesByValues = () => {
14579
14607
  var _a;
14580
14608
  if (confirmValues.value && confirmValues.value.length > 0) {
14581
14609
  confirmIndexes.value.splice(0, confirmIndexes.value.length);
14582
- (_a = props.options) == null ? void 0 : _a.forEach((option, index) => {
14610
+ (_a = currentOptions2.value) == null ? void 0 : _a.forEach((option, index) => {
14583
14611
  if (option.value && confirmValues.value.includes(option.value)) {
14584
14612
  confirmIndexes.value.push(index);
14585
14613
  }
@@ -14587,6 +14615,16 @@ var stdin_default$z = defineComponent({
14587
14615
  }
14588
14616
  };
14589
14617
  getIndexesByValues();
14618
+ const getValuesByIndexes = () => {
14619
+ if (confirmIndexes.value && confirmIndexes.value.length > 0) {
14620
+ confirmValues.value.splice(0, confirmValues.value.length);
14621
+ confirmIndexes.value.forEach((index) => {
14622
+ if (index > -1 && index < currentOptions2.value.length) {
14623
+ confirmValues.value.push(currentOptions2.value[index].value);
14624
+ }
14625
+ });
14626
+ }
14627
+ };
14590
14628
  const pickerOptions = ref();
14591
14629
  const currentShow = ref(props.showPicker);
14592
14630
  const DEFAULT_ITEM_HEIGHT = ref(36);
@@ -14617,10 +14655,10 @@ var stdin_default$z = defineComponent({
14617
14655
  const indexes = confirmIndexes.value;
14618
14656
  const result = [];
14619
14657
  indexes == null ? void 0 : indexes.forEach((index) => {
14620
- if (index > -1 && index < props.options.length && props.options[index]) {
14658
+ if (index > -1 && index < currentOptions2.value.length && currentOptions2.value[index]) {
14621
14659
  result.push({
14622
- [props.textKey]: props.options[index][props.textKey],
14623
- value: props.options[index].value,
14660
+ [props.textKey]: currentOptions2.value[index][props.textKey],
14661
+ value: currentOptions2.value[index].value,
14624
14662
  initialIndex: index
14625
14663
  });
14626
14664
  }
@@ -14676,20 +14714,20 @@ var stdin_default$z = defineComponent({
14676
14714
  }, [slots.toolbar ? slots.toolbar() : [genCancel(), genConfirm()]]);
14677
14715
  }
14678
14716
  };
14679
- const genOptionItems = () => {
14717
+ const genOptionItems = computed(() => {
14680
14718
  let formatOptions = [];
14681
- if (props.options && props.options[0] && typeof props.options[0] !== "object") {
14682
- formatOptions = props.options.map((v) => ({
14719
+ if (currentOptions2.value && currentOptions2.value[0] && typeof currentOptions2.value[0] !== "object") {
14720
+ formatOptions = currentOptions2.value.map((v) => ({
14683
14721
  value: v,
14684
14722
  text: v
14685
14723
  }));
14686
14724
  } else {
14687
- formatOptions = props.options;
14725
+ formatOptions = currentOptions2.value;
14688
14726
  }
14689
14727
  return createVNode(stdin_default$A, {
14690
14728
  "ref": pickerOptions,
14691
14729
  "currentIndexes": confirmIndexes.value,
14692
- "onUpdate:currentIndexes": ($event) => confirmIndexes.value = $event,
14730
+ "onUpdate:currentIndexes": [($event) => confirmIndexes.value = $event, onUpdateCurrentIndexes],
14693
14731
  "columnCounts": props.columnCounts,
14694
14732
  "initialOptions": formatOptions,
14695
14733
  "allowHtml": props.allowHtml,
@@ -14700,15 +14738,18 @@ var stdin_default$z = defineComponent({
14700
14738
  }, {
14701
14739
  option: slots.option
14702
14740
  });
14703
- };
14741
+ });
14704
14742
  const genOptions2 = () => createVNode("div", {
14705
14743
  "class": bem$r("options")
14706
- }, [genOptionItems()]);
14744
+ }, [genOptionItems.value]);
14707
14745
  const renderMultiplePicker = () => createVNode("div", {
14708
14746
  "class": bem$r()
14709
14747
  }, [genTitle(), props.loading ? createVNode(stdin_default$1Q, {
14710
14748
  "class": bem$r("loading")
14711
14749
  }, null) : "", genOptions2(), props.toolbarPosition === "bottom" ? genToolbar() : ""]);
14750
+ useExpose({
14751
+ resetOptions
14752
+ });
14712
14753
  return () => {
14713
14754
  if (props.popup) {
14714
14755
  return createVNode(stdin_default$1S, {
@@ -20499,7 +20540,7 @@ const Lazyload = {
20499
20540
  });
20500
20541
  }
20501
20542
  };
20502
- const version = "3.1.24";
20543
+ const version = "3.1.26";
20503
20544
  function install(app) {
20504
20545
  const components = [
20505
20546
  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,37 @@
16320
16324
  emit,
16321
16325
  slots
16322
16326
  }) {
16327
+ const currentOptions2 = vue.ref(props.options);
16328
+ vue.watch(props.options, (newVal) => {
16329
+ currentOptions2.value = newVal;
16330
+ });
16323
16331
  const confirmIndexes = vue.ref(props.selectedIndex);
16324
16332
  const confirmValues = vue.ref(props.selectedValue);
16333
+ const resetOptions = (props2) => {
16334
+ currentOptions2.value = props2.options;
16335
+ confirmIndexes.value = props2.selectedIndex;
16336
+ if (confirmIndexes.value.length > 0) {
16337
+ getValuesByIndexes();
16338
+ } else {
16339
+ confirmValues.value = [];
16340
+ }
16341
+ emit("update:selectedValue", confirmValues.value);
16342
+ };
16343
+ const onUpdateCurrentIndexes = (newVal) => {
16344
+ confirmIndexes.value = newVal;
16345
+ if (newVal.length > 0) {
16346
+ getValuesByIndexes();
16347
+ } else {
16348
+ confirmValues.value = [];
16349
+ }
16350
+ getValuesByIndexes();
16351
+ emit("update:selectedValue", confirmValues.value);
16352
+ };
16325
16353
  const getIndexesByValues = () => {
16326
16354
  var _a;
16327
16355
  if (confirmValues.value && confirmValues.value.length > 0) {
16328
16356
  confirmIndexes.value.splice(0, confirmIndexes.value.length);
16329
- (_a = props.options) == null ? void 0 : _a.forEach((option, index) => {
16357
+ (_a = currentOptions2.value) == null ? void 0 : _a.forEach((option, index) => {
16330
16358
  if (option.value && confirmValues.value.includes(option.value)) {
16331
16359
  confirmIndexes.value.push(index);
16332
16360
  }
@@ -16334,6 +16362,16 @@
16334
16362
  }
16335
16363
  };
16336
16364
  getIndexesByValues();
16365
+ const getValuesByIndexes = () => {
16366
+ if (confirmIndexes.value && confirmIndexes.value.length > 0) {
16367
+ confirmValues.value.splice(0, confirmValues.value.length);
16368
+ confirmIndexes.value.forEach((index) => {
16369
+ if (index > -1 && index < currentOptions2.value.length) {
16370
+ confirmValues.value.push(currentOptions2.value[index].value);
16371
+ }
16372
+ });
16373
+ }
16374
+ };
16337
16375
  const pickerOptions = vue.ref();
16338
16376
  const currentShow = vue.ref(props.showPicker);
16339
16377
  const DEFAULT_ITEM_HEIGHT = vue.ref(36);
@@ -16364,10 +16402,10 @@
16364
16402
  const indexes = confirmIndexes.value;
16365
16403
  const result = [];
16366
16404
  indexes == null ? void 0 : indexes.forEach((index) => {
16367
- if (index > -1 && index < props.options.length && props.options[index]) {
16405
+ if (index > -1 && index < currentOptions2.value.length && currentOptions2.value[index]) {
16368
16406
  result.push({
16369
- [props.textKey]: props.options[index][props.textKey],
16370
- value: props.options[index].value,
16407
+ [props.textKey]: currentOptions2.value[index][props.textKey],
16408
+ value: currentOptions2.value[index].value,
16371
16409
  initialIndex: index
16372
16410
  });
16373
16411
  }
@@ -16423,20 +16461,20 @@
16423
16461
  }, [slots.toolbar ? slots.toolbar() : [genCancel(), genConfirm()]]);
16424
16462
  }
16425
16463
  };
16426
- const genOptionItems = () => {
16464
+ const genOptionItems = vue.computed(() => {
16427
16465
  let formatOptions = [];
16428
- if (props.options && props.options[0] && typeof props.options[0] !== "object") {
16429
- formatOptions = props.options.map((v) => ({
16466
+ if (currentOptions2.value && currentOptions2.value[0] && typeof currentOptions2.value[0] !== "object") {
16467
+ formatOptions = currentOptions2.value.map((v) => ({
16430
16468
  value: v,
16431
16469
  text: v
16432
16470
  }));
16433
16471
  } else {
16434
- formatOptions = props.options;
16472
+ formatOptions = currentOptions2.value;
16435
16473
  }
16436
16474
  return vue.createVNode(stdin_default$A, {
16437
16475
  "ref": pickerOptions,
16438
16476
  "currentIndexes": confirmIndexes.value,
16439
- "onUpdate:currentIndexes": ($event) => confirmIndexes.value = $event,
16477
+ "onUpdate:currentIndexes": [($event) => confirmIndexes.value = $event, onUpdateCurrentIndexes],
16440
16478
  "columnCounts": props.columnCounts,
16441
16479
  "initialOptions": formatOptions,
16442
16480
  "allowHtml": props.allowHtml,
@@ -16447,15 +16485,18 @@
16447
16485
  }, {
16448
16486
  option: slots.option
16449
16487
  });
16450
- };
16488
+ });
16451
16489
  const genOptions2 = () => vue.createVNode("div", {
16452
16490
  "class": bem$r("options")
16453
- }, [genOptionItems()]);
16491
+ }, [genOptionItems.value]);
16454
16492
  const renderMultiplePicker = () => vue.createVNode("div", {
16455
16493
  "class": bem$r()
16456
16494
  }, [genTitle(), props.loading ? vue.createVNode(stdin_default$1Q, {
16457
16495
  "class": bem$r("loading")
16458
16496
  }, null) : "", genOptions2(), props.toolbarPosition === "bottom" ? genToolbar() : ""]);
16497
+ useExpose({
16498
+ resetOptions
16499
+ });
16459
16500
  return () => {
16460
16501
  if (props.popup) {
16461
16502
  return vue.createVNode(stdin_default$1S, {
@@ -24499,7 +24540,7 @@
24499
24540
  });
24500
24541
  }
24501
24542
  };
24502
- const version = "3.1.24";
24543
+ const version = "3.1.26";
24503
24544
  function install(app) {
24504
24545
  const components = [
24505
24546
  ActionSheet,