@covet-pics/covet-pics-widget 0.169.1 → 0.169.2
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/cjs/{a11y-CK4x8GGD.js → a11y-DFTngZna.js} +456 -3
- package/dist/cjs/{covet-pics-direct-buy_7.cjs.entry.js → covet-pics-direct-buy_6.cjs.entry.js} +27 -247
- package/dist/cjs/covet-pics-gallery-grid_6.cjs.entry.js +15062 -0
- package/dist/cjs/covet-pics-gallery-header_3.cjs.entry.js +867 -0
- package/dist/cjs/covet-pics-highlighted-hotspots_2.cjs.entry.js +7 -8
- package/dist/cjs/{covet-pics-popup-freeflow-carousel_2.cjs.entry.js → covet-pics-popup-freeflow-carousel_3.cjs.entry.js} +241 -4
- package/dist/cjs/covet-pics-widget.cjs.entry.js +80 -41
- package/dist/cjs/covet-pics-widget.cjs.js +1 -1
- package/dist/cjs/{popupFuncComponents-CnC52E_i.js → funcComponents-CfVw6fo-.js} +28 -35
- package/dist/cjs/{getters-D8jVc2zI.js → getters-CfegpAq-.js} +22 -4
- package/dist/cjs/items-CADjiXI2.js +33 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{navigation-CYe27V90.js → navigation-XeIeQQXp.js} +1 -1
- package/dist/cjs/{popup-BLOuNMa1.js → popup-D7H4OHzy.js} +78 -33
- package/dist/cjs/popupFuncComponents-BMXR6oUT.js +43 -0
- package/dist/cjs/{slider-C9n0gjmk.js → slider-DKsGC7_c.js} +21 -1
- package/dist/cjs/sort-DqDz43Zk.js +30 -0
- package/dist/collection/components/covet-pics-gallery-grid/covet-pics-gallery-grid.js +9 -167
- package/dist/collection/components/covet-pics-gallery-item/covet-pics-gallery-item.js +5 -2
- package/dist/collection/components/covet-pics-gallery-item-detail/covet-pics-gallery-item-detail.js +6 -2
- package/dist/collection/components/covet-pics-gallery-slider/covet-pics-gallery-slider.js +34 -173
- package/dist/collection/components/covet-pics-popup/covet-gallery-popup.css +43 -0
- package/dist/collection/components/covet-pics-popup/covet-pics-popup-slider.js +34 -3
- package/dist/collection/components/covet-pics-popup/covet-pics-popup.js +120 -113
- package/dist/collection/components/covet-pics-popup-freeflow/covet-pics-popup-freeflow.js +29 -26
- package/dist/collection/components/covet-pics-popup-freeflow/covet-pics-popup-slide.js +23 -1
- package/dist/collection/components/covet-pics-popup-links/covet-gallery-popup-links.css +1 -0
- package/dist/collection/components/covet-pics-upload/covet-gallery-upload.css +43 -0
- package/dist/collection/components/covet-pics-upload/covet-pics-upload.js +61 -38
- package/dist/collection/components/covet-pics-widget/covet-pics-widget.js +80 -38
- package/dist/collection/store/getters.js +20 -4
- package/dist/collection/store/items.js +25 -0
- package/dist/collection/store/popup.js +70 -28
- package/dist/collection/store/reducer.js +6 -4
- package/dist/collection/store/upload.js +20 -0
- package/dist/covet-pics-widget/covet-pics-widget.esm.js +1 -1
- package/dist/covet-pics-widget/{p-5624938d.entry.js → p-046d9c7d.entry.js} +1 -1
- package/dist/covet-pics-widget/p-108c8b8a.entry.js +4 -0
- package/dist/covet-pics-widget/p-13825b0f.entry.js +4 -0
- package/dist/covet-pics-widget/p-22d562ee.entry.js +4 -0
- package/dist/covet-pics-widget/{p-49fe4508.entry.js → p-5cc07632.entry.js} +1 -1
- package/dist/covet-pics-widget/{p-cb32cd08.entry.js → p-6e1b1797.entry.js} +1 -1
- package/dist/covet-pics-widget/p-7947aca5.entry.js +4 -0
- package/dist/covet-pics-widget/p-CAi6kQk0.js +4 -0
- package/dist/covet-pics-widget/p-CLHluiN7.js +4 -0
- package/dist/covet-pics-widget/p-CpJH5xCN.js +4 -0
- package/dist/covet-pics-widget/{p-BODOgEuN.js → p-D8MPbUL8.js} +1 -1
- package/dist/covet-pics-widget/{p-Cg1R57T9.js → p-DA9YXXNi.js} +1 -1
- package/dist/covet-pics-widget/{p-DsyTUwCw.js → p-DVsh_O2H.js} +1 -1
- package/dist/covet-pics-widget/p-EDoZiRHa.js +4 -0
- package/dist/covet-pics-widget/p-UzW4UXdJ.js +4 -0
- package/dist/covet-pics-widget/p-a74d3938.entry.js +4 -0
- package/dist/covet-pics-widget/p-af37dd54.entry.js +47 -0
- package/dist/covet-pics-widget/p-sycwJ1v1.js +4 -0
- package/dist/covet-pics-widget/{p-B68hw7d9.js → p-vTnGj8u1.js} +1 -1
- package/dist/esm/{a11y-BM21er6f.js → a11y-sycwJ1v1.js} +456 -1
- package/dist/esm/covet-pics-crop-text.entry.js +1 -1
- package/dist/esm/{covet-pics-direct-buy_7.entry.js → covet-pics-direct-buy_6.entry.js} +26 -245
- package/dist/esm/covet-pics-gallery-grid_6.entry.js +15055 -0
- package/dist/esm/covet-pics-gallery-header_3.entry.js +863 -0
- package/dist/esm/covet-pics-highlighted-hotspots_2.entry.js +4 -5
- package/dist/esm/{covet-pics-popup-freeflow-carousel_2.entry.js → covet-pics-popup-freeflow-carousel_3.entry.js} +241 -5
- package/dist/esm/covet-pics-post.entry.js +1 -1
- package/dist/esm/covet-pics-star-rating.entry.js +1 -1
- package/dist/esm/covet-pics-widget.entry.js +80 -41
- package/dist/esm/covet-pics-widget.js +1 -1
- package/dist/esm/{popupFuncComponents-76LYIj-8.js → funcComponents-gMx_QmoA.js} +1 -35
- package/dist/esm/{getters-C5ofYrUT.js → getters-CAi6kQk0.js} +21 -5
- package/dist/esm/items-BoG6bDU1.js +28 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{navigation-xBso107Y.js → navigation-tjGnaVXK.js} +1 -1
- package/dist/esm/{popup-B68hw7d9.js → popup-vTnGj8u1.js} +72 -30
- package/dist/esm/popupFuncComponents-BraeS1Sr.js +41 -0
- package/dist/esm/{slider-DfItksrM.js → slider-DaKjQSC5.js} +19 -2
- package/dist/esm/sort-BcLZV3pF.js +27 -0
- package/dist/esm/{utils-BODOgEuN.js → utils-D8MPbUL8.js} +1 -1
- package/dist/types/components/covet-pics-gallery-grid/covet-pics-gallery-grid.d.ts +1 -37
- package/dist/types/components/covet-pics-gallery-slider/covet-pics-gallery-slider.d.ts +5 -39
- package/dist/types/components/covet-pics-popup/covet-pics-popup-slider.d.ts +5 -0
- package/dist/types/components/covet-pics-popup/covet-pics-popup.d.ts +9 -14
- package/dist/types/components/covet-pics-popup-freeflow/covet-pics-popup-freeflow.d.ts +2 -2
- package/dist/types/components/covet-pics-popup-freeflow/covet-pics-popup-slide.d.ts +4 -0
- package/dist/types/components/covet-pics-upload/covet-pics-upload.d.ts +4 -2
- package/dist/types/components/covet-pics-widget/covet-pics-widget.d.ts +6 -3
- package/dist/types/components.d.ts +26 -54
- package/dist/types/store/getters.d.ts +2 -0
- package/dist/types/store/items.d.ts +3 -0
- package/dist/types/store/popup.d.ts +9 -5
- package/dist/types/store/upload.d.ts +5 -0
- package/package.json +1 -1
- package/dist/cjs/_commonjsHelpers-bNhl0hAp.js +0 -13
- package/dist/cjs/covet-pics-gallery-grid_3.cjs.entry.js +0 -5339
- package/dist/cjs/covet-pics-gallery-header_6.cjs.entry.js +0 -10696
- package/dist/cjs/modals-CcLPCudv.js +0 -51
- package/dist/cjs/pagination-B5Ad17kw.js +0 -463
- package/dist/collection/store/modals.js +0 -21
- package/dist/covet-pics-widget/p-40055ed4.entry.js +0 -23
- package/dist/covet-pics-widget/p-5ae26b01.entry.js +0 -4
- package/dist/covet-pics-widget/p-802afafc.entry.js +0 -28
- package/dist/covet-pics-widget/p-8e246791.entry.js +0 -4
- package/dist/covet-pics-widget/p-BJA1jk-5.js +0 -4
- package/dist/covet-pics-widget/p-BM21er6f.js +0 -4
- package/dist/covet-pics-widget/p-Bzxn1cid.js +0 -4
- package/dist/covet-pics-widget/p-C5ofYrUT.js +0 -4
- package/dist/covet-pics-widget/p-CP5h6CHJ.js +0 -4
- package/dist/covet-pics-widget/p-DVa63jZy.js +0 -4
- package/dist/covet-pics-widget/p-b6eb92eb.entry.js +0 -4
- package/dist/covet-pics-widget/p-f94cd032.entry.js +0 -4
- package/dist/esm/_commonjsHelpers-DVa63jZy.js +0 -10
- package/dist/esm/covet-pics-gallery-grid_3.entry.js +0 -5335
- package/dist/esm/covet-pics-gallery-header_6.entry.js +0 -10689
- package/dist/esm/modals-B4bZnaAK.js +0 -45
- package/dist/esm/pagination-C5Wsf2-B.js +0 -461
- package/dist/types/store/modals.d.ts +0 -6
|
@@ -4426,6 +4426,461 @@ function classesToSelector(classes) {
|
|
|
4426
4426
|
.replace(/ /g, '.')}`;
|
|
4427
4427
|
}
|
|
4428
4428
|
|
|
4429
|
+
function Pagination(_ref) {
|
|
4430
|
+
let {
|
|
4431
|
+
swiper,
|
|
4432
|
+
extendParams,
|
|
4433
|
+
on,
|
|
4434
|
+
emit
|
|
4435
|
+
} = _ref;
|
|
4436
|
+
const pfx = 'swiper-pagination';
|
|
4437
|
+
extendParams({
|
|
4438
|
+
pagination: {
|
|
4439
|
+
el: null,
|
|
4440
|
+
bulletElement: 'span',
|
|
4441
|
+
clickable: false,
|
|
4442
|
+
hideOnClick: false,
|
|
4443
|
+
renderBullet: null,
|
|
4444
|
+
renderProgressbar: null,
|
|
4445
|
+
renderFraction: null,
|
|
4446
|
+
renderCustom: null,
|
|
4447
|
+
progressbarOpposite: false,
|
|
4448
|
+
type: 'bullets',
|
|
4449
|
+
// 'bullets' or 'progressbar' or 'fraction' or 'custom'
|
|
4450
|
+
dynamicBullets: false,
|
|
4451
|
+
dynamicMainBullets: 1,
|
|
4452
|
+
formatFractionCurrent: number => number,
|
|
4453
|
+
formatFractionTotal: number => number,
|
|
4454
|
+
bulletClass: `${pfx}-bullet`,
|
|
4455
|
+
bulletActiveClass: `${pfx}-bullet-active`,
|
|
4456
|
+
modifierClass: `${pfx}-`,
|
|
4457
|
+
currentClass: `${pfx}-current`,
|
|
4458
|
+
totalClass: `${pfx}-total`,
|
|
4459
|
+
hiddenClass: `${pfx}-hidden`,
|
|
4460
|
+
progressbarFillClass: `${pfx}-progressbar-fill`,
|
|
4461
|
+
progressbarOppositeClass: `${pfx}-progressbar-opposite`,
|
|
4462
|
+
clickableClass: `${pfx}-clickable`,
|
|
4463
|
+
lockClass: `${pfx}-lock`,
|
|
4464
|
+
horizontalClass: `${pfx}-horizontal`,
|
|
4465
|
+
verticalClass: `${pfx}-vertical`,
|
|
4466
|
+
paginationDisabledClass: `${pfx}-disabled`
|
|
4467
|
+
}
|
|
4468
|
+
});
|
|
4469
|
+
swiper.pagination = {
|
|
4470
|
+
el: null,
|
|
4471
|
+
bullets: []
|
|
4472
|
+
};
|
|
4473
|
+
let bulletSize;
|
|
4474
|
+
let dynamicBulletIndex = 0;
|
|
4475
|
+
function isPaginationDisabled() {
|
|
4476
|
+
return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0;
|
|
4477
|
+
}
|
|
4478
|
+
function setSideBullets(bulletEl, position) {
|
|
4479
|
+
const {
|
|
4480
|
+
bulletActiveClass
|
|
4481
|
+
} = swiper.params.pagination;
|
|
4482
|
+
if (!bulletEl) return;
|
|
4483
|
+
bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];
|
|
4484
|
+
if (bulletEl) {
|
|
4485
|
+
bulletEl.classList.add(`${bulletActiveClass}-${position}`);
|
|
4486
|
+
bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];
|
|
4487
|
+
if (bulletEl) {
|
|
4488
|
+
bulletEl.classList.add(`${bulletActiveClass}-${position}-${position}`);
|
|
4489
|
+
}
|
|
4490
|
+
}
|
|
4491
|
+
}
|
|
4492
|
+
function getMoveDirection(prevIndex, nextIndex, length) {
|
|
4493
|
+
prevIndex = prevIndex % length;
|
|
4494
|
+
nextIndex = nextIndex % length;
|
|
4495
|
+
if (nextIndex === prevIndex + 1) {
|
|
4496
|
+
return 'next';
|
|
4497
|
+
} else if (nextIndex === prevIndex - 1) {
|
|
4498
|
+
return 'previous';
|
|
4499
|
+
}
|
|
4500
|
+
return;
|
|
4501
|
+
}
|
|
4502
|
+
function onBulletClick(e) {
|
|
4503
|
+
const bulletEl = e.target.closest(classesToSelector(swiper.params.pagination.bulletClass));
|
|
4504
|
+
if (!bulletEl) {
|
|
4505
|
+
return;
|
|
4506
|
+
}
|
|
4507
|
+
e.preventDefault();
|
|
4508
|
+
const index = elementIndex(bulletEl) * swiper.params.slidesPerGroup;
|
|
4509
|
+
if (swiper.params.loop) {
|
|
4510
|
+
if (swiper.realIndex === index) return;
|
|
4511
|
+
const moveDirection = getMoveDirection(swiper.realIndex, index, swiper.slides.length);
|
|
4512
|
+
if (moveDirection === 'next') {
|
|
4513
|
+
swiper.slideNext();
|
|
4514
|
+
} else if (moveDirection === 'previous') {
|
|
4515
|
+
swiper.slidePrev();
|
|
4516
|
+
} else {
|
|
4517
|
+
swiper.slideToLoop(index);
|
|
4518
|
+
}
|
|
4519
|
+
} else {
|
|
4520
|
+
swiper.slideTo(index);
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
function update() {
|
|
4524
|
+
// Render || Update Pagination bullets/items
|
|
4525
|
+
const rtl = swiper.rtl;
|
|
4526
|
+
const params = swiper.params.pagination;
|
|
4527
|
+
if (isPaginationDisabled()) return;
|
|
4528
|
+
let el = swiper.pagination.el;
|
|
4529
|
+
el = makeElementsArray(el);
|
|
4530
|
+
// Current/Total
|
|
4531
|
+
let current;
|
|
4532
|
+
let previousIndex;
|
|
4533
|
+
const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
|
|
4534
|
+
const total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
|
|
4535
|
+
if (swiper.params.loop) {
|
|
4536
|
+
previousIndex = swiper.previousRealIndex || 0;
|
|
4537
|
+
current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex;
|
|
4538
|
+
} else if (typeof swiper.snapIndex !== 'undefined') {
|
|
4539
|
+
current = swiper.snapIndex;
|
|
4540
|
+
previousIndex = swiper.previousSnapIndex;
|
|
4541
|
+
} else {
|
|
4542
|
+
previousIndex = swiper.previousIndex || 0;
|
|
4543
|
+
current = swiper.activeIndex || 0;
|
|
4544
|
+
}
|
|
4545
|
+
// Types
|
|
4546
|
+
if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
|
|
4547
|
+
const bullets = swiper.pagination.bullets;
|
|
4548
|
+
let firstIndex;
|
|
4549
|
+
let lastIndex;
|
|
4550
|
+
let midIndex;
|
|
4551
|
+
if (params.dynamicBullets) {
|
|
4552
|
+
bulletSize = elementOuterSize(bullets[0], swiper.isHorizontal() ? 'width' : 'height');
|
|
4553
|
+
el.forEach(subEl => {
|
|
4554
|
+
subEl.style[swiper.isHorizontal() ? 'width' : 'height'] = `${bulletSize * (params.dynamicMainBullets + 4)}px`;
|
|
4555
|
+
});
|
|
4556
|
+
if (params.dynamicMainBullets > 1 && previousIndex !== undefined) {
|
|
4557
|
+
dynamicBulletIndex += current - (previousIndex || 0);
|
|
4558
|
+
if (dynamicBulletIndex > params.dynamicMainBullets - 1) {
|
|
4559
|
+
dynamicBulletIndex = params.dynamicMainBullets - 1;
|
|
4560
|
+
} else if (dynamicBulletIndex < 0) {
|
|
4561
|
+
dynamicBulletIndex = 0;
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
4564
|
+
firstIndex = Math.max(current - dynamicBulletIndex, 0);
|
|
4565
|
+
lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);
|
|
4566
|
+
midIndex = (lastIndex + firstIndex) / 2;
|
|
4567
|
+
}
|
|
4568
|
+
bullets.forEach(bulletEl => {
|
|
4569
|
+
const classesToRemove = [...['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`)].map(s => typeof s === 'string' && s.includes(' ') ? s.split(' ') : s).flat();
|
|
4570
|
+
bulletEl.classList.remove(...classesToRemove);
|
|
4571
|
+
});
|
|
4572
|
+
if (el.length > 1) {
|
|
4573
|
+
bullets.forEach(bullet => {
|
|
4574
|
+
const bulletIndex = elementIndex(bullet);
|
|
4575
|
+
if (bulletIndex === current) {
|
|
4576
|
+
bullet.classList.add(...params.bulletActiveClass.split(' '));
|
|
4577
|
+
} else if (swiper.isElement) {
|
|
4578
|
+
bullet.setAttribute('part', 'bullet');
|
|
4579
|
+
}
|
|
4580
|
+
if (params.dynamicBullets) {
|
|
4581
|
+
if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {
|
|
4582
|
+
bullet.classList.add(...`${params.bulletActiveClass}-main`.split(' '));
|
|
4583
|
+
}
|
|
4584
|
+
if (bulletIndex === firstIndex) {
|
|
4585
|
+
setSideBullets(bullet, 'prev');
|
|
4586
|
+
}
|
|
4587
|
+
if (bulletIndex === lastIndex) {
|
|
4588
|
+
setSideBullets(bullet, 'next');
|
|
4589
|
+
}
|
|
4590
|
+
}
|
|
4591
|
+
});
|
|
4592
|
+
} else {
|
|
4593
|
+
const bullet = bullets[current];
|
|
4594
|
+
if (bullet) {
|
|
4595
|
+
bullet.classList.add(...params.bulletActiveClass.split(' '));
|
|
4596
|
+
}
|
|
4597
|
+
if (swiper.isElement) {
|
|
4598
|
+
bullets.forEach((bulletEl, bulletIndex) => {
|
|
4599
|
+
bulletEl.setAttribute('part', bulletIndex === current ? 'bullet-active' : 'bullet');
|
|
4600
|
+
});
|
|
4601
|
+
}
|
|
4602
|
+
if (params.dynamicBullets) {
|
|
4603
|
+
const firstDisplayedBullet = bullets[firstIndex];
|
|
4604
|
+
const lastDisplayedBullet = bullets[lastIndex];
|
|
4605
|
+
for (let i = firstIndex; i <= lastIndex; i += 1) {
|
|
4606
|
+
if (bullets[i]) {
|
|
4607
|
+
bullets[i].classList.add(...`${params.bulletActiveClass}-main`.split(' '));
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
4610
|
+
setSideBullets(firstDisplayedBullet, 'prev');
|
|
4611
|
+
setSideBullets(lastDisplayedBullet, 'next');
|
|
4612
|
+
}
|
|
4613
|
+
}
|
|
4614
|
+
if (params.dynamicBullets) {
|
|
4615
|
+
const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);
|
|
4616
|
+
const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize;
|
|
4617
|
+
const offsetProp = rtl ? 'right' : 'left';
|
|
4618
|
+
bullets.forEach(bullet => {
|
|
4619
|
+
bullet.style[swiper.isHorizontal() ? offsetProp : 'top'] = `${bulletsOffset}px`;
|
|
4620
|
+
});
|
|
4621
|
+
}
|
|
4622
|
+
}
|
|
4623
|
+
el.forEach((subEl, subElIndex) => {
|
|
4624
|
+
if (params.type === 'fraction') {
|
|
4625
|
+
subEl.querySelectorAll(classesToSelector(params.currentClass)).forEach(fractionEl => {
|
|
4626
|
+
fractionEl.textContent = params.formatFractionCurrent(current + 1);
|
|
4627
|
+
});
|
|
4628
|
+
subEl.querySelectorAll(classesToSelector(params.totalClass)).forEach(totalEl => {
|
|
4629
|
+
totalEl.textContent = params.formatFractionTotal(total);
|
|
4630
|
+
});
|
|
4631
|
+
}
|
|
4632
|
+
if (params.type === 'progressbar') {
|
|
4633
|
+
let progressbarDirection;
|
|
4634
|
+
if (params.progressbarOpposite) {
|
|
4635
|
+
progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';
|
|
4636
|
+
} else {
|
|
4637
|
+
progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';
|
|
4638
|
+
}
|
|
4639
|
+
const scale = (current + 1) / total;
|
|
4640
|
+
let scaleX = 1;
|
|
4641
|
+
let scaleY = 1;
|
|
4642
|
+
if (progressbarDirection === 'horizontal') {
|
|
4643
|
+
scaleX = scale;
|
|
4644
|
+
} else {
|
|
4645
|
+
scaleY = scale;
|
|
4646
|
+
}
|
|
4647
|
+
subEl.querySelectorAll(classesToSelector(params.progressbarFillClass)).forEach(progressEl => {
|
|
4648
|
+
progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`;
|
|
4649
|
+
progressEl.style.transitionDuration = `${swiper.params.speed}ms`;
|
|
4650
|
+
});
|
|
4651
|
+
}
|
|
4652
|
+
if (params.type === 'custom' && params.renderCustom) {
|
|
4653
|
+
subEl.innerHTML = params.renderCustom(swiper, current + 1, total);
|
|
4654
|
+
if (subElIndex === 0) emit('paginationRender', subEl);
|
|
4655
|
+
} else {
|
|
4656
|
+
if (subElIndex === 0) emit('paginationRender', subEl);
|
|
4657
|
+
emit('paginationUpdate', subEl);
|
|
4658
|
+
}
|
|
4659
|
+
if (swiper.params.watchOverflow && swiper.enabled) {
|
|
4660
|
+
subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
|
|
4661
|
+
}
|
|
4662
|
+
});
|
|
4663
|
+
}
|
|
4664
|
+
function render() {
|
|
4665
|
+
// Render Container
|
|
4666
|
+
const params = swiper.params.pagination;
|
|
4667
|
+
if (isPaginationDisabled()) return;
|
|
4668
|
+
const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.grid && swiper.params.grid.rows > 1 ? swiper.slides.length / Math.ceil(swiper.params.grid.rows) : swiper.slides.length;
|
|
4669
|
+
let el = swiper.pagination.el;
|
|
4670
|
+
el = makeElementsArray(el);
|
|
4671
|
+
let paginationHTML = '';
|
|
4672
|
+
if (params.type === 'bullets') {
|
|
4673
|
+
let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;
|
|
4674
|
+
if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) {
|
|
4675
|
+
numberOfBullets = slidesLength;
|
|
4676
|
+
}
|
|
4677
|
+
for (let i = 0; i < numberOfBullets; i += 1) {
|
|
4678
|
+
if (params.renderBullet) {
|
|
4679
|
+
paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);
|
|
4680
|
+
} else {
|
|
4681
|
+
// prettier-ignore
|
|
4682
|
+
paginationHTML += `<${params.bulletElement} ${swiper.isElement ? 'part="bullet"' : ''} class="${params.bulletClass}"></${params.bulletElement}>`;
|
|
4683
|
+
}
|
|
4684
|
+
}
|
|
4685
|
+
}
|
|
4686
|
+
if (params.type === 'fraction') {
|
|
4687
|
+
if (params.renderFraction) {
|
|
4688
|
+
paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);
|
|
4689
|
+
} else {
|
|
4690
|
+
paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`;
|
|
4691
|
+
}
|
|
4692
|
+
}
|
|
4693
|
+
if (params.type === 'progressbar') {
|
|
4694
|
+
if (params.renderProgressbar) {
|
|
4695
|
+
paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);
|
|
4696
|
+
} else {
|
|
4697
|
+
paginationHTML = `<span class="${params.progressbarFillClass}"></span>`;
|
|
4698
|
+
}
|
|
4699
|
+
}
|
|
4700
|
+
swiper.pagination.bullets = [];
|
|
4701
|
+
el.forEach(subEl => {
|
|
4702
|
+
if (params.type !== 'custom') {
|
|
4703
|
+
subEl.innerHTML = paginationHTML || '';
|
|
4704
|
+
}
|
|
4705
|
+
if (params.type === 'bullets') {
|
|
4706
|
+
swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass)));
|
|
4707
|
+
}
|
|
4708
|
+
});
|
|
4709
|
+
if (params.type !== 'custom') {
|
|
4710
|
+
emit('paginationRender', el[0]);
|
|
4711
|
+
}
|
|
4712
|
+
}
|
|
4713
|
+
function init() {
|
|
4714
|
+
swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, {
|
|
4715
|
+
el: 'swiper-pagination'
|
|
4716
|
+
});
|
|
4717
|
+
const params = swiper.params.pagination;
|
|
4718
|
+
if (!params.el) return;
|
|
4719
|
+
let el;
|
|
4720
|
+
if (typeof params.el === 'string' && swiper.isElement) {
|
|
4721
|
+
el = swiper.el.querySelector(params.el);
|
|
4722
|
+
}
|
|
4723
|
+
if (!el && typeof params.el === 'string') {
|
|
4724
|
+
el = [...document.querySelectorAll(params.el)];
|
|
4725
|
+
}
|
|
4726
|
+
if (!el) {
|
|
4727
|
+
el = params.el;
|
|
4728
|
+
}
|
|
4729
|
+
if (!el || el.length === 0) return;
|
|
4730
|
+
if (swiper.params.uniqueNavElements && typeof params.el === 'string' && Array.isArray(el) && el.length > 1) {
|
|
4731
|
+
el = [...swiper.el.querySelectorAll(params.el)];
|
|
4732
|
+
// check if it belongs to another nested Swiper
|
|
4733
|
+
if (el.length > 1) {
|
|
4734
|
+
el = el.find(subEl => {
|
|
4735
|
+
if (elementParents(subEl, '.swiper')[0] !== swiper.el) return false;
|
|
4736
|
+
return true;
|
|
4737
|
+
});
|
|
4738
|
+
}
|
|
4739
|
+
}
|
|
4740
|
+
if (Array.isArray(el) && el.length === 1) el = el[0];
|
|
4741
|
+
Object.assign(swiper.pagination, {
|
|
4742
|
+
el
|
|
4743
|
+
});
|
|
4744
|
+
el = makeElementsArray(el);
|
|
4745
|
+
el.forEach(subEl => {
|
|
4746
|
+
if (params.type === 'bullets' && params.clickable) {
|
|
4747
|
+
subEl.classList.add(...(params.clickableClass || '').split(' '));
|
|
4748
|
+
}
|
|
4749
|
+
subEl.classList.add(params.modifierClass + params.type);
|
|
4750
|
+
subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
4751
|
+
if (params.type === 'bullets' && params.dynamicBullets) {
|
|
4752
|
+
subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`);
|
|
4753
|
+
dynamicBulletIndex = 0;
|
|
4754
|
+
if (params.dynamicMainBullets < 1) {
|
|
4755
|
+
params.dynamicMainBullets = 1;
|
|
4756
|
+
}
|
|
4757
|
+
}
|
|
4758
|
+
if (params.type === 'progressbar' && params.progressbarOpposite) {
|
|
4759
|
+
subEl.classList.add(params.progressbarOppositeClass);
|
|
4760
|
+
}
|
|
4761
|
+
if (params.clickable) {
|
|
4762
|
+
subEl.addEventListener('click', onBulletClick);
|
|
4763
|
+
}
|
|
4764
|
+
if (!swiper.enabled) {
|
|
4765
|
+
subEl.classList.add(params.lockClass);
|
|
4766
|
+
}
|
|
4767
|
+
});
|
|
4768
|
+
}
|
|
4769
|
+
function destroy() {
|
|
4770
|
+
const params = swiper.params.pagination;
|
|
4771
|
+
if (isPaginationDisabled()) return;
|
|
4772
|
+
let el = swiper.pagination.el;
|
|
4773
|
+
if (el) {
|
|
4774
|
+
el = makeElementsArray(el);
|
|
4775
|
+
el.forEach(subEl => {
|
|
4776
|
+
subEl.classList.remove(params.hiddenClass);
|
|
4777
|
+
subEl.classList.remove(params.modifierClass + params.type);
|
|
4778
|
+
subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
4779
|
+
if (params.clickable) {
|
|
4780
|
+
subEl.classList.remove(...(params.clickableClass || '').split(' '));
|
|
4781
|
+
subEl.removeEventListener('click', onBulletClick);
|
|
4782
|
+
}
|
|
4783
|
+
});
|
|
4784
|
+
}
|
|
4785
|
+
if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(subEl => subEl.classList.remove(...params.bulletActiveClass.split(' ')));
|
|
4786
|
+
}
|
|
4787
|
+
on('changeDirection', () => {
|
|
4788
|
+
if (!swiper.pagination || !swiper.pagination.el) return;
|
|
4789
|
+
const params = swiper.params.pagination;
|
|
4790
|
+
let {
|
|
4791
|
+
el
|
|
4792
|
+
} = swiper.pagination;
|
|
4793
|
+
el = makeElementsArray(el);
|
|
4794
|
+
el.forEach(subEl => {
|
|
4795
|
+
subEl.classList.remove(params.horizontalClass, params.verticalClass);
|
|
4796
|
+
subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);
|
|
4797
|
+
});
|
|
4798
|
+
});
|
|
4799
|
+
on('init', () => {
|
|
4800
|
+
if (swiper.params.pagination.enabled === false) {
|
|
4801
|
+
// eslint-disable-next-line
|
|
4802
|
+
disable();
|
|
4803
|
+
} else {
|
|
4804
|
+
init();
|
|
4805
|
+
render();
|
|
4806
|
+
update();
|
|
4807
|
+
}
|
|
4808
|
+
});
|
|
4809
|
+
on('activeIndexChange', () => {
|
|
4810
|
+
if (typeof swiper.snapIndex === 'undefined') {
|
|
4811
|
+
update();
|
|
4812
|
+
}
|
|
4813
|
+
});
|
|
4814
|
+
on('snapIndexChange', () => {
|
|
4815
|
+
update();
|
|
4816
|
+
});
|
|
4817
|
+
on('snapGridLengthChange', () => {
|
|
4818
|
+
render();
|
|
4819
|
+
update();
|
|
4820
|
+
});
|
|
4821
|
+
on('destroy', () => {
|
|
4822
|
+
destroy();
|
|
4823
|
+
});
|
|
4824
|
+
on('enable disable', () => {
|
|
4825
|
+
let {
|
|
4826
|
+
el
|
|
4827
|
+
} = swiper.pagination;
|
|
4828
|
+
if (el) {
|
|
4829
|
+
el = makeElementsArray(el);
|
|
4830
|
+
el.forEach(subEl => subEl.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.pagination.lockClass));
|
|
4831
|
+
}
|
|
4832
|
+
});
|
|
4833
|
+
on('lock unlock', () => {
|
|
4834
|
+
update();
|
|
4835
|
+
});
|
|
4836
|
+
on('click', (_s, e) => {
|
|
4837
|
+
const targetEl = e.target;
|
|
4838
|
+
const el = makeElementsArray(swiper.pagination.el);
|
|
4839
|
+
if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) {
|
|
4840
|
+
if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return;
|
|
4841
|
+
const isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass);
|
|
4842
|
+
if (isHidden === true) {
|
|
4843
|
+
emit('paginationShow');
|
|
4844
|
+
} else {
|
|
4845
|
+
emit('paginationHide');
|
|
4846
|
+
}
|
|
4847
|
+
el.forEach(subEl => subEl.classList.toggle(swiper.params.pagination.hiddenClass));
|
|
4848
|
+
}
|
|
4849
|
+
});
|
|
4850
|
+
const enable = () => {
|
|
4851
|
+
swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass);
|
|
4852
|
+
let {
|
|
4853
|
+
el
|
|
4854
|
+
} = swiper.pagination;
|
|
4855
|
+
if (el) {
|
|
4856
|
+
el = makeElementsArray(el);
|
|
4857
|
+
el.forEach(subEl => subEl.classList.remove(swiper.params.pagination.paginationDisabledClass));
|
|
4858
|
+
}
|
|
4859
|
+
init();
|
|
4860
|
+
render();
|
|
4861
|
+
update();
|
|
4862
|
+
};
|
|
4863
|
+
const disable = () => {
|
|
4864
|
+
swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass);
|
|
4865
|
+
let {
|
|
4866
|
+
el
|
|
4867
|
+
} = swiper.pagination;
|
|
4868
|
+
if (el) {
|
|
4869
|
+
el = makeElementsArray(el);
|
|
4870
|
+
el.forEach(subEl => subEl.classList.add(swiper.params.pagination.paginationDisabledClass));
|
|
4871
|
+
}
|
|
4872
|
+
destroy();
|
|
4873
|
+
};
|
|
4874
|
+
Object.assign(swiper.pagination, {
|
|
4875
|
+
enable,
|
|
4876
|
+
disable,
|
|
4877
|
+
render,
|
|
4878
|
+
update,
|
|
4879
|
+
init,
|
|
4880
|
+
destroy
|
|
4881
|
+
});
|
|
4882
|
+
}
|
|
4883
|
+
|
|
4429
4884
|
function A11y(_ref) {
|
|
4430
4885
|
let {
|
|
4431
4886
|
swiper,
|
|
@@ -4797,15 +5252,13 @@ function A11y(_ref) {
|
|
|
4797
5252
|
}
|
|
4798
5253
|
|
|
4799
5254
|
exports.A11y = A11y;
|
|
5255
|
+
exports.Pagination = Pagination;
|
|
4800
5256
|
exports.Swiper = Swiper;
|
|
4801
5257
|
exports.classesToSelector = classesToSelector;
|
|
4802
5258
|
exports.classesToTokens = classesToTokens;
|
|
4803
5259
|
exports.createElement = createElement;
|
|
4804
5260
|
exports.createElementIfNotDefined = createElementIfNotDefined;
|
|
4805
|
-
exports.elementIndex = elementIndex;
|
|
4806
5261
|
exports.elementOffset = elementOffset;
|
|
4807
|
-
exports.elementOuterSize = elementOuterSize;
|
|
4808
|
-
exports.elementParents = elementParents;
|
|
4809
5262
|
exports.elementTransitionEnd = elementTransitionEnd;
|
|
4810
5263
|
exports.getDocument = getDocument;
|
|
4811
5264
|
exports.getSlideTransformEl = getSlideTransformEl;
|