@jumpgroup/jump-design-system 0.3.0 → 0.3.1
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/{index-418c607f.js → index-674508e2.js} +9 -4
- package/dist/cjs/index-674508e2.js.map +1 -0
- package/dist/cjs/jump-accordion.cjs.entry.js +1 -1
- package/dist/cjs/jump-badge.cjs.entry.js +27 -0
- package/dist/cjs/jump-badge.cjs.entry.js.map +1 -0
- package/dist/cjs/{jump-icon.cjs.entry.js → jump-button_2.cjs.entry.js} +35 -2
- package/dist/cjs/jump-button_2.cjs.entry.js.map +1 -0
- package/dist/cjs/jump-card-ecommerce.cjs.entry.js +31 -26
- package/dist/cjs/jump-card-ecommerce.cjs.entry.js.map +1 -1
- package/dist/cjs/jump-card.cjs.entry.js +3 -3
- package/dist/cjs/jump-design-system.cjs.js +2 -2
- package/dist/cjs/jump-filter.cjs.entry.js +3 -3
- package/dist/cjs/jump-filtergroup.cjs.entry.js +3 -3
- package/dist/cjs/jump-pagination-table.cjs.entry.js +16 -4
- package/dist/cjs/jump-pagination-table.cjs.entry.js.map +1 -1
- package/dist/cjs/jump-pagination.cjs.entry.js +18 -5
- package/dist/cjs/jump-pagination.cjs.entry.js.map +1 -1
- package/dist/cjs/{jump-badge_2.cjs.entry.js → jump-quantity.cjs.entry.js} +13 -24
- package/dist/cjs/jump-quantity.cjs.entry.js.map +1 -0
- package/dist/cjs/jump-tab-item.cjs.entry.js +4 -4
- package/dist/cjs/jump-tab-item.cjs.entry.js.map +1 -1
- package/dist/cjs/jump-tab-panel.cjs.entry.js +2 -2
- package/dist/cjs/jump-tab.cjs.entry.js +3 -3
- package/dist/cjs/jump-tab.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/jump-badge/jump-badge.css +90 -6
- package/dist/collection/components/jump-badge/jump-badge.js +60 -3
- package/dist/collection/components/jump-badge/jump-badge.js.map +1 -1
- package/dist/collection/components/jump-badge/jump-badge.stories.js +79 -4
- package/dist/collection/components/jump-badge/jump-badge.stories.js.map +1 -1
- package/dist/collection/components/jump-button/jump-button.js +1 -1
- package/dist/collection/components/jump-card/jump-card.js +2 -2
- package/dist/collection/components/jump-card-ecommerce/jump-card-ecommerce.css +4 -0
- package/dist/collection/components/jump-card-ecommerce/jump-card-ecommerce.js +30 -74
- package/dist/collection/components/jump-card-ecommerce/jump-card-ecommerce.js.map +1 -1
- package/dist/collection/components/jump-card-ecommerce/jump-card-ecommerce.stories.js +15 -21
- package/dist/collection/components/jump-card-ecommerce/jump-card-ecommerce.stories.js.map +1 -1
- package/dist/collection/components/jump-filter/jump-filter.js +2 -2
- package/dist/collection/components/jump-filtergroup/jump-filtergroup.js +2 -2
- package/dist/collection/components/jump-pagination/jump-pagination.css +1 -0
- package/dist/collection/components/jump-pagination/jump-pagination.js +17 -3
- package/dist/collection/components/jump-pagination/jump-pagination.js.map +1 -1
- package/dist/collection/components/jump-pagination-table/jump-pagination-table.js +15 -3
- package/dist/collection/components/jump-pagination-table/jump-pagination-table.js.map +1 -1
- package/dist/collection/components/jump-quantity/jump-quantity.css +3 -1
- package/dist/collection/components/jump-quantity/jump-quantity.js +32 -6
- package/dist/collection/components/jump-quantity/jump-quantity.js.map +1 -1
- package/dist/collection/components/jump-tab/jump-tab.css +2 -5
- package/dist/collection/components/jump-tab/jump-tab.js +1 -1
- package/dist/collection/components/jump-tab/jump-tab.js.map +1 -1
- package/dist/collection/components/jump-tab/jump-tab.stories.js +13 -13
- package/dist/collection/components/jump-tab/jump-tab.stories.js.map +1 -1
- package/dist/collection/components/jump-tab-item/jump-tab-item-boxed.stories.js +3 -5
- package/dist/collection/components/jump-tab-item/jump-tab-item-boxed.stories.js.map +1 -1
- package/dist/collection/components/jump-tab-item/jump-tab-item-inline.stories.js +3 -5
- package/dist/collection/components/jump-tab-item/jump-tab-item-inline.stories.js.map +1 -1
- package/dist/collection/components/jump-tab-item/jump-tab-item.css +34 -34
- package/dist/collection/components/jump-tab-item/jump-tab-item.js +3 -2
- package/dist/collection/components/jump-tab-item/jump-tab-item.js.map +1 -1
- package/dist/collection/components/jump-tab-panel/jump-tab-panel.js +1 -1
- package/dist/components/jump-badge2.js +9 -3
- package/dist/components/jump-badge2.js.map +1 -1
- package/dist/components/jump-button2.js +1 -1
- package/dist/components/jump-card-ecommerce.js +36 -39
- package/dist/components/jump-card-ecommerce.js.map +1 -1
- package/dist/components/jump-card.js +2 -2
- package/dist/components/jump-filter.js +2 -2
- package/dist/components/jump-filtergroup.js +2 -2
- package/dist/components/jump-pagination-table.js +22 -4
- package/dist/components/jump-pagination-table.js.map +1 -1
- package/dist/components/jump-pagination.js +26 -6
- package/dist/components/jump-pagination.js.map +1 -1
- package/dist/components/jump-quantity.js +102 -1
- package/dist/components/jump-quantity.js.map +1 -1
- package/dist/components/jump-tab-item.js +5 -4
- package/dist/components/jump-tab-item.js.map +1 -1
- package/dist/components/jump-tab-panel.js +1 -1
- package/dist/components/jump-tab.js +2 -2
- package/dist/components/jump-tab.js.map +1 -1
- package/dist/esm/{index-056a0a66.js → index-70f1949a.js} +9 -4
- package/dist/esm/index-70f1949a.js.map +1 -0
- package/dist/esm/jump-accordion.entry.js +1 -1
- package/dist/esm/jump-badge.entry.js +23 -0
- package/dist/esm/jump-badge.entry.js.map +1 -0
- package/dist/esm/{jump-icon.entry.js → jump-button_2.entry.js} +35 -3
- package/dist/esm/jump-button_2.entry.js.map +1 -0
- package/dist/esm/jump-card-ecommerce.entry.js +31 -26
- package/dist/esm/jump-card-ecommerce.entry.js.map +1 -1
- package/dist/esm/jump-card.entry.js +3 -3
- package/dist/esm/jump-design-system.js +3 -3
- package/dist/esm/jump-filter.entry.js +3 -3
- package/dist/esm/jump-filtergroup.entry.js +3 -3
- package/dist/esm/jump-pagination-table.entry.js +16 -4
- package/dist/esm/jump-pagination-table.entry.js.map +1 -1
- package/dist/esm/jump-pagination.entry.js +18 -5
- package/dist/esm/jump-pagination.entry.js.map +1 -1
- package/dist/esm/{jump-badge_2.entry.js → jump-quantity.entry.js} +14 -24
- package/dist/esm/jump-quantity.entry.js.map +1 -0
- package/dist/esm/jump-tab-item.entry.js +4 -4
- package/dist/esm/jump-tab-item.entry.js.map +1 -1
- package/dist/esm/jump-tab-panel.entry.js +2 -2
- package/dist/esm/jump-tab.entry.js +3 -3
- package/dist/esm/jump-tab.entry.js.map +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/jump-design-system/jump-design-system.esm.js +1 -1
- package/dist/jump-design-system/jump-design-system.esm.js.map +1 -1
- package/dist/jump-design-system/p-2cb7d817.entry.js +2 -0
- package/dist/jump-design-system/p-2cb7d817.entry.js.map +1 -0
- package/dist/jump-design-system/p-34a46a10.entry.js +2 -0
- package/dist/jump-design-system/p-34a46a10.entry.js.map +1 -0
- package/dist/jump-design-system/p-377a769b.entry.js +2 -0
- package/dist/jump-design-system/p-377a769b.entry.js.map +1 -0
- package/dist/jump-design-system/p-493c7f4a.entry.js +2 -0
- package/dist/jump-design-system/p-493c7f4a.entry.js.map +1 -0
- package/dist/jump-design-system/p-4d6cc90d.js +3 -0
- package/dist/jump-design-system/p-4d6cc90d.js.map +1 -0
- package/dist/jump-design-system/p-56609b82.entry.js +2 -0
- package/dist/jump-design-system/p-5a6fbc53.entry.js +2 -0
- package/dist/jump-design-system/p-5d713084.entry.js +2 -0
- package/dist/jump-design-system/p-7696c03d.entry.js +2 -0
- package/dist/jump-design-system/p-7696c03d.entry.js.map +1 -0
- package/dist/jump-design-system/p-8343b4f5.entry.js +2 -0
- package/dist/jump-design-system/p-8343b4f5.entry.js.map +1 -0
- package/dist/jump-design-system/{p-83e6ab6e.entry.js → p-a6fc23f7.entry.js} +2 -2
- package/dist/jump-design-system/{p-58602fcb.entry.js → p-c1665537.entry.js} +2 -2
- package/dist/jump-design-system/p-c2bc6395.entry.js +66 -0
- package/dist/jump-design-system/p-c2bc6395.entry.js.map +1 -0
- package/dist/jump-design-system/p-fafe6478.entry.js +2 -0
- package/dist/jump-design-system/p-fafe6478.entry.js.map +1 -0
- package/dist/jump-design-system-elements.json +38 -8
- package/dist/types/components/jump-badge/jump-badge.d.ts +13 -1
- package/dist/types/components/jump-badge/jump-badge.stories.d.ts +22 -1
- package/dist/types/components/jump-card-ecommerce/jump-card-ecommerce.d.ts +5 -6
- package/dist/types/components/jump-card-ecommerce/jump-card-ecommerce.stories.d.ts +0 -6
- package/dist/types/components/jump-quantity/jump-quantity.d.ts +4 -0
- package/dist/types/components/jump-tab-item/jump-tab-item-boxed.stories.d.ts +0 -1
- package/dist/types/components/jump-tab-item/jump-tab-item-inline.stories.d.ts +0 -1
- package/dist/types/components.d.ts +30 -20
- package/package.json +1 -1
- package/dist/cjs/index-418c607f.js.map +0 -1
- package/dist/cjs/jump-badge_2.cjs.entry.js.map +0 -1
- package/dist/cjs/jump-button.cjs.entry.js +0 -41
- package/dist/cjs/jump-button.cjs.entry.js.map +0 -1
- package/dist/cjs/jump-icon.cjs.entry.js.map +0 -1
- package/dist/components/jump-quantity2.js +0 -94
- package/dist/components/jump-quantity2.js.map +0 -1
- package/dist/esm/index-056a0a66.js.map +0 -1
- package/dist/esm/jump-badge_2.entry.js.map +0 -1
- package/dist/esm/jump-button.entry.js +0 -37
- package/dist/esm/jump-button.entry.js.map +0 -1
- package/dist/esm/jump-icon.entry.js.map +0 -1
- package/dist/jump-design-system/p-0dc744ce.entry.js +0 -2
- package/dist/jump-design-system/p-357cf73d.entry.js +0 -66
- package/dist/jump-design-system/p-357cf73d.entry.js.map +0 -1
- package/dist/jump-design-system/p-58bed455.entry.js +0 -2
- package/dist/jump-design-system/p-58bed455.entry.js.map +0 -1
- package/dist/jump-design-system/p-647ec30b.entry.js +0 -2
- package/dist/jump-design-system/p-647ec30b.entry.js.map +0 -1
- package/dist/jump-design-system/p-8ec76454.entry.js +0 -2
- package/dist/jump-design-system/p-8ec76454.entry.js.map +0 -1
- package/dist/jump-design-system/p-91794ae6.js +0 -3
- package/dist/jump-design-system/p-91794ae6.js.map +0 -1
- package/dist/jump-design-system/p-afe0cca0.entry.js +0 -2
- package/dist/jump-design-system/p-b2ca2e96.entry.js +0 -2
- package/dist/jump-design-system/p-b2ca2e96.entry.js.map +0 -1
- package/dist/jump-design-system/p-d58e0952.entry.js +0 -2
- package/dist/jump-design-system/p-d58e0952.entry.js.map +0 -1
- package/dist/jump-design-system/p-e2318686.entry.js +0 -2
- package/dist/jump-design-system/p-e2318686.entry.js.map +0 -1
- package/dist/jump-design-system/p-ee61c223.entry.js +0 -2
- package/dist/jump-design-system/p-f842ff46.entry.js +0 -2
- package/dist/jump-design-system/p-f842ff46.entry.js.map +0 -1
- /package/dist/jump-design-system/{p-afe0cca0.entry.js.map → p-56609b82.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-ee61c223.entry.js.map → p-5a6fbc53.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-0dc744ce.entry.js.map → p-5d713084.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-83e6ab6e.entry.js.map → p-a6fc23f7.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-58602fcb.entry.js.map → p-c1665537.entry.js.map} +0 -0
|
@@ -23,13 +23,29 @@ export class JumpCardEcommerce {
|
|
|
23
23
|
this.addtoCartText = undefined;
|
|
24
24
|
this.waitingListText = undefined;
|
|
25
25
|
this.addToWaitingList = false;
|
|
26
|
-
this.quantity = false;
|
|
27
|
-
this.changedQuantity = false;
|
|
28
26
|
this.changedVariation = false;
|
|
29
27
|
}
|
|
30
28
|
/* ---------------------- @LIFECYCLE ------------------------- */
|
|
31
|
-
componentWillLoad() {
|
|
32
|
-
|
|
29
|
+
componentWillLoad() { }
|
|
30
|
+
componentDidLoad() {
|
|
31
|
+
this.jumpQuantityEl = this.JumpCardEcommerce.querySelector('jump-quantity');
|
|
32
|
+
if (this.jumpQuantityEl) {
|
|
33
|
+
this.jumpQuantityEl.addEventListener('jump-change', this.onQuantityChange.bind(this));
|
|
34
|
+
this.quantity = this.jumpQuantityEl.getValue().then((quantity) => {
|
|
35
|
+
this.quantity = quantity;
|
|
36
|
+
});
|
|
37
|
+
console.log('Quantity:', this.quantity);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
disconnectedCallback() {
|
|
41
|
+
this.jumpQuantityEl = this.JumpCardEcommerce.querySelector('jump-quantity');
|
|
42
|
+
if (this.jumpQuantityEl) {
|
|
43
|
+
this.jumpQuantityEl.removeEventListener('jump-change', this.onQuantityChange);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/* ---------------------- @METHODS ------------------------- */
|
|
47
|
+
onQuantityChange(e) {
|
|
48
|
+
this.quantity = e.detail.value;
|
|
33
49
|
}
|
|
34
50
|
onToggleFavorite() {
|
|
35
51
|
this.favorite = !this.favorite;
|
|
@@ -43,7 +59,7 @@ export class JumpCardEcommerce {
|
|
|
43
59
|
const payload = {
|
|
44
60
|
productId: this.productId,
|
|
45
61
|
addedToCart: this.addedToCart,
|
|
46
|
-
quantity:
|
|
62
|
+
quantity: this.quantity
|
|
47
63
|
// mancano le variazioni
|
|
48
64
|
};
|
|
49
65
|
this.productAddToCart.emit(payload);
|
|
@@ -56,21 +72,6 @@ export class JumpCardEcommerce {
|
|
|
56
72
|
addToWaitingList: this.addToWaitingList
|
|
57
73
|
});
|
|
58
74
|
}
|
|
59
|
-
changeQuantityProduct(event) {
|
|
60
|
-
// const quantityInput = this.JumpCardEcommerce.querySelector('jump-quantity');
|
|
61
|
-
// const quantityValue = quantityInput.value; // Access the `value` property
|
|
62
|
-
const quantityElement = event.target;
|
|
63
|
-
console.log('Valore selezionato:', quantityElement);
|
|
64
|
-
// const quantityValue = quantityElement.value;
|
|
65
|
-
this.changedQuantity = true;
|
|
66
|
-
const payload = {
|
|
67
|
-
productId: this.productId,
|
|
68
|
-
changedQuantity: this.changedQuantity,
|
|
69
|
-
quantity: 2 // da sostituire con quaintity value
|
|
70
|
-
};
|
|
71
|
-
this.changeQuantity.emit(payload);
|
|
72
|
-
console.log("changeQuantity payload:", payload);
|
|
73
|
-
}
|
|
74
75
|
changeVariationBody(event) {
|
|
75
76
|
const selectElement = event.target;
|
|
76
77
|
const selectedValue = selectElement.value;
|
|
@@ -87,10 +88,15 @@ export class JumpCardEcommerce {
|
|
|
87
88
|
const backgroundClass = this.hasBackground ? 'hasBackground' : '';
|
|
88
89
|
const iconOnlyClass = this.onlyIconButton ? 'iconOnly' : '';
|
|
89
90
|
const justifyClass = this.outOfStock ? 'justify-between' : '';
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
function calculateDiscount(price, salePrice) {
|
|
92
|
+
const discount = ((price - salePrice) / price) * 100;
|
|
93
|
+
return discount.toFixed(0);
|
|
94
|
+
}
|
|
95
|
+
;
|
|
96
|
+
return (h(Host, null, this.badge ? h("jump-badge", { class: `${backgroundClass} ${iconOnlyClass}`, variant: "secondary", dimension: "small", label: this.badge }) : '', h("jump-button", { onClick: () => this.onToggleFavorite(), class: `Favorite ${backgroundClass} ${iconOnlyClass}`, variant: this.favorite ? 'neutral' : 'primary', size: "small", text: true, onlyIcon: true }, h("jump-icon", { slot: "prefix", name: "heart", category: this.favorite ? 'light' : 'solid', size: "medium" })), h("div", { class: `Media ${iconOnlyClass} ${backgroundClass}` }, h("a", { href: this.link }, this.img && !this.videoSrc ? h("img", { src: this.img, alt: this.imgAlt }) : '', this.videoSrc && !this.img ?
|
|
97
|
+
h("video", { autoplay: true }, h("source", { src: this.videoSrc, type: "video/mp4" }), h("source", { src: this.videoSrc, type: "video/mov" }), h("source", { src: this.videoSrc, type: "video/webm" })) : ''), h("div", { class: `NotificationCart ${this.addedToCart == true ? 'is-active' : ''}` }, h("jump-button", { href: this.notificationUrl, variant: "white", text: true }, h("jump-icon", { slot: "prefix", name: "check" }), h("span", null, " ", this.notificationText, " "))), this.onlyIconButton ?
|
|
92
98
|
h("div", { class: "OnlyIconButton" }, h("jump-button", { variant: "secondary", size: "large", pill: true, onlyIcon: true, onClick: () => this.addProductToCart() }, h("jump-icon", { slot: "prefix", name: 'cart-shopping', category: "regular" })))
|
|
93
|
-
: ''), h("div", {
|
|
99
|
+
: ''), h("div", { class: `Content ${backgroundClass} ${iconOnlyClass}` }, h("div", { class: `Body ${backgroundClass} ${iconOnlyClass}` }, h("div", null, h("div", { class: "Info" }, h("div", { class: "Product" }, this.productName), h("div", { class: "Subtitle" }, this.subtitle)), h("div", { class: "Price" }, h("div", { class: "Price__Discount" }, calculateDiscount(this.price, this.salePrice), "%"), h("div", { class: `Price__Regular ${this.salePrice ? 'sale' : ''}` }, this.currency, this.price), h("div", { class: "Price__Sale" }, this.currency, this.salePrice))), h("div", null, h("slot", { name: "select" }), h("slot", { name: "quantity" }))), h("div", { class: `Footer ${justifyClass} ${backgroundClass} ${iconOnlyClass}` }, this.outOfStock ? h("div", { class: "OutOfStock" }, this.outOfStockText ? this.outOfStockText : 'Esaurito') : '', this.outOfStock ?
|
|
94
100
|
h("jump-button", { variant: "secondary", size: "small", text: true, onClick: () => this.waitingList() }, h("jump-icon", { slot: "prefix", name: !this.outOfStock ? 'cart-shopping' : 'bell', category: "regular", size: "small" }), this.waitingListText ? this.waitingListText : 'Notifica disponibilità') : '', !this.outOfStock && !this.onlyIconButton ?
|
|
95
101
|
h("jump-button", { variant: "secondary", size: "small", text: true, onClick: () => this.addProductToCart() }, h("jump-icon", { slot: "prefix", name: !this.outOfStock ? 'cart-shopping' : 'bell', category: "regular", size: "small" }), this.addtoCartText ? this.addtoCartText : 'Aggiungi al carrello') : ''))));
|
|
96
102
|
}
|
|
@@ -489,42 +495,6 @@ export class JumpCardEcommerce {
|
|
|
489
495
|
"reflect": false,
|
|
490
496
|
"defaultValue": "false"
|
|
491
497
|
},
|
|
492
|
-
"quantity": {
|
|
493
|
-
"type": "boolean",
|
|
494
|
-
"mutable": true,
|
|
495
|
-
"complexType": {
|
|
496
|
-
"original": "boolean",
|
|
497
|
-
"resolved": "boolean",
|
|
498
|
-
"references": {}
|
|
499
|
-
},
|
|
500
|
-
"required": false,
|
|
501
|
-
"optional": false,
|
|
502
|
-
"docs": {
|
|
503
|
-
"tags": [],
|
|
504
|
-
"text": "Indicates if the user can choose how much quantity of the product add to cart"
|
|
505
|
-
},
|
|
506
|
-
"attribute": "quantity",
|
|
507
|
-
"reflect": true,
|
|
508
|
-
"defaultValue": "false"
|
|
509
|
-
},
|
|
510
|
-
"changedQuantity": {
|
|
511
|
-
"type": "boolean",
|
|
512
|
-
"mutable": false,
|
|
513
|
-
"complexType": {
|
|
514
|
-
"original": "boolean",
|
|
515
|
-
"resolved": "boolean",
|
|
516
|
-
"references": {}
|
|
517
|
-
},
|
|
518
|
-
"required": false,
|
|
519
|
-
"optional": false,
|
|
520
|
-
"docs": {
|
|
521
|
-
"tags": [],
|
|
522
|
-
"text": "Indicate if the quantity is change"
|
|
523
|
-
},
|
|
524
|
-
"attribute": "changed-quantity",
|
|
525
|
-
"reflect": false,
|
|
526
|
-
"defaultValue": "false"
|
|
527
|
-
},
|
|
528
498
|
"changedVariation": {
|
|
529
499
|
"type": "boolean",
|
|
530
500
|
"mutable": false,
|
|
@@ -591,21 +561,6 @@ export class JumpCardEcommerce {
|
|
|
591
561
|
"resolved": "any",
|
|
592
562
|
"references": {}
|
|
593
563
|
}
|
|
594
|
-
}, {
|
|
595
|
-
"method": "changeQuantity",
|
|
596
|
-
"name": "jump-change-quantity",
|
|
597
|
-
"bubbles": true,
|
|
598
|
-
"cancelable": true,
|
|
599
|
-
"composed": true,
|
|
600
|
-
"docs": {
|
|
601
|
-
"tags": [],
|
|
602
|
-
"text": ""
|
|
603
|
-
},
|
|
604
|
-
"complexType": {
|
|
605
|
-
"original": "any",
|
|
606
|
-
"resolved": "any",
|
|
607
|
-
"references": {}
|
|
608
|
-
}
|
|
609
564
|
}, {
|
|
610
565
|
"method": "changeVariation",
|
|
611
566
|
"name": "jump-change-variation",
|
|
@@ -623,5 +578,6 @@ export class JumpCardEcommerce {
|
|
|
623
578
|
}
|
|
624
579
|
}];
|
|
625
580
|
}
|
|
581
|
+
static get elementRef() { return "JumpCardEcommerce"; }
|
|
626
582
|
}
|
|
627
583
|
//# sourceMappingURL=jump-card-ecommerce.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jump-card-ecommerce.js","sourceRoot":"","sources":["../../../src/components/jump-card-ecommerce/jump-card-ecommerce.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAO9E,MAAM,OAAO,iBAAiB;;8BAOM,KAAK;6BAGN,KAAK;;wBAMmB,KAAK;;;;;2BAe/B,KAAK;;gCAMD,sBAAsB;;;;;;;0BAqBE,KAAK;;;;gCAY5B,KAAK;wBAGgB,KAAK;+BAG3B,KAAK;gCAGJ,KAAK;;IAmBzC,iEAAiE;IAEjE,iBAAiB;QACf,8DAA8D;IAChE,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,IAAI,CACtB;YACE,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CACF,CAAC;IACJ,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,MAAM,OAAO,GAAG;YACd,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,CAAC,CAAC,2BAA2B;YACvC,wBAAwB;SACzB,CAAC;QACF,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,WAAW;QACT,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,kBAAkB,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Prop, Event, EventEmitter } from '@stencil/core';\n\n@Component({\n tag: 'jump-card-ecommerce',\n styleUrl: 'jump-card-ecommerce.scss',\n shadow: true,\n})\nexport class JumpCardEcommerce {\n\n JumpCardEcommerce: HTMLElement;\n\n /* ---------------------- @PROPERTIES ------------------------- */\n\n /** Indicate if card has only icon button*/\n @Prop() onlyIconButton: boolean = false;\n\n /** Indicate if card has background*/\n @Prop() hasBackground: boolean = false;\n\n /** Indicates the badge of the card*/\n @Prop() badge: string;\n\n /** Indicates if the product is favorite */\n @Prop({mutable:true, reflect: true}) favorite: boolean = false;\n\n /** Indicates the link of the card*/\n @Prop() link: string;\n\n /** Indicates the image's src of the card*/\n @Prop() img: string ;\n\n /** Indicates the img's alt of the card*/\n @Prop() imgAlt: string;\n\n /** Indicates the videoSrc of the card*/\n @Prop() videoSrc: string; \n\n /** Indicate if the product is added to cart*/\n @Prop() addedToCart: boolean = false;\n\n /** Indicates the notificationUrl of the card*/\n @Prop() notificationUrl: string;\n\n /** Indicates the notificationText of the card*/\n @Prop() notificationText: string = 'Aggiunto al carrello';\n\n /** Indicates the title of the card*/\n @Prop() productName: string ;\n\n /** Indicates the subtitle of the card*/\n @Prop() subtitle: string;\n\n /** Indicates the ID of the product, can be also a SKU*/\n @Prop() productId: string ;\n\n /** Indicates the price of the card */\n @Prop() price: number;\n\n /** Indicates the sale price of the card */\n @Prop() salePrice: number;\n\n /** Indicates the currency of the card */\n @Prop() currency: string;\n\n /** Indicates if the product is outOfStock */\n @Prop({mutable:true, reflect: true}) outOfStock: boolean = false;\n \n /** Indicates the outOfStockText of the product*/\n @Prop() outOfStockText: string;\n\n /** Indicates the button class of the add to cart / notification button */\n @Prop() addtoCartText: string ;\n\n /** Indicates the button class of the add to cart / notification button */\n @Prop() waitingListText: string ;\n\n /** Indicate if the user request to be notified when te product is avaible*/\n @Prop() addToWaitingList: boolean = false;\n\n /** Indicates if the user can choose how much quantity of the product add to cart */\n @Prop({mutable:true, reflect: true}) quantity: boolean = false;\n\n /** Indicate if the quantity is change*/\n @Prop() changedQuantity: boolean = false;\n\n /** Indicate if the variation is change*/\n @Prop() changedVariation: boolean = false;\n\n // /** Indicates the inizial value of input quantity*/\n // @Prop() quantity: number ;\n\n\n /* ---------------------- @EVENTS ------------------------- */\n \n @Event({eventName: 'jump-toggle-favorite'}) toggleFavorite: EventEmitter;\n\n @Event({eventName: 'jump-add-to-cart'}) productAddToCart: EventEmitter;\n\n @Event({eventName: 'jump-add-to-waiting-list'}) productWaitingList: EventEmitter;\n\n @Event({eventName: 'jump-change-quantity'}) changeQuantity: EventEmitter;\n\n @Event({eventName: 'jump-change-variation'}) changeVariation: EventEmitter;\n\n \n /* ---------------------- @LIFECYCLE ------------------------- */\n\n componentWillLoad() {\n // this._selectVariations = this.selectVariations?.split(',');\n }\n\n onToggleFavorite() {\n this.favorite = !this.favorite;\n this.toggleFavorite.emit(\n {\n productId: this.productId,\n favorite: this.favorite\n }\n ); \n }\n\n addProductToCart() {\n this.addedToCart = true;\n const payload = {\n productId: this.productId,\n addedToCart: this.addedToCart,\n quantity: 2 // da prendere dal quantity\n // mancano le variazioni\n };\n this.productAddToCart.emit(payload);\n console.log(\"productAddToCart payload:\", payload);\n }\n\n waitingList() {\n this.addToWaitingList = true;\n this.productWaitingList.emit(\n {\n productId: this.productId,\n addToWaitingList: this.addToWaitingList\n }\n )\n }\n\n changeQuantityProduct(event: Event) {\n // const quantityInput = this.JumpCardEcommerce.querySelector('jump-quantity');\n // const quantityValue = quantityInput.value; // Access the `value` property\n const quantityElement = event.target as HTMLInputElement;\n console.log('Valore selezionato:', quantityElement);\n // const quantityValue = quantityElement.value;\n\n this.changedQuantity = true;\n const payload = {\n productId: this.productId,\n changedQuantity: this.changedQuantity,\n quantity: 2 // da sostituire con quaintity value\n };\n this.changeQuantity.emit(payload);\n console.log(\"changeQuantity payload:\", payload)\n }\n\n changeVariationBody(event: Event) {\n const selectElement = event.target as HTMLSelectElement;\n const selectedValue = selectElement.value;\n\n this.changedVariation = true;\n const payload = {\n productId: this.productId,\n changedVariation: this.changedVariation,\n variation: selectedValue // da sostituire\n };\n this.changeVariation.emit(payload);\n console.log(\"changeVariation payload:\", payload)\n }\n\n render() {\n const backgroundClass = this.hasBackground ? 'hasBackground' : '';\n const iconOnlyClass = this.onlyIconButton ? 'iconOnly' : '';\n const justifyClass = this.outOfStock ? 'justify-between' : '';\n\n return (\n\n <Host ref={(el) => {this.JumpCardEcommerce = el;}} >\n {this.badge ? <jump-badge class={`${backgroundClass} ${iconOnlyClass}`} variant=\"secondary\" label={this.badge}></jump-badge> : ''}\n \n <jump-button onClick={ () => this.onToggleFavorite() } class={`Favorite ${backgroundClass} ${iconOnlyClass}`} variant={this.favorite ? 'neutral' : 'primary'} size=\"small\" text onlyIcon>\n <jump-icon slot=\"prefix\" name=\"heart\" category={this.favorite ? 'light' : 'solid'} size=\"medium\"></jump-icon>\n </jump-button> \n\n <div class={`Media ${iconOnlyClass} ${backgroundClass}`}>\n <a href={this.link}>\n {this.img && !this.videoSrc ? <img src={this.img} alt={this.imgAlt}></img> : ''}\n {this.videoSrc && !this.img ? \n <video autoplay> \n <source src={this.videoSrc} type=\"video/mp4\"/> \n <source src={this.videoSrc} type=\"video/mov\"/> \n <source src={this.videoSrc} type=\"video/webm\"/> \n </video> : ''}\n </a> \n <div class={`NotificationCart ${this.addedToCart == true ? 'is-active' : ''}`}>\n <jump-button href={this.notificationUrl} variant=\"white\" text> \n <jump-icon slot=\"prefix\" name=\"check\"></jump-icon> \n <span> {this.notificationText} </span>\n </jump-button>\n </div>\n {this.onlyIconButton ? \n <div class=\"OnlyIconButton\">\n <jump-button variant=\"secondary\" size=\"large\" pill onlyIcon onClick={() => this.addProductToCart()}> \n <jump-icon slot=\"prefix\" name='cart-shopping' category=\"regular\"></jump-icon> \n </jump-button> \n </div>\n : ''\n }\n </div>\n\n <div class={`Content ${backgroundClass} ${iconOnlyClass}`}>\n <div class={`Body ${backgroundClass} ${iconOnlyClass}`}>\n <div>\n <div class=\"Info\">\n <div class=\"Product\">{this.productName}</div>\n <div class=\"Subtitle\">{this.subtitle}</div>\n </div>\n\n <div class=\"Price\">\n <div class=\"Price__Discount\">-5%</div>\n <div class={`Price__Regular ${this.salePrice ? 'sale' : ''}`}> \n {this.currency}{this.price}\n </div>\n <div class=\"Price__Sale\">{this.currency}{this.salePrice}</div>\n </div>\n </div>\n <div>\n {/* manca la proprietà se ci sono variazioni o no */}\n <select name=\"select\" id=\"selectID\" onChange={(event) => this.changeVariationBody(event)}>\n <option value='m'>medium</option>\n <option value='l'>large</option>\n <option value='xl'>extra large</option>\n </select>\n\n {this.quantity ? <jump-quantity onClick={(event) => this.changeQuantityProduct(event)}></jump-quantity> : ''}\n \n {/* <slot name=\"select\"></slot>\n <slot name=\"quantity\"></slot> */}\n </div>\n \n </div>\n\n <div class={`Footer ${justifyClass} ${backgroundClass} ${iconOnlyClass}`}>\n \n {this.outOfStock ? <div class=\"OutOfStock\">{this.outOfStockText ? this.outOfStockText : 'Esaurito'}</div> : ''}\n \n { this.outOfStock ? \n <jump-button variant=\"secondary\" size=\"small\" text onClick={() => this.waitingList()}> \n <jump-icon slot=\"prefix\" name={!this.outOfStock ? 'cart-shopping' : 'bell'} category=\"regular\" size=\"small\"></jump-icon> \n {this.waitingListText ? this.waitingListText : 'Notifica disponibilità'} \n </jump-button> : ''\n }\n\n { !this.outOfStock && !this.onlyIconButton ? \n <jump-button variant=\"secondary\" size=\"small\" text onClick={() => this.addProductToCart()}> \n <jump-icon slot=\"prefix\" name={!this.outOfStock ? 'cart-shopping' : 'bell'} category=\"regular\" size=\"small\"></jump-icon> \n {this.addtoCartText ? this.addtoCartText : 'Aggiungi al carrello'} \n </jump-button> : ''\n }\n\n </div>\n\n </div>\n </Host>\n );\n }\n\n}"]}
|
|
1
|
+
{"version":3,"file":"jump-card-ecommerce.js","sourceRoot":"","sources":["../../../src/components/jump-card-ecommerce/jump-card-ecommerce.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,OAAO,EAAC,MAAM,eAAe,CAAC;AAOtF,MAAM,OAAO,iBAAiB;;8BAQM,KAAK;6BAGN,KAAK;;wBAMmB,KAAK;;;;;2BAe/B,KAAK;;gCAMD,sBAAsB;;;;;;;0BAqBE,KAAK;;;;gCAY5B,KAAK;gCAGL,KAAK;;IAwBzC,iEAAiE;IAEjE,iBAAiB,KAAI,CAAC;IAEtB,gBAAgB;QACd,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QAE5E,IAAG,IAAI,CAAC,cAAc,EAAC,CAAC;YACtB,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,aAAa,EAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACvF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;gBAC/D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YAC3B,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QACzC,CAAC;IACH,CAAC;IAED,oBAAoB;QAClB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QAC5E,IAAG,IAAI,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Prop, Event, EventEmitter, Element} from '@stencil/core';\n\n@Component({\n tag: 'jump-card-ecommerce',\n styleUrl: 'jump-card-ecommerce.scss',\n shadow: true,\n})\nexport class JumpCardEcommerce {\n\n @Element() JumpCardEcommerce: HTMLElement;\n jumpQuantityEl;\n\n /* ---------------------- @PROPERTIES ------------------------- */\n\n /** Indicate if card has only icon button*/\n @Prop() onlyIconButton: boolean = false;\n\n /** Indicate if card has background*/\n @Prop() hasBackground: boolean = false;\n\n /** Indicates the badge of the card*/\n @Prop() badge: string;\n\n /** Indicates if the product is favorite */\n @Prop({mutable:true, reflect: true}) favorite: boolean = false;\n\n /** Indicates the link of the card*/\n @Prop() link: string;\n\n /** Indicates the image's src of the card*/\n @Prop() img: string ;\n\n /** Indicates the img's alt of the card*/\n @Prop() imgAlt: string;\n\n /** Indicates the videoSrc of the card*/\n @Prop() videoSrc: string; \n\n /** Indicate if the product is added to cart*/\n @Prop() addedToCart: boolean = false;\n\n /** Indicates the notificationUrl of the card*/\n @Prop() notificationUrl: string;\n\n /** Indicates the notificationText of the card*/\n @Prop() notificationText: string = 'Aggiunto al carrello';\n\n /** Indicates the title of the card*/\n @Prop() productName: string ;\n\n /** Indicates the subtitle of the card*/\n @Prop() subtitle: string;\n\n /** Indicates the ID of the product, can be also a SKU*/\n @Prop() productId: string ;\n\n /** Indicates the price of the card */\n @Prop() price: number;\n\n /** Indicates the sale price of the card */\n @Prop() salePrice: number;\n\n /** Indicates the currency of the card */\n @Prop() currency: string;\n\n /** Indicates if the product is outOfStock */\n @Prop({mutable:true, reflect: true}) outOfStock: boolean = false;\n \n /** Indicates the outOfStockText of the product*/\n @Prop() outOfStockText: string;\n\n /** Indicates the button class of the add to cart / notification button */\n @Prop() addtoCartText: string ;\n\n /** Indicates the button class of the add to cart / notification button */\n @Prop() waitingListText: string ;\n\n /** Indicate if the user request to be notified when te product is avaible*/\n @Prop() addToWaitingList: boolean = false;\n\n /** Indicate if the variation is change*/\n @Prop() changedVariation: boolean = false;\n\n /* ---------------------- @STATE ------------------------- */ \n\n // è una proprietà che viene cambiata solo da dentro\n\n quantity: number;\n\n // @Watch('quantity') \n // funziona solo dalla seconda volta in poi \n // watchQuantity(newValue, oldValue) {\n // console.log('quantity changed:', newValue, oldValue);\n // }\n\n /* ---------------------- @EVENTS ------------------------- */\n \n @Event({eventName: 'jump-toggle-favorite'}) toggleFavorite: EventEmitter;\n\n @Event({eventName: 'jump-add-to-cart'}) productAddToCart: EventEmitter;\n\n @Event({eventName: 'jump-add-to-waiting-list'}) productWaitingList: EventEmitter;\n\n @Event({eventName: 'jump-change-variation'}) changeVariation: EventEmitter;\n \n /* ---------------------- @LIFECYCLE ------------------------- */\n\n componentWillLoad() {}\n\n componentDidLoad() {\n this.jumpQuantityEl = this.JumpCardEcommerce.querySelector('jump-quantity');\n \n if(this.jumpQuantityEl){\n this.jumpQuantityEl.addEventListener('jump-change', this.onQuantityChange.bind(this));\n this.quantity = this.jumpQuantityEl.getValue().then((quantity) => {\n this.quantity = quantity;\n });\n\n console.log('Quantity:', this.quantity)\n }\n }\n\n disconnectedCallback() {\n this.jumpQuantityEl = this.JumpCardEcommerce.querySelector('jump-quantity');\n if(this.jumpQuantityEl){\n this.jumpQuantityEl.removeEventListener('jump-change',this.onQuantityChange);\n }\n }\n\n /* ---------------------- @METHODS ------------------------- */\n onQuantityChange(e) {\n this.quantity = e.detail.value;\n }\n\n onToggleFavorite() {\n this.favorite = !this.favorite;\n this.toggleFavorite.emit(\n {\n productId: this.productId,\n favorite: this.favorite\n }\n ); \n }\n\n addProductToCart() {\n this.addedToCart = true;\n const payload = {\n productId: this.productId,\n addedToCart: this.addedToCart,\n quantity: this.quantity\n // mancano le variazioni\n };\n this.productAddToCart.emit(payload);\n console.log(\"productAddToCart payload:\", payload);\n }\n\n waitingList() {\n this.addToWaitingList = true;\n this.productWaitingList.emit(\n {\n productId: this.productId,\n addToWaitingList: this.addToWaitingList\n }\n )\n }\n\n changeVariationBody(event: Event) {\n const selectElement = event.target as HTMLSelectElement;\n const selectedValue = selectElement.value;\n\n this.changedVariation = true;\n const payload = {\n productId: this.productId,\n changedVariation: this.changedVariation,\n variation: selectedValue // da sostituire\n };\n this.changeVariation.emit(payload);\n console.log(\"changeVariation payload:\", payload)\n }\n\n \n render() {\n const backgroundClass = this.hasBackground ? 'hasBackground' : '';\n const iconOnlyClass = this.onlyIconButton ? 'iconOnly' : '';\n const justifyClass = this.outOfStock ? 'justify-between' : '';\n function calculateDiscount(price: number, salePrice: number): string {\n const discount = ((price - salePrice) / price) * 100;\n return discount.toFixed(0);\n };\n\n return (\n <Host>\n {this.badge ? <jump-badge class={`${backgroundClass} ${iconOnlyClass}`} variant=\"secondary\" dimension=\"small\" label={this.badge}></jump-badge> : ''}\n \n <jump-button onClick={ () => this.onToggleFavorite() } class={`Favorite ${backgroundClass} ${iconOnlyClass}`} variant={this.favorite ? 'neutral' : 'primary'} size=\"small\" text onlyIcon>\n <jump-icon slot=\"prefix\" name=\"heart\" category={this.favorite ? 'light' : 'solid'} size=\"medium\"></jump-icon>\n </jump-button> \n\n <div class={`Media ${iconOnlyClass} ${backgroundClass}`}>\n <a href={this.link}>\n {this.img && !this.videoSrc ? <img src={this.img} alt={this.imgAlt}></img> : ''}\n {this.videoSrc && !this.img ? \n <video autoplay> \n <source src={this.videoSrc} type=\"video/mp4\"/> \n <source src={this.videoSrc} type=\"video/mov\"/> \n <source src={this.videoSrc} type=\"video/webm\"/> \n </video> : ''}\n </a> \n <div class={`NotificationCart ${this.addedToCart == true ? 'is-active' : ''}`}>\n <jump-button href={this.notificationUrl} variant=\"white\" text> \n <jump-icon slot=\"prefix\" name=\"check\"></jump-icon> \n <span> {this.notificationText} </span>\n </jump-button>\n </div>\n {this.onlyIconButton ? \n <div class=\"OnlyIconButton\">\n <jump-button variant=\"secondary\" size=\"large\" pill onlyIcon onClick={() => this.addProductToCart()}> \n <jump-icon slot=\"prefix\" name='cart-shopping' category=\"regular\"></jump-icon> \n </jump-button> \n </div>\n : ''\n }\n </div>\n\n <div class={`Content ${backgroundClass} ${iconOnlyClass}`}>\n <div class={`Body ${backgroundClass} ${iconOnlyClass}`}>\n <div>\n <div class=\"Info\">\n <div class=\"Product\">{this.productName}</div>\n <div class=\"Subtitle\">{this.subtitle}</div>\n </div>\n\n <div class=\"Price\">\n <div class=\"Price__Discount\">\n {calculateDiscount(this.price, this.salePrice)}%\n </div>\n <div class={`Price__Regular ${this.salePrice ? 'sale' : ''}`}> \n {this.currency}{this.price}\n </div>\n <div class=\"Price__Sale\">{this.currency}{this.salePrice}</div>\n </div>\n </div>\n <div>\n \n <slot name=\"select\"></slot>\n <slot name=\"quantity\"></slot>\n </div>\n \n </div>\n\n <div class={`Footer ${justifyClass} ${backgroundClass} ${iconOnlyClass}`}>\n \n {this.outOfStock ? <div class=\"OutOfStock\">{this.outOfStockText ? this.outOfStockText : 'Esaurito'}</div> : ''}\n \n { this.outOfStock ? \n <jump-button variant=\"secondary\" size=\"small\" text onClick={() => this.waitingList()}> \n <jump-icon slot=\"prefix\" name={!this.outOfStock ? 'cart-shopping' : 'bell'} category=\"regular\" size=\"small\"></jump-icon> \n {this.waitingListText ? this.waitingListText : 'Notifica disponibilità'} \n </jump-button> : ''\n }\n\n { !this.outOfStock && !this.onlyIconButton ? \n <jump-button variant=\"secondary\" size=\"small\" text onClick={() => this.addProductToCart()}> \n <jump-icon slot=\"prefix\" name={!this.outOfStock ? 'cart-shopping' : 'bell'} category=\"regular\" size=\"small\"></jump-icon> \n {this.addtoCartText ? this.addtoCartText : 'Aggiungi al carrello'} \n </jump-button> : ''\n }\n\n </div>\n\n </div>\n </Host>\n );\n }\n\n}"]}
|
|
@@ -112,34 +112,29 @@ export default {
|
|
|
112
112
|
description: 'cta per richiedere l\'avviso se il prodotto torna disponibile',
|
|
113
113
|
control: 'text',
|
|
114
114
|
},
|
|
115
|
-
quantity: {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
115
|
+
// quantity: {
|
|
116
|
+
// name: 'quantity',
|
|
117
|
+
// description: 'Indica se è visibile il campo per la quantità del prodotto',
|
|
118
|
+
// control: 'boolean',
|
|
119
|
+
// defaultValue: false
|
|
120
|
+
// }
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
const Template = (args) => {
|
|
124
|
-
const attributes = generateAttributesFromArgs(args);
|
|
125
|
-
return formatHtml(`<jump-card-ecommerce ${attributes}> </jump-card-ecommerce>`);
|
|
126
|
-
};
|
|
127
123
|
// const Template = (args) => {
|
|
128
124
|
// const attributes = generateAttributesFromArgs(args);
|
|
129
|
-
// return formatHtml(
|
|
130
|
-
// <jump-card-ecommerce ${attributes}>
|
|
131
|
-
// <select slot="select" name="select" id="selectID" onChange={(event) => this.changeVariationBody(event)}>
|
|
132
|
-
// <option value='m'>mono</option>
|
|
133
|
-
// <option value='l'>enciclopedico</option>
|
|
134
|
-
// <option value='xl'>superlativogalattico</option>
|
|
135
|
-
// </select>
|
|
136
|
-
// <jump-quantity slot="quantity" onClick={(event) => this.changeQuantityProduct(event)}></jump-quantity>
|
|
137
|
-
// </jump-card-ecommerce>`);
|
|
125
|
+
// return formatHtml(`<jump-card-ecommerce ${attributes}> </jump-card-ecommerce>`);
|
|
138
126
|
// }
|
|
127
|
+
const Template = (args) => {
|
|
128
|
+
const attributes = generateAttributesFromArgs(args);
|
|
129
|
+
return formatHtml(`
|
|
130
|
+
<jump-card-ecommerce ${attributes}>
|
|
131
|
+
<jump-quantity slot="quantity"></jump-quantity>
|
|
132
|
+
</jump-card-ecommerce>`);
|
|
133
|
+
};
|
|
139
134
|
export const Card = Template.bind({});
|
|
140
135
|
Card.args = {
|
|
141
136
|
hasBackground: true,
|
|
142
|
-
onlyIconButton:
|
|
137
|
+
onlyIconButton: false,
|
|
143
138
|
badge: 'Badge',
|
|
144
139
|
favorite: true,
|
|
145
140
|
link: '/prodotto',
|
|
@@ -157,7 +152,6 @@ Card.args = {
|
|
|
157
152
|
outOfStockText: 'Esaurito',
|
|
158
153
|
addtoCartText: 'Aggiungi al carrello',
|
|
159
154
|
waitingListText: 'Notifica disponibilità',
|
|
160
|
-
quantity: true
|
|
161
155
|
};
|
|
162
156
|
// const TemplateWithEvent = (args, data) => {
|
|
163
157
|
// let id = data.id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jump-card-ecommerce.stories.js","sourceRoot":"","sources":["../../../src/components/jump-card-ecommerce/jump-card-ecommerce.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAE1E,eAAe;IACb,KAAK,EAAE,+BAA+B;IACtC,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,aAAa,EAAE;YACb,IAAI,EAAE,eAAe;YACrB,WAAW,EAAE,yCAAyC;YACtD,OAAO,EAAE,SAAS;SACnB;QACD,cAAc,EAAE;YACd,IAAI,EAAE,gBAAgB;YACtB,WAAW,EAAE,4DAA4D;YACzE,OAAO,EAAE,SAAS;SACnB;QACD,KAAK,EAAE;YACL,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,kBAAkB;YAC/B,OAAO,EAAE,MAAM;SAChB;QACD,QAAQ,EAAE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,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,WAAW;IACjB,GAAG,EAAE,gIAAgI;IACrI,MAAM,EAAE,UAAU;IAClB,eAAe,EAAE,OAAO;IACxB,gBAAgB,EAAE,sBAAsB;IACxC,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,iBAAiB;IAC3B,SAAS,EAAE,GAAG;IACd,KAAK,EAAE,EAAE;IACT,SAAS,EAAE,EAAE;IACb,QAAQ,EAAE,GAAG;IACb,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,UAAU;IAC1B,aAAa,EAAE,sBAAsB;IACrC,eAAe,EAAE,wBAAwB;IACzC,QAAQ,EAAE,IAAI;CACf,CAAC;AAGF,8CAA8C;AAC9C,sBAAsB;AACtB,yDAAyD;AACzD,kFAAkF;AAClF,eAAe;AAEf,oBAAoB;AACpB,wBAAwB;AACxB,6DAA6D;AAC7D,0GAA0G;AAC1G,+CAA+C;AAC/C,6CAA6C;AAC7C,wBAAwB;AACxB,wEAAwE;AACxE,mBAAmB;AACnB,wEAAwE;AACxE,YAAY;AACZ,WAAW;AAEX,sGAAsG;AACtG,+CAA+C;AAC/C,mDAAmD;AACnD,2BAA2B;AAC3B,uEAAuE;AACvE,aAAa;AACb,WAAW;AAEX,YAAY;AAEZ,gBAAgB;AAChB,SAAS;AACT,IAAI;AAEJ,uDAAuD;AACvD,qBAAqB;AACrB,oBAAoB;AACpB,qBAAqB;AACrB,uBAAuB;AACvB,2IAA2I;AAC3I,wBAAwB;AACxB,oDAAoD;AACpD,8BAA8B;AAC9B,8CAA8C;AAC9C,wBAAwB;AACxB,kBAAkB;AAClB,sBAAsB;AACtB,4BAA4B;AAC5B,iCAAiC;AACjC,oBAAoB;AACpB,eAAe;AACf,mBAAmB;AACnB,uBAAuB;AACvB,oBAAoB;AACpB,KAAK","sourcesContent":["import { generateAttributesFromArgs, formatHtml} from '../../utils/utils';\n\nexport default {\n title: 'Components/CardEcommerce/Card',\n tags: ['autodocs'],\n argTypes: {\n hasBackground: {\n name: 'hasBackground',\n description: 'Aggiungi o meno il background alla card',\n control: 'boolean',\n },\n onlyIconButton: {\n name: 'onlyIconButton',\n description: 'Cambia lo stile della card mostrando solo il bottone icona',\n control: 'boolean',\n },\n badge: {\n name: 'badge',\n description: 'Badge della card',\n control: 'text',\n },\n favorite: {\n name: 'favorite',\n description: 'Aggiunge il prodotto ai preferiti',\n control: 'boolean',\n },\n link: {\n name: 'link',\n description: 'Link della card',\n control: 'text',\n },\n img: {\n name: 'img',\n description: 'Url dell\\'immagine da visualizzare, si attiva solo se non è presente videoSrc',\n control: 'text',\n defaultValue: 'https://content-management-files.canva.com/cdn-cgi/image/f=auto,q=70/2fdbd7ab-f378-4c63-8b21-c944ad2633fd/header_t-shirts2.jpg',\n if:{\n arg: 'videoSrc',\n exists: false\n }\n },\n imgAlt: {\n name: 'imgAlt',\n description: 'Alt dell\\'immagine da visualizzare, si attiva solo se è presente img',\n control: 'text',\n if:{\n arg: 'img',\n exists: true\n }\n },\n videoSrc: {\n name: 'videoSrc',\n description: 'Url del video da visualizzare, si attiva solo se non è presente img',\n control: 'text',\n if:{\n arg: 'img',\n exists: false\n }\n },\n notificationUrl: {\n name: 'notificationUrl',\n description: 'Url della notifica da visualizzare',\n control: 'text',\n },\n notificationText: {\n name: 'notificationText',\n description: 'Testo della notifica da visualizzare',\n control: 'text',\n },\n productName: {\n name: 'productName',\n description: 'Nome del prodotto',\n control: 'text',\n },\n subtitle: {\n name: 'subtitle',\n description: 'Sottotitolo della card',\n control: 'text',\n },\n productId: {\n name: 'productId',\n description: 'ID del prodotto',\n control: 'text',\n },\n price: {\n name: 'price',\n description: 'Prezzo del prodotto',\n control: 'number',\n },\n salePrice: {\n name: 'salePrice',\n description: 'Prezzo scontato del prodotto',\n control: 'number',\n },\n outOfStock: {\n name: 'outOfStock',\n description: 'Indica se il prodotto è esaurito',\n control: 'boolean',\n defaultValue: false\n },\n outOfStockText: {\n name: 'outOfStockText',\n description: 'Testo da visualizzare se il prodotto è esaurito',\n control: 'text',\n },\n addtoCartText: {\n name: 'addtoCartText',\n description: 'Testo bottone aggiungi al carrello',\n control: 'text',\n },\n waitingListText: {\n name: 'waitingListText',\n description: 'cta per richiedere l\\'avviso se il prodotto torna disponibile',\n control: 'text',\n },\n quantity: {\n name: 'quantity',\n description: 'Indica se è visibile il campo per la quantità del prodotto',\n control: 'boolean',\n defaultValue: false\n }\n }\n};\n\nconst Template = (args) => {\n const attributes = generateAttributesFromArgs(args);\n return formatHtml(`<jump-card-ecommerce ${attributes}> </jump-card-ecommerce>`);\n}\n\n// const Template = (args) => {\n// const attributes = generateAttributesFromArgs(args);\n// return formatHtml(`\n// <jump-card-ecommerce ${attributes}> \n// <select slot=\"select\" name=\"select\" id=\"selectID\" onChange={(event) => this.changeVariationBody(event)}>\n// <option value='m'>mono</option>\n// <option value='l'>enciclopedico</option>\n// <option value='xl'>superlativogalattico</option>\n// </select>\n// <jump-quantity slot=\"quantity\" onClick={(event) => this.changeQuantityProduct(event)}></jump-quantity>\n// </jump-card-ecommerce>`);\n// }\n\nexport const Card = Template.bind({});\nCard.args = {\n hasBackground: true,\n onlyIconButton: true,\n badge: 'Badge',\n favorite: true,\n link: '/prodotto',\n img: 'https://content-management-files.canva.com/cdn-cgi/image/f=auto,q=70/2fdbd7ab-f378-4c63-8b21-c944ad2633fd/header_t-shirts2.jpg',\n imgAlt: 'Immagine',\n notificationUrl: '/cart',\n notificationText: 'Aggiunto al carrello',\n productName: 'T-shirt',\n subtitle: 'T-shirt da uomo',\n productId: '1',\n price: 15,\n salePrice: 10,\n currency: '€',\n outOfStock: false,\n outOfStockText: 'Esaurito',\n addtoCartText: 'Aggiungi al carrello',\n waitingListText: 'Notifica disponibilità',\n quantity: true\n};\n\n\n// const TemplateWithEvent = (args, data) => {\n// let id = data.id;\n// const attributes = generateAttributesFromArgs(args);\n// return formatHtml(`<jump-card-ecommerce ${attributes}> </jump-card-ecommerce>\n// <script>\n\n// (function() {\n// let container; \n// container = document.querySelector('#story--${id}');\n// container.querySelector('jump-card-ecommerce').addEventListener( 'jump-toggle-favorite', ev => {\n// let productId = ev.detail.productId;\n// let favorite = ev.detail.favorite;\n// if(favorite){\n// alert( 'Prodotto ' + productId + ' aggiunto ai preferiti');\n// } else {\n// alert( 'Prodotto ' + productId + ' rimosso dai preferiti');\n// }\n// })\n\n// container.querySelector('jump-card-ecommerce').addEventListener( 'jump-add-to-cart', ev => {\n// let productId = ev.detail.productId;\n// let addedToCart = ev.detail.addedToCart;\n// if(addedToCart){\n// alert( 'Prodotto ' + productId + ' aggiunto al carrello');\n// } \n// })\n\n// })();\n\n// </script>\n// ` );\n// }\n\n// export const CardEvent = TemplateWithEvent.bind({});\n// CardEvent.args = {\n// badge: 'Badge',\n// favorite: false,\n// link: '/prodotto',\n// img: 'https://content-management-files.canva.com/cdn-cgi/image/f=auto,q=70/2fdbd7ab-f378-4c63-8b21-c944ad2633fd/header_t-shirts2.jpg',\n// imgAlt: 'Immagine',\n// // ricordati di mettere anche esempio con video\n// notificationUrl: '/cart',\n// notificationText: 'Aggiunto al carrello',\n// addedToCart: false,\n// onSale: true,\n// variant: 'light',\n// productName: 'T-shirt',\n// subtitle: 'T-shirt da uomo',\n// discount: '5%',\n// price: 15,\n// salePrice: 10,\n// background: false,\n// productId: '1',\n// };\n"]}
|
|
1
|
+
{"version":3,"file":"jump-card-ecommerce.stories.js","sourceRoot":"","sources":["../../../src/components/jump-card-ecommerce/jump-card-ecommerce.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAE1E,eAAe;IACb,KAAK,EAAE,+BAA+B;IACtC,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,aAAa,EAAE;YACb,IAAI,EAAE,eAAe;YACrB,WAAW,EAAE,yCAAyC;YACtD,OAAO,EAAE,SAAS;SACnB;QACD,cAAc,EAAE;YACd,I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ACnB,cAAc,EAAE,KAAK;IACrB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,WAAW;IACjB,GAAG,EAAE,gIAAgI;IACrI,MAAM,EAAE,UAAU;IAClB,eAAe,EAAE,OAAO;IACxB,gBAAgB,EAAE,sBAAsB;IACxC,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,iBAAiB;IAC3B,SAAS,EAAE,GAAG;IACd,KAAK,EAAE,EAAE;IACT,SAAS,EAAE,EAAE;IACb,QAAQ,EAAE,GAAG;IACb,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,UAAU;IAC1B,aAAa,EAAE,sBAAsB;IACrC,eAAe,EAAE,wBAAwB;CAC1C,CAAC;AAGF,8CAA8C;AAC9C,sBAAsB;AACtB,yDAAyD;AACzD,kFAAkF;AAClF,eAAe;AAEf,oBAAoB;AACpB,wBAAwB;AACxB,6DAA6D;AAC7D,0GAA0G;AAC1G,+CAA+C;AAC/C,6CAA6C;AAC7C,wBAAwB;AACxB,wEAAwE;AACxE,mBAAmB;AACnB,wEAAwE;AACxE,YAAY;AACZ,WAAW;AAEX,sGAAsG;AACtG,+CAA+C;AAC/C,mDAAmD;AACnD,2BAA2B;AAC3B,uEAAuE;AACvE,aAAa;AACb,WAAW;AAEX,YAAY;AAEZ,gBAAgB;AAChB,SAAS;AACT,IAAI;AAEJ,uDAAuD;AACvD,qBAAqB;AACrB,oBAAoB;AACpB,qBAAqB;AACrB,uBAAuB;AACvB,2IAA2I;AAC3I,wBAAwB;AACxB,oDAAoD;AACpD,8BAA8B;AAC9B,8CAA8C;AAC9C,wBAAwB;AACxB,kBAAkB;AAClB,sBAAsB;AACtB,4BAA4B;AAC5B,iCAAiC;AACjC,oBAAoB;AACpB,eAAe;AACf,mBAAmB;AACnB,uBAAuB;AACvB,oBAAoB;AACpB,KAAK","sourcesContent":["import { generateAttributesFromArgs, formatHtml} from '../../utils/utils';\n\nexport default {\n title: 'Components/CardEcommerce/Card',\n tags: ['autodocs'],\n argTypes: {\n hasBackground: {\n name: 'hasBackground',\n description: 'Aggiungi o meno il background alla card',\n control: 'boolean',\n },\n onlyIconButton: {\n name: 'onlyIconButton',\n description: 'Cambia lo stile della card mostrando solo il bottone icona',\n control: 'boolean',\n },\n badge: {\n name: 'badge',\n description: 'Badge della card',\n control: 'text',\n },\n favorite: {\n name: 'favorite',\n description: 'Aggiunge il prodotto ai preferiti',\n control: 'boolean',\n },\n link: {\n name: 'link',\n description: 'Link della card',\n control: 'text',\n },\n img: {\n name: 'img',\n description: 'Url dell\\'immagine da visualizzare, si attiva solo se non è presente videoSrc',\n control: 'text',\n defaultValue: 'https://content-management-files.canva.com/cdn-cgi/image/f=auto,q=70/2fdbd7ab-f378-4c63-8b21-c944ad2633fd/header_t-shirts2.jpg',\n if:{\n arg: 'videoSrc',\n exists: false\n }\n },\n imgAlt: {\n name: 'imgAlt',\n description: 'Alt dell\\'immagine da visualizzare, si attiva solo se è presente img',\n control: 'text',\n if:{\n arg: 'img',\n exists: true\n }\n },\n videoSrc: {\n name: 'videoSrc',\n description: 'Url del video da visualizzare, si attiva solo se non è presente img',\n control: 'text',\n if:{\n arg: 'img',\n exists: false\n }\n },\n notificationUrl: {\n name: 'notificationUrl',\n description: 'Url della notifica da visualizzare',\n control: 'text',\n },\n notificationText: {\n name: 'notificationText',\n description: 'Testo della notifica da visualizzare',\n control: 'text',\n },\n productName: {\n name: 'productName',\n description: 'Nome del prodotto',\n control: 'text',\n },\n subtitle: {\n name: 'subtitle',\n description: 'Sottotitolo della card',\n control: 'text',\n },\n productId: {\n name: 'productId',\n description: 'ID del prodotto',\n control: 'text',\n },\n price: {\n name: 'price',\n description: 'Prezzo del prodotto',\n control: 'number',\n },\n salePrice: {\n name: 'salePrice',\n description: 'Prezzo scontato del prodotto',\n control: 'number',\n },\n outOfStock: {\n name: 'outOfStock',\n description: 'Indica se il prodotto è esaurito',\n control: 'boolean',\n defaultValue: false\n },\n outOfStockText: {\n name: 'outOfStockText',\n description: 'Testo da visualizzare se il prodotto è esaurito',\n control: 'text',\n },\n addtoCartText: {\n name: 'addtoCartText',\n description: 'Testo bottone aggiungi al carrello',\n control: 'text',\n },\n waitingListText: {\n name: 'waitingListText',\n description: 'cta per richiedere l\\'avviso se il prodotto torna disponibile',\n control: 'text',\n },\n // quantity: {\n // name: 'quantity',\n // description: 'Indica se è visibile il campo per la quantità del prodotto',\n // control: 'boolean',\n // defaultValue: false\n // }\n }\n};\n\n// const Template = (args) => {\n// const attributes = generateAttributesFromArgs(args);\n// return formatHtml(`<jump-card-ecommerce ${attributes}> </jump-card-ecommerce>`);\n// }\n\nconst Template = (args) => {\n const attributes = generateAttributesFromArgs(args);\n return formatHtml(`\n <jump-card-ecommerce ${attributes}> \n <jump-quantity slot=\"quantity\"></jump-quantity>\n </jump-card-ecommerce>`);\n}\n\nexport const Card = Template.bind({});\nCard.args = {\n hasBackground: true,\n onlyIconButton: false,\n badge: 'Badge',\n favorite: true,\n link: '/prodotto',\n img: 'https://content-management-files.canva.com/cdn-cgi/image/f=auto,q=70/2fdbd7ab-f378-4c63-8b21-c944ad2633fd/header_t-shirts2.jpg',\n imgAlt: 'Immagine',\n notificationUrl: '/cart',\n notificationText: 'Aggiunto al carrello',\n productName: 'T-shirt',\n subtitle: 'T-shirt da uomo',\n productId: '1',\n price: 15,\n salePrice: 10,\n currency: '€',\n outOfStock: false,\n outOfStockText: 'Esaurito',\n addtoCartText: 'Aggiungi al carrello',\n waitingListText: 'Notifica disponibilità',\n};\n\n\n// const TemplateWithEvent = (args, data) => {\n// let id = data.id;\n// const attributes = generateAttributesFromArgs(args);\n// return formatHtml(`<jump-card-ecommerce ${attributes}> </jump-card-ecommerce>\n// <script>\n\n// (function() {\n// let container; \n// container = document.querySelector('#story--${id}');\n// container.querySelector('jump-card-ecommerce').addEventListener( 'jump-toggle-favorite', ev => {\n// let productId = ev.detail.productId;\n// let favorite = ev.detail.favorite;\n// if(favorite){\n// alert( 'Prodotto ' + productId + ' aggiunto ai preferiti');\n// } else {\n// alert( 'Prodotto ' + productId + ' rimosso dai preferiti');\n// }\n// })\n\n// container.querySelector('jump-card-ecommerce').addEventListener( 'jump-add-to-cart', ev => {\n// let productId = ev.detail.productId;\n// let addedToCart = ev.detail.addedToCart;\n// if(addedToCart){\n// alert( 'Prodotto ' + productId + ' aggiunto al carrello');\n// } \n// })\n\n// })();\n\n// </script>\n// ` );\n// }\n\n// export const CardEvent = TemplateWithEvent.bind({});\n// CardEvent.args = {\n// badge: 'Badge',\n// favorite: false,\n// link: '/prodotto',\n// img: 'https://content-management-files.canva.com/cdn-cgi/image/f=auto,q=70/2fdbd7ab-f378-4c63-8b21-c944ad2633fd/header_t-shirts2.jpg',\n// imgAlt: 'Immagine',\n// // ricordati di mettere anche esempio con video\n// notificationUrl: '/cart',\n// notificationText: 'Aggiunto al carrello',\n// addedToCart: false,\n// onSale: true,\n// variant: 'light',\n// productName: 'T-shirt',\n// subtitle: 'T-shirt da uomo',\n// discount: '5%',\n// price: 15,\n// salePrice: 10,\n// background: false,\n// productId: '1',\n// };\n"]}
|
|
@@ -39,8 +39,8 @@ export class JumpFilter {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
render() {
|
|
42
|
-
return (h(Host, { key: '
|
|
43
|
-
h("div", { key: '
|
|
42
|
+
return (h(Host, { key: '66c02e0b1d1e1b57c12a7124874b4d41f0281579', mobileFilters: this.showMobileFilters }, this.isMobile && h("jump-button", { key: 'c6533178a0f3a4b389f289ca919925c160a24df8', ref: (el) => { this.mobileToggle = el; }, buttonId: this.filterButtonIcon, variant: 'primary', outline: true }, h("slot", { key: 'd95b2240c4a7cfec153213ba73c5679b9e72d227', name: "prefix" }, this.filterButtonIcon && h("jump-icon", { key: '9b964e09eb0942e796b4bee737a97326e0363c4e', class: "small", name: this.filterButtonIcon }), this.filterButtonLabel), h("slot", { key: '39cc668bd11bcbff18521fed0216024676827487', name: "suffix" }, this.activeFilters > 0 ? `(${this.activeFilters})` : '0')), h("div", { key: 'f864e224be6ef13cd2530cca0e4e61366253ccf0', ref: (el) => { this.filtersDrawer = el; }, class: "filtersDrawer", "data-variant": this.direction }, !this.isMobile &&
|
|
43
|
+
h("div", { key: 'e56713bbe8701eb7c5cabf9a768206c688bebfac', class: 'filtersDrawer__header' }, h("jump-icon", { key: 'eb27d23ae68ed0e245d6ef2d9feb600a6e47ebd2', class: "small", name: this.filterButtonIcon }), h("h3", { key: '4396ffb6e8a10397fe12c322192ab085e06ffa32' }, this.filterHeading)), h("slot", { key: '54b6684aad46df572655a8f29e4c865182c0f1a3' }))));
|
|
44
44
|
}
|
|
45
45
|
static get is() { return "jump-filter"; }
|
|
46
46
|
static get encapsulation() { return "shadow"; }
|
|
@@ -98,8 +98,8 @@ export class JumpFiltergroup {
|
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
render() {
|
|
101
|
-
return (h(Host, { key: '
|
|
102
|
-
h("jump-button", { key: '
|
|
101
|
+
return (h(Host, { key: '6ea498729a7279ad7b686ef158e6d912c7ec86ce' }, this.heading && h("h5", { key: 'a4d4a1b71dec49d90bd92a30c2335c8a69034906' }, this.heading), h("div", { key: '215a8386f89ba7026b2e1b05aad67157e7f512d6', class: "filterGroup" }, h("slot", { key: '6e96d228078df165e364adccae8d6dceac8626f4', ref: (el) => (this.slotItemsWrapper = el) })), this.inputs.length > this.maxElements &&
|
|
102
|
+
h("jump-button", { key: '6f1a595c19d8d7528b8f99d3665607e56b4c1d27', variant: "primary", size: "small", text: true, name: this.showMore ? this.otherLabel : this.lessLabel, "aria-label": this.showMore ? this.otherLabel : this.lessLabel, onClick: () => this.handleShowMore() }, this.showMore ? this.otherLabel : this.lessLabel, h("jump-icon", { key: '79e9c1540e53fee842bc5ba0658b0437eddbf47d', slot: "suffix", name: this.showMore ? 'chevron-down' : 'chevron-down' }))));
|
|
103
103
|
}
|
|
104
104
|
static get is() { return "jump-filtergroup"; }
|
|
105
105
|
static get encapsulation() { return "shadow"; }
|
|
@@ -22,11 +22,25 @@ export class JumpPagination {
|
|
|
22
22
|
}
|
|
23
23
|
/* --------------------- RENDER ------------------------------- */
|
|
24
24
|
render() {
|
|
25
|
-
return (h(Host, { key: '
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
return (h(Host, { key: 'fff2409f80165635fb36aff91e928053a758e56d', class: "JumpPagination" }, h("div", { key: '02def4c71603b81f531c66c612fa492fa665631b', class: "JumpPagination__Wrapper" }, h("div", { key: '4bacda248ee1ee095e9272f0948df3f8d8e539e3', class: "indicators" }, h("div", { key: 'b344407f8e6f07cda556fd7f1f272763272786c8', class: "elements" }, h("span", { key: 'f2e31e33e8608244820bfc4596c47f6234cc25f2' }, h("span", { key: 'a64da6ab40dbea7f7fbeaafeb1a06ea2242993cc' }, this.current), " ", this.pagLabel, " ", h("span", { key: '5a6b9a269ea390192cab4ec6319bc4cca0883921' }, this.last))), h("div", { key: '01878b6a1ba85feb505ec230085f6cbff2edddca', class: "arrow" }, this.showFirstAndLast &&
|
|
26
|
+
// <button
|
|
27
|
+
// onClick={() => {this.current = 1} }
|
|
28
|
+
// disabled={(this.current === 1) ? true : false}>
|
|
29
|
+
// <jump-icon library="fa" category="regular" name="chevrons-left" size="small" slot="prefix"
|
|
30
|
+
// disabled={(this.current === 1) ? true : false}
|
|
31
|
+
// ></jump-icon>
|
|
32
|
+
// </button>
|
|
33
|
+
h("jump-button", { key: 'b59a7068f61b1e1f7908e5bacd9dd029eb06f4bd', onClick: () => { this.current = 1; }, variant: "primary", text: true, size: "small", name: "scopri", value: "value", "aria-label": "Scopri di pi\u00F9", id: "button", onlyIcon: true, disabled: (this.current === 1) ? true : false }, " ", h("jump-icon", { key: '559950d3f0e77790efc1c301d1ce8e0ad2d9ab44', slot: "suffix", name: "chevrons-left" }), " "), h("jump-button", { key: '5e48895c5b5c39a468cac1b39d646a105288e0f4', onClick: () => { this.current--; }, variant: "primary", text: true, size: "small", name: "scopri", value: "value", "aria-label": "Scopri di pi\u00F9", id: "button", onlyIcon: true, disabled: (this.current === 1) ? true : false }, " ", h("jump-icon", { key: '6035d9060e9ea7ad1d0156dd1295cfb689578263', slot: "suffix", name: "chevron-left" }), " "), h("jump-button", { key: '06589d58a7202868b97ead74d5e7f7d1e3f66400', onClick: () => { this.current++; }, variant: "primary", text: true, size: "small", name: "scopri", value: "value", "aria-label": "Scopri di pi\u00F9", id: "button", onlyIcon: true, disabled: (this.current === this.last) ? true : false }, " ", h("jump-icon", { key: '2e484cd77ece285b0e6e72941b06eab8e571c968', slot: "suffix", name: "chevron-right" }), " "), this.showFirstAndLast &&
|
|
34
|
+
// <button
|
|
35
|
+
// onClick={() => {this.current = this.last}}
|
|
36
|
+
// disabled={(this.current === this.last) ? true : false}
|
|
37
|
+
// >
|
|
38
|
+
// <jump-icon library="fa" category="regular" name="chevrons-right" size="small" slot="prefix"></jump-icon>
|
|
39
|
+
// </button>
|
|
40
|
+
h("jump-button", { key: '73d1096f381a0cfc35bfc4f0585ac7a35af8060a', onClick: () => { this.current = this.last; }, variant: "primary", text: true, size: "small", name: "scopri", value: "value", "aria-label": "Scopri di pi\u00F9", id: "button", onlyIcon: true, disabled: (this.current === this.last) ? true : false }, " ", h("jump-icon", { key: 'ca455641fadf5bec18d26d071678c7af07d14837', slot: "suffix", name: "chevrons-right" }), " "))))));
|
|
28
41
|
}
|
|
29
42
|
static get is() { return "jump-pagination"; }
|
|
43
|
+
static get encapsulation() { return "shadow"; }
|
|
30
44
|
static get originalStyleUrls() {
|
|
31
45
|
return {
|
|
32
46
|
"$": ["jump-pagination.scss"]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jump-pagination.js","sourceRoot":"","sources":["../../../src/components/jump-pagination/jump-pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAO5F,MAAM,OAAO,cAAc;;uB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Q,EAAC,QAAQ,QAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;;gCAAG,kEAAW,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,gBAAgB,GAAc;oCAAe,CAE5S,CACF,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, State, Event, EventEmitter, Prop, h, Watch } from '@stencil/core';\n\n@Component({\n tag: 'jump-pagination',\n styleUrl: 'jump-pagination.scss',\n shadow: true,\n})\nexport class JumpPagination {\n \n /* ---------------------- @STATE ------------------------- */\n @State() current: number = 1;\n\n @Watch('current')\n watchcurrent(newValue: number, oldValue: number) {\n let details = {\n current: newValue,\n previousPage: oldValue,\n first: 1,\n last: this.last,\n direction: newValue > oldValue ? 'next' : 'prev'\n };\n\n this.changePage.emit(details);\n }\n\n /* ---------------------- @PROPERTIES ------------------------- */\n /**\n * Label of the pagination\n */\n @Prop() pagLabel: string = 'di'; \n\n /**\n * Last element of the page\n */\n @Prop() last: number = 10; \n\n /**\n * Show button to navigate so first e last page\n */\n @Prop() showFirstAndLast: boolean = false;\n\n /* ---------------------- @EVENTS ------------------------- */\n @Event({ eventName: 'jump-change-page' }) changePage: EventEmitter;\n\n /* ---------------------- @LIFECYCLE ------------------------- */\n componentWillLoad() {\n this.current = 1;\n }\n \n /* --------------------- RENDER ------------------------------- */\n render() {\n return (\n <Host class=\"JumpPagination\">\n <div class=\"JumpPagination__Wrapper\">\n <div class=\"indicators\"> \n <div class=\"elements\">\n <span>\n <span>{this.current}</span> {this.pagLabel} <span>{this.last}</span>\n </span>\n </div>\n <div class=\"arrow\">\n \n {this.showFirstAndLast &&\n // <button \n // onClick={() => {this.current = 1} }\n // disabled={(this.current === 1) ? true : false}> \n // <jump-icon library=\"fa\" category=\"regular\" name=\"chevrons-left\" size=\"small\" slot=\"prefix\"\n // disabled={(this.current === 1) ? true : false}\n // ></jump-icon> \n // </button>\n <jump-button onClick={() => { this.current = 1 }} variant=\"primary\" text size=\"small\" name=\"scopri\" value=\"value\" aria-label=\"Scopri di più\" id=\"button\" onlyIcon disabled={(this.current === 1) ? true : false}> <jump-icon slot=\"suffix\" name=\"chevrons-left\" ></jump-icon> </jump-button>\n }\n {/* <button \n onClick={() => {this.current--}} \n disabled={(this.current === 1) ? true : false}>\n <jump-icon library=\"fa\" category=\"regular\" name=\"chevron-left\" size=\"small\" slot=\"prefix\"></jump-icon> \n </button> */}\n <jump-button onClick={() => { this.current-- }} variant=\"primary\" text size=\"small\" name=\"scopri\" value=\"value\" aria-label=\"Scopri di più\" id=\"button\" onlyIcon disabled={(this.current === 1) ? true : false}> <jump-icon slot=\"suffix\" name=\"chevron-left\" ></jump-icon> </jump-button>\n <jump-button onClick={() => { this.current++ }} variant=\"primary\" text size=\"small\" name=\"scopri\" value=\"value\" aria-label=\"Scopri di più\" id=\"button\" onlyIcon disabled={(this.current === this.last) ? true : false}> <jump-icon slot=\"suffix\" name=\"chevron-right\" ></jump-icon> </jump-button>\n {/* <button \n onClick={() => {this.current++}}\n disabled={(this.current === this.last) ? true : false}\n > \n <jump-icon library=\"fa\" category=\"regular\" name=\"chevron-right\" size=\"small\" slot=\"prefix\"></jump-icon> \n </button> */}\n {this.showFirstAndLast &&\n // <button \n // onClick={() => {this.current = this.last}}\n // disabled={(this.current === this.last) ? true : false}\n // >\n // <jump-icon library=\"fa\" category=\"regular\" name=\"chevrons-right\" size=\"small\" slot=\"prefix\"></jump-icon> \n // </button> \n <jump-button onClick={() => { this.current = this.last }} variant=\"primary\" text size=\"small\" name=\"scopri\" value=\"value\" aria-label=\"Scopri di più\" id=\"button\" onlyIcon disabled={(this.current === this.last) ? true : false}> <jump-icon slot=\"suffix\" name=\"chevrons-right\" ></jump-icon> </jump-button>\n }\n </div> \n </div>\n </div>\n </Host>\n );\n }\n\n}\n"]}
|
|
@@ -60,9 +60,21 @@ export class JumpPaginationTable {
|
|
|
60
60
|
/* --------------------- RENDER ------------------------------- */
|
|
61
61
|
render() {
|
|
62
62
|
var _a;
|
|
63
|
-
return (h(Host, { key: '
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
return (h(Host, { key: '824d23ed1c7c26ea21047e5ce764887d526b2df6', class: "JumpPaginationTable" }, h("div", { key: '742793df17e3f1826768d7839905baddd0223d2b', class: "JumpPaginationTable__Wrapper" }, h("div", { key: 'b11952c253e2472672418fc1c48ab59a1ba06e51', class: "elementsPerPage" }, h("label", { key: '9dd4f75b634d818787f050bf2fcf01ef4faad36e', htmlFor: "elements" }, (_a = this.labelElementsPerPage) !== null && _a !== void 0 ? _a : 'Elements per page'), h("select", { key: 'f33c5d47808e09b0d6cef474b29373564243c3a2', name: "elements", id: "elements", onChange: (e) => this.setElPerPage(e) }, this.elementsRanges.map((range) => (h("option", { value: range, selected: (this.elPerPage == range) && true }, range))))), h("div", { key: '392ede73df269175c997b713f9a4a5ecd92a0e25', class: "indicators" }, h("div", { key: '2438ecab0062bb1fec07d62e32597e2b2aba3fe4', class: "elements" }, h("span", { key: '49e7ad9c4e6298c41b6dba1d984bc5649b15bbbe' }, h("span", { key: '471b63b04e31295192e992f9c61e31878e1cb04d' }, this.first), " - ", h("span", { key: 'b1d61554e28c1e254efc1cf6768da9480a363aea' }, this.last), " ", this.pagLabel, " ", h("span", { key: 'b0727788ea7159d9bc07708814429c95866faa62' }, this.total))), h("div", { key: '0aa5a04cb2837c519790d43805f83cca903eca7e', class: "arrow" }, this.showFirstAndLast &&
|
|
64
|
+
// <button
|
|
65
|
+
// onClick={() => this.doChangePage('first')}
|
|
66
|
+
// disabled={this.first === 1}
|
|
67
|
+
// >
|
|
68
|
+
// <jump-icon slot="prefix" name="chevrons-left"></jump-icon>
|
|
69
|
+
// </button>
|
|
70
|
+
h("jump-button", { key: 'd767d7705db97eecb2d9111eca909f633c4ae6fa', onClick: () => this.doChangePage('first'), variant: "primary", text: true, size: "small", name: "scopri", value: "value", "aria-label": "Scopri di pi\u00F9", id: "button", onlyIcon: true, disabled: this.first === 1 }, " ", h("jump-icon", { key: 'f6799dbdd47a0e845bf7860585c21f5b06d39811', slot: "suffix", name: "chevrons-left" }), " "), h("jump-button", { key: 'd417512e45c62fbed1a1780da00fb01dea27a7e1', onClick: () => this.doChangePage('previous'), variant: "primary", text: true, size: "small", name: "scopri", value: "value", "aria-label": "Scopri di pi\u00F9", id: "button", onlyIcon: true, disabled: this.first === 1 }, " ", h("jump-icon", { key: '22199b55ffcfc402f01b9880a728a86b00dc47d3', slot: "suffix", name: "chevron-left" }), " "), h("jump-button", { key: 'ea388be01e0be9adb03033e94665078cb30f64a2', onClick: () => this.doChangePage('next'), variant: "primary", text: true, size: "small", name: "scopri", value: "value", "aria-label": "Scopri di pi\u00F9", id: "button", onlyIcon: true, disabled: this.last === this.total }, " ", h("jump-icon", { key: '1cdb6a7d147ad4757e3b7c717e0bd1fab8e356fb', slot: "suffix", name: "chevron-right" }), " "), this.showFirstAndLast &&
|
|
71
|
+
// <button
|
|
72
|
+
// onClick={() => this.doChangePage('last')}
|
|
73
|
+
// disabled={this.last === this.total}
|
|
74
|
+
// >
|
|
75
|
+
// <jump-icon slot="prefix" name="chevrons-right"></jump-icon>
|
|
76
|
+
// </button>
|
|
77
|
+
h("jump-button", { key: '2309eeed0c9a78ffaf9c886979ff35f566841592', onClick: () => this.doChangePage('last'), variant: "primary", text: true, size: "small", name: "scopri", value: "value", "aria-label": "Scopri di pi\u00F9", id: "button", onlyIcon: true, disabled: this.last === this.total }, " ", h("jump-icon", { key: 'f8a929bcdbd2b488cb1bf481a2247fa8d0aa1daf', slot: "suffix", name: "chevrons-right" }), " "))))));
|
|
66
78
|
}
|
|
67
79
|
static get is() { return "jump-pagination-table"; }
|
|
68
80
|
static get originalStyleUrls() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jump-pagination-table.js","sourceRoot":"","sources":["../../../src/components/jump-pagination-table/jump-pagination-table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAOrF,MAAM,OAAO,mBAAmB;;8BAa2B,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC;yBAK9C,EAAE;wBAYc,IAAI;oCAKQ,qBAAqB;qBAKpC,GAAG;qBAKH,CAAC;oBAKF,EAAE;gCAKW,KAAK;;IAnC1D,gBAAgB,CAAC,QAAgB,EAAE,QAAgB;QACjD,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAC1B,6CAA6C;YAC7C,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;YACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC7C,CAAC;QAED,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;IACrD,CAAC;IAiCD,kEAAkE;IAClE,iBAAiB;QACf,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,kEAAkE;IAElE,kEAAkE;IAElE,kEAAkE;IAClE,YAAY,CAAC,CAAC;QACZ,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;IAClC,CAAC;IAED,YAAY,CAAC,GAAG;QACd,IAAI,QAAQ,CAAC;QACb,IAAI,OAAO,CAAC;QAEZ,mBAAmB;QACnB,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;YACpB,QAAQ,GAAG,CAAC,CAAC;YACb,OAAO,GAAG,IAAI,CAAC,GAAG,C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AAC,YAAY,CAAC,MAAM,CAAC,EACxC,QAAQ,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK;4BAElC,kEAAW,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,eAAe,GAAa,CACnD;wBACR,IAAI,CAAC,gBAAgB;4BACpB,+DACE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EACxC,QAAQ,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK;gCAElC,kEAAW,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,gBAAgB,GAAa,CACpD,CAEP,CACF,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Event, EventEmitter, Watch, Host, Prop, h } from '@stencil/core';\n\n@Component({\n tag: 'jump-pagination-table',\n styleUrl: 'jump-pagination-table.scss',\n shadow: false,\n})\nexport class JumpPaginationTable {\n\n /* ---------------------- OWN PROPERTIES ---------------------- */\n\n /* ---------------------- @ELEMENT ---------------------------- */\n\n /* ---------------------- @STATE ------------------------------ */\n\n /* ---------------------- @PROPERTIES ------------------------- */\n\n /**\n * Values for the elements per page select\n */\n @Prop({ reflect: true }) elementsRanges: Array<number> = [10, 20, 60, 100];\n\n /**\n * Number of elements per page selected\n */\n @Prop() elPerPage: number = 10;\n @Watch('elPerPage')\n elPerPageChanged(newValue: number, oldValue: number) {\n if (newValue !== oldValue) {\n // Riporta la paginazione allo stato iniziale\n this.first = 1;\n this.last = Math.min(this.total, newValue);\n }\n\n this.changeElPerPage.emit({ elPerPage: newValue });\n }\n\n @Prop({ reflect: true }) pagLabel: string = 'di'; // Identifica la label testuale di pagination. \n\n /**\n * Label for the elements per page select\n */\n @Prop({ reflect: true }) labelElementsPerPage: string = 'Elementi per pagina';\n\n /**\n * Total of elements\n */\n @Prop({ reflect: true }) total: number = 100; \n\n /**\n * First element of the page\n */\n @Prop({ reflect: true }) first: number = 1;\n\n /**\n * Last element of the page\n */\n @Prop({ reflect: true }) last: number = 10;\n\n /**\n * Show button to navigate so first e last page\n */\n @Prop({ reflect: true }) showFirstAndLast: boolean = false;\n\n /* ---------------------- @EVENTS ------------------------- */\n @Event({ eventName: 'jump-change-page' }) changePage: EventEmitter;\n @Event({ eventName: 'jump-change-el-per-page' }) changeElPerPage: EventEmitter;\n\n /* -------------------- LYFECYCLE EVENTS ---------------------- */\n componentWillLoad() {\n this.elPerPage = this.elementsRanges[0];\n }\n\n /* -------------------- @LISTEN ------------------------------- */\n\n /* -------------------- @METHOD ------------------------------- */\n\n /* -------------------- LOCAL METHODS ------------------------- */\n setElPerPage(e) {\n this.elPerPage = e.target.value;\n }\n\n doChangePage(dir) {\n let newFirst;\n let newLast;\n\n //TODO refactorare \n if (dir === 'first') {\n newFirst = 1;\n newLast = Math.min(this.total, this.elPerPage);\n } else if (dir === 'last') {\n newLast = this.total;\n newFirst = Math.max(1, this.total - this.elPerPage + 1);\n } else if (dir === 'previous') {\n newFirst = Math.max(1, this.first - this.elPerPage);\n newLast = Math.min(this.total, newFirst + this.elPerPage - 1);\n } else if (dir === 'next') {\n newLast = Math.min(this.total, this.last + this.elPerPage);\n newFirst = Math.max(1, newLast - this.elPerPage + 1);\n }\n\n this.first = newFirst;\n this.last = newLast;\n\n let details = {\n first: newFirst,\n last: newLast,\n direction: dir\n }\n\n this.changePage.emit(details);\n }\n\n /* --------------------- RENDER ------------------------------- */\n render() {\n return (\n <Host class=\"JumpPaginationTable\">\n <div class=\"JumpPaginationTable__Wrapper\">\n <div class=\"elementsPerPage\">\n <label htmlFor=\"elements\">{this.labelElementsPerPage ?? 'Elements per page'}</label>\n <select name=\"elements\" id=\"elements\" onChange={(e) => this.setElPerPage(e)}>\n {this.elementsRanges.map((range) => (\n <option value={range} selected={(this.elPerPage == range) && true}>{range}</option>\n ))}\n </select>\n </div> \n <div class=\"indicators\">\n <div class=\"elements\">\n <span>\n <span>{this.first}</span> - <span>{this.last}</span> {this.pagLabel} <span>{this.total}</span>\n </span>\n </div>\n <div class=\"arrow\">\n {this.showFirstAndLast &&\n <button \n onClick={() => this.doChangePage('first')}\n disabled={this.first === 1}\n >\n <jump-icon slot=\"prefix\" name=\"chevrons-left\"></jump-icon>\n </button>\n }\n <button\n onClick={() => this.doChangePage('previous')}\n disabled={this.first === 1}\n >\n <jump-icon slot=\"prefix\" name=\"chevron-left\"></jump-icon>\n </button>\n <button\n onClick={() => this.doChangePage('next')}\n disabled={this.last === this.total}\n >\n <jump-icon slot=\"prefix\" name=\"chevron-right\"></jump-icon>\n </button>\n {this.showFirstAndLast &&\n <button\n onClick={() => this.doChangePage('last')}\n disabled={this.last === this.total}\n >\n <jump-icon slot=\"prefix\" name=\"chevrons-right\"></jump-icon>\n </button>\n }\n </div>\n </div>\n </div>\n </Host>\n );\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"jump-pagination-table.js","sourceRoot":"","sources":["../../../src/components/jump-pagination-table/jump-pagination-table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAOrF,MAAM,OAAO,mBAAmB;;8BAa2B,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC;yBAK9C,EAAE;wBAYc,IAAI;oCAKQ,qBAAqB;qBAKpC,GAAG;qBAKH,CAAC;oBAKF,EAAE;gCAKW,KAAK;;IAnC1D,gBAAgB,CAAC,QAAgB,EAAE,QAAgB;QACjD,IAAI,QAAQ,KAAK,QAAQ,EAA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AO,EAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,OAAO,gBAAY,oBAAe,EAAC,EAAE,EAAC,QAAQ,EAAC,QAAQ,QAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK;;4BAAG,kEAAW,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,eAAe,GAAc;gCAAe;wBAOrR,IAAI,CAAC,gBAAgB;4BACpB,UAAU;4BACV,8CAA8C;4BAC9C,wCAAwC;4BACxC,IAAI;4BACJ,gEAAgE;4BAChE,YAAY;4BACZ,oEAAa,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,OAAO,EAAC,SAAS,EAAC,IAAI,QAAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,OAAO,gBAAY,oBAAe,EAAC,EAAE,EAAC,QAAQ,EAAC,QAAQ,QAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK;;gCAAG,kEAAW,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,gBAAgB,GAAc;oCAAe,CAErR,CACF,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Event, EventEmitter, Watch, Host, Prop, h } from '@stencil/core';\n\n@Component({\n tag: 'jump-pagination-table',\n styleUrl: 'jump-pagination-table.scss',\n shadow: false,\n})\nexport class JumpPaginationTable {\n\n /* ---------------------- OWN PROPERTIES ---------------------- */\n\n /* ---------------------- @ELEMENT ---------------------------- */\n\n /* ---------------------- @STATE ------------------------------ */\n\n /* ---------------------- @PROPERTIES ------------------------- */\n\n /**\n * Values for the elements per page select\n */\n @Prop({ reflect: true }) elementsRanges: Array<number> = [10, 20, 60, 100];\n\n /**\n * Number of elements per page selected\n */\n @Prop() elPerPage: number = 10;\n @Watch('elPerPage')\n elPerPageChanged(newValue: number, oldValue: number) {\n if (newValue !== oldValue) {\n // Riporta la paginazione allo stato iniziale\n this.first = 1;\n this.last = Math.min(this.total, newValue);\n }\n\n this.changeElPerPage.emit({ elPerPage: newValue });\n }\n\n @Prop({ reflect: true }) pagLabel: string = 'di'; // Identifica la label testuale di pagination. \n\n /**\n * Label for the elements per page select\n */\n @Prop({ reflect: true }) labelElementsPerPage: string = 'Elementi per pagina';\n\n /**\n * Total of elements\n */\n @Prop({ reflect: true }) total: number = 100; \n\n /**\n * First element of the page\n */\n @Prop({ reflect: true }) first: number = 1;\n\n /**\n * Last element of the page\n */\n @Prop({ reflect: true }) last: number = 10;\n\n /**\n * Show button to navigate so first e last page\n */\n @Prop({ reflect: true }) showFirstAndLast: boolean = false;\n\n /* ---------------------- @EVENTS ------------------------- */\n @Event({ eventName: 'jump-change-page' }) changePage: EventEmitter;\n @Event({ eventName: 'jump-change-el-per-page' }) changeElPerPage: EventEmitter;\n\n /* -------------------- LYFECYCLE EVENTS ---------------------- */\n componentWillLoad() {\n this.elPerPage = this.elementsRanges[0];\n }\n\n /* -------------------- @LISTEN ------------------------------- */\n\n /* -------------------- @METHOD ------------------------------- */\n\n /* -------------------- LOCAL METHODS ------------------------- */\n setElPerPage(e) {\n this.elPerPage = e.target.value;\n }\n\n doChangePage(dir) {\n let newFirst;\n let newLast;\n\n //TODO refactorare \n if (dir === 'first') {\n newFirst = 1;\n newLast = Math.min(this.total, this.elPerPage);\n } else if (dir === 'last') {\n newLast = this.total;\n newFirst = Math.max(1, this.total - this.elPerPage + 1);\n } else if (dir === 'previous') {\n newFirst = Math.max(1, this.first - this.elPerPage);\n newLast = Math.min(this.total, newFirst + this.elPerPage - 1);\n } else if (dir === 'next') {\n newLast = Math.min(this.total, this.last + this.elPerPage);\n newFirst = Math.max(1, newLast - this.elPerPage + 1);\n }\n\n this.first = newFirst;\n this.last = newLast;\n\n let details = {\n first: newFirst,\n last: newLast,\n direction: dir\n }\n\n this.changePage.emit(details);\n }\n\n /* --------------------- RENDER ------------------------------- */\n render() {\n return (\n <Host class=\"JumpPaginationTable\">\n <div class=\"JumpPaginationTable__Wrapper\">\n <div class=\"elementsPerPage\">\n <label htmlFor=\"elements\">{this.labelElementsPerPage ?? 'Elements per page'}</label>\n <select name=\"elements\" id=\"elements\" onChange={(e) => this.setElPerPage(e)}>\n {this.elementsRanges.map((range) => (\n <option value={range} selected={(this.elPerPage == range) && true}>{range}</option>\n ))}\n </select>\n </div> \n <div class=\"indicators\">\n <div class=\"elements\">\n <span>\n <span>{this.first}</span> - <span>{this.last}</span> {this.pagLabel} <span>{this.total}</span>\n </span>\n </div>\n <div class=\"arrow\">\n {this.showFirstAndLast &&\n // <button \n // onClick={() => this.doChangePage('first')}\n // disabled={this.first === 1}\n // >\n // <jump-icon slot=\"prefix\" name=\"chevrons-left\"></jump-icon>\n // </button>\n <jump-button onClick={() => this.doChangePage('first')} variant=\"primary\" text size=\"small\" name=\"scopri\" value=\"value\" aria-label=\"Scopri di più\" id=\"button\" onlyIcon disabled={this.first === 1}> <jump-icon slot=\"suffix\" name=\"chevrons-left\" ></jump-icon> </jump-button>\n }\n {/* <button\n onClick={() => this.doChangePage('previous')}\n disabled={this.first === 1}\n >\n <jump-icon slot=\"prefix\" name=\"chevron-left\"></jump-icon>\n </button> */}\n <jump-button onClick={() => this.doChangePage('previous')} variant=\"primary\" text size=\"small\" name=\"scopri\" value=\"value\" aria-label=\"Scopri di più\" id=\"button\" onlyIcon disabled={this.first === 1}> <jump-icon slot=\"suffix\" name=\"chevron-left\" ></jump-icon> </jump-button>\n <jump-button onClick={() => this.doChangePage('next')} variant=\"primary\" text size=\"small\" name=\"scopri\" value=\"value\" aria-label=\"Scopri di più\" id=\"button\" onlyIcon disabled={this.last === this.total}> <jump-icon slot=\"suffix\" name=\"chevron-right\" ></jump-icon> </jump-button>\n {/* <button\n onClick={() => this.doChangePage('next')}\n disabled={this.last === this.total}\n >\n <jump-icon slot=\"prefix\" name=\"chevron-right\"></jump-icon>\n </button> */}\n {this.showFirstAndLast &&\n // <button\n // onClick={() => this.doChangePage('last')}\n // disabled={this.last === this.total}\n // >\n // <jump-icon slot=\"prefix\" name=\"chevrons-right\"></jump-icon>\n // </button>\n <jump-button onClick={() => this.doChangePage('last')} variant=\"primary\" text size=\"small\" name=\"scopri\" value=\"value\" aria-label=\"Scopri di più\" id=\"button\" onlyIcon disabled={this.last === this.total}> <jump-icon slot=\"suffix\" name=\"chevrons-right\" ></jump-icon> </jump-button>\n }\n </div>\n </div>\n </div>\n </Host>\n );\n }\n\n}\n"]}
|