@supersoniks/concorde 1.1.43 → 1.1.44
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/concorde-core.bundle.js +18 -18
- package/concorde-core.es.js +805 -739
- 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 +25 -13
- 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 +12 -3
- package/core/components/functional/queue/queue.js +28 -22
- 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 +10 -10
- 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 +10 -9
- package/core/components/functional/sdui/sdui.js +32 -33
- 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 +8 -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/ui/_css/size.d.ts +1 -1
- package/core/components/ui/button/button.d.ts +6 -4
- package/core/components/ui/button/button.js +2 -2
- 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/select/select.d.ts +5 -4
- package/core/components/ui/form/select/select.js +8 -8
- 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 +1 -1
- 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 +1 -1
- package/core/components/ui/pop/pop.js +13 -13
- 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 +1 -1
- 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 +19 -18
- 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 +16 -31
- package/core/utils/api.js +26 -22
- package/mixins.d.ts +25 -19
- package/package.json +9 -5
- package/core/components/ui/taxonomy/taxonomy.d.ts +0 -44
- package/core/components/ui/taxonomy/taxonomy.js +0 -115
package/core/_types/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface ConcordeWindow extends Window {
|
|
|
6
6
|
PasswordCredential: new (options: {
|
|
7
7
|
id: string;
|
|
8
8
|
password: string;
|
|
9
|
-
}) =>
|
|
9
|
+
}) => Credential;
|
|
10
10
|
grecaptcha: {
|
|
11
11
|
ready: (handler: () => void) => void;
|
|
12
12
|
execute: (key: string, options: {
|
|
@@ -17,10 +17,15 @@ export interface ConcordeWindow extends Window {
|
|
|
17
17
|
SonicToast: any;
|
|
18
18
|
[key: string]: any;
|
|
19
19
|
}
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export
|
|
20
|
+
export type MixinArgsType = any;
|
|
21
|
+
export type PrimitiveType = string | number | boolean | bigint | undefined | null | symbol;
|
|
22
|
+
export type PublisherInterface<T = PublisherContentType> = Publisher<T> & any;
|
|
23
|
+
export type CoreJSType = string | number | boolean | null | {
|
|
24
|
+
[property: string]: CoreJSType;
|
|
25
|
+
} | CoreJSType[];
|
|
26
|
+
export type TypeAndRecordOfType<U> = U & Record<string | number, U>;
|
|
27
|
+
export type PublisherContentType = CoreJSType & {
|
|
28
|
+
__value?: CoreJSType;
|
|
29
|
+
_key_?: number;
|
|
30
|
+
};
|
|
31
|
+
export type HTMLFormControl = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
package/core/_types/types.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { LitElement, nothing } from "lit";
|
|
2
|
-
|
|
2
|
+
type DateTimeFormatPartExtended = {
|
|
3
3
|
hidden?: boolean;
|
|
4
4
|
source?: string;
|
|
5
5
|
type: string;
|
|
6
6
|
value: string;
|
|
7
7
|
};
|
|
8
|
-
declare const SonicDate_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<
|
|
8
|
+
declare const SonicDate_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/TemplatesContainer").TemplatesContainerInterface) & typeof LitElement;
|
|
9
9
|
export declare class SonicDate extends SonicDate_base {
|
|
10
10
|
pageLanguage: string;
|
|
11
11
|
private duAu;
|
|
@@ -59,11 +59,11 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
|
|
|
59
59
|
* Retourne un tableau des différentes parties de la date en fonction des options données, de la date de début et de fin.
|
|
60
60
|
*/
|
|
61
61
|
getDatesParts(start_date, end_date, options) {
|
|
62
|
-
|
|
62
|
+
const start = this.startDateObject;
|
|
63
63
|
start.setTime(start_date * 1000);
|
|
64
64
|
let parts = [];
|
|
65
65
|
if (end_date > 0) {
|
|
66
|
-
|
|
66
|
+
const end = this.endDateObject;
|
|
67
67
|
end.setTime(end_date * 1000);
|
|
68
68
|
//
|
|
69
69
|
//on affiche pas l'heure si les dates sont les mêmes
|
|
@@ -72,7 +72,7 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
|
|
|
72
72
|
delete options.hour;
|
|
73
73
|
delete options.minute;
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
const format = new Intl.DateTimeFormat(this.language || this.pageLanguage, options);
|
|
76
76
|
parts = format.formatRangeToParts(start, end);
|
|
77
77
|
//En mode design on cache les ","
|
|
78
78
|
if (this.designMode) {
|
|
@@ -80,7 +80,7 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
|
|
|
80
80
|
}
|
|
81
81
|
//on affiche du au uniquement si on a deux dates différentes
|
|
82
82
|
if (!isSameDay) {
|
|
83
|
-
|
|
83
|
+
const to = parts.find((part) => part.type == "literal" && part.source == "shared" && part.value.trim().length > 0);
|
|
84
84
|
if (to) {
|
|
85
85
|
to.value = " " + this.duAu[1] + " ";
|
|
86
86
|
to.type = "to";
|
|
@@ -90,7 +90,7 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
|
-
|
|
93
|
+
const format = new Intl.DateTimeFormat(this.language || this.pageLanguage, options);
|
|
94
94
|
parts = format.formatToParts(start);
|
|
95
95
|
}
|
|
96
96
|
parts[0].value = Format.ucFirst(parts[0].value);
|
|
@@ -125,7 +125,7 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
|
|
|
125
125
|
/* *
|
|
126
126
|
* gestion des options d'affichage des dates
|
|
127
127
|
* */
|
|
128
|
-
|
|
128
|
+
const options = {
|
|
129
129
|
year: this.year,
|
|
130
130
|
month: this.month,
|
|
131
131
|
day: this.day,
|
|
@@ -143,12 +143,12 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
|
|
|
143
143
|
/**
|
|
144
144
|
* On récupère les différentes partie affichées en vu de l'injection dans le template
|
|
145
145
|
*/
|
|
146
|
-
|
|
146
|
+
const parts = this.getDatesParts(this.start_date, this.end_date, options);
|
|
147
147
|
return html `${parts.map((part) => {
|
|
148
|
-
|
|
148
|
+
const template = this.templateParts[part.type];
|
|
149
149
|
if (template) {
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
const clone = document.importNode(template.content, true);
|
|
151
|
+
const child = clone.children[0];
|
|
152
152
|
if (child.innerText.trim() == "")
|
|
153
153
|
child.innerText = part.value;
|
|
154
154
|
return clone;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
-
declare const SonicComponent_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<
|
|
2
|
+
declare const SonicComponent_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & typeof LitElement;
|
|
3
3
|
export declare class SonicComponent extends SonicComponent_base {
|
|
4
4
|
text: string;
|
|
5
5
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
import { LitElement } from "lit";
|
|
3
3
|
declare const Fetch_base: {
|
|
4
4
|
new (...args: any[]): {
|
|
5
|
-
api: import("../../../utils/api").default
|
|
6
|
-
key:
|
|
5
|
+
api: import("../../../utils/api").default | null;
|
|
6
|
+
key: string;
|
|
7
7
|
isFirstLoad: boolean;
|
|
8
8
|
isLoading: boolean;
|
|
9
9
|
iObserver: IntersectionObserver | null;
|
|
10
10
|
isDefaultLoaderEnabled: boolean;
|
|
11
11
|
isFetchEnabled: boolean;
|
|
12
12
|
_endPoint: string;
|
|
13
|
+
props: (import("../../../_types/types").PublisherContentType & import("../../../utils/api").ResultTypeInterface) | null;
|
|
13
14
|
endPoint: string;
|
|
14
15
|
requestId: number;
|
|
15
16
|
refetchEveryMs: number;
|
|
@@ -20,9 +21,10 @@ declare const Fetch_base: {
|
|
|
20
21
|
connectedCallback(): void;
|
|
21
22
|
firstUpdated(): void;
|
|
22
23
|
onIntersection(entries: IntersectionObserverEntry[]): void;
|
|
23
|
-
|
|
24
|
-
propertyMap: Object;
|
|
24
|
+
propertyMap: object;
|
|
25
25
|
isConnected: boolean;
|
|
26
|
+
children: HTMLCollection;
|
|
27
|
+
appendChild(node: Node): Node;
|
|
26
28
|
getAncestorAttributeValue(attributeName: string): string;
|
|
27
29
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
28
30
|
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
@@ -42,9 +44,9 @@ declare const Fetch_base: {
|
|
|
42
44
|
getApiConfiguration(): import("../../../utils/api").APIConfiguration;
|
|
43
45
|
requestUpdate(): void;
|
|
44
46
|
getAttribute(name: string): string;
|
|
45
|
-
hasAttribute(attributeName:
|
|
47
|
+
hasAttribute(attributeName: string): boolean;
|
|
46
48
|
};
|
|
47
|
-
} & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<
|
|
49
|
+
} & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & typeof LitElement;
|
|
48
50
|
/**
|
|
49
51
|
* ###Fetch charge un contenu via un appel d'api web.
|
|
50
52
|
* Extends mixins : Fetcher, [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
|
|
@@ -7,14 +7,15 @@ import { TemplateContentDirective } from "lit/directives/template-content.js";
|
|
|
7
7
|
import { TemplateResult } from "lit";
|
|
8
8
|
declare const List_base: {
|
|
9
9
|
new (...args: any[]): {
|
|
10
|
-
api: import("../../../utils/api").default
|
|
11
|
-
key:
|
|
10
|
+
api: import("../../../utils/api").default | null;
|
|
11
|
+
key: string;
|
|
12
12
|
isFirstLoad: boolean;
|
|
13
13
|
isLoading: boolean;
|
|
14
14
|
iObserver: IntersectionObserver | null;
|
|
15
15
|
isDefaultLoaderEnabled: boolean;
|
|
16
16
|
isFetchEnabled: boolean;
|
|
17
17
|
_endPoint: string;
|
|
18
|
+
props: (import("../../../_types/types").PublisherContentType & import("../../../utils/api").ResultTypeInterface) | null;
|
|
18
19
|
endPoint: string;
|
|
19
20
|
requestId: number;
|
|
20
21
|
refetchEveryMs: number;
|
|
@@ -25,9 +26,10 @@ declare const List_base: {
|
|
|
25
26
|
connectedCallback(): void;
|
|
26
27
|
firstUpdated(): void;
|
|
27
28
|
onIntersection(entries: IntersectionObserverEntry[]): void;
|
|
28
|
-
|
|
29
|
-
propertyMap: Object;
|
|
29
|
+
propertyMap: object;
|
|
30
30
|
isConnected: boolean;
|
|
31
|
+
children: HTMLCollection;
|
|
32
|
+
appendChild(node: Node): Node;
|
|
31
33
|
getAncestorAttributeValue(attributeName: string): string;
|
|
32
34
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
33
35
|
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
@@ -47,9 +49,9 @@ declare const List_base: {
|
|
|
47
49
|
getApiConfiguration(): import("../../../utils/api").APIConfiguration;
|
|
48
50
|
requestUpdate(): void;
|
|
49
51
|
getAttribute(name: string): string;
|
|
50
|
-
hasAttribute(attributeName:
|
|
52
|
+
hasAttribute(attributeName: string): boolean;
|
|
51
53
|
};
|
|
52
|
-
} & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<
|
|
54
|
+
} & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/TemplatesContainer").TemplatesContainerInterface) & typeof LitElement;
|
|
53
55
|
/**
|
|
54
56
|
* ### List boucle sur sa propriété "props" et crée des éléments a partir des données en bouclant également sur ses templates.
|
|
55
57
|
*
|
|
@@ -68,7 +70,7 @@ declare const List_base: {
|
|
|
68
70
|
* *
|
|
69
71
|
*/
|
|
70
72
|
export declare class List extends List_base {
|
|
71
|
-
itemPropertyMap?:
|
|
73
|
+
itemPropertyMap?: object;
|
|
72
74
|
/**
|
|
73
75
|
* La propriété templateKey contient le nom de la propriété qui sera utilisé pour identifier le template à utiliser dans la donnée de la ligne.
|
|
74
76
|
* Par exemple si templateIdentifier = "name" et que la donnée de la ligne est {name: "myTemplate" ... }, alors le template possédant l'attribut data-value="myTemplate" sera utilisé.
|
|
@@ -81,7 +83,13 @@ export declare class List extends List_base {
|
|
|
81
83
|
connectedCallback(): void;
|
|
82
84
|
renderLoadingState(): DirectiveResult<typeof TemplateContentDirective> | TemplateResult;
|
|
83
85
|
renderNoResultState(): TemplateResult<1>;
|
|
84
|
-
formatProps():
|
|
86
|
+
formatProps(): (import("../../../_types/types").CoreJSType[] & {
|
|
87
|
+
__value?: import("../../../_types/types").CoreJSType | undefined;
|
|
88
|
+
_key_?: number | undefined;
|
|
89
|
+
} & {
|
|
90
|
+
_sonic_http_response_?: Response | undefined;
|
|
91
|
+
text?: string | undefined;
|
|
92
|
+
}) | null;
|
|
85
93
|
render(): DirectiveResult<typeof TemplateContentDirective>;
|
|
86
94
|
}
|
|
87
95
|
export {};
|
|
@@ -74,8 +74,11 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
74
74
|
}
|
|
75
75
|
formatProps() {
|
|
76
76
|
let props = this.props;
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
if (props == null) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const response = props._sonic_http_response_;
|
|
81
|
+
const extractValues = this.hasAttribute("extractValues");
|
|
79
82
|
//si props n'est pas un tableau on l'adapte
|
|
80
83
|
if (!Array.isArray(props)) {
|
|
81
84
|
if (extractValues) {
|
|
@@ -116,11 +119,11 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
116
119
|
/**
|
|
117
120
|
* On format les props pour les rendre compatibles avec le fonctionnement du rendu en fonction du paramétrage du composant (cf : "extractValues" )
|
|
118
121
|
*/
|
|
119
|
-
|
|
122
|
+
const props = this.formatProps();
|
|
120
123
|
/**
|
|
121
124
|
* On peut définir un template spécifique si le résultat est un tableau vide
|
|
122
125
|
*/
|
|
123
|
-
if (props.length == 0 && this.templateParts["no-item"]) {
|
|
126
|
+
if (((props === null || props === void 0 ? void 0 : props.length) || 0) == 0 && this.templateParts["no-item"]) {
|
|
124
127
|
return templateContent(this.templateParts["no-item"]);
|
|
125
128
|
}
|
|
126
129
|
/**
|
|
@@ -130,19 +133,28 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
130
133
|
let counter = -1;
|
|
131
134
|
const extractValues = this.hasAttribute("extractValues");
|
|
132
135
|
const separator = this.templateParts["separator"];
|
|
133
|
-
const length = props.length;
|
|
136
|
+
const length = (props === null || props === void 0 ? void 0 : props.length) || 0;
|
|
134
137
|
return html `
|
|
135
|
-
${props.map((item, index) => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
${props === null || props === void 0 ? void 0 : props.map((item, index) => {
|
|
139
|
+
if (item == null)
|
|
140
|
+
return nothing;
|
|
141
|
+
if (typeof item != "object" || Array.isArray(item))
|
|
142
|
+
return nothing;
|
|
143
|
+
const templatePartName = item[this.templateKey];
|
|
144
|
+
let templatePart = null;
|
|
145
|
+
if (templatePartName && typeof templatePartName == "string") {
|
|
146
|
+
templatePart = this.templateParts[templatePartName];
|
|
147
|
+
}
|
|
148
|
+
const key = extractValues ? item === null || item === void 0 ? void 0 : item[this.idKey] : index;
|
|
139
149
|
if (key == "_sonic_http_response_")
|
|
140
150
|
return nothing;
|
|
141
|
-
|
|
151
|
+
if (typeof key != "string" && typeof key != "number")
|
|
152
|
+
return nothing;
|
|
153
|
+
const pub = this.publisher[key];
|
|
142
154
|
pub._key_ = key + "";
|
|
143
155
|
counter++;
|
|
144
156
|
const isNotLast = index < length - 1;
|
|
145
|
-
if (
|
|
157
|
+
if (templatePart)
|
|
146
158
|
counter = -1;
|
|
147
159
|
return (item &&
|
|
148
160
|
html `
|
|
@@ -154,8 +166,8 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
154
166
|
.propertyMap?=${this.itemPropertyMap}
|
|
155
167
|
dataProvider="${this.dataProvider}/list-item/${key}"
|
|
156
168
|
>
|
|
157
|
-
${
|
|
158
|
-
? templateContent(
|
|
169
|
+
${templatePart
|
|
170
|
+
? templateContent(templatePart)
|
|
159
171
|
: templateContent(this.templateList[counter % templateCount])}
|
|
160
172
|
</sonic-subscriber>
|
|
161
173
|
${separator && isNotLast ? templateContent(separator) : nothing}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import { PublisherInterface, PublisherContentType } from "@supersoniks/concorde/core/_types/types";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type Composition = Record<string, object | string>;
|
|
4
|
+
type Listener = {
|
|
5
5
|
publisher: PublisherInterface;
|
|
6
6
|
subscriber: <T>(v: T) => void;
|
|
7
7
|
};
|
|
8
|
-
declare const SonicMix_base: (new (...args: any[]) => import("../../../mixins/Subscriber").SubscriberInterface<
|
|
8
|
+
declare const SonicMix_base: (new (...args: any[]) => import("../../../mixins/Subscriber").SubscriberInterface<import("@supersoniks/concorde/core/_types/types").CoreJSType>) & typeof LitElement;
|
|
9
9
|
export default class SonicMix extends SonicMix_base {
|
|
10
|
+
static styles: import("lit").CSSResult[];
|
|
10
11
|
private _composition;
|
|
11
12
|
get composition(): Composition;
|
|
12
|
-
static styles: import("lit").CSSResult[];
|
|
13
13
|
set composition(value: Composition);
|
|
14
14
|
connectedCallback(): void;
|
|
15
15
|
disconnectedCallback(): void;
|
|
16
16
|
updateComposition(): void;
|
|
17
17
|
listeners: Listener[];
|
|
18
18
|
removePublisherListeners(): void;
|
|
19
|
-
parseComposition<T extends PublisherContentType =
|
|
19
|
+
parseComposition<T extends PublisherContentType = PublisherContentType>(composition: Composition, publisher: PublisherInterface<T>): void;
|
|
20
20
|
render(): import("lit-html").TemplateResult<1>;
|
|
21
21
|
}
|
|
22
22
|
export {};
|
|
@@ -38,7 +38,7 @@ let SonicMix = class SonicMix extends Subscriber(LitElement) {
|
|
|
38
38
|
this.parseComposition(this.composition, this.publisher);
|
|
39
39
|
}
|
|
40
40
|
removePublisherListeners() {
|
|
41
|
-
|
|
41
|
+
const listeners = this.listeners;
|
|
42
42
|
this.listeners = [];
|
|
43
43
|
listeners.forEach((listener) => {
|
|
44
44
|
this.publisher.offAssign(listener.subscriber);
|
|
@@ -47,13 +47,16 @@ let SonicMix = class SonicMix extends Subscriber(LitElement) {
|
|
|
47
47
|
parseComposition(composition, publisher) {
|
|
48
48
|
if (!composition)
|
|
49
49
|
return;
|
|
50
|
-
for (
|
|
51
|
-
|
|
50
|
+
for (const z in composition) {
|
|
51
|
+
const value = composition[z];
|
|
52
52
|
if (typeof value === "string") {
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const split = value.split(".");
|
|
54
|
+
const first = split.shift();
|
|
55
|
+
if (!first)
|
|
56
|
+
continue;
|
|
57
|
+
let publisherSource = PublisherManager.get(first);
|
|
55
58
|
publisherSource = Objects.traverse(publisherSource, split);
|
|
56
|
-
|
|
59
|
+
const publisherSubscriber = {
|
|
57
60
|
publisher: publisherSource,
|
|
58
61
|
subscriber: (v) => {
|
|
59
62
|
publisher[z] = v;
|
|
@@ -65,9 +68,9 @@ let SonicMix = class SonicMix extends Subscriber(LitElement) {
|
|
|
65
68
|
}
|
|
66
69
|
else {
|
|
67
70
|
this.publisher[z] = {};
|
|
68
|
-
|
|
71
|
+
const newPublisher = new PublisherProxy({}, publisher);
|
|
69
72
|
publisher._proxies_.set(z, newPublisher);
|
|
70
|
-
|
|
73
|
+
const publisherSubscriber = {
|
|
71
74
|
publisher: newPublisher,
|
|
72
75
|
subscriber: (v) => {
|
|
73
76
|
publisher[z] = v;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { LitElement, nothing } from "lit";
|
|
2
2
|
import "@supersoniks/concorde/core/components/functional/list/list";
|
|
3
3
|
import { PublisherProxy } from "@supersoniks/concorde/core/utils/PublisherProxy";
|
|
4
|
-
|
|
4
|
+
type QueueItem = {
|
|
5
|
+
id: string;
|
|
6
|
+
dataProvider: string;
|
|
7
|
+
offset: number;
|
|
8
|
+
limit: number;
|
|
9
|
+
};
|
|
10
|
+
type QueueProps = QueueItem[] & {
|
|
11
|
+
resultCount?: number;
|
|
12
|
+
};
|
|
13
|
+
declare const Queue_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<QueueProps>) & typeof LitElement;
|
|
5
14
|
/**
|
|
6
15
|
*### Une Queue charge du contenu par lot selon l'expression renseignée dans l'attribut *dataProviderExpression*.
|
|
7
16
|
* * Chaque lot est chargé par un composant [List](./?path=/docs/core-components-functional-list-list--basic) dont le dataProvider créé à partir de l'attribut dataProviderExpression
|
|
@@ -13,8 +22,8 @@ declare const Queue_base: (new (...args: any[]) => import("@supersoniks/concorde
|
|
|
13
22
|
export default class Queue extends Queue_base {
|
|
14
23
|
templates: Array<HTMLTemplateElement> | null;
|
|
15
24
|
lastRequestTime: number;
|
|
16
|
-
key:
|
|
17
|
-
itemPropertyMap:
|
|
25
|
+
key: string;
|
|
26
|
+
itemPropertyMap: object | null;
|
|
18
27
|
/**
|
|
19
28
|
* Durée cible en ms d'une requête pour afficher 1 lot.
|
|
20
29
|
*/
|
|
@@ -21,7 +21,7 @@ const tagName = "sonic-queue";
|
|
|
21
21
|
* Les valeurs renseignées dans ce publisher sont ajoutées en get à chaque requête
|
|
22
22
|
* * la proriété *key* peut être utilisé pour cibler une propriété particulière du retour de l'api.
|
|
23
23
|
*/
|
|
24
|
-
let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
24
|
+
let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
|
|
25
25
|
constructor() {
|
|
26
26
|
super(...arguments);
|
|
27
27
|
this.templates = null;
|
|
@@ -56,7 +56,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
56
56
|
this.nextHadEvent = false;
|
|
57
57
|
}
|
|
58
58
|
disconnectedCallback() {
|
|
59
|
-
for (
|
|
59
|
+
for (const dataProvider of this.listDataProviders) {
|
|
60
60
|
PublisherManager.delete(dataProvider);
|
|
61
61
|
}
|
|
62
62
|
super.disconnectedCallback();
|
|
@@ -77,11 +77,12 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
77
77
|
if (!this.templates)
|
|
78
78
|
this.templates = Array.from(this.querySelectorAll("template"));
|
|
79
79
|
this.lastRequestTime = new Date().getTime();
|
|
80
|
-
|
|
80
|
+
let func = window.requestAnimationFrame;
|
|
81
|
+
func(() => this.next());
|
|
81
82
|
}
|
|
82
83
|
configFilter() {
|
|
83
84
|
var _a;
|
|
84
|
-
|
|
85
|
+
const dataFilterProvider = this.getAncestorAttributeValue("dataFilterProvider");
|
|
85
86
|
if (!dataFilterProvider)
|
|
86
87
|
return;
|
|
87
88
|
this.filterPublisher = PublisherManager.getInstance().get(dataFilterProvider);
|
|
@@ -97,31 +98,34 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
97
98
|
/**
|
|
98
99
|
* On ne lance la recherche que si le hash de recherche est différent
|
|
99
100
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
const dataProvider = this.dataProviderExpression;
|
|
102
|
+
const split = dataProvider.split("?");
|
|
102
103
|
split.shift();
|
|
103
104
|
let searchParams = new URLSearchParams(split.join("?"));
|
|
104
105
|
let filterData = (_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.get();
|
|
105
106
|
let filteredFieldsArray = this.filteredFields.split(" ");
|
|
106
107
|
for (let f in filterData) {
|
|
107
|
-
|
|
108
|
+
let value = filterData[f];
|
|
109
|
+
if (Array.isArray(value))
|
|
110
|
+
value = value.filter((v) => v !== null);
|
|
111
|
+
if ((this.filteredFields && !filteredFieldsArray.includes(f)) || value == null || value.toString() === "")
|
|
108
112
|
continue;
|
|
109
|
-
searchParams.set(f, filterData[f]);
|
|
113
|
+
searchParams.set(f, filterData[f].toString());
|
|
110
114
|
}
|
|
111
|
-
|
|
115
|
+
const searchHash = searchParams.toString();
|
|
112
116
|
if (searchHash == this.searchHash)
|
|
113
117
|
return;
|
|
114
118
|
this.searchHash = searchHash;
|
|
115
119
|
/**
|
|
116
120
|
* on reset les données avant de lancer la requète
|
|
117
121
|
*/
|
|
118
|
-
for (
|
|
122
|
+
for (const dataProvider of this.listDataProviders) {
|
|
119
123
|
PublisherManager.delete(dataProvider);
|
|
120
124
|
}
|
|
121
125
|
this.listDataProviders = [];
|
|
122
126
|
clearTimeout(this.filterTimeoutId);
|
|
123
127
|
this.filterTimeoutId = setTimeout(() => {
|
|
124
|
-
|
|
128
|
+
const count = this.resultCount;
|
|
125
129
|
this.props = null;
|
|
126
130
|
//On garde le décompte au cas ou il n'y aurait pas rechargement
|
|
127
131
|
this.resultCount = count;
|
|
@@ -155,7 +159,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
155
159
|
}
|
|
156
160
|
}
|
|
157
161
|
if (!Array.isArray(this.props)) {
|
|
158
|
-
|
|
162
|
+
const newProps = [];
|
|
159
163
|
newProps.resultCount = this.resultCount;
|
|
160
164
|
this.props = newProps;
|
|
161
165
|
}
|
|
@@ -171,20 +175,22 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
171
175
|
if (this.limit > 15)
|
|
172
176
|
this.limit = 15;
|
|
173
177
|
let dataProvider = this.dataProviderExpression.replace("$offset", offset + "").replace("$limit", this.limit + "");
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
for (
|
|
178
|
+
const split = dataProvider.split("?");
|
|
179
|
+
const endpoint = split.shift();
|
|
180
|
+
const searchParams = new URLSearchParams(split.join("?"));
|
|
181
|
+
const filterData = (_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.get();
|
|
182
|
+
const filteredFieldsArray = this.filteredFields.split(" ");
|
|
183
|
+
for (const f in filterData) {
|
|
180
184
|
if ((this.filteredFields && !filteredFieldsArray.includes(f)) || filterData[f] == null)
|
|
181
185
|
continue;
|
|
182
186
|
searchParams.set(f, filterData[f]);
|
|
183
187
|
}
|
|
188
|
+
if (!this.searchHash)
|
|
189
|
+
this.searchHash = searchParams.toString();
|
|
184
190
|
dataProvider = endpoint + "?" + searchParams.toString();
|
|
185
191
|
this.listDataProviders.push(dataProvider);
|
|
186
192
|
this.currentScrollPosition = (_b = document.scrollingElement) === null || _b === void 0 ? void 0 : _b.scrollTop;
|
|
187
|
-
|
|
193
|
+
const newProps = [
|
|
188
194
|
...this.props,
|
|
189
195
|
{
|
|
190
196
|
id: searchParams.toString() + "/" + this.props.length,
|
|
@@ -200,7 +206,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
200
206
|
render() {
|
|
201
207
|
if (this.currentScrollPosition) {
|
|
202
208
|
window.requestAnimationFrame(() => {
|
|
203
|
-
if (document.scrollingElement)
|
|
209
|
+
if (document.scrollingElement && this.currentScrollPosition != undefined)
|
|
204
210
|
document.scrollingElement.scrollTop = this.currentScrollPosition;
|
|
205
211
|
this.currentScrollPosition = undefined;
|
|
206
212
|
});
|
|
@@ -210,14 +216,14 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
210
216
|
return html `
|
|
211
217
|
${repeat(this.props, (item) => item.id, (item, index) => {
|
|
212
218
|
var _a;
|
|
213
|
-
|
|
219
|
+
const templates = index == 0 ? this.templates : (_a = this.templates) === null || _a === void 0 ? void 0 : _a.filter((elt) => elt.getAttribute("data-value") != "no-item");
|
|
214
220
|
return html `
|
|
215
221
|
<sonic-list
|
|
216
222
|
fetch
|
|
217
223
|
displayContents
|
|
218
224
|
lazyload
|
|
219
225
|
requestId=${this.requestId}
|
|
220
|
-
|
|
226
|
+
.itemPropertyMap=${this.itemPropertyMap}
|
|
221
227
|
?debug=${this.defferedDebug === true}
|
|
222
228
|
@load=${this.next}
|
|
223
229
|
key=${this.key}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
-
declare const SonicRedirect_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<
|
|
2
|
+
declare const SonicRedirect_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & typeof LitElement;
|
|
3
3
|
/**
|
|
4
4
|
* sonic-redirect permet d'effectuer une redirection.
|
|
5
5
|
* * L'URL de redirection fournie dans l'attribut *to*.
|
|
@@ -10,7 +10,7 @@ declare const SonicRedirect_base: (new (...args: any[]) => import("@supersoniks/
|
|
|
10
10
|
* * Si l'attribut pushState est défini, alors la redirection est effectuée via pushState, sinon c'est document.location qui est modifié.
|
|
11
11
|
*/
|
|
12
12
|
export declare class SonicRedirect extends SonicRedirect_base {
|
|
13
|
-
udpateCallBack
|
|
13
|
+
udpateCallBack?: VoidFunction;
|
|
14
14
|
connectedCallback(): void;
|
|
15
15
|
disconnectedCallback(): void;
|
|
16
16
|
update(): void;
|
|
@@ -20,10 +20,6 @@ const tagName = "sonic-redirect";
|
|
|
20
20
|
* * Si l'attribut pushState est défini, alors la redirection est effectuée via pushState, sinon c'est document.location qui est modifié.
|
|
21
21
|
*/
|
|
22
22
|
let SonicRedirect = class SonicRedirect extends Subscriber(LitElement) {
|
|
23
|
-
constructor() {
|
|
24
|
-
super(...arguments);
|
|
25
|
-
this.udpateCallBack = () => { };
|
|
26
|
-
}
|
|
27
23
|
connectedCallback() {
|
|
28
24
|
this.noShadowDom = "";
|
|
29
25
|
this.style.display = "none";
|
|
@@ -44,8 +40,8 @@ let SonicRedirect = class SonicRedirect extends Subscriber(LitElement) {
|
|
|
44
40
|
}
|
|
45
41
|
if (!this.props)
|
|
46
42
|
return;
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
const onDataPath = this.getAttribute("onData").split(".");
|
|
44
|
+
const searchedData = Objects.traverse(this.props, onDataPath);
|
|
49
45
|
if (searchedData && !(Objects.isObject(searchedData) && searchedData)) {
|
|
50
46
|
LocationHandler.changeFromComponent(this);
|
|
51
47
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
-
declare const SonicRouter_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<
|
|
2
|
+
declare const SonicRouter_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/TemplatesContainer").TemplatesContainerInterface) & typeof LitElement;
|
|
3
3
|
/**
|
|
4
4
|
* ### Le router observe les modification document.location et met à jour sa vu de la manière suivante :
|
|
5
5
|
* * Il boucle sur ses template enfants et test si la regexp contenue dans l'attribut *data-route* match document.location
|
|
@@ -50,11 +50,11 @@ let SonicRouter = class SonicRouter extends Subscriber(TemplatesContainer(LitEle
|
|
|
50
50
|
return this._location;
|
|
51
51
|
}
|
|
52
52
|
render() {
|
|
53
|
-
|
|
54
|
-
for (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
const templates = [];
|
|
54
|
+
for (const t of this.templatePartsList) {
|
|
55
|
+
const path = t.getAttribute(this.templateValueAttribute) || "";
|
|
56
|
+
const regexp = new RegExp(path);
|
|
57
|
+
const urlPattern = new UrlPattern(path);
|
|
58
58
|
if (regexp.test(this.location)) {
|
|
59
59
|
templates.push(t);
|
|
60
60
|
}
|
|
@@ -72,17 +72,17 @@ let SonicRouter = class SonicRouter extends Subscriber(TemplatesContainer(LitEle
|
|
|
72
72
|
document.title = template.title;
|
|
73
73
|
if (template.hasAttribute("dataProviderExpression")) {
|
|
74
74
|
let dataProvider = "";
|
|
75
|
-
|
|
75
|
+
const dataProviderExpression = template.getAttribute("dataProviderExpression") || "";
|
|
76
76
|
if (template.getAttribute("mode") == "patternMatching") {
|
|
77
|
-
const matcher = new UrlPattern(template.getAttribute(this.templateValueAttribute));
|
|
77
|
+
const matcher = new UrlPattern(template.getAttribute(this.templateValueAttribute) || "");
|
|
78
78
|
const filler = new UrlPattern(dataProviderExpression);
|
|
79
79
|
dataProvider = filler.stringify(matcher.match(this.location));
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
|
-
const regexp = new RegExp(template.getAttribute(this.templateValueAttribute));
|
|
83
|
-
|
|
82
|
+
const regexp = new RegExp(template.getAttribute(this.templateValueAttribute) || "");
|
|
83
|
+
const match = (this.location + "").match(regexp);
|
|
84
84
|
if (match) {
|
|
85
|
-
dataProvider = (_a = match.shift()) === null || _a === void 0 ? void 0 : _a.replace(regexp, dataProviderExpression);
|
|
85
|
+
dataProvider = ((_a = match.shift()) === null || _a === void 0 ? void 0 : _a.replace(regexp, dataProviderExpression)) || "";
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
return html `<div style="display:contents" dataProvider="${dataProvider}">${templateContent(template)}</div>`;
|