@supersoniks/concorde 1.1.46 → 1.1.48
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 +19 -21
- package/concorde-core.es.js +802 -822
- 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 +5 -0
- package/core/components/functional/list/list.d.ts +37 -18
- package/core/components/functional/list/list.js +12 -22
- package/core/components/functional/sdui/sdui.d.ts +5 -3
- package/core/components/functional/sdui/sdui.js +0 -3
- package/core/components/ui/_css/type.js +12 -12
- package/core/components/ui/badge/badge.js +3 -4
- package/core/components/ui/button/button.d.ts +5 -0
- package/core/components/ui/button/button.js +37 -12
- package/core/components/ui/form/checkbox/checkbox.d.ts +8 -0
- package/core/components/ui/form/css/form-control.js +7 -5
- package/core/components/ui/form/form-layout/form-layout.js +3 -1
- package/core/components/ui/form/input/input.d.ts +7 -1
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +9 -0
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +37 -7
- package/core/components/ui/form/textarea/textarea.d.ts +4 -0
- 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.d.ts +2 -0
- package/core/components/ui/modal/modal.js +6 -3
- 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.js +8 -6
- 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/decorators/Subscriber.d.ts +3 -0
- package/core/decorators/Subscriber.js +78 -0
- package/core/mixins/Fetcher.d.ts +8 -1
- package/core/mixins/Fetcher.js +9 -10
- package/core/mixins/FormCheckable.d.ts +4 -0
- package/core/mixins/FormInput.d.ts +5 -4
- package/core/mixins/Subscriber.d.ts +4 -0
- package/core/mixins/Subscriber.js +30 -4
- package/core/utils/LocationHandler.js +9 -3
- package/core/utils/PublisherProxy.d.ts +0 -1
- package/core/utils/PublisherProxy.js +0 -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 +13 -0
- package/package.json +2 -2
- package/svg/regular/plane.svg +0 -0
- package/svg/solid/plane.svg +0 -0
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { html, LitElement, css, nothing } from "lit";
|
|
8
|
-
import { customElement, property } from "lit/decorators.js";
|
|
8
|
+
import { customElement, property, queryAssignedNodes, state, } from "lit/decorators.js";
|
|
9
9
|
import { FormInput, FormElement, Subscriber, TemplatesContainer, } from "@supersoniks/concorde/mixins";
|
|
10
10
|
import "@supersoniks/concorde/core/components/ui/form/input/input";
|
|
11
11
|
import "@supersoniks/concorde/core/components/ui/pop/pop";
|
|
@@ -13,6 +13,8 @@ import "@supersoniks/concorde/core/components/functional/queue/queue";
|
|
|
13
13
|
import "@supersoniks/concorde/core/components/ui/menu/menu-item";
|
|
14
14
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
15
15
|
import { PublisherManager } from "@supersoniks/concorde/utils";
|
|
16
|
+
import { customScroll } from "@supersoniks/concorde/core/components/ui/_css/scroll";
|
|
17
|
+
import { ResizeController } from "@lit-labs/observers/resize_controller.js";
|
|
16
18
|
/**
|
|
17
19
|
* Input avec autocomplete. Propose des valeurs à partir d'un sonic-queue.
|
|
18
20
|
* L'input permet de filtrer les choix de valeurs dans le sonic-pop.
|
|
@@ -31,6 +33,8 @@ let InputAutocomplete = class InputAutocomplete extends TemplatesContainer(FormI
|
|
|
31
33
|
this.dataProviderExpression = "";
|
|
32
34
|
this.key = "";
|
|
33
35
|
this.searchParameter = "";
|
|
36
|
+
this.hasInputPrefix = false;
|
|
37
|
+
this._resizeController = new ResizeController(this, {});
|
|
34
38
|
/**
|
|
35
39
|
* Les dataProviders
|
|
36
40
|
*/
|
|
@@ -39,9 +43,6 @@ let InputAutocomplete = class InputAutocomplete extends TemplatesContainer(FormI
|
|
|
39
43
|
this.queueDataProvider = "";
|
|
40
44
|
this.initQueueDataProvider = "";
|
|
41
45
|
this.lastValidSearch = "";
|
|
42
|
-
/**
|
|
43
|
-
* Les fonctions de gestion
|
|
44
|
-
*/
|
|
45
46
|
this.updateSearchParameter = (value) => {
|
|
46
47
|
if (value == "") {
|
|
47
48
|
this.lastValidSearch = "";
|
|
@@ -79,6 +80,13 @@ let InputAutocomplete = class InputAutocomplete extends TemplatesContainer(FormI
|
|
|
79
80
|
}
|
|
80
81
|
};
|
|
81
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Les fonctions de gestion
|
|
85
|
+
*/
|
|
86
|
+
hasSlotOrProps() {
|
|
87
|
+
var _a;
|
|
88
|
+
this.hasInputPrefix = !!((_a = this.slotInputPrefixNodes) === null || _a === void 0 ? void 0 : _a.length);
|
|
89
|
+
}
|
|
82
90
|
connectedCallback() {
|
|
83
91
|
var _a, _b, _c;
|
|
84
92
|
super.connectedCallback();
|
|
@@ -145,7 +153,6 @@ let InputAutocomplete = class InputAutocomplete extends TemplatesContainer(FormI
|
|
|
145
153
|
if (!Array.isArray(list))
|
|
146
154
|
continue;
|
|
147
155
|
listItem = list.find(itemFinder);
|
|
148
|
-
console.log(listItem);
|
|
149
156
|
if (listItem) {
|
|
150
157
|
break;
|
|
151
158
|
}
|
|
@@ -173,7 +180,6 @@ let InputAutocomplete = class InputAutocomplete extends TemplatesContainer(FormI
|
|
|
173
180
|
return html `
|
|
174
181
|
<sonic-pop noToggle style="display:block;" @hide=${this.handleHide}>
|
|
175
182
|
<sonic-input
|
|
176
|
-
debug
|
|
177
183
|
dataProvider="${this.initSearchDataProvider + Math.random()}"
|
|
178
184
|
formDataProvider="${this.searchDataProvider}"
|
|
179
185
|
type="search"
|
|
@@ -188,6 +194,12 @@ let InputAutocomplete = class InputAutocomplete extends TemplatesContainer(FormI
|
|
|
188
194
|
inlineContent
|
|
189
195
|
size=${this.size}
|
|
190
196
|
>
|
|
197
|
+
<slot
|
|
198
|
+
name="prefix"
|
|
199
|
+
slot="prefix"
|
|
200
|
+
@slotchange=${this.hasSlotOrProps}
|
|
201
|
+
></slot>
|
|
202
|
+
|
|
191
203
|
${this.select
|
|
192
204
|
? html `
|
|
193
205
|
<sonic-icon
|
|
@@ -199,7 +211,11 @@ let InputAutocomplete = class InputAutocomplete extends TemplatesContainer(FormI
|
|
|
199
211
|
`
|
|
200
212
|
: nothing}
|
|
201
213
|
</sonic-input>
|
|
202
|
-
<sonic-menu
|
|
214
|
+
<sonic-menu
|
|
215
|
+
slot="content"
|
|
216
|
+
class="custom-scroll"
|
|
217
|
+
style="${this.offsetWidth ? `width: ${this.offsetWidth}px` : ""}"
|
|
218
|
+
>
|
|
203
219
|
<sonic-queue
|
|
204
220
|
dataProvider="${this.queueDataProvider}"
|
|
205
221
|
filteredFields=${this.filteredFields}
|
|
@@ -226,10 +242,18 @@ let InputAutocomplete = class InputAutocomplete extends TemplatesContainer(FormI
|
|
|
226
242
|
}
|
|
227
243
|
};
|
|
228
244
|
InputAutocomplete.styles = [
|
|
245
|
+
customScroll,
|
|
229
246
|
css `
|
|
230
247
|
:host {
|
|
231
248
|
display: block;
|
|
232
249
|
}
|
|
250
|
+
|
|
251
|
+
sonic-menu {
|
|
252
|
+
display: block;
|
|
253
|
+
max-height: clamp(20rem, 55vh, 35rem);
|
|
254
|
+
min-width: 14rem;
|
|
255
|
+
width: 100%;
|
|
256
|
+
}
|
|
233
257
|
`,
|
|
234
258
|
];
|
|
235
259
|
__decorate([
|
|
@@ -256,6 +280,12 @@ __decorate([
|
|
|
256
280
|
__decorate([
|
|
257
281
|
property({ type: String })
|
|
258
282
|
], InputAutocomplete.prototype, "searchParameter", void 0);
|
|
283
|
+
__decorate([
|
|
284
|
+
queryAssignedNodes({ slot: "prefix" })
|
|
285
|
+
], InputAutocomplete.prototype, "slotInputPrefixNodes", void 0);
|
|
286
|
+
__decorate([
|
|
287
|
+
state()
|
|
288
|
+
], InputAutocomplete.prototype, "hasInputPrefix", void 0);
|
|
259
289
|
InputAutocomplete = __decorate([
|
|
260
290
|
customElement("sonic-input-autocomplete")
|
|
261
291
|
], InputAutocomplete);
|
|
@@ -56,6 +56,10 @@ declare const Textarea_base: {
|
|
|
56
56
|
hasAttribute(attributeName: string): boolean;
|
|
57
57
|
disconnectedCallback(): void;
|
|
58
58
|
getBoundingClientRect(): DOMRect;
|
|
59
|
+
onConnected(callback: (component: any) => void): void;
|
|
60
|
+
offConnected(callback: (component: any) => void): void;
|
|
61
|
+
onDisconnected(callback: (component: any) => void): void;
|
|
62
|
+
offDisconnected(callback: (component: any) => void): void;
|
|
59
63
|
};
|
|
60
64
|
} & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/FormElement").FormElementInterface) & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("../../../../_types/types").CoreJSType>) & typeof LitElement;
|
|
61
65
|
export declare class Textarea extends Textarea_base {
|
|
@@ -5,9 +5,11 @@ export declare class Image extends LitElement {
|
|
|
5
5
|
src: string;
|
|
6
6
|
alt: string;
|
|
7
7
|
loading: "eager" | "lazy";
|
|
8
|
+
transition?: "fade" | "fade-scale-out";
|
|
8
9
|
ratio: string;
|
|
9
10
|
objectPosition: string;
|
|
10
11
|
imageRendering: string;
|
|
11
12
|
cover: boolean;
|
|
13
|
+
firstUpdated(): void;
|
|
12
14
|
render(): import("lit-html").TemplateResult<1>;
|
|
13
15
|
}
|
|
@@ -20,6 +20,17 @@ let Image = class Image extends LitElement {
|
|
|
20
20
|
this.imageRendering = "auto";
|
|
21
21
|
this.cover = false;
|
|
22
22
|
}
|
|
23
|
+
firstUpdated() {
|
|
24
|
+
var _a;
|
|
25
|
+
if (this.transition) {
|
|
26
|
+
const img = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("img");
|
|
27
|
+
if (!img)
|
|
28
|
+
return;
|
|
29
|
+
img.onload = function () {
|
|
30
|
+
img.classList.add("loaded");
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
23
34
|
render() {
|
|
24
35
|
const imgStyles = {
|
|
25
36
|
aspectRatio: this.cover ? "auto" : this.ratio,
|
|
@@ -93,6 +104,20 @@ Image.styles = [
|
|
|
93
104
|
height: 100% !important;
|
|
94
105
|
width: 100% !important;
|
|
95
106
|
}
|
|
107
|
+
|
|
108
|
+
:host([transition]) img {
|
|
109
|
+
opacity: 0;
|
|
110
|
+
transition: 0.25s;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
:host([transition="fade-scale-out"]) img {
|
|
114
|
+
scale: 1.08;
|
|
115
|
+
transition: opacity 0.3s linear, scale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
116
|
+
}
|
|
117
|
+
:host([transition]) img.loaded {
|
|
118
|
+
opacity: 1;
|
|
119
|
+
scale: 1;
|
|
120
|
+
}
|
|
96
121
|
`,
|
|
97
122
|
];
|
|
98
123
|
__decorate([
|
|
@@ -107,6 +132,9 @@ __decorate([
|
|
|
107
132
|
__decorate([
|
|
108
133
|
property({ type: String })
|
|
109
134
|
], Image.prototype, "loading", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
property({ type: String, reflect: true })
|
|
137
|
+
], Image.prototype, "transition", void 0);
|
|
110
138
|
__decorate([
|
|
111
139
|
property({ type: String })
|
|
112
140
|
], Image.prototype, "ratio", void 0);
|
|
@@ -11,6 +11,8 @@ declare type ModalCreateOptions = {
|
|
|
11
11
|
paddingY?: string;
|
|
12
12
|
width?: string;
|
|
13
13
|
maxWidth?: string;
|
|
14
|
+
height?: string;
|
|
15
|
+
maxHeight?: string;
|
|
14
16
|
removeOnHide?: boolean;
|
|
15
17
|
};
|
|
16
18
|
declare const Modal_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("@supersoniks/concorde/core/_types/types").CoreJSType>) & typeof LitElement;
|
|
@@ -41,6 +41,10 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
41
41
|
modal.maxWidth = options === null || options === void 0 ? void 0 : options.maxWidth;
|
|
42
42
|
if (options.width)
|
|
43
43
|
modal.width = options === null || options === void 0 ? void 0 : options.width;
|
|
44
|
+
if (options.maxHeight)
|
|
45
|
+
modal.maxHeight = options === null || options === void 0 ? void 0 : options.maxHeight;
|
|
46
|
+
if (options.height)
|
|
47
|
+
modal.height = options === null || options === void 0 ? void 0 : options.height;
|
|
44
48
|
if (options.paddingX)
|
|
45
49
|
modal.style.setProperty("--sc-modal-px", options === null || options === void 0 ? void 0 : options.paddingX);
|
|
46
50
|
if (options.paddingY)
|
|
@@ -48,8 +52,7 @@ let Modal = class Modal extends Subscriber(LitElement) {
|
|
|
48
52
|
if (options.zIndex)
|
|
49
53
|
modal.style.setProperty("--sc-modal-z-index", options === null || options === void 0 ? void 0 : options.zIndex);
|
|
50
54
|
// inner content
|
|
51
|
-
modal.innerHTML =
|
|
52
|
-
`<sonic-modal-close></sonic-modal-close><sonic-modal-content>${options.content}</sonic-modal-content>` || "";
|
|
55
|
+
modal.innerHTML = `<sonic-modal-close></sonic-modal-close><sonic-modal-content>${options.content}</sonic-modal-content>` || "";
|
|
53
56
|
const container = document.querySelector("sonic-theme") || document.body;
|
|
54
57
|
container.appendChild(modal);
|
|
55
58
|
modal.show();
|
|
@@ -182,7 +185,7 @@ Modal.styles = [
|
|
|
182
185
|
--sc-modal-py: 2.5rem;
|
|
183
186
|
--sc-modal-px: 1.5rem;
|
|
184
187
|
--sc-modal-max-w: min(100vw, 64ch);
|
|
185
|
-
--sc-modal-max-h:
|
|
188
|
+
--sc-modal-max-h: 85vh;
|
|
186
189
|
--sc-modal-rounded: var(--sc-rounded-lg);
|
|
187
190
|
--sc-modal-z-index: 990;
|
|
188
191
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -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,6 +26,7 @@ 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 = [];
|
|
@@ -34,13 +36,14 @@ let Theme = Theme_1 = class Theme extends LitElement {
|
|
|
34
36
|
(ss.href.includes("googleapis") || ss.href.includes("typekit.net")))
|
|
35
37
|
fontUrls.push(ss.href);
|
|
36
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);
|
|
37
44
|
document.querySelectorAll("iframe").forEach((elt) => {
|
|
38
45
|
var _a;
|
|
39
|
-
return (_a = elt.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
40
|
-
type: "SonicTheme",
|
|
41
|
-
variables: this.getCssVariables(),
|
|
42
|
-
fonts: fontUrls,
|
|
43
|
-
}, "*");
|
|
46
|
+
return (_a = elt.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(Object.assign({ type: "SonicTheme" }, theme), "*");
|
|
44
47
|
});
|
|
45
48
|
}
|
|
46
49
|
receiveMessage(event) {
|
|
@@ -55,7 +58,6 @@ let Theme = Theme_1 = class Theme extends LitElement {
|
|
|
55
58
|
...Theme_1.styles.map((s) => s.styleSheet),
|
|
56
59
|
...Array.from(document.styleSheets),
|
|
57
60
|
];
|
|
58
|
-
console.log(stylesheets);
|
|
59
61
|
for (const stylesheet of stylesheets) {
|
|
60
62
|
try {
|
|
61
63
|
if (!stylesheet)
|
|
@@ -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
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function bind(value: string): (target: any, propertyKey: string) => void;
|
|
2
|
+
export declare function onAssign(values: Array<string>): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
3
|
+
export declare function autoFill(value: string): (target: any) => void;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Objects, PublisherManager } from "@supersoniks/concorde/utils";
|
|
2
|
+
export function bind(value) {
|
|
3
|
+
const split = value.split(".");
|
|
4
|
+
if (split.length == 0) {
|
|
5
|
+
return function () {
|
|
6
|
+
//Empty def function
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
const dataProvider = split.shift() || "";
|
|
10
|
+
let publisher = PublisherManager.get(dataProvider);
|
|
11
|
+
publisher = Objects.traverse(publisher, split);
|
|
12
|
+
return function (target, propertyKey) {
|
|
13
|
+
let onAssign;
|
|
14
|
+
target.onConnected((component) => {
|
|
15
|
+
onAssign = (value) => {
|
|
16
|
+
component[propertyKey] = value;
|
|
17
|
+
};
|
|
18
|
+
publisher.onAssign(onAssign);
|
|
19
|
+
});
|
|
20
|
+
target.onDisconnected(() => {
|
|
21
|
+
publisher.offAssign(onAssign);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function onAssign(values) {
|
|
26
|
+
const onAssignValues = [];
|
|
27
|
+
const confs = [];
|
|
28
|
+
let callback;
|
|
29
|
+
for (let i = 0; i < values.length; i++) {
|
|
30
|
+
const value = values[i];
|
|
31
|
+
const split = value.split(".");
|
|
32
|
+
if (split.length == 0) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const dataProvider = split.shift() || "";
|
|
36
|
+
let publisher = PublisherManager.get(dataProvider);
|
|
37
|
+
publisher = Objects.traverse(publisher, split);
|
|
38
|
+
const onAssign = (value) => {
|
|
39
|
+
onAssignValues[i] = value;
|
|
40
|
+
if (onAssignValues.filter((v) => v !== null).length == values.length)
|
|
41
|
+
callback(...onAssignValues);
|
|
42
|
+
};
|
|
43
|
+
confs.push({ publisher, onAssign });
|
|
44
|
+
}
|
|
45
|
+
return function (target, propertyKey, descriptor) {
|
|
46
|
+
propertyKey;
|
|
47
|
+
target.onConnected((component) => {
|
|
48
|
+
callback = descriptor.value.bind(component);
|
|
49
|
+
for (const conf of confs) {
|
|
50
|
+
conf.publisher.onAssign(conf.onAssign);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
target.onDisconnected(() => {
|
|
54
|
+
for (const conf of confs) {
|
|
55
|
+
conf.publisher.offAssign(conf.onAssign);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export function autoFill(value) {
|
|
61
|
+
const split = value.split(".");
|
|
62
|
+
if (split.length == 0) {
|
|
63
|
+
return function () {
|
|
64
|
+
//Empty def function
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const dataProvider = split.shift() || "";
|
|
68
|
+
let publisher = PublisherManager.get(dataProvider);
|
|
69
|
+
publisher = Objects.traverse(publisher, split);
|
|
70
|
+
return function (target) {
|
|
71
|
+
target.prototype.connectedCallbackCalls.add((component) => {
|
|
72
|
+
publisher.startTemplateFilling(component);
|
|
73
|
+
});
|
|
74
|
+
target.prototype.disconnectedCallbackCalls.add((component) => {
|
|
75
|
+
publisher.stopTemplateFilling(component);
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
}
|
package/core/mixins/Fetcher.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ 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
|
+
lazyLoadSpan?: HTMLSpanElement | undefined;
|
|
57
58
|
handleLazyLoad(): void;
|
|
58
59
|
onIntersection(entries: IntersectionObserverEntry[]): void;
|
|
59
60
|
propertyMap: object;
|
|
@@ -69,7 +70,9 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface<PropsType>>, P
|
|
|
69
70
|
debug: HTMLElement | null;
|
|
70
71
|
defferedDebug: boolean | null;
|
|
71
72
|
displayContents: boolean;
|
|
72
|
-
shadowRoot?: ShadowRoot | undefined;
|
|
73
|
+
shadowRoot?: ShadowRoot | undefined; /**
|
|
74
|
+
* isFirstLoad vaut true jusqu'au premier chargement de données
|
|
75
|
+
*/
|
|
73
76
|
dispatchEvent(event: Event): void;
|
|
74
77
|
setAttribute(name: string, value: string): void;
|
|
75
78
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
@@ -81,6 +84,10 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface<PropsType>>, P
|
|
|
81
84
|
getAttribute(name: string): string;
|
|
82
85
|
hasAttribute(attributeName: string): boolean;
|
|
83
86
|
getBoundingClientRect(): DOMRect;
|
|
87
|
+
onConnected(callback: (component: any) => void): void;
|
|
88
|
+
offConnected(callback: (component: any) => void): void;
|
|
89
|
+
onDisconnected(callback: (component: any) => void): void;
|
|
90
|
+
offDisconnected(callback: (component: any) => void): void;
|
|
84
91
|
};
|
|
85
92
|
} & T;
|
|
86
93
|
export default Fetcher;
|
package/core/mixins/Fetcher.js
CHANGED
|
@@ -173,9 +173,6 @@ const Fetcher = (superClass, propsType) => {
|
|
|
173
173
|
this.handleLazyLoad();
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Première update, le comportement de lazyload est géré ici a l'aide d'un intersection observer.
|
|
178
|
-
*/
|
|
179
176
|
handleLazyLoad() {
|
|
180
177
|
const lazyLoad = this.getAttribute("lazyload");
|
|
181
178
|
if (lazyLoad === null) {
|
|
@@ -192,15 +189,15 @@ const Fetcher = (superClass, propsType) => {
|
|
|
192
189
|
rootMargin: Math.max(window.innerWidth * boundsRatio, window.innerHeight * boundsRatio) + "px",
|
|
193
190
|
};
|
|
194
191
|
this.iObserver = new IntersectionObserver((entries) => this.onIntersection(entries), options);
|
|
195
|
-
/**
|
|
196
|
-
* on retire cette partie car finalement on mets systématiquement un span pour la détection de l'intersection
|
|
197
|
-
*/
|
|
198
192
|
let elt = (this.shadowRoot ? this.shadowRoot.children[0] : this.children[0]);
|
|
199
|
-
if (elt
|
|
193
|
+
if ((elt === null || elt === void 0 ? void 0 : elt.nodeName.toLocaleLowerCase()) == "slot")
|
|
200
194
|
elt = elt.children[0];
|
|
201
195
|
if (!elt || elt.nodeName.toLocaleLowerCase() == "template") {
|
|
202
196
|
elt = document.createElement("span");
|
|
203
|
-
|
|
197
|
+
const style = elt.style;
|
|
198
|
+
style.position = "absolute";
|
|
199
|
+
style.pointerEvents = "none";
|
|
200
|
+
this.lazyLoadSpan = elt;
|
|
204
201
|
this.appendChild(elt);
|
|
205
202
|
}
|
|
206
203
|
if (elt) {
|
|
@@ -211,11 +208,13 @@ const Fetcher = (superClass, propsType) => {
|
|
|
211
208
|
}
|
|
212
209
|
}
|
|
213
210
|
onIntersection(entries) {
|
|
214
|
-
var _a;
|
|
211
|
+
var _a, _b;
|
|
215
212
|
for (const e of entries) {
|
|
216
213
|
if (e.isIntersecting && this.isFirstLoad) {
|
|
217
214
|
this._fetchData();
|
|
218
|
-
(_a = this.
|
|
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();
|
|
219
218
|
break;
|
|
220
219
|
}
|
|
221
220
|
}
|
|
@@ -82,6 +82,10 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
82
82
|
getAttribute(name: string): string;
|
|
83
83
|
hasAttribute(attributeName: string): boolean;
|
|
84
84
|
getBoundingClientRect(): DOMRect;
|
|
85
|
+
onConnected(callback: (component: any) => void): void;
|
|
86
|
+
offConnected(callback: (component: any) => void): void;
|
|
87
|
+
onDisconnected(callback: (component: any) => void): void;
|
|
88
|
+
offDisconnected(callback: (component: any) => void): void;
|
|
85
89
|
};
|
|
86
90
|
} & T;
|
|
87
91
|
export default Form;
|
|
@@ -42,10 +42,7 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
42
42
|
children: HTMLCollection;
|
|
43
43
|
appendChild(node: Node): Node;
|
|
44
44
|
getAncestorAttributeValue(attributeName: string): string;
|
|
45
|
-
hasAncestorAttribute(attributeName: string): boolean;
|
|
46
|
-
* Le type De l'input, comme en html cependant tous les types ne sont pas actuellements compatibles en raison du style en vigueur
|
|
47
|
-
* On peut essayer text, date, color, email par exemple, mais pas radio/checkbox/range a priori
|
|
48
|
-
*/
|
|
45
|
+
hasAncestorAttribute(attributeName: string): boolean;
|
|
49
46
|
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
50
47
|
publisher: any;
|
|
51
48
|
dataProvider: string | null;
|
|
@@ -66,6 +63,10 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
66
63
|
hasAttribute(attributeName: string): boolean;
|
|
67
64
|
disconnectedCallback(): void;
|
|
68
65
|
getBoundingClientRect(): DOMRect;
|
|
66
|
+
onConnected(callback: (component: any) => void): void;
|
|
67
|
+
offConnected(callback: (component: any) => void): void;
|
|
68
|
+
onDisconnected(callback: (component: any) => void): void;
|
|
69
|
+
offDisconnected(callback: (component: any) => void): void;
|
|
69
70
|
};
|
|
70
71
|
} & T;
|
|
71
72
|
export default Form;
|
|
@@ -31,6 +31,10 @@ export interface SubscriberInterface<PropsType = CoreJSType> {
|
|
|
31
31
|
hasAttribute(attributeName: string): boolean;
|
|
32
32
|
disconnectedCallback(): void;
|
|
33
33
|
getBoundingClientRect(): DOMRect;
|
|
34
|
+
onConnected(callback: (component: any) => void): void;
|
|
35
|
+
offConnected(callback: (component: any) => void): void;
|
|
36
|
+
onDisconnected(callback: (component: any) => void): void;
|
|
37
|
+
offDisconnected(callback: (component: any) => void): void;
|
|
34
38
|
}
|
|
35
39
|
declare const Subscriber: <PropsType = CoreJSType, T extends Constructor<LitElement> = Constructor<LitElement>>(superClass: T, type?: PropsType | undefined) => Constructor<SubscriberInterface<PropsType>> & T;
|
|
36
40
|
export default Subscriber;
|
|
@@ -96,6 +96,26 @@ const Subscriber = (superClass, type) => {
|
|
|
96
96
|
};
|
|
97
97
|
args;
|
|
98
98
|
}
|
|
99
|
+
onConnected(callback) {
|
|
100
|
+
if (!this.connectedCallbackCalls)
|
|
101
|
+
this.connectedCallbackCalls = new Set();
|
|
102
|
+
this.connectedCallbackCalls.add(callback);
|
|
103
|
+
}
|
|
104
|
+
onDisconnected(callback) {
|
|
105
|
+
if (!this.disconnectedCallbackCalls)
|
|
106
|
+
this.disconnectedCallbackCalls = new Set();
|
|
107
|
+
this.disconnectedCallbackCalls.add(callback);
|
|
108
|
+
}
|
|
109
|
+
offConnected(callback) {
|
|
110
|
+
if (!this.connectedCallbackCalls)
|
|
111
|
+
this.connectedCallbackCalls = new Set();
|
|
112
|
+
this.connectedCallbackCalls.delete(callback);
|
|
113
|
+
}
|
|
114
|
+
offDisconnected(callback) {
|
|
115
|
+
if (!this.disconnectedCallbackCalls)
|
|
116
|
+
this.disconnectedCallbackCalls = new Set();
|
|
117
|
+
this.disconnectedCallbackCalls.delete(callback);
|
|
118
|
+
}
|
|
99
119
|
/**
|
|
100
120
|
* va de parent en parent pour trouver un attribut
|
|
101
121
|
* @param attributeName nom de l'attribut
|
|
@@ -141,6 +161,7 @@ const Subscriber = (superClass, type) => {
|
|
|
141
161
|
this.style.removeProperty("display");
|
|
142
162
|
}
|
|
143
163
|
connectedCallback() {
|
|
164
|
+
var _a;
|
|
144
165
|
SubscriberElement.instanceCounter++;
|
|
145
166
|
if (this.hasAttribute("lazyRendering")) {
|
|
146
167
|
const options = {
|
|
@@ -168,9 +189,11 @@ const Subscriber = (superClass, type) => {
|
|
|
168
189
|
this.addDebugger();
|
|
169
190
|
}
|
|
170
191
|
super.connectedCallback();
|
|
192
|
+
(_a = this.connectedCallbackCalls) === null || _a === void 0 ? void 0 : _a.forEach((cb) => cb(this));
|
|
171
193
|
}
|
|
172
194
|
disconnectedCallback() {
|
|
173
|
-
var _a;
|
|
195
|
+
var _a, _b;
|
|
196
|
+
(_a = this.disconnectedCallbackCalls) === null || _a === void 0 ? void 0 : _a.forEach((cb) => cb(this));
|
|
174
197
|
this.removeDebugger();
|
|
175
198
|
super.disconnectedCallback();
|
|
176
199
|
if (this.publisher) {
|
|
@@ -180,7 +203,7 @@ const Subscriber = (superClass, type) => {
|
|
|
180
203
|
if (this.wordingPublisher)
|
|
181
204
|
this.wordingPublisher.stopTemplateFilling(this);
|
|
182
205
|
if (this.onAssign)
|
|
183
|
-
(
|
|
206
|
+
(_b = this.publisher) === null || _b === void 0 ? void 0 : _b.offAssign(this.onAssign);
|
|
184
207
|
}
|
|
185
208
|
addDebugger() {
|
|
186
209
|
var _a;
|
|
@@ -278,7 +301,8 @@ const Subscriber = (superClass, type) => {
|
|
|
278
301
|
}
|
|
279
302
|
if (!hasWording)
|
|
280
303
|
return;
|
|
281
|
-
const publisher = PublisherManager.get("sonic-wording");
|
|
304
|
+
const publisher = PublisherManager.get("sonic-wording", { localStorageMode: "enabled" });
|
|
305
|
+
yield PublisherManager.getInstance().isLocalStrorageReady;
|
|
282
306
|
const wordingProvider = this.getAncestorAttributeValue("wordingProvider");
|
|
283
307
|
const api = new API(this.getApiConfiguration());
|
|
284
308
|
if (wordingProvider) {
|
|
@@ -296,7 +320,9 @@ const Subscriber = (superClass, type) => {
|
|
|
296
320
|
}
|
|
297
321
|
}
|
|
298
322
|
if (wordings.length > 0) {
|
|
299
|
-
const
|
|
323
|
+
const calledURL = wordingProvider + "?labels[]=" + wordings.join("&labels[]=");
|
|
324
|
+
// const result = (await api.post(wordingProvider, {labels: wordings})) as Record<string, string>;
|
|
325
|
+
const result = (yield api.get(calledURL));
|
|
300
326
|
for (const elt in result) {
|
|
301
327
|
publisher["wording_" + elt] = result[elt];
|
|
302
328
|
}
|
|
@@ -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;
|
|
@@ -16,7 +16,6 @@ export declare class PublisherProxy<T = any> {
|
|
|
16
16
|
static instancesCounter: number;
|
|
17
17
|
_proxies_: Map<string, PublisherProxy>;
|
|
18
18
|
_value_: T;
|
|
19
|
-
_key_: string;
|
|
20
19
|
_is_savable_: boolean;
|
|
21
20
|
_invalidateListeners_: Set<VoidFunction>;
|
|
22
21
|
_assignListeners_: Set<(value: T) => void>;
|
|
@@ -17,7 +17,6 @@ function isComplex(value) {
|
|
|
17
17
|
export class PublisherProxy {
|
|
18
18
|
constructor(target, parentProxPub) {
|
|
19
19
|
this._proxies_ = new Map();
|
|
20
|
-
this._key_ = "";
|
|
21
20
|
this._is_savable_ = false;
|
|
22
21
|
this._invalidateListeners_ = new Set();
|
|
23
22
|
this._assignListeners_ = new Set();
|
package/img/concorde-logo.svg
CHANGED
|
File without changes
|