@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.
@@ -63,7 +63,7 @@ var VcComponents = (function (exports, vue) {
63
63
  }
64
64
  const VcInstance = new Instance();
65
65
 
66
- const props$1s = {
66
+ const props$1t = {
67
67
  tag: {
68
68
  type: String,
69
69
  default: "div"
@@ -72,10 +72,10 @@ var VcComponents = (function (exports, vue) {
72
72
 
73
73
  /** @jsxImportSource vue */
74
74
 
75
- const COMPONENT_NAME$27 = 'vc-action-sheet';
75
+ const COMPONENT_NAME$28 = 'vc-action-sheet';
76
76
  const ActionSheet = /* @__PURE__ */ vue.defineComponent({
77
- name: COMPONENT_NAME$27,
78
- props: props$1s,
77
+ name: COMPONENT_NAME$28,
78
+ props: props$1t,
79
79
  setup(props, {
80
80
  slots
81
81
  }) {
@@ -89,6 +89,400 @@ var VcComponents = (function (exports, vue) {
89
89
 
90
90
  const MActionSheet = ActionSheet;
91
91
 
92
+ const IS_SERVER$3 = typeof window === "undefined";
93
+
94
+ const hasClass = (el, cls) => {
95
+ if (IS_SERVER$3 || !cls) return false;
96
+ if (cls.includes(" ")) {
97
+ throw new Error("[@deot/helper-dom]: 类名不应该包含空格");
98
+ }
99
+ if (el.classList) {
100
+ return el.classList.contains(cls);
101
+ } else {
102
+ return (" " + el.className + " ").indexOf(" " + cls + " ") > -1;
103
+ }
104
+ };
105
+
106
+ const addClass = (el, cls) => {
107
+ if (IS_SERVER$3 || !cls) return;
108
+ let curClass = el.className;
109
+ const classes = cls.split(" ");
110
+ for (let i = 0, j = classes.length; i < j; i++) {
111
+ const clsName = classes[i];
112
+ if (clsName) {
113
+ if (el.classList) {
114
+ el.classList.add(clsName);
115
+ } else if (!hasClass(el, clsName)) {
116
+ curClass += " " + clsName;
117
+ }
118
+ }
119
+ }
120
+ if (!el.classList) {
121
+ el.className = curClass;
122
+ }
123
+ };
124
+
125
+ const composedPath = (e) => {
126
+ const path = e.composedPath && e.composedPath() || [];
127
+ if (path.length) return path;
128
+ let parent = e.target?.parentNode;
129
+ /* istanbul ignore next -- @preserve */
130
+ while (parent) {
131
+ path.push(parent);
132
+ parent = parent.parentNode;
133
+ }
134
+ return path;
135
+ };
136
+
137
+ const contains$1 = (el, child) => {
138
+ if (IS_SERVER$3 || !child) return false;
139
+ const childRect = child.getBoundingClientRect();
140
+ let elRect;
141
+ if (!el || [window, document, document.documentElement].includes(el)) {
142
+ elRect = {
143
+ top: 0,
144
+ right: window.innerWidth,
145
+ bottom: window.innerHeight,
146
+ left: 0
147
+ };
148
+ } else {
149
+ elRect = el.getBoundingClientRect();
150
+ }
151
+ return childRect.top < elRect.bottom && childRect.bottom > elRect.top && childRect.right > elRect.left && childRect.left < elRect.right;
152
+ };
153
+
154
+ const el$1 = (v) => {
155
+ if (IS_SERVER$3) return null;
156
+ let target;
157
+ if (typeof v === "object") {
158
+ target = v;
159
+ } else {
160
+ target = document.querySelector(v);
161
+ }
162
+ if (!target) {
163
+ throw new Error("[@deot/helper-dom]: el缺失");
164
+ }
165
+ return target;
166
+ };
167
+
168
+ const getStyle$1 = (el, name) => {
169
+ if (IS_SERVER$3 || !name) return "";
170
+ if (name === "float") {
171
+ name = "cssFloat";
172
+ }
173
+ try {
174
+ const computed = document.defaultView.getComputedStyle(el, "");
175
+ return el.style[name] || (computed?.[name] || "");
176
+ } catch (e) {
177
+ return el.style[name] || "";
178
+ }
179
+ };
180
+
181
+ const isScroller = (el, options) => {
182
+ if (IS_SERVER$3 || !el) return false;
183
+ const { className, direction } = options || {};
184
+ let overflow = getStyle$1(el, `overflow-${direction ? "y" : "x"}`);
185
+ overflow = overflow || getStyle$1(el, "overflow");
186
+ return !!(overflow.match(/(scroll|auto)/) || className?.test(el.className));
187
+ };
188
+
189
+ const getScroller = (el, options) => {
190
+ if (IS_SERVER$3 || !el) return null;
191
+ let parent = el;
192
+ while (parent) {
193
+ if ([window, document, document.documentElement].includes(parent)) {
194
+ return window;
195
+ }
196
+ if (isScroller(parent, options)) {
197
+ return parent;
198
+ }
199
+ parent = parent?.parentNode;
200
+ }
201
+ return parent;
202
+ };
203
+
204
+ const off = (el, event, handler, options) => {
205
+ if (IS_SERVER$3) return;
206
+ el.removeEventListener(event, handler, false);
207
+ };
208
+
209
+ const on = (el, event, handler, options) => {
210
+ if (IS_SERVER$3) return () => {
211
+ };
212
+ el.addEventListener(event, handler, false);
213
+ return () => {
214
+ el.removeEventListener(event, handler, false);
215
+ };
216
+ };
217
+
218
+ const $target = IS_SERVER$3 ? {} : document.createElement("div").style;
219
+ const prefix$1 = (() => {
220
+ const keys = {
221
+ webkit: "webkitTransform",
222
+ Moz: "MozTransform",
223
+ O: "OTransform",
224
+ ms: "msTransform",
225
+ standard: "transform"
226
+ };
227
+ const values = {
228
+ webkit: "-webkit-",
229
+ Moz: "-moz-",
230
+ O: "-o-",
231
+ ms: "-ms-",
232
+ standard: ""
233
+ };
234
+ for (const key in keys) {
235
+ if ($target[keys[key]] !== void 0) {
236
+ return {
237
+ camel: key,
238
+ kebab: values[key]
239
+ };
240
+ }
241
+ }
242
+ return false;
243
+ })();
244
+ const prefixStyle = (v) => {
245
+ if (IS_SERVER$3 || prefix$1 === false) {
246
+ return {
247
+ camel: v,
248
+ kebab: v
249
+ };
250
+ }
251
+ return {
252
+ camel: prefix$1.camel + v.charAt(0).toUpperCase() + v.substr(1),
253
+ kebab: prefix$1.kebab + v
254
+ };
255
+ };
256
+
257
+ const removeClass = (el, cls) => {
258
+ if (IS_SERVER$3 || !cls) return;
259
+ const classes = cls.split(" ");
260
+ let curClass = " " + el.className + " ";
261
+ for (let i = 0, j = classes.length; i < j; i++) {
262
+ const clsName = classes[i];
263
+ if (clsName) {
264
+ if (el.classList) {
265
+ el.classList.remove(clsName);
266
+ continue;
267
+ }
268
+ /* istanbul ignore next -- @preserve */
269
+ if (hasClass(el, clsName)) {
270
+ curClass = curClass.replace(" " + clsName + " ", " ");
271
+ }
272
+ }
273
+ }
274
+ if (!el.classList) {
275
+ el.className = curClass.trim();
276
+ }
277
+ };
278
+
279
+ const scrollIntoView = async (el, options) => {
280
+ if (IS_SERVER$3) return;
281
+ const { from = 0, to = 0, duration = 300 } = options || {};
282
+ const difference = Math.abs(from - to);
283
+ const step = Math.ceil(difference / duration * 50);
284
+ let onResolve;
285
+ const target = new Promise((resolve) => {
286
+ onResolve = resolve;
287
+ });
288
+ const scroll = (start, end) => {
289
+ if (start === end) {
290
+ onResolve();
291
+ return;
292
+ }
293
+ let d = start + step > end ? end : start + step;
294
+ if (start > end) {
295
+ d = start - step < end ? end : start - step;
296
+ }
297
+ if (el === window) {
298
+ window.scrollTo(d, d);
299
+ } else {
300
+ el.scrollTop = d;
301
+ }
302
+ window.requestAnimationFrame(() => scroll(d, end));
303
+ };
304
+ scroll(from, to);
305
+ return target;
306
+ };
307
+
308
+ const props$1s = {
309
+ zIndex: {
310
+ type: [Number, String],
311
+ default: 1
312
+ },
313
+ // TODO: left/right
314
+ placement: {
315
+ type: String,
316
+ default: "top"
317
+ },
318
+ disabled: {
319
+ type: Boolean,
320
+ default: false
321
+ },
322
+ fixed: {
323
+ type: Boolean,
324
+ default: true
325
+ },
326
+ offset: {
327
+ type: Number,
328
+ default: 0
329
+ },
330
+ // -> 固钉始终保持在容器内, 超过范围则隐藏(请注意容器避免出现滚动条) 仅fixed为true有效
331
+ target: {
332
+ type: String
333
+ }
334
+ };
335
+
336
+ /** @jsxImportSource vue */
337
+
338
+ const COMPONENT_NAME$27 = 'vc-affix';
339
+ const SCROLLER_WHEEL_REG = /vc-scroller-wheel/;
340
+ const Affix = /* @__PURE__ */ vue.defineComponent({
341
+ name: COMPONENT_NAME$27,
342
+ props: props$1s,
343
+ setup(props, {
344
+ slots,
345
+ expose
346
+ }) {
347
+ const scrollerInstance = vue.inject('vc-scroller', null);
348
+ const scroller = vue.shallowRef(); // 当前元素所在的滚动容器
349
+ const base = vue.shallowRef(); // 当前元素(props.tagret)的参考容器
350
+ const current = vue.shallowRef(); // 当前元素
351
+
352
+ const currentRect = vue.reactive({
353
+ top: 0,
354
+ bottom: 0,
355
+ width: 0,
356
+ height: 0
357
+ });
358
+ const isActive = vue.ref(false);
359
+ const transformY = vue.ref(0);
360
+ const windowHeight = vue.ref(window.innerHeight);
361
+ const isVcScrollerWheel = vue.computed(() => {
362
+ return SCROLLER_WHEEL_REG.test(scroller.value?.className || '');
363
+ });
364
+ const currentStyle = vue.computed(() => {
365
+ if (!isActive.value) return {};
366
+ return {
367
+ height: `${currentRect.height}px`,
368
+ width: `${currentRect.width}px`
369
+ };
370
+ });
371
+ const contentStyle = vue.computed(() => {
372
+ if (!isActive.value) return {};
373
+ const offset = `${props.offset}px`;
374
+ return {
375
+ height: `${currentRect.height}px`,
376
+ width: `${currentRect.width}px`,
377
+ top: props.placement === 'top' ? offset : '',
378
+ bottom: props.placement === 'bottom' ? offset : '',
379
+ zIndex: props.zIndex,
380
+ transform: transformY.value ? `translateY(${transformY.value}px)` : ''
381
+ };
382
+ });
383
+ const setCurrentRect = () => {
384
+ const rect = current.value.getBoundingClientRect();
385
+ Object.assign(currentRect, {
386
+ top: rect.top,
387
+ bottom: rect.bottom,
388
+ width: rect.width,
389
+ height: rect.height
390
+ });
391
+ };
392
+ const setAbsoluteStatus = () => {
393
+ const {
394
+ placement,
395
+ offset
396
+ } = props;
397
+ const currentHeightOffset = offset + currentRect.height;
398
+ const containerRect = scroller.value.getBoundingClientRect();
399
+ let transformOffsetY = 0;
400
+
401
+ // scroller-wheel滚动条偏移
402
+ if (scrollerInstance && isVcScrollerWheel.value) {
403
+ const maxMoveY = scrollerInstance.scrollHeight - scrollerInstance.clientHeight;
404
+ transformOffsetY = scrollerInstance.scrollTop >= maxMoveY ? maxMoveY : scrollerInstance.scrollTop;
405
+ }
406
+ if (placement === 'top') {
407
+ isActive.value = currentRect.top - containerRect.top <= props.offset;
408
+ transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0) + transformOffsetY;
409
+ } else {
410
+ isActive.value = currentRect.bottom - containerRect.top >= containerRect.height - props.offset;
411
+ transformY.value = Math.max(containerRect.height - containerRect.top - currentHeightOffset, 0) + transformOffsetY;
412
+ }
413
+ };
414
+ const setFixedStatus = () => {
415
+ const {
416
+ placement,
417
+ target,
418
+ offset
419
+ } = props;
420
+ const currentHeightOffset = offset + currentRect.height;
421
+ const containerRect = target && base.value.getBoundingClientRect();
422
+ if (placement === 'top') {
423
+ if (target) {
424
+ isActive.value = offset > currentRect.top && containerRect.bottom > 0;
425
+ transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0);
426
+ } else {
427
+ isActive.value = offset > currentRect.top;
428
+ }
429
+ } else {
430
+ if (target) {
431
+ isActive.value = windowHeight.value - offset < currentRect.bottom && windowHeight.value > containerRect.top;
432
+ transformY.value = -Math.min(windowHeight.value - containerRect.top - currentHeightOffset, 0);
433
+ } else {
434
+ isActive.value = windowHeight.value - offset < currentRect.bottom;
435
+ }
436
+ }
437
+ };
438
+ const refresh = () => {
439
+ setCurrentRect();
440
+ scroller.value instanceof Window || props.fixed ? setFixedStatus() : setAbsoluteStatus();
441
+ };
442
+ vue.onMounted(() => {
443
+ if (typeof props.target === 'string') {
444
+ base.value = document.querySelector(props.target) ?? void 0;
445
+ }
446
+ !base.value && (base.value = document.documentElement);
447
+ scroller.value = getScroller(current.value, {
448
+ className: SCROLLER_WHEEL_REG
449
+ });
450
+ if (isVcScrollerWheel.value) {
451
+ scrollerInstance?.on(refresh);
452
+ } else {
453
+ scroller.value?.addEventListener('scroll', refresh);
454
+ }
455
+ refresh();
456
+ });
457
+ vue.onBeforeUnmount(() => {
458
+ if (isVcScrollerWheel.value) {
459
+ scrollerInstance?.off(refresh);
460
+ } else {
461
+ scroller.value?.removeEventListener('scroll', refresh);
462
+ }
463
+ });
464
+ expose({
465
+ refresh
466
+ });
467
+ return () => {
468
+ return vue.createVNode("div", {
469
+ "ref": current,
470
+ "class": "vc-affix",
471
+ "style": currentStyle.value
472
+ }, [vue.createVNode("div", {
473
+ "class": {
474
+ [`vc-affix__${props.fixed ? 'fixed' : 'absolute'}`]: isActive.value
475
+ },
476
+ "style": contentStyle.value
477
+ }, [slots?.default?.({
478
+ active: isActive.value
479
+ })])]);
480
+ };
481
+ }
482
+ });
483
+
484
+ const MAffix = Affix;
485
+
92
486
  const props$1r = {
93
487
  modelValue: {
94
488
  type: Boolean,
@@ -131,9 +525,9 @@ var VcComponents = (function (exports, vue) {
131
525
  const dReg = /.*d="([^"]+).*/g;
132
526
  const fillReg = /.*fill="([^"]+).*/g;
133
527
  const basicUrl = "//at.alicdn.com/t/font_1119857_u0f4525o6sd.js";
134
- const prefix$1 = "@deot/vc-icon:";
528
+ const prefix = "@deot/vc-icon:";
135
529
  const IS_DEV = false;
136
- const IS_SERVER$3 = typeof document === "undefined";
530
+ const IS_SERVER$2 = typeof document === "undefined";
137
531
  class Manager {
138
532
  icons = {};
139
533
  events = {};
@@ -148,10 +542,10 @@ var VcComponents = (function (exports, vue) {
148
542
  this.sourceStatus[url] = this.sourceStatus[url] || new Promise((resolve, reject) => {
149
543
  (async () => {
150
544
  try {
151
- if (IS_SERVER$3 || !/.js$/.test(url)) {
545
+ if (IS_SERVER$2 || !/.js$/.test(url)) {
152
546
  return reject(new VcError("icon", "invaild url"));
153
547
  }
154
- const key = `${prefix$1}${url}`;
548
+ const key = `${prefix}${url}`;
155
549
  const cache = window.localStorage.getItem(key);
156
550
  let icons = JSON.parse(cache || '""');
157
551
  /* istanbul ignore next -- @preserve */
@@ -233,7 +627,7 @@ var VcComponents = (function (exports, vue) {
233
627
  if (this.events[type].length >= 100) {
234
628
  delete this.events[type];
235
629
  /* istanbul ignore else -- @preserve */
236
- if (!IS_SERVER$3) {
630
+ if (!IS_SERVER$2) {
237
631
  throw new VcError("icon", `${type} nonexistent`);
238
632
  }
239
633
  }
@@ -250,8 +644,8 @@ var VcComponents = (function (exports, vue) {
250
644
  clearResource() {
251
645
  const needs = Object.keys(this.sourceStatus);
252
646
  Object.keys(window.localStorage).forEach((item) => {
253
- if (item.includes(prefix$1)) {
254
- const key = item.split(prefix$1).pop();
647
+ if (item.includes(prefix)) {
648
+ const key = item.split(prefix).pop();
255
649
  key && !needs.includes(key) && window.localStorage.removeItem(item);
256
650
  }
257
651
  });
@@ -775,7 +1169,7 @@ var VcComponents = (function (exports, vue) {
775
1169
 
776
1170
  // [color, borderColor, backgroundColor], -> CSS
777
1171
  const THEME_MAP = {
778
- info: ['#2B72FD', '#91d5ff', '#e6f7ff'],
1172
+ info: ['#456CF6', '#91d5ff', '#e6f7ff'],
779
1173
  success: ['#52c41a', '#b7eb8f', '#f6ffed'],
780
1174
  error: ['#ed4014', '#ffb08f', '#fbe9e9'],
781
1175
  warning: ['#ffbf00', '#ffe58f', '#fffbe6']
@@ -966,7 +1360,7 @@ var VcComponents = (function (exports, vue) {
966
1360
  );
967
1361
  };
968
1362
 
969
- const flatten$1 = (value, parser) => {
1363
+ const flatten$1 = (value, parser, exit) => {
970
1364
  let need = true;
971
1365
  let safeCount = 1;
972
1366
  let parseValue = value;
@@ -976,7 +1370,7 @@ var VcComponents = (function (exports, vue) {
976
1370
  }
977
1371
  try {
978
1372
  const next = (parser || decodeURIComponent)(parseValue);
979
- if (parseValue === next) {
1373
+ if (parseValue === next || typeof exit === "function" && exit(next)) {
980
1374
  need = false;
981
1375
  }
982
1376
  parseValue = next;
@@ -989,8 +1383,7 @@ var VcComponents = (function (exports, vue) {
989
1383
  };
990
1384
 
991
1385
  const flattenJSONParse = (value) => {
992
- if (value === null)
993
- return null;
1386
+ if (value === null) return null;
994
1387
  const regex = /^\d+$/;
995
1388
  if (regex.test(value) && value.length >= 16 && +value > Number.MAX_SAFE_INTEGER) {
996
1389
  return value;
@@ -3618,7 +4011,7 @@ var VcComponents = (function (exports, vue) {
3618
4011
  function castSlice(array, start, end) {
3619
4012
  var length = array.length;
3620
4013
  end = end === undefined ? length : end;
3621
- return (false && end >= length) ? array : baseSlice(array, start, end);
4014
+ return (!start && end >= length) ? array : baseSlice(array, start, end);
3622
4015
  }
3623
4016
 
3624
4017
  /** Used to compose unicode character classes. */
@@ -6692,233 +7085,6 @@ var VcComponents = (function (exports, vue) {
6692
7085
  return parent;
6693
7086
  };
6694
7087
 
6695
- const IS_SERVER$2 = typeof window === "undefined";
6696
-
6697
- const hasClass = (el, cls) => {
6698
- if (IS_SERVER$2 || !cls)
6699
- return false;
6700
- if (cls.includes(" ")) {
6701
- throw new Error("[@deot/helper-dom]: 类名不应该包含空格");
6702
- }
6703
- if (el.classList) {
6704
- return el.classList.contains(cls);
6705
- } else {
6706
- return (" " + el.className + " ").indexOf(" " + cls + " ") > -1;
6707
- }
6708
- };
6709
-
6710
- const addClass = (el, cls) => {
6711
- if (IS_SERVER$2 || !cls)
6712
- return;
6713
- let curClass = el.className;
6714
- let classes = cls.split(" ");
6715
- for (let i = 0, j = classes.length; i < j; i++) {
6716
- let clsName = classes[i];
6717
- if (clsName) {
6718
- if (el.classList) {
6719
- el.classList.add(clsName);
6720
- } else if (!hasClass(el, clsName)) {
6721
- curClass += " " + clsName;
6722
- }
6723
- }
6724
- }
6725
- if (!el.classList) {
6726
- el.className = curClass;
6727
- }
6728
- };
6729
-
6730
- const composedPath = (e) => {
6731
- let path = e.composedPath && e.composedPath() || [];
6732
- if (path.length)
6733
- return path;
6734
- let parent = e.target?.parentNode;
6735
- /* istanbul ignore next -- @preserve */
6736
- while (parent) {
6737
- path.push(parent);
6738
- parent = parent.parentNode;
6739
- }
6740
- return path;
6741
- };
6742
-
6743
- const contains$1 = (el, child) => {
6744
- if (IS_SERVER$2 || !child)
6745
- return false;
6746
- let childRect = child.getBoundingClientRect();
6747
- let elRect;
6748
- if (!el || [window, document, document.documentElement].includes(el)) {
6749
- elRect = {
6750
- top: 0,
6751
- right: window.innerWidth,
6752
- bottom: window.innerHeight,
6753
- left: 0
6754
- };
6755
- } else {
6756
- elRect = el.getBoundingClientRect();
6757
- }
6758
- return childRect.top < elRect.bottom && childRect.bottom > elRect.top && childRect.right > elRect.left && childRect.left < elRect.right;
6759
- };
6760
-
6761
- const el$1 = (v) => {
6762
- if (IS_SERVER$2)
6763
- return null;
6764
- let target;
6765
- if (typeof v === "object") {
6766
- target = v;
6767
- } else {
6768
- target = document.querySelector(v);
6769
- }
6770
- if (!target) {
6771
- throw new Error("[@deot/helper-dom]: el缺失");
6772
- }
6773
- return target;
6774
- };
6775
-
6776
- const getStyle$1 = (el, name) => {
6777
- if (IS_SERVER$2 || !name)
6778
- return "";
6779
- if (name === "float") {
6780
- name = "cssFloat";
6781
- }
6782
- try {
6783
- let computed = document.defaultView.getComputedStyle(el, "");
6784
- return el.style[name] || (computed?.[name] || "");
6785
- } catch (e) {
6786
- return el.style[name] || "";
6787
- }
6788
- };
6789
-
6790
- const isScroll = (el, direction) => {
6791
- if (IS_SERVER$2 || !el)
6792
- return false;
6793
- let overflow = getStyle$1(el, `overflow-${"x"}`);
6794
- overflow = overflow || getStyle$1(el, "overflow");
6795
- return !!overflow.match(/(scroll|auto)/);
6796
- };
6797
-
6798
- const getScroller = (el, direction) => {
6799
- if (IS_SERVER$2 || !el)
6800
- return null;
6801
- let parent = el;
6802
- while (parent) {
6803
- if ([window, document, document.documentElement].includes(parent)) {
6804
- return window;
6805
- }
6806
- if (isScroll(parent)) {
6807
- return parent;
6808
- }
6809
- parent = parent?.parentNode;
6810
- }
6811
- return parent;
6812
- };
6813
-
6814
- const off = (el, event, handler, options) => {
6815
- if (IS_SERVER$2)
6816
- return;
6817
- el.removeEventListener(event, handler, false);
6818
- };
6819
-
6820
- const on = (el, event, handler, options) => {
6821
- if (IS_SERVER$2)
6822
- return () => {
6823
- };
6824
- el.addEventListener(event, handler, false);
6825
- return () => {
6826
- el.removeEventListener(event, handler, false);
6827
- };
6828
- };
6829
-
6830
- const $target = IS_SERVER$2 ? {} : document.createElement("div").style;
6831
- const prefix = (() => {
6832
- let keys = {
6833
- webkit: "webkitTransform",
6834
- Moz: "MozTransform",
6835
- O: "OTransform",
6836
- ms: "msTransform",
6837
- standard: "transform"
6838
- };
6839
- let values = {
6840
- webkit: "-webkit-",
6841
- Moz: "-moz-",
6842
- O: "-o-",
6843
- ms: "-ms-",
6844
- standard: ""
6845
- };
6846
- for (let key in keys) {
6847
- if ($target[keys[key]] !== void 0) {
6848
- return {
6849
- camel: key,
6850
- kebab: values[key]
6851
- };
6852
- }
6853
- }
6854
- return false;
6855
- })();
6856
- const prefixStyle = (v) => {
6857
- if (IS_SERVER$2 || prefix === false) {
6858
- return {
6859
- camel: v,
6860
- kebab: v
6861
- };
6862
- }
6863
- return {
6864
- camel: prefix.camel + v.charAt(0).toUpperCase() + v.substr(1),
6865
- kebab: prefix.kebab + v
6866
- };
6867
- };
6868
-
6869
- const removeClass = (el, cls) => {
6870
- if (IS_SERVER$2 || !cls)
6871
- return;
6872
- let classes = cls.split(" ");
6873
- let curClass = " " + el.className + " ";
6874
- for (let i = 0, j = classes.length; i < j; i++) {
6875
- let clsName = classes[i];
6876
- if (clsName) {
6877
- if (el.classList) {
6878
- el.classList.remove(clsName);
6879
- continue;
6880
- }
6881
- /* istanbul ignore next -- @preserve */
6882
- if (hasClass(el, clsName)) {
6883
- curClass = curClass.replace(" " + clsName + " ", " ");
6884
- }
6885
- }
6886
- }
6887
- if (!el.classList) {
6888
- el.className = curClass.trim();
6889
- }
6890
- };
6891
-
6892
- const scrollIntoView = async (el, options) => {
6893
- if (IS_SERVER$2)
6894
- return;
6895
- let { from = 0, to = 0, duration = 300 } = options || {};
6896
- let difference = Math.abs(from - to);
6897
- let step = Math.ceil(difference / duration * 50);
6898
- let onResolve;
6899
- let target = new Promise((resolve) => {
6900
- onResolve = resolve;
6901
- });
6902
- const scroll = (start, end) => {
6903
- if (start === end) {
6904
- onResolve();
6905
- return;
6906
- }
6907
- let d = start + step > end ? end : start + step;
6908
- if (start > end) {
6909
- d = start - step < end ? end : start - step;
6910
- }
6911
- if (el === window) {
6912
- window.scrollTo(d, d);
6913
- } else {
6914
- el.scrollTop = d;
6915
- }
6916
- window.requestAnimationFrame(() => scroll(d, end));
6917
- };
6918
- scroll(from, to);
6919
- return target;
6920
- };
6921
-
6922
7088
  const getSelectedData = (value = [], source = []) => {
6923
7089
  const label = [];
6924
7090
  const data = [];
@@ -14690,6 +14856,7 @@ var VcComponents = (function (exports, vue) {
14690
14856
  refreshSize();
14691
14857
  refreshPosition(options);
14692
14858
  };
14859
+ const listeners = [];
14693
14860
  const triggerScrollDelegate = (options) => {
14694
14861
  const delegates = {
14695
14862
  scrollLeft: (options && options.x) ?? scrollX.value,
@@ -14697,12 +14864,15 @@ var VcComponents = (function (exports, vue) {
14697
14864
  clientWidth: wrapperW.value,
14698
14865
  clientHeight: wrapperH.value,
14699
14866
  scrollWidth: contentW.value,
14700
- scrollHeight: contentH.value
14867
+ scrollHeight: contentH.value,
14868
+ getBoundingClientRect: () => wrapper.value?.getBoundingClientRect()
14701
14869
  };
14702
- instance.emit("scroll", {
14870
+ const e = {
14703
14871
  target: delegates,
14704
14872
  currentTarget: delegates
14705
- });
14873
+ };
14874
+ instance.emit("scroll", e);
14875
+ listeners.forEach((listener) => listener(e));
14706
14876
  };
14707
14877
  const scrollTo = (options) => {
14708
14878
  refreshPosition(options);
@@ -14729,8 +14899,9 @@ var VcComponents = (function (exports, vue) {
14729
14899
  Resize.off(wrapper.value, refresh);
14730
14900
  Resize.off(content.value, refresh);
14731
14901
  }
14902
+ listeners.splice(0, listeners.length);
14732
14903
  });
14733
- expose({
14904
+ const exposed = {
14734
14905
  wrapper,
14735
14906
  content,
14736
14907
  scrollTo,
@@ -14746,8 +14917,16 @@ var VcComponents = (function (exports, vue) {
14746
14917
  },
14747
14918
  setScrollLeft: (value) => {
14748
14919
  scrollTo({ x: value });
14920
+ },
14921
+ on: (listener) => {
14922
+ listeners.push(listener);
14923
+ },
14924
+ off: (listener) => {
14925
+ listeners.splice(listeners.indexOf(listener), 1);
14749
14926
  }
14750
- });
14927
+ };
14928
+ expose(exposed);
14929
+ vue.provide("vc-scroller", vue.reactive(exposed));
14751
14930
  return {
14752
14931
  bar,
14753
14932
  wrapper,
@@ -23793,7 +23972,7 @@ var VcComponents = (function (exports, vue) {
23793
23972
  color: {
23794
23973
  type: [Object, String],
23795
23974
  default: () => ({
23796
- normal: "#2B72FD",
23975
+ normal: "#456CF6",
23797
23976
  success: "#52c41a",
23798
23977
  error: "#f5222d"
23799
23978
  })
@@ -28855,6 +29034,7 @@ var VcComponents = (function (exports, vue) {
28855
29034
  emit("update:modelValue", currentValue.value);
28856
29035
  emit("change", currentValue.value);
28857
29036
  emit("click", currentValue.value);
29037
+ nav.anchor && document.querySelector(nav.anchor)?.scrollIntoView?.({ behavior: "smooth" });
28858
29038
  };
28859
29039
  const handleResize = () => {
28860
29040
  if (instance.isUnmounted) return;
@@ -29107,12 +29287,16 @@ var VcComponents = (function (exports, vue) {
29107
29287
 
29108
29288
  const props$b = {
29109
29289
  value: {
29110
- type: [String, Number, Boolean]
29290
+ type: [String, Number, Boolean],
29291
+ default: void 0
29111
29292
  },
29112
29293
  label: {
29113
29294
  type: [String, Function],
29114
29295
  default: ""
29115
29296
  },
29297
+ anchor: {
29298
+ type: String
29299
+ },
29116
29300
  /**
29117
29301
  * 服务端渲染时,lazy设置为false,可以把内容渲染出来;
29118
29302
  * 不能设置为!IS_SERVER, 会影响客服端激活,不一样会存在问题
@@ -29455,7 +29639,7 @@ var VcComponents = (function (exports, vue) {
29455
29639
  "class": [{
29456
29640
  'is-fixed': isFixed
29457
29641
  }, 'vcm-tabs__bar']
29458
- }, [vue.createVNode("slot", {
29642
+ }, [vue.createVNode(vue.resolveComponent("slot"), {
29459
29643
  "name": "prepend"
29460
29644
  }, null), slots.prepend?.(), props.showStep && tabs.scrollable.value && vue.createVNode("div", {
29461
29645
  "class": "vcm-tabs__step is-left",
@@ -29569,6 +29753,10 @@ var VcComponents = (function (exports, vue) {
29569
29753
  default: (props$) => {
29570
29754
  return props$.value;
29571
29755
  }
29756
+ },
29757
+ theme: {
29758
+ type: String,
29759
+ default: "dark"
29572
29760
  }
29573
29761
  };
29574
29762
 
@@ -29621,7 +29809,7 @@ var VcComponents = (function (exports, vue) {
29621
29809
  // 确保不重复创建
29622
29810
  triggerEl: e.target,
29623
29811
  hover: true,
29624
- theme: 'dark',
29812
+ theme: props.theme,
29625
29813
  placement: props.placement,
29626
29814
  portalClass: props.portalClass,
29627
29815
  portalStyle: [props.portalStyle || `width: ${e.target.clientWidth}px`, 'word-break: break-all'],
@@ -35705,10 +35893,10 @@ var VcComponents = (function (exports, vue) {
35705
35893
  var _v1 = create$2();
35706
35894
  var _v2 = create$2();
35707
35895
  function isAroundZero$1(val) {
35708
- return val > -1e-8 && val < EPSILON$4;
35896
+ return val > -EPSILON$4 && val < EPSILON$4;
35709
35897
  }
35710
35898
  function isNotAroundZero$1(val) {
35711
- return val > EPSILON$4 || val < -1e-8;
35899
+ return val > EPSILON$4 || val < -EPSILON$4;
35712
35900
  }
35713
35901
  function cubicAt(p0, p1, p2, p3, t) {
35714
35902
  var onet = 1 - t;
@@ -36695,7 +36883,7 @@ var VcComponents = (function (exports, vue) {
36695
36883
  }
36696
36884
  var EPSILON$3 = 1e-4;
36697
36885
  function isAroundZero(transform) {
36698
- return transform < EPSILON$3 && transform > -1e-4;
36886
+ return transform < EPSILON$3 && transform > -EPSILON$3;
36699
36887
  }
36700
36888
  function round3(transform) {
36701
36889
  return mathRound$1(transform * 1e3) / 1e3;
@@ -37976,7 +38164,7 @@ var VcComponents = (function (exports, vue) {
37976
38164
  var mIdentity = identity;
37977
38165
  var EPSILON$2 = 5e-5;
37978
38166
  function isNotAroundZero(val) {
37979
- return val > EPSILON$2 || val < -5e-5;
38167
+ return val > EPSILON$2 || val < -EPSILON$2;
37980
38168
  }
37981
38169
  var scaleTmp = [];
37982
38170
  var tmpTransform = [];
@@ -38694,7 +38882,7 @@ var VcComponents = (function (exports, vue) {
38694
38882
  this.markRedraw();
38695
38883
  if (!useHoverLayer && this.__inHover) {
38696
38884
  this._toggleHoverLayerFlag(false);
38697
- this.__dirty &= -2;
38885
+ this.__dirty &= ~REDRAW_BIT;
38698
38886
  }
38699
38887
  return state;
38700
38888
  };
@@ -38752,7 +38940,7 @@ var VcComponents = (function (exports, vue) {
38752
38940
  this.markRedraw();
38753
38941
  if (!useHoverLayer && this.__inHover) {
38754
38942
  this._toggleHoverLayerFlag(false);
38755
- this.__dirty &= -2;
38943
+ this.__dirty &= ~REDRAW_BIT;
38756
38944
  }
38757
38945
  }
38758
38946
  };
@@ -40075,7 +40263,7 @@ var VcComponents = (function (exports, vue) {
40075
40263
  * @return {boolean}
40076
40264
  */
40077
40265
  function isRadianAroundZero(val) {
40078
- return val > -1e-4 && val < RADIAN_EPSILON;
40266
+ return val > -RADIAN_EPSILON && val < RADIAN_EPSILON;
40079
40267
  }
40080
40268
  // eslint-disable-next-line
40081
40269
  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
@@ -41669,7 +41857,7 @@ var VcComponents = (function (exports, vue) {
41669
41857
  return !!(this.__dirty & STYLE_CHANGED_BIT);
41670
41858
  };
41671
41859
  Displayable.prototype.styleUpdated = function () {
41672
- this.__dirty &= -3;
41860
+ this.__dirty &= ~STYLE_CHANGED_BIT;
41673
41861
  };
41674
41862
  Displayable.prototype.createStyle = function (obj) {
41675
41863
  return createObject(DEFAULT_COMMON_STYLE, obj);
@@ -43178,7 +43366,7 @@ var VcComponents = (function (exports, vue) {
43178
43366
  };
43179
43367
  Path.prototype.buildPath = function (ctx, shapeCfg, inBatch) { };
43180
43368
  Path.prototype.pathUpdated = function () {
43181
- this.__dirty &= -5;
43369
+ this.__dirty &= ~SHAPE_CHANGED_BIT;
43182
43370
  };
43183
43371
  Path.prototype.getUpdatedPathProxy = function (inBatch) {
43184
43372
  !this.path && this.createPathProxy();
@@ -55764,7 +55952,7 @@ var VcComponents = (function (exports, vue) {
55764
55952
  function brush$1(ctx, el, scope, isLast) {
55765
55953
  var m = el.transform;
55766
55954
  if (!el.shouldBePainted(scope.viewWidth, scope.viewHeight, false, false)) {
55767
- el.__dirty &= -2;
55955
+ el.__dirty &= ~REDRAW_BIT;
55768
55956
  el.__isRendered = false;
55769
55957
  return;
55770
55958
  }
@@ -114033,7 +114221,7 @@ var VcComponents = (function (exports, vue) {
114033
114221
  // and velocity is close to 0
114034
114222
  //
114035
114223
 
114036
- if (velocity.x < -0.5 && currentSlideVisibilityRatio < 0 || velocity.x < 0.1 && currentSlideVisibilityRatio < -0.5) {
114224
+ if (velocity.x < -MIN_NEXT_SLIDE_SPEED && currentSlideVisibilityRatio < 0 || velocity.x < 0.1 && currentSlideVisibilityRatio < -0.5) {
114037
114225
  // Go to next slide
114038
114226
  indexDiff = 1;
114039
114227
  velocity.x = Math.min(velocity.x, 0);
@@ -114097,7 +114285,7 @@ var VcComponents = (function (exports, vue) {
114097
114285
  // or if we are below and moving downwards
114098
114286
 
114099
114287
 
114100
- if (vDragRatio < 0 && projectedVDragRatio < -0.4 || vDragRatio > 0 && projectedVDragRatio > MIN_RATIO_TO_CLOSE) {
114288
+ if (vDragRatio < 0 && projectedVDragRatio < -MIN_RATIO_TO_CLOSE || vDragRatio > 0 && projectedVDragRatio > MIN_RATIO_TO_CLOSE) {
114101
114289
  this.pswp.close();
114102
114290
  return;
114103
114291
  }
@@ -132815,6 +133003,7 @@ var VcComponents = (function (exports, vue) {
132815
133003
  }, Symbol.toStringTag, { value: 'Module' }));
132816
133004
 
132817
133005
  exports.ActionSheet = ActionSheet;
133006
+ exports.Affix = Affix;
132818
133007
  exports.Alert = Alert;
132819
133008
  exports.Artboard = Artboard;
132820
133009
  exports.Button = Button;
@@ -132859,6 +133048,7 @@ var VcComponents = (function (exports, vue) {
132859
133048
  exports.List = MList;
132860
133049
  exports.ListItem = MListItem;
132861
133050
  exports.MActionSheet = MActionSheet;
133051
+ exports.MAffix = MAffix;
132862
133052
  exports.MAlert = MAlert;
132863
133053
  exports.MArtboard = MArtboard;
132864
133054
  exports.MButton = MButton;