@varlet/ui 1.26.5 → 1.26.8

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 (48) hide show
  1. package/README.en-US.md +14 -15
  2. package/README.md +19 -18
  3. package/es/back-top/BackTop.js +12 -7
  4. package/es/cell/cell.css +1 -1
  5. package/es/cell/cell.less +3 -0
  6. package/es/collapse-item/collapseItem.css +1 -1
  7. package/es/collapse-item/collapseItem.less +2 -2
  8. package/es/date-picker/DatePicker.js +5 -2
  9. package/es/date-picker/date-picker.css +1 -1
  10. package/es/date-picker/date-picker.less +10 -0
  11. package/es/date-picker/src/day-picker-panel.js +8 -4
  12. package/es/date-picker/src/month-picker-panel.js +8 -4
  13. package/es/index-bar/IndexBar.js +8 -14
  14. package/es/ripple/index.js +5 -0
  15. package/es/select/Select.js +3 -1
  16. package/es/select/props.js +4 -0
  17. package/es/snackbar/style/index.js +1 -1
  18. package/es/snackbar/style/less.js +1 -1
  19. package/es/style.css +1 -1
  20. package/es/uploader/Uploader.js +14 -1
  21. package/es/uploader/props.js +4 -0
  22. package/es/utils/elements.js +4 -0
  23. package/es/varlet.esm.js +415 -375
  24. package/highlight/attributes.json +8 -0
  25. package/highlight/tags.json +2 -0
  26. package/highlight/web-types.json +19 -1
  27. package/lib/back-top/BackTop.js +11 -6
  28. package/lib/cell/cell.css +1 -1
  29. package/lib/cell/cell.less +3 -0
  30. package/lib/collapse-item/collapseItem.css +1 -1
  31. package/lib/collapse-item/collapseItem.less +2 -2
  32. package/lib/date-picker/DatePicker.js +6 -2
  33. package/lib/date-picker/date-picker.css +1 -1
  34. package/lib/date-picker/date-picker.less +10 -0
  35. package/lib/date-picker/src/day-picker-panel.js +8 -4
  36. package/lib/date-picker/src/month-picker-panel.js +8 -4
  37. package/lib/index-bar/IndexBar.js +7 -13
  38. package/lib/ripple/index.js +6 -0
  39. package/lib/select/Select.js +3 -1
  40. package/lib/select/props.js +4 -0
  41. package/lib/style.css +1 -1
  42. package/lib/uploader/Uploader.js +14 -1
  43. package/lib/uploader/props.js +4 -0
  44. package/lib/utils/elements.js +6 -0
  45. package/package.json +5 -5
  46. package/types/select.d.ts +1 -0
  47. package/types/uploader.d.ts +1 -0
  48. package/umd/varlet.js +4 -4
package/es/varlet.esm.js CHANGED
@@ -6,6 +6,334 @@ var context = {
6
6
  };
7
7
  reactive(context);
8
8
  var Context = reactive(context);
