@varlet/ui 2.10.3-alpha.1683532936621 → 2.10.3-alpha.1683732401073

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/varlet.cjs.js CHANGED
@@ -22,6 +22,7 @@ const isURL = (val) => {
22
22
  return /^(http)|(\.*\/)/.test(val);
23
23
  };
24
24
  const isEmpty = (val) => val === void 0 || val === null || val === "" || Array.isArray(val) && !val.length;
25
+ const isWindow = (val) => val === window;
25
26
  const toNumber = (val) => {
26
27
  if (val == null)
27
28
  return 0;
@@ -147,45 +148,53 @@ function error$1(source, message) {
147
148
  function warn(source, message) {
148
149
  console.warn("Varlet [" + source + "]: " + message);
149
150
  }
150
- function asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, key, arg) {
151
- try {
152
- var info = gen[key](arg);
153
- var value = info.value;
154
- } catch (error2) {
155
- reject(error2);
156
- return;
157
- }
158
- if (info.done) {
159
- resolve(value);
160
- } else {
161
- Promise.resolve(value).then(_next, _throw);
162
- }
163
- }
164
- function _asyncToGenerator$e(fn2) {
165
- return function() {
166
- var self2 = this, args = arguments;
167
- return new Promise(function(resolve, reject) {
168
- var gen = fn2.apply(self2, args);
169
- function _next(value) {
170
- asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, "next", value);
171
- }
172
- function _throw(err) {
173
- asyncGeneratorStep$e(gen, resolve, reject, _next, _throw, "throw", err);
151
+ function _extends$q() {
152
+ _extends$q = Object.assign ? Object.assign.bind() : function(target) {
153
+ for (var i = 1; i < arguments.length; i++) {
154
+ var source = arguments[i];
155
+ for (var key in source) {
156
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
157
+ target[key] = source[key];
158
+ }
174
159
  }
175
- _next(void 0);
176
- });
160
+ }
161
+ return target;
177
162
  };
163
+ return _extends$q.apply(this, arguments);
164
+ }
165
+ function getStyle$1(element) {
166
+ return window.getComputedStyle(element);
167
+ }
168
+ function getRect(element) {
169
+ if (isWindow(element)) {
170
+ var width = element.innerWidth;
171
+ var height = element.innerHeight;
172
+ var rect = {
173
+ x: 0,
174
+ y: 0,
175
+ top: 0,
176
+ left: 0,
177
+ right: width,
178
+ bottom: height,
179
+ width,
180
+ height
181
+ };
182
+ return _extends$q({}, rect, {
183
+ toJSON: () => rect
184
+ });
185
+ }
186
+ return element.getBoundingClientRect();
178
187
  }
179
188
  function getLeft(element) {
180
189
  var {
181
190
  left: left2
182
- } = element.getBoundingClientRect();
191
+ } = getRect(element);
183
192
  return left2 + (document.body.scrollLeft || document.documentElement.scrollLeft);
184
193
  }
185
194
  function getTop$1(element) {
186
195
  var {
187
196
  top: top2
188
- } = element.getBoundingClientRect();
197
+ } = getRect(element);
189
198
  return top2 + (document.body.scrollTop || document.documentElement.scrollTop);
190
199
  }
