zartui 3.1.14 → 3.1.16

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.
Files changed (40) hide show
  1. package/es/cell/Cell.d.ts +1 -1
  2. package/es/cell/index.d.ts +1 -1
  3. package/es/date-time-picker/DateTimePicker.mjs +1 -1
  4. package/es/dropdown-item/types.d.ts +3 -3
  5. package/es/field/Field.d.ts +1 -1
  6. package/es/field/index.d.ts +1 -1
  7. package/es/index.d.ts +1 -1
  8. package/es/index.mjs +1 -1
  9. package/es/multiple-picker/MultiplePicker.d.ts +16 -1
  10. package/es/multiple-picker/MultiplePicker.mjs +19 -2
  11. package/es/multiple-picker/MultiplePickerOptions.mjs +3 -1
  12. package/es/multiple-picker/index.d.ts +11 -1
  13. package/es/pull-refresh/PullRefresh.d.ts +5 -1
  14. package/es/pull-refresh/PullRefresh.mjs +15 -4
  15. package/es/pull-refresh/index.d.ts +2 -0
  16. package/es/utils/dom.d.ts +2 -0
  17. package/es/utils/dom.mjs +15 -0
  18. package/lib/cell/Cell.d.ts +1 -1
  19. package/lib/cell/index.d.ts +1 -1
  20. package/lib/date-time-picker/DateTimePicker.js +1 -1
  21. package/lib/dropdown-item/types.d.ts +3 -3
  22. package/lib/field/Field.d.ts +1 -1
  23. package/lib/field/index.d.ts +1 -1
  24. package/lib/index.d.ts +1 -1
  25. package/lib/index.js +1 -1
  26. package/lib/multiple-picker/MultiplePicker.d.ts +16 -1
  27. package/lib/multiple-picker/MultiplePicker.js +19 -2
  28. package/lib/multiple-picker/MultiplePickerOptions.js +3 -1
  29. package/lib/multiple-picker/index.d.ts +11 -1
  30. package/lib/pull-refresh/PullRefresh.d.ts +5 -1
  31. package/lib/pull-refresh/PullRefresh.js +13 -2
  32. package/lib/pull-refresh/index.d.ts +2 -0
  33. package/lib/utils/dom.d.ts +2 -0
  34. package/lib/utils/dom.js +15 -0
  35. package/lib/web-types.json +1 -1
  36. package/lib/zartui.cjs.js +49 -7
  37. package/lib/zartui.es.js +49 -7
  38. package/lib/zartui.js +49 -7
  39. package/lib/zartui.min.js +1 -1
  40. package/package.json +1 -1
package/lib/zartui.cjs.js CHANGED
@@ -134,6 +134,20 @@ function colorFromCSSClass(className, defaultColor) {
134
134
  document.body.removeChild(tmp);
135
135
  return !classColor ? defaultColor : classColor;
136
136
  }
137
+ const getTargetDom = (target) => {
138
+ if (target) {
139
+ if (typeof target === "string") {
140
+ return document.querySelectorAll(target)[0];
141
+ }
142
+ if (typeof target === "function") {
143
+ return target();
144
+ }
145
+ if (typeof target === "object" && target instanceof window.HTMLElement) {
146
+ return target;
147
+ }
148
+ }
149
+ return document.body;
150
+ };
137
151
  const { width: windowWidth, height: windowHeight } = use.useWindowSize();
138
152
  function addUnit(value) {
139
153
  if (isDef(value)) {
@@ -7193,7 +7207,7 @@ var stdin_default$17 = vue.defineComponent({
7193
7207
  }
7194
7208
  }
7195
7209
  onClose();
7196
- emit("confirm");
7210
+ emit("confirm", currentValue.value);
7197
7211
  };
7198
7212
  const onOpen = () => {
7199
7213
  var _a, _b, _c;
@@ -14696,7 +14710,8 @@ var stdin_default$z = vue.defineComponent({
14696
14710
  }, [slots.options ? slots.options(option) : vue.createVNode("div", childData, null)]);
14697
14711
  });
