@seresweb/website-component 2.0.2 → 2.1.0

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.
@@ -0,0 +1,561 @@
1
+ import { defineComponent as P, ref as y, reactive as te, watch as Z, onMounted as j, onBeforeUnmount as q, createElementBlock as s, openBlock as o, normalizeStyle as E, normalizeClass as l, unref as t, createElementVNode as w, createCommentVNode as S, Fragment as R, renderList as N, createBlock as I, createVNode as G, mergeProps as W, normalizeProps as Y, computed as C, createStaticVNode as oe } from "vue";
2
+ import { a as ne } from "./index-BrggpRcU.js";
3
+ import { P as i } from "./_vars-BV4QQF-p.js";
4
+ import "./es/accordion-info-panel.mjs";
5
+ import "./es/animated-number.mjs";
6
+ import "./es/drawer.mjs";
7
+ import "./es/dropdown.mjs";
8
+ import "./es/gradual-highlight.mjs";
9
+ import { getRootOffset as re } from "@vavt/util";
10
+ import "./es/input.mjs";
11
+ import { ScLayzImage as A } from "./es/layz-image.mjs";
12
+ import "./es/parameter-box.mjs";
13
+ import "./es/radio.mjs";
14
+ import { ScTabIndicator as ie } from "./es/tab-indicator.mjs";
15
+ import { ScVideo as J } from "./es/video.mjs";
16
+ const ae = ["innerHTML"], le = ["innerHTML"], se = ["innerHTML"], ce = ["innerHTML"], de = /* @__PURE__ */ P({
17
+ __name: "pc-viewer",
18
+ props: {
19
+ title: {},
20
+ desc: {},
21
+ dataList: {},
22
+ extraTopSpacing: { default: 0 },
23
+ extraBottomSpacing: { default: 0 }
24
+ },
25
+ setup(c) {
26
+ const v = c, a = y(), _ = y(), n = y(), f = y(), g = y(), d = y(), L = te({
27
+ container: "",
28
+ root: "",
29
+ item: ""
30
+ }), m = (r) => typeof r != "number" || Number.isNaN(r) ? 0 : r, b = (r, u, p) => {
31
+ const T = Math.min(Math.max(r, 0), p), M = Math.min(Math.max(u, 0), Math.max(p - T, 0));
32
+ return { safeTop: T, safeBottom: M };
33
+ }, k = () => {
34
+ var X;
35
+ if (!n.value)
36
+ return;
37
+ const r = n.value.offsetHeight, u = window.innerHeight, p = ((X = d.value) == null ? void 0 : X.offsetHeight) || 0, T = h(d.value), M = m(v.extraTopSpacing), x = m(v.extraBottomSpacing), { safeTop: H, safeBottom: z } = b(M, x, u), O = Math.max(u - H - z, 0), V = Math.max((O - p - r - T) / 2, 0), K = H + V, Q = z + V;
38
+ L.container = `padding-top: ${K}px; padding-bottom: ${Q}px; min-height: ${u}px;`;
39
+ const ee = n.value.scrollWidth;
40
+ L.root = `height: ${Math.max(ee, u)}px`;
41
+ }, e = () => {
42
+ const r = document.documentElement.getAttribute("dir") || "ltr", u = r === "rtl" ? "right" : "left";
43
+ if (!a.value || !n.value || !f.value || !g.value) return;
44
+ const T = a.value.clientHeight - window.innerHeight, { offsetTop: M } = re(a.value), x = document.documentElement.scrollTop - M;
45
+ if (x < 0) {
46
+ n.value.scrollTo({ left: 0 }), g.value.style[u] = "0px";
47
+ return;
48
+ }
49
+ if (x > T) {
50
+ const V = n.value.scrollWidth - window.innerWidth;
51
+ n.value.scrollTo({ left: r === "rtl" ? -V : V }), g.value.style[u] = f.value.clientWidth - g.value.clientWidth + "px";
52
+ return;
53
+ }
54
+ const H = x / T, z = H * (n.value.scrollWidth - window.innerWidth), O = H * (f.value.clientWidth * 2 / 3);
55
+ n.value.scrollTo({ left: r === "rtl" ? -z : z }), g.value.style[u] = `${O}px`;
56
+ }, $ = () => {
57
+ L.container = "", k();
58
+ }, h = (r) => {
59
+ if (!(r instanceof HTMLElement))
60
+ return 0;
61
+ const u = window.getComputedStyle(r), p = parseFloat(u.marginTop) || 0, T = parseFloat(u.marginBottom) || 0;
62
+ return p + T;
63
+ };
64
+ let B;
65
+ return Z(
66
+ () => [v.extraTopSpacing, v.extraBottomSpacing],
67
+ () => {
68
+ L.container = "", k();
69
+ }
70
+ ), j(() => {
71
+ B = new IntersectionObserver(
72
+ (r) => {
73
+ r.forEach((u) => {
74
+ u.isIntersecting && (L.container = "", k());
75
+ });
76
+ },
77
+ {
78
+ root: null,
79
+ // 相对于 viewport
80
+ rootMargin: "200px 0px 200px 0px",
81
+ // 提前100px触发
82
+ threshold: 0
83
+ }
84
+ ), window.addEventListener("scroll", e), window.addEventListener("resize", $), a.value && B.observe(a.value);
85
+ }), q(() => {
86
+ window.removeEventListener("scroll", e), window.removeEventListener("resize", $), B && B.disconnect();
87
+ }), (r, u) => (o(), s(
88
+ "div",
89
+ {
90
+ ref_key: "rootRef",
91
+ ref: a,
92
+ class: l(`${t(i)}-horizontal-viewer`),
93
+ style: E(L.root)
94
+ },
95
+ [
96
+ w(
97
+ "div",
98
+ {
99
+ ref_key: "containerRef",
100
+ ref: _,
101
+ class: l([`${t(i)}-horizontal-viewer__container`, (r.title || r.desc) && "has-header"]),
102
+ style: E(L.container)
103
+ },
104
+ [
105
+ r.title || r.desc ? (o(), s(
106
+ "div",
107
+ {
108
+ key: 0,
109
+ class: l(`${t(i)}-horizontal-viewer__header`),
110
+ ref_key: "headerRef",
111
+ ref: d
112
+ },
113
+ [
114
+ r.title ? (o(), s("p", {
115
+ key: 0,
116
+ innerHTML: r.title
117
+ }, null, 8, ae)) : S("v-if", !0),
118
+ r.desc ? (o(), s("p", {
119
+ key: 1,
120
+ innerHTML: r.desc
121
+ }, null, 8, le)) : S("v-if", !0)
122
+ ],
123
+ 2
124
+ /* CLASS */
125
+ )) : S("v-if", !0),
126
+ w(
127
+ "div",
128
+ {
129
+ ref_key: "scrollerRef",
130
+ ref: n,
131
+ class: l(`${t(i)}-horizontal-viewer__scroller`)
132
+ },
133
+ [
134
+ w(
135
+ "div",
136
+ {
137
+ class: l(`${t(i)}-horizontal-viewer__content`)
138
+ },
139
+ [
140
+ (o(!0), s(
141
+ R,
142
+ null,
143
+ N(r.dataList, (p) => (o(), s(
144
+ "div",
145
+ {
146
+ key: p.title,
147
+ class: l(`${t(i)}-horizontal-viewer__content-item`)
148
+ },
149
+ [
150
+ p.type === "img" ? (o(), I(t(A), {
151
+ key: 0,
152
+ src: p.url,
153
+ alt: p.alt
154
+ }, null, 8, ["src", "alt"])) : (o(), I(t(J), {
155
+ key: 1,
156
+ url: p.url,
157
+ poster: p.poster,
158
+ "auto-play": !1
159
+ }, null, 8, ["url", "poster"])),
160
+ w(
161
+ "div",
162
+ {
163
+ class: l(`${t(i)}-horizontal-viewer__content-item-footer`)
164
+ },
165
+ [
166
+ w("p", {
167
+ innerHTML: p.title
168
+ }, null, 8, se),
169
+ w("p", {
170
+ innerHTML: p.desc
171
+ }, null, 8, ce)
172
+ ],
173
+ 2
174
+ /* CLASS */
175
+ )
176
+ ],
177
+ 2
178
+ /* CLASS */
179
+ ))),
180
+ 128
181
+ /* KEYED_FRAGMENT */
182
+ ))
183
+ ],
184
+ 2
185
+ /* CLASS */
186
+ )
187
+ ],
188
+ 2
189
+ /* CLASS */
190
+ ),
191
+ w(
192
+ "div",
193
+ {
194
+ ref_key: "paginationRef",
195
+ ref: f,
196
+ class: l(`${t(i)}-horizontal-viewer__pagination`)
197
+ },
198
+ [
199
+ w(
200
+ "div",
201
+ {
202
+ class: l(`${t(i)}-horizontal-viewer__scrollbar`)
203
+ },
204
+ [
205
+ w(
206
+ "div",
207
+ {
208
+ ref_key: "scrollbarDragRef",
209
+ ref: g,
210
+ class: l(`${t(i)}-horizontal-viewer__scrollbar-drag`)
211
+ },
212
+ null,
213
+ 2
214
+ /* CLASS */
215
+ )
216
+ ],
217
+ 2
218
+ /* CLASS */
219
+ )
220
+ ],
221
+ 2
222
+ /* CLASS */
223
+ )
224
+ ],
225
+ 6
226
+ /* CLASS, STYLE */
227
+ )
228
+ ],
229
+ 6
230
+ /* CLASS, STYLE */
231
+ ));
232
+ }
233
+ }), ue = /* @__PURE__ */ P({
234
+ __name: "mb-viewer",
235
+ props: {
236
+ title: {},
237
+ desc: {},
238
+ isMobile: { type: Boolean },
239
+ extraTopSpacing: {},
240
+ extraBottomSpacing: {},
241
+ modelValue: {},
242
+ dataList: {},
243
+ swiperOptions: {},
244
+ effect: {},
245
+ showIntro: { type: Boolean },
246
+ videoProps: {},
247
+ indicatorClass: {},
248
+ tabIndicatorBottom: {},
249
+ widthType: {},
250
+ indicatorType: {},
251
+ showIndicator: { type: Boolean },
252
+ indicatorPosition: {}
253
+ },
254
+ setup(c) {
255
+ const v = c, a = y();
256
+ return (_, n) => (o(), s(
257
+ "div",
258
+ {
259
+ ref_key: "rootRef",
260
+ ref: a,
261
+ class: l(`${t(i)}-horizontal-viewer-mb`)
262
+ },
263
+ [
264
+ G(
265
+ t(ge),
266
+ W(v, { indicatorType: "image" }),
267
+ null,
268
+ 16
269
+ /* FULL_PROPS */
270
+ )
271
+ ],
272
+ 2
273
+ /* CLASS */
274
+ ));
275
+ }
276
+ }), F = /* @__PURE__ */ P({
277
+ __name: "horizontal-viewer",
278
+ props: {
279
+ title: {},
280
+ desc: {},
281
+ isMobile: { type: Boolean },
282
+ extraTopSpacing: {},
283
+ extraBottomSpacing: {},
284
+ modelValue: {},
285
+ dataList: {},
286
+ swiperOptions: {},
287
+ effect: {},
288
+ showIntro: { type: Boolean },
289
+ videoProps: {},
290
+ indicatorClass: {},
291
+ tabIndicatorBottom: {},
292
+ widthType: {},
293
+ indicatorType: {},
294
+ showIndicator: { type: Boolean, default: !0 },
295
+ indicatorPosition: {}
296
+ },
297
+ setup(c) {
298
+ const v = c;
299
+ return (a, _) => a.isMobile ? (o(), I(
300
+ ue,
301
+ Y(W({ key: 0 }, v)),
302
+ null,
303
+ 16
304
+ /* FULL_PROPS */
305
+ )) : (o(), I(
306
+ de,
307
+ Y(W({ key: 1 }, v)),
308
+ null,
309
+ 16
310
+ /* FULL_PROPS */
311
+ ));
312
+ }
313
+ });
314
+ F.install = (c) => (c.component("ScHorizontalViewer", F), c);
315
+ const Ve = F, pe = ["onClick"], fe = ["innerHTML"], me = ["innerHTML"], D = /* @__PURE__ */ P({
316
+ __name: "image-indicator",
317
+ props: {
318
+ dataList: {},
319
+ showIntro: { type: Boolean, default: !0 }
320
+ },
321
+ emits: ["change"],
322
+ setup(c, { emit: v }) {
323
+ const a = v, _ = y(0), n = y([]), f = C(() => {
324
+ const d = n.value[_.value];
325
+ return {
326
+ height: `${d == null ? void 0 : d.offsetHeight}px`
327
+ };
328
+ }), g = (d) => {
329
+ _.value = d, a("change", d);
330
+ };
331
+ return (d, L) => (o(), s(
332
+ "div",
333
+ {
334
+ class: l(`${t(i)}-image-indicator`)
335
+ },
336
+ [
337
+ w(
338
+ "div",
339
+ {
340
+ class: l(`${t(i)}-image-indicator__list`)
341
+ },
342
+ [
343
+ (o(!0), s(
344
+ R,
345
+ null,
346
+ N(d.dataList, (m, b) => (o(), s("div", {
347
+ key: m.url,
348
+ class: l([
349
+ `${t(i)}-image-indicator__list-item`,
350
+ _.value === b ? `${t(i)}-image-indicator__active` : ""
351
+ ]),
352
+ onClick: (k) => g(b)
353
+ }, [
354
+ G(t(A), {
355
+ src: m.url,
356
+ alt: m.alt
357
+ }, null, 8, ["src", "alt"])
358
+ ], 10, pe))),
359
+ 128
360
+ /* KEYED_FRAGMENT */
361
+ ))
362
+ ],
363
+ 2
364
+ /* CLASS */
365
+ ),
366
+ d.showIntro ? (o(), s(
367
+ "div",
368
+ {
369
+ key: 0,
370
+ class: l(`${t(i)}-image-indicator__intro`),
371
+ style: E(f.value)
372
+ },
373
+ [
374
+ (o(!0), s(
375
+ R,
376
+ null,
377
+ N(d.dataList, (m, b) => (o(), s(
378
+ "div",
379
+ {
380
+ key: m.url,
381
+ ref_for: !0,
382
+ ref_key: "introItemRef",
383
+ ref: n,
384
+ class: l([`${t(i)}-image-indicator__intro-item`, _.value === b && `${t(i)}-image-indicator__active`])
385
+ },
386
+ [
387
+ m.title ? (o(), s("p", {
388
+ key: 0,
389
+ class: l(`${t(i)}-image-indicator__intro-title`),
390
+ innerHTML: m.title
391
+ }, null, 10, fe)) : S("v-if", !0),
392
+ m.desc ? (o(), s("p", {
393
+ key: 1,
394
+ class: l(`${t(i)}-image-indicator__intro-desc`),
395
+ innerHTML: m.desc
396
+ }, null, 10, me)) : S("v-if", !0)
397
+ ],
398
+ 2
399
+ /* CLASS */
400
+ ))),
401
+ 128
402
+ /* KEYED_FRAGMENT */
403
+ ))
404
+ ],
405
+ 6
406
+ /* CLASS, STYLE */
407
+ )) : S("v-if", !0)
408
+ ],
409
+ 2
410
+ /* CLASS */
411
+ ));
412
+ }
413
+ });
414
+ D.install = (c) => (c.component("ScImageIndicator", D), c);
415
+ const ve = D, he = { class: "swiper-wrapper" }, U = /* @__PURE__ */ P({
416
+ __name: "swiper-normal",
417
+ props: {
418
+ modelValue: { default: 0 },
419
+ dataList: {},
420
+ swiperOptions: { default: () => ({}) },
421
+ effect: {},
422
+ showIntro: { type: Boolean, default: !0 },
423
+ videoProps: {},
424
+ indicatorClass: {},
425
+ tabIndicatorBottom: {},
426
+ widthType: { default: "full" },
427
+ indicatorType: { default: "tab" },
428
+ showIndicator: { type: Boolean, default: !0 },
429
+ indicatorPosition: { default: "relative" }
430
+ },
431
+ emits: ["change", "update:modelValue"],
432
+ setup(c, { emit: v }) {
433
+ const a = c, _ = v;
434
+ let n = null;
435
+ const f = y(a.modelValue), g = y(), d = C(() => {
436
+ const e = [`${i}-swiper-main`];
437
+ return a.widthType === "middle" ? e.push(`${i}-swiper-main__middle`) : e.push(`${i}-swiper-main__full`), e;
438
+ }), L = C(() => {
439
+ const e = {};
440
+ return a.tabIndicatorBottom && (e.position = "absolute", e.zIndex = 1, e.bottom = typeof a.tabIndicatorBottom == "number" ? `${a.tabIndicatorBottom}px` : a.tabIndicatorBottom), e;
441
+ });
442
+ Z(
443
+ () => a.modelValue,
444
+ () => {
445
+ f.value = a.modelValue, b(f.value);
446
+ }
447
+ );
448
+ const m = C(() => a.dataList.map((e) => ({
449
+ ...e,
450
+ url: e.type === "img" ? e.url || "" : e.poster || ""
451
+ }))), b = (e) => {
452
+ n == null || n.slideTo(e);
453
+ }, k = () => {
454
+ n == null || n.destroy(), g.value && (n = new ne(g.value, {
455
+ slidesPerView: 1,
456
+ allowTouchMove: !1,
457
+ effect: a.effect,
458
+ navigation: {
459
+ nextEl: ".swiper-button-next",
460
+ prevEl: ".swiper-button-prev"
461
+ },
462
+ ...a.swiperOptions
463
+ }), n.on("slideChange", (e) => {
464
+ f.value = e.activeIndex, _("change", e.activeIndex), _("update:modelValue", e.activeIndex);
465
+ }));
466
+ };
467
+ return j(() => {
468
+ k(), window.addEventListener("resize", k);
469
+ }), q(() => {
470
+ n == null || n.destroy(), window.removeEventListener("resize", k);
471
+ }), (e, $) => (o(), s(
472
+ "div",
473
+ {
474
+ class: l(`${t(i)}-swiper`)
475
+ },
476
+ [
477
+ w(
478
+ "div",
479
+ {
480
+ ref_key: "swiperRef",
481
+ ref: g,
482
+ class: l(d.value)
483
+ },
484
+ [
485
+ w("div", he, [
486
+ (o(!0), s(
487
+ R,
488
+ null,
489
+ N(e.dataList, (h, B) => (o(), s("div", {
490
+ key: h.title,
491
+ class: "swiper-slide"
492
+ }, [
493
+ h.type === "img" ? (o(), I(t(A), {
494
+ key: 0,
495
+ src: h.url,
496
+ alt: h.alt
497
+ }, null, 8, ["src", "alt"])) : (o(), I(t(J), W({
498
+ key: 1,
499
+ ref_for: !0
500
+ }, e.videoProps, {
501
+ url: h.url,
502
+ poster: h.poster,
503
+ playable: f.value === B
504
+ }), null, 16, ["url", "poster", "playable"])),
505
+ h.mask ? (o(), s(
506
+ "div",
507
+ {
508
+ key: 2,
509
+ class: l(`${t(i)}-swiper-mask`)
510
+ },
511
+ null,
512
+ 2
513
+ /* CLASS */
514
+ )) : S("v-if", !0)
515
+ ]))),
516
+ 128
517
+ /* KEYED_FRAGMENT */
518
+ ))
519
+ ]),
520
+ $[2] || ($[2] = oe('<div class="swiper-button-next"><svg xmlns="http://www.w3.org/2000/svg" width="25" height="24" viewBox="0 0 25 24" fill="none"><path d="M9.64299 3.12871L9.51887 5.83301L15.6859 12L9.51887 18.167L9.64299 20.8713L18.5143 12L9.64299 3.12871Z" fill="white"></path></svg></div><div class="swiper-button-prev"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15.1289 3.12871L15.2531 5.83301L9.08609 12L15.2531 18.167L15.1289 20.8713L6.25766 12L15.1289 3.12871Z" fill="white"></path></svg></div>', 2))
521
+ ],
522
+ 2
523
+ /* CLASS */
524
+ ),
525
+ e.showIndicator ? (o(), s(
526
+ R,
527
+ { key: 0 },
528
+ [
529
+ e.indicatorType === "tab" ? (o(), I(t(ie), {
530
+ key: 0,
531
+ modelValue: f.value,
532
+ "onUpdate:modelValue": $[0] || ($[0] = (h) => f.value = h),
533
+ class: l([e.indicatorClass, e.indicatorPosition === "absolute" && `${t(i)}-swiper-indicator-absolute`]),
534
+ dataList: e.dataList,
535
+ "show-intro": e.showIntro,
536
+ style: E(L.value),
537
+ onChange: b
538
+ }, null, 8, ["modelValue", "class", "dataList", "show-intro", "style"])) : (o(), I(t(ve), {
539
+ key: 1,
540
+ modelValue: f.value,
541
+ "onUpdate:modelValue": $[1] || ($[1] = (h) => f.value = h),
542
+ dataList: m.value,
543
+ onChange: b
544
+ }, null, 8, ["modelValue", "dataList"]))
545
+ ],
546
+ 64
547
+ /* STABLE_FRAGMENT */
548
+ )) : S("v-if", !0)
549
+ ],
550
+ 2
551
+ /* CLASS */
552
+ ));
553
+ }
554
+ });
555
+ U.install = (c) => (c.component("ScSwiperNormal", U), c);
556
+ const ge = U;
557
+ export {
558
+ Ve as S,
559
+ ve as a,
560
+ ge as b
561
+ };