191
200
  function getScrollTop(element) {
@@ -196,32 +205,25 @@ function getScrollLeft(element) {
196
205
  var left2 = "scrollLeft" in element ? element.scrollLeft : element.pageXOffset;
197
206
  return Math.max(left2, 0);
198
207
  }
199
- function inViewport(_x) {
200
- return _inViewport.apply(this, arguments);
201
- }
202
- function _inViewport() {
203
- _inViewport = _asyncToGenerator$e(function* (element) {
204
- yield doubleRaf();
205
- var {
206
- top: top2,
207
- bottom: bottom2,
208
- left: left2,
209
- right: right2
210
- } = element.getBoundingClientRect();
211
- var {
212
- innerWidth,
213
- innerHeight
214
- } = window;
215
- var xInViewport = left2 <= innerWidth && right2 >= 0;
216
- var yInViewport = top2 <= innerHeight && bottom2 >= 0;
217
- return xInViewport && yInViewport;
218
- });
219
- return _inViewport.apply(this, arguments);
208
+ function inViewport(element) {
209
+ var {
210
+ top: top2,
211
+ bottom: bottom2,
212
+ left: left2,
213
+ right: right2
214
+ } = getRect(element);
215
+ var {
216
+ width,
217
+ height
218
+ } = getRect(window);
219
+ var xInViewport = left2 <= width && right2 >= 0;
220
+ var yInViewport = top2 <= height && bottom2 >= 0;
221
+ return xInViewport && yInViewport;
220
222
  }
221
223
  function getTranslate(el) {
222
224
  var {
223
225
  transform
224
- } = window.getComputedStyle(el);
226
+ } = getStyle$1(el);
225
227
  return +transform.slice(transform.lastIndexOf(",") + 2, transform.length - 1);
226
228
  }
227
229
  function getParentScroller(el) {
@@ -238,7 +240,7 @@ function getParentScroller(el) {
238
240
  var {
239
241
  overflowY,
240
242
  overflow
241
- } = window.getComputedStyle(element);
243
+ } = getStyle$1(element);
242
244
  if (scrollRE.test(overflowY) || scrollRE.test(overflow)) {
243
245
  return element;
244
246
  }
@@ -248,7 +250,7 @@ function getParentScroller(el) {
248
250
  function getAllParentScroller(el) {
249
251
  var allParentScroller = [];
250
252
  var element = el;
251
- while (element !== window) {
253
+ while (!isWindow(element)) {
252
254
  element = getParentScroller(element);
253
255
  allParentScroller.push(element);
254
256
  }
@@ -268,15 +270,15 @@ function getTarget(target, componentName) {
268
270
  }
269
271
  function getViewportSize() {
270
272
  var {
271
- innerWidth,
272
- innerHeight
273
- } = window;
274
- return innerWidth > innerHeight ? {
275
- vMin: innerHeight,
276
- vMax: innerWidth
273
+ width,
274
+ height
275
+ } = getRect(window);
276
+ return width > height ? {
277
+ vMin: height,
278
+ vMax: width
277
279
  } : {
278
- vMin: innerWidth,
279
- vMax: innerHeight
280
+ vMin: width,
281
+ vMax: height
280
282
  };
281
283
  }
282
284
  var isRem = (value) => isString(value) && value.endsWith("rem");
@@ -295,15 +297,19 @@ var toPxNum = (value) => {
295
297
  if (isPx(value)) {
296
298
  return +value.replace("px", "");
297
299
  }
300
+ var {
301
+ width,
302
+ height
303
+ } = getRect(window);
298
304
  if (isVw(value)) {
299
- return +value.replace("vw", "") * window.innerWidth / 100;
305
+ return +value.replace("vw", "") * width / 100;
300
306
  }
301
307
  if (isVh(value)) {
302
- return +value.replace("vh", "") * window.innerHeight / 100;
308
+ return +value.replace("vh", "") * height / 100;
303
309
  }
304
310
  if (isRem(value)) {
305
311
  var num = +value.replace("rem", "");
306
- var rootFontSize = window.getComputedStyle(document.documentElement).fontSize;
312
+ var rootFontSize = getStyle$1(document.documentElement).fontSize;
307
313
  return num * parseFloat(rootFontSize);
308
314
  }
309
315
  if (isVMin(value)) {
@@ -2254,7 +2260,10 @@ function check(_x) {
2254
2260
  }
2255
2261
  function _check() {
2256
2262
  _check = _asyncToGenerator$b(function* (el) {
2257
- (yield inViewport(el)) && attemptLoad(el);
2263
+ yield doubleRaf();
2264
+ if (inViewport(el)) {
2265
+ attemptLoad(el);
2266
+ }
2258
2267
  });
2259
2268
  return _check.apply(this, arguments);
2260
2269
  }
@@ -6009,7 +6018,7 @@ var __sfc__$W = vue.defineComponent({
6009
6018
  var {
6010
6019
  offsetHeight
6011
6020
  } = contentEl.value;
6012
- contentEl.value.style.height = 0 + "px";
6021
+ contentEl.value.style.height = "0px";
6013
6022
  requestAnimationFrame(() => {
6014
6023
  contentEl.value.style.height = offsetHeight + "px";
6015
6024
  if (!isInitToTrigger)
@@ -6032,7 +6041,7 @@ var __sfc__$W = vue.defineComponent({
6032
6041
  } = contentEl.value;
6033
6042
  contentEl.value.style.height = offsetHeight + "px";
6034
6043
  requestAnimationFrame(() => {
6035
- contentEl.value.style.height = 0 + "px";
6044
+ contentEl.value.style.height = "0px";
6036
6045
  });
6037
6046
  };
6038
6047
  var transitionend = () => {
@@ -7597,7 +7606,8 @@ function finalise(x, sd, rm, isTruncated) {
7597
7606
  }
7598
7607
  }
7599
7608
  isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
7600
- roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
7609
+ roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && // Check whether the digit to the left of the rounding digit is odd.
7610
+ (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
7601
7611
  if (sd < 1 || !xd[0]) {
7602
7612
  xd.length = 0;
7603
7613
  if (roundUp) {
@@ -9159,9 +9169,9 @@ Utils.w = wrapper;
9159
9169
  var parseDate = function parseDate2(cfg) {
9160
9170
  var date = cfg.date, utc = cfg.utc;
9161
9171
  if (date === null)
9162
- return new Date(NaN);
9172
+ return /* @__PURE__ */ new Date(NaN);
9163
9173
  if (Utils.u(date))
9164
- return new Date();
9174
+ return /* @__PURE__ */ new Date();
9165
9175
  if (date instanceof Date)
9166
9176
  return new Date(date);
9167
9177
  if (typeof date === "string" && !/Z$/i.test(date)) {
@@ -14181,7 +14191,7 @@ var __sfc__$I = vue.defineComponent({
14181
14191
  bindSwipeItems,
14182
14192
  length
14183
14193
  } = useSwipeItems();
14184
- var isCalledPrevOrNext = false;
14194
+ var initializedIndex = false;
14185
14195
  var touching = false;
14186
14196
  var timer = -1;
14187
14197
  var startX;
@@ -14265,7 +14275,11 @@ var __sfc__$I = vue.defineComponent({
14265
14275
  });
14266
14276
  };
14267
14277
  var initialIndex = () => {
14278
+ if (initializedIndex) {
14279
+ return;
14280
+ }
14268
14281
  index.value = boundaryIndex(toNumber(props2.initialIndex));
14282
+ initializedIndex = true;
14269
14283
  };
14270
14284
  var startAutoplay = () => {
14271
14285
  var {
@@ -14376,7 +14390,7 @@ var __sfc__$I = vue.defineComponent({
14376
14390
  if (length.value <= 1) {
14377
14391
  return;
14378
14392
  }
14379
- isCalledPrevOrNext = true;
14393
+ initialIndex();
14380
14394
  var {
14381
14395
  loop,
14382
14396
  onChange
@@ -14401,7 +14415,7 @@ var __sfc__$I = vue.defineComponent({
14401
14415
  if (length.value <= 1) {
14402
14416
  return;
14403
14417
  }
14404
- isCalledPrevOrNext = true;
14418
+ initialIndex();
14405
14419
  var {
14406
14420
  loop,
14407
14421
  onChange
@@ -14444,9 +14458,8 @@ var __sfc__$I = vue.defineComponent({
14444
14458
  };
14445
14459
  bindSwipeItems(swipeProvider);
14446
14460
  vue.watch(() => length.value, /* @__PURE__ */ _asyncToGenerator$7(function* () {
14447
- isCalledPrevOrNext = false;
14448
14461
  yield doubleRaf();
14449
- !isCalledPrevOrNext && initialIndex();
14462
+ initialIndex();
14450
14463
  resize();
14451
14464
  }));
14452
14465
  vue.onActivated(resize);
@@ -15753,10 +15766,6 @@ function __render__$B(_ctx, _cache) {
15753
15766
  "div",
15754
15767
  {
15755
15768
  class: vue.normalizeClass(_ctx.classes(_ctx.n(), _ctx.n("$--box"), _ctx.n("--" + _ctx.variant), [_ctx.size === "small", _ctx.n("--small")], [_ctx.disabled, _ctx.n("--disabled")])),
15756
- style: vue.normalizeStyle({
15757
- "--field-decorator-legend-max-width": _ctx.legendMaxWidth,
15758
- "--filed-decorator-controller-width": _ctx.controllerWidth
15759
- }),
15760
15769
  onClick: _cache[0] || (_cache[0] = function() {
15761
15770
  return _ctx.handleClick && _ctx.handleClick(...arguments);
15762
15771
  })
@@ -15768,14 +15777,14 @@ function __render__$B(_ctx, _cache) {
15768
15777
  ref: "controllerEl",
15769
15778
  style: vue.normalizeStyle({
15770
15779
  color: _ctx.color,
15771
- cursor: _ctx.cursor
15780
+ cursor: _ctx.cursor,
15781
+ overflow: _ctx.isFloating ? "visible" : "hidden"
15772
15782
  })
15773
15783
  },
15774
15784
  [vue.createElementVNode(
15775
15785
  "div",
15776
15786
  {
15777
- class: vue.normalizeClass(_ctx.classes(_ctx.n("icon"), [!_ctx.hint, _ctx.n("--icon-non-hint")])),
15778
- ref: "prependIconEl"
15787
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("icon"), [!_ctx.hint, _ctx.n("--icon-non-hint")]))
15779
15788
  },
15780
15789
  [vue.renderSlot(_ctx.$slots, "prepend-icon")],
15781
15790
  2
@@ -15783,41 +15792,44 @@ function __render__$B(_ctx, _cache) {
15783
15792
  ), vue.createElementVNode(
15784
15793
  "div",
15785
15794
  {
15795
+ ref: "middleEl",
15786
15796
  class: vue.normalizeClass(_ctx.classes(_ctx.n("middle"), [!_ctx.hint, _ctx.n("--middle-non-hint")]))
15787
15797
  },
15788
- [vue.renderSlot(_ctx.$slots, "default"), _ctx.hint || _ctx.alwaysCustomPlaceholder ? (vue.openBlock(), vue.createElementBlock(
15789
- "label",
15790
- {
15791
- key: 0,
15792
- class: vue.normalizeClass(_ctx.classes(_ctx.n("placeholder"), _ctx.n("$--ellipsis"), [_ctx.isFocus, _ctx.n("--focus")], [_ctx.formDisabled || _ctx.disabled, _ctx.n("--disabled")], [_ctx.errorMessage, _ctx.n("--error")], [!_ctx.hint, _ctx.n("--placeholder-non-hint")], _ctx.computePlaceholderState())),
15793
- style: vue.normalizeStyle({
15794
- transform: _ctx.placeholderTransform,
15795
- color: _ctx.color
15796
- }),
15797
- for: _ctx.id
15798
- },
15799
- [vue.createElementVNode(
15800
- "span",
15801
- null,
15802
- vue.toDisplayString(_ctx.placeholder),
15803
- 1
15804
- /* TEXT */
15805
- ), vue.createElementVNode(
15806
- "span",
15807
- {
15808
- class: vue.normalizeClass(_ctx.n("placeholder-text")),
15809
- ref: "placeholderTextEl"
15810
- },
15811
- vue.toDisplayString(_ctx.placeholder),
15812
- 3
15813
- /* TEXT, CLASS */
15814
- )],
15815
- 14,
15816
- _hoisted_1$f
15817
- )) : vue.createCommentVNode("v-if", true)],
15798
+ [vue.renderSlot(_ctx.$slots, "default")],
15818
15799
  2
15819
15800
  /* CLASS */
15820
- ), vue.createElementVNode(
15801
+ ), (_ctx.hint || _ctx.alwaysCustomPlaceholder) && _ctx.placeholderTransform ? (vue.openBlock(), vue.createElementBlock(
15802
+ "label",
15803
+ {
15804
+ key: 0,
15805
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("placeholder"), _ctx.n("$--ellipsis"), [_ctx.isFocus, _ctx.n("--focus")], [_ctx.formDisabled || _ctx.disabled, _ctx.n("--disabled")], [_ctx.errorMessage, _ctx.n("--error")], [!_ctx.hint, _ctx.n("--placeholder-non-hint")], _ctx.computePlaceholderState())),
15806
+ style: vue.normalizeStyle({
15807
+ color: _ctx.color,
15808
+ transform: _ctx.placeholderTransform,
15809
+ maxWidth: _ctx.placeholderMaxWidth
15810
+ }),
15811
+ for: _ctx.id
15812
+ },
15813
+ [vue.createElementVNode(
15814
+ "span",
15815
+ null,
15816
+ vue.toDisplayString(_ctx.placeholder),
15817
+ 1
15818
+ /* TEXT */
15819
+ )],
15820
+ 14,
15821
+ _hoisted_1$f
15822
+ )) : vue.createCommentVNode("v-if", true), _ctx.variant === "outlined" ? (vue.openBlock(), vue.createElementBlock(
15823
+ "span",
15824
+ {
15825
+ key: 1,
15826
+ ref: "placeholderTextEl",
15827
+ class: vue.normalizeClass([_ctx.n("placeholder-text"), _ctx.n("$--ellipsis")])
15828
+ },
15829
+ vue.toDisplayString(_ctx.placeholder),
15830
+ 3
15831
+ /* TEXT, CLASS */
15832
+ )) : vue.createCommentVNode("v-if", true), vue.createElementVNode(
15821
15833
  "div",
15822
15834
  {
15823
15835
  class: vue.normalizeClass(_ctx.classes(_ctx.n("icon"), [!_ctx.hint, _ctx.n("--icon-non-hint")]))
@@ -15850,23 +15862,24 @@ function __render__$B(_ctx, _cache) {
15850
15862
  {
15851
15863
  key: 0,
15852
15864
  class: vue.normalizeClass(_ctx.classes(_ctx.n("line"), [_ctx.isFocus, _ctx.n("--line-focus")], [_ctx.errorMessage, _ctx.n("--line-error")], [_ctx.formDisabled || _ctx.disabled, _ctx.n("--line-disabled")])),
15853
- ref: "fieldsetEl"
15865
+ style: vue.normalizeStyle({
15866
+ borderColor: _ctx.color
15867
+ })
15854
15868
  },
15855
15869
  [vue.createElementVNode(
15856
15870
  "legend",
15857
15871
  {
15858
- class: vue.normalizeClass(_ctx.classes(_ctx.n("line-legend"), [_ctx.isFloating(), _ctx.n("line-legend--hint")])),
15872
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("line-legend"), [_ctx.isFloating, _ctx.n("line-legend--hint")])),
15859
15873
  style: vue.normalizeStyle({
15860
- width: _ctx.legendWidth,
15861
- maxWidth: _ctx.legendMaxWidth
15874
+ width: _ctx.legendWidth
15862
15875
  })
15863
15876
  },
15864
15877
  null,
15865
15878
  6
15866
15879
  /* CLASS, STYLE */
15867
15880
  )],
15868
- 2
15869
- /* CLASS */
15881
+ 6
15882
+ /* CLASS, STYLE */
15870
15883
  )) : (vue.openBlock(), vue.createElementBlock(
15871
15884
  "div",
15872
15885
  {
@@ -15894,8 +15907,8 @@ function __render__$B(_ctx, _cache) {
15894
15907
  2112
15895
15908
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
15896
15909
  )) : vue.createCommentVNode("v-if", true)],
15897
- 6
15898
- /* CLASS, STYLE */
15910
+ 2
15911
+ /* CLASS */
15899
15912
  );
15900
15913
  }
15901
15914
  var __sfc__$C = vue.defineComponent({
@@ -15905,61 +15918,49 @@ var __sfc__$C = vue.defineComponent({
15905
15918
  },
15906
15919
  props: props$y,
15907
15920
  setup(props2) {
15908
- var fieldsetEl = vue.ref(null);
15909
15921
  var controllerEl = vue.ref(null);
15922
+ var middleEl = vue.ref(null);
15910
15923
  var placeholderTextEl = vue.ref(null);
15911
- var prependIconEl = vue.ref(null);
15912
- var legendMaxWidth = vue.ref("");
15913
15924
  var legendWidth = vue.ref("");
15914
- var controllerWidth = vue.ref("");
15915
15925
  var placeholderTransform = vue.ref("");
15926
+ var placeholderMaxWidth = vue.ref("");
15916
15927
  var color = vue.computed(() => !props2.errorMessage ? props2.isFocus ? props2.focusColor : props2.blurColor : void 0);
15928
+ var isFloating = vue.computed(() => props2.hint && (!isEmpty(props2.value) || props2.isFocus));
15917
15929
  var computePlaceholderState = () => {
15918
15930
  var {
15919
15931
  hint,
15920
15932
  value,
15921
- isFocus,
15922
15933
  composing
15923
15934
  } = props2;
15924
15935
  if (!hint && (!isEmpty(value) || composing)) {
15925
15936
  return n$A("--placeholder-hidden");
15926
15937
  }
15927
- if (hint && (!isEmpty(value) || isFocus)) {
15928
- return n$A("--placeholder-hint");
15929
- }
15930
- };
15931
- var resetSize = () => {
15932
- legendWidth.value = "";
15933
- legendMaxWidth.value = "";
15934
- placeholderTransform.value = "";
15935
- controllerWidth.value = "";
15936
15938
  };
15937
- var isFloating = () => props2.hint && (!isEmpty(props2.value) || props2.isFocus);
15938
15939
  var resize = () => {
15939
- var _window$getComputedSt, _window$getComputedSt2;
15940
15940
  var {
15941
15941
  size,
15942
+ hint,
15942
15943
  placeholder,
15943
15944
  variant
15944
15945
  } = props2;
15945
- if (!isFloating() || !placeholder) {
15946
- resetSize();
15946
+ if (!isFloating.value || !placeholder) {
15947
+ var controllerRect = getRect(controllerEl.value);
15948
+ var middleRect = getRect(middleEl.value);
15949
+ var translateX = middleRect.left - controllerRect.left + "px";
15950
+ placeholderTransform.value = hint ? "translate(" + translateX + ", calc(var(--field-decorator-" + variant + "-" + size + "-placeholder-translate-y) + var(--field-decorator-middle-offset-y))) scale(1)" : "translate(" + translateX + ", -50%)";
15951
+ placeholderMaxWidth.value = middleRect.width + "px";
15947
15952
  return;
15948
15953
  }
15949
- var placeholderSpace = "var(--field-decorator-outlined-" + size + "-placeholder-space)";
15950
- var placeholderTextWidth = (_window$getComputedSt = window.getComputedStyle(placeholderTextEl.value)) == null ? void 0 : _window$getComputedSt.width;
15951
- var prependIconWidth = (_window$getComputedSt2 = window.getComputedStyle(prependIconEl.value)) == null ? void 0 : _window$getComputedSt2.width;
15954
+ var controllerStyle = getStyle$1(controllerEl.value);
15952
15955
  var translateY = variant === "outlined" ? "-50%" : "0";
15953
- placeholderTransform.value = "translate(-" + prependIconWidth + ", " + translateY + ") scale(0.75)";
15954
- controllerWidth.value = window.getComputedStyle(controllerEl.value).width;
15956
+ placeholderTransform.value = "translate(" + controllerStyle.paddingLeft + ", " + translateY + ") scale(0.75)";
15955
15957
  if (variant === "outlined") {
15956
- var {
15957
- width,
15958
- paddingLeft,
15959
- paddingRight
15960
- } = window.getComputedStyle(fieldsetEl.value);
15961
- legendWidth.value = "calc(" + placeholderTextWidth + " * 0.75 + 2 * " + placeholderSpace + ")";
15962
- legendMaxWidth.value = "calc(" + width + " - " + paddingLeft + " - " + paddingRight + ")";
15958
+ var placeholderTextStyle = getStyle$1(placeholderTextEl.value);
15959
+ var placeholderSpace = "var(--field-decorator-outlined-" + size + "-placeholder-space)";
15960
+ legendWidth.value = "calc(" + placeholderTextStyle.width + " * 0.75 + " + placeholderSpace + " * 2)";
15961
+ placeholderMaxWidth.value = "calc((100% - var(--field-decorator-outlined-" + size + "-padding-left) - var(--field-decorator-outlined-" + size + "-padding-right)) * 1.33)";
15962
+ } else {
15963
+ placeholderMaxWidth.value = "133%";
15963
15964
  }
15964
15965
  };
15965
15966
  var handleClear = (e) => {
@@ -15968,19 +15969,17 @@ var __sfc__$C = vue.defineComponent({
15968
15969
  var handleClick = (e) => {
15969
15970
  call(props2.onClick, e);
15970
15971
  };
15971
- vue.watch(() => [props2.size, props2.placeholder, props2.hint, props2.value, props2.isFocus, props2.variant], resize);
15972
+ vue.onUpdated(resize);
15972
15973
  useMounted(resize);
15973
15974
  useEventListener(() => window, "resize", resize);
15974
15975
  return {
15975
- fieldsetEl,
15976
15976
  controllerEl,
15977
+ middleEl,
15977
15978
  placeholderTextEl,
15978
- prependIconEl,
15979
15979
  placeholderTransform,
15980
+ placeholderMaxWidth,
15980
15981
  color,
15981
15982
  legendWidth,
15982
- legendMaxWidth,
15983
- controllerWidth,
15984
15983
  isFloating,
15985
15984
  computePlaceholderState,
15986
15985
  n: n$A,
@@ -16638,6 +16637,59 @@ var props$v = {
16638
16637
  "onUpdate:loading": defineListenerProp(),
16639
16638
  "onUpdate:error": defineListenerProp()
16640
16639
  };
16640
+ var TABS_ITEMS_BIND_TAB_ITEM_KEY = Symbol("TABS_ITEMS_BIND_TAB_ITEM_KEY");
16641
+ function useTabItem$1() {
16642
+ var {
16643
+ bindChildren,
16644
+ childProviders,
16645
+ length
16646
+ } = useChildren(TABS_ITEMS_BIND_TAB_ITEM_KEY);
16647
+ return {
16648
+ length,
16649
+ tabItemList: childProviders,
16650
+ bindTabItem: bindChildren
16651
+ };
16652
+ }
16653
+ var TAB_ITEM_BIND_LIST_KEY = Symbol("TAB_ITEM_BIND_LIST_KEY");
16654
+ function useTabsItems() {
16655
+ var {
16656
+ parentProvider,
16657
+ bindParent,
16658
+ index
16659
+ } = useParent(TABS_ITEMS_BIND_TAB_ITEM_KEY);
16660
+ if (!bindParent) {
16661
+ error$1("TabItem", "<var-tab-item/> must in <var-tabs-items/>");
16662
+ }
16663
+ return {
16664
+ index,
16665
+ tabsItems: parentProvider,
16666
+ bindTabsItems: bindParent
16667
+ };
16668
+ }
16669
+ function useLists() {
16670
+ var {
16671
+ childProviders,
16672
+ bindChildren,
16673
+ length
16674
+ } = useChildren(TAB_ITEM_BIND_LIST_KEY);
16675
+ return {
16676
+ length,
16677
+ lists: childProviders,
16678
+ bindLists: bindChildren
16679
+ };
16680
+ }
16681
+ function useTabItem() {
16682
+ var {
16683
+ parentProvider,
16684
+ bindParent,
16685
+ index
16686
+ } = useParent(TAB_ITEM_BIND_LIST_KEY);
16687
+ return {
16688
+ index,
16689
+ tabItem: parentProvider,
16690
+ bindTabItem: bindParent
16691
+ };
16692
+ }
16641
16693
  function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
16642
16694
  try {
16643
16695
  var info = gen[key](arg);
@@ -16752,6 +16804,10 @@ var __sfc__$z = vue.defineComponent({
16752
16804
  },
16753
16805
  props: props$v,
16754
16806
  setup(props2) {
16807
+ var {
16808
+ tabItem: tabItem2,
16809
+ bindTabItem
16810
+ } = useTabItem();
16755
16811
  var listEl = vue.ref(null);
16756
16812
  var detectorEl = vue.ref(null);
16757
16813
  var scroller;
@@ -16761,10 +16817,12 @@ var __sfc__$z = vue.defineComponent({
16761
16817
  call(props2.onLoad);
16762
16818
  };
16763
16819
  var isReachBottom = () => {
16764
- var containerBottom = scroller === window ? window.innerHeight : scroller.getBoundingClientRect().bottom;
16820
+ var {
16821
+ bottom: containerBottom
16822
+ } = getRect(scroller);
16765
16823
  var {
16766
16824
  bottom: detectorBottom
16767
- } = detectorEl.value.getBoundingClientRect();
16825
+ } = getRect(detectorEl.value);
16768
16826
  return Math.floor(detectorBottom) - toPxNum(props2.offset) <= containerBottom;
16769
16827
  };
16770
16828
  var removeScrollerListener = () => {
@@ -16773,23 +16831,26 @@ var __sfc__$z = vue.defineComponent({
16773
16831
  var check2 = /* @__PURE__ */ function() {
16774
16832
  var _ref = _asyncToGenerator$4(function* () {
16775
16833
  yield vue.nextTick();
16776
- var {
16777
- loading: loading2,
16778
- finished,
16779
- error: error2
16780
- } = props2;
16781
- if (!loading2 && !finished && !error2 && isReachBottom()) {
16782
- load();
16834
+ if (props2.loading || props2.finished || props2.error || (tabItem2 == null ? void 0 : tabItem2.current.value) === false || !isReachBottom()) {
16835
+ return;
16783
16836
  }
16837
+ load();
16784
16838
  });
16785
16839
  return function check3() {
16786
16840
  return _ref.apply(this, arguments);
16787
16841
  };
16788
16842
  }();
16843
+ call(bindTabItem, {});
16844
+ if (tabItem2) {
16845
+ vue.watch(() => tabItem2.current.value, check2);
16846
+ }
16847
+ vue.watch(() => [props2.loading, props2.error, props2.finished], check2);
16789
16848
  useMounted(() => {
16790
16849
  scroller = getParentScroller(listEl.value);
16791
16850
  scroller.addEventListener("scroll", check2);
16792
- props2.immediateCheck && check2();
16851
+ if (props2.immediateCheck) {
16852
+ check2();
16853
+ }
16793
16854
  });
16794
16855
  vue.onDeactivated(removeScrollerListener);
16795
16856
  vue.onUnmounted(removeScrollerListener);
@@ -22918,34 +22979,6 @@ Tab.install = function(app) {
22918
22979
  app.component(Tab.name, Tab);
22919
22980
  };
22920
22981
  var _TabComponent = Tab;
22921
- var TABS_ITEMS_BIND_TAB_ITEM_KEY = Symbol("TABS_ITEMS_BIND_TAB_ITEM_KEY");
22922
- function useTabItem() {
22923
- var {
22924
- bindChildren,
22925
- childProviders,
22926
- length
22927
- } = useChildren(TABS_ITEMS_BIND_TAB_ITEM_KEY);
22928
- return {
22929
- length,
22930
- tabItemList: childProviders,
22931
- bindTabItem: bindChildren
22932
- };
22933
- }
22934
- function useTabsItems() {
22935
- var {
22936
- parentProvider,
22937
- bindParent,
22938
- index
22939
- } = useParent(TABS_ITEMS_BIND_TAB_ITEM_KEY);
22940
- if (!bindParent) {
22941
- error$1("TabItem", "<var-tab-item/> must in <var-tabs-items/>");
22942
- }
22943
- return {
22944
- index,
22945
- tabsItems: parentProvider,
22946
- bindTabsItems: bindParent
22947
- };
22948
- }
22949
22982
  var props$5 = {
22950
22983
  name: {
22951
22984
  type: [String, Number]
@@ -22964,9 +22997,7 @@ function __render__$6(_ctx, _cache) {
22964
22997
  "var-tab-item-cover": ""
22965
22998
  },
22966
22999
  {
22967
- default: vue.withCtx(() => [_ctx.initSlot ? vue.renderSlot(_ctx.$slots, "default", {
22968
- key: 0
22969
- }) : vue.createCommentVNode("v-if", true)]),
23000
+ default: vue.withCtx(() => [vue.renderSlot(_ctx.$slots, "default")]),
22970
23001
  _: 3
22971
23002
  /* FORWARDED */
22972
23003
  },
@@ -22981,30 +23012,27 @@ var __sfc__$6 = vue.defineComponent({
22981
23012
  },
22982
23013
  props: props$5,
22983
23014
  setup(props2) {
22984
- var current = vue.ref(false);
22985
- var initSlot = vue.ref(false);
22986
- var name = vue.computed(() => props2.name);
22987
23015
  var {
22988
23016
  index,
23017
+ tabsItems,
22989
23018
  bindTabsItems
22990
23019
  } = useTabsItems();
22991
- var setCurrent = (value) => {
22992
- if (!initSlot.value && value) {
22993
- initSlot.value = true;
22994
- }
22995
- current.value = value;
22996
- };
23020
+ var {
23021
+ bindLists
23022
+ } = useLists();
23023
+ var name = vue.computed(() => props2.name);
23024
+ var current = vue.computed(() => index.value === Number(tabsItems.active.value));
22997
23025
  var tabItemProvider = {
22998
23026
  index,
22999
23027
  name,
23000
- setCurrent
23028
+ current
23001
23029
  };
23002
23030
  bindTabsItems(tabItemProvider);
23031
+ bindLists(tabItemProvider);
23003
23032
  return {
23004
23033
  n: n$6,
23005
23034
  classes: classes$5,
23006
- current,
23007
- initSlot
23035
+ current
23008
23036
  };
23009
23037
  }
23010
23038
  });
@@ -23501,29 +23529,30 @@ var __sfc__$3 = vue.defineComponent({
23501
23529
  props: props$2,
23502
23530
  setup(props2) {
23503
23531
  var swipe2 = vue.ref(null);
23532
+ var active = vue.computed(() => props2.active);
23504
23533
  var {
23505
23534
  tabItemList,
23506
23535
  bindTabItem,
23507
23536
  length
23508
- } = useTabItem();
23509
- var matchName = (active) => {
23537
+ } = useTabItem$1();
23538
+ var matchName = (active2) => {
23510
23539
  return tabItemList.find((_ref) => {
23511
23540
  var {
23512
23541
  name
23513
23542
  } = _ref;
23514
- return active === name.value;
23543
+ return active2 === name.value;
23515
23544
  });
23516
23545
  };
23517
- var matchIndex = (active) => {
23546
+ var matchIndex = (active2) => {
23518
23547
  return tabItemList.find((_ref2) => {
23519
23548
  var {
23520
23549
  index
23521
23550
  } = _ref2;
23522
- return active === index.value;
23551
+ return active2 === index.value;
23523
23552
  });
23524
23553
  };
23525
- var matchActive = (active) => {
23526
- return matchName(active) || matchIndex(active);
23554
+ var matchActive = (active2) => {
23555
+ return matchName(active2) || matchIndex(active2);
23527
23556
  };
23528
23557
  var handleActiveChange = (newValue) => {
23529
23558
  var _swipe$value;
@@ -23531,30 +23560,25 @@ var __sfc__$3 = vue.defineComponent({
23531
23560
  if (!newActiveTabItemProvider) {
23532
23561
  return;
23533
23562
  }
23534
- tabItemList.forEach((_ref3) => {
23535
- var {
23536
- setCurrent
23537
- } = _ref3;
23538
- return setCurrent(false);
23539
- });
23540
- newActiveTabItemProvider.setCurrent(true);
23541
23563
  (_swipe$value = swipe2.value) == null ? void 0 : _swipe$value.to(newActiveTabItemProvider.index.value);
23542
23564
  };
23543
23565
  var handleSwipeChange = (currentIndex) => {
23544
23566
  var _tabItem$name$value;
23545
- var tabItem2 = tabItemList.find((_ref4) => {
23567
+ var tabItem2 = tabItemList.find((_ref3) => {
23546
23568
  var {
23547
23569
  index
23548
- } = _ref4;
23570
+ } = _ref3;
23549
23571
  return index.value === currentIndex;
23550
23572
  });
23551
- var active = (_tabItem$name$value = tabItem2.name.value) != null ? _tabItem$name$value : tabItem2.index.value;
23552
- call(props2["onUpdate:active"], active);
23573
+ var active2 = (_tabItem$name$value = tabItem2.name.value) != null ? _tabItem$name$value : tabItem2.index.value;
23574
+ call(props2["onUpdate:active"], active2);
23553
23575
  };
23554
23576
  var getSwipe = () => {
23555
23577
  return swipe2.value;
23556
23578
  };
23557
- var tabsItemsProvider = {};
23579
+ var tabsItemsProvider = {
23580
+ active
23581
+ };
23558
23582
  bindTabItem(tabsItemsProvider);
23559
23583
  vue.watch(() => props2.active, handleActiveChange);
23560
23584
  vue.watch(() => length.value, /* @__PURE__ */ _asyncToGenerator$1(function* () {
@@ -25397,9 +25421,9 @@ const skeleton = "";
25397
25421
  const SkeletonSfc = "";
25398
25422
  const slider = "";
25399
25423
  const SliderSfc = "";
25400
- const SnackbarSfc = "";
25401
25424
  const snackbar = "";
25402
25425
  const coreSfc = "";
25426
+ const SnackbarSfc = "";
25403
25427
  const space = "";
25404
25428
  const step = "";
25405
25429
  const StepSfc = "";
@@ -25424,7 +25448,7 @@ const TimePickerSfc = "";
25424
25448
  const TooltipSfc = "";
25425
25449
  const uploader = "";
25426
25450
  const UploaderSfc = "";
25427
- const version = "2.10.3-alpha.1683532936621";
25451
+ const version = "2.10.3-alpha.1683732401073";
25428
25452
  function install(app) {
25429
25453
  ActionSheet.install && app.use(ActionSheet);
25430
25454
  AppBar.install && app.use(AppBar);