14698
14712
  };
14699
- const setConfirmIndex = (indexes) => {
14713
+ const setConfirmIndex = (data) => {
14714
+ const indexes = deepClone(data);
14700
14715
  state.confirmed = true;
14701
14716
  const keys = Object.keys(indexes);
14702
14717
  currentIndexes.value.length = 0;
@@ -14734,17 +14749,31 @@ const multiplePickerProps = {
14734
14749
  textKey: makeStringProp("text"),
14735
14750
  columnCounts: makeNumberProp(3),
14736
14751
  selectedIndex: makeArrayProp([]),
14752
+ selectedValue: makeArrayProp([]),
14737
14753
  popup: truthProp
14738
14754
  };
14739
14755
  var stdin_default$y = vue.defineComponent({
14740
14756
  name: name$s,
14741
14757
  props: multiplePickerProps,
14742
- emits: ["cancel", "confirm", "change", "update:showPicker", "update:selectedIndex"],
14758
+ emits: ["cancel", "confirm", "change", "update:showPicker", "update:selectedIndex", "update:selectedValue"],
14743
14759
  setup(props, {
14744
14760
  emit,
14745
14761
  slots
14746
14762
  }) {
14747
14763
  const confirmIndexes = vue.ref(props.selectedIndex);
14764
+ const confirmValues = vue.ref(props.selectedValue);
14765
+ const getIndexesByValues = () => {
14766
+ var _a;
14767
+ if (confirmValues.value && confirmValues.value.length > 0) {
14768
+ confirmIndexes.value.splice(0, confirmIndexes.value.length);
14769
+ (_a = props.options) == null ? void 0 : _a.forEach((option, index) => {
14770
+ if (option.value && confirmValues.value.includes(option.value)) {
14771
+ confirmIndexes.value.push(index);
14772
+ }
14773
+ });
14774
+ }
14775
+ };
14776
+ getIndexesByValues();
14748
14777
  const pickerOptions = vue.ref();
14749
14778
  const currentShow = vue.ref(props.showPicker);
14750
14779
  const DEFAULT_ITEM_HEIGHT = vue.ref(36);
@@ -14752,7 +14781,9 @@ var stdin_default$y = vue.defineComponent({
14752
14781
  if (newValue !== props.showPicker) {
14753
14782
  emit("update:showPicker", newValue);
14754
14783
  }
14755
- confirmIndexes.value = props.selectedIndex;
14784
+ confirmIndexes.value = deepClone(props.selectedIndex);
14785
+ confirmValues.value = deepClone(props.selectedValue);
14786
+ getIndexesByValues();
14756
14787
  });
14757
14788
  vue.watch(() => props.showPicker, (newValue) => {
14758
14789
  var _a;
@@ -15908,7 +15939,8 @@ const pullRefreshProps = {
15908
15939
  loadingText: String,
15909
15940
  pullDistance: numericProp,
15910
15941
  successDuration: makeNumericProp(500),
15911
- animationDuration: makeNumericProp(300)
15942
+ animationDuration: makeNumericProp(300),
15943
+ scrollElement: null
15912
15944
  };
15913
15945
  var stdin_default$q = vue.defineComponent({
15914
15946
  name: name$k,
@@ -15921,7 +15953,17 @@ var stdin_default$q = vue.defineComponent({
15921
15953
  let reachTop;
15922
15954
  const root = vue.ref();
15923
15955
  const track = vue.ref();
15924
- const scrollParent = use.useScrollParent(root);
15956
+ const rootScrollElement = use.useScrollParent(root);
15957
+ const scrollParent = vue.computed(() => {
15958
+ if (props.scrollElement) {
15959
+ const targetDom = getTargetDom(props.scrollElement);
15960
+ if (!targetDom) {
15961
+ console.warn("请检查props scroll-element元素是否存在!");
15962
+ }
15963
+ return targetDom != null ? targetDom : rootScrollElement.value;
15964
+ }
15965
+ return rootScrollElement.value;
15966
+ });
15925
15967
  const state = vue.reactive({
15926
15968
  status: "normal",
15927
15969
  distance: 0,
@@ -20544,7 +20586,7 @@ const Lazyload = {
20544
20586
  });
20545
20587
  }
20546
20588
  };
20547
- const version = "3.1.13";
20589
+ const version = "3.1.15";
20548
20590
  function install(app) {
20549
20591
  const components = [
20550
20592
  ActionSheet,
package/lib/zartui.es.js CHANGED
@@ -132,6 +132,20 @@ function colorFromCSSClass(className, defaultColor) {
132
132
  document.body.removeChild(tmp);
133
133
  return !classColor ? defaultColor : classColor;
134
134
  }
135
+ const getTargetDom = (target) => {
136
+ if (target) {
137
+ if (typeof target === "string") {
138
+ return document.querySelectorAll(target)[0];
139
+ }
140
+ if (typeof target === "function") {
141
+ return target();
142
+ }
143
+ if (typeof target === "object" && target instanceof window.HTMLElement) {
144
+ return target;
145
+ }
146
+ }
147
+ return document.body;
148
+ };
135
149
  const { width: windowWidth, height: windowHeight } = useWindowSize();
136
150
  function addUnit(value) {
137
151
  if (isDef(value)) {
@@ -7191,7 +7205,7 @@ var stdin_default$17 = defineComponent({
7191
7205
  }
7192
7206
  }
7193
7207
  onClose();
7194
- emit("confirm");
7208
+ emit("confirm", currentValue.value);
7195
7209
  };
7196
7210
  const onOpen = () => {
7197
7211
  var _a, _b, _c;
@@ -14694,7 +14708,8 @@ var stdin_default$z = defineComponent({
14694
14708
  }, [slots.options ? slots.options(option) : createVNode("div", childData, null)]);
14695
14709
  });
14696
14710
  };
14697
- const setConfirmIndex = (indexes) => {
14711
+ const setConfirmIndex = (data) => {
14712
+ const indexes = deepClone(data);
14698
14713
  state.confirmed = true;
14699
14714
  const keys = Object.keys(indexes);
14700
14715
  currentIndexes.value.length = 0;
@@ -14732,17 +14747,31 @@ const multiplePickerProps = {
14732
14747
  textKey: makeStringProp("text"),
14733
14748
  columnCounts: makeNumberProp(3),
14734
14749
  selectedIndex: makeArrayProp([]),
14750
+ selectedValue: makeArrayProp([]),
14735
14751
  popup: truthProp
14736
14752
  };
14737
14753
  var stdin_default$y = defineComponent({
14738
14754
  name: name$s,
14739
14755
  props: multiplePickerProps,
14740
- emits: ["cancel", "confirm", "change", "update:showPicker", "update:selectedIndex"],
14756
+ emits: ["cancel", "confirm", "change", "update:showPicker", "update:selectedIndex", "update:selectedValue"],
14741
14757
  setup(props, {
14742
14758
  emit,
14743
14759
  slots
14744
14760
  }) {
14745
14761
  const confirmIndexes = ref(props.selectedIndex);
14762
+ const confirmValues = ref(props.selectedValue);
14763
+ const getIndexesByValues = () => {
14764
+ var _a;
14765
+ if (confirmValues.value && confirmValues.value.length > 0) {
14766
+ confirmIndexes.value.splice(0, confirmIndexes.value.length);
14767
+ (_a = props.options) == null ? void 0 : _a.forEach((option, index) => {
14768
+ if (option.value && confirmValues.value.includes(option.value)) {
14769
+ confirmIndexes.value.push(index);
14770
+ }
14771
+ });
14772
+ }
14773
+ };
14774
+ getIndexesByValues();
14746
14775
  const pickerOptions = ref();
14747
14776
  const currentShow = ref(props.showPicker);
14748
14777
  const DEFAULT_ITEM_HEIGHT = ref(36);
@@ -14750,7 +14779,9 @@ var stdin_default$y = defineComponent({
14750
14779
  if (newValue !== props.showPicker) {
14751
14780
  emit("update:showPicker", newValue);
14752
14781
  }
14753
- confirmIndexes.value = props.selectedIndex;
14782
+ confirmIndexes.value = deepClone(props.selectedIndex);
14783
+ confirmValues.value = deepClone(props.selectedValue);
14784
+ getIndexesByValues();
14754
14785
  });
14755
14786
  watch(() => props.showPicker, (newValue) => {
14756
14787
  var _a;
@@ -15906,7 +15937,8 @@ const pullRefreshProps = {
15906
15937
  loadingText: String,
15907
15938
  pullDistance: numericProp,
15908
15939
  successDuration: makeNumericProp(500),
15909
- animationDuration: makeNumericProp(300)
15940
+ animationDuration: makeNumericProp(300),
15941
+ scrollElement: null
15910
15942
  };
15911
15943
  var stdin_default$q = defineComponent({
15912
15944
  name: name$k,
@@ -15919,7 +15951,17 @@ var stdin_default$q = defineComponent({
15919
15951
  let reachTop;
15920
15952
  const root = ref();
15921
15953
  const track = ref();
15922
- const scrollParent = useScrollParent(root);
15954
+ const rootScrollElement = useScrollParent(root);
15955
+ const scrollParent = computed(() => {
15956
+ if (props.scrollElement) {
15957
+ const targetDom = getTargetDom(props.scrollElement);
15958
+ if (!targetDom) {
15959
+ console.warn("请检查props scroll-element元素是否存在!");
15960
+ }
15961
+ return targetDom != null ? targetDom : rootScrollElement.value;
15962
+ }
15963
+ return rootScrollElement.value;
15964
+ });
15923
15965
  const state = reactive({
15924
15966
  status: "normal",
15925
15967
  distance: 0,
@@ -20542,7 +20584,7 @@ const Lazyload = {
20542
20584
  });
20543
20585
  }
20544
20586
  };
20545
- const version = "3.1.13";
20587
+ const version = "3.1.15";
20546
20588
  function install(app) {
20547
20589
  const components = [
20548
20590
  ActionSheet,
package/lib/zartui.js CHANGED
@@ -404,6 +404,20 @@
404
404
  document.body.removeChild(tmp);
405
405
  return !classColor ? defaultColor : classColor;
406
406
  }
407
+ const getTargetDom = (target) => {
408
+ if (target) {
409
+ if (typeof target === "string") {
410
+ return document.querySelectorAll(target)[0];
411
+ }
412
+ if (typeof target === "function") {
413
+ return target();
414
+ }
415
+ if (typeof target === "object" && target instanceof window.HTMLElement) {
416
+ return target;
417
+ }
418
+ }
419
+ return document.body;
420
+ };
407
421
  const { width: windowWidth, height: windowHeight } = useWindowSize();
408
422
  function addUnit(value) {
409
423
  if (isDef(value)) {
@@ -7437,7 +7451,7 @@
7437
7451
  }
7438
7452
  }
7439
7453
  onClose();
7440
- emit("confirm");
7454
+ emit("confirm", currentValue.value);
7441
7455
  };
7442
7456
  const onOpen = () => {
7443
7457
  var _a, _b, _c;
@@ -15013,7 +15027,8 @@
15013
15027
  }, [slots.options ? slots.options(option) : vue.createVNode("div", childData, null)]);
15014
15028
  });
15015
15029
  };
15016
- const setConfirmIndex = (indexes) => {
15030
+ const setConfirmIndex = (data) => {
15031
+ const indexes = deepClone(data);
15017
15032
  state.confirmed = true;
15018
15033
  const keys = Object.keys(indexes);
15019
15034
  currentIndexes.value.length = 0;
@@ -15051,17 +15066,31 @@
15051
15066
  textKey: makeStringProp("text"),
15052
15067
  columnCounts: makeNumberProp(3),
15053
15068
  selectedIndex: makeArrayProp([]),
15069
+ selectedValue: makeArrayProp([]),
15054
15070
  popup: truthProp
15055
15071
  };
15056
15072
  var stdin_default$y = vue.defineComponent({
15057
15073
  name: name$s,
15058
15074
  props: multiplePickerProps,
15059
- emits: ["cancel", "confirm", "change", "update:showPicker", "update:selectedIndex"],
15075
+ emits: ["cancel", "confirm", "change", "update:showPicker", "update:selectedIndex", "update:selectedValue"],
15060
15076
  setup(props, {
15061
15077
  emit,
15062
15078
  slots
15063
15079
  }) {
15064
15080
  const confirmIndexes = vue.ref(props.selectedIndex);
15081
+ const confirmValues = vue.ref(props.selectedValue);
15082
+ const getIndexesByValues = () => {
15083
+ var _a;
15084
+ if (confirmValues.value && confirmValues.value.length > 0) {
15085
+ confirmIndexes.value.splice(0, confirmIndexes.value.length);
15086
+ (_a = props.options) == null ? void 0 : _a.forEach((option, index) => {
15087
+ if (option.value && confirmValues.value.includes(option.value)) {
15088
+ confirmIndexes.value.push(index);
15089
+ }
15090
+ });
15091
+ }
15092
+ };
15093
+ getIndexesByValues();
15065
15094
  const pickerOptions = vue.ref();
15066
15095
  const currentShow = vue.ref(props.showPicker);
15067
15096
  const DEFAULT_ITEM_HEIGHT = vue.ref(36);
@@ -15069,7 +15098,9 @@
15069
15098
  if (newValue !== props.showPicker) {
15070
15099
  emit("update:showPicker", newValue);
15071
15100
  }
15072
- confirmIndexes.value = props.selectedIndex;
15101
+ confirmIndexes.value = deepClone(props.selectedIndex);
15102
+ confirmValues.value = deepClone(props.selectedValue);
15103
+ getIndexesByValues();
15073
15104
  });
15074
15105
  vue.watch(() => props.showPicker, (newValue) => {
15075
15106
  var _a;
@@ -17549,7 +17580,8 @@
17549
17580
  loadingText: String,
17550
17581
  pullDistance: numericProp,
17551
17582
  successDuration: makeNumericProp(500),
17552
- animationDuration: makeNumericProp(300)
17583
+ animationDuration: makeNumericProp(300),
17584
+ scrollElement: null
17553
17585
  };
17554
17586
  var stdin_default$q = vue.defineComponent({
17555
17587
  name: name$k,
@@ -17562,7 +17594,17 @@
17562
17594
  let reachTop;
17563
17595
  const root = vue.ref();
17564
17596
  const track = vue.ref();
17565
- const scrollParent = useScrollParent(root);
17597
+ const rootScrollElement = useScrollParent(root);
17598
+ const scrollParent = vue.computed(() => {
17599
+ if (props.scrollElement) {
17600
+ const targetDom = getTargetDom(props.scrollElement);
17601
+ if (!targetDom) {
17602
+ console.warn("请检查props scroll-element元素是否存在!");
17603
+ }
17604
+ return targetDom != null ? targetDom : rootScrollElement.value;
17605
+ }
17606
+ return rootScrollElement.value;
17607
+ });
17566
17608
  const state = vue.reactive({
17567
17609
  status: "normal",
17568
17610
  distance: 0,
@@ -22162,7 +22204,7 @@
22162
22204
  });
22163
22205
  }
22164
22206
  };
22165
- const version = "3.1.13";
22207
+ const version = "3.1.15";
22166
22208
  function install(app) {
22167
22209
  const components = [
22168
22210
  ActionSheet,