@deot/vc 1.0.43 → 1.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +283 -167
- package/dist/index.iife.js +431 -257
- package/dist/index.js +3 -1
- package/dist/index.umd.cjs +431 -257
- package/package.json +4 -4
package/dist/index.umd.cjs
CHANGED
|
@@ -127,6 +127,222 @@
|
|
|
127
127
|
return parent;
|
|
128
128
|
};
|
|
129
129
|
|
|
130
|
+
const IS_SERVER$2 = typeof window === "undefined";
|
|
131
|
+
|
|
132
|
+
const hasClass = (el, cls) => {
|
|
133
|
+
if (IS_SERVER$2 || !cls) return false;
|
|
134
|
+
if (cls.includes(" ")) {
|
|
135
|
+
throw new Error("[@deot/helper-dom]: 类名不应该包含空格");
|
|
136
|
+
}
|
|
137
|
+
if (el.classList) {
|
|
138
|
+
return el.classList.contains(cls);
|
|
139
|
+
} else {
|
|
140
|
+
return (" " + el.className + " ").indexOf(" " + cls + " ") > -1;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const addClass = (el, cls) => {
|
|
145
|
+
if (IS_SERVER$2 || !cls) return;
|
|
146
|
+
let curClass = el.className;
|
|
147
|
+
const classes = cls.split(" ");
|
|
148
|
+
for (let i = 0, j = classes.length; i < j; i++) {
|
|
149
|
+
const clsName = classes[i];
|
|
150
|
+
if (clsName) {
|
|
151
|
+
if (el.classList) {
|
|
152
|
+
el.classList.add(clsName);
|
|
153
|
+
} else if (!hasClass(el, clsName)) {
|
|
154
|
+
curClass += " " + clsName;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (!el.classList) {
|
|
159
|
+
el.className = curClass;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const composedPath = (e) => {
|
|
164
|
+
const path = e.composedPath && e.composedPath() || [];
|
|
165
|
+
if (path.length) return path;
|
|
166
|
+
let parent = e.target?.parentNode;
|
|
167
|
+
/* istanbul ignore next -- @preserve */
|
|
168
|
+
while (parent) {
|
|
169
|
+
path.push(parent);
|
|
170
|
+
parent = parent.parentNode;
|
|
171
|
+
}
|
|
172
|
+
return path;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const contains$1 = (el, child) => {
|
|
176
|
+
if (IS_SERVER$2 || !child) return false;
|
|
177
|
+
const childRect = child.getBoundingClientRect();
|
|
178
|
+
let elRect;
|
|
179
|
+
if (!el || [window, document, document.documentElement].includes(el)) {
|
|
180
|
+
elRect = {
|
|
181
|
+
top: 0,
|
|
182
|
+
right: window.innerWidth,
|
|
183
|
+
bottom: window.innerHeight,
|
|
184
|
+
left: 0
|
|
185
|
+
};
|
|
186
|
+
} else {
|
|
187
|
+
elRect = el.getBoundingClientRect();
|
|
188
|
+
}
|
|
189
|
+
return childRect.top < elRect.bottom && childRect.bottom > elRect.top && childRect.right > elRect.left && childRect.left < elRect.right;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const el$1 = (v) => {
|
|
193
|
+
if (IS_SERVER$2) return null;
|
|
194
|
+
let target;
|
|
195
|
+
if (typeof v === "object") {
|
|
196
|
+
target = v;
|
|
197
|
+
} else {
|
|
198
|
+
target = document.querySelector(v);
|
|
199
|
+
}
|
|
200
|
+
if (!target) {
|
|
201
|
+
throw new Error("[@deot/helper-dom]: el缺失");
|
|
202
|
+
}
|
|
203
|
+
return target;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const getStyle$1 = (el, name) => {
|
|
207
|
+
if (IS_SERVER$2 || !name) return "";
|
|
208
|
+
if (name === "float") {
|
|
209
|
+
name = "cssFloat";
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
const computed = document.defaultView.getComputedStyle(el, "");
|
|
213
|
+
return el.style[name] || (computed?.[name] || "");
|
|
214
|
+
} catch (e) {
|
|
215
|
+
return el.style[name] || "";
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const isScroller = (el, options) => {
|
|
220
|
+
if (IS_SERVER$2 || !el) return false;
|
|
221
|
+
const { className, direction } = options || {};
|
|
222
|
+
let overflow = getStyle$1(el, `overflow-${direction ? "y" : "x"}`);
|
|
223
|
+
overflow = overflow || getStyle$1(el, "overflow");
|
|
224
|
+
return !!(overflow.match(/(scroll|auto)/) || className?.test(el.className));
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const getScroller = (el, options) => {
|
|
228
|
+
if (IS_SERVER$2 || !el) return null;
|
|
229
|
+
let parent = el;
|
|
230
|
+
while (parent) {
|
|
231
|
+
if ([window, document, document.documentElement].includes(parent)) {
|
|
232
|
+
return window;
|
|
233
|
+
}
|
|
234
|
+
if (isScroller(parent, options)) {
|
|
235
|
+
return parent;
|
|
236
|
+
}
|
|
237
|
+
parent = parent?.parentNode;
|
|
238
|
+
}
|
|
239
|
+
return parent;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const off = (el, event, handler, options) => {
|
|
243
|
+
if (IS_SERVER$2) return;
|
|
244
|
+
el.removeEventListener(event, handler, false);
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const on = (el, event, handler, options) => {
|
|
248
|
+
if (IS_SERVER$2) return () => {
|
|
249
|
+
};
|
|
250
|
+
el.addEventListener(event, handler, false);
|
|
251
|
+
return () => {
|
|
252
|
+
el.removeEventListener(event, handler, false);
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const $target = IS_SERVER$2 ? {} : document.createElement("div").style;
|
|
257
|
+
const prefix$1 = (() => {
|
|
258
|
+
const keys = {
|
|
259
|
+
webkit: "webkitTransform",
|
|
260
|
+
Moz: "MozTransform",
|
|
261
|
+
O: "OTransform",
|
|
262
|
+
ms: "msTransform",
|
|
263
|
+
standard: "transform"
|
|
264
|
+
};
|
|
265
|
+
const values = {
|
|
266
|
+
webkit: "-webkit-",
|
|
267
|
+
Moz: "-moz-",
|
|
268
|
+
O: "-o-",
|
|
269
|
+
ms: "-ms-",
|
|
270
|
+
standard: ""
|
|
271
|
+
};
|
|
272
|
+
for (const key in keys) {
|
|
273
|
+
if ($target[keys[key]] !== void 0) {
|
|
274
|
+
return {
|
|
275
|
+
camel: key,
|
|
276
|
+
kebab: values[key]
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return false;
|
|
281
|
+
})();
|
|
282
|
+
const prefixStyle = (v) => {
|
|
283
|
+
if (IS_SERVER$2 || prefix$1 === false) {
|
|
284
|
+
return {
|
|
285
|
+
camel: v,
|
|
286
|
+
kebab: v
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
return {
|
|
290
|
+
camel: prefix$1.camel + v.charAt(0).toUpperCase() + v.substr(1),
|
|
291
|
+
kebab: prefix$1.kebab + v
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const removeClass = (el, cls) => {
|
|
296
|
+
if (IS_SERVER$2 || !cls) return;
|
|
297
|
+
const classes = cls.split(" ");
|
|
298
|
+
let curClass = " " + el.className + " ";
|
|
299
|
+
for (let i = 0, j = classes.length; i < j; i++) {
|
|
300
|
+
const clsName = classes[i];
|
|
301
|
+
if (clsName) {
|
|
302
|
+
if (el.classList) {
|
|
303
|
+
el.classList.remove(clsName);
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
/* istanbul ignore next -- @preserve */
|
|
307
|
+
if (hasClass(el, clsName)) {
|
|
308
|
+
curClass = curClass.replace(" " + clsName + " ", " ");
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (!el.classList) {
|
|
313
|
+
el.className = curClass.trim();
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
const scrollIntoView = async (el, options) => {
|
|
318
|
+
if (IS_SERVER$2) return;
|
|
319
|
+
const { from = 0, to = 0, duration = 300 } = options || {};
|
|
320
|
+
const difference = Math.abs(from - to);
|
|
321
|
+
const step = Math.ceil(difference / duration * 50);
|
|
322
|
+
let onResolve;
|
|
323
|
+
const target = new Promise((resolve) => {
|
|
324
|
+
onResolve = resolve;
|
|
325
|
+
});
|
|
326
|
+
const scroll = (start, end) => {
|
|
327
|
+
if (start === end) {
|
|
328
|
+
onResolve();
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
let d = start + step > end ? end : start + step;
|
|
332
|
+
if (start > end) {
|
|
333
|
+
d = start - step < end ? end : start - step;
|
|
334
|
+
}
|
|
335
|
+
if (el === window) {
|
|
336
|
+
window.scrollTo(d, d);
|
|
337
|
+
} else {
|
|
338
|
+
el.scrollTop = d;
|
|
339
|
+
}
|
|
340
|
+
window.requestAnimationFrame(() => scroll(d, end));
|
|
341
|
+
};
|
|
342
|
+
scroll(from, to);
|
|
343
|
+
return target;
|
|
344
|
+
};
|
|
345
|
+
|
|
130
346
|
const debounce$1 = (original, wait, options) => {
|
|
131
347
|
const { leading, trailing = true, throttle } = options || {};
|
|
132
348
|
let timer;
|
|
@@ -222,7 +438,7 @@
|
|
|
222
438
|
);
|
|
223
439
|
};
|
|
224
440
|
|
|
225
|
-
const flatten$1 = (value, parser) => {
|
|
441
|
+
const flatten$1 = (value, parser, exit) => {
|
|
226
442
|
let need = true;
|
|
227
443
|
let safeCount = 1;
|
|
228
444
|
let parseValue = value;
|
|
@@ -232,7 +448,7 @@
|
|
|
232
448
|
}
|
|
233
449
|
try {
|
|
234
450
|
const next = (parser || decodeURIComponent)(parseValue);
|
|
235
|
-
if (parseValue === next) {
|
|
451
|
+
if (parseValue === next || typeof exit === "function" && exit(next)) {
|
|
236
452
|
need = false;
|
|
237
453
|
}
|
|
238
454
|
parseValue = next;
|
|
@@ -245,8 +461,7 @@
|
|
|
245
461
|
};
|
|
246
462
|
|
|
247
463
|
const flattenJSONParse = (value) => {
|
|
248
|
-
if (value === null)
|
|
249
|
-
return null;
|
|
464
|
+
if (value === null) return null;
|
|
250
465
|
const regex = /^\d+$/;
|
|
251
466
|
if (regex.test(value) && value.length >= 16 && +value > Number.MAX_SAFE_INTEGER) {
|
|
252
467
|
return value;
|
|
@@ -2591,7 +2806,7 @@
|
|
|
2591
2806
|
function castSlice(array, start, end) {
|
|
2592
2807
|
var length = array.length;
|
|
2593
2808
|
end = end === undefined ? length : end;
|
|
2594
|
-
return (
|
|
2809
|
+
return (!start && end >= length) ? array : baseSlice(array, start, end);
|
|
2595
2810
|
}
|
|
2596
2811
|
|
|
2597
2812
|
/** Used to compose unicode character classes. */
|
|
@@ -5292,233 +5507,6 @@
|
|
|
5292
5507
|
});
|
|
5293
5508
|
}
|
|
5294
5509
|
|
|
5295
|
-
const IS_SERVER$2 = typeof window === "undefined";
|
|
5296
|
-
|
|
5297
|
-
const hasClass = (el, cls) => {
|
|
5298
|
-
if (IS_SERVER$2 || !cls)
|
|
5299
|
-
return false;
|
|
5300
|
-
if (cls.includes(" ")) {
|
|
5301
|
-
throw new Error("[@deot/helper-dom]: 类名不应该包含空格");
|
|
5302
|
-
}
|
|
5303
|
-
if (el.classList) {
|
|
5304
|
-
return el.classList.contains(cls);
|
|
5305
|
-
} else {
|
|
5306
|
-
return (" " + el.className + " ").indexOf(" " + cls + " ") > -1;
|
|
5307
|
-
}
|
|
5308
|
-
};
|
|
5309
|
-
|
|
5310
|
-
const addClass = (el, cls) => {
|
|
5311
|
-
if (IS_SERVER$2 || !cls)
|
|
5312
|
-
return;
|
|
5313
|
-
let curClass = el.className;
|
|
5314
|
-
let classes = cls.split(" ");
|
|
5315
|
-
for (let i = 0, j = classes.length; i < j; i++) {
|
|
5316
|
-
let clsName = classes[i];
|
|
5317
|
-
if (clsName) {
|
|
5318
|
-
if (el.classList) {
|
|
5319
|
-
el.classList.add(clsName);
|
|
5320
|
-
} else if (!hasClass(el, clsName)) {
|
|
5321
|
-
curClass += " " + clsName;
|
|
5322
|
-
}
|
|
5323
|
-
}
|
|
5324
|
-
}
|
|
5325
|
-
if (!el.classList) {
|
|
5326
|
-
el.className = curClass;
|
|
5327
|
-
}
|
|
5328
|
-
};
|
|
5329
|
-
|
|
5330
|
-
const composedPath = (e) => {
|
|
5331
|
-
let path = e.composedPath && e.composedPath() || [];
|
|
5332
|
-
if (path.length)
|
|
5333
|
-
return path;
|
|
5334
|
-
let parent = e.target?.parentNode;
|
|
5335
|
-
/* istanbul ignore next -- @preserve */
|
|
5336
|
-
while (parent) {
|
|
5337
|
-
path.push(parent);
|
|
5338
|
-
parent = parent.parentNode;
|
|
5339
|
-
}
|
|
5340
|
-
return path;
|
|
5341
|
-
};
|
|
5342
|
-
|
|
5343
|
-
const contains$1 = (el, child) => {
|
|
5344
|
-
if (IS_SERVER$2 || !child)
|
|
5345
|
-
return false;
|
|
5346
|
-
let childRect = child.getBoundingClientRect();
|
|
5347
|
-
let elRect;
|
|
5348
|
-
if (!el || [window, document, document.documentElement].includes(el)) {
|
|
5349
|
-
elRect = {
|
|
5350
|
-
top: 0,
|
|
5351
|
-
right: window.innerWidth,
|
|
5352
|
-
bottom: window.innerHeight,
|
|
5353
|
-
left: 0
|
|
5354
|
-
};
|
|
5355
|
-
} else {
|
|
5356
|
-
elRect = el.getBoundingClientRect();
|
|
5357
|
-
}
|
|
5358
|
-
return childRect.top < elRect.bottom && childRect.bottom > elRect.top && childRect.right > elRect.left && childRect.left < elRect.right;
|
|
5359
|
-
};
|
|
5360
|
-
|
|
5361
|
-
const el$1 = (v) => {
|
|
5362
|
-
if (IS_SERVER$2)
|
|
5363
|
-
return null;
|
|
5364
|
-
let target;
|
|
5365
|
-
if (typeof v === "object") {
|
|
5366
|
-
target = v;
|
|
5367
|
-
} else {
|
|
5368
|
-
target = document.querySelector(v);
|
|
5369
|
-
}
|
|
5370
|
-
if (!target) {
|
|
5371
|
-
throw new Error("[@deot/helper-dom]: el缺失");
|
|
5372
|
-
}
|
|
5373
|
-
return target;
|
|
5374
|
-
};
|
|
5375
|
-
|
|
5376
|
-
const getStyle$1 = (el, name) => {
|
|
5377
|
-
if (IS_SERVER$2 || !name)
|
|
5378
|
-
return "";
|
|
5379
|
-
if (name === "float") {
|
|
5380
|
-
name = "cssFloat";
|
|
5381
|
-
}
|
|
5382
|
-
try {
|
|
5383
|
-
let computed = document.defaultView.getComputedStyle(el, "");
|
|
5384
|
-
return el.style[name] || (computed?.[name] || "");
|
|
5385
|
-
} catch (e) {
|
|
5386
|
-
return el.style[name] || "";
|
|
5387
|
-
}
|
|
5388
|
-
};
|
|
5389
|
-
|
|
5390
|
-
const isScroll = (el, direction) => {
|
|
5391
|
-
if (IS_SERVER$2 || !el)
|
|
5392
|
-
return false;
|
|
5393
|
-
let overflow = getStyle$1(el, `overflow-${"x"}`);
|
|
5394
|
-
overflow = overflow || getStyle$1(el, "overflow");
|
|
5395
|
-
return !!overflow.match(/(scroll|auto)/);
|
|
5396
|
-
};
|
|
5397
|
-
|
|
5398
|
-
const getScroller = (el, direction) => {
|
|
5399
|
-
if (IS_SERVER$2 || !el)
|
|
5400
|
-
return null;
|
|
5401
|
-
let parent = el;
|
|
5402
|
-
while (parent) {
|
|
5403
|
-
if ([window, document, document.documentElement].includes(parent)) {
|
|
5404
|
-
return window;
|
|
5405
|
-
}
|
|
5406
|
-
if (isScroll(parent)) {
|
|
5407
|
-
return parent;
|
|
5408
|
-
}
|
|
5409
|
-
parent = parent?.parentNode;
|
|
5410
|
-
}
|
|
5411
|
-
return parent;
|
|
5412
|
-
};
|
|
5413
|
-
|
|
5414
|
-
const off = (el, event, handler, options) => {
|
|
5415
|
-
if (IS_SERVER$2)
|
|
5416
|
-
return;
|
|
5417
|
-
el.removeEventListener(event, handler, false);
|
|
5418
|
-
};
|
|
5419
|
-
|
|
5420
|
-
const on = (el, event, handler, options) => {
|
|
5421
|
-
if (IS_SERVER$2)
|
|
5422
|
-
return () => {
|
|
5423
|
-
};
|
|
5424
|
-
el.addEventListener(event, handler, false);
|
|
5425
|
-
return () => {
|
|
5426
|
-
el.removeEventListener(event, handler, false);
|
|
5427
|
-
};
|
|
5428
|
-
};
|
|
5429
|
-
|
|
5430
|
-
const $target = IS_SERVER$2 ? {} : document.createElement("div").style;
|
|
5431
|
-
const prefix$1 = (() => {
|
|
5432
|
-
let keys = {
|
|
5433
|
-
webkit: "webkitTransform",
|
|
5434
|
-
Moz: "MozTransform",
|
|
5435
|
-
O: "OTransform",
|
|
5436
|
-
ms: "msTransform",
|
|
5437
|
-
standard: "transform"
|
|
5438
|
-
};
|
|
5439
|
-
let values = {
|
|
5440
|
-
webkit: "-webkit-",
|
|
5441
|
-
Moz: "-moz-",
|
|
5442
|
-
O: "-o-",
|
|
5443
|
-
ms: "-ms-",
|
|
5444
|
-
standard: ""
|
|
5445
|
-
};
|
|
5446
|
-
for (let key in keys) {
|
|
5447
|
-
if ($target[keys[key]] !== void 0) {
|
|
5448
|
-
return {
|
|
5449
|
-
camel: key,
|
|
5450
|
-
kebab: values[key]
|
|
5451
|
-
};
|
|
5452
|
-
}
|
|
5453
|
-
}
|
|
5454
|
-
return false;
|
|
5455
|
-
})();
|
|
5456
|
-
const prefixStyle = (v) => {
|
|
5457
|
-
if (IS_SERVER$2 || prefix$1 === false) {
|
|
5458
|
-
return {
|
|
5459
|
-
camel: v,
|
|
5460
|
-
kebab: v
|
|
5461
|
-
};
|
|
5462
|
-
}
|
|
5463
|
-
return {
|
|
5464
|
-
camel: prefix$1.camel + v.charAt(0).toUpperCase() + v.substr(1),
|
|
5465
|
-
kebab: prefix$1.kebab + v
|
|
5466
|
-
};
|
|
5467
|
-
};
|
|
5468
|
-
|
|
5469
|
-
const removeClass = (el, cls) => {
|
|
5470
|
-
if (IS_SERVER$2 || !cls)
|
|
5471
|
-
return;
|
|
5472
|
-
let classes = cls.split(" ");
|
|
5473
|
-
let curClass = " " + el.className + " ";
|
|
5474
|
-
for (let i = 0, j = classes.length; i < j; i++) {
|
|
5475
|
-
let clsName = classes[i];
|
|
5476
|
-
if (clsName) {
|
|
5477
|
-
if (el.classList) {
|
|
5478
|
-
el.classList.remove(clsName);
|
|
5479
|
-
continue;
|
|
5480
|
-
}
|
|
5481
|
-
/* istanbul ignore next -- @preserve */
|
|
5482
|
-
if (hasClass(el, clsName)) {
|
|
5483
|
-
curClass = curClass.replace(" " + clsName + " ", " ");
|
|
5484
|
-
}
|
|
5485
|
-
}
|
|
5486
|
-
}
|
|
5487
|
-
if (!el.classList) {
|
|
5488
|
-
el.className = curClass.trim();
|
|
5489
|
-
}
|
|
5490
|
-
};
|
|
5491
|
-
|
|
5492
|
-
const scrollIntoView = async (el, options) => {
|
|
5493
|
-
if (IS_SERVER$2)
|
|
5494
|
-
return;
|
|
5495
|
-
let { from = 0, to = 0, duration = 300 } = options || {};
|
|
5496
|
-
let difference = Math.abs(from - to);
|
|
5497
|
-
let step = Math.ceil(difference / duration * 50);
|
|
5498
|
-
let onResolve;
|
|
5499
|
-
let target = new Promise((resolve) => {
|
|
5500
|
-
onResolve = resolve;
|
|
5501
|
-
});
|
|
5502
|
-
const scroll = (start, end) => {
|
|
5503
|
-
if (start === end) {
|
|
5504
|
-
onResolve();
|
|
5505
|
-
return;
|
|
5506
|
-
}
|
|
5507
|
-
let d = start + step > end ? end : start + step;
|
|
5508
|
-
if (start > end) {
|
|
5509
|
-
d = start - step < end ? end : start - step;
|
|
5510
|
-
}
|
|
5511
|
-
if (el === window) {
|
|
5512
|
-
window.scrollTo(d, d);
|
|
5513
|
-
} else {
|
|
5514
|
-
el.scrollTop = d;
|
|
5515
|
-
}
|
|
5516
|
-
window.requestAnimationFrame(() => scroll(d, end));
|
|
5517
|
-
};
|
|
5518
|
-
scroll(from, to);
|
|
5519
|
-
return target;
|
|
5520
|
-
};
|
|
5521
|
-
|
|
5522
5510
|
class Resize {
|
|
5523
5511
|
el;
|
|
5524
5512
|
static of(el) {
|
|
@@ -9143,16 +9131,16 @@
|
|
|
9143
9131
|
}
|
|
9144
9132
|
}
|
|
9145
9133
|
const VcInstance = new Instance();
|
|
9146
|
-
const props$
|
|
9134
|
+
const props$1t = {
|
|
9147
9135
|
tag: {
|
|
9148
9136
|
type: String,
|
|
9149
9137
|
default: "div"
|
|
9150
9138
|
}
|
|
9151
9139
|
};
|
|
9152
|
-
const COMPONENT_NAME$
|
|
9140
|
+
const COMPONENT_NAME$28 = "vc-action-sheet";
|
|
9153
9141
|
const ActionSheet = /* @__PURE__ */ vue.defineComponent({
|
|
9154
|
-
name: COMPONENT_NAME$
|
|
9155
|
-
props: props$
|
|
9142
|
+
name: COMPONENT_NAME$28,
|
|
9143
|
+
props: props$1t,
|
|
9156
9144
|
setup(props2, {
|
|
9157
9145
|
slots
|
|
9158
9146
|
}) {
|
|
@@ -9164,6 +9152,174 @@
|
|
|
9164
9152
|
}
|
|
9165
9153
|
});
|
|
9166
9154
|
const MActionSheet = ActionSheet;
|
|
9155
|
+
const props$1s = {
|
|
9156
|
+
zIndex: {
|
|
9157
|
+
type: [Number, String],
|
|
9158
|
+
default: 1
|
|
9159
|
+
},
|
|
9160
|
+
// TODO: left/right
|
|
9161
|
+
placement: {
|
|
9162
|
+
type: String,
|
|
9163
|
+
default: "top"
|
|
9164
|
+
},
|
|
9165
|
+
disabled: {
|
|
9166
|
+
type: Boolean,
|
|
9167
|
+
default: false
|
|
9168
|
+
},
|
|
9169
|
+
fixed: {
|
|
9170
|
+
type: Boolean,
|
|
9171
|
+
default: true
|
|
9172
|
+
},
|
|
9173
|
+
offset: {
|
|
9174
|
+
type: Number,
|
|
9175
|
+
default: 0
|
|
9176
|
+
},
|
|
9177
|
+
// -> 固钉始终保持在容器内, 超过范围则隐藏(请注意容器避免出现滚动条) 仅fixed为true有效
|
|
9178
|
+
target: {
|
|
9179
|
+
type: String
|
|
9180
|
+
}
|
|
9181
|
+
};
|
|
9182
|
+
const COMPONENT_NAME$27 = "vc-affix";
|
|
9183
|
+
const SCROLLER_WHEEL_REG = /vc-scroller-wheel/;
|
|
9184
|
+
const Affix = /* @__PURE__ */ vue.defineComponent({
|
|
9185
|
+
name: COMPONENT_NAME$27,
|
|
9186
|
+
props: props$1s,
|
|
9187
|
+
setup(props2, {
|
|
9188
|
+
slots,
|
|
9189
|
+
expose
|
|
9190
|
+
}) {
|
|
9191
|
+
const scrollerInstance = vue.inject("vc-scroller", null);
|
|
9192
|
+
const scroller = vue.shallowRef();
|
|
9193
|
+
const base = vue.shallowRef();
|
|
9194
|
+
const current = vue.shallowRef();
|
|
9195
|
+
const currentRect = vue.reactive({
|
|
9196
|
+
top: 0,
|
|
9197
|
+
bottom: 0,
|
|
9198
|
+
width: 0,
|
|
9199
|
+
height: 0
|
|
9200
|
+
});
|
|
9201
|
+
const isActive = vue.ref(false);
|
|
9202
|
+
const transformY = vue.ref(0);
|
|
9203
|
+
const windowHeight = vue.ref(window.innerHeight);
|
|
9204
|
+
const isVcScrollerWheel = vue.computed(() => {
|
|
9205
|
+
return SCROLLER_WHEEL_REG.test(scroller.value?.className || "");
|
|
9206
|
+
});
|
|
9207
|
+
const currentStyle = vue.computed(() => {
|
|
9208
|
+
if (!isActive.value) return {};
|
|
9209
|
+
return {
|
|
9210
|
+
height: `${currentRect.height}px`,
|
|
9211
|
+
width: `${currentRect.width}px`
|
|
9212
|
+
};
|
|
9213
|
+
});
|
|
9214
|
+
const contentStyle = vue.computed(() => {
|
|
9215
|
+
if (!isActive.value) return {};
|
|
9216
|
+
const offset = `${props2.offset}px`;
|
|
9217
|
+
return {
|
|
9218
|
+
height: `${currentRect.height}px`,
|
|
9219
|
+
width: `${currentRect.width}px`,
|
|
9220
|
+
top: props2.placement === "top" ? offset : "",
|
|
9221
|
+
bottom: props2.placement === "bottom" ? offset : "",
|
|
9222
|
+
zIndex: props2.zIndex,
|
|
9223
|
+
transform: transformY.value ? `translateY(${transformY.value}px)` : ""
|
|
9224
|
+
};
|
|
9225
|
+
});
|
|
9226
|
+
const setCurrentRect = () => {
|
|
9227
|
+
const rect = current.value.getBoundingClientRect();
|
|
9228
|
+
Object.assign(currentRect, {
|
|
9229
|
+
top: rect.top,
|
|
9230
|
+
bottom: rect.bottom,
|
|
9231
|
+
width: rect.width,
|
|
9232
|
+
height: rect.height
|
|
9233
|
+
});
|
|
9234
|
+
};
|
|
9235
|
+
const setAbsoluteStatus = () => {
|
|
9236
|
+
const {
|
|
9237
|
+
placement,
|
|
9238
|
+
offset
|
|
9239
|
+
} = props2;
|
|
9240
|
+
const currentHeightOffset = offset + currentRect.height;
|
|
9241
|
+
const containerRect = scroller.value.getBoundingClientRect();
|
|
9242
|
+
let transformOffsetY = 0;
|
|
9243
|
+
if (scrollerInstance && isVcScrollerWheel.value) {
|
|
9244
|
+
const maxMoveY = scrollerInstance.scrollHeight - scrollerInstance.clientHeight;
|
|
9245
|
+
transformOffsetY = scrollerInstance.scrollTop >= maxMoveY ? maxMoveY : scrollerInstance.scrollTop;
|
|
9246
|
+
}
|
|
9247
|
+
if (placement === "top") {
|
|
9248
|
+
isActive.value = currentRect.top - containerRect.top <= props2.offset;
|
|
9249
|
+
transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0) + transformOffsetY;
|
|
9250
|
+
} else {
|
|
9251
|
+
isActive.value = currentRect.bottom - containerRect.top >= containerRect.height - props2.offset;
|
|
9252
|
+
transformY.value = Math.max(containerRect.height - containerRect.top - currentHeightOffset, 0) + transformOffsetY;
|
|
9253
|
+
}
|
|
9254
|
+
};
|
|
9255
|
+
const setFixedStatus = () => {
|
|
9256
|
+
const {
|
|
9257
|
+
placement,
|
|
9258
|
+
target,
|
|
9259
|
+
offset
|
|
9260
|
+
} = props2;
|
|
9261
|
+
const currentHeightOffset = offset + currentRect.height;
|
|
9262
|
+
const containerRect = target && base.value.getBoundingClientRect();
|
|
9263
|
+
if (placement === "top") {
|
|
9264
|
+
if (target) {
|
|
9265
|
+
isActive.value = offset > currentRect.top && containerRect.bottom > 0;
|
|
9266
|
+
transformY.value = Math.min(containerRect.bottom - currentHeightOffset, 0);
|
|
9267
|
+
} else {
|
|
9268
|
+
isActive.value = offset > currentRect.top;
|
|
9269
|
+
}
|
|
9270
|
+
} else {
|
|
9271
|
+
if (target) {
|
|
9272
|
+
isActive.value = windowHeight.value - offset < currentRect.bottom && windowHeight.value > containerRect.top;
|
|
9273
|
+
transformY.value = -Math.min(windowHeight.value - containerRect.top - currentHeightOffset, 0);
|
|
9274
|
+
} else {
|
|
9275
|
+
isActive.value = windowHeight.value - offset < currentRect.bottom;
|
|
9276
|
+
}
|
|
9277
|
+
}
|
|
9278
|
+
};
|
|
9279
|
+
const refresh = () => {
|
|
9280
|
+
setCurrentRect();
|
|
9281
|
+
scroller.value instanceof Window || props2.fixed ? setFixedStatus() : setAbsoluteStatus();
|
|
9282
|
+
};
|
|
9283
|
+
vue.onMounted(() => {
|
|
9284
|
+
if (typeof props2.target === "string") {
|
|
9285
|
+
base.value = document.querySelector(props2.target) ?? void 0;
|
|
9286
|
+
}
|
|
9287
|
+
!base.value && (base.value = document.documentElement);
|
|
9288
|
+
scroller.value = getScroller(current.value, {
|
|
9289
|
+
className: SCROLLER_WHEEL_REG
|
|
9290
|
+
});
|
|
9291
|
+
if (isVcScrollerWheel.value) {
|
|
9292
|
+
scrollerInstance?.on(refresh);
|
|
9293
|
+
} else {
|
|
9294
|
+
scroller.value?.addEventListener("scroll", refresh);
|
|
9295
|
+
}
|
|
9296
|
+
refresh();
|
|
9297
|
+
});
|
|
9298
|
+
vue.onBeforeUnmount(() => {
|
|
9299
|
+
if (isVcScrollerWheel.value) {
|
|
9300
|
+
scrollerInstance?.off(refresh);
|
|
9301
|
+
} else {
|
|
9302
|
+
scroller.value?.removeEventListener("scroll", refresh);
|
|
9303
|
+
}
|
|
9304
|
+
});
|
|
9305
|
+
expose({
|
|
9306
|
+
refresh
|
|
9307
|
+
});
|
|
9308
|
+
return () => {
|
|
9309
|
+
return vue.createVNode("div", {
|
|
9310
|
+
"ref": current,
|
|
9311
|
+
"class": "vc-affix",
|
|
9312
|
+
"style": currentStyle.value
|
|
9313
|
+
}, [vue.createVNode("div", {
|
|
9314
|
+
"class": {
|
|
9315
|
+
[`vc-affix__${props2.fixed ? "fixed" : "absolute"}`]: isActive.value
|
|
9316
|
+
},
|
|
9317
|
+
"style": contentStyle.value
|
|
9318
|
+
}, [slots?.default?.()])]);
|
|
9319
|
+
};
|
|
9320
|
+
}
|
|
9321
|
+
});
|
|
9322
|
+
const MAffix = Affix;
|
|
9167
9323
|
const props$1r = {
|
|
9168
9324
|
modelValue: {
|
|
9169
9325
|
type: Boolean,
|
|
@@ -9832,7 +9988,7 @@
|
|
|
9832
9988
|
});
|
|
9833
9989
|
const COMPONENT_NAME$1$ = "vc-alert";
|
|
9834
9990
|
const THEME_MAP = {
|
|
9835
|
-
info: ["#
|
|
9991
|
+
info: ["#456CF6", "#91d5ff", "#e6f7ff"],
|
|
9836
9992
|
success: ["#52c41a", "#b7eb8f", "#f6ffed"],
|
|
9837
9993
|
error: ["#ed4014", "#ffb08f", "#fbe9e9"],
|
|
9838
9994
|
warning: ["#ffbf00", "#ffe58f", "#fffbe6"]
|
|
@@ -17729,6 +17885,7 @@
|
|
|
17729
17885
|
refreshSize();
|
|
17730
17886
|
refreshPosition(options);
|
|
17731
17887
|
};
|
|
17888
|
+
const listeners = [];
|
|
17732
17889
|
const triggerScrollDelegate = (options) => {
|
|
17733
17890
|
const delegates = {
|
|
17734
17891
|
scrollLeft: (options && options.x) ?? scrollX.value,
|
|
@@ -17736,12 +17893,15 @@
|
|
|
17736
17893
|
clientWidth: wrapperW.value,
|
|
17737
17894
|
clientHeight: wrapperH.value,
|
|
17738
17895
|
scrollWidth: contentW.value,
|
|
17739
|
-
scrollHeight: contentH.value
|
|
17896
|
+
scrollHeight: contentH.value,
|
|
17897
|
+
getBoundingClientRect: () => wrapper.value?.getBoundingClientRect()
|
|
17740
17898
|
};
|
|
17741
|
-
|
|
17899
|
+
const e = {
|
|
17742
17900
|
target: delegates,
|
|
17743
17901
|
currentTarget: delegates
|
|
17744
|
-
}
|
|
17902
|
+
};
|
|
17903
|
+
instance.emit("scroll", e);
|
|
17904
|
+
listeners.forEach((listener) => listener(e));
|
|
17745
17905
|
};
|
|
17746
17906
|
const scrollTo = (options) => {
|
|
17747
17907
|
refreshPosition(options);
|
|
@@ -17768,8 +17928,9 @@
|
|
|
17768
17928
|
Resize.off(wrapper.value, refresh);
|
|
17769
17929
|
Resize.off(content.value, refresh);
|
|
17770
17930
|
}
|
|
17931
|
+
listeners.splice(0, listeners.length);
|
|
17771
17932
|
});
|
|
17772
|
-
|
|
17933
|
+
const exposed = {
|
|
17773
17934
|
wrapper,
|
|
17774
17935
|
content,
|
|
17775
17936
|
scrollTo,
|
|
@@ -17785,8 +17946,16 @@
|
|
|
17785
17946
|
},
|
|
17786
17947
|
setScrollLeft: (value) => {
|
|
17787
17948
|
scrollTo({ x: value });
|
|
17949
|
+
},
|
|
17950
|
+
on: (listener) => {
|
|
17951
|
+
listeners.push(listener);
|
|
17952
|
+
},
|
|
17953
|
+
off: (listener) => {
|
|
17954
|
+
listeners.splice(listeners.indexOf(listener), 1);
|
|
17788
17955
|
}
|
|
17789
|
-
}
|
|
17956
|
+
};
|
|
17957
|
+
expose(exposed);
|
|
17958
|
+
vue.provide("vc-scroller", vue.reactive(exposed));
|
|
17790
17959
|
return {
|
|
17791
17960
|
bar,
|
|
17792
17961
|
wrapper,
|
|
@@ -23099,7 +23268,7 @@
|
|
|
23099
23268
|
color: {
|
|
23100
23269
|
type: [Object, String],
|
|
23101
23270
|
default: () => ({
|
|
23102
|
-
normal: "#
|
|
23271
|
+
normal: "#456CF6",
|
|
23103
23272
|
success: "#52c41a",
|
|
23104
23273
|
error: "#f5222d"
|
|
23105
23274
|
})
|
|
@@ -28053,7 +28222,8 @@
|
|
|
28053
28222
|
});
|
|
28054
28223
|
const props$b = {
|
|
28055
28224
|
value: {
|
|
28056
|
-
type: [String, Number, Boolean]
|
|
28225
|
+
type: [String, Number, Boolean],
|
|
28226
|
+
default: void 0
|
|
28057
28227
|
},
|
|
28058
28228
|
label: {
|
|
28059
28229
|
type: [String, Function],
|
|
@@ -28359,7 +28529,7 @@
|
|
|
28359
28529
|
"class": [{
|
|
28360
28530
|
"is-fixed": isFixed
|
|
28361
28531
|
}, "vcm-tabs__bar"]
|
|
28362
|
-
}, [vue.createVNode("slot", {
|
|
28532
|
+
}, [vue.createVNode(vue.resolveComponent("slot"), {
|
|
28363
28533
|
"name": "prepend"
|
|
28364
28534
|
}, null), slots.prepend?.(), props2.showStep && tabs.scrollable.value && vue.createVNode("div", {
|
|
28365
28535
|
"class": "vcm-tabs__step is-left",
|
|
@@ -31404,6 +31574,8 @@
|
|
|
31404
31574
|
const Components = {
|
|
31405
31575
|
ActionSheet,
|
|
31406
31576
|
MActionSheet,
|
|
31577
|
+
Affix,
|
|
31578
|
+
MAffix,
|
|
31407
31579
|
Alert,
|
|
31408
31580
|
MAlert,
|
|
31409
31581
|
Artboard,
|
|
@@ -34729,10 +34901,10 @@
|
|
|
34729
34901
|
var _v1 = create$2();
|
|
34730
34902
|
var _v2 = create$2();
|
|
34731
34903
|
function isAroundZero$1(val) {
|
|
34732
|
-
return val > -
|
|
34904
|
+
return val > -EPSILON$4 && val < EPSILON$4;
|
|
34733
34905
|
}
|
|
34734
34906
|
function isNotAroundZero$1(val) {
|
|
34735
|
-
return val > EPSILON$4 || val < -
|
|
34907
|
+
return val > EPSILON$4 || val < -EPSILON$4;
|
|
34736
34908
|
}
|
|
34737
34909
|
function cubicAt(p0, p1, p2, p3, t) {
|
|
34738
34910
|
var onet = 1 - t;
|
|
@@ -35719,7 +35891,7 @@
|
|
|
35719
35891
|
}
|
|
35720
35892
|
var EPSILON$3 = 1e-4;
|
|
35721
35893
|
function isAroundZero(transform) {
|
|
35722
|
-
return transform < EPSILON$3 && transform > -
|
|
35894
|
+
return transform < EPSILON$3 && transform > -EPSILON$3;
|
|
35723
35895
|
}
|
|
35724
35896
|
function round3(transform) {
|
|
35725
35897
|
return mathRound$1(transform * 1e3) / 1e3;
|
|
@@ -37000,7 +37172,7 @@
|
|
|
37000
37172
|
var mIdentity = identity;
|
|
37001
37173
|
var EPSILON$2 = 5e-5;
|
|
37002
37174
|
function isNotAroundZero(val) {
|
|
37003
|
-
return val > EPSILON$2 || val < -
|
|
37175
|
+
return val > EPSILON$2 || val < -EPSILON$2;
|
|
37004
37176
|
}
|
|
37005
37177
|
var scaleTmp = [];
|
|
37006
37178
|
var tmpTransform = [];
|
|
@@ -37718,7 +37890,7 @@
|
|
|
37718
37890
|
this.markRedraw();
|
|
37719
37891
|
if (!useHoverLayer && this.__inHover) {
|
|
37720
37892
|
this._toggleHoverLayerFlag(false);
|
|
37721
|
-
this.__dirty &=
|
|
37893
|
+
this.__dirty &= ~REDRAW_BIT;
|
|
37722
37894
|
}
|
|
37723
37895
|
return state;
|
|
37724
37896
|
};
|
|
@@ -37776,7 +37948,7 @@
|
|
|
37776
37948
|
this.markRedraw();
|
|
37777
37949
|
if (!useHoverLayer && this.__inHover) {
|
|
37778
37950
|
this._toggleHoverLayerFlag(false);
|
|
37779
|
-
this.__dirty &=
|
|
37951
|
+
this.__dirty &= ~REDRAW_BIT;
|
|
37780
37952
|
}
|
|
37781
37953
|
}
|
|
37782
37954
|
};
|
|
@@ -39099,7 +39271,7 @@
|
|
|
39099
39271
|
* @return {boolean}
|
|
39100
39272
|
*/
|
|
39101
39273
|
function isRadianAroundZero(val) {
|
|
39102
|
-
return val > -
|
|
39274
|
+
return val > -RADIAN_EPSILON && val < RADIAN_EPSILON;
|
|
39103
39275
|
}
|
|
39104
39276
|
// eslint-disable-next-line
|
|
39105
39277
|
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
|
|
@@ -40693,7 +40865,7 @@
|
|
|
40693
40865
|
return !!(this.__dirty & STYLE_CHANGED_BIT);
|
|
40694
40866
|
};
|
|
40695
40867
|
Displayable.prototype.styleUpdated = function () {
|
|
40696
|
-
this.__dirty &=
|
|
40868
|
+
this.__dirty &= ~STYLE_CHANGED_BIT;
|
|
40697
40869
|
};
|
|
40698
40870
|
Displayable.prototype.createStyle = function (obj) {
|
|
40699
40871
|
return createObject(DEFAULT_COMMON_STYLE, obj);
|
|
@@ -42202,7 +42374,7 @@
|
|
|
42202
42374
|
};
|
|
42203
42375
|
Path.prototype.buildPath = function (ctx, shapeCfg, inBatch) { };
|
|
42204
42376
|
Path.prototype.pathUpdated = function () {
|
|
42205
|
-
this.__dirty &=
|
|
42377
|
+
this.__dirty &= ~SHAPE_CHANGED_BIT;
|
|
42206
42378
|
};
|
|
42207
42379
|
Path.prototype.getUpdatedPathProxy = function (inBatch) {
|
|
42208
42380
|
!this.path && this.createPathProxy();
|
|
@@ -54788,7 +54960,7 @@
|
|
|
54788
54960
|
function brush$1(ctx, el, scope, isLast) {
|
|
54789
54961
|
var m = el.transform;
|
|
54790
54962
|
if (!el.shouldBePainted(scope.viewWidth, scope.viewHeight, false, false)) {
|
|
54791
|
-
el.__dirty &=
|
|
54963
|
+
el.__dirty &= ~REDRAW_BIT;
|
|
54792
54964
|
el.__isRendered = false;
|
|
54793
54965
|
return;
|
|
54794
54966
|
}
|
|
@@ -113057,7 +113229,7 @@
|
|
|
113057
113229
|
// and velocity is close to 0
|
|
113058
113230
|
//
|
|
113059
113231
|
|
|
113060
|
-
if (velocity.x < -
|
|
113232
|
+
if (velocity.x < -MIN_NEXT_SLIDE_SPEED && currentSlideVisibilityRatio < 0 || velocity.x < 0.1 && currentSlideVisibilityRatio < -0.5) {
|
|
113061
113233
|
// Go to next slide
|
|
113062
113234
|
indexDiff = 1;
|
|
113063
113235
|
velocity.x = Math.min(velocity.x, 0);
|
|
@@ -113121,7 +113293,7 @@
|
|
|
113121
113293
|
// or if we are below and moving downwards
|
|
113122
113294
|
|
|
113123
113295
|
|
|
113124
|
-
if (vDragRatio < 0 && projectedVDragRatio < -
|
|
113296
|
+
if (vDragRatio < 0 && projectedVDragRatio < -MIN_RATIO_TO_CLOSE || vDragRatio > 0 && projectedVDragRatio > MIN_RATIO_TO_CLOSE) {
|
|
113125
113297
|
this.pswp.close();
|
|
113126
113298
|
return;
|
|
113127
113299
|
}
|
|
@@ -131839,6 +132011,7 @@
|
|
|
131839
132011
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
131840
132012
|
|
|
131841
132013
|
exports.ActionSheet = ActionSheet;
|
|
132014
|
+
exports.Affix = Affix;
|
|
131842
132015
|
exports.Alert = Alert;
|
|
131843
132016
|
exports.Artboard = Artboard;
|
|
131844
132017
|
exports.Button = Button;
|
|
@@ -131884,6 +132057,7 @@
|
|
|
131884
132057
|
exports.List = MList;
|
|
131885
132058
|
exports.ListItem = MListItem;
|
|
131886
132059
|
exports.MActionSheet = MActionSheet;
|
|
132060
|
+
exports.MAffix = MAffix;
|
|
131887
132061
|
exports.MAlert = MAlert;
|
|
131888
132062
|
exports.MArtboard = MArtboard;
|
|
131889
132063
|
exports.MButton = MButton;
|