9
+ var toNumber = (val) => {
10
+ if (val == null)
11
+ return 0;
12
+ if (isString(val)) {
13
+ val = parseFloat(val);
14
+ val = Number.isNaN(val) ? 0 : val;
15
+ return val;
16
+ }
17
+ if (isBool(val))
18
+ return Number(val);
19
+ return val;
20
+ };
21
+ var isHTMLSupportImage = (val) => {
22
+ if (val == null) {
23
+ return false;
24
+ }
25
+ return val.startsWith("data:image") || /\.(png|jpg|gif|jpeg|svg)$/.test(val);
26
+ };
27
+ var isHTMLSupportVideo = (val) => {
28
+ if (val == null) {
29
+ return false;
30
+ }
31
+ return val.startsWith("data:video") || /\.(mp4|webm|ogg)$/.test(val);
32
+ };
33
+ var isString = (val) => typeof val === "string";
34
+ var isBool = (val) => typeof val === "boolean";
35
+ var isNumber = (val) => typeof val === "number";
36
+ var isPlainObject = (val) => Object.prototype.toString.call(val) === "[object Object]";
37
+ var isObject = (val) => typeof val === "object" && val !== null;
38
+ var isArray = (val) => Array.isArray(val);
39
+ var isURL = (val) => {
40
+ if (!val) {
41
+ return false;
42
+ }
43
+ return /^(http)|(\.*\/)/.test(val);
44
+ };
45
+ var isEmpty = (val) => val === void 0 || val === null || val === "" || Array.isArray(val) && !val.length;
46
+ var removeItem = (arr, item) => {
47
+ if (arr.length) {
48
+ var index = arr.indexOf(item);
49
+ if (index > -1) {
50
+ return arr.splice(index, 1);
51
+ }
52
+ }
53
+ };
54
+ var throttle = function(method, mustRunDelay) {
55
+ if (mustRunDelay === void 0) {
56
+ mustRunDelay = 200;
57
+ }
58
+ var timer;
59
+ var start = 0;
60
+ return function loop() {
61
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
62
+ args[_key] = arguments[_key];
63
+ }
64
+ var now = Date.now();
65
+ var elapsed = now - start;
66
+ if (!start) {
67
+ start = now;
68
+ }
69
+ if (timer) {
70
+ window.clearTimeout(timer);
71
+ }
72
+ if (elapsed >= mustRunDelay) {
73
+ method.apply(this, args);
74
+ start = now;
75
+ } else {
76
+ timer = window.setTimeout(() => {
77
+ loop.apply(this, args);
78
+ }, mustRunDelay - elapsed);
79
+ }
80
+ };
81
+ };
82
+ var createCache = (max2) => {
83
+ var cache = [];
84
+ return {
85
+ cache,
86
+ has(key) {
87
+ return this.cache.includes(key);
88
+ },
89
+ add(key) {
90
+ if (this.has(key)) {
91
+ return;
92
+ }
93
+ this.cache.length === max2 && cache.shift();
94
+ this.cache.push(key);
95
+ },
96
+ remove(key) {
97
+ this.has(key) && removeItem(this.cache, key);
98
+ },
99
+ clear() {
100
+ this.cache.length = 0;
101
+ }
102
+ };
103
+ };
104
+ var linear = (value) => value;
105
+ var cubic = (value) => Math.pow(value, 3);
106
+ var easeInOutCubic = (value) => value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2;
107
+ function parseFormat(format, time) {
108
+ var scannedTimes = Object.values(time);
109
+ var scannedFormats = ["DD", "HH", "mm", "ss"];
110
+ var padValues = [24, 60, 60, 1e3];
111
+ scannedFormats.forEach((scannedFormat, index) => {
112
+ if (!format.includes(scannedFormat)) {
113
+ scannedTimes[index + 1] += scannedTimes[index] * padValues[index];
114
+ } else {
115
+ format = format.replace(scannedFormat, String(scannedTimes[index]).padStart(2, "0"));
116
+ }
117
+ });
118
+ if (format.includes("S")) {
119
+ var ms = String(scannedTimes[scannedTimes.length - 1]).padStart(3, "0");
120
+ if (format.includes("SSS")) {
121
+ format = format.replace("SSS", ms);
122
+ } else if (format.includes("SS")) {
123
+ format = format.replace("SS", ms.slice(0, 2));
124
+ } else {
125
+ format = format.replace("S", ms.slice(0, 1));
126
+ }
127
+ }
128
+ return format;
129
+ }
130
+ var dt = (value, defaultText) => value == null ? defaultText : value;
131
+ var inBrowser = () => typeof window !== "undefined";
132
+ var uniq = (arr) => [...new Set(arr)];
133
+ function kebabCase(str) {
134
+ var ret = str.replace(/([A-Z])/g, " $1").trim();
135
+ return ret.split(" ").join("-").toLowerCase();
136
+ }
137
+ function asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, key, arg) {
138
+ try {
139
+ var info = gen[key](arg);
140
+ var value = info.value;
141
+ } catch (error) {
142
+ reject(error);
143
+ return;
144
+ }
145
+ if (info.done) {
146
+ resolve(value);
147
+ } else {
148
+ Promise.resolve(value).then(_next, _throw);
149
+ }
150
+ }
151
+ function _asyncToGenerator$b(fn) {
152
+ return function() {
153
+ var self = this, args = arguments;
154
+ return new Promise(function(resolve, reject) {
155
+ var gen = fn.apply(self, args);
156
+ function _next(value) {
157
+ asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "next", value);
158
+ }
159
+ function _throw(err) {
160
+ asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "throw", err);
161
+ }
162
+ _next(void 0);
163
+ });
164
+ };
165
+ }
166
+ function getLeft(element) {
167
+ var {
168
+ left
169
+ } = element.getBoundingClientRect();
170
+ return left + (document.body.scrollLeft || document.documentElement.scrollLeft);
171
+ }
172
+ function getTop$1(element) {
173
+ var {
174
+ top
175
+ } = element.getBoundingClientRect();
176
+ return top + (document.body.scrollTop || document.documentElement.scrollTop);
177
+ }
178
+ function getScrollTop(element) {
179
+ var top = "scrollTop" in element ? element.scrollTop : element.pageYOffset;
180
+ return Math.max(top, 0);
181
+ }
182
+ function getScrollLeft(element) {
183
+ var left = "scrollLeft" in element ? element.scrollLeft : element.pageXOffset;
184
+ return Math.max(left, 0);
185
+ }
186
+ function inViewport(_x) {
187
+ return _inViewport.apply(this, arguments);
188
+ }
189
+ function _inViewport() {
190
+ _inViewport = _asyncToGenerator$b(function* (element) {
191
+ yield doubleRaf();
192
+ var {
193
+ top,
194
+ bottom,
195
+ left,
196
+ right
197
+ } = element.getBoundingClientRect();
198
+ var {
199
+ innerWidth,
200
+ innerHeight
201
+ } = window;
202
+ var xInViewport = left <= innerWidth && right >= 0;
203
+ var yInViewport = top <= innerHeight && bottom >= 0;
204
+ return xInViewport && yInViewport;
205
+ });
206
+ return _inViewport.apply(this, arguments);
207
+ }
208
+ function getTranslate(el) {
209
+ var {
210
+ transform
211
+ } = window.getComputedStyle(el);
212
+ return +transform.slice(transform.lastIndexOf(",") + 2, transform.length - 1);
213
+ }
214
+ function getParentScroller(el) {
215
+ var element = el;
216
+ while (element) {
217
+ if (!element.parentNode) {
218
+ break;
219
+ }
220
+ element = element.parentNode;
221
+ if (element === document.body || element === document.documentElement) {
222
+ break;
223
+ }
224
+ var scrollRE = /(scroll|auto)/;
225
+ var {
226
+ overflowY,
227
+ overflow
228
+ } = window.getComputedStyle(element);
229
+ if (scrollRE.test(overflowY) || scrollRE.test(overflow)) {
230
+ return element;
231
+ }
232
+ }
233
+ return window;
234
+ }
235
+ function getAllParentScroller(el) {
236
+ var allParentScroller = [];
237
+ var element = el;
238
+ while (element !== window) {
239
+ element = getParentScroller(element);
240
+ allParentScroller.push(element);
241
+ }
242
+ return allParentScroller;
243
+ }
244
+ var isRem = (value) => isString(value) && value.endsWith("rem");
245
+ var isPx = (value) => isString(value) && value.endsWith("px") || isNumber(value);
246
+ var isPercent = (value) => isString(value) && value.endsWith("%");
247
+ var isVw = (value) => isString(value) && value.endsWith("vw");
248
+ var isVh = (value) => isString(value) && value.endsWith("vh");
249
+ var toPxNum = (value) => {
250
+ if (isNumber(value)) {
251
+ return value;
252
+ }
253
+ if (isPx(value)) {
254
+ return +value.replace("px", "");
255
+ }
256
+ if (isVw(value)) {
257
+ return +value.replace("vw", "") * window.innerWidth / 100;
258
+ }
259
+ if (isVh(value)) {
260
+ return +value.replace("vh", "") * window.innerHeight / 100;
261
+ }
262
+ if (isRem(value)) {
263
+ var num = +value.replace("rem", "");
264
+ var rootFontSize = window.getComputedStyle(document.documentElement).fontSize;
265
+ return num * parseFloat(rootFontSize);
266
+ }
267
+ if (isString(value)) {
268
+ return toNumber(value);
269
+ }
270
+ return 0;
271
+ };
272
+ var toSizeUnit = (value) => {
273
+ if (value == null) {
274
+ return void 0;
275
+ }
276
+ if (isPercent(value) || isVw(value) || isVh(value) || isRem(value)) {
277
+ return value;
278
+ }
279
+ return toPxNum(value) + "px";
280
+ };
281
+ function requestAnimationFrame(fn) {
282
+ return globalThis.requestAnimationFrame ? globalThis.requestAnimationFrame(fn) : globalThis.setTimeout(fn, 16);
283
+ }
284
+ function cancelAnimationFrame(handle) {
285
+ globalThis.cancelAnimationFrame ? globalThis.cancelAnimationFrame(handle) : globalThis.clearTimeout(handle);
286
+ }
287
+ function nextTickFrame(fn) {
288
+ requestAnimationFrame(() => {
289
+ requestAnimationFrame(fn);
290
+ });
291
+ }
292
+ function doubleRaf() {
293
+ return new Promise((resolve) => {
294
+ requestAnimationFrame(() => {
295
+ requestAnimationFrame(resolve);
296
+ });
297
+ });
298
+ }
299
+ function scrollTo(element, _ref) {
300
+ var {
301
+ top = 0,
302
+ left = 0,
303
+ duration = 300,
304
+ animation
305
+ } = _ref;
306
+ var startTime = Date.now();
307
+ var scrollTop = getScrollTop(element);
308
+ var scrollLeft = getScrollLeft(element);
309
+ return new Promise((resolve) => {
310
+ var frame = () => {
311
+ var progress2 = (Date.now() - startTime) / duration;
312
+ if (progress2 < 1) {
313
+ var nextTop = scrollTop + (top - scrollTop) * animation(progress2);
314
+ var nextLeft = scrollLeft + (left - scrollLeft) * animation(progress2);
315
+ element.scrollTo(nextLeft, nextTop);
316
+ requestAnimationFrame(frame);
317
+ } else {
318
+ element.scrollTo(left, top);
319
+ resolve();
320
+ }
321
+ };
322
+ requestAnimationFrame(frame);
323
+ });
324
+ }
325
+ function formatStyleVars(styleVars) {
326
+ return Object.entries(styleVars != null ? styleVars : {}).reduce((styles, _ref2) => {
327
+ var [key, value] = _ref2;
328
+ var cssVar = key.startsWith("--") ? key : "--" + kebabCase(key);
329
+ styles[cssVar] = value;
330
+ return styles;
331
+ }, {});
332
+ }
333
+ function supportTouch() {
334
+ var inBrowser2 = typeof window !== "undefined";
335
+ return inBrowser2 && "ontouchstart" in window;
336
+ }
9
337
  function _extends$d() {
10
338
  _extends$d = Object.assign || function(target) {
11
339
  for (var i = 1; i < arguments.length; i++) {
@@ -110,6 +438,9 @@ function removeRipple() {
110
438
  }
111
439
  function forbidRippleTask() {
112
440
  var _ripple = this._ripple;
441
+ if (!supportTouch()) {
442
+ return;
443
+ }
113
444
  if (!_ripple.touchmoveForbid) {
114
445
  return;
115
446
  }
@@ -287,152 +618,24 @@ function useLock(props2, state, use2) {
287
618
  if (props2[state] === true) {
288
619
  releaseLock(uid);
289
620
  }
290
- });
291
- }
292
- function useZIndex(source, count) {
293
- var zIndex = ref(Context.zIndex);
294
- watch(source, (newValue) => {
295
- if (newValue) {
296
- Context.zIndex += count;
297
- zIndex.value = Context.zIndex;
298
- }
299
- }, {
300
- immediate: true
301
- });
302
- return {
303
- zIndex
304
- };
305
- }
306
- var toNumber = (val) => {
307
- if (val == null)
308
- return 0;
309
- if (isString(val)) {
310
- val = parseFloat(val);
311
- val = Number.isNaN(val) ? 0 : val;
312
- return val;
313
- }
314
- if (isBool(val))
315
- return Number(val);
316
- return val;
317
- };
318
- var isHTMLSupportImage = (val) => {
319
- if (val == null) {
320
- return false;
321
- }
322
- return val.startsWith("data:image") || /\.(png|jpg|gif|jpeg|svg)$/.test(val);
323
- };
324
- var isHTMLSupportVideo = (val) => {
325
- if (val == null) {
326
- return false;
327
- }
328
- return val.startsWith("data:video") || /\.(mp4|webm|ogg)$/.test(val);
329
- };
330
- var isString = (val) => typeof val === "string";
331
- var isBool = (val) => typeof val === "boolean";
332
- var isNumber = (val) => typeof val === "number";
333
- var isPlainObject = (val) => Object.prototype.toString.call(val) === "[object Object]";
334
- var isObject = (val) => typeof val === "object" && val !== null;
335
- var isArray = (val) => Array.isArray(val);
336
- var isURL = (val) => {
337
- if (!val) {
338
- return false;
339
- }
340
- return /^(http)|(\.*\/)/.test(val);
341
- };
342
- var isEmpty = (val) => val === void 0 || val === null || val === "" || Array.isArray(val) && !val.length;
343
- var removeItem = (arr, item) => {
344
- if (arr.length) {
345
- var index = arr.indexOf(item);
346
- if (index > -1) {
347
- return arr.splice(index, 1);
348
- }
349
- }
350
- };
351
- var throttle = function(method, mustRunDelay) {
352
- if (mustRunDelay === void 0) {
353
- mustRunDelay = 200;
354
- }
355
- var timer;
356
- var start = 0;
357
- return function loop() {
358
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
359
- args[_key] = arguments[_key];
360
- }
361
- var now = Date.now();
362
- var elapsed = now - start;
363
- if (!start) {
364
- start = now;
365
- }
366
- if (timer) {
367
- window.clearTimeout(timer);
368
- }
369
- if (elapsed >= mustRunDelay) {
370
- method.apply(this, args);
371
- start = now;
372
- } else {
373
- timer = window.setTimeout(() => {
374
- loop.apply(this, args);
375
- }, mustRunDelay - elapsed);
376
- }
377
- };
378
- };
379
- var createCache = (max2) => {
380
- var cache = [];
381
- return {
382
- cache,
383
- has(key) {
384
- return this.cache.includes(key);
385
- },
386
- add(key) {
387
- if (this.has(key)) {
388
- return;
389
- }
390
- this.cache.length === max2 && cache.shift();
391
- this.cache.push(key);
392
- },
393
- remove(key) {
394
- this.has(key) && removeItem(this.cache, key);
395
- },
396
- clear() {
397
- this.cache.length = 0;
398
- }
399
- };
400
- };
401
- var linear = (value) => value;
402
- var cubic = (value) => Math.pow(value, 3);
403
- var easeInOutCubic = (value) => value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2;
404
- function parseFormat(format, time) {
405
- var scannedTimes = Object.values(time);
406
- var scannedFormats = ["DD", "HH", "mm", "ss"];
407
- var padValues = [24, 60, 60, 1e3];
408
- scannedFormats.forEach((scannedFormat, index) => {
409
- if (!format.includes(scannedFormat)) {
410
- scannedTimes[index + 1] += scannedTimes[index] * padValues[index];
411
- } else {
412
- format = format.replace(scannedFormat, String(scannedTimes[index]).padStart(2, "0"));
413
- }
414
- });
415
- if (format.includes("S")) {
416
- var ms = String(scannedTimes[scannedTimes.length - 1]).padStart(3, "0");
417
- if (format.includes("SSS")) {
418
- format = format.replace("SSS", ms);
419
- } else if (format.includes("SS")) {
420
- format = format.replace("SS", ms.slice(0, 2));
421
- } else {
422
- format = format.replace("S", ms.slice(0, 1));
423
- }
424
- }
425
- return format;
621
+ });
426
622
  }
