@everymatrix/casino-slider 1.4.1 → 1.5.3
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 +27 -18
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@everymatrix/casino-slider",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.5.3",
|
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": "455c9a0d14fef23d3698fbea37042c69e3aeed24"
|
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;
|
@@ -141,18 +142,25 @@
|
|
141
142
|
fetch(url.href)
|
142
143
|
.then((res:any) => res.json())
|
143
144
|
.then((data:any) => {
|
144
|
-
|
145
|
-
|
145
|
+
data.index = index;
|
146
|
+
subGroupsData = subGroupsData.concat(data);
|
147
|
+
|
146
148
|
if(showsubgroups == 'false') {
|
147
149
|
window.postMessage({ type: actionevent, itemId: item.id, index, item }, window.location.href);
|
148
150
|
} else {
|
149
|
-
if(trigger == 'navigation' && subGroupsData.
|
151
|
+
if(trigger == 'navigation' && subGroupsData.length <= 0) {
|
150
152
|
window.postMessage({ type: actionevent, itemId: item.id, index, item }, window.location.href);
|
151
153
|
}
|
152
154
|
}
|
153
155
|
|
154
|
-
//Send subgroups ids
|
155
|
-
|
156
|
+
//Send list of subgroups ids
|
157
|
+
const subGroupsIds: any[] = [];
|
158
|
+
subGroupsData.map(subGroup => {
|
159
|
+
subGroup.items.forEach(item => subGroupsIds.push(item.id));
|
160
|
+
return subGroupsIds.flat();
|
161
|
+
});
|
162
|
+
window.postMessage({type: 'SubgroupsIds', subGroupsIds: subGroupsIds});
|
163
|
+
|
156
164
|
|
157
165
|
}).then(() => {
|
158
166
|
if(carousel.querySelectorAll(".DropDown")) scrollHandler();
|
@@ -241,6 +249,7 @@
|
|
241
249
|
<ul id="CarouselNav" class="CarouselItems" part="CarouselItems" bind:this={carousel}>
|
242
250
|
<li class="TouchOnly"><a href="#CarouselNav">Close Subs</a></li>
|
243
251
|
{#if sliderdata.length > 0}
|
252
|
+
|
244
253
|
{#each sliderdata as category, index (category.id)}
|
245
254
|
<li class="CarouselItem {activeIndex == index || prevIndex == index ? 'active': ''}
|
246
255
|
{location == 'headerMain' ? '' : 'SecondaryMenu'}"
|
@@ -252,18 +261,18 @@
|
|
252
261
|
<a href="#">{category.name}</a>
|
253
262
|
{/if}
|
254
263
|
{#if itemsActive[index] == true}
|
255
|
-
{#if subGroupsData
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
264
|
+
{#if subGroupsData.length > 0 && showsubgroups == 'true'}
|
265
|
+
<ul class="DropDown">
|
266
|
+
{#each subGroupsData as subGroup}
|
267
|
+
{#each subGroup.items as subGroupItem, subindex (subGroupItem.id)}
|
268
|
+
{#if index == subGroup.index}
|
269
|
+
<li on:click={e => { handleClick(category, index, subGroupItem, subindex, 'secondary'); e.stopPropagation();}}>
|
270
|
+
<a class="SubDropDown {index == activeIndex && (activeSubIndex == subindex || prevSubIndex == subindex) ? 'active': ''}">{subGroupItem?.name}</a>
|
271
|
+
</li>
|
272
|
+
{/if}
|
273
|
+
{/each}
|
274
|
+
{/each}
|
275
|
+
</ul>
|
267
276
|
{/if}
|
268
277
|
{/if}
|
269
278
|
</li>
|