zartui 3.1.15 → 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.
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;
@@ -15925,7 +15939,8 @@ const pullRefreshProps = {
15925
15939
  loadingText: String,
15926
15940
  pullDistance: numericProp,
15927
15941
  successDuration: makeNumericProp(500),
15928
- animationDuration: makeNumericProp(300)
15942
+ animationDuration: makeNumericProp(300),
15943
+ scrollElement: null
15929
15944
  };
15930
15945
  var stdin_default$q = vue.defineComponent({
15931
15946
  name: name$k,
@@ -15938,7 +15953,17 @@ var stdin_default$q = vue.defineComponent({
15938
15953
  let reachTop;
15939
15954
  const root = vue.ref();
15940
15955
  const track = vue.ref();
15941
- 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
+ });
15942
15967
  const state = vue.reactive({
15943
15968
  status: "normal",
15944
15969
  distance: 0,
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;
@@ -15923,7 +15937,8 @@ const pullRefreshProps = {
15923
15937
  loadingText: String,
15924
15938
  pullDistance: numericProp,
15925
15939
  successDuration: makeNumericProp(500),
15926
- animationDuration: makeNumericProp(300)
15940
+ animationDuration: makeNumericProp(300),
15941
+ scrollElement: null
15927
15942
  };
15928
15943
  var stdin_default$q = defineComponent({
15929
15944
  name: name$k,
@@ -15936,7 +15951,17 @@ var stdin_default$q = defineComponent({
15936
15951
  let reachTop;
15937
15952
  const root = ref();
15938
15953
  const track = ref();
15939
- 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
+ });
15940
15965
  const state = reactive({
15941
15966
  status: "normal",
15942
15967
  distance: 0,
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;
@@ -17566,7 +17580,8 @@
17566
17580
  loadingText: String,
17567
17581
  pullDistance: numericProp,
17568
17582
  successDuration: makeNumericProp(500),
17569
- animationDuration: makeNumericProp(300)
17583
+ animationDuration: makeNumericProp(300),
17584
+ scrollElement: null
17570
17585
  };
17571
17586
  var stdin_default$q = vue.defineComponent({
17572
17587
  name: name$k,
@@ -17579,7 +17594,17 @@
17579
17594
  let reachTop;
17580
17595
  const root = vue.ref();
17581
17596
  const track = vue.ref();
17582
- 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
+ });
17583
17608
  const state = vue.reactive({
17584
17609
  status: "normal",
17585
17610
  distance: 0,