@iris.interactive/handcook 2.6.3 → 2.6.6
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/package.json
CHANGED
|
@@ -20,24 +20,37 @@ import './modal.component.scss';
|
|
|
20
20
|
|
|
21
21
|
export class HcModal {
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
defaultOptions = {
|
|
25
|
-
src: '',
|
|
26
|
-
type: 'inline'
|
|
27
|
-
}
|
|
23
|
+
options = {};
|
|
28
24
|
|
|
29
25
|
constructor(elements = ElementEnum.modal, overrideOptions = {}) {
|
|
30
|
-
let options = {};
|
|
31
|
-
Object.assign(options, this.defaultOptions, overrideOptions);
|
|
32
26
|
document.querySelectorAll(elements).forEach(element => {
|
|
33
|
-
|
|
34
|
-
this.instance.push(Fancybox.bind(element));
|
|
27
|
+
Fancybox.bind(element);
|
|
35
28
|
element.addEventListener('click', (e) => {
|
|
36
29
|
e.preventDefault();
|
|
37
|
-
|
|
30
|
+
this.initOptions();
|
|
31
|
+
Object.assign(this.options, overrideOptions);
|
|
32
|
+
this.options.src = this.options.src != '' ? this.options.src : (e.currentTarget.hasAttribute('href') ? e.currentTarget.getAttribute('href') : (e.currentTarget.hasAttribute('data-hc-src') ? e.currentTarget.dataset.hcSrc : ''));
|
|
33
|
+
this.options.parentEl = this.options.parentEl !== null ? document.querySelector(this.options.parentEl) : (e.currentTarget.hasAttribute('data-hc-modal-parent') ? document.querySelector(e.currentTarget.getAttribute('data-hc-modal-parent')) : '');
|
|
34
|
+
Fancybox.show([this.options]);
|
|
38
35
|
});
|
|
39
36
|
});
|
|
40
37
|
}
|
|
38
|
+
|
|
39
|
+
static show(options) {
|
|
40
|
+
Fancybox.show([options]);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static close(all) {
|
|
44
|
+
Fancybox.close(all);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
initOptions() {
|
|
48
|
+
this.options = {
|
|
49
|
+
src: '',
|
|
50
|
+
type: 'inline',
|
|
51
|
+
parentEl: null
|
|
52
|
+
};
|
|
53
|
+
}
|
|
41
54
|
}
|
|
42
55
|
|
|
43
56
|
const hc_modal = function (trigger, options) {
|
|
@@ -38,22 +38,55 @@ export class HcSlider {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
setOptions() {
|
|
41
|
-
|
|
42
|
-
const attr = this.slider.getAttribute('data-hc-' + option);
|
|
43
|
-
if (attr !== null) {
|
|
44
|
-
if (typeof option === "boolean") {
|
|
45
|
-
this.options[option] = attr !== false;
|
|
46
|
-
} else {
|
|
47
|
-
this.options[option] = attr;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const attr = this.slider.getAttribute('data-hc-autoplay');
|
|
41
|
+
const attr = this.slider.getAttribute('data-hc-slider-autoplay');
|
|
52
42
|
if (attr !== null) {
|
|
53
43
|
this.options['autoplay'] = {
|
|
54
44
|
delay: attr
|
|
55
45
|
}
|
|
56
46
|
}
|
|
47
|
+
|
|
48
|
+
const gap = this.slider.getAttribute('data-hc-slider-gap');
|
|
49
|
+
const slidesPerView = this.slider.getAttribute('data-hc-slider-slides-per-view');
|
|
50
|
+
if (gap !== null) {
|
|
51
|
+
this.options['spaceBetween'] = parseFloat(gap);
|
|
52
|
+
}
|
|
53
|
+
if (slidesPerView !== null) {
|
|
54
|
+
this.options['slidesPerView'] = parseFloat(slidesPerView);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const gapMedium = this.slider.getAttribute('data-hc-slider-gap-medium');
|
|
58
|
+
const slidesPerViewMedium = this.slider.getAttribute('data-hc-slider-slides-per-view-medium');
|
|
59
|
+
if (gapMedium !== null) {
|
|
60
|
+
this.options['breakpoints'][650]['spaceBetween'] = parseFloat(gapMedium);
|
|
61
|
+
}
|
|
62
|
+
if (slidesPerViewMedium !== null) {
|
|
63
|
+
this.options['breakpoints'][650]['slidesPerView'] = parseFloat(slidesPerViewMedium);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const gapLarge = this.slider.getAttribute('data-hc-slider-gap-large');
|
|
67
|
+
const slidesPerViewLarge = this.slider.getAttribute('data-hc-slider-slides-per-view-large');
|
|
68
|
+
if (gapLarge !== null) {
|
|
69
|
+
this.options['breakpoints']['1000']['spaceBetween'] = parseFloat(gapLarge);
|
|
70
|
+
}
|
|
71
|
+
if (slidesPerViewLarge !== null) {
|
|
72
|
+
this.options['breakpoints']['1000']['slidesPerView'] = parseFloat(slidesPerViewLarge);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const gapXlarge = this.slider.getAttribute('data-hc-slider-gap-xlarge');
|
|
76
|
+
const slidesPerViewXlarge = this.slider.getAttribute('data-hc-slider-slides-per-view-xlarge');
|
|
77
|
+
if (gapXlarge !== null) {
|
|
78
|
+
this.options['breakpoints']['1453']['spaceBetween'] = parseFloat(gapXlarge);
|
|
79
|
+
}
|
|
80
|
+
if (slidesPerViewXlarge !== null) {
|
|
81
|
+
this.options['breakpoints']['1453']['slidesPerView'] = parseFloat(slidesPerViewXlarge);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const freeMode = this.slider.getAttribute('data-hc-slider-free-mode');
|
|
85
|
+
if (freeMode !== null) {
|
|
86
|
+
this.options['freeMode'] = {
|
|
87
|
+
enabled: true
|
|
88
|
+
}
|
|
89
|
+
}
|
|
57
90
|
}
|
|
58
91
|
|
|
59
92
|
buildDom() {
|
|
@@ -66,7 +99,6 @@ export class HcSlider {
|
|
|
66
99
|
|
|
67
100
|
// On ajoute la classe swiper a notre slider,
|
|
68
101
|
// on crée la div wrapper et on insére les slider item dedans
|
|
69
|
-
this.slider.classList.add('swiper');
|
|
70
102
|
const wrapperElement = document.createElement("div");
|
|
71
103
|
wrapperElement.classList.add("swiper-wrapper");
|
|
72
104
|
this.slider.appendChild(wrapperElement);
|
|
@@ -114,7 +146,7 @@ export class HcSlider {
|
|
|
114
146
|
|
|
115
147
|
initOptions() {
|
|
116
148
|
this.options = {
|
|
117
|
-
slidesPerView:
|
|
149
|
+
slidesPerView: 4,
|
|
118
150
|
pagination: false,
|
|
119
151
|
navigation: false,
|
|
120
152
|
mousewheel: {
|
|
@@ -145,6 +177,11 @@ export class HcSlider {
|
|
|
145
177
|
swiper.$el.find('.swiper-slide-next').addClass('hc-slider-slide-next');
|
|
146
178
|
swiper.$el.find('.swiper-slide-prev').addClass('hc-slider-slide-prev');
|
|
147
179
|
}
|
|
180
|
+
},
|
|
181
|
+
breakpoints: {
|
|
182
|
+
650: {},
|
|
183
|
+
1000: {},
|
|
184
|
+
1453: {},
|
|
148
185
|
}
|
|
149
186
|
};
|
|
150
187
|
}
|
|
@@ -41,7 +41,7 @@ export class HcTooltip {
|
|
|
41
41
|
Object.assign(options, this.defaultOptions, overrideOptions);
|
|
42
42
|
options.trigger = options.trigger != '' ? options.trigger : (element.hasAttribute(TooltipEnum.attrPopover) ? "click" : "mouseenter focus");
|
|
43
43
|
options.content = options.content != '' ? options.content : (element.hasAttribute(TooltipEnum.attrContent) ? element.getAttribute(TooltipEnum.attrContent) : '');
|
|
44
|
-
options.placement = options.placement != '' ? options.placement : (element.hasAttribute(TooltipEnum.attrPlacement) ? element.getAttribute(TooltipEnum.attrPlacement) : '');
|
|
44
|
+
options.placement = options.placement != '' ? options.placement : (element.hasAttribute(TooltipEnum.attrPlacement) ? element.getAttribute(TooltipEnum.attrPlacement) : 'bottom');
|
|
45
45
|
if (options.trigger === 'click') {
|
|
46
46
|
element.addEventListener('click', (e) => {
|
|
47
47
|
e.preventDefault();
|