@supersoniks/concorde 1.1.45 → 1.1.47
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 +0 -0
- package/cli.js +0 -0
- package/concorde-core.bundle.js +36 -23
- package/concorde-core.es.js +1156 -864
- package/concorde-customer.bundle.js +129 -0
- package/concorde-customer.es.js +22004 -0
- package/core/_types/types.d.ts +0 -1
- package/core/components/functional/date/date.js +15 -7
- package/core/components/functional/fetch/fetch.d.ts +3 -1
- package/core/components/functional/list/list.d.ts +36 -19
- package/core/components/functional/list/list.js +15 -23
- package/core/components/functional/queue/queue.d.ts +6 -1
- package/core/components/functional/queue/queue.js +92 -54
- package/core/components/functional/sdui/sdui.d.ts +3 -4
- package/core/components/functional/sdui/sdui.js +0 -3
- package/core/components/ui/_css/type.js +12 -12
- package/core/components/ui/alert/alert.d.ts +3 -0
- package/core/components/ui/alert/alert.js +33 -1
- package/core/components/ui/badge/badge.d.ts +1 -1
- package/core/components/ui/badge/badge.js +9 -3
- package/core/components/ui/button/button.d.ts +2 -0
- package/core/components/ui/button/button.js +37 -12
- package/core/components/ui/form/checkbox/checkbox.d.ts +3 -0
- package/core/components/ui/form/checkbox/checkbox.js +14 -3
- package/core/components/ui/form/css/form-control.d.ts +1 -0
- package/core/components/ui/form/css/form-control.js +17 -0
- package/core/components/ui/form/input/input.d.ts +4 -3
- package/core/components/ui/form/input/input.js +38 -1
- package/core/components/ui/form/textarea/textarea.d.ts +1 -0
- package/core/components/ui/icon/icon.js +1 -1
- package/core/components/ui/image/image.d.ts +2 -0
- package/core/components/ui/image/image.js +28 -0
- package/core/components/ui/modal/modal-close.js +2 -3
- package/core/components/ui/modal/modal-content.js +1 -0
- package/core/components/ui/modal/modal.d.ts +8 -0
- package/core/components/ui/modal/modal.js +34 -6
- package/core/components/ui/pop/pop.js +1 -1
- package/core/components/ui/theme/css/tailwind.css +0 -0
- package/core/components/ui/theme/css/tailwind.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/core-variables.js +18 -9
- package/core/components/ui/theme/theme.js +15 -8
- package/core/components/ui/toast/toast.d.ts +1 -1
- package/core/components/ui/toast/types.d.ts +1 -1
- package/core/components/ui/ui.d.ts +0 -1
- package/core/components/ui/ui.js +0 -1
- package/core/mixins/Fetcher.d.ts +3 -1
- package/core/mixins/Fetcher.js +45 -14
- package/core/mixins/FormCheckable.d.ts +1 -0
- package/core/mixins/FormInput.d.ts +1 -0
- package/core/mixins/Subscriber.d.ts +1 -0
- package/core/mixins/Subscriber.js +12 -7
- package/core/utils/LocationHandler.js +9 -3
- package/core/utils/PublisherProxy.d.ts +30 -4
- package/core/utils/PublisherProxy.js +218 -7
- package/core/utils/api.d.ts +3 -0
- package/core/utils/api.js +3 -1
- package/img/concorde-logo.svg +0 -0
- package/img/concorde.png +0 -0
- package/img/concorde_def.png +0 -0
- package/mixins.d.ts +5 -1
- package/package.json +5 -1
- package/svg/regular/plane.svg +0 -0
- package/svg/solid/plane.svg +0 -0
|
@@ -21,17 +21,33 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
21
21
|
constructor() {
|
|
22
22
|
super(...arguments);
|
|
23
23
|
this.forceAction = false;
|
|
24
|
+
this.removeOnHide = false;
|
|
24
25
|
this.align = "left";
|
|
25
26
|
this.padding = "var(--sc-modal-py) var(--sc-modal-px)";
|
|
26
27
|
this.maxWidth = "var(--sc-modal-max-w) ";
|
|
27
28
|
this.maxHeight = "var(--sc-modal-max-h) ";
|
|
28
29
|
this.width = "100%";
|
|
29
30
|
this.height = "auto";
|
|
31
|
+
this.zIndex = "var(--sc-modal-z-index)";
|
|
30
32
|
this.fullScreen = false;
|
|
31
33
|
this.visible = false;
|
|
32
34
|
}
|
|
33
35
|
static create(options) {
|
|
34
36
|
const modal = document.createElement(tagName);
|
|
37
|
+
// modal styles
|
|
38
|
+
if (options.removeOnHide === true)
|
|
39
|
+
modal.setAttribute("removeOnHide", "true");
|
|
40
|
+
if (options.maxWidth)
|
|
41
|
+
modal.maxWidth = options === null || options === void 0 ? void 0 : options.maxWidth;
|
|
42
|
+
if (options.width)
|
|
43
|
+
modal.width = options === null || options === void 0 ? void 0 : options.width;
|
|
44
|
+
if (options.paddingX)
|
|
45
|
+
modal.style.setProperty("--sc-modal-px", options === null || options === void 0 ? void 0 : options.paddingX);
|
|
46
|
+
if (options.paddingY)
|
|
47
|
+
modal.style.setProperty("--sc-modal-py", options === null || options === void 0 ? void 0 : options.paddingY);
|
|
48
|
+
if (options.zIndex)
|
|
49
|
+
modal.style.setProperty("--sc-modal-z-index", options === null || options === void 0 ? void 0 : options.zIndex);
|
|
50
|
+
// inner content
|
|
35
51
|
modal.innerHTML =
|
|
36
52
|
`<sonic-modal-close></sonic-modal-close><sonic-modal-content>${options.content}</sonic-modal-content>` || "";
|
|
37
53
|
const container = document.querySelector("sonic-theme") || document.body;
|
|
@@ -67,6 +83,7 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
67
83
|
maxHeight: this.maxHeight,
|
|
68
84
|
width: this.width,
|
|
69
85
|
height: this.height,
|
|
86
|
+
zIndex: this.zIndex,
|
|
70
87
|
borderRadius: this.fullScreen ? "0" : "var(--sc-modal-rounded)",
|
|
71
88
|
};
|
|
72
89
|
const modalWrapperStyles = {
|
|
@@ -105,7 +122,7 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
105
122
|
|
|
106
123
|
<div
|
|
107
124
|
class="overlay"
|
|
108
|
-
@click="${!this.forceAction ? this.hide :
|
|
125
|
+
@click="${!this.forceAction ? this.hide : null}"
|
|
109
126
|
${animate({
|
|
110
127
|
keyframeOptions: {
|
|
111
128
|
duration: 500,
|
|
@@ -130,6 +147,9 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
130
147
|
if (this.hasAttribute("resetDataProviderOnHide")) {
|
|
131
148
|
PublisherManager.get(this.getAttribute("resetDataProviderOnHide")).set({});
|
|
132
149
|
}
|
|
150
|
+
if (this.removeOnHide) {
|
|
151
|
+
this.remove();
|
|
152
|
+
}
|
|
133
153
|
}
|
|
134
154
|
dispose() {
|
|
135
155
|
this.hide();
|
|
@@ -138,9 +158,9 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
138
158
|
handleEscape(e) {
|
|
139
159
|
if (e.key === "Escape") {
|
|
140
160
|
const modals = [...document.querySelectorAll(tagName)];
|
|
141
|
-
modals.forEach((
|
|
142
|
-
if (!
|
|
143
|
-
|
|
161
|
+
modals.forEach((modal) => {
|
|
162
|
+
if (!modal.forceAction) {
|
|
163
|
+
modal.hide();
|
|
144
164
|
}
|
|
145
165
|
});
|
|
146
166
|
}
|
|
@@ -164,6 +184,7 @@ Modal.styles = [
|
|
|
164
184
|
--sc-modal-max-w: min(100vw, 64ch);
|
|
165
185
|
--sc-modal-max-h: 80vh;
|
|
166
186
|
--sc-modal-rounded: var(--sc-rounded-lg);
|
|
187
|
+
--sc-modal-z-index: 990;
|
|
167
188
|
}
|
|
168
189
|
|
|
169
190
|
* {
|
|
@@ -175,7 +196,7 @@ Modal.styles = [
|
|
|
175
196
|
bottom: 0;
|
|
176
197
|
left: 0;
|
|
177
198
|
width: 100%;
|
|
178
|
-
z-index:
|
|
199
|
+
z-index: calc(var(--sc-modal-z-index) + 1);
|
|
179
200
|
align-items: center;
|
|
180
201
|
justify-content: center;
|
|
181
202
|
flex-direction: column;
|
|
@@ -207,7 +228,7 @@ Modal.styles = [
|
|
|
207
228
|
top: 0;
|
|
208
229
|
right: 0;
|
|
209
230
|
bottom: 0;
|
|
210
|
-
z-index:
|
|
231
|
+
z-index: var(--sc-modal-z-index);
|
|
211
232
|
opacity: 0.8;
|
|
212
233
|
position: fixed;
|
|
213
234
|
}
|
|
@@ -226,6 +247,7 @@ Modal.styles = [
|
|
|
226
247
|
.modal {
|
|
227
248
|
max-width: none !important;
|
|
228
249
|
width: 100% !important;
|
|
250
|
+
border-radius: var(--sc-modal-rounded) var(--sc-modal-rounded) 0 0 !important;
|
|
229
251
|
}
|
|
230
252
|
}
|
|
231
253
|
|
|
@@ -270,6 +292,9 @@ Modal.styles = [
|
|
|
270
292
|
__decorate([
|
|
271
293
|
property({ type: Boolean })
|
|
272
294
|
], Modal.prototype, "forceAction", void 0);
|
|
295
|
+
__decorate([
|
|
296
|
+
property({ type: Boolean })
|
|
297
|
+
], Modal.prototype, "removeOnHide", void 0);
|
|
273
298
|
__decorate([
|
|
274
299
|
property({ type: String, reflect: true })
|
|
275
300
|
], Modal.prototype, "align", void 0);
|
|
@@ -288,6 +313,9 @@ __decorate([
|
|
|
288
313
|
__decorate([
|
|
289
314
|
property({ type: String })
|
|
290
315
|
], Modal.prototype, "height", void 0);
|
|
316
|
+
__decorate([
|
|
317
|
+
property({ type: String })
|
|
318
|
+
], Modal.prototype, "zIndex", void 0);
|
|
291
319
|
__decorate([
|
|
292
320
|
property({ type: Boolean, reflect: true })
|
|
293
321
|
], Modal.prototype, "fullScreen", void 0);
|
|
@@ -85,7 +85,6 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
85
85
|
firstUpdated(_changedProperties) {
|
|
86
86
|
super.firstUpdated(_changedProperties);
|
|
87
87
|
this.resizeObserver.observe(this.popContent);
|
|
88
|
-
this.computePosition(this.placement);
|
|
89
88
|
}
|
|
90
89
|
disconnectedCallback() {
|
|
91
90
|
super.disconnectedCallback();
|
|
@@ -179,6 +178,7 @@ let Pop = Pop_1 = class Pop extends LitElement {
|
|
|
179
178
|
name="content"
|
|
180
179
|
tabindex="-1"
|
|
181
180
|
part="content"
|
|
181
|
+
style="display: none;"
|
|
182
182
|
class="
|
|
183
183
|
${this.open ? "is-open" : ""}"
|
|
184
184
|
></slot>
|
|
File without changes
|
|
File without changes
|
|
@@ -2,12 +2,13 @@ import { css } from "lit";
|
|
|
2
2
|
export const coreVariables = css `
|
|
3
3
|
:host {
|
|
4
4
|
/* polices*/
|
|
5
|
-
--sc-font-family-base: "Inter var", "Inter", -apple-system, system-ui,
|
|
6
|
-
"Helvetica Neue", Arial,
|
|
5
|
+
--sc-font-family-base: "Inter var", "Inter", -apple-system, system-ui,
|
|
6
|
+
BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
|
|
7
|
+
sans-serif;
|
|
7
8
|
--sc-font-weight-base: 400;
|
|
8
9
|
--sc-font-style-base: normal;
|
|
9
10
|
|
|
10
|
-
--sc-headings-font-family: var(--sc-font-family-base);
|
|
11
|
+
--sc-headings-font-family: var(--sc-font-family-base), sans-serif;
|
|
11
12
|
--sc-headings-font-style: var(--sc-font-style-base);
|
|
12
13
|
--sc-headings-line-height: 1.1;
|
|
13
14
|
--sc-headings-font-weight: 700;
|
|
@@ -29,16 +30,23 @@ export const coreVariables = css `
|
|
|
29
30
|
/* 4 for rounded full*/
|
|
30
31
|
--sc-btn-rounded-intensity: 1.4;
|
|
31
32
|
--sc-btn-font-weight: 500;
|
|
32
|
-
--sc-btn-rounded: calc(
|
|
33
|
+
--sc-btn-rounded: calc(
|
|
34
|
+
(var(--sc-rounded) + var(--sc-rounded-size-intensity)) *
|
|
35
|
+
var(--sc-btn-rounded-intensity)
|
|
36
|
+
);
|
|
33
37
|
|
|
34
38
|
/* Placeholder */
|
|
35
39
|
--sc-placeholder-bg: rgba(17, 24, 39, 0.05);
|
|
36
40
|
|
|
37
41
|
/* OMBRES */
|
|
38
|
-
--sc-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1),
|
|
39
|
-
|
|
40
|
-
--sc-shadow
|
|
41
|
-
|
|
42
|
+
--sc-shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1),
|
|
43
|
+
0 1px 2px -1px rgb(0 0 0 / 0.1);
|
|
44
|
+
--sc-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1),
|
|
45
|
+
0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
46
|
+
--sc-shadow-lg: 0 10px 15px 0px rgb(0 0 0 / 0.1),
|
|
47
|
+
0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
48
|
+
--sc-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1),
|
|
49
|
+
0 8px 10px -6px rgb(0 0 0 / 0.1);
|
|
42
50
|
--sc-shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
|
|
43
51
|
|
|
44
52
|
/* Forms */
|
|
@@ -50,7 +58,8 @@ export const coreVariables = css `
|
|
|
50
58
|
--sc-input-border-color: var(--sc-input-bg);
|
|
51
59
|
--sc-input-rounded-intensity: 1.4;
|
|
52
60
|
--sc-input-rounded: calc(
|
|
53
|
-
(var(--sc-rounded) + var(--sc-rounded-size-intensity)) *
|
|
61
|
+
(var(--sc-rounded) + var(--sc-rounded-size-intensity)) *
|
|
62
|
+
var(--sc-input-rounded-intensity)
|
|
54
63
|
);
|
|
55
64
|
--sc-label-font-weight: 500;
|
|
56
65
|
|
|
@@ -10,6 +10,7 @@ import { customElement, property } from "lit/decorators.js";
|
|
|
10
10
|
import { coreVariables } from "@supersoniks/concorde/core/components/ui/theme/theme-collection/core-variables";
|
|
11
11
|
import { light } from "@supersoniks/concorde/core/components/ui/theme/theme-collection/light";
|
|
12
12
|
import { dark } from "@supersoniks/concorde/core/components/ui/theme/theme-collection/dark";
|
|
13
|
+
import { PublisherManager } from "@supersoniks/concorde/utils";
|
|
13
14
|
const tagName = "sonic-theme";
|
|
14
15
|
let Theme = Theme_1 = class Theme extends LitElement {
|
|
15
16
|
constructor() {
|
|
@@ -25,21 +26,24 @@ let Theme = Theme_1 = class Theme extends LitElement {
|
|
|
25
26
|
this.postCSSVars();
|
|
26
27
|
}
|
|
27
28
|
postCSSVars() {
|
|
29
|
+
var _a;
|
|
28
30
|
const stylesheets = document.styleSheets;
|
|
29
31
|
const ssLength = stylesheets.length;
|
|
30
32
|
const fontUrls = [];
|
|
31
33
|
for (let i = 0; i < ssLength; i++) {
|
|
32
34
|
const ss = stylesheets[i];
|
|
33
|
-
if (ss.href &&
|
|
35
|
+
if (ss.href &&
|
|
36
|
+
(ss.href.includes("googleapis") || ss.href.includes("typekit.net")))
|
|
34
37
|
fontUrls.push(ss.href);
|
|
35
38
|
}
|
|
39
|
+
const theme = {
|
|
40
|
+
variables: this.getCssVariables(),
|
|
41
|
+
fonts: fontUrls,
|
|
42
|
+
};
|
|
43
|
+
(_a = PublisherManager.get("sonic-theme")) === null || _a === void 0 ? void 0 : _a.set(theme);
|
|
36
44
|
document.querySelectorAll("iframe").forEach((elt) => {
|
|
37
45
|
var _a;
|
|
38
|
-
return (_a = elt.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
39
|
-
type: "SonicTheme",
|
|
40
|
-
variables: this.getCssVariables(),
|
|
41
|
-
fonts: fontUrls,
|
|
42
|
-
}, "*");
|
|
46
|
+
return (_a = elt.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(Object.assign({ type: "SonicTheme" }, theme), "*");
|
|
43
47
|
});
|
|
44
48
|
}
|
|
45
49
|
receiveMessage(event) {
|
|
@@ -50,7 +54,10 @@ let Theme = Theme_1 = class Theme extends LitElement {
|
|
|
50
54
|
}
|
|
51
55
|
getCssVariables() {
|
|
52
56
|
const names = [];
|
|
53
|
-
const stylesheets = [
|
|
57
|
+
const stylesheets = [
|
|
58
|
+
...Theme_1.styles.map((s) => s.styleSheet),
|
|
59
|
+
...Array.from(document.styleSheets),
|
|
60
|
+
];
|
|
54
61
|
for (const stylesheet of stylesheets) {
|
|
55
62
|
try {
|
|
56
63
|
if (!stylesheet)
|
|
@@ -96,7 +103,7 @@ Theme.styles = [
|
|
|
96
103
|
}
|
|
97
104
|
|
|
98
105
|
:host([font]) {
|
|
99
|
-
font-family: var(--sc-font-family-base);
|
|
106
|
+
font-family: var(--sc-font-family-base), sans-serif;
|
|
100
107
|
font-weight: var(--sc-font-weight-base);
|
|
101
108
|
font-style: var(--sc-font-style-base);
|
|
102
109
|
}
|
|
@@ -8,7 +8,7 @@ export declare class SonicToast extends LitElement {
|
|
|
8
8
|
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
9
9
|
static removeAll(): void;
|
|
10
10
|
static add(conf: Toast): {
|
|
11
|
-
id: number;
|
|
11
|
+
id: string | number;
|
|
12
12
|
text: string;
|
|
13
13
|
title: string | undefined;
|
|
14
14
|
status: import("@supersoniks/concorde/core/components/ui/toast/types").ToastStatus;
|
package/core/components/ui/ui.js
CHANGED
package/core/mixins/Fetcher.d.ts
CHANGED
|
@@ -54,7 +54,8 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface<PropsType>>, P
|
|
|
54
54
|
/**
|
|
55
55
|
* Première update, le comportement de lazyload est géré ici a l'aide d'un intersection observer.
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
lazyLoadSpan?: HTMLSpanElement | undefined;
|
|
58
|
+
handleLazyLoad(): void;
|
|
58
59
|
onIntersection(entries: IntersectionObserverEntry[]): void;
|
|
59
60
|
propertyMap: object;
|
|
60
61
|
isConnected: boolean;
|
|
@@ -80,6 +81,7 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface<PropsType>>, P
|
|
|
80
81
|
requestUpdate(): void;
|
|
81
82
|
getAttribute(name: string): string;
|
|
82
83
|
hasAttribute(attributeName: string): boolean;
|
|
84
|
+
getBoundingClientRect(): DOMRect;
|
|
83
85
|
};
|
|
84
86
|
} & T;
|
|
85
87
|
export default Fetcher;
|
package/core/mixins/Fetcher.js
CHANGED
|
@@ -87,29 +87,46 @@ const Fetcher = (superClass, propsType) => {
|
|
|
87
87
|
return;
|
|
88
88
|
// if (!this.dataProvider) return;
|
|
89
89
|
this.dispatchEvent(new CustomEvent("loading", { detail: this }));
|
|
90
|
-
this.
|
|
91
|
-
|
|
90
|
+
if (this.getAttribute("localStorage") === "enabled") {
|
|
91
|
+
yield PublisherManager.getInstance().isLocalStrorageReady;
|
|
92
|
+
}
|
|
93
|
+
if (!this.isConnected)
|
|
94
|
+
return;
|
|
92
95
|
const hasLoader = this.isDefaultLoaderEnabled && !this.hasAttribute("noLoader");
|
|
93
|
-
if (hasLoader)
|
|
96
|
+
if (hasLoader) {
|
|
94
97
|
Loader.show();
|
|
98
|
+
}
|
|
95
99
|
const headerData = PublisherManager.getInstance()
|
|
96
100
|
.get(this.getAncestorAttributeValue("headersDataProvider"))
|
|
97
101
|
.get();
|
|
102
|
+
this.isLoading = true;
|
|
103
|
+
if (Objects.isObject(this.props) && Object.keys(this.props || {}).length > 0 && this.isFirstLoad) {
|
|
104
|
+
this.dispatchEvent(new CustomEvent("load", { detail: this }));
|
|
105
|
+
this.isFirstLoad = false;
|
|
106
|
+
this.isLoading = false;
|
|
107
|
+
}
|
|
98
108
|
let data = yield this.api.get(this.endPoint || this.dataProvider || "", headerData);
|
|
109
|
+
if (!this.isConnected) {
|
|
110
|
+
if (hasLoader)
|
|
111
|
+
Loader.hide();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
99
114
|
// Je garde ça mais normalement ça n'arrive jamais
|
|
100
115
|
if (!data) {
|
|
101
116
|
SonicToast.add({ text: "Network Error", status: "error" });
|
|
102
117
|
this.isLoading = false;
|
|
103
|
-
if (hasLoader)
|
|
118
|
+
if (hasLoader) {
|
|
104
119
|
Loader.hide();
|
|
120
|
+
}
|
|
105
121
|
return;
|
|
106
122
|
}
|
|
107
123
|
// Si data ne contient que la réponse HTTP, avec un statut not ok, on affiche un message
|
|
108
124
|
else if (data._sonic_http_response_ && !data._sonic_http_response_.ok && Object.keys(data).length === 1) {
|
|
109
125
|
SonicToast.add({ text: "Network Error", status: "error" });
|
|
110
126
|
}
|
|
111
|
-
if (hasLoader)
|
|
127
|
+
if (hasLoader) {
|
|
112
128
|
Loader.hide();
|
|
129
|
+
}
|
|
113
130
|
if (this.key) {
|
|
114
131
|
const response = data._sonic_http_response_;
|
|
115
132
|
/* preserveOtherKeys s'exprime lorsque le paramètre "key" est défini
|
|
@@ -138,11 +155,10 @@ const Fetcher = (superClass, propsType) => {
|
|
|
138
155
|
connectedCallback() {
|
|
139
156
|
var _a;
|
|
140
157
|
// this.noShadowDom = "";
|
|
158
|
+
super.connectedCallback();
|
|
141
159
|
if (!this.isFetchEnabled) {
|
|
142
|
-
super.connectedCallback();
|
|
143
160
|
return;
|
|
144
161
|
}
|
|
145
|
-
super.connectedCallback();
|
|
146
162
|
this.key = this.getAttribute("key");
|
|
147
163
|
if (this.props) {
|
|
148
164
|
this.publisher.set(this.props);
|
|
@@ -153,25 +169,35 @@ const Fetcher = (superClass, propsType) => {
|
|
|
153
169
|
if (lazyLoad === null) {
|
|
154
170
|
this._fetchData();
|
|
155
171
|
}
|
|
172
|
+
else {
|
|
173
|
+
this.handleLazyLoad();
|
|
174
|
+
}
|
|
156
175
|
}
|
|
157
|
-
|
|
158
|
-
* Première update, le comportement de lazyload est géré ici a l'aide d'un intersection observer.
|
|
159
|
-
*/
|
|
160
|
-
firstUpdated() {
|
|
176
|
+
handleLazyLoad() {
|
|
161
177
|
const lazyLoad = this.getAttribute("lazyload");
|
|
162
178
|
if (lazyLoad === null) {
|
|
163
179
|
return;
|
|
164
180
|
}
|
|
181
|
+
const rect = this.getBoundingClientRect();
|
|
182
|
+
if (rect.x < window.innerWidth && rect.right > 0 && rect.y < window.innerHeight && rect.right > 0) {
|
|
183
|
+
this._fetchData();
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const boundsRatio = parseFloat(this.getAttribute("lazyBoundsRatio") || "1");
|
|
165
187
|
const options = {
|
|
166
188
|
root: null,
|
|
167
|
-
rootMargin: Math.max(window.innerWidth, window.innerHeight) + "px",
|
|
189
|
+
rootMargin: Math.max(window.innerWidth * boundsRatio, window.innerHeight * boundsRatio) + "px",
|
|
168
190
|
};
|
|
169
191
|
this.iObserver = new IntersectionObserver((entries) => this.onIntersection(entries), options);
|
|
170
|
-
let elt = this.shadowRoot ? this.shadowRoot.children[0] : this.children[0];
|
|
171
|
-
if (elt
|
|
192
|
+
let elt = (this.shadowRoot ? this.shadowRoot.children[0] : this.children[0]);
|
|
193
|
+
if ((elt === null || elt === void 0 ? void 0 : elt.nodeName.toLocaleLowerCase()) == "slot")
|
|
172
194
|
elt = elt.children[0];
|
|
173
195
|
if (!elt || elt.nodeName.toLocaleLowerCase() == "template") {
|
|
174
196
|
elt = document.createElement("span");
|
|
197
|
+
const style = elt.style;
|
|
198
|
+
style.position = "absolute";
|
|
199
|
+
style.pointerEvents = "none";
|
|
200
|
+
this.lazyLoadSpan = elt;
|
|
175
201
|
this.appendChild(elt);
|
|
176
202
|
}
|
|
177
203
|
if (elt) {
|
|
@@ -182,9 +208,14 @@ const Fetcher = (superClass, propsType) => {
|
|
|
182
208
|
}
|
|
183
209
|
}
|
|
184
210
|
onIntersection(entries) {
|
|
211
|
+
var _a, _b;
|
|
185
212
|
for (const e of entries) {
|
|
186
213
|
if (e.isIntersecting && this.isFirstLoad) {
|
|
187
214
|
this._fetchData();
|
|
215
|
+
(_a = this.lazyLoadSpan) === null || _a === void 0 ? void 0 : _a.remove();
|
|
216
|
+
this.lazyLoadSpan = undefined;
|
|
217
|
+
(_b = this.iObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
218
|
+
break;
|
|
188
219
|
}
|
|
189
220
|
}
|
|
190
221
|
}
|
|
@@ -81,6 +81,7 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
81
81
|
requestUpdate(): void;
|
|
82
82
|
getAttribute(name: string): string;
|
|
83
83
|
hasAttribute(attributeName: string): boolean;
|
|
84
|
+
getBoundingClientRect(): DOMRect;
|
|
84
85
|
};
|
|
85
86
|
} & T;
|
|
86
87
|
export default Form;
|
|
@@ -65,6 +65,7 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
65
65
|
getAttribute(name: string): string;
|
|
66
66
|
hasAttribute(attributeName: string): boolean;
|
|
67
67
|
disconnectedCallback(): void;
|
|
68
|
+
getBoundingClientRect(): DOMRect;
|
|
68
69
|
};
|
|
69
70
|
} & T;
|
|
70
71
|
export default Form;
|
|
@@ -30,6 +30,7 @@ export interface SubscriberInterface<PropsType = CoreJSType> {
|
|
|
30
30
|
getAttribute(name: string): string;
|
|
31
31
|
hasAttribute(attributeName: string): boolean;
|
|
32
32
|
disconnectedCallback(): void;
|
|
33
|
+
getBoundingClientRect(): DOMRect;
|
|
33
34
|
}
|
|
34
35
|
declare const Subscriber: <PropsType = CoreJSType, T extends Constructor<LitElement> = Constructor<LitElement>>(superClass: T, type?: PropsType | undefined) => Constructor<SubscriberInterface<PropsType>> & T;
|
|
35
36
|
export default Subscriber;
|
|
@@ -141,18 +141,22 @@ const Subscriber = (superClass, type) => {
|
|
|
141
141
|
this.style.removeProperty("display");
|
|
142
142
|
}
|
|
143
143
|
connectedCallback() {
|
|
144
|
+
SubscriberElement.instanceCounter++;
|
|
144
145
|
if (this.hasAttribute("lazyRendering")) {
|
|
145
146
|
const options = {
|
|
146
147
|
root: null,
|
|
147
|
-
rootMargin: Math.max(window.innerWidth
|
|
148
|
+
rootMargin: Math.max(window.innerWidth, window.innerHeight) + "px",
|
|
148
149
|
};
|
|
149
150
|
let firstView = true;
|
|
150
151
|
const iObserver = new IntersectionObserver((entries) => {
|
|
151
152
|
for (const e of entries) {
|
|
152
153
|
if (firstView && e.isIntersecting) {
|
|
154
|
+
this.addDebugger();
|
|
153
155
|
firstView = false;
|
|
154
156
|
this.initWording();
|
|
155
157
|
this.initPublisher();
|
|
158
|
+
iObserver.disconnect();
|
|
159
|
+
break;
|
|
156
160
|
}
|
|
157
161
|
}
|
|
158
162
|
}, options);
|
|
@@ -161,10 +165,9 @@ const Subscriber = (superClass, type) => {
|
|
|
161
165
|
else {
|
|
162
166
|
this.initWording();
|
|
163
167
|
this.initPublisher();
|
|
168
|
+
this.addDebugger();
|
|
164
169
|
}
|
|
165
|
-
this.addDebugger();
|
|
166
170
|
super.connectedCallback();
|
|
167
|
-
SubscriberElement.instanceCounter++;
|
|
168
171
|
}
|
|
169
172
|
disconnectedCallback() {
|
|
170
173
|
var _a;
|
|
@@ -260,7 +263,8 @@ const Subscriber = (superClass, type) => {
|
|
|
260
263
|
password = this.getAncestorAttributeValue("password");
|
|
261
264
|
}
|
|
262
265
|
const credentials = this.getAncestorAttributeValue("credentials") || undefined;
|
|
263
|
-
|
|
266
|
+
const cache = (this.getAttribute("cache") || undefined) || undefined;
|
|
267
|
+
return { serviceURL, token, userName, password, authToken, tokenProvider, addHTTPResponse, credentials, cache };
|
|
264
268
|
}
|
|
265
269
|
initWording() {
|
|
266
270
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -274,16 +278,17 @@ const Subscriber = (superClass, type) => {
|
|
|
274
278
|
}
|
|
275
279
|
if (!hasWording)
|
|
276
280
|
return;
|
|
277
|
-
const publisher = PublisherManager.
|
|
281
|
+
const publisher = PublisherManager.get("sonic-wording");
|
|
278
282
|
const wordingProvider = this.getAncestorAttributeValue("wordingProvider");
|
|
279
283
|
const api = new API(this.getApiConfiguration());
|
|
280
284
|
if (wordingProvider) {
|
|
281
285
|
const wordings = [];
|
|
282
286
|
const wordingsAll = [];
|
|
287
|
+
const publisherValue = publisher.get();
|
|
283
288
|
for (const p of propNames) {
|
|
284
289
|
if (p.indexOf("wording_") == 0) {
|
|
285
290
|
const p8 = p.substring(8);
|
|
286
|
-
if (!
|
|
291
|
+
if (!publisherValue[p]) {
|
|
287
292
|
publisher[p] = "...";
|
|
288
293
|
wordings.push(p8);
|
|
289
294
|
}
|
|
@@ -334,7 +339,7 @@ const Subscriber = (superClass, type) => {
|
|
|
334
339
|
if (this.bindPublisher) {
|
|
335
340
|
mng.set(publisherId, this.bindPublisher());
|
|
336
341
|
}
|
|
337
|
-
let pub = mng.get(publisherId);
|
|
342
|
+
let pub = mng.get(publisherId, { localStorageMode: this.getAttribute("localStorage") || "disabled" });
|
|
338
343
|
this.dataProvider = publisherId;
|
|
339
344
|
if (this.hasAttribute("subDataProvider")) {
|
|
340
345
|
const dataPath = this.getAttribute("subDataProvider");
|
|
@@ -56,7 +56,9 @@ export default class LocationHandler {
|
|
|
56
56
|
const origin = document.location.origin;
|
|
57
57
|
const urlDest = goBack || origin;
|
|
58
58
|
const isHTTP = referrer.indexOf("http") == 0;
|
|
59
|
-
const isNotSameOrigin = isHTTP
|
|
59
|
+
const isNotSameOrigin = isHTTP
|
|
60
|
+
? new URL(referrer).origin != origin
|
|
61
|
+
: false;
|
|
60
62
|
const isReferrerEmpty = referrer == "";
|
|
61
63
|
const isFirstPage = history.length < 3; // imparfait mais variabsle selon les situations
|
|
62
64
|
const isFallbackNoReferer = isReferrerEmpty && isFirstPage; // fallback pour ff qui a parfois un referer nulle ex : drupal 9
|
|
@@ -109,14 +111,18 @@ export default class LocationHandler {
|
|
|
109
111
|
* Ajoute l'attribut "active" à l'élément si l'url correspond à la location en donction du mode d'activation
|
|
110
112
|
*/
|
|
111
113
|
static updateComponentActiveState(component) {
|
|
112
|
-
if (component.autoActive == "disabled")
|
|
114
|
+
if (component.autoActive == "disabled") {
|
|
113
115
|
return;
|
|
116
|
+
}
|
|
114
117
|
if (component.href && component.href.indexOf("http") != 0) {
|
|
115
118
|
const url1 = new URL(component.href, document.location.href);
|
|
116
119
|
const url2 = new URL(component.location || "", document.location.origin);
|
|
117
120
|
let isActive = false;
|
|
118
121
|
if (component.autoActive == "strict") {
|
|
119
|
-
isActive =
|
|
122
|
+
isActive =
|
|
123
|
+
url1.pathname == url2.pathname &&
|
|
124
|
+
url1.hash == url2.hash &&
|
|
125
|
+
url1.search == url2.search;
|
|
120
126
|
}
|
|
121
127
|
else
|
|
122
128
|
isActive = url2.href.indexOf(url1.href) == 0;
|