@supersoniks/concorde 1.1.43 → 1.1.45
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/README.md +9 -7
- package/concorde-core.bundle.js +20 -20
- package/concorde-core.es.js +987 -804
- package/core/_types/types.d.ts +13 -8
- package/core/_types/types.js +1 -0
- package/core/components/functional/date/date.d.ts +2 -2
- package/core/components/functional/date/date.js +10 -10
- package/core/components/functional/example/example.d.ts +1 -1
- package/core/components/functional/fetch/fetch.d.ts +8 -6
- package/core/components/functional/list/list.d.ts +16 -8
- package/core/components/functional/list/list.js +29 -14
- package/core/components/functional/mix/mix.d.ts +5 -5
- package/core/components/functional/mix/mix.js +11 -8
- package/core/components/functional/queue/queue.d.ts +13 -4
- package/core/components/functional/queue/queue.js +33 -27
- package/core/components/functional/router/redirect.d.ts +2 -2
- package/core/components/functional/router/redirect.js +2 -6
- package/core/components/functional/router/router.d.ts +1 -1
- package/core/components/functional/router/router.js +22 -13
- package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +0 -1
- package/core/components/functional/sdui/SDUIDescriptorTransformer.js +35 -36
- package/core/components/functional/sdui/sdui-utils.js +11 -11
- package/core/components/functional/sdui/sdui.d.ts +11 -10
- package/core/components/functional/sdui/sdui.js +33 -34
- package/core/components/functional/sdui/types.d.ts +8 -8
- package/core/components/functional/states/states.d.ts +3 -3
- package/core/components/functional/states/states.js +9 -8
- package/core/components/functional/submit/submit.d.ts +1 -1
- package/core/components/functional/submit/submit.js +16 -16
- package/core/components/functional/subscriber/subscriber.d.ts +1 -1
- package/core/components/functional/value/value.d.ts +1 -1
- package/core/components/functional/value/value.js +3 -2
- package/core/components/ui/_css/size.d.ts +1 -1
- package/core/components/ui/button/button.d.ts +6 -4
- package/core/components/ui/button/button.js +34 -30
- package/core/components/ui/captcha/captcha.d.ts +2 -2
- package/core/components/ui/captcha/captcha.js +2 -2
- package/core/components/ui/card/card-header.js +5 -1
- package/core/components/ui/card/card.js +7 -5
- package/core/components/ui/form/checkbox/checkbox.d.ts +36 -12
- package/core/components/ui/form/fieldset/fieldset.d.ts +1 -1
- package/core/components/ui/form/form-layout/form-layout.d.ts +1 -1
- package/core/components/ui/form/input/input.d.ts +14 -9
- package/core/components/ui/form/input/input.js +2 -2
- package/core/components/ui/form/input/password-helper.d.ts +1 -1
- package/core/components/ui/form/input/password-helper.js +1 -1
- package/core/components/ui/form/input/same-value-helper.d.ts +1 -1
- package/core/components/ui/form/input/same-value-helper.js +2 -2
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +1 -1
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +1 -1
- package/core/components/ui/form/select/select.d.ts +5 -4
- package/core/components/ui/form/select/select.js +24 -12
- package/core/components/ui/form/textarea/textarea.d.ts +11 -9
- package/core/components/ui/form/textarea/textarea.js +1 -1
- package/core/components/ui/group/group.js +8 -2
- package/core/components/ui/icon/icons.js +15 -13
- package/core/components/ui/loader/loader.d.ts +1 -1
- package/core/components/ui/loader/loader.js +1 -1
- package/core/components/ui/menu/menu.js +15 -16
- package/core/components/ui/modal/modal.d.ts +1 -1
- package/core/components/ui/modal/modal.js +1 -1
- package/core/components/ui/pop/pop.d.ts +6 -5
- package/core/components/ui/pop/pop.js +76 -46
- package/core/components/ui/table/table-tbody.js +1 -1
- package/core/components/ui/theme/theme.js +15 -13
- package/core/components/ui/toast/message-subscriber.d.ts +12 -9
- package/core/components/ui/toast/message-subscriber.js +10 -8
- package/core/components/ui/toast/toast.d.ts +1 -1
- package/core/components/ui/toast/toast.js +7 -8
- package/core/components/ui/toast/types.d.ts +3 -2
- package/core/components/ui/tooltip/tooltip.js +4 -4
- package/core/components/ui/ui.d.ts +1 -1
- package/core/components/ui/ui.js +1 -1
- package/core/mixins/Fetcher.d.ts +15 -17
- package/core/mixins/Fetcher.js +19 -10
- package/core/mixins/FormCheckable.d.ts +8 -5
- package/core/mixins/FormCheckable.js +21 -19
- package/core/mixins/FormElement.d.ts +10 -7
- package/core/mixins/FormElement.js +24 -23
- package/core/mixins/FormInput.d.ts +16 -10
- package/core/mixins/FormInput.js +1 -1
- package/core/mixins/Subscriber.d.ts +8 -6
- package/core/mixins/Subscriber.js +24 -23
- package/core/mixins/TemplatesContainer.d.ts +2 -1
- package/core/mixins/TemplatesContainer.js +2 -2
- package/core/utils/Arrays.js +12 -9
- package/core/utils/DataBindObserver.d.ts +4 -4
- package/core/utils/DataBindObserver.js +26 -28
- package/core/utils/HTML.d.ts +1 -1
- package/core/utils/HTML.js +2 -2
- package/core/utils/LocationHandler.js +10 -10
- package/core/utils/Objects.js +10 -4
- package/core/utils/PublisherProxy.d.ts +21 -15
- package/core/utils/PublisherProxy.js +67 -63
- package/core/utils/api.d.ts +40 -32
- package/core/utils/api.js +127 -32
- package/mixins.d.ts +25 -19
- package/package.json +11 -6
- package/core/components/ui/taxonomy/taxonomy.d.ts +0 -44
- package/core/components/ui/taxonomy/taxonomy.js +0 -115
|
@@ -13,7 +13,6 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
15
|
this.open = false;
|
|
16
|
-
this.toggle = "true";
|
|
17
16
|
this.noToggle = false;
|
|
18
17
|
this.inline = false;
|
|
19
18
|
/**
|
|
@@ -22,15 +21,16 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
22
21
|
this.shadow = "lg";
|
|
23
22
|
this.placement = "bottom";
|
|
24
23
|
this.positioningRuns = false;
|
|
25
|
-
this.lastContentX =
|
|
26
|
-
this.lastContentY =
|
|
24
|
+
this.lastContentX = 0;
|
|
25
|
+
this.lastContentY = 0;
|
|
26
|
+
this.resizeObserver = new ResizeObserver(() => this.computePosition(this.placement));
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
runPositioningLoop() {
|
|
29
29
|
if (!this.positioningRuns)
|
|
30
30
|
return;
|
|
31
31
|
this.positioningRuns = true;
|
|
32
|
-
this.
|
|
33
|
-
window.requestAnimationFrame(() => this.
|
|
32
|
+
this.computePosition(this.placement);
|
|
33
|
+
window.requestAnimationFrame(() => this.runPositioningLoop());
|
|
34
34
|
}
|
|
35
35
|
_toggle(e) {
|
|
36
36
|
if (this.open && this.noToggle)
|
|
@@ -42,13 +42,14 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
42
42
|
this.open ? this._show() : this._hide();
|
|
43
43
|
}
|
|
44
44
|
_show() {
|
|
45
|
+
this.popContent.style.removeProperty("display");
|
|
45
46
|
this.open = true;
|
|
46
47
|
this.popContent.setAttribute("tabindex", "0");
|
|
47
48
|
if (this.popBtn && this.popContent && !this.positioningRuns) {
|
|
48
49
|
this.positioningRuns = true;
|
|
49
|
-
this.lastContentX =
|
|
50
|
-
this.lastContentY =
|
|
51
|
-
this.
|
|
50
|
+
this.lastContentX = 0;
|
|
51
|
+
this.lastContentY = 0;
|
|
52
|
+
this.runPositioningLoop();
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
_hide() {
|
|
@@ -57,8 +58,8 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
57
58
|
this.positioningRuns = false;
|
|
58
59
|
}
|
|
59
60
|
_handleClosePop(e) {
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
const path = e.composedPath();
|
|
62
|
+
const target = path[0];
|
|
62
63
|
Pop_1.pops.forEach((pop) => {
|
|
63
64
|
const popContainsTarget = path.includes(pop);
|
|
64
65
|
const popContentContainsTarget = path.includes(pop.querySelector('[slot="content"]'));
|
|
@@ -78,6 +79,14 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
78
79
|
}
|
|
79
80
|
Pop_1.pops.add(this);
|
|
80
81
|
}
|
|
82
|
+
// /*
|
|
83
|
+
// On attends le premier rendu pour observer les changements de taille car popup content n'est pas encore défini sinon
|
|
84
|
+
// */
|
|
85
|
+
firstUpdated(_changedProperties) {
|
|
86
|
+
super.firstUpdated(_changedProperties);
|
|
87
|
+
this.resizeObserver.observe(this.popContent);
|
|
88
|
+
this.computePosition(this.placement);
|
|
89
|
+
}
|
|
81
90
|
disconnectedCallback() {
|
|
82
91
|
super.disconnectedCallback();
|
|
83
92
|
Pop_1.pops.delete(this);
|
|
@@ -85,23 +94,21 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
85
94
|
document.removeEventListener("pointerdown", this._handleClosePop);
|
|
86
95
|
document.removeEventListener("click", this._handleClosePop);
|
|
87
96
|
}
|
|
97
|
+
this.resizeObserver.unobserve(this.popContent);
|
|
88
98
|
}
|
|
89
|
-
|
|
90
|
-
var _a;
|
|
91
|
-
|
|
99
|
+
computePosition(placement) {
|
|
100
|
+
var _a, _b, _c;
|
|
101
|
+
let contentRect = (_a = this.popContent) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
92
102
|
const padding = 8;
|
|
93
|
-
const shiftPadding =
|
|
103
|
+
const shiftPadding = 5;
|
|
94
104
|
const thisRect = this.getBoundingClientRect();
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
let bodyRect = this.offsetParent.getBoundingClientRect();
|
|
98
|
-
let x0 = thisRect.left - bodyRect.left;
|
|
99
|
-
let y0 = thisRect.top - bodyRect.top;
|
|
105
|
+
const x0 = thisRect.left;
|
|
106
|
+
const y0 = thisRect.top;
|
|
100
107
|
let x = x0, y = y0;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
const yTop = y0 - contentRect.height - padding;
|
|
109
|
+
const xLeft = x0 - contentRect.width - padding;
|
|
110
|
+
const xRight = x0 + thisRect.width + padding;
|
|
111
|
+
const yBottom = y0 + thisRect.height + padding;
|
|
105
112
|
switch (placement) {
|
|
106
113
|
case "bottom":
|
|
107
114
|
y = yBottom;
|
|
@@ -116,27 +123,53 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
116
123
|
x = xRight;
|
|
117
124
|
break;
|
|
118
125
|
}
|
|
119
|
-
|
|
120
|
-
if (dxRight < 0 && placement === "right")
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (
|
|
126
|
+
// const dxRight = window.innerWidth - xRight - bodyRect.left - contentRect.width - shiftPadding;
|
|
127
|
+
// if (dxRight < 0 && placement === "right") x = xLeft;
|
|
128
|
+
// if (dxRight < 0 && ["top", "bottom"].includes(placement)) x = Math.max(x + dxRight, xLeft + thisRect.width);
|
|
129
|
+
// const dxLeft = -bodyRect.left - xLeft;
|
|
130
|
+
// if (dxLeft > shiftPadding && placement === "left") x = xRight;
|
|
131
|
+
// const dyBottom = window.innerHeight - yBottom - bodyRect.top - contentRect.height - shiftPadding;
|
|
132
|
+
// if (dyBottom < 0 && placement === "bottom") y = yTop;
|
|
133
|
+
// if (dyBottom < 0 && ["left", "right"].includes(placement)) y = Math.max(y + dyBottom, yTop + thisRect.height);
|
|
134
|
+
// const dyTop = -bodyRect.top - yTop;
|
|
135
|
+
// if (dyTop > -shiftPadding && placement === "top") y = yBottom;
|
|
136
|
+
this.lastContentX += x - contentRect.x;
|
|
137
|
+
this.lastContentY += y - contentRect.y;
|
|
138
|
+
Object.assign(this.popContent.style, {
|
|
139
|
+
left: `${this.lastContentX}px`,
|
|
140
|
+
top: `${this.lastContentY}px`,
|
|
141
|
+
});
|
|
142
|
+
contentRect = (_b = this.popContent) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
143
|
+
if (contentRect.x < shiftPadding && placement == "left")
|
|
126
144
|
x = xRight;
|
|
127
|
-
|
|
128
|
-
if (dyBottom < 0 && placement === "bottom")
|
|
129
|
-
y = yTop;
|
|
130
|
-
if (dyBottom < 0 && ["left", "right"].includes(placement))
|
|
131
|
-
y = Math.max(y + dyBottom, yTop + thisRect.height);
|
|
132
|
-
let dyTop = -bodyRect.top - yTop;
|
|
133
|
-
if (dyTop > -shiftPadding && placement === "top")
|
|
145
|
+
if (contentRect.y < shiftPadding && placement == "top")
|
|
134
146
|
y = yBottom;
|
|
135
|
-
|
|
136
|
-
|
|
147
|
+
if (contentRect.x + contentRect.width > window.innerWidth - shiftPadding && placement == "right")
|
|
148
|
+
x = xLeft;
|
|
149
|
+
if (contentRect.y + contentRect.height > window.innerHeight - shiftPadding && placement == "bottom")
|
|
150
|
+
y = yTop;
|
|
151
|
+
this.lastContentX += x - contentRect.x;
|
|
152
|
+
this.lastContentY += y - contentRect.y;
|
|
137
153
|
Object.assign(this.popContent.style, {
|
|
138
|
-
left: `${
|
|
139
|
-
top: `${
|
|
154
|
+
left: `${this.lastContentX}px`,
|
|
155
|
+
top: `${this.lastContentY}px`,
|
|
156
|
+
});
|
|
157
|
+
contentRect = (_c = this.popContent) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
|
|
158
|
+
if (contentRect.x < 0) {
|
|
159
|
+
this.lastContentX += -contentRect.x;
|
|
160
|
+
}
|
|
161
|
+
if (contentRect.y < 0) {
|
|
162
|
+
this.lastContentY += -contentRect.y;
|
|
163
|
+
}
|
|
164
|
+
if (contentRect.x + contentRect.width > window.innerWidth) {
|
|
165
|
+
this.lastContentX += window.innerWidth - (contentRect.x + contentRect.width);
|
|
166
|
+
}
|
|
167
|
+
if (contentRect.y + contentRect.height > window.innerHeight) {
|
|
168
|
+
this.lastContentY += window.innerHeight - (contentRect.y + contentRect.height);
|
|
169
|
+
}
|
|
170
|
+
Object.assign(this.popContent.style, {
|
|
171
|
+
left: `${this.lastContentX}px`,
|
|
172
|
+
top: `${this.lastContentY}px`,
|
|
140
173
|
});
|
|
141
174
|
}
|
|
142
175
|
render() {
|
|
@@ -174,7 +207,7 @@ Pop.styles = [
|
|
|
174
207
|
border-radius: min(calc(var(--sc-btn-rounded) * 2), 0.4em);
|
|
175
208
|
}
|
|
176
209
|
|
|
177
|
-
slot[name="content"].is-open {
|
|
210
|
+
slot[name="content"].is-open:not(.is-empty) {
|
|
178
211
|
transform: translateY(0) scale(1);
|
|
179
212
|
opacity: 1;
|
|
180
213
|
pointer-events: auto;
|
|
@@ -215,9 +248,6 @@ __decorate([
|
|
|
215
248
|
__decorate([
|
|
216
249
|
query("slot[name=content]")
|
|
217
250
|
], Pop.prototype, "popContent", void 0);
|
|
218
|
-
__decorate([
|
|
219
|
-
property({ type: String })
|
|
220
|
-
], Pop.prototype, "toggle", void 0);
|
|
221
251
|
__decorate([
|
|
222
252
|
property({ type: Boolean })
|
|
223
253
|
], Pop.prototype, "noToggle", void 0);
|
|
@@ -27,9 +27,9 @@ let Theme = Theme_1 = class Theme extends LitElement {
|
|
|
27
27
|
postCSSVars() {
|
|
28
28
|
const stylesheets = document.styleSheets;
|
|
29
29
|
const ssLength = stylesheets.length;
|
|
30
|
-
|
|
30
|
+
const fontUrls = [];
|
|
31
31
|
for (let i = 0; i < ssLength; i++) {
|
|
32
|
-
|
|
32
|
+
const ss = stylesheets[i];
|
|
33
33
|
if (ss.href && (ss.href.includes("googleapis") || ss.href.includes("typekit.net")))
|
|
34
34
|
fontUrls.push(ss.href);
|
|
35
35
|
}
|
|
@@ -43,34 +43,36 @@ let Theme = Theme_1 = class Theme extends LitElement {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
receiveMessage(event) {
|
|
46
|
-
|
|
46
|
+
const data = event.data;
|
|
47
47
|
if (!data.type || data.type != "GetSonicTheme")
|
|
48
48
|
return;
|
|
49
49
|
this.postCSSVars();
|
|
50
50
|
}
|
|
51
51
|
getCssVariables() {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
for (
|
|
52
|
+
const names = [];
|
|
53
|
+
const stylesheets = [...Theme_1.styles.map((s) => s.styleSheet), ...Array.from(document.styleSheets)];
|
|
54
|
+
for (const stylesheet of stylesheets) {
|
|
55
55
|
try {
|
|
56
56
|
if (!stylesheet)
|
|
57
57
|
continue;
|
|
58
|
-
|
|
59
|
-
for (
|
|
58
|
+
const rules = stylesheet.cssRules;
|
|
59
|
+
for (const rule of rules) {
|
|
60
60
|
if (!("style" in rule))
|
|
61
61
|
continue;
|
|
62
|
-
|
|
63
|
-
for (
|
|
62
|
+
const style = rule.style;
|
|
63
|
+
for (const name of style) {
|
|
64
64
|
if (names.includes(name) || name.indexOf("--sc") !== 0)
|
|
65
65
|
continue;
|
|
66
66
|
names.push(name);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
catch (e) {
|
|
70
|
+
catch (e) {
|
|
71
|
+
console.log("Erreur lors de la récupération des variables CSS");
|
|
72
|
+
}
|
|
71
73
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
const style = window.getComputedStyle(this);
|
|
75
|
+
const result = {};
|
|
74
76
|
names.forEach((name) => (result[name] = style.getPropertyValue(name)));
|
|
75
77
|
return result;
|
|
76
78
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { Message } from "@supersoniks/concorde/la-billetterie/_types/swagger";
|
|
3
|
+
type APIResult = {
|
|
4
|
+
data?: object | string;
|
|
5
|
+
message?: string;
|
|
6
|
+
public_message?: string;
|
|
7
|
+
success?: boolean;
|
|
8
|
+
messages?: Message[];
|
|
9
|
+
status?: boolean;
|
|
7
10
|
};
|
|
8
|
-
declare const MessageSubscriber_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<
|
|
11
|
+
declare const MessageSubscriber_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<APIResult>) & typeof LitElement;
|
|
9
12
|
export declare class MessageSubscriber extends MessageSubscriber_base {
|
|
10
13
|
_messages: Array<Message>;
|
|
11
14
|
success: boolean | null;
|
|
@@ -15,9 +18,9 @@ export declare class MessageSubscriber extends MessageSubscriber_base {
|
|
|
15
18
|
_message: string;
|
|
16
19
|
get message(): string;
|
|
17
20
|
set message(value: string);
|
|
18
|
-
_data:
|
|
19
|
-
get data(): string |
|
|
20
|
-
set data(value: string |
|
|
21
|
+
_data: object | string;
|
|
22
|
+
get data(): string | object;
|
|
23
|
+
set data(value: string | object);
|
|
21
24
|
render(): symbol;
|
|
22
25
|
}
|
|
23
26
|
export {};
|
|
@@ -10,7 +10,7 @@ import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
|
10
10
|
import { SonicToast } from "@supersoniks/concorde/core/components/ui/toast/toast";
|
|
11
11
|
const tagName = "sonic-toast-message-subscriber";
|
|
12
12
|
//Superbe mix de multples versions d'api.
|
|
13
|
-
let MessageSubscriber = class MessageSubscriber extends Subscriber(LitElement) {
|
|
13
|
+
let MessageSubscriber = class MessageSubscriber extends Subscriber(LitElement, {}) {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
16
|
this._messages = [];
|
|
@@ -28,19 +28,20 @@ let MessageSubscriber = class MessageSubscriber extends Subscriber(LitElement) {
|
|
|
28
28
|
return;
|
|
29
29
|
value.forEach((message) => {
|
|
30
30
|
if (message.type == "public")
|
|
31
|
-
SonicToast.add({ text: message.content, status: message.status });
|
|
31
|
+
SonicToast.add({ text: message.content || "", status: message.status });
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
get message() {
|
|
35
35
|
return this._message;
|
|
36
36
|
}
|
|
37
37
|
set message(value) {
|
|
38
|
+
var _a, _b;
|
|
38
39
|
this._message = value;
|
|
39
40
|
if (!this.message)
|
|
40
41
|
return;
|
|
41
|
-
if (this.props.success !== false)
|
|
42
|
+
if (((_a = this.props) === null || _a === void 0 ? void 0 : _a.success) !== false)
|
|
42
43
|
return;
|
|
43
|
-
if (this.props.public_message)
|
|
44
|
+
if ((_b = this.props) === null || _b === void 0 ? void 0 : _b.public_message)
|
|
44
45
|
return;
|
|
45
46
|
//OUi OUi il faut afficher "message" que si success est parfaitement égal à false et qu'il n'y a rien dans public_message.
|
|
46
47
|
SonicToast.add({ text: this.message, status: "error" });
|
|
@@ -49,15 +50,16 @@ let MessageSubscriber = class MessageSubscriber extends Subscriber(LitElement) {
|
|
|
49
50
|
return this._data;
|
|
50
51
|
}
|
|
51
52
|
set data(value) {
|
|
53
|
+
var _a, _b, _c, _d;
|
|
52
54
|
this._data = value;
|
|
53
55
|
const toastOptions = { text: "Votre produit a bien été ajouté", status: "success" };
|
|
54
|
-
if (Array.isArray(this.data) && this.props.success === true)
|
|
56
|
+
if (Array.isArray(this.data) && ((_a = this.props) === null || _a === void 0 ? void 0 : _a.success) === true)
|
|
55
57
|
SonicToast.add(toastOptions);
|
|
56
|
-
if (this.data == "" && this.props.status === true)
|
|
58
|
+
if (this.data == "" && ((_b = this.props) === null || _b === void 0 ? void 0 : _b.status) === true)
|
|
57
59
|
SonicToast.add(toastOptions);
|
|
58
|
-
if (this.props.success !== false)
|
|
60
|
+
if (((_c = this.props) === null || _c === void 0 ? void 0 : _c.success) !== false)
|
|
59
61
|
return;
|
|
60
|
-
if (this.props.public_message)
|
|
62
|
+
if ((_d = this.props) === null || _d === void 0 ? void 0 : _d.public_message)
|
|
61
63
|
return;
|
|
62
64
|
SonicToast.add({ text: this.data, status: "error" });
|
|
63
65
|
}
|
|
@@ -11,7 +11,7 @@ export declare class SonicToast extends LitElement {
|
|
|
11
11
|
id: number;
|
|
12
12
|
text: string;
|
|
13
13
|
title: string | undefined;
|
|
14
|
-
status: import("@supersoniks/concorde/core/components/ui/toast/types").ToastStatus
|
|
14
|
+
status: import("@supersoniks/concorde/core/components/ui/toast/types").ToastStatus;
|
|
15
15
|
preserve: boolean | undefined;
|
|
16
16
|
ghost: boolean | undefined;
|
|
17
17
|
dismissForever: boolean | undefined;
|
|
@@ -72,7 +72,7 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
72
72
|
</div>`;
|
|
73
73
|
}
|
|
74
74
|
static removeAll() {
|
|
75
|
-
|
|
75
|
+
const toastComponent = document.querySelector("sonic-toast");
|
|
76
76
|
if (!toastComponent)
|
|
77
77
|
return;
|
|
78
78
|
toastComponent.toasts = toastComponent.toasts.filter((item) => item.ghost);
|
|
@@ -82,12 +82,12 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
82
82
|
var _a;
|
|
83
83
|
// Init toast area si absente (au <sonic-theme> ou <body< à défaut)
|
|
84
84
|
if (!document.querySelector("sonic-toast")) {
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
const toastComponent = document.createElement("sonic-toast");
|
|
86
|
+
const container = document.querySelector("sonic-theme") || document.body;
|
|
87
87
|
container.prepend(toastComponent);
|
|
88
88
|
}
|
|
89
89
|
// Ajoute le toast à la liste
|
|
90
|
-
|
|
90
|
+
const toastComponent = document.querySelector("sonic-toast");
|
|
91
91
|
const nextId = (_a = conf.id) !== null && _a !== void 0 ? _a : new Date().valueOf();
|
|
92
92
|
const interactiveRegExp = new RegExp("</a>|</.*?button>|</.*?input>|</.*?textarea>|</.*?select>");
|
|
93
93
|
const hasInteractive = interactiveRegExp.test(conf.text);
|
|
@@ -109,9 +109,9 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
if (toastComponent.toasts.length > 0) {
|
|
112
|
-
|
|
112
|
+
const toastA = Object.assign({}, currentToast);
|
|
113
113
|
for (const toast of toastComponent.toasts) {
|
|
114
|
-
|
|
114
|
+
const toastB = Object.assign({}, toast);
|
|
115
115
|
toastA.id = toastB.id = 0;
|
|
116
116
|
if ( /*!currentToast.preserve && */Objects.shallowEqual(toastA, toastB)) {
|
|
117
117
|
return null;
|
|
@@ -122,10 +122,9 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
122
122
|
return currentToast;
|
|
123
123
|
}
|
|
124
124
|
static removeItem(toastToRemove) {
|
|
125
|
-
|
|
125
|
+
const toastComponent = document.querySelector("sonic-toast");
|
|
126
126
|
if (!toastComponent)
|
|
127
127
|
return;
|
|
128
|
-
console.log(toastToRemove);
|
|
129
128
|
toastComponent.removeItem(toastToRemove);
|
|
130
129
|
}
|
|
131
130
|
// Remove Toast
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import { Message } from "@supersoniks/concorde/la-billetterie/_types/swagger";
|
|
2
|
+
export type ToastStatus = Message["status"] | "" | "success";
|
|
3
|
+
export type Toast = {
|
|
3
4
|
id?: number;
|
|
4
5
|
text: string;
|
|
5
6
|
title?: string;
|
|
@@ -14,7 +14,7 @@ let Tooltip = class Tooltip extends LitElement {
|
|
|
14
14
|
this.disabled = false;
|
|
15
15
|
}
|
|
16
16
|
render() {
|
|
17
|
-
|
|
17
|
+
const disabledClass = this.disabled || this.label == "" ? "disabled" : "";
|
|
18
18
|
return html `<div data-tooltip-text="${this.label.trim().replace(" ", " ")}" class="tooltip ${disabledClass}">
|
|
19
19
|
<slot></slot>
|
|
20
20
|
</div>`;
|
|
@@ -38,14 +38,14 @@ Tooltip.styles = [
|
|
|
38
38
|
opacity: 0;
|
|
39
39
|
pointer-events: none;
|
|
40
40
|
background: var(--sc-base-content, #111827);
|
|
41
|
-
padding: 0.25rem;
|
|
42
|
-
border-radius:
|
|
41
|
+
padding: 0.32rem 0.25rem;
|
|
42
|
+
border-radius: var(--sc-rounded);
|
|
43
43
|
color: var(--sc-base, #fff);
|
|
44
44
|
z-index: 999;
|
|
45
45
|
display: none;
|
|
46
46
|
line-height: 1.1;
|
|
47
47
|
width: max-content;
|
|
48
|
-
max-width:
|
|
48
|
+
max-width: 18rem;
|
|
49
49
|
white-space: pre-line;
|
|
50
50
|
font-weight: var(--sc-tooltip-fw);
|
|
51
51
|
}
|
|
@@ -19,7 +19,7 @@ import "./group/group";
|
|
|
19
19
|
import "./icon/icon";
|
|
20
20
|
import "./image/image";
|
|
21
21
|
import "./loader/loader";
|
|
22
|
-
import "
|
|
22
|
+
import "../../../la-billetterie/components/event/atoms/taxonomy/taxonomy";
|
|
23
23
|
import "./menu/menu";
|
|
24
24
|
import "./modal/modal";
|
|
25
25
|
import "./alert/alert";
|
package/core/components/ui/ui.js
CHANGED
|
@@ -23,7 +23,7 @@ import "./group/group";
|
|
|
23
23
|
import "./icon/icon";
|
|
24
24
|
import "./image/image";
|
|
25
25
|
import "./loader/loader";
|
|
26
|
-
import "
|
|
26
|
+
import "../../../la-billetterie/components/event/atoms/taxonomy/taxonomy";
|
|
27
27
|
//Menu
|
|
28
28
|
import "./menu/menu";
|
|
29
29
|
// Misc
|
package/core/mixins/Fetcher.d.ts
CHANGED
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
import "@supersoniks/concorde/core/components/ui/button/button";
|
|
3
3
|
import { SubscriberInterface } from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
4
4
|
import API from "@supersoniks/concorde/core/utils/api";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { PublisherContentType } from "../_types/types";
|
|
6
|
+
import { MixinArgsType } from "../_types/types";
|
|
7
|
+
import { ResultTypeInterface } from "@supersoniks/concorde/core/utils/api";
|
|
8
|
+
type Constructor<T> = new (...args: MixinArgsType[]) => T;
|
|
9
|
+
declare const Fetcher: <T extends Constructor<SubscriberInterface<PropsType>>, PropsType extends PublisherContentType = PublisherContentType>(superClass: T, propsType?: PropsType | undefined) => {
|
|
10
|
+
new (...args: MixinArgsType[]): {
|
|
8
11
|
api: API | null;
|
|
9
12
|
/**
|
|
10
13
|
* Après le chargement des données on traverse l'objet reçu en fonctione de la cible exprimées dans cette propriété avec la dot syntaxe.
|
|
11
14
|
* C'est cette donnée cible qui est injectée dans les pros et donc disponible via le publisher disponible globalement via PublisherManager.get(dataProvider)
|
|
12
15
|
*/
|
|
13
|
-
key:
|
|
16
|
+
key: string;
|
|
14
17
|
/**
|
|
15
18
|
* isFirstLoad vaut true jusqu'au premier chargement de données
|
|
16
19
|
*/
|
|
@@ -33,6 +36,7 @@ declare const Fetcher: <PropsType = any, T extends Constructor<SubscriberInterfa
|
|
|
33
36
|
*/
|
|
34
37
|
isFetchEnabled: boolean;
|
|
35
38
|
_endPoint: string;
|
|
39
|
+
props: (PropsType & ResultTypeInterface) | null;
|
|
36
40
|
endPoint: string;
|
|
37
41
|
requestId: number;
|
|
38
42
|
refetchEveryMs: number;
|
|
@@ -52,36 +56,30 @@ declare const Fetcher: <PropsType = any, T extends Constructor<SubscriberInterfa
|
|
|
52
56
|
*/
|
|
53
57
|
firstUpdated(): void;
|
|
54
58
|
onIntersection(entries: IntersectionObserverEntry[]): void;
|
|
55
|
-
|
|
56
|
-
propertyMap: Object;
|
|
59
|
+
propertyMap: object;
|
|
57
60
|
isConnected: boolean;
|
|
61
|
+
children: HTMLCollection;
|
|
62
|
+
appendChild(node: Node): Node;
|
|
58
63
|
getAncestorAttributeValue(attributeName: string): string;
|
|
59
64
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
60
65
|
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
61
66
|
publisher: any;
|
|
62
67
|
dataProvider: string | null;
|
|
63
|
-
noShadowDom: string | null;
|
|
64
|
-
* isFirstLoad vaut true jusqu'au premier chargement de données
|
|
65
|
-
*/
|
|
68
|
+
noShadowDom: string | null;
|
|
66
69
|
debug: HTMLElement | null;
|
|
67
70
|
defferedDebug: boolean | null;
|
|
68
71
|
displayContents: boolean;
|
|
69
|
-
shadowRoot?: ShadowRoot | undefined;
|
|
70
|
-
* isLoading vaut true pendant le chargement des données
|
|
71
|
-
*/
|
|
72
|
+
shadowRoot?: ShadowRoot | undefined;
|
|
72
73
|
dispatchEvent(event: Event): void;
|
|
73
74
|
setAttribute(name: string, value: string): void;
|
|
74
75
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
75
76
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
|
76
77
|
removeAttribute(name: string): void;
|
|
77
|
-
initPublisher(): void;
|
|
78
|
-
* On peut désactiver le fetch programmatiquement via cette propriété.
|
|
79
|
-
* Cela est le cas pour le composant sonic-list qui ne fetch que si l'attribut fetch est renseigné
|
|
80
|
-
*/
|
|
78
|
+
initPublisher(): void;
|
|
81
79
|
getApiConfiguration(): import("@supersoniks/concorde/core/utils/api").APIConfiguration;
|
|
82
80
|
requestUpdate(): void;
|
|
83
81
|
getAttribute(name: string): string;
|
|
84
|
-
hasAttribute(attributeName:
|
|
82
|
+
hasAttribute(attributeName: string): boolean;
|
|
85
83
|
};
|
|
86
84
|
} & T;
|
|
87
85
|
export default Fetcher;
|
package/core/mixins/Fetcher.js
CHANGED
|
@@ -58,6 +58,12 @@ const Fetcher = (superClass, propsType) => {
|
|
|
58
58
|
args;
|
|
59
59
|
this.dataProvider = "";
|
|
60
60
|
}
|
|
61
|
+
get props() {
|
|
62
|
+
return super.props;
|
|
63
|
+
}
|
|
64
|
+
set props(value) {
|
|
65
|
+
super.props = value;
|
|
66
|
+
}
|
|
61
67
|
set endPoint(value) {
|
|
62
68
|
this._endPoint = value;
|
|
63
69
|
if (this.isConnected)
|
|
@@ -83,12 +89,13 @@ const Fetcher = (superClass, propsType) => {
|
|
|
83
89
|
this.dispatchEvent(new CustomEvent("loading", { detail: this }));
|
|
84
90
|
this.isLoading = true;
|
|
85
91
|
this.requestUpdate();
|
|
86
|
-
|
|
87
|
-
let hasLoader = this.isDefaultLoaderEnabled && !this.hasAttribute("noLoader");
|
|
92
|
+
const hasLoader = this.isDefaultLoaderEnabled && !this.hasAttribute("noLoader");
|
|
88
93
|
if (hasLoader)
|
|
89
94
|
Loader.show();
|
|
90
|
-
|
|
91
|
-
|
|
95
|
+
const headerData = PublisherManager.getInstance()
|
|
96
|
+
.get(this.getAncestorAttributeValue("headersDataProvider"))
|
|
97
|
+
.get();
|
|
98
|
+
let data = yield this.api.get(this.endPoint || this.dataProvider || "", headerData);
|
|
92
99
|
// Je garde ça mais normalement ça n'arrive jamais
|
|
93
100
|
if (!data) {
|
|
94
101
|
SonicToast.add({ text: "Network Error", status: "error" });
|
|
@@ -104,7 +111,7 @@ const Fetcher = (superClass, propsType) => {
|
|
|
104
111
|
if (hasLoader)
|
|
105
112
|
Loader.hide();
|
|
106
113
|
if (this.key) {
|
|
107
|
-
|
|
114
|
+
const response = data._sonic_http_response_;
|
|
108
115
|
/* preserveOtherKeys s'exprime lorsque le paramètre "key" est défini
|
|
109
116
|
* Conserve les autres propriétés de l'objet reçu, en plus des propriétés définies sous "key"
|
|
110
117
|
*/
|
|
@@ -155,18 +162,17 @@ const Fetcher = (superClass, propsType) => {
|
|
|
155
162
|
if (lazyLoad === null) {
|
|
156
163
|
return;
|
|
157
164
|
}
|
|
158
|
-
|
|
165
|
+
const options = {
|
|
159
166
|
root: null,
|
|
160
167
|
rootMargin: Math.max(window.innerWidth, window.innerHeight) + "px",
|
|
161
168
|
};
|
|
162
169
|
this.iObserver = new IntersectionObserver((entries) => this.onIntersection(entries), options);
|
|
163
|
-
let
|
|
164
|
-
let elt = this.shadowRoot ? this.shadowRoot.children[0] : that.children[0];
|
|
170
|
+
let elt = this.shadowRoot ? this.shadowRoot.children[0] : this.children[0];
|
|
165
171
|
if (elt && elt.nodeName.toLocaleLowerCase() == "slot")
|
|
166
172
|
elt = elt.children[0];
|
|
167
173
|
if (!elt || elt.nodeName.toLocaleLowerCase() == "template") {
|
|
168
174
|
elt = document.createElement("span");
|
|
169
|
-
|
|
175
|
+
this.appendChild(elt);
|
|
170
176
|
}
|
|
171
177
|
if (elt) {
|
|
172
178
|
this.iObserver.observe(elt);
|
|
@@ -183,6 +189,9 @@ const Fetcher = (superClass, propsType) => {
|
|
|
183
189
|
}
|
|
184
190
|
}
|
|
185
191
|
}
|
|
192
|
+
__decorate([
|
|
193
|
+
property()
|
|
194
|
+
], FetcherElement.prototype, "props", null);
|
|
186
195
|
__decorate([
|
|
187
196
|
property({ type: String })
|
|
188
197
|
], FetcherElement.prototype, "endPoint", null);
|
|
@@ -192,6 +201,6 @@ const Fetcher = (superClass, propsType) => {
|
|
|
192
201
|
__decorate([
|
|
193
202
|
property({ type: Number })
|
|
194
203
|
], FetcherElement.prototype, "refetchEveryMs", void 0);
|
|
195
|
-
return FetcherElement; //
|
|
204
|
+
return FetcherElement; //as Constructor<SubscriberInterface> & T;
|
|
196
205
|
};
|
|
197
206
|
export default Fetcher;
|