@deot/vc-components 1.0.43 → 1.0.45

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.
@@ -66,7 +66,7 @@
66
66
  }
67
67
  const VcInstance = new Instance();
68
68
 
69
- const props$1s = {
69
+ const props$1t = {
70
70
  tag: {
71
71
  type: String,
72
72
  default: "div"
@@ -75,10 +75,10 @@
75
75
 
76
76
  /** @jsxImportSource vue */
77
77
 
78
- const COMPONENT_NAME$27 = 'vc-action-sheet';
78
+ const COMPONENT_NAME$28 = 'vc-action-sheet';
79
79
  const ActionSheet = /* @__PURE__ */ vue.defineComponent({
80
- name: COMPONENT_NAME$27,
81
- props: props$1s,
80
+ name: COMPONENT_NAME$28,
81
+ props: props$1t,
82
82
  setup(props, {
83
83
  slots
84
84
  }) {
@@ -92,6 +92,400 @@
92
92
 
93
93
  const MActionSheet = ActionSheet;
94
94
 
95
+ const IS_SERVER$3 = typeof window === "undefined";
96
+
97
+ const hasClass = (el, cls) => {
98
+ if (IS_SERVER$3 || !cls) return false;
99
+ if (cls.includes(" ")) {
100
+ throw new Error("[@deot/helper-dom]: 类名不应该包含空格");
101
+ }
102
+ if (el.classList) {
103
+ return el.classList.contains(cls);
104
+ } else {
105
+ return (" " + el.className + " ").indexOf(" " + cls + " ") > -1;
106
+ }
107
+ };
108
+
109
+ const addClass = (el, cls) => {
110
+ if (IS_SERVER$3 || !cls) return;
111
+ let curClass = el.className;
112
+ const classes = cls.split(" ");
113
+ for (let i = 0, j = classes.length; i < j; i++) {
114
+ const clsName = classes[i];
115
+ if (clsName) {
116
+ if (el.classList) {
117
+ el.classList.add(clsName);
118
+ } else if (!hasClass(el, clsName)) {
119
+ curClass += " " + clsName;
120
+ }
121
+ }
122
+ }
123
+ if (!el.classList) {
124
+ el.className = curClass;
125
+ }
126
+ };
127
+
128
+ const composedPath = (e) => {
129
+ const path = e.composedPath && e.composedPath() || [];
130
+ if (path.length) return path;
131
+ let parent = e.target?.parentNode;
132
+ /* istanbul ignore next -- @preserve */
133
+ while (parent) {
134
+ path.push(parent);
135
+ parent = parent.parentNode;
136
+ }
137
+ return path;
138
+ };
139
+
140
+ const contains$1 = (el, child) => {
141
+ if (IS_SERVER$3 || !child) return false;
142
+ const childRect = child.getBoundingClientRect();
143
+ let elRect;
144
+ if (!el || [window, document, document.documentElement].includes(el)) {
145
+ elRect = {
146
+ top: 0,
147
+ right: window.innerWidth,
148
+ bottom: window.innerHeight,
149
+ left: 0
150
+ };
151
+ } else {
152
+ elRect = el.getBoundingClientRect();
153
+ }
154
+ return childRect.top < elRect.bottom && childRect.bottom > elRect.top && childRect.right > elRect.left && childRect.left < elRect.right;
155
+ };
156
+
157
+ const el$1 = (v) => {
158
+ if (IS_SERVER$3) return null;
159
+ let target;
160
+ if (typeof v === "object") {
161
+ target = v;
162
+ } else {
163
+ target = document.querySelector(v);
164
+ }
165
+ if (!target) {
166
+ throw new Error("[@deot/helper-dom]: el缺失");
167
+ }
168
+ return target;
169
+ };
170
+
171
+ const getStyle$1 = (el, name) => {
172
+ if (IS_SERVER$3 || !name) return "";
173
+ if (name === "float") {
174
+ name = "cssFloat";
175
+ }
176
+ try {
177
+ const computed = document.defaultView.getComputedStyle(el, "");
178
+ return el.style[name] || (computed?.[name] || "");
179
+ } catch (e) {
180
+ return el.style[name] || "";
181
+ }
182
+ };
183
+
184
+ const isScroller = (el, options) => {
185
+ if (IS_SERVER$3 || !el) return false;
186
+ const { className, direction } = options || {};
187
+ let overflow = getStyle$1(el, `overflow-${direction ? "y" : "x"}`);
188
+ overflow = overflow || getStyle$1(el, "overflow");
189
+ return !!(overflow.match(/(scroll|auto)/) || className?.test(el.className));
190
+ };
191
+
192
+ const getScroller = (el, options) => {
193
+ if (IS_SERVER$3 || !el) return null;
194
+ let parent = el;
195
+ while (parent) {
196
+ if ([window, document, document.documentElement].includes(parent)) {
197
+ return window;
198
+ }
199
+ if (isScroller(parent, options)) {
200
+ return parent;
201
+ }
202
+ parent = parent?.parentNode;
203
+ }
204
+ return parent;
205
+ };
206
+
207
+ const off = (el, event, handler, options) => {
208
+ if (IS_SERVER$3) return;
209
+ el.removeEventListener(event, handler, false);
210
+ };
211
+
212
+ const on = (el, event, handler, options) => {
213
+ if (IS_SERVER$3) return () => {
214
+ };
215
+ el.addEventListener(event, handler, false);
216
+ return () => {
217
+ el.removeEventListener(event, handler, false);
218
+ };
219
+ };
220
+
221
+ const $target = IS_SERVER$3 ? {} : document.createElement("div").style;
222
+ const prefix$1 = (() => {
223
+ const keys = {
224
+ webkit: "webkitTransform",
225
+ Moz: "MozTransform",
226
+ O: "OTransform",
227
+ ms: "msTransform",
228
+ standard: "transform"
229
+ };
230
+ const values = {
231
+ webkit: "-webkit-",
232
+ Moz: "-moz-",
233
+ O: "-o-",
234
+ ms: "-ms-",
235
+ standard: ""
236
+ };
237
+ for (const key in keys) {
238
+ if ($target[keys[key]] !== void 0) {
239
+ return {
240
+ camel: key,
241
+ kebab: values[key]
242
+ };
243
+ }
244
+ }
245
+ return false;
246
+ })();
247
+ const prefixStyle = (v) => {
248
+ if (IS_SERVER$3 || prefix$1 === false) {
249
+ return {
250
+ camel: v,
251
+ kebab: v
252
+ };
253
+ }
254
+ return {
255
+ camel: prefix$1.camel + v.charAt(0).toUpperCase() + v.substr(1),
256
+ kebab: prefix$1.kebab + v
257
+ };
258
+ };
259
+
260
+ const removeClass = (el, cls) => {
261
+ if (IS_SERVER$3 || !cls) return;
262
+ const classes = cls.split(" ");
263
+ let curClass = " " + el.className + " ";
264
+ for (let i = 0, j = classes.length; i < j; i++) {
265
+ const clsName = classes[i];
266
+ if (clsName) {
267
+ if (el.classList) {
268
+ el.classList.remove(clsName);
269
+ continue;
270
+ }
271
+ /* istanbul ignore next -- @preserve */
272
+ if (hasClass(el, clsName)) {
273
+ curClass = curClass.replace(" " + clsName + " ", " ");
274
+ }
275
+ }
276
+ }
277
+ if (!el.classList) {
278
+ el.className = curClass.trim();
279
+ }
280
+ };
281
+
282
+ const scrollIntoView = async (el, options) => {
283
+ if (IS_SERVER$3) return;
284
+ const { from = 0, to = 0, duration = 300 } = options || {};
285
+ const difference = Math.abs(from - to);
286
+ const step = Math.ceil(difference / duration * 50);
287
+ let onResolve;
288
+ const target = new Promise((resolve) => {
289
+ onResolve = resolve;
290
+ });
291
+ const scroll = (start, end) => {
292
+ if (start === end) {
293
+ onResolve();
294
+ return;
295
+ }
296
+ let d = start + step > end ? end : start + step;
297
+ if (start > end) {
298
+ d = start - step < end ? end : start - step;
299
+ }
300
+ if (el === window) {
301
+ window.scrollTo(d, d);
302
+ } else {
303
+ el.scrollTop = d;
304
+ }
305
+ window.requestAnimationFrame(() => scroll(d, end));
306
+ };
307
+ scroll(from, to);
308
+ return target;
309
+ };
310
+
311
+ const props$1s = {
312
+ zIndex: {
313
+ type: [Number, String],
314
+ default: 1
315
+ },
316
+ // TODO: left/right
317
+ placement: {
318
+ type: String,
319
+ default: "top"
320
+ },
321
+ disabled: {
322
+ type: Boolean,
323
+ default: false
324
+ },
325
+ fixed: {
326
+ type: Boolean,
327
+ default: true
328
+ },
329
+ offset: {
330
+ type: Number,
331
+ default: 0
332
+ },
333
+ // -> 固钉始终保持在容器内, 超过范围则隐藏(请注意容器避免出现滚动条) 仅fixed为true有效
334
+ target: {
335
+ type: String
336
+ }
337
+ };
338
+
339
+ /** @jsxImportSource vue */
340
+
341
+ const COMPONENT_NAME$27 = 'vc-affix';
342
+ const SCROLLER_WHEEL_REG = /vc-scroller-wheel/;
343
+ const Affix = /* @__PURE__ */ vue.defineComponent({
344
+ name: COMPONENT_NAME$27,
345
+ props: props$1s,
346
+ setup(props, {
347
+ slots,
348
+ expose
349
+ }) {
350
+ const scrollerInstance = vue.inject('vc-scroller', null);
351
+ const scroller = vue.shallowRef(); // 当前元素所在的滚动容器
352
+ const base = vue.shallowRef(); // 当前元素(props.tagret)的参考容器
353
+ const current = vue.shallowRef(); // 当前元素
354
+
355
+ const currentRect = vue.reactive({
356
+ top: 0,
357
+ bottom: 0,
358
+ width: 0,
359
+ height: 0
360
+ });
361
+ const isActive = vue.ref(false);
362
+ const transformY = vue.ref(0);
363
+ const windowHeight = vue.ref(window.innerHeight);
364
+ const isVcScrollerWheel = vue.computed(() => {
365
+ return SCROLLER_WHEEL_REG.test(scroller.value?.className || '');
366
+ });
367
+ const currentStyle = vue.computed(() => {
368
+ if (!isActive.value) return {};
369
+ return {
370
+ height: `${currentRect.height}px`,
371
+ width: `${currentRect.width}px`
372
+ };
373
+ });
374
+ const contentStyle = vue.computed(() => {
375
+ if (!isActive.value) return {};
376
+ const offset = `${props.offset}px`;
377
+ return {
378
+ height: `${currentRect.height}px`,
379
+ width: `${currentRect.width}px`,
380
+ top: props.placement === 'top' ? offset : '',
381
+ bottom: props.placement === 'bottom' ? offset : '',
382
+ zIndex: props.zIndex,
383
+ transform: transformY.value ? `translateY(${transformY.value}px)` : ''
384
+ };
385
+ });
386
+ const setCurrentRect = () => {
387
+ const rect = current.value.getBoundingClientRect();
388
+ Object.assign(currentRect, {
389
+ top: rect.top,
390
+ bottom: rect.bottom,
391
+ width: rect.width,
392
+ height: rect.height
393
+ });
394
+ };
395
+ const setAbsoluteStatus = () => {
396
+ const {
397
+ placement,
398
+ offset
399
+ } = props;
400
+ const currentHeightOffset = offset + currentRect.height;
401
+ const containerRect = scroller.value.getBoundingClientRect();
402
+ let transformOffsetY = 0;
403
+
404
+ // scroller-wheel滚动条偏移
405
+ if (scrollerInstance && isVcScrollerWheel.value) {
406
+ const maxMoveY = scrollerInstance.scrollHeight - scrollerInstance.clientHeight;
407
+ transformOffsetY = scrollerInstance.scrollTop >= maxMoveY ? maxMoveY : scrollerInstance.scrollTop;
408
+ }
409
+ if (placement === 'top') {
410
+ isActive.value = currentRect.top - containerRect.top <= props.offset;
411
+ transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0) + transformOffsetY;
412
+ } else {
413
+ isActive.value = currentRect.bottom - containerRect.top >= containerRect.height - props.offset;
414
+ transformY.value = Math.max(containerRect.height - containerRect.top - currentHeightOffset, 0) + transformOffsetY;
415
+ }
416
+ };
417
+ const setFixedStatus = () => {
418
+ const {
419
+ placement,
420
+ target,
421
+ offset
422
+ } = props;
423
+ const currentHeightOffset = offset + currentRect.height;
424
+ const containerRect = target && base.value.getBoundingClientRect();
425
+ if (placement === 'top') {
426
+ if (target) {
427
+ isActive.value = offset > currentRect.top && containerRect.bottom > 0;
428
+ transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0);
429
+ } else {
430
+ isActive.value = offset > currentRect.top;
431
+ }
432
+ } else {
433
+ if (target) {
434
+ isActive.value = windowHeight.value - offset < currentRect.bottom && windowHeight.value > containerRect.top;
435
+ transformY.value = -Math.min(windowHeight.value - containerRect.top - currentHeightOffset, 0);
436
+ } else {
437
+ isActive.value = windowHeight.value - offset < currentRect.bottom;
438
+ }
439
+ }
440
+ };
441
+ const refresh = () => {
442
+ setCurrentRect();
443
+ scroller.value instanceof Window || props.fixed ? setFixedStatus() : setAbsoluteStatus();
444
+ };
445
+ vue.onMounted(() => {
446
+ if (typeof props.target === 'string') {
447
+ base.value = document.querySelector(props.target) ?? void 0;
448
+ }
449
+ !base.value && (base.value = document.documentElement);
450
+ scroller.value = getScroller(current.value, {
451
+ className: SCROLLER_WHEEL_REG
452
+ });
453
+ if (isVcScrollerWheel.value) {
454
+ scrollerInstance?.on(refresh);
455
+ } else {
456
+ scroller.value?.addEventListener('scroll', refresh);
457
+ }
458
+ refresh();
459
+ });
460
+ vue.onBeforeUnmount(() => {
461
+ if (isVcScrollerWheel.value) {
462
+ scrollerInstance?.off(refresh);
463
+ } else {
464
+ scroller.value?.removeEventListener('scroll', refresh);
465
+ }
466
+ });
467
+ expose({
468
+ refresh
469
+ });
470
+ return () => {
471
+ return vue.createVNode("div", {
472
+ "ref": current,
473
+ "class": "vc-affix",
474
+ "style": currentStyle.value
475
+ }, [vue.createVNode("div", {
476
+ "class": {
477
+ [`vc-affix__${props.fixed ? 'fixed' : 'absolute'}`]: isActive.value
478
+ },
479
+ "style": contentStyle.value
480
+ }, [slots?.default?.({
481
+ active: isActive.value
482
+ })])]);
483
+ };
484
+ }
485
+ });
486
+
487
+ const MAffix = Affix;
488
+
95
489
  const props$1r = {
96
490
  modelValue: {
97
491
  type: Boolean,
@@ -134,9 +528,9 @@
134
528
  const dReg = /.*d="([^"]+).*/g;
135
529
  const fillReg = /.*fill="([^"]+).*/g;
136
530
  const basicUrl = "//at.alicdn.com/t/font_1119857_u0f4525o6sd.js";
137
- const prefix$1 = "@deot/vc-icon:";
531
+ const prefix = "@deot/vc-icon:";
138
532
  const IS_DEV = false;
139
- const IS_SERVER$3 = typeof document === "undefined";
533
+ const IS_SERVER$2 = typeof document === "undefined";
140
534
  class Manager {
141
535
  icons = {};
142
536
  events = {};
@@ -151,10 +545,10 @@
151
545
  this.sourceStatus[url] = this.sourceStatus[url] || new Promise((resolve, reject) => {
152
546
  (async () => {
153
547
  try {
154
- if (IS_SERVER$3 || !/.js$/.test(url)) {
548
+ if (IS_SERVER$2 || !/.js$/.test(url)) {
155
549
  return reject(new VcError("icon", "invaild url"));
156
550
  }
157
- const key = `${prefix$1}${url}`;
551
+ const key = `${prefix}${url}`;
158
552
  const cache = window.localStorage.getItem(key);
159
553
  let icons = JSON.parse(cache || '""');
160
554
  /* istanbul ignore next -- @preserve */
@@ -236,7 +630,7 @@
236
630
  if (this.events[type].length >= 100) {
237
631
  delete this.events[type];
238
632
  /* istanbul ignore else -- @preserve */
239
- if (!IS_SERVER$3) {
633
+ if (!IS_SERVER$2) {
240
634
  throw new VcError("icon", `${type} nonexistent`);
241
635
  }
242
636
  }
@@ -253,8 +647,8 @@
253
647
  clearResource() {
254
648
  const needs = Object.keys(this.sourceStatus);
255
649
  Object.keys(window.localStorage).forEach((item) => {
256
- if (item.includes(prefix$1)) {
257
- const key = item.split(prefix$1).pop();
650
+ if (item.includes(prefix)) {
651
+ const key = item.split(prefix).pop();
258
652
  key && !needs.includes(key) && window.localStorage.removeItem(item);
259
653
  }
260
654
  });
@@ -778,7 +1172,7 @@
778
1172
 
779
1173
  // [color, borderColor, backgroundColor], -> CSS
780
1174
  const THEME_MAP = {
781
- info: ['#2B72FD', '#91d5ff', '#e6f7ff'],
1175
+ info: ['#456CF6', '#91d5ff', '#e6f7ff'],
782
1176
  success: ['#52c41a', '#b7eb8f', '#f6ffed'],
783
1177
  error: ['#ed4014', '#ffb08f', '#fbe9e9'],
784
1178
  warning: ['#ffbf00', '#ffe58f', '#fffbe6']
@@ -969,7 +1363,7 @@
969
1363
  );
970
1364
  };
971
1365
 
972
- const flatten$1 = (value, parser) => {
1366
+ const flatten$1 = (value, parser, exit) => {
973
1367
  let need = true;
974
1368
  let safeCount = 1;
975
1369
  let parseValue = value;
@@ -979,7 +1373,7 @@
979
1373
  }
980
1374
  try {
981
1375
  const next = (parser || decodeURIComponent)(parseValue);
982
- if (parseValue === next) {
1376
+ if (parseValue === next || typeof exit === "function" && exit(next)) {
983
1377
  need = false;
984
1378
  }
985
1379
  parseValue = next;
@@ -992,8 +1386,7 @@
992
1386
  };
993
1387
 
994
1388
  const flattenJSONParse = (value) => {
995
- if (value === null)
996
- return null;
1389
+ if (value === null) return null;
997
1390
  const regex = /^\d+$/;
998
1391
  if (regex.test(value) && value.length >= 16 && +value > Number.MAX_SAFE_INTEGER) {
999
1392
  return value;
@@ -3621,7 +4014,7 @@
3621
4014
  function castSlice(array, start, end) {
3622
4015
  var length = array.length;
3623
4016
  end = end === undefined ? length : end;
3624
- return (false && end >= length) ? array : baseSlice(array, start, end);
4017
+ return (!start && end >= length) ? array : baseSlice(array, start, end);
3625
4018
  }
3626
4019
 
3627
4020
  /** Used to compose unicode character classes. */
@@ -6695,233 +7088,6 @@
6695
7088
  return parent;
6696
7089
  };
6697
7090
 
6698
- const IS_SERVER$2 = typeof window === "undefined";
6699
-
6700
- const hasClass = (el, cls) => {
6701
- if (IS_SERVER$2 || !cls)
6702
- return false;
6703
- if (cls.includes(" ")) {
6704
- throw new Error("[@deot/helper-dom]: 类名不应该包含空格");
6705
- }
6706
- if (el.classList) {
6707
- return el.classList.contains(cls);
6708
- } else {
6709
- return (" " + el.className + " ").indexOf(" " + cls + " ") > -1;
6710
- }
6711
- };
6712
-
6713
- const addClass = (el, cls) => {
6714
- if (IS_SERVER$2 || !cls)
6715
- return;
6716
- let curClass = el.className;
6717
- let classes = cls.split(" ");
6718
- for (let i = 0, j = classes.length; i < j; i++) {
6719
- let clsName = classes[i];
6720
- if (clsName) {
6721
- if (el.classList) {
6722
- el.classList.add(clsName);
6723
- } else if (!hasClass(el, clsName)) {
6724
- curClass += " " + clsName;
6725
- }
6726
- }
6727
- }
6728
- if (!el.classList) {
6729
- el.className = curClass;
6730
- }
6731
- };
6732
-
6733
- const composedPath = (e) => {
6734
- let path = e.composedPath && e.composedPath() || [];
6735
- if (path.length)
6736
- return path;
6737
- let parent = e.target?.parentNode;
6738
- /* istanbul ignore next -- @preserve */
6739
- while (parent) {
6740
- path.push(parent);
6741
- parent = parent.parentNode;
6742
- }
6743
- return path;
6744
- };
6745
-
6746
- const contains$1 = (el, child) => {
6747
- if (IS_SERVER$2 || !child)
6748
- return false;
6749
- let childRect = child.getBoundingClientRect();
6750
- let elRect;
6751
- if (!el || [window, document, document.documentElement].includes(el)) {
6752
- elRect = {
6753
- top: 0,
6754
- right: window.innerWidth,
6755
- bottom: window.innerHeight,
6756
- left: 0
6757
- };
6758
- } else {
6759
- elRect = el.getBoundingClientRect();
6760
- }
6761
- return childRect.top < elRect.bottom && childRect.bottom > elRect.top && childRect.right > elRect.left && childRect.left < elRect.right;
6762
- };
6763
-
6764
- const el$1 = (v) => {
6765
- if (IS_SERVER$2)
6766
- return null;
6767
- let target;
6768
- if (typeof v === "object") {
6769
- target = v;
6770
- } else {
6771
- target = document.querySelector(v);
6772
- }
6773
- if (!target) {
6774
- throw new Error("[@deot/helper-dom]: el缺失");
6775
- }
6776
- return target;
6777
- };
6778
-
6779
- const getStyle$1 = (el, name) => {
6780
- if (IS_SERVER$2 || !name)
6781
- return "";
6782
- if (name === "float") {
6783
- name = "cssFloat";
6784
- }
6785
- try {
6786
- let computed = document.defaultView.getComputedStyle(el, "");
6787
- return el.style[name] || (computed?.[name] || "");
6788
- } catch (e) {
6789
- return el.style[name] || "";
6790
- }
6791
- };
6792
-
6793
- const isScroll = (el, direction) => {
6794
- if (IS_SERVER$2 || !el)
6795
- return false;
6796
- let overflow = getStyle$1(el, `overflow-${"x"}`);
6797
- overflow = overflow || getStyle$1(el, "overflow");
6798
- return !!overflow.match(/(scroll|auto)/);
6799
- };
6800
-
6801
- const getScroller = (el, direction) => {
6802
- if (IS_SERVER$2 || !el)
6803
- return null;
6804
- let parent = el;
6805
- while (parent) {
6806
- if ([window, document, document.documentElement].includes(parent)) {
6807
- return window;
6808
- }
6809
- if (isScroll(parent)) {
6810
- return parent;
6811
- }
6812
- parent = parent?.parentNode;
6813
- }
6814
- return parent;
6815
- };
6816
-
6817
- const off = (el, event, handler, options) => {
6818
- if (IS_SERVER$2)
6819
- return;
6820
- el.removeEventListener(event, handler, false);
6821
- };
6822
-
6823
- const on = (el, event, handler, options) => {
6824
- if (IS_SERVER$2)
6825
- return () => {
6826
- };
6827
- el.addEventListener(event, handler, false);
6828
- return () => {
6829
- el.removeEventListener(event, handler, false);
6830
- };
6831
- };
6832
-
6833
- const $target = IS_SERVER$2 ? {} : document.createElement("div").style;
6834
- const prefix = (() => {
6835
- let keys = {
6836
- webkit: "webkitTransform",
6837
- Moz: "MozTransform",
6838
- O: "OTransform",
6839
- ms: "msTransform",
6840
- standard: "transform"
6841
- };
6842
- let values = {
6843
- webkit: "-webkit-",
6844
- Moz: "-moz-",
6845
- O: "-o-",
6846
- ms: "-ms-",
6847
- standard: ""
6848
- };
6849
- for (let key in keys) {
6850
- if ($target[keys[key]] !== void 0) {
6851
- return {
6852
- camel: key,
6853
- kebab: values[key]
6854
- };
6855
- }
6856
- }
6857
- return false;
6858
- })();
6859
- const prefixStyle = (v) => {
6860
- if (IS_SERVER$2 || prefix === false) {
6861
- return {
6862
- camel: v,
6863
- kebab: v
6864
- };
6865
- }
6866
- return {
6867
- camel: prefix.camel + v.charAt(0).toUpperCase() + v.substr(1),
6868
- kebab: prefix.kebab + v
6869
- };
6870
- };
6871
-
6872
- const removeClass = (el, cls) => {
6873
- if (IS_SERVER$2 || !cls)
6874
- return;
6875
- let classes = cls.split(" ");
6876
- let curClass = " " + el.className + " ";
6877
- for (let i = 0, j = classes.length; i < j; i++) {
6878
- let clsName = classes[i];
6879
- if (clsName) {
6880
- if (el.classList) {
6881
- el.classList.remove(clsName);
6882
- continue;
6883
- }
6884
- /* istanbul ignore next -- @preserve */
6885
- if (hasClass(el, clsName)) {
6886
- curClass = curClass.replace(" " + clsName + " ", " ");
6887
- }
6888
- }
6889
- }
6890
- if (!el.classList) {
6891
- el.className = curClass.trim();
6892
- }
6893
- };
6894
-
6895
- const scrollIntoView = async (el, options) => {
6896
- if (IS_SERVER$2)
6897
- return;
6898
- let { from = 0, to = 0, duration = 300 } = options || {};
6899
- let difference = Math.abs(from - to);
6900
- let step = Math.ceil(difference / duration * 50);
6901
- let onResolve;
6902
- let target = new Promise((resolve) => {
6903
- onResolve = resolve;
6904
- });
6905
- const scroll = (start, end) => {
6906
- if (start === end) {
6907
- onResolve();
6908
- return;
6909
- }
6910
- let d = start + step > end ? end : start + step;
6911
- if (start > end) {
6912
- d = start - step < end ? end : start - step;
6913
- }
6914
- if (el === window) {
6915
- window.scrollTo(d, d);
6916
- } else {
6917
- el.scrollTop = d;
6918
- }
6919
- window.requestAnimationFrame(() => scroll(d, end));
6920
- };
6921
- scroll(from, to);
6922
- return target;
6923
- };
6924
-
6925
7091
  const getSelectedData = (value = [], source = []) => {
6926
7092
  const label = [];
6927
7093
  const data = [];
@@ -14693,6 +14859,7 @@
14693
14859
  refreshSize();
14694
14860
  refreshPosition(options);
14695
14861
  };
14862
+ const listeners = [];
14696
14863
  const triggerScrollDelegate = (options) => {
14697
14864
  const delegates = {
14698
14865
  scrollLeft: (options && options.x) ?? scrollX.value,
@@ -14700,12 +14867,15 @@
14700
14867
  clientWidth: wrapperW.value,
14701
14868
  clientHeight: wrapperH.value,
14702
14869
  scrollWidth: contentW.value,
14703
- scrollHeight: contentH.value
14870
+ scrollHeight: contentH.value,
14871
+ getBoundingClientRect: () => wrapper.value?.getBoundingClientRect()
14704
14872
  };
14705
- instance.emit("scroll", {
14873
+ const e = {
14706
14874
  target: delegates,
14707
14875
  currentTarget: delegates
14708
- });
14876
+ };
14877
+ instance.emit("scroll", e);
14878
+ listeners.forEach((listener) => listener(e));
14709
14879
  };
14710
14880
  const scrollTo = (options) => {
14711
14881
  refreshPosition(options);
@@ -14732,8 +14902,9 @@
14732
14902
  Resize.off(wrapper.value, refresh);
14733
14903
  Resize.off(content.value, refresh);
14734
14904
  }
14905
+ listeners.splice(0, listeners.length);
14735
14906
  });
14736
- expose({
14907
+ const exposed = {
14737
14908
  wrapper,
14738
14909
  content,
14739
14910
  scrollTo,
@@ -14749,8 +14920,16 @@
14749
14920
  },
14750
14921
  setScrollLeft: (value) => {
14751
14922
  scrollTo({ x: value });
14923
+ },
14924
+ on: (listener) => {
14925
+ listeners.push(listener);
14926
+ },
14927
+ off: (listener) => {
14928
+ listeners.splice(listeners.indexOf(listener), 1);
14752
14929
  }
14753
- });
14930
+ };
14931
+ expose(exposed);
14932
+ vue.provide("vc-scroller", vue.reactive(exposed));
14754
14933
  return {
14755
14934
  bar,
14756
14935
  wrapper,
@@ -23796,7 +23975,7 @@
23796
23975
  color: {
23797
23976
  type: [Object, String],
23798
23977
  default: () => ({
23799
- normal: "#2B72FD",
23978
+ normal: "#456CF6",
23800
23979
  success: "#52c41a",
23801
23980
  error: "#f5222d"
23802
23981
  })
@@ -28858,6 +29037,7 @@
28858
29037
  emit("update:modelValue", currentValue.value);
28859
29038
  emit("change", currentValue.value);
28860
29039
  emit("click", currentValue.value);
29040
+ nav.anchor && document.querySelector(nav.anchor)?.scrollIntoView?.({ behavior: "smooth" });
28861
29041
  };
28862
29042
  const handleResize = () => {
28863
29043
  if (instance.isUnmounted) return;
@@ -29110,12 +29290,16 @@
29110
29290
 
29111
29291
  const props$b = {
29112
29292
  value: {
29113
- type: [String, Number, Boolean]
29293
+ type: [String, Number, Boolean],
29294
+ default: void 0
29114
29295
  },
29115
29296
  label: {
29116
29297
  type: [String, Function],
29117
29298
  default: ""
29118
29299
  },
29300
+ anchor: {
29301
+ type: String
29302
+ },
29119
29303
  /**
29120
29304
  * 服务端渲染时,lazy设置为false,可以把内容渲染出来;
29121
29305
  * 不能设置为!IS_SERVER, 会影响客服端激活,不一样会存在问题
@@ -29458,7 +29642,7 @@
29458
29642
  "class": [{
29459
29643
  'is-fixed': isFixed
29460
29644
  }, 'vcm-tabs__bar']
29461
- }, [vue.createVNode("slot", {
29645
+ }, [vue.createVNode(vue.resolveComponent("slot"), {
29462
29646
  "name": "prepend"
29463
29647
  }, null), slots.prepend?.(), props.showStep && tabs.scrollable.value && vue.createVNode("div", {
29464
29648
  "class": "vcm-tabs__step is-left",
@@ -29572,6 +29756,10 @@
29572
29756
  default: (props$) => {
29573
29757
  return props$.value;
29574
29758
  }
29759
+ },
29760
+ theme: {
29761
+ type: String,
29762
+ default: "dark"
29575
29763
  }
29576
29764
  };
29577
29765
 
@@ -29624,7 +29812,7 @@
29624
29812
  // 确保不重复创建
29625
29813
  triggerEl: e.target,
29626
29814
  hover: true,
29627
- theme: 'dark',
29815
+ theme: props.theme,
29628
29816
  placement: props.placement,
29629
29817
  portalClass: props.portalClass,
29630
29818
  portalStyle: [props.portalStyle || `width: ${e.target.clientWidth}px`, 'word-break: break-all'],
@@ -35708,10 +35896,10 @@
35708
35896
  var _v1 = create$2();
35709
35897
  var _v2 = create$2();
35710
35898
  function isAroundZero$1(val) {
35711
- return val > -1e-8 && val < EPSILON$4;
35899
+ return val > -EPSILON$4 && val < EPSILON$4;
35712
35900
  }
35713
35901
  function isNotAroundZero$1(val) {
35714
- return val > EPSILON$4 || val < -1e-8;
35902
+ return val > EPSILON$4 || val < -EPSILON$4;
35715
35903
  }
35716
35904
  function cubicAt(p0, p1, p2, p3, t) {
35717
35905
  var onet = 1 - t;
@@ -36698,7 +36886,7 @@
36698
36886
  }
36699
36887
  var EPSILON$3 = 1e-4;
36700
36888
  function isAroundZero(transform) {
36701
- return transform < EPSILON$3 && transform > -1e-4;
36889
+ return transform < EPSILON$3 && transform > -EPSILON$3;
36702
36890
  }
36703
36891
  function round3(transform) {
36704
36892
  return mathRound$1(transform * 1e3) / 1e3;
@@ -37979,7 +38167,7 @@
37979
38167
  var mIdentity = identity;
37980
38168
  var EPSILON$2 = 5e-5;
37981
38169
  function isNotAroundZero(val) {
37982
- return val > EPSILON$2 || val < -5e-5;
38170
+ return val > EPSILON$2 || val < -EPSILON$2;
37983
38171
  }
37984
38172
  var scaleTmp = [];
37985
38173
  var tmpTransform = [];
@@ -38697,7 +38885,7 @@
38697
38885
  this.markRedraw();
38698
38886
  if (!useHoverLayer && this.__inHover) {
38699
38887
  this._toggleHoverLayerFlag(false);
38700
- this.__dirty &= -2;
38888
+ this.__dirty &= ~REDRAW_BIT;
38701
38889
  }
38702
38890
  return state;
38703
38891
  };
@@ -38755,7 +38943,7 @@
38755
38943
  this.markRedraw();
38756
38944
  if (!useHoverLayer && this.__inHover) {
38757
38945
  this._toggleHoverLayerFlag(false);
38758
- this.__dirty &= -2;
38946
+ this.__dirty &= ~REDRAW_BIT;
38759
38947
  }
38760
38948
  }
38761
38949
  };
@@ -40078,7 +40266,7 @@
40078
40266
  * @return {boolean}
40079
40267
  */
40080
40268
  function isRadianAroundZero(val) {
40081
- return val > -1e-4 && val < RADIAN_EPSILON;
40269
+ return val > -RADIAN_EPSILON && val < RADIAN_EPSILON;
40082
40270
  }
40083
40271
  // eslint-disable-next-line
40084
40272
  var TIME_REG = /^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/; // jshint ignore:line
@@ -41672,7 +41860,7 @@
41672
41860
  return !!(this.__dirty & STYLE_CHANGED_BIT);
41673
41861
  };
41674
41862
  Displayable.prototype.styleUpdated = function () {
41675
- this.__dirty &= -3;
41863
+ this.__dirty &= ~STYLE_CHANGED_BIT;
41676
41864
  };
41677
41865
  Displayable.prototype.createStyle = function (obj) {
41678
41866
  return createObject(DEFAULT_COMMON_STYLE, obj);
@@ -43181,7 +43369,7 @@
43181
43369
  };
43182
43370
  Path.prototype.buildPath = function (ctx, shapeCfg, inBatch) { };
43183
43371
  Path.prototype.pathUpdated = function () {
43184
- this.__dirty &= -5;
43372
+ this.__dirty &= ~SHAPE_CHANGED_BIT;
43185
43373
  };
43186
43374
  Path.prototype.getUpdatedPathProxy = function (inBatch) {
43187
43375
  !this.path && this.createPathProxy();
@@ -55767,7 +55955,7 @@
55767
55955
  function brush$1(ctx, el, scope, isLast) {
55768
55956
  var m = el.transform;
55769
55957
  if (!el.shouldBePainted(scope.viewWidth, scope.viewHeight, false, false)) {
55770
- el.__dirty &= -2;
55958
+ el.__dirty &= ~REDRAW_BIT;
55771
55959
  el.__isRendered = false;
55772
55960
  return;
55773
55961
  }
@@ -114036,7 +114224,7 @@
114036
114224
  // and velocity is close to 0
114037
114225
  //
114038
114226
 
114039
- if (velocity.x < -0.5 && currentSlideVisibilityRatio < 0 || velocity.x < 0.1 && currentSlideVisibilityRatio < -0.5) {
114227
+ if (velocity.x < -MIN_NEXT_SLIDE_SPEED && currentSlideVisibilityRatio < 0 || velocity.x < 0.1 && currentSlideVisibilityRatio < -0.5) {
114040
114228
  // Go to next slide
114041
114229
  indexDiff = 1;
114042
114230
  velocity.x = Math.min(velocity.x, 0);
@@ -114100,7 +114288,7 @@
114100
114288
  // or if we are below and moving downwards
114101
114289
 
114102
114290
 
114103
- if (vDragRatio < 0 && projectedVDragRatio < -0.4 || vDragRatio > 0 && projectedVDragRatio > MIN_RATIO_TO_CLOSE) {
114291
+ if (vDragRatio < 0 && projectedVDragRatio < -MIN_RATIO_TO_CLOSE || vDragRatio > 0 && projectedVDragRatio > MIN_RATIO_TO_CLOSE) {
114104
114292
  this.pswp.close();
114105
114293
  return;
114106
114294
  }
@@ -132818,6 +133006,7 @@
132818
133006
  }, Symbol.toStringTag, { value: 'Module' }));
132819
133007
 
132820
133008
  exports.ActionSheet = ActionSheet;
133009
+ exports.Affix = Affix;
132821
133010
  exports.Alert = Alert;
132822
133011
  exports.Artboard = Artboard;
132823
133012
  exports.Button = Button;
@@ -132862,6 +133051,7 @@
132862
133051
  exports.List = MList;
132863
133052
  exports.ListItem = MListItem;
132864
133053
  exports.MActionSheet = MActionSheet;
133054
+ exports.MAffix = MAffix;
132865
133055
  exports.MAlert = MAlert;
132866
133056
  exports.MArtboard = MArtboard;
132867
133057
  exports.MButton = MButton;