427
- var dt = (value, defaultText) => value == null ? defaultText : value;
428
- var inBrowser = () => typeof window !== "undefined";
429
- var uniq = (arr) => [...new Set(arr)];
430
- function kebabCase(str) {
431
- var ret = str.replace(/([A-Z])/g, " $1").trim();
432
- return ret.split(" ").join("-").toLowerCase();
623
+ function useZIndex(source, count) {
624
+ var zIndex = ref(Context.zIndex);
625
+ watch(source, (newValue) => {
626
+ if (newValue) {
627
+ Context.zIndex += count;
628
+ zIndex.value = Context.zIndex;
629
+ }
630
+ }, {
631
+ immediate: true
632
+ });
633
+ return {
634
+ zIndex
635
+ };
433
636
  }
434
637
  var _excluded = ["collect", "clear"];
435
- function asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, key, arg) {
638
+ function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
436
639
  try {
437
640
  var info = gen[key](arg);
438
641
  var value = info.value;
@@ -446,16 +649,16 @@ function asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, key, arg) {
446
649
  Promise.resolve(value).then(_next, _throw);
447
650
  }
448
651
  }
449
- function _asyncToGenerator$b(fn) {
652
+ function _asyncToGenerator$a(fn) {
450
653
  return function() {
451
654
  var self = this, args = arguments;
452
655
  return new Promise(function(resolve, reject) {
453
656
  var gen = fn.apply(self, args);
454
657
  function _next(value) {
455
- asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "next", value);
658
+ asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "next", value);
456
659
  }
457
660
  function _throw(err) {
458
- asyncGeneratorStep$b(gen, resolve, reject, _next, _throw, "throw", err);
661
+ asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "throw", err);
459
662
  }
460
663
  _next(void 0);
461
664
  });
