@ppg_pl/pallete 2.0.18 → 2.0.19
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/loader.cjs.js +1 -1
- package/dist/cjs/my-backdrop_8.cjs.entry.js +111 -45
- package/dist/cjs/my-backdrop_8.cjs.entry.js.map +1 -1
- package/dist/cjs/pallete.cjs.js +1 -1
- package/dist/collection/components/api/index.js +2 -2
- package/dist/collection/components/api/index.js.map +1 -1
- package/dist/collection/components/api/services.js +17 -0
- package/dist/collection/components/api/services.js.map +1 -1
- package/dist/collection/components/my-component/my-component.js +19 -1
- package/dist/collection/components/my-component/my-component.js.map +1 -1
- package/dist/collection/components/my-modal/my-modal.css +58 -14
- package/dist/collection/components/my-modal/my-modal.js +106 -35
- package/dist/collection/components/my-modal/my-modal.js.map +1 -1
- package/dist/collection/components/my-search/my-search.css +2 -2
- package/dist/collection/components/my-search/my-search.js +1 -1
- package/dist/collection/components/my-search/my-search.js.map +1 -1
- package/dist/collection/utils/index.js +12 -0
- package/dist/collection/utils/index.js.map +1 -0
- package/dist/components/index2.js +2 -2
- package/dist/components/index2.js.map +1 -1
- package/dist/components/my-component.js +3 -1
- package/dist/components/my-component.js.map +1 -1
- package/dist/components/my-modal2.js +107 -40
- package/dist/components/my-modal2.js.map +1 -1
- package/dist/components/my-search2.js +2 -2
- package/dist/components/my-search2.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/my-backdrop_8.entry.js +111 -45
- package/dist/esm/my-backdrop_8.entry.js.map +1 -1
- package/dist/esm/pallete.js +1 -1
- package/dist/pallete/p-a3b655d5.entry.js +2 -0
- package/dist/pallete/p-a3b655d5.entry.js.map +1 -0
- package/dist/pallete/pallete.esm.js +1 -1
- package/dist/pallete/pallete.esm.js.map +1 -1
- package/dist/types/components/api/services.d.ts +1 -0
- package/dist/types/components/my-component/my-component.d.ts +1 -0
- package/dist/types/components/my-modal/my-modal.d.ts +8 -2
- package/dist/types/components.d.ts +4 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +1 -1
- package/www/build/p-a3b655d5.entry.js +2 -0
- package/www/build/p-a3b655d5.entry.js.map +1 -0
- package/www/build/pallete.esm.js +1 -1
- package/www/build/pallete.esm.js.map +1 -1
- package/www/index.html +3 -1
- package/dist/pallete/p-64135b01.entry.js +0 -2
- package/dist/pallete/p-64135b01.entry.js.map +0 -1
- package/www/build/p-64135b01.entry.js +0 -2
- package/www/build/p-64135b01.entry.js.map +0 -1
package/dist/cjs/pallete.cjs.js
CHANGED
|
@@ -20,7 +20,7 @@ const patchBrowser = () => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
patchBrowser().then(options => {
|
|
23
|
-
return index.bootstrapLazy([["my-backdrop_8.cjs",[[2,"my-component",{"shop":[1],"product":[1],"baselink":[1],"show":[32],"readyToClose":[32],"open":[64],"close":[64]},[[0,"readyToCLose","setReadyToCloseHandler"],[0,"close","closeModalHandler"]]],[0,"my-modal",{"shop":[1],"product":[1],"baselink":[1],"closeImage":[1,"close-image"],"arrowDown":[1,"arrow-down"],"chunksNum":[32],"data":[32],"preloader":[32],"loading":[32],"colors":[32],"currentColor":[32],"currentIndex":[32],"infoBoxWidth":[32],"boxWidth":[32],"padding":[32],"isMobile":[32],"showRange":[32],"colorCategories":[32],"selectedCategory":[32],"page":[32],"open":[64]},[[0,"closeInfoBox","closeInfoBoxHandler"],[9,"resize","handleResize"],[0,"searchColors","searchColorsHandler"]]],[0,"my-backdrop"],[0,"my-colorinfo",{"currentColor":[16],"shop":[1],"product":[1],"baselink":[1],"data":[16],"isMobile":[4,"is-mobile"],"infoBoxWidth":[2,"info-box-width"],"closeImage":[1,"close-image"]}],[0,"my-colorbox",{"color":[1],"name":[1],"shop":[1],"product":[1],"isActive":[4,"is-active"],"isCategoryActive":[4,"is-category-active"],"isImageInsteadHex":[16]}],[2,"my-loader"],[2,"my-search",{"productId":[2,"product-id"],"isMobile":[4,"is-mobile"],"searchIcon":[1,"search-icon"],"searchText":[32]},[[4,"clearSearchText","clearSearchTextHandler"]]],[0,"my-slider",{"slides":[16],"shop":[1],"product":[1],"color":[1]}]]]], options);
|
|
23
|
+
return index.bootstrapLazy([["my-backdrop_8.cjs",[[2,"my-component",{"shop":[1],"product":[1],"baselink":[1],"colorname":[1],"show":[32],"readyToClose":[32],"open":[64],"close":[64]},[[0,"readyToCLose","setReadyToCloseHandler"],[0,"close","closeModalHandler"]]],[0,"my-modal",{"shop":[1],"product":[1],"baselink":[1],"selectedcolor":[1],"closeImage":[1,"close-image"],"arrowDown":[1,"arrow-down"],"chunksNum":[32],"data":[32],"preloader":[32],"loading":[32],"colors":[32],"currentColor":[32],"currentIndex":[32],"infoBoxWidth":[32],"boxWidth":[32],"padding":[32],"isMobile":[32],"showRange":[32],"colorCategories":[32],"selectedCategory":[32],"page":[32],"colorIsSelected":[32],"open":[64]},[[0,"closeInfoBox","closeInfoBoxHandler"],[9,"resize","handleResize"],[0,"searchColors","searchColorsHandler"]]],[0,"my-backdrop"],[0,"my-colorinfo",{"currentColor":[16],"shop":[1],"product":[1],"baselink":[1],"data":[16],"isMobile":[4,"is-mobile"],"infoBoxWidth":[2,"info-box-width"],"closeImage":[1,"close-image"]}],[0,"my-colorbox",{"color":[1],"name":[1],"shop":[1],"product":[1],"isActive":[4,"is-active"],"isCategoryActive":[4,"is-category-active"],"isImageInsteadHex":[16]}],[2,"my-loader"],[2,"my-search",{"productId":[2,"product-id"],"isMobile":[4,"is-mobile"],"searchIcon":[1,"search-icon"],"searchText":[32]},[[4,"clearSearchText","clearSearchTextHandler"]]],[0,"my-slider",{"slides":[16],"shop":[1],"product":[1],"color":[1]}]]]], options);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
exports.setNonce = index.setNonce;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// DEV/
|
|
2
|
-
// export const APIURL = 'http://
|
|
3
|
-
// export const accessToken = '
|
|
2
|
+
// export const APIURL = 'http://localhost:8055';
|
|
3
|
+
// export const accessToken = 'iGAWx696CkipbZDOESC8CBn3BF7xPaei';
|
|
4
4
|
// PROD
|
|
5
5
|
export const APIURL = 'https://color-selector.pl'; //'https://pallete-colors-backend.herokuapp.com';
|
|
6
6
|
export const accessToken = '8uZQSXi0wCxiY0UR8wp_Pe2gY86wVErp'; //'_baZ127gfvFIFmZ5umrrTBUUm6D7ve6p'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/api/index.ts"],"names":[],"mappings":"AAAA,OAAO;AACP,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/api/index.ts"],"names":[],"mappings":"AAAA,OAAO;AACP,iDAAiD;AACjD,iEAAiE;AAEjE,OAAO;AAEP,MAAM,CAAC,MAAM,MAAM,GAAG,2BAA2B,CAAC,CAAC,iDAAiD;AACpG,MAAM,CAAC,MAAM,WAAW,GAAG,kCAAkC,CAAC,CAAC,oCAAoC;AAEnG,MAAM,GAAG;EACP,KAAK,CAAC,OAAO,CAAC,EAAU;IACtB,IAAI;MACF,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,IAAI,EAAE,EAAE,EAAE;QAC7C,MAAM,EAAE,KAAK;QAEb,OAAO,EAAE;UACP,eAAe,EAAE,UAAU,WAAW,EAAE;UACxC,cAAc,EAAE,kBAAkB;SACnC;QACD,mBAAmB;OACpB,CAAC,CAAC;MAEH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;MAEtC,OAAO,QAAQ,CAAC;KACjB;IAAC,OAAO,KAAK,EAAE;MACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACtB;EACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC","sourcesContent":["// DEV/\n// export const APIURL = 'http://localhost:8055';\n// export const accessToken = 'iGAWx696CkipbZDOESC8CBn3BF7xPaei';\n\n// PROD\n\nexport const APIURL = 'https://color-selector.pl'; //'https://pallete-colors-backend.herokuapp.com';\nexport const accessToken = '8uZQSXi0wCxiY0UR8wp_Pe2gY86wVErp'; //'_baZ127gfvFIFmZ5umrrTBUUm6D7ve6p'\n\nclass API {\n async getData(ep: string) {\n try {\n const request = await fetch(`${APIURL}/${ep}`, {\n method: 'GET',\n\n headers: {\n 'Authorization': `Bearer ${accessToken}`,\n 'Content-Type': 'application/json',\n },\n // mode: 'no-cors',\n });\n\n const response = await request.json();\n\n return response;\n } catch (error) {\n console.error(error);\n }\n }\n}\n\nexport const ApiService = new API();\n"]}
|
|
@@ -46,4 +46,21 @@ export const fetchColorByNumber = (id, colorNumber) => qs.stringify({
|
|
|
46
46
|
}, {
|
|
47
47
|
encodeValuesOnly: true,
|
|
48
48
|
});
|
|
49
|
+
export const fetchColorByName = (id, colorName) => qs.stringify({
|
|
50
|
+
fields: ['*'].join(','),
|
|
51
|
+
filter: {
|
|
52
|
+
products: {
|
|
53
|
+
Product_id: {
|
|
54
|
+
_eq: id,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
name: {
|
|
58
|
+
_icontains: colorName,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
meta: '*',
|
|
62
|
+
limit: 100,
|
|
63
|
+
}, {
|
|
64
|
+
encodeValuesOnly: true,
|
|
65
|
+
});
|
|
49
66
|
//# sourceMappingURL=services.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../../src/components/api/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAC;AAEzB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EAAU,EAAE,IAAa,EAAE,EAAE,CACnE,EAAE,CAAC,SAAS,CACV;EACE,MAAM,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;EACrC,MAAM,EAAE;IACN,QAAQ,EAAE;MACR,UAAU,EAAE;QACV,GAAG,EAAE,EAAE;OACR;KACF;GACF;EAED,IAAI,EAAE,GAAG;EACT,IAAI,EAAE,IAAI,IAAI,CAAC;EACf,KAAK;CACN,EACD;EACE,gBAAgB,EAAE,IAAI;CACvB,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EAAU,EAAE,IAAa,EAAE,EAAE,CACpE,EAAE,CAAC,SAAS,CACV;EACE,MAAM,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;EACnD,MAAM,EAAE;IACN,QAAQ,EAAE;MACR,WAAW,EAAE;QACX,GAAG,EAAE,EAAE;OACR;KACF;GACF;EACD,IAAI,EAAE,GAAG;EACT,IAAI,EAAE,IAAI,IAAI,CAAC;EACf,KAAK;CACN,EACD;EACE,gBAAgB,EAAE,IAAI;CACvB,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAU,EAAE,WAAmB,EAAE,EAAE,CACpE,EAAE,CAAC,SAAS,CACV;EACE,MAAM,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;EACrC,MAAM,EAAE;IACN,QAAQ,EAAE;MACR,WAAW,EAAE;QACX,GAAG,EAAE,EAAE;OACR;KACF;IACD,MAAM,EAAE;MACN,SAAS,EAAE,WAAW;KACvB;GACF;EACD,IAAI,EAAE,GAAG;CACV,EAED;EACE,gBAAgB,EAAE,IAAI;CACvB,CACF,CAAC","sourcesContent":["import qs from 'qs';\n\nexport const limit = 100;\n\nexport const fetchProductColorsQuery = (id: string, page?: number) =>\n qs.stringify(\n {\n fields: ['*', 'products.*'].join(','),\n filter: {\n products: {\n Product_id: {\n _eq: id,\n },\n },\n },\n\n meta: '*',\n page: page || 1,\n limit,\n },\n {\n encodeValuesOnly: true,\n },\n );\n\nexport const fetchCategoryColorsQuery = (id: number, page?: number) =>\n qs.stringify(\n {\n fields: ['*', 'Category.*', 'products.*'].join(','),\n filter: {\n Category: {\n Category_id: {\n _eq: id,\n },\n },\n },\n meta: '*',\n page: page || 1,\n limit,\n },\n {\n encodeValuesOnly: true,\n },\n );\n\nexport const fetchColorByNumber = (id: number, colorNumber: string) =>\n qs.stringify(\n {\n fields: ['*', 'Category.*'].join(','),\n filter: {\n Category: {\n Category_id: {\n _eq: id,\n },\n },\n number: {\n _contains: colorNumber,\n },\n },\n meta: '*',\n },\n\n {\n encodeValuesOnly: true,\n },\n );\n"]}
|
|
1
|
+
{"version":3,"file":"services.js","sourceRoot":"","sources":["../../../src/components/api/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAC;AAEzB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EAAU,EAAE,IAAa,EAAE,EAAE,CACnE,EAAE,CAAC,SAAS,CACV;EACE,MAAM,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;EACrC,MAAM,EAAE;IACN,QAAQ,EAAE;MACR,UAAU,EAAE;QACV,GAAG,EAAE,EAAE;OACR;KACF;GACF;EAED,IAAI,EAAE,GAAG;EACT,IAAI,EAAE,IAAI,IAAI,CAAC;EACf,KAAK;CACN,EACD;EACE,gBAAgB,EAAE,IAAI;CACvB,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EAAU,EAAE,IAAa,EAAE,EAAE,CACpE,EAAE,CAAC,SAAS,CACV;EACE,MAAM,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;EACnD,MAAM,EAAE;IACN,QAAQ,EAAE;MACR,WAAW,EAAE;QACX,GAAG,EAAE,EAAE;OACR;KACF;GACF;EACD,IAAI,EAAE,GAAG;EACT,IAAI,EAAE,IAAI,IAAI,CAAC;EACf,KAAK;CACN,EACD;EACE,gBAAgB,EAAE,IAAI;CACvB,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAU,EAAE,WAAmB,EAAE,EAAE,CACpE,EAAE,CAAC,SAAS,CACV;EACE,MAAM,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;EACrC,MAAM,EAAE;IACN,QAAQ,EAAE;MACR,WAAW,EAAE;QACX,GAAG,EAAE,EAAE;OACR;KACF;IACD,MAAM,EAAE;MACN,SAAS,EAAE,WAAW;KACvB;GACF;EACD,IAAI,EAAE,GAAG;CACV,EAED;EACE,gBAAgB,EAAE,IAAI;CACvB,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAU,EAAE,SAAiB,EAAE,EAAE,CAChE,EAAE,CAAC,SAAS,CACV;EACE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;EACvB,MAAM,EAAE;IACN,QAAQ,EAAE;MACR,UAAU,EAAE;QACV,GAAG,EAAE,EAAE;OACR;KACF;IACD,IAAI,EAAE;MACJ,UAAU,EAAE,SAAS;KACtB;GACF;EACD,IAAI,EAAE,GAAG;EACT,KAAK,EAAE,GAAG;CACX,EAED;EACE,gBAAgB,EAAE,IAAI;CACvB,CACF,CAAC","sourcesContent":["import qs from 'qs';\n\nexport const limit = 100;\n\nexport const fetchProductColorsQuery = (id: string, page?: number) =>\n qs.stringify(\n {\n fields: ['*', 'products.*'].join(','),\n filter: {\n products: {\n Product_id: {\n _eq: id,\n },\n },\n },\n\n meta: '*',\n page: page || 1,\n limit,\n },\n {\n encodeValuesOnly: true,\n },\n );\n\nexport const fetchCategoryColorsQuery = (id: number, page?: number) =>\n qs.stringify(\n {\n fields: ['*', 'Category.*', 'products.*'].join(','),\n filter: {\n Category: {\n Category_id: {\n _eq: id,\n },\n },\n },\n meta: '*',\n page: page || 1,\n limit,\n },\n {\n encodeValuesOnly: true,\n },\n );\n\nexport const fetchColorByNumber = (id: number, colorNumber: string) =>\n qs.stringify(\n {\n fields: ['*', 'Category.*'].join(','),\n filter: {\n Category: {\n Category_id: {\n _eq: id,\n },\n },\n number: {\n _contains: colorNumber,\n },\n },\n meta: '*',\n },\n\n {\n encodeValuesOnly: true,\n },\n );\n\nexport const fetchColorByName = (id: string, colorName: string) =>\n qs.stringify(\n {\n fields: ['*'].join(','),\n filter: {\n products: {\n Product_id: {\n _eq: id,\n },\n },\n name: {\n _icontains: colorName,\n },\n },\n meta: '*',\n limit: 100,\n },\n\n {\n encodeValuesOnly: true,\n },\n );\n"]}
|
|
@@ -5,6 +5,7 @@ export class MyModalBundle {
|
|
|
5
5
|
this.shop = undefined;
|
|
6
6
|
this.product = undefined;
|
|
7
7
|
this.baselink = undefined;
|
|
8
|
+
this.colorname = undefined;
|
|
8
9
|
this.show = false;
|
|
9
10
|
this.readyToClose = false;
|
|
10
11
|
}
|
|
@@ -24,7 +25,7 @@ export class MyModalBundle {
|
|
|
24
25
|
render() {
|
|
25
26
|
let content = null;
|
|
26
27
|
if (this.show) {
|
|
27
|
-
content = [h("my-backdrop", null), h("my-modal", { shop: this.shop, product: this.product, baselink: this.baselink })];
|
|
28
|
+
content = [h("my-backdrop", null), h("my-modal", { shop: this.shop, product: this.product, baselink: this.baselink, selectedcolor: this.colorname })];
|
|
28
29
|
}
|
|
29
30
|
return (h("div", { onClick: () => {
|
|
30
31
|
if (this.readyToClose) {
|
|
@@ -105,6 +106,23 @@ export class MyModalBundle {
|
|
|
105
106
|
},
|
|
106
107
|
"attribute": "baselink",
|
|
107
108
|
"reflect": false
|
|
109
|
+
},
|
|
110
|
+
"colorname": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"mutable": false,
|
|
113
|
+
"complexType": {
|
|
114
|
+
"original": "string | null",
|
|
115
|
+
"resolved": "null | string",
|
|
116
|
+
"references": {}
|
|
117
|
+
},
|
|
118
|
+
"required": false,
|
|
119
|
+
"optional": false,
|
|
120
|
+
"docs": {
|
|
121
|
+
"tags": [],
|
|
122
|
+
"text": ""
|
|
123
|
+
},
|
|
124
|
+
"attribute": "colorname",
|
|
125
|
+
"reflect": false
|
|
108
126
|
}
|
|
109
127
|
};
|
|
110
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"my-component.js","sourceRoot":"","sources":["../../../src/components/my-component/my-component.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAOnF,MAAM,OAAO,aAAa
|
|
1
|
+
{"version":3,"file":"my-component.js","sourceRoot":"","sources":["../../../src/components/my-component/my-component.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAOnF,MAAM,OAAO,aAAa;;;;;;gBAQR,KAAK;wBACG,KAAK;;EAG7B,KAAK,CAAC,IAAI;IACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;EACnB,CAAC;EAGD,KAAK,CAAC,KAAK;IACT,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;EACpB,CAAC;EAGD,sBAAsB,CAAC,KAAkB;IACvC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;EAC9C,CAAC;EAGD,iBAAiB;IACf,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IAClB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;EAC5B,CAAC;EAED,MAAM;IACJ,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,IAAI,IAAI,CAAC,IAAI,EAAE;MACb,OAAO,GAAG,CAAC,sBAA2B,EAAE,gBAAU,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,CAAC,SAAS,GAAa,CAAC,CAAC;KAChK;IACD,OAAO,CACL,WACE,OAAO,EAAE,GAAG,EAAE;QACZ,IAAI,IAAI,CAAC,YAAY,EAAE;UACrB,IAAI,CAAC,iBAAiB,EAAE,CAAC;SAC1B;MACH,CAAC;MAED,EAAC,MAAM;QACL,kBACG;;;;;;;;;kEASqD,CAC/C,CACF;MACT,WAAK,KAAK,EAAC,iBAAiB,IAAE,OAAO,CAAO;MAC5C;QACE,cAAQ,GAAG,EAAC,yDAAyD,EAAC,MAAM,EAAC,GAAG,EAAC,KAAK,EAAC,GAAG,EAAC,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAW,CAC7I,CACP,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import Helmet from '@stencil/helmet';\nimport { Component, Prop, Method, Element, State, Listen, h } from '@stencil/core';\n\n@Component({\n tag: 'my-component',\n styleUrl: 'my-component.scss',\n scoped: true,\n})\nexport class MyModalBundle {\n @Element() modalEl: HTMLElement;\n\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() baselink: string;\n @Prop() colorname: string | null;\n\n @State() show = false;\n @State() readyToClose = false;\n\n @Method()\n async open() {\n this.show = true;\n }\n\n @Method()\n async close() {\n this.show = false;\n }\n\n @Listen('readyToCLose')\n setReadyToCloseHandler(value: CustomEvent) {\n this.readyToClose = value.detail.observable;\n }\n\n @Listen('close')\n closeModalHandler() {\n this.show = false;\n this.readyToClose = false;\n }\n\n render() {\n let content = null;\n if (this.show) {\n content = [<my-backdrop></my-backdrop>, <my-modal shop={this.shop} product={this.product} baselink={this.baselink} selectedcolor={this.colorname}></my-modal>];\n }\n return (\n <div\n onClick={() => {\n if (this.readyToClose) {\n this.closeModalHandler();\n }\n }}\n >\n <Helmet>\n <script>\n {`(function (w, d, s, l, i) {\n w[l] = w[l] || [];\n w[l].push({ 'gtm.start': new Date().getTime(), 'event': 'gtm.js' });\n var f = d.getElementsByTagName(s)[0],\n j = d.createElement(s),\n dl = l != 'dataLayer' ? '&l=' + l : '';\n j.async = true;\n j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;\n f.parentNode.insertBefore(j, f);\n })(window, document, 'script', 'dataLayer', 'GTM-PMTKHDX');`}\n </script>\n </Helmet>\n <div class=\"pallete-wrapper\">{content}</div>\n <noscript>\n <iframe src=\"https://www.googletagmanager.com/ns.html?id=GTM-PMTKHDX\" height=\"0\" width=\"0\" style={{ display: 'none', visibility: 'hidden' }}></iframe>\n </noscript>\n </div>\n );\n }\n}\n"]}
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
box-shadow: 1px 1px 1px #ccc;
|
|
7
7
|
background-color: #fff;
|
|
8
8
|
position: fixed;
|
|
9
|
-
top:
|
|
9
|
+
top: 20px;
|
|
10
|
+
/* Change this to 0 or a suitable value for spacing from the top */
|
|
10
11
|
left: 50%;
|
|
11
|
-
transform:
|
|
12
|
+
transform: translateX(-50%);
|
|
13
|
+
/* Only translate horizontally */
|
|
12
14
|
max-width: 1555px;
|
|
13
15
|
width: 90%;
|
|
14
16
|
z-index: 1000;
|
|
@@ -16,10 +18,11 @@
|
|
|
16
18
|
padding: 35px 40px;
|
|
17
19
|
max-height: calc(100vh - 100px);
|
|
18
20
|
overflow-y: auto;
|
|
21
|
+
min-height: 50vh;
|
|
19
22
|
}
|
|
20
23
|
@media (max-width: 1024px) {
|
|
21
24
|
.my-modal {
|
|
22
|
-
padding:
|
|
25
|
+
padding: 40px 20px 20px;
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
.my-modal::-webkit-scrollbar {
|
|
@@ -32,39 +35,80 @@
|
|
|
32
35
|
justify-content: center;
|
|
33
36
|
height: 300px;
|
|
34
37
|
}
|
|
35
|
-
.my-
|
|
38
|
+
.my-modal__header {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: space-between;
|
|
42
|
+
align-items: flex-end;
|
|
43
|
+
margin-bottom: 16px;
|
|
44
|
+
}
|
|
45
|
+
@media (max-width: 1024px) {
|
|
46
|
+
.my-modal__header {
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
margin-bottom: 12px;
|
|
49
|
+
align-items: center;
|
|
50
|
+
display: block;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
@media (max-width: 768px) {
|
|
54
|
+
.my-modal__header .image-wrapper {
|
|
55
|
+
margin-bottom: 12px;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
.my-modal__header .image-wrapper > img {
|
|
36
59
|
max-width: 300px;
|
|
37
60
|
object-fit: cover;
|
|
38
61
|
}
|
|
39
62
|
@media (max-width: 768px) {
|
|
40
|
-
.my-
|
|
63
|
+
.my-modal__header .image-wrapper > img {
|
|
41
64
|
max-width: 200px;
|
|
42
65
|
}
|
|
43
66
|
}
|
|
44
|
-
.my-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
67
|
+
.my-modal__header .search-wrapper {
|
|
68
|
+
display: flex;
|
|
69
|
+
gap: 55px;
|
|
70
|
+
align-items: flex-start;
|
|
71
|
+
}
|
|
72
|
+
@media (max-width: 1024px) {
|
|
73
|
+
.my-modal__header .search-wrapper {
|
|
74
|
+
justify-content: center;
|
|
75
|
+
width: 92%;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
@media (max-width: 1024px) {
|
|
79
|
+
.my-modal__header .search-wrapper .sc-my-search-h {
|
|
80
|
+
width: 100%;
|
|
81
|
+
margin: 0 auto;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
.my-modal__header .search-wrapper .my-modal__close {
|
|
48
85
|
background: transparent;
|
|
49
86
|
border: none;
|
|
87
|
+
margin-top: -20px;
|
|
50
88
|
}
|
|
51
|
-
.my-modal__close > img {
|
|
89
|
+
.my-modal__header .search-wrapper .my-modal__close > img {
|
|
52
90
|
width: 45px;
|
|
53
91
|
height: 45px;
|
|
54
92
|
object-fit: cover;
|
|
55
93
|
cursor: pointer;
|
|
56
94
|
}
|
|
57
95
|
@media (max-width: 1024px) {
|
|
58
|
-
.my-modal__close {
|
|
59
|
-
top:
|
|
96
|
+
.my-modal__header .search-wrapper .my-modal__close {
|
|
97
|
+
margin-top: 0px;
|
|
98
|
+
position: absolute;
|
|
99
|
+
right: 10px;
|
|
100
|
+
top: 10px;
|
|
60
101
|
}
|
|
61
102
|
}
|
|
62
103
|
.my-modal__see-more {
|
|
63
|
-
font-size:
|
|
64
|
-
margin-bottom: 27px;
|
|
104
|
+
font-size: 16px;
|
|
65
105
|
display: flex;
|
|
66
106
|
justify-content: center;
|
|
67
107
|
align-items: center;
|
|
108
|
+
font-weight: 300;
|
|
109
|
+
color: #575757;
|
|
110
|
+
margin-top: 12px;
|
|
111
|
+
margin-bottom: 0px;
|
|
68
112
|
}
|
|
69
113
|
@media (max-width: 1024px) {
|
|
70
114
|
.my-modal__see-more {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { h, getAssetPath } from '@stencil/core';
|
|
2
2
|
import { APIURL, ApiService, accessToken } from '../api';
|
|
3
3
|
import { setDataLayer } from '../../gtmUtils';
|
|
4
|
-
import { fetchCategoryColorsQuery,
|
|
4
|
+
import { fetchCategoryColorsQuery, fetchColorByName, fetchProductColorsQuery, limit } from '../api/services';
|
|
5
|
+
import { debounce } from '../../utils';
|
|
5
6
|
export class MyModal {
|
|
6
7
|
constructor() {
|
|
7
8
|
this.boxDesktopWidth = 130;
|
|
@@ -119,6 +120,48 @@ export class MyModal {
|
|
|
119
120
|
this.loading = false;
|
|
120
121
|
}
|
|
121
122
|
};
|
|
123
|
+
this.handleCategoryClick = (color) => {
|
|
124
|
+
if (this.selectedCategory && color && this.selectedCategory === color && !this.showRange) {
|
|
125
|
+
this.data && this.fetchProductColors(String(this.data.id));
|
|
126
|
+
this.selectedCategory = null;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
color && this.fetchCategoryColors(color);
|
|
130
|
+
this.selectedCategory = color;
|
|
131
|
+
}
|
|
132
|
+
this.currentColor = null;
|
|
133
|
+
this.clearSearchText.emit();
|
|
134
|
+
};
|
|
135
|
+
// async searchColorsHandler(event: CustomEvent) {
|
|
136
|
+
// this.loading = true;
|
|
137
|
+
// this.currentColor = null;
|
|
138
|
+
// // if search is empty set to first category to not showing whole product colors
|
|
139
|
+
// if (event.detail === '') {
|
|
140
|
+
// this.handleCategoryClick(this.selectedCategory);
|
|
141
|
+
// this.loading = true;
|
|
142
|
+
// }
|
|
143
|
+
// try {
|
|
144
|
+
// if (this.data && this.data.id && event.detail !== '') {
|
|
145
|
+
// const response = await ApiService.getData(`items/Color?${fetchColorByNumber(Number(this.selectedCategory), event.detail)}`);
|
|
146
|
+
// if (response) {
|
|
147
|
+
// this.colors = {
|
|
148
|
+
// list:
|
|
149
|
+
// (response &&
|
|
150
|
+
// response.data &&
|
|
151
|
+
// response.data.map((item: Color) => ({
|
|
152
|
+
// ...item,
|
|
153
|
+
// }))) ||
|
|
154
|
+
// [],
|
|
155
|
+
// pagination: response.meta,
|
|
156
|
+
// };
|
|
157
|
+
// }
|
|
158
|
+
// }
|
|
159
|
+
// } catch (error) {
|
|
160
|
+
// console.error(error);
|
|
161
|
+
// } finally {
|
|
162
|
+
// this.loading = false;
|
|
163
|
+
// }
|
|
164
|
+
// }
|
|
122
165
|
this.onPage = (page) => {
|
|
123
166
|
if (this.data) {
|
|
124
167
|
if (this.selectedCategory) {
|
|
@@ -132,21 +175,10 @@ export class MyModal {
|
|
|
132
175
|
this.currentColor = null;
|
|
133
176
|
this.currentIndex = null;
|
|
134
177
|
};
|
|
135
|
-
this.handleCategoryClick = (color) => {
|
|
136
|
-
if (this.selectedCategory && color && this.selectedCategory === color && !this.showRange) {
|
|
137
|
-
this.data && this.fetchProductColors(String(this.data.id));
|
|
138
|
-
this.selectedCategory = null;
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
color && this.fetchCategoryColors(color);
|
|
142
|
-
this.selectedCategory = color;
|
|
143
|
-
}
|
|
144
|
-
this.currentColor = null;
|
|
145
|
-
this.clearSearchText.emit();
|
|
146
|
-
};
|
|
147
178
|
this.shop = undefined;
|
|
148
179
|
this.product = undefined;
|
|
149
180
|
this.baselink = undefined;
|
|
181
|
+
this.selectedcolor = undefined;
|
|
150
182
|
this.closeImage = 'close.png';
|
|
151
183
|
this.arrowDown = 'arrow_down.png';
|
|
152
184
|
this.chunksNum = 12;
|
|
@@ -164,6 +196,8 @@ export class MyModal {
|
|
|
164
196
|
this.colorCategories = null;
|
|
165
197
|
this.selectedCategory = null;
|
|
166
198
|
this.page = 1;
|
|
199
|
+
this.colorIsSelected = false;
|
|
200
|
+
this.debouncedSearchColorsHandler = debounce(this.searchColor.bind(this), 300);
|
|
167
201
|
}
|
|
168
202
|
setInfoBoxWidth(newValue) {
|
|
169
203
|
this.infoBoxWidth = newValue * this.boxWidth;
|
|
@@ -194,33 +228,54 @@ export class MyModal {
|
|
|
194
228
|
this.calculateBoxCount();
|
|
195
229
|
this.displayForMobile();
|
|
196
230
|
}
|
|
197
|
-
async
|
|
198
|
-
|
|
199
|
-
this.currentColor = null;
|
|
200
|
-
// if search is empty set to first category to not showing whole product colors
|
|
231
|
+
async searchColor(event) {
|
|
232
|
+
var _a, _b;
|
|
201
233
|
if (event.detail === '') {
|
|
202
|
-
this.
|
|
234
|
+
this.fetchProductData();
|
|
203
235
|
this.loading = true;
|
|
204
236
|
}
|
|
205
|
-
|
|
206
|
-
if (
|
|
207
|
-
|
|
237
|
+
else {
|
|
238
|
+
if (!((_a = this.data) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
try {
|
|
242
|
+
const response = await ApiService.getData(`items/Color?${fetchColorByName((_b = this.data) === null || _b === void 0 ? void 0 : _b.id, event.detail)}`);
|
|
208
243
|
if (response) {
|
|
209
244
|
this.colors = {
|
|
210
|
-
list:
|
|
245
|
+
list: response &&
|
|
211
246
|
response.data &&
|
|
212
|
-
response.data.map((item) => (Object.assign({}, item)))
|
|
213
|
-
[],
|
|
247
|
+
response.data.map((item) => (Object.assign({}, item))),
|
|
214
248
|
pagination: response.meta,
|
|
215
249
|
};
|
|
216
250
|
}
|
|
217
251
|
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
console.error(error);
|
|
254
|
+
}
|
|
255
|
+
finally {
|
|
256
|
+
this.loading = false;
|
|
257
|
+
}
|
|
218
258
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
259
|
+
}
|
|
260
|
+
searchColorsHandler(event) {
|
|
261
|
+
this.loading = true;
|
|
262
|
+
this.currentColor = null;
|
|
263
|
+
this.debouncedSearchColorsHandler(event);
|
|
264
|
+
}
|
|
265
|
+
openSeletedColor() {
|
|
266
|
+
var _a, _b, _c;
|
|
267
|
+
if (!((_a = this.colors) === null || _a === void 0 ? void 0 : _a.list) || !this.selectedcolor)
|
|
268
|
+
return;
|
|
269
|
+
if (!this.colorIsSelected) {
|
|
270
|
+
const result = this.chunks(this.colors.list)
|
|
271
|
+
.map((innerArray, arrayIndex) => {
|
|
272
|
+
const foundColor = innerArray.find(color => { var _a, _b; return color.name.trim() === ((_b = (_a = this.selectedcolor) === null || _a === void 0 ? void 0 : _a.trim()) === null || _b === void 0 ? void 0 : _b.toUpperCase()); });
|
|
273
|
+
return foundColor ? { color: foundColor, index: arrayIndex } : null;
|
|
274
|
+
})
|
|
275
|
+
.filter(item => item !== null);
|
|
276
|
+
this.currentColor = (_b = result[0]) === null || _b === void 0 ? void 0 : _b.color;
|
|
277
|
+
this.currentIndex = (_c = result[0]) === null || _c === void 0 ? void 0 : _c.index;
|
|
278
|
+
this.colorIsSelected = true;
|
|
224
279
|
}
|
|
225
280
|
}
|
|
226
281
|
componentWillLoad() {
|
|
@@ -231,13 +286,11 @@ export class MyModal {
|
|
|
231
286
|
this.displayForMobile();
|
|
232
287
|
this.calculateBoxCount();
|
|
233
288
|
this.colorTimer();
|
|
289
|
+
this.openSeletedColor();
|
|
234
290
|
}
|
|
235
291
|
render() {
|
|
236
|
-
var _a, _b, _c
|
|
237
|
-
return (h("div", { class: `my-modal`, onMouseEnter: () => this.handleReadyToClose(false), onMouseLeave: () => this.handleReadyToClose(true) }, this.preloader && (h("div", { class: 'loader' }, h("my-loader", null))), !this.preloader && (h("
|
|
238
|
-
isImageInsteadHex: (c === null || c === void 0 ? void 0 : c.imageInsteadHex) || false,
|
|
239
|
-
bigImage: (c === null || c === void 0 ? void 0 : c.bigImage) || '',
|
|
240
|
-
} })))), this.isMobile && (h("div", { class: 'categories__slide-information', style: { width: `${this.infoBoxWidth}px` } }, h("span", null, "Przewi\u0144 w lewo"), h("span", null, "Przewi\u0144 w prawo"))))), h("div", { class: 'my-modal__wrapper' }, this.loading && h("my-loader", null), !this.loading && this.colors && (h("div", { class: 'container_boxes' }, this.colors.list.length > 0 ? (this.chunks(this.colors.list).map((color, index) => {
|
|
292
|
+
var _a, _b, _c;
|
|
293
|
+
return (h("div", { class: `my-modal`, onMouseEnter: () => this.handleReadyToClose(false), onMouseLeave: () => this.handleReadyToClose(true) }, this.preloader && (h("div", { class: 'loader' }, h("my-loader", null))), !this.preloader && this.data && (h("div", { class: `my-modal__header` }, h("div", { class: "image-wrapper" }, h("img", { src: `${APIURL}/assets/${(_a = this.data) === null || _a === void 0 ? void 0 : _a.modalLogo}?access_token=${accessToken}`, alt: "modal-logo" }), !this.preloader && this.data && (h("p", { class: "my-modal__see-more" }, (_b = this.data) === null || _b === void 0 ? void 0 : _b.modalDescription))), h("div", { class: "search-wrapper" }, !this.preloader && h("my-search", { productId: Number((_c = this.data) === null || _c === void 0 ? void 0 : _c.id), isMobile: this.isMobile }), !this.preloader && (h("button", { class: "my-modal__close", onClick: () => this.closeModalHandler() }, h("img", { src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" })))))), h("div", { class: 'my-modal__wrapper' }, this.loading && h("my-loader", null), !this.loading && this.colors && (h("div", { class: 'container_boxes' }, this.colors.list.length > 0 ? (this.chunks(this.colors.list).map((color, index) => {
|
|
241
294
|
var _a;
|
|
242
295
|
return (h("div", { key: index, class: "boxes" }, h("div", { class: "boxes__list" }, color.map((c) => {
|
|
243
296
|
var _a;
|
|
@@ -329,6 +382,23 @@ export class MyModal {
|
|
|
329
382
|
"attribute": "baselink",
|
|
330
383
|
"reflect": false
|
|
331
384
|
},
|
|
385
|
+
"selectedcolor": {
|
|
386
|
+
"type": "string",
|
|
387
|
+
"mutable": false,
|
|
388
|
+
"complexType": {
|
|
389
|
+
"original": "string | null",
|
|
390
|
+
"resolved": "null | string",
|
|
391
|
+
"references": {}
|
|
392
|
+
},
|
|
393
|
+
"required": false,
|
|
394
|
+
"optional": false,
|
|
395
|
+
"docs": {
|
|
396
|
+
"tags": [],
|
|
397
|
+
"text": ""
|
|
398
|
+
},
|
|
399
|
+
"attribute": "selectedcolor",
|
|
400
|
+
"reflect": false
|
|
401
|
+
},
|
|
332
402
|
"closeImage": {
|
|
333
403
|
"type": "string",
|
|
334
404
|
"mutable": false,
|
|
@@ -383,7 +453,8 @@ export class MyModal {
|
|
|
383
453
|
"showRange": {},
|
|
384
454
|
"colorCategories": {},
|
|
385
455
|
"selectedCategory": {},
|
|
386
|
-
"page": {}
|
|
456
|
+
"page": {},
|
|
457
|
+
"colorIsSelected": {}
|
|
387
458
|
};
|
|
388
459
|
}
|
|
389
460
|
static get events() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"my-modal.js","sourceRoot":"","sources":["../../../src/components/my-modal/my-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7H,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAa/G,MAAM,OAAO,OAAO;;IACV,oBAAe,GAAG,GAAG,CAAC;IACtB,mBAAc,GAAG,EAAE,CAAC;IACpB,mBAAc,GAAG,EAAE,CAAC;IACpB,kBAAa,GAAG,EAAE,CAAC;IACnB,qBAAgB,GAAG,IAAI,CAAC;IA2CxB,kBAAa,GAAG,GAAG,EAAE;MAC3B,IAAI,CAAC,kBAAkB,IAAI,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;MAClE,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;IACtC,CAAC,CAAC;IAEM,eAAU,GAAG,GAAG,EAAE;MACxB,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE;QAC7C,IAAI,CAAC,kBAAkB,GAAG,WAAW,CAAC,GAAG,EAAE;;UACzC,CAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI;YACrB,YAAY,CAAC;cACX,KAAK,EAAE,YAAY;cACnB,IAAI,EAAE,IAAI,CAAC,IAAI;cACf,OAAO,EAAE,IAAI,CAAC,OAAO;cACrB,KAAK,E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AC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Method, Element, Prop, Event, EventEmitter, h, State, getAssetPath, Listen, Watch } from '@stencil/core';\nimport { APIURL, ApiService, accessToken } from '../api';\nimport { setDataLayer } from '../../gtmUtils';\nimport { Color, PaginationData, Product, ProductCategoryRelation, ProductShopRelation } from '../../types';\nimport { fetchCategoryColorsQuery, fetchColorByNumber, fetchProductColorsQuery, limit } from '../api/services';\n\ndeclare global {\n interface Window {\n dataLayer: Record<string, any>[];\n }\n}\n\n@Component({\n tag: 'my-modal',\n styleUrl: 'my-modal.scss',\n assetsDirs: ['assets'],\n})\nexport class MyModal {\n private boxDesktopWidth = 130;\n private boxMobileWidth = 70;\n private desktopPadding = 75;\n private mobilePadding = 35;\n private mediumBreakpoint = 1024;\n private colorTimerInterval: ReturnType<typeof setInterval> | undefined;\n\n @Event({ bubbles: true, composed: true }) clearSearchText: EventEmitter;\n @Element() modalEl: HTMLElement;\n\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() baselink: string;\n @Prop() closeImage = 'close.png';\n @Prop() arrowDown = 'arrow_down.png';\n\n @State() chunksNum = 12;\n @State() data: Product | null = null;\n @State() preloader = false;\n @State() loading = false;\n @State() colors: PaginationData<Color> | null = null;\n @State() currentColor: Color | null = null;\n @State() currentIndex: number | null = null;\n @State() infoBoxWidth: number | null = null;\n @State() boxWidth: number = this.boxDesktopWidth; // box width with gap\n @State() padding: number = this.desktopPadding;\n @State() isMobile: boolean = false;\n @State() showRange: boolean = false;\n @State() colorCategories: string[] | null = null;\n @State() selectedCategory: any = null;\n @State() page = 1;\n\n @Watch('chunksNum')\n setInfoBoxWidth(newValue: number) {\n this.infoBoxWidth = newValue * this.boxWidth;\n }\n\n @Watch('data')\n watchPropHandler(newValue: Product) {\n if (newValue.Category.length > 0) {\n this.showRange = true;\n this.handleCategoryClick(newValue.Category[0].Category_id.id);\n } else {\n this.fetchProductColors(String(newValue.id));\n }\n }\n\n private clearInterval = () => {\n this.colorTimerInterval && clearInterval(this.colorTimerInterval);\n this.colorTimerInterval = undefined;\n };\n\n private colorTimer = () => {\n if (this.currentColor && this.currentColor.id) {\n this.colorTimerInterval = setInterval(() => {\n this.currentColor?.name &&\n setDataLayer({\n event: 'ColorTimer',\n shop: this.shop,\n product: this.product,\n color: this.currentColor?.name,\n timer: '10',\n });\n }, 10000);\n } else {\n this.clearInterval();\n }\n };\n\n @Method()\n async open() {\n this.modalEl.style.display = 'block';\n }\n @Event() close: EventEmitter;\n closeModalHandler() {\n this.close.emit();\n }\n\n @Event() readyToCLose: EventEmitter;\n handleReadyToClose(value: boolean) {\n this.readyToCLose.emit({ observable: value });\n }\n\n @Listen('closeInfoBox')\n closeInfoBoxHandler() {\n this.currentColor = null;\n this.currentIndex = null;\n }\n\n private chunks = (xs: Color[], y: Color[][] = []): Color[][] => {\n return xs.length === 0 ? y : this.chunks(xs.slice(this.chunksNum), y.concat([xs.slice(0, this.chunksNum)]));\n };\n\n private calculateBoxCount = () => {\n const modalWidth = this.modalEl.children && this.modalEl.children[0] && this.modalEl.children[0]?.clientWidth - this.padding;\n const boxWidth = this.boxWidth;\n\n const calc = Math.floor(modalWidth / boxWidth);\n\n const boxesCount = calc;\n\n if (!this.preloader) this.chunksNum = boxesCount;\n };\n\n private displayForMobile = () => {\n if (window.innerWidth < this.mediumBreakpoint) {\n this.boxWidth = this.boxMobileWidth;\n this.padding = this.mobilePadding;\n this.isMobile = true;\n } else {\n this.isMobile = false;\n this.boxWidth = this.boxDesktopWidth;\n this.padding = this.desktopPadding;\n }\n };\n\n @Listen('resize', { target: 'window' })\n handleResize() {\n this.calculateBoxCount();\n this.displayForMobile();\n }\n\n private fetchProductData = async () => {\n try {\n const shopResponse = await ApiService.getData(`items/Shop?filter[name][_eq]=${this.shop}`);\n const shop = shopResponse?.data[0];\n if (shop.id) {\n const response = await ApiService.getData(`items/Product?filter[name][_eq]=${this.product}&fields=*,images.*,Shop.*,Category.*.*.*.*`);\n const product = response?.data[0];\n\n if (product) {\n if (product.Shop.find((s: ProductShopRelation) => s.Shop_id === shop.id)) {\n this.data = {\n ...response.data[0],\n id: response.data[0].id,\n };\n } else {\n return null;\n }\n }\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.preloader = false;\n }\n };\n\n private fetchProductColors = async (id: string, page?: number) => {\n this.loading = true;\n\n try {\n const response = await ApiService.getData(`items/Color?${fetchProductColorsQuery(id, page)}`);\n\n if (response) {\n this.colors = {\n list:\n response &&\n response.data &&\n response.data.map((item: Color) => ({\n ...item,\n })),\n pagination: response.meta,\n };\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.loading = false;\n }\n };\n\n private fetchCategoryColors = async (id: number, page?: number) => {\n this.loading = true;\n\n try {\n const response = await ApiService.getData(`items/Color?${fetchCategoryColorsQuery(id, page)}`);\n\n if (response) {\n this.colors = {\n list:\n response &&\n response.data &&\n response.data.map((item: Color) => ({\n ...item,\n })),\n pagination: response.meta,\n };\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.loading = false;\n }\n };\n\n @Listen('searchColors')\n async searchColorsHandler(event: CustomEvent) {\n this.loading = true;\n this.currentColor = null;\n // if search is empty set to first category to not showing whole product colors\n if (event.detail === '') {\n this.handleCategoryClick(this.selectedCategory);\n this.loading = true;\n }\n\n try {\n if (this.data && this.data.id && event.detail !== '') {\n const response = await ApiService.getData(`items/Color?${fetchColorByNumber(Number(this.selectedCategory), event.detail)}`);\n if (response) {\n this.colors = {\n list:\n (response &&\n response.data &&\n response.data.map((item: Color) => ({\n ...item,\n }))) ||\n [],\n pagination: response.meta,\n };\n }\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.loading = false;\n }\n }\n\n private onPage = (page: number) => {\n if (this.data) {\n if (this.selectedCategory) {\n this.fetchCategoryColors(this.selectedCategory, page);\n } else {\n this.fetchProductColors(String(this.data.id), page);\n }\n }\n\n this.page = page;\n this.currentColor = null;\n this.currentIndex = null;\n };\n\n componentWillLoad() {\n this.preloader = true;\n this.fetchProductData();\n }\n\n componentWillRender() {\n this.displayForMobile();\n this.calculateBoxCount();\n this.colorTimer();\n }\n\n private handleCategoryClick = (color?: number) => {\n if (this.selectedCategory && color && this.selectedCategory === color && !this.showRange) {\n this.data && this.fetchProductColors(String(this.data.id));\n this.selectedCategory = null;\n } else {\n color && this.fetchCategoryColors(color);\n this.selectedCategory = color;\n }\n this.currentColor = null;\n this.clearSearchText.emit();\n };\n\n render() {\n return (\n <div class={`my-modal`} onMouseEnter={() => this.handleReadyToClose(false)} onMouseLeave={() => this.handleReadyToClose(true)}>\n {this.preloader && (\n <div class={'loader'}>\n <my-loader></my-loader>\n </div>\n )}\n {!this.preloader && (\n <button class=\"my-modal__close\" onClick={() => this.closeModalHandler()}>\n <img src={getAssetPath(`./assets/${this.closeImage}`)} alt=\"closebtn\" />\n </button>\n )}\n {!this.preloader && this.data && this.data.modalLogo && <img src={`${APIURL}/assets/${this.data?.modalLogo}?access_token=${accessToken}`} alt=\"modal-logo\" />}\n {!this.preloader && this.data && (\n <p class=\"my-modal__see-more\">\n {this.data?.modalDescription}\n {/* <img src={getAssetPath(`./assets/${this.arrowDown}`)} alt=\"arrow_down\" /> */}\n </p>\n )}\n {this.showRange && (\n <div class={'categories'}>\n {this.data && <my-search productId={Number(this.data?.id)} isMobile={this.isMobile}></my-search>}\n\n <div class={'categories__container'} style={{ maxWidth: `${this.infoBoxWidth}px` }}>\n {this.data?.Category.map((c: ProductCategoryRelation) => (\n <my-colorbox\n key={c.id}\n onClick={() => this.handleCategoryClick(c.Category_id.id)}\n color={c.Category_id.hex}\n name={c.Category_id.category_name}\n shop={this.shop}\n product={this.product}\n isCategoryActive={this.selectedCategory === c.Category_id.id}\n isImageInsteadHex={{\n isImageInsteadHex: c?.imageInsteadHex || false,\n bigImage: c?.bigImage || '',\n }}\n ></my-colorbox>\n ))}\n </div>\n {this.isMobile && (\n <div class={'categories__slide-information'} style={{ width: `${this.infoBoxWidth}px` }}>\n <span>Przewiń w lewo</span>\n <span>Przewiń w prawo</span>\n </div>\n )}\n </div>\n )}\n <div class={'my-modal__wrapper'}>\n {this.loading && <my-loader></my-loader>}\n {!this.loading && this.colors && (\n <div class={'container_boxes'}>\n {this.colors.list.length > 0 ? (\n this.chunks(this.colors.list).map((color: Color[], index: number) => {\n return (\n <div key={index} class=\"boxes\">\n <div class=\"boxes__list\">\n {color.map((c: Color) => (\n <my-colorbox\n key={c.id}\n onClick={() => [\n this.currentColor?.id ? (this.currentColor?.id === c.id ? (this.currentColor = null) : (this.currentColor = c)) : (this.currentColor = c),\n (this.currentIndex = index),\n setDataLayer({\n event: 'ColorClick',\n shop: this.shop,\n product: this.product,\n color: c.name,\n }),\n this.currentColor?.id && this.clearInterval(),\n ]}\n color={c.hex}\n name={c.name}\n isActive={this.currentColor?.id === c.id}\n shop={this.shop}\n product={this.product}\n isImageInsteadHex={{\n isImageInsteadHex: c.imageInsteadHex,\n bigImage: c.bigImage,\n }}\n ></my-colorbox>\n ))}\n </div>\n\n {this.currentColor?.id && index === this.currentIndex && (\n <my-colorinfo\n currentColor={this.currentColor}\n shop={this.shop}\n product={this.product}\n data={this.data}\n isMobile={this.isMobile}\n infoBoxWidth={this.infoBoxWidth}\n baselink={this.baselink}\n ></my-colorinfo>\n )}\n </div>\n );\n })\n ) : (\n <p>Brak wyników</p>\n )}\n {this.colors.pagination.filter_count > limit && (\n <div class={'pagination'}>\n {Array.from({ length: Math.ceil(this.colors.pagination.filter_count / limit) }).map((_, i) => (\n <span\n class={i + 1 === this.page ? 'current' : ''}\n onClick={e => {\n e.preventDefault();\n this.onPage(i + 1);\n }}\n key={`#${i + 1}`}\n >\n {i + 1}\n </span>\n ))}\n </div>\n )}\n </div>\n )}\n </div>\n {!this.preloader && this.isMobile && (\n <button class=\"button\" onClick={() => this.closeModalHandler()}>\n Zamknij\n </button>\n )}\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"my-modal.js","sourceRoot":"","sources":["../../../src/components/my-modal/my-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7H,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7G,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAavC,MAAM,OAAO,OAAO;EAoClB;IAnCQ,oBAAe,GAAG,GAAG,CAAC;IACtB,mBAAc,GAAG,EAAE,CAAC;IACpB,mBAAc,GAAG,EAAE,CAAC;IACpB,kBAAa,GAAG,EAAE,CAAC;IACnB,qBAAgB,GAAG,IAAI,CAAC;IAkDxB,kBAAa,GAAG,GAAG,EAAE;MAC3B,IAAI,CAAC,kBAAkB,IAAI,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;MAClE,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;IACtC,CAAC,CAAC;IAEM,eAAU,GAAG,GAAG,EAAE;MACxB,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE;QAC7C,IAAI,CAAC,kBAAkB,GAAG,WAAW,CAAC,GAAG,EAAE;;UACzC,CAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI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AC,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAC5F,YACE,KAAK,EAAE,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAC3C,OAAO,EAAE,CAAC,CAAC,EAAE;cACX,CAAC,CAAC,cAAc,EAAE,CAAC;cACnB,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACrB,CAAC,EACD,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,IAEf,CAAC,GAAG,CAAC,CACD,CACR,CAAC,CACE,CACP,CACG,CACP,CACG;MACL,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,QAAQ,IAAI,CACnC,cAAQ,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,cAErD,CACV,CACG,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Method, Element, Prop, Event, EventEmitter, h, State, getAssetPath, Listen, Watch } from '@stencil/core';\nimport { APIURL, ApiService, accessToken } from '../api';\nimport { setDataLayer } from '../../gtmUtils';\nimport { Color, PaginationData, Product, ProductShopRelation } from '../../types';\nimport { fetchCategoryColorsQuery, fetchColorByName, fetchProductColorsQuery, limit } from '../api/services';\nimport { debounce } from '../../utils';\n\ndeclare global {\n interface Window {\n dataLayer: Record<string, any>[];\n }\n}\n\n@Component({\n tag: 'my-modal',\n styleUrl: 'my-modal.scss',\n assetsDirs: ['assets'],\n})\nexport class MyModal {\n private boxDesktopWidth = 130;\n private boxMobileWidth = 70;\n private desktopPadding = 75;\n private mobilePadding = 35;\n private mediumBreakpoint = 1024;\n private colorTimerInterval: ReturnType<typeof setInterval> | undefined;\n\n @Event({ bubbles: true, composed: true }) clearSearchText: EventEmitter;\n @Element() modalEl: HTMLElement;\n\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() baselink: string;\n @Prop() selectedcolor: string | null;\n @Prop() closeImage = 'close.png';\n @Prop() arrowDown = 'arrow_down.png';\n\n @State() chunksNum = 12;\n @State() data: Product | null = null;\n @State() preloader = false;\n @State() loading = false;\n @State() colors: PaginationData<Color> | null = null;\n @State() currentColor: Color | null = null;\n @State() currentIndex: number | null = null;\n @State() infoBoxWidth: number | null = null;\n @State() boxWidth: number = this.boxDesktopWidth; // box width with gap\n @State() padding: number = this.desktopPadding;\n @State() isMobile: boolean = false;\n @State() showRange: boolean = false;\n @State() colorCategories: string[] | null = null;\n @State() selectedCategory: any = null;\n @State() page = 1;\n @State() colorIsSelected = false;\n debouncedSearchColorsHandler: (event: CustomEvent) => void;\n\n constructor() {\n this.debouncedSearchColorsHandler = debounce(this.searchColor.bind(this), 300);\n }\n\n @Watch('chunksNum')\n setInfoBoxWidth(newValue: number) {\n this.infoBoxWidth = newValue * this.boxWidth;\n }\n\n @Watch('data')\n watchPropHandler(newValue: Product) {\n if (newValue.Category.length > 0) {\n this.showRange = true;\n this.handleCategoryClick(newValue.Category[0].Category_id.id);\n } else {\n this.fetchProductColors(String(newValue.id));\n }\n }\n\n private clearInterval = () => {\n this.colorTimerInterval && clearInterval(this.colorTimerInterval);\n this.colorTimerInterval = undefined;\n };\n\n private colorTimer = () => {\n if (this.currentColor && this.currentColor.id) {\n this.colorTimerInterval = setInterval(() => {\n this.currentColor?.name &&\n setDataLayer({\n event: 'ColorTimer',\n shop: this.shop,\n product: this.product,\n color: this.currentColor?.name,\n timer: '10',\n });\n }, 10000);\n } else {\n this.clearInterval();\n }\n };\n\n @Method()\n async open() {\n this.modalEl.style.display = 'block';\n }\n @Event() close: EventEmitter;\n closeModalHandler() {\n this.close.emit();\n }\n\n @Event() readyToCLose: EventEmitter;\n handleReadyToClose(value: boolean) {\n this.readyToCLose.emit({ observable: value });\n }\n\n @Listen('closeInfoBox')\n closeInfoBoxHandler() {\n this.currentColor = null;\n this.currentIndex = null;\n }\n\n private chunks = (xs: Color[], y: Color[][] = []): Color[][] => {\n return xs.length === 0 ? y : this.chunks(xs.slice(this.chunksNum), y.concat([xs.slice(0, this.chunksNum)]));\n };\n\n private calculateBoxCount = () => {\n const modalWidth = this.modalEl.children && this.modalEl.children[0] && this.modalEl.children[0]?.clientWidth - this.padding;\n const boxWidth = this.boxWidth;\n\n const calc = Math.floor(modalWidth / boxWidth);\n\n const boxesCount = calc;\n\n if (!this.preloader) this.chunksNum = boxesCount;\n };\n\n private displayForMobile = () => {\n if (window.innerWidth < this.mediumBreakpoint) {\n this.boxWidth = this.boxMobileWidth;\n this.padding = this.mobilePadding;\n this.isMobile = true;\n } else {\n this.isMobile = false;\n this.boxWidth = this.boxDesktopWidth;\n this.padding = this.desktopPadding;\n }\n };\n\n @Listen('resize', { target: 'window' })\n handleResize() {\n this.calculateBoxCount();\n this.displayForMobile();\n }\n\n private fetchProductData = async () => {\n try {\n const shopResponse = await ApiService.getData(`items/Shop?filter[name][_eq]=${this.shop}`);\n const shop = shopResponse?.data[0];\n if (shop.id) {\n const response = await ApiService.getData(`items/Product?filter[name][_eq]=${this.product}&fields=*,images.*,Shop.*,Category.*.*.*.*`);\n const product = response?.data[0];\n\n if (product) {\n if (product.Shop.find((s: ProductShopRelation) => s.Shop_id === shop.id)) {\n this.data = {\n ...response.data[0],\n id: response.data[0].id,\n };\n } else {\n return null;\n }\n }\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.preloader = false;\n }\n };\n\n private fetchProductColors = async (id: string, page?: number) => {\n this.loading = true;\n\n try {\n const response = await ApiService.getData(`items/Color?${fetchProductColorsQuery(id, page)}`);\n\n if (response) {\n this.colors = {\n list:\n response &&\n response.data &&\n response.data.map((item: Color) => ({\n ...item,\n })),\n pagination: response.meta,\n };\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.loading = false;\n }\n };\n\n private fetchCategoryColors = async (id: number, page?: number) => {\n this.loading = true;\n\n try {\n const response = await ApiService.getData(`items/Color?${fetchCategoryColorsQuery(id, page)}`);\n\n if (response) {\n this.colors = {\n list:\n response &&\n response.data &&\n response.data.map((item: Color) => ({\n ...item,\n })),\n pagination: response.meta,\n };\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.loading = false;\n }\n };\n\n async searchColor(event: CustomEvent) {\n if (event.detail === '') {\n this.fetchProductData();\n this.loading = true;\n } else {\n if (!this.data?.id) {\n return;\n }\n try {\n const response = await ApiService.getData(`items/Color?${fetchColorByName(this.data?.id, event.detail)}`);\n\n if (response) {\n this.colors = {\n list:\n response &&\n response.data &&\n response.data.map((item: Color) => ({\n ...item,\n })),\n pagination: response.meta,\n };\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.loading = false;\n }\n }\n }\n\n @Listen('searchColors')\n searchColorsHandler(event: CustomEvent) {\n this.loading = true;\n this.currentColor = null;\n this.debouncedSearchColorsHandler(event);\n }\n\n private handleCategoryClick = (color?: number) => {\n if (this.selectedCategory && color && this.selectedCategory === color && !this.showRange) {\n this.data && this.fetchProductColors(String(this.data.id));\n this.selectedCategory = null;\n } else {\n color && this.fetchCategoryColors(color);\n this.selectedCategory = color;\n }\n this.currentColor = null;\n this.clearSearchText.emit();\n };\n\n // async searchColorsHandler(event: CustomEvent) {\n // this.loading = true;\n // this.currentColor = null;\n\n // // if search is empty set to first category to not showing whole product colors\n // if (event.detail === '') {\n // this.handleCategoryClick(this.selectedCategory);\n // this.loading = true;\n // }\n\n // try {\n // if (this.data && this.data.id && event.detail !== '') {\n // const response = await ApiService.getData(`items/Color?${fetchColorByNumber(Number(this.selectedCategory), event.detail)}`);\n // if (response) {\n // this.colors = {\n // list:\n // (response &&\n // response.data &&\n // response.data.map((item: Color) => ({\n // ...item,\n // }))) ||\n // [],\n // pagination: response.meta,\n // };\n // }\n // }\n // } catch (error) {\n // console.error(error);\n // } finally {\n // this.loading = false;\n // }\n // }\n private onPage = (page: number) => {\n if (this.data) {\n if (this.selectedCategory) {\n this.fetchCategoryColors(this.selectedCategory, page);\n } else {\n this.fetchProductColors(String(this.data.id), page);\n }\n }\n\n this.page = page;\n this.currentColor = null;\n this.currentIndex = null;\n };\n\n private openSeletedColor() {\n if (!this.colors?.list || !this.selectedcolor) return;\n\n if (!this.colorIsSelected) {\n const result = this.chunks(this.colors.list)\n .map((innerArray, arrayIndex) => {\n const foundColor = innerArray.find(color => color.name.trim() === this.selectedcolor?.trim()?.toUpperCase());\n\n return foundColor ? { color: foundColor, index: arrayIndex } : null;\n })\n .filter(item => item !== null);\n\n this.currentColor = result[0]?.color as any;\n this.currentIndex = result[0]?.index as any;\n this.colorIsSelected = true;\n }\n }\n\n componentWillLoad() {\n this.preloader = true;\n this.fetchProductData();\n }\n\n componentWillRender() {\n this.displayForMobile();\n this.calculateBoxCount();\n this.colorTimer();\n this.openSeletedColor();\n }\n\n render() {\n return (\n <div class={`my-modal`} onMouseEnter={() => this.handleReadyToClose(false)} onMouseLeave={() => this.handleReadyToClose(true)}>\n {this.preloader && (\n <div class={'loader'}>\n <my-loader></my-loader>\n </div>\n )}\n {!this.preloader && this.data && (\n <div class={`my-modal__header`}>\n <div class=\"image-wrapper\">\n <img src={`${APIURL}/assets/${this.data?.modalLogo}?access_token=${accessToken}`} alt=\"modal-logo\" />\n {!this.preloader && this.data && (\n <p class=\"my-modal__see-more\">\n {this.data?.modalDescription}\n {/* <img src={getAssetPath(`./assets/${this.arrowDown}`)} alt=\"arrow_down\" /> */}\n </p>\n )}\n </div>\n <div class=\"search-wrapper\">\n {!this.preloader && <my-search productId={Number(this.data?.id)} isMobile={this.isMobile}></my-search>}\n {!this.preloader && (\n <button class=\"my-modal__close\" onClick={() => this.closeModalHandler()}>\n <img src={getAssetPath(`./assets/${this.closeImage}`)} alt=\"closebtn\" />\n </button>\n )}\n </div>\n </div>\n )}\n\n {/* {this.showRange && (\n <div class={'categories'}>\n {this.data && <my-search productId={Number(this.data?.id)} isMobile={this.isMobile}></my-search>}\n\n <div class={'categories__container'} style={{ maxWidth: `${this.infoBoxWidth}px` }}>\n {this.data?.Category.map((c: ProductCategoryRelation) => (\n <my-colorbox\n key={c.id}\n onClick={() => this.handleCategoryClick(c.Category_id.id)}\n color={c.Category_id.hex}\n name={c.Category_id.category_name}\n shop={this.shop}\n product={this.product}\n isCategoryActive={this.selectedCategory === c.Category_id.id}\n isImageInsteadHex={{\n isImageInsteadHex: c?.imageInsteadHex || false,\n bigImage: c?.bigImage || '',\n }}\n ></my-colorbox>\n ))}\n </div>\n {this.isMobile && (\n <div class={'categories__slide-information'} style={{ width: `${this.infoBoxWidth}px` }}>\n <span>Przewiń w lewo</span>\n <span>Przewiń w prawo</span>\n </div>\n )}\n </div>\n )} */}\n <div class={'my-modal__wrapper'}>\n {this.loading && <my-loader></my-loader>}\n {!this.loading && this.colors && (\n <div class={'container_boxes'}>\n {this.colors.list.length > 0 ? (\n this.chunks(this.colors.list).map((color: Color[], index: number) => {\n return (\n <div key={index} class=\"boxes\">\n <div class=\"boxes__list\">\n {color.map((c: Color) => (\n <my-colorbox\n key={c.id}\n onClick={() => [\n this.currentColor?.id ? (this.currentColor?.id === c.id ? (this.currentColor = null) : (this.currentColor = c)) : (this.currentColor = c),\n (this.currentIndex = index),\n setDataLayer({\n event: 'ColorClick',\n shop: this.shop,\n product: this.product,\n color: c.name,\n }),\n this.currentColor?.id && this.clearInterval(),\n ]}\n color={c.hex}\n name={c.name}\n isActive={this.currentColor?.id === c.id}\n shop={this.shop}\n product={this.product}\n isImageInsteadHex={{\n isImageInsteadHex: c.imageInsteadHex,\n bigImage: c.bigImage,\n }}\n ></my-colorbox>\n ))}\n </div>\n\n {this.currentColor?.id && index === this.currentIndex && (\n <my-colorinfo\n currentColor={this.currentColor}\n shop={this.shop}\n product={this.product}\n data={this.data}\n isMobile={this.isMobile}\n infoBoxWidth={this.infoBoxWidth}\n baselink={this.baselink}\n ></my-colorinfo>\n )}\n </div>\n );\n })\n ) : (\n <p>Brak wyników</p>\n )}\n {this.colors.pagination.filter_count > limit && (\n <div class={'pagination'}>\n {Array.from({ length: Math.ceil(this.colors.pagination.filter_count / limit) }).map((_, i) => (\n <span\n class={i + 1 === this.page ? 'current' : ''}\n onClick={e => {\n e.preventDefault();\n this.onPage(i + 1);\n }}\n key={`#${i + 1}`}\n >\n {i + 1}\n </span>\n ))}\n </div>\n )}\n </div>\n )}\n </div>\n {!this.preloader && this.isMobile && (\n <button class=\"button\" onClick={() => this.closeModalHandler()}>\n Zamknij\n </button>\n )}\n </div>\n );\n }\n}\n"]}
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
.search input {
|
|
15
|
-
margin-bottom: 12px;
|
|
16
15
|
font-size: 16px;
|
|
17
16
|
padding: 19px;
|
|
18
17
|
border-radius: 27.35px;
|
|
19
18
|
border: 1px solid #dfdfdf;
|
|
20
19
|
width: 100%;
|
|
20
|
+
color: #4c4c4c;
|
|
21
21
|
}
|
|
22
22
|
.search button {
|
|
23
23
|
position: absolute;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
right: -20px;
|
|
27
27
|
top: 0;
|
|
28
28
|
width: 50px;
|
|
29
|
-
height:
|
|
29
|
+
height: 100%;
|
|
30
30
|
display: flex;
|
|
31
31
|
flex-direction: column;
|
|
32
32
|
align-items: center;
|