@everymatrix/casino-slider 1.5.2 → 1.5.4
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/casino-slider.js +1 -1
- package/dist/casino-slider.js.map +1 -1
- package/package.json +2 -2
- package/src/CasinoSlider.svelte +31 -27
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@everymatrix/casino-slider",
|
3
|
-
"version": "1.5.
|
3
|
+
"version": "1.5.4",
|
4
4
|
"main": "dist/casino-slider.js",
|
5
5
|
"svelte": "src/index.ts",
|
6
6
|
"scripts": {
|
@@ -36,5 +36,5 @@
|
|
36
36
|
"publishConfig": {
|
37
37
|
"access": "public"
|
38
38
|
},
|
39
|
-
"gitHead": "
|
39
|
+
"gitHead": "0515078fefc5290a183afcfb2608cf265f2322c7"
|
40
40
|
}
|
package/src/CasinoSlider.svelte
CHANGED
@@ -54,7 +54,7 @@
|
|
54
54
|
let prevSubIndex:number;
|
55
55
|
let customStylingContainer:HTMLElement;
|
56
56
|
let sliderdata:Array<any> = [];
|
57
|
-
let subGroupsData: any;
|
57
|
+
let subGroupsData: any[] = [];
|
58
58
|
let itemsActive:Array<boolean> = [];
|
59
59
|
let scroller:HTMLElement;
|
60
60
|
|
@@ -75,6 +75,7 @@
|
|
75
75
|
prevSubIndex = null;
|
76
76
|
return;
|
77
77
|
}
|
78
|
+
|
78
79
|
activeSubIndex = subIndex;
|
79
80
|
activeSubIndex = activeSubIndex;
|
80
81
|
prevSubIndex = activeSubIndex;
|
@@ -86,9 +87,6 @@
|
|
86
87
|
left: -250,
|
87
88
|
behavior: 'smooth'
|
88
89
|
});
|
89
|
-
if(showsubgroups == 'true') {
|
90
|
-
obtainSubcategories();
|
91
|
-
}
|
92
90
|
}
|
93
91
|
|
94
92
|
let scrollRight = ():void => {
|
@@ -96,9 +94,6 @@
|
|
96
94
|
left: +250,
|
97
95
|
behavior: 'smooth'
|
98
96
|
});
|
99
|
-
if(showsubgroups == 'true') {
|
100
|
-
obtainSubcategories();
|
101
|
-
}
|
102
97
|
}
|
103
98
|
|
104
99
|
const setActiveIndex = ():void => {
|
@@ -106,9 +101,6 @@
|
|
106
101
|
if (!prevIndex) {
|
107
102
|
prevIndex = activeIndex;
|
108
103
|
}
|
109
|
-
if(showsubgroups == 'true') {
|
110
|
-
obtainSubcategories();
|
111
|
-
}
|
112
104
|
}
|
113
105
|
|
114
106
|
const messageHandler = (e:any):void => {
|
@@ -141,18 +133,29 @@
|
|
141
133
|
fetch(url.href)
|
142
134
|
.then((res:any) => res.json())
|
143
135
|
.then((data:any) => {
|
144
|
-
|
145
|
-
|
136
|
+
data.index = index;
|
137
|
+
subGroupsData = subGroupsData.concat(data);
|
138
|
+
|
146
139
|
if(showsubgroups == 'false') {
|
147
140
|
window.postMessage({ type: actionevent, itemId: item.id, index, item }, window.location.href);
|
148
141
|
} else {
|
149
|
-
if(trigger == 'navigation' && subGroupsData.
|
142
|
+
if(trigger == 'navigation' && subGroupsData.length <= 0) {
|
150
143
|
window.postMessage({ type: actionevent, itemId: item.id, index, item }, window.location.href);
|
151
144
|
}
|
152
145
|
}
|
153
146
|
|
154
|
-
//Send subgroups ids
|
155
|
-
|
147
|
+
//Send list of subgroups ids
|
148
|
+
const subGroupsIds: any[] = [];
|
149
|
+
subGroupsData.map(subGroup => {
|
150
|
+
subGroup.items.forEach(item => {
|
151
|
+
if(!subGroupsIds.find(id => item.id == id)){
|
152
|
+
subGroupsIds.push(item.id);
|
153
|
+
}
|
154
|
+
});
|
155
|
+
return subGroupsIds.flat();
|
156
|
+
});
|
157
|
+
window.postMessage({type: 'SubgroupsIds', subGroupsIds: subGroupsIds});
|
158
|
+
|
156
159
|
|
157
160
|
}).then(() => {
|
158
161
|
if(carousel.querySelectorAll(".DropDown")) scrollHandler();
|
@@ -241,6 +244,7 @@
|
|
241
244
|
<ul id="CarouselNav" class="CarouselItems" part="CarouselItems" bind:this={carousel}>
|
242
245
|
<li class="TouchOnly"><a href="#CarouselNav">Close Subs</a></li>
|
243
246
|
{#if sliderdata.length > 0}
|
247
|
+
|
244
248
|
{#each sliderdata as category, index (category.id)}
|
245
249
|
<li class="CarouselItem {activeIndex == index || prevIndex == index ? 'active': ''}
|
246
250
|
{location == 'headerMain' ? '' : 'SecondaryMenu'}"
|
@@ -252,18 +256,18 @@
|
|
252
256
|
<a href="#">{category.name}</a>
|
253
257
|
{/if}
|
254
258
|
{#if itemsActive[index] == true}
|
255
|
-
{#if subGroupsData
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
259
|
+
{#if subGroupsData.length > 0 && showsubgroups == 'true'}
|
260
|
+
<ul class="DropDown">
|
261
|
+
{#each subGroupsData as subGroup}
|
262
|
+
{#each subGroup.items as subGroupItem, subindex (subGroupItem.id)}
|
263
|
+
{#if index == subGroup.index}
|
264
|
+
<li on:click={e => { handleClick(category, index, subGroupItem, subindex, 'secondary'); e.stopPropagation();}}>
|
265
|
+
<a class="SubDropDown {index == activeIndex && (activeSubIndex == subindex || prevSubIndex == subindex) ? 'active': ''}">{subGroupItem?.name}</a>
|
266
|
+
</li>
|
267
|
+
{/if}
|
268
|
+
{/each}
|
269
|
+
{/each}
|
270
|
+
</ul>
|
267
271
|
{/if}
|
268
272
|
{/if}
|
269
273
|
</li>
|