@meetelise/chat 1.42.4 → 1.43.0
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/src/WebComponent/FeeCalculator/components/addons/addon-table/addon-table.d.ts +6 -1
- package/dist/src/WebComponent/FeeCalculator/components/addons/addon-table/table-qty-selectors.d.ts +1 -0
- package/dist/src/WebComponent/FeeCalculator/components/addons/index.d.ts +0 -1
- package/dist/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout.d.ts +2 -1
- package/dist/src/WebComponent/FeeCalculator/components/fee-card/fee-card.d.ts +3 -2
- package/dist/src/WebComponent/FeeCalculator/components/fee-item/fee-item.d.ts +1 -1
- package/dist/src/WebComponent/FeeCalculator/components/fee-item/grouped-rentable-item.d.ts +23 -0
- package/dist/src/WebComponent/FeeCalculator/fee-calculator.d.ts +2 -1
- package/dist/src/WebComponent/FeeCalculator/model/rentable-item.d.ts +1 -0
- package/dist/src/WebComponent/FeeCalculator/utils/rentable-item-utils.d.ts +19 -0
- package/package.json +1 -1
- package/public/dist/index.js +244 -236
- package/src/WebComponent/FeeCalculator/components/addons/addon-table/addon-table.ts +132 -36
- package/src/WebComponent/FeeCalculator/components/addons/addon-table/table-qty-selectors.ts +18 -17
- package/src/WebComponent/FeeCalculator/components/addons/index.ts +0 -1
- package/src/WebComponent/FeeCalculator/components/fee-calculator-layout/fee-calculator-layout.ts +8 -3
- package/src/WebComponent/FeeCalculator/components/fee-card/fee-card.ts +32 -18
- package/src/WebComponent/FeeCalculator/components/fee-item/fee-item.ts +14 -8
- package/src/WebComponent/FeeCalculator/components/fee-item/grouped-rentable-item.ts +105 -0
- package/src/WebComponent/FeeCalculator/fee-calculator.ts +10 -7
- package/src/WebComponent/FeeCalculator/model/rentable-item-summary.ts +1 -2
- package/src/WebComponent/FeeCalculator/model/rentable-item.ts +2 -0
- package/src/WebComponent/FeeCalculator/utils/rentable-item-utils.ts +61 -0
- package/dist/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector-styles.d.ts +0 -2
- package/dist/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector.d.ts +0 -25
- package/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector-styles.ts +0 -9
- package/src/WebComponent/FeeCalculator/components/addons/rentable-item-qty-selector/rentable-item-qty-selector.ts +0 -156
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { LitElement, TemplateResult } from "lit";
|
|
2
|
-
import { DesiredRentableItem, RentableItemSummary } from "../../../model";
|
|
3
|
-
import "../../../../shared/simple-tooltip";
|
|
4
|
-
export declare class RentableItemQtySelector extends LitElement {
|
|
5
|
-
static styles: import("lit").CSSResult;
|
|
6
|
-
rentableItem: RentableItemSummary | null;
|
|
7
|
-
onSelect: ((rentableItem: DesiredRentableItem) => void) | null;
|
|
8
|
-
disabled: boolean;
|
|
9
|
-
private quantity;
|
|
10
|
-
selectedItemIds: Set<string>;
|
|
11
|
-
get totalAvailableItems(): number;
|
|
12
|
-
get totalInventory(): number;
|
|
13
|
-
get quantityLeft(): number;
|
|
14
|
-
get atMaxUnits(): boolean;
|
|
15
|
-
get atMinUnits(): boolean;
|
|
16
|
-
private handleIncrement;
|
|
17
|
-
private handleDecrement;
|
|
18
|
-
private emitChange;
|
|
19
|
-
render(): TemplateResult;
|
|
20
|
-
}
|
|
21
|
-
declare global {
|
|
22
|
-
interface HTMLElementTagNameMap {
|
|
23
|
-
"rentable-item-qty-selector": RentableItemQtySelector;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { html, LitElement, TemplateResult } from "lit";
|
|
2
|
-
import { customElement, property, state } from "lit/decorators.js";
|
|
3
|
-
import { DesiredRentableItem, RentableItemSummary } from "../../../model";
|
|
4
|
-
|
|
5
|
-
import "../../../../shared/simple-tooltip";
|
|
6
|
-
|
|
7
|
-
import commonAddonStyles from "../common-addon-styles";
|
|
8
|
-
|
|
9
|
-
const DEFAULT_MAX_QUANTITY = 10;
|
|
10
|
-
|
|
11
|
-
@customElement("rentable-item-qty-selector")
|
|
12
|
-
export class RentableItemQtySelector extends LitElement {
|
|
13
|
-
static styles = commonAddonStyles;
|
|
14
|
-
|
|
15
|
-
@property({ type: Object })
|
|
16
|
-
rentableItem: RentableItemSummary | null = null;
|
|
17
|
-
|
|
18
|
-
@property({ type: Function })
|
|
19
|
-
onSelect: ((rentableItem: DesiredRentableItem) => void) | null = null;
|
|
20
|
-
|
|
21
|
-
@property({ type: Boolean, reflect: true })
|
|
22
|
-
disabled = false;
|
|
23
|
-
|
|
24
|
-
@state()
|
|
25
|
-
private quantity = 0;
|
|
26
|
-
|
|
27
|
-
@state()
|
|
28
|
-
selectedItemIds: Set<string> = new Set();
|
|
29
|
-
|
|
30
|
-
get totalAvailableItems(): number {
|
|
31
|
-
return (
|
|
32
|
-
this.rentableItem?.allItems?.filter((item) => item.available).length ?? 0
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get totalInventory(): number {
|
|
37
|
-
return Math.min(
|
|
38
|
-
this.rentableItem?.allItems?.filter((item) => item.available).length ?? 0,
|
|
39
|
-
DEFAULT_MAX_QUANTITY
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
get quantityLeft(): number {
|
|
44
|
-
return this.totalInventory - this.quantity;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
get atMaxUnits(): boolean {
|
|
48
|
-
return this.quantity >= this.totalAvailableItems;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
get atMinUnits(): boolean {
|
|
52
|
-
return this.quantity <= 0;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
private handleIncrement(): void {
|
|
56
|
-
if (this.disabled || this.atMaxUnits) return;
|
|
57
|
-
this.quantity += 1;
|
|
58
|
-
this.emitChange();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
private handleDecrement(): void {
|
|
62
|
-
if (this.disabled || this.atMinUnits) return;
|
|
63
|
-
this.quantity = Math.max(0, this.quantity - 1);
|
|
64
|
-
this.emitChange();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
private emitChange(): void {
|
|
68
|
-
if (!this.rentableItem) return;
|
|
69
|
-
|
|
70
|
-
const firstAvailableItem = this.rentableItem.allItems.find(
|
|
71
|
-
(item) => item.available && !this.selectedItemIds.has(item.id)
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
if (!firstAvailableItem) return;
|
|
75
|
-
|
|
76
|
-
this.selectedItemIds.add(firstAvailableItem.id);
|
|
77
|
-
|
|
78
|
-
this.onSelect?.({
|
|
79
|
-
id: firstAvailableItem.id,
|
|
80
|
-
type: this.rentableItem.type,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
render(): TemplateResult {
|
|
85
|
-
if (!this.rentableItem) return html``;
|
|
86
|
-
|
|
87
|
-
const hasAvailableItems = this.totalAvailableItems > 0;
|
|
88
|
-
|
|
89
|
-
const incrementDisabled =
|
|
90
|
-
this.disabled || !hasAvailableItems || this.atMaxUnits;
|
|
91
|
-
const decrementDisabled = this.disabled || this.quantity <= 0;
|
|
92
|
-
|
|
93
|
-
return html`
|
|
94
|
-
<div class="addon-container">
|
|
95
|
-
<div class="addon-inner-container">
|
|
96
|
-
<div class="addon-header">
|
|
97
|
-
<div class="addon-header-left">
|
|
98
|
-
<p class="addon-title">${this.rentableItem.displayName}</p>
|
|
99
|
-
</div>
|
|
100
|
-
|
|
101
|
-
${this.totalInventory > 0
|
|
102
|
-
? html`
|
|
103
|
-
<div class="addon-header-right">
|
|
104
|
-
<p>${this.totalInventory} Max</p>
|
|
105
|
-
</div>
|
|
106
|
-
`
|
|
107
|
-
: ""}
|
|
108
|
-
</div>
|
|
109
|
-
|
|
110
|
-
<simple-tooltip
|
|
111
|
-
tooltip="Please select a unit first"
|
|
112
|
-
.disabled=${this.disabled}
|
|
113
|
-
>
|
|
114
|
-
<div class="addon-body">
|
|
115
|
-
<div
|
|
116
|
-
class="quantity-control ${!hasAvailableItems || this.disabled
|
|
117
|
-
? "unavailable"
|
|
118
|
-
: ""}"
|
|
119
|
-
>
|
|
120
|
-
<button
|
|
121
|
-
class="quantity-button"
|
|
122
|
-
@click=${this.handleDecrement}
|
|
123
|
-
?disabled=${decrementDisabled}
|
|
124
|
-
aria-label="Decrease quantity"
|
|
125
|
-
>
|
|
126
|
-
<span class="operator-sign">−</span>
|
|
127
|
-
</button>
|
|
128
|
-
<span
|
|
129
|
-
class="quantity-value ${this.disabled
|
|
130
|
-
? "unavailable-text"
|
|
131
|
-
: ""}"
|
|
132
|
-
>
|
|
133
|
-
${hasAvailableItems ? this.quantity : "Not available"}
|
|
134
|
-
</span>
|
|
135
|
-
<button
|
|
136
|
-
class="quantity-button"
|
|
137
|
-
@click=${this.handleIncrement}
|
|
138
|
-
?disabled=${incrementDisabled}
|
|
139
|
-
aria-label="Increase quantity"
|
|
140
|
-
>
|
|
141
|
-
<span class="operator-sign">+</span>
|
|
142
|
-
</button>
|
|
143
|
-
</div>
|
|
144
|
-
</div>
|
|
145
|
-
</simple-tooltip>
|
|
146
|
-
</div>
|
|
147
|
-
</div>
|
|
148
|
-
`;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
declare global {
|
|
153
|
-
interface HTMLElementTagNameMap {
|
|
154
|
-
"rentable-item-qty-selector": RentableItemQtySelector;
|
|
155
|
-
}
|
|
156
|
-
}
|