@@ -642,7 +845,7 @@ function keyInProvides(key) {
642
845
  function useValidation() {
643
846
  var errorMessage = ref("");
644
847
  var validate = /* @__PURE__ */ function() {
645
- var _ref = _asyncToGenerator$b(function* (rules, value, apis) {
848
+ var _ref = _asyncToGenerator$a(function* (rules, value, apis) {
646
849
  if (!isArray(rules) || !rules.length) {
647
850
  return true;
648
851
  }
@@ -663,7 +866,7 @@ function useValidation() {
663
866
  errorMessage.value = "";
664
867
  };
665
868
  var validateWithTrigger = /* @__PURE__ */ function() {
666
- var _ref2 = _asyncToGenerator$b(function* (validateTrigger, trigger, rules, value, apis) {
869
+ var _ref2 = _asyncToGenerator$a(function* (validateTrigger, trigger, rules, value, apis) {
667
870
  if (validateTrigger.includes(trigger)) {
668
871
  (yield validate(rules, value, apis)) && (errorMessage.value = "");
669
872
  }
@@ -849,202 +1052,6 @@ var props$R = {
849
1052
  type: Function
850
1053
  }
851
1054
  };
852
- function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
853
- try {
854
- var info = gen[key](arg);
855
- var value = info.value;
856
- } catch (error) {
857
- reject(error);
858
- return;
859
- }
860
- if (info.done) {
861
- resolve(value);
862
- } else {
863
- Promise.resolve(value).then(_next, _throw);
864
- }
865
- }
866
- function _asyncToGenerator$a(fn) {
867
- return function() {
868
- var self = this, args = arguments;
869
- return new Promise(function(resolve, reject) {
870
- var gen = fn.apply(self, args);
871
- function _next(value) {
872
- asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "next", value);
873
- }
874
- function _throw(err) {
875
- asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "throw", err);
876
- }
877
- _next(void 0);
878
- });
879
- };
880
- }
881
- function getLeft(element) {
882
- var {
883
- left
884
- } = element.getBoundingClientRect();
885
- return left + (document.body.scrollLeft || document.documentElement.scrollLeft);
886
- }
887
- function getTop$1(element) {
888
- var {
889
- top
890
- } = element.getBoundingClientRect();
891
- return top + (document.body.scrollTop || document.documentElement.scrollTop);
892
- }
893
- function getScrollTop(element) {
894
- var top = "scrollTop" in element ? element.scrollTop : element.pageYOffset;
895
- return Math.max(top, 0);
896
- }
897
- function getScrollLeft(element) {
898
- var left = "scrollLeft" in element ? element.scrollLeft : element.pageXOffset;
899
- return Math.max(left, 0);
900
- }
901
- function inViewport(_x) {
902
- return _inViewport.apply(this, arguments);
903
- }
904
- function _inViewport() {
905
- _inViewport = _asyncToGenerator$a(function* (element) {
906
- yield doubleRaf();
907
- var {
908
- top,
909
- bottom,
910
- left,
911
- right
912
- } = element.getBoundingClientRect();
913
- var {
914
- innerWidth,
915
- innerHeight
916
- } = window;
917
- var xInViewport = left <= innerWidth && right >= 0;
918
- var yInViewport = top <= innerHeight && bottom >= 0;
919
- return xInViewport && yInViewport;
920
- });
921
- return _inViewport.apply(this, arguments);
922
- }
923
- function getTranslate(el) {
924
- var {
925
- transform
926
- } = window.getComputedStyle(el);
927
- return +transform.slice(transform.lastIndexOf(",") + 2, transform.length - 1);
928
- }
929
- function getParentScroller(el) {
930
- var element = el;
931
- while (element) {
932
- if (!element.parentNode) {
933
- break;
934
- }
935
- element = element.parentNode;
936
- if (element === document.body || element === document.documentElement) {
937
- break;
938
- }
939
- var scrollRE = /(scroll|auto)/;
940
- var {
941
- overflowY,
942
- overflow
943
- } = window.getComputedStyle(element);
944
- if (scrollRE.test(overflowY) || scrollRE.test(overflow)) {
945
- return element;
946
- }
947
- }
948
- return window;
949
- }
950
- function getAllParentScroller(el) {
951
- var allParentScroller = [];
952
- var element = el;
953
- while (element !== window) {
954
- element = getParentScroller(element);
955
- allParentScroller.push(element);
956
- }
957
- return allParentScroller;
958
- }
959
- var isRem = (value) => isString(value) && value.endsWith("rem");
960
- var isPx = (value) => isString(value) && value.endsWith("px") || isNumber(value);
961
- var isPercent = (value) => isString(value) && value.endsWith("%");
962
- var isVw = (value) => isString(value) && value.endsWith("vw");
963
- var isVh = (value) => isString(value) && value.endsWith("vh");
964
- var toPxNum = (value) => {
965
- if (isNumber(value)) {
966
- return value;
967
- }
968
- if (isPx(value)) {
969
- return +value.replace("px", "");
970
- }
971
- if (isVw(value)) {
972
- return +value.replace("vw", "") * window.innerWidth / 100;
973
- }
974
- if (isVh(value)) {
975
- return +value.replace("vh", "") * window.innerHeight / 100;
976
- }
977
- if (isRem(value)) {
978
- var num = +value.replace("rem", "");
979
- var rootFontSize = window.getComputedStyle(document.documentElement).fontSize;
980
- return num * parseFloat(rootFontSize);
981
- }
982
- if (isString(value)) {
983
- return toNumber(value);
984
- }
985
- return 0;
986
- };
987
- var toSizeUnit = (value) => {
988
- if (value == null) {
989
- return void 0;
990
- }
991
- if (isPercent(value) || isVw(value) || isVh(value) || isRem(value)) {
992
- return value;
993
- }
994
- return toPxNum(value) + "px";
995
- };
996
- function requestAnimationFrame(fn) {
997
- return globalThis.requestAnimationFrame ? globalThis.requestAnimationFrame(fn) : globalThis.setTimeout(fn, 16);
998
- }
999
- function cancelAnimationFrame(handle) {
1000
- globalThis.cancelAnimationFrame ? globalThis.cancelAnimationFrame(handle) : globalThis.clearTimeout(handle);
1001
- }
1002
- function nextTickFrame(fn) {
1003
- requestAnimationFrame(() => {
1004
- requestAnimationFrame(fn);
1005
- });
1006
- }
1007
- function doubleRaf() {
1008
- return new Promise((resolve) => {
1009
- requestAnimationFrame(() => {
1010
- requestAnimationFrame(resolve);
1011
- });
1012
- });
1013
- }
1014
- function scrollTo(element, _ref) {
1015
- var {
1016
- top = 0,
1017
- left = 0,
1018
- duration = 300,
1019
- animation
1020
- } = _ref;
1021
- var startTime = Date.now();
1022
- var scrollTop = getScrollTop(element);
1023
- var scrollLeft = getScrollLeft(element);
1024
- return new Promise((resolve) => {
1025
- var frame = () => {
1026
- var progress2 = (Date.now() - startTime) / duration;
1027
- if (progress2 < 1) {
1028
- var nextTop = scrollTop + (top - scrollTop) * animation(progress2);
1029
- var nextLeft = scrollLeft + (left - scrollLeft) * animation(progress2);
1030
- element.scrollTo(nextLeft, nextTop);
1031
- requestAnimationFrame(frame);
1032
- } else {
1033
- element.scrollTo(left, top);
1034
- resolve();
1035
- }
1036
- };
1037
- requestAnimationFrame(frame);
1038
- });
1039
- }
1040
- function formatStyleVars(styleVars) {
1041
- return Object.entries(styleVars != null ? styleVars : {}).reduce((styles, _ref2) => {
1042
- var [key, value] = _ref2;
1043
- var cssVar = key.startsWith("--") ? key : "--" + kebabCase(key);
1044
- styles[cssVar] = value;
1045
- return styles;
1046
- }, {});
1047
- }
1048
1055
  function asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, key, arg) {
1049
1056
  try {
1050
1057
  var info = gen[key](arg);
@@ -1866,7 +1873,10 @@ var props$M = {
1866
1873
  function render$S(_ctx, _cache) {
1867
1874
  var _component_var_icon = resolveComponent("var-icon");
1868
1875
  var _component_var_button = resolveComponent("var-button");
1869
- return openBlock(), createElementBlock("div", {
1876
+ return openBlock(), createBlock(Teleport, {
1877
+ to: "body",
1878
+ disabled: _ctx.disabled
1879
+ }, [createElementVNode("div", {
1870
1880
  class: normalizeClass(["var-back-top", [_ctx.show ? "var-back-top--active" : null]]),
1871
1881
  ref: "backTopEl",
1872
1882
  style: normalizeStyle({
@@ -1885,7 +1895,7 @@ function render$S(_ctx, _cache) {
1885
1895
  name: "chevron-up"
1886
1896
  })]),
1887
1897
  _: 1
1888
- })])], 6);
1898
+ })])], 6)], 8, ["disabled"]);
1889
1899
  }
1890
1900
  var BackTop = defineComponent({
1891
1901
  render: render$S,
@@ -1898,6 +1908,7 @@ var BackTop = defineComponent({
1898
1908
  setup(props2) {
1899
1909
  var show = ref(false);
1900
1910
  var backTopEl = ref(null);
1911
+ var disabled = ref(true);
1901
1912
  var target;
1902
1913
  var click = (event) => {
1903
1914
  props2.onClick == null ? void 0 : props2.onClick(event);
@@ -1923,19 +1934,20 @@ var BackTop = defineComponent({
1923
1934
  }
1924
1935
  return el;
1925
1936
  }
1926
- if (isObject(target2)) {
1937
+ if (isObject(target2))
1927
1938
  return target2;
1928
- }
1929
1939
  throw Error('[Varlet] BackTop: type of prop "target" should be a selector or an element object');
1930
1940
  };
1931
1941
  onMounted(() => {
1932
1942
  target = props2.target ? getTarget() : getParentScroller(backTopEl.value);
1933
1943
  target.addEventListener("scroll", throttleScroll);
1944
+ disabled.value = false;
1934
1945
  });
1935
1946
  onBeforeUnmount(() => {
1936
1947
  target.removeEventListener("scroll", throttleScroll);
1937
1948
  });
1938
1949
  return {
1950
+ disabled,
1939
1951
  show,
1940
1952
  backTopEl,
1941
1953
  toSizeUnit,
@@ -6684,7 +6696,7 @@ function render$E(_ctx, _cache) {
6684
6696
  "var-month-picker-cover": "",
6685
6697
  ripple: false
6686
6698
  }, _extends$8({}, _ctx.buttonProps(month.index)), {
6687
- onClick: ($event) => _ctx.chooseMonth(month)
6699
+ onClick: (event) => _ctx.chooseMonth(month, event)
6688
6700
  }), {
6689
6701
  default: withCtx(() => [createTextVNode(toDisplayString(_ctx.getMonthAbbr(month.index)), 1)]),
6690
6702
  _: 2
@@ -6841,15 +6853,20 @@ var MonthPickerPanel = defineComponent({
6841
6853
  };
6842
6854
  var isCover = textColorOrCover().startsWith("var-date-picker");
6843
6855
  return {
6844
- disabled,
6845
6856
  outline: computeOutline(),
6846
6857
  text: computeText(),
6847
6858
  color: !computeText() ? color : "",
6848
6859
  textColor: isCover ? "" : textColorOrCover(),
6849
- "var-date-picker-color-cover": isCover
6860
+ "var-date-picker-color-cover": isCover,
6861
+ class: {
6862
+ "var-month-picker__button-disabled": disabled
6863
+ }
6850
6864
  };
6851
6865
  };
6852
- var chooseMonth = (month) => {
6866
+ var chooseMonth = (month, event) => {
6867
+ var buttonEl = event.currentTarget;
6868
+ if (buttonEl.classList.contains("var-month-picker__button-disabled"))
6869
+ return;
6853
6870
  emit("choose-month", month);
6854
6871
  };
6855
6872
  var checkDate = (checkType) => {
@@ -7030,7 +7047,7 @@ function render$C(_ctx, _cache) {
7030
7047
  round: "",
7031
7048
  ripple: false
7032
7049
  }, _extends$7({}, _ctx.buttonProps(day)), {
7033
- onClick: ($event) => _ctx.chooseDay(day)
7050
+ onClick: (event) => _ctx.chooseDay(day, event)
7034
7051
  }), {
7035
7052
  default: withCtx(() => [createTextVNode(toDisplayString(_ctx.filterDay(day)), 1)]),
7036
7053
  _: 2
@@ -7235,11 +7252,13 @@ var DayPickerPanel = defineComponent({
7235
7252
  };
7236
7253
  var isCover = textColorOrCover().startsWith("var-date-picker");
7237
7254
  return {
7238
- disabled,
7239
7255
  text: computeText(),
7240
7256
  outline: computeOutline(),
7241
7257
  textColor: isCover ? "" : textColorOrCover(),
7242
- "var-date-picker-color-cover": isCover
7258
+ "var-date-picker-color-cover": isCover,
7259
+ class: {
7260
+ "var-day-picker__button-disabled": disabled
7261
+ }
7243
7262
  };
7244
7263
  };
7245
7264
  var checkDate = (checkType) => {
@@ -7247,7 +7266,10 @@ var DayPickerPanel = defineComponent({
7247
7266
  panelKey.value += checkType === "prev" ? -1 : 1;
7248
7267
  emit("check-preview", "month", checkType);
7249
7268
  };
7250
- var chooseDay = (day) => {
7269
+ var chooseDay = (day, event) => {
7270
+ var buttonEl = event.currentTarget;
7271
+ if (buttonEl.classList.contains("var-day-picker__button-disabled"))
7272
+ return;
7251
7273
  emit("choose-day", day);
7252
7274
  };
7253
7275
  var forwardRef = (checkType) => {
@@ -7531,8 +7553,10 @@ var DatePicker = defineComponent({
7531
7553
  if (isUntouchable.value || touchDirection !== "x")
7532
7554
  return;
7533
7555
  var componentRef = getPanelType.value === "month" ? monthPanelEl : dayPanelEl;
7534
- componentRef.value.forwardRef(checkType);
7535
- resetState();
7556
+ nextTickFrame(() => {
7557
+ componentRef.value.forwardRef(checkType);
7558
+ resetState();
7559
+ });
7536
7560
  };
7537
7561
  var updateRange = (date, type) => {
7538
7562
  var rangeDate = type === "month" ? chooseRangeMonth : chooseRangeDay;
@@ -9860,7 +9884,6 @@ var IndexBar = defineComponent({
9860
9884
  indexAnchors,
9861
9885
  bindIndexAnchors
9862
9886
  } = useIndexAnchors();
9863
- var scrollEl = ref(null);
9864
9887
  var clickedName = ref("");
9865
9888
  var scroller2 = ref(null);
9866
9889
  var barEl = ref(null);
@@ -9886,10 +9909,8 @@ var IndexBar = defineComponent({
9886
9909
  props2.onChange == null ? void 0 : props2.onChange(anchorName);
9887
9910
  };
9888
9911
  var handleScroll = () => {
9889
- var {
9890
- scrollTop,
9891
- scrollHeight
9892
- } = scrollEl.value;
9912
+ var scrollTop = getScrollTop(scroller2.value);
9913
+ var scrollHeight = scroller2.value === window ? document.body.scrollHeight : scroller2.value.scrollHeight;
9893
9914
  var {
9894
9915
  offsetTop
9895
9916
  } = barEl.value;
@@ -9924,10 +9945,10 @@ var IndexBar = defineComponent({
9924
9945
  if (!indexAnchor)
9925
9946
  return;
9926
9947
  var top = indexAnchor.ownTop.value - stickyOffsetTop.value + offsetTop;
9927
- var left = getScrollLeft(scrollEl.value);
9948
+ var left = getScrollLeft(scroller2.value);
9928
9949
  clickedName.value = anchorName;
9929
9950
  emitEvent(anchorName);
9930
- yield scrollTo(scrollEl.value, {
9951
+ yield scrollTo(scroller2.value, {
9931
9952
  left,
9932
9953
  top,
9933
9954
  animation: easeInOutCubic,
@@ -9957,15 +9978,13 @@ var IndexBar = defineComponent({
9957
9978
  });
9958
9979
  }));
9959
9980
  onMounted(/* @__PURE__ */ _asyncToGenerator$4(function* () {
9960
- var _scroller$value;
9961
9981
  yield doubleRaf();
9962
9982
  scroller2.value = getParentScroller(barEl.value);
9963
- scrollEl.value = scroller2.value === window ? scroller2.value.document.documentElement : scroller2.value;
9964
- (_scroller$value = scroller2.value) == null ? void 0 : _scroller$value.addEventListener("scroll", handleScroll);
9983
+ scroller2.value.addEventListener("scroll", handleScroll);
9965
9984
  }));
9966
9985
  onBeforeUnmount(() => {
9967
- var _scroller$value2;
9968
- (_scroller$value2 = scroller2.value) == null ? void 0 : _scroller$value2.removeEventListener("scroll", handleScroll);
9986
+ var _scroller$value;
9987
+ (_scroller$value = scroller2.value) == null ? void 0 : _scroller$value.removeEventListener("scroll", handleScroll);
9969
9988
  });
9970
9989
  return {
9971
9990
  barEl,
@@ -12657,6 +12676,10 @@ var props$d = {
12657
12676
  type: Boolean,
12658
12677
  default: false
12659
12678
  },
12679
+ offsetY: {
12680
+ type: [String, Number],
12681
+ default: 0
12682
+ },
12660
12683
  chip: {
12661
12684
  type: Boolean,
12662
12685
  default: false
@@ -12949,7 +12972,7 @@ var Select = defineComponent({
12949
12972
  return;
12950
12973
  }
12951
12974
  wrapWidth.value = getWrapWidth();
12952
- offsetY.value = getOffsetY();
12975
+ offsetY.value = getOffsetY() + toPxNum(props2.offsetY);
12953
12976
  isFocus.value = true;
12954
12977
  onFocus == null ? void 0 : onFocus();
12955
12978
  validateWithTrigger("onFocus");
@@ -13056,6 +13079,8 @@ var Select = defineComponent({
13056
13079
  computeLabel();
13057
13080
  };
13058
13081
  var focus = () => {
13082
+ wrapWidth.value = getWrapWidth();
13083
+ offsetY.value = getOffsetY() + toPxNum(props2.offsetY);
13059
13084
  isFocus.value = true;
13060
13085
  };
13061
13086
  var blur = () => {
@@ -16121,6 +16146,10 @@ var props = {
16121
16146
  rules: {
16122
16147
  type: Array
16123
16148
  },
16149
+ hideList: {
16150
+ type: Boolean,
16151
+ default: false
16152
+ },
16124
16153
  onBeforeRead: {
16125
16154
  type: Function
16126
16155
  },
@@ -16189,7 +16218,7 @@ function render(_ctx, _cache) {
16189
16218
  var _component_var_form_details = resolveComponent("var-form-details");
16190
16219
  var _component_var_popup = resolveComponent("var-popup");
16191
16220
  var _directive_ripple = resolveDirective("ripple");
16192
- return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.modelValue, (f) => {
16221
+ return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (f) => {
16193
16222
  return withDirectives((openBlock(), createElementBlock("div", {
16194
16223
  class: normalizeClass(["var-uploader__file var-elevation--2", [f.state === "loading" ? "var-uploader--loading" : null]]),
16195
16224
  key: f.id,
@@ -16296,6 +16325,16 @@ var Uploader = defineComponent({
16296
16325
  validate: v,
16297
16326
  resetValidation
16298
16327
  } = useValidation();
16328
+ var files = computed(() => {
16329
+ var {
16330
+ modelValue,
16331
+ hideList
16332
+ } = props2;
16333
+ if (hideList) {
16334
+ return [];
16335
+ }
16336
+ return modelValue;
16337
+ });
16299
16338
  var preview = (varFile) => {
16300
16339
  var {
16301
16340
  disabled,
@@ -16388,8 +16427,8 @@ var Uploader = defineComponent({
16388
16427
  var limit = Math.min(varFiles2.length, toNumber(maxlength) - modelValue.length);
16389
16428
  return varFiles2.slice(0, limit);
16390
16429
  };
16391
- var files = getFiles(event);
16392
- var varFiles = files.map(createVarFile);
16430
+ var files2 = getFiles(event);
16431
+ var varFiles = files2.map(createVarFile);
16393
16432
  varFiles = maxsize != null ? getValidSizeVarFile(varFiles) : varFiles;
16394
16433
  varFiles = maxlength != null ? getValidLengthVarFiles(varFiles) : varFiles;
16395
16434
  var resolvedVarFiles = yield Promise.all(getResolvers(varFiles));
@@ -16477,6 +16516,7 @@ var Uploader = defineComponent({
16477
16516
  deep: true
16478
16517
  });
16479
16518
  return {
16519
+ files,
16480
16520
  showPreview,
16481
16521
  currentPreview,
16482
16522
  errorMessage,
@@ -16584,9 +16624,9 @@ var skeleton = "";
16584
16624
  var SkeletonSfc = "";
16585
16625
  var slider = "";
16586
16626
  var SliderSfc = "";
16587
- var SnackbarSfc = "";
16588
16627
  var snackbar = "";
16589
16628
  var coreSfc = "";
16629
+ var SnackbarSfc = "";
16590
16630
  var space = "";
16591
16631
  var step = "";
16592
16632
  var StepSfc = "";