@supersoniks/concorde 1.1.42 → 1.1.43
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/components.js +2 -3
- package/concorde-core.bundle.js +37 -35
- package/concorde-core.es.js +5081 -4317
- package/core/_types/types.d.ts +26 -0
- package/core/_types/types.js +1 -0
- package/core/components/functional/date/date.d.ts +13 -5
- package/core/components/functional/date/date.js +48 -29
- package/core/components/functional/example/example.d.ts +1 -1
- package/core/components/functional/example/example.js +1 -1
- package/core/components/functional/fetch/fetch.d.ts +40 -3
- package/core/components/functional/fetch/fetch.js +2 -6
- package/core/components/functional/functional.d.ts +2 -0
- package/core/components/functional/functional.js +2 -0
- package/core/components/functional/if/if.d.ts +3 -0
- package/core/components/functional/if/if.js +6 -12
- package/core/components/functional/if/if.test.d.ts +1 -0
- package/core/components/functional/if/if.test.js +44 -0
- package/core/components/functional/list/list.d.ts +32 -8
- package/core/components/functional/list/list.js +33 -40
- package/core/components/functional/mix/mix.d.ts +22 -0
- package/core/components/functional/mix/mix.js +99 -0
- package/core/components/functional/queue/queue.d.ts +16 -3
- package/core/components/functional/queue/queue.js +71 -15
- package/core/components/functional/router/redirect.d.ts +10 -1
- package/core/components/functional/router/redirect.js +5 -6
- package/core/components/functional/router/router.d.ts +15 -1
- package/core/components/functional/router/router.js +1 -6
- package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +1 -1
- package/core/components/functional/sdui/SDUIDescriptorTransformer.js +24 -12
- package/core/components/functional/sdui/default-library.json +108 -0
- package/core/components/functional/sdui/sdui-utils.d.ts +5 -0
- package/core/components/functional/sdui/sdui-utils.js +63 -0
- package/core/components/functional/sdui/sdui.d.ts +16 -9
- package/core/components/functional/sdui/sdui.js +52 -25
- package/core/components/functional/sdui/types.d.ts +4 -2
- package/core/components/functional/states/states.d.ts +19 -3
- package/core/components/functional/states/states.js +7 -12
- package/core/components/functional/submit/submit.d.ts +16 -1
- package/core/components/functional/submit/submit.js +87 -17
- package/core/components/functional/subscriber/subscriber.d.ts +4 -1
- package/core/components/functional/subscriber/subscriber.js +1 -6
- package/core/components/functional/value/value.d.ts +7 -0
- package/core/components/functional/value/value.js +26 -0
- package/core/components/ui/_css/scroll.js +6 -7
- package/core/components/ui/_css/size.d.ts +1 -0
- package/core/components/ui/_css/size.js +3 -1
- package/core/components/ui/alert/alert.d.ts +2 -2
- package/core/components/ui/alert/alert.js +11 -16
- package/core/components/ui/badge/badge.d.ts +3 -1
- package/core/components/ui/badge/badge.js +36 -22
- package/core/components/ui/button/button.d.ts +23 -20
- package/core/components/ui/button/button.js +59 -42
- package/core/components/ui/captcha/captcha.d.ts +14 -2
- package/core/components/ui/captcha/captcha.js +17 -12
- package/core/components/ui/card/card-footer.js +1 -8
- package/core/components/ui/card/card-header-descripton.js +3 -9
- package/core/components/ui/card/card-header.js +1 -6
- package/core/components/ui/card/card-main.js +0 -5
- package/core/components/ui/card/card.d.ts +1 -1
- package/core/components/ui/card/card.js +28 -12
- package/core/components/ui/divider/divider.d.ts +2 -0
- package/core/components/ui/divider/divider.js +43 -16
- package/core/components/ui/form/checkbox/checkbox.d.ts +53 -16
- package/core/components/ui/form/checkbox/checkbox.js +53 -28
- package/core/components/ui/form/css/form-control.d.ts +2 -0
- package/core/components/ui/form/css/form-control.js +145 -67
- package/core/components/ui/form/fieldset/fieldset.d.ts +8 -1
- package/core/components/ui/form/fieldset/fieldset.js +45 -8
- package/core/components/ui/form/fieldset/legend-description.js +0 -5
- package/core/components/ui/form/fieldset/legend.js +3 -6
- package/core/components/ui/form/form-actions/form-actions.d.ts +2 -0
- package/core/components/ui/form/form-actions/form-actions.js +26 -11
- package/core/components/ui/form/form-layout/form-layout.d.ts +5 -2
- package/core/components/ui/form/form-layout/form-layout.js +31 -9
- package/core/components/ui/form/input/input.d.ts +15 -18
- package/core/components/ui/form/input/input.js +87 -52
- package/core/components/ui/form/input/password-helper.d.ts +1 -1
- package/core/components/ui/form/input/password-helper.js +3 -2
- package/core/components/ui/form/input/same-value-helper.d.ts +1 -1
- package/core/components/ui/form/input/same-value-helper.js +1 -0
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +2 -3
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +2 -6
- package/core/components/ui/form/radio/radio.d.ts +6 -0
- package/core/components/ui/form/radio/radio.js +7 -12
- package/core/components/ui/form/select/select.d.ts +23 -7
- package/core/components/ui/form/select/select.js +69 -38
- package/core/components/ui/form/textarea/textarea.d.ts +13 -13
- package/core/components/ui/form/textarea/textarea.js +29 -36
- package/core/components/ui/group/group.d.ts +11 -1
- package/core/components/ui/group/group.js +79 -17
- package/core/components/ui/icon/icon.d.ts +10 -3
- package/core/components/ui/icon/icon.js +16 -15
- package/core/components/ui/icon/icons.js +11 -8
- package/core/components/ui/icon/icons.json +1 -1
- package/core/components/ui/image/image.js +0 -5
- package/core/components/ui/link/link.d.ts +1 -1
- package/core/components/ui/link/link.js +2 -6
- package/core/components/ui/loader/loader.js +2 -8
- package/core/components/ui/menu/menu-item.js +4 -9
- package/core/components/ui/menu/menu.d.ts +9 -1
- package/core/components/ui/menu/menu.js +183 -27
- package/core/components/ui/modal/modal-actions.js +1 -6
- package/core/components/ui/modal/modal-close.d.ts +1 -0
- package/core/components/ui/modal/modal-close.js +14 -10
- package/core/components/ui/modal/modal-content.js +0 -5
- package/core/components/ui/modal/modal-subtitle.js +2 -6
- package/core/components/ui/modal/modal-title.js +0 -5
- package/core/components/ui/modal/modal.d.ts +7 -7
- package/core/components/ui/modal/modal.js +36 -36
- package/core/components/ui/pop/pop.d.ts +6 -5
- package/core/components/ui/pop/pop.js +44 -44
- package/core/components/ui/progress/progress.js +34 -32
- package/core/components/ui/table/table-caption.js +5 -10
- package/core/components/ui/table/table-tbody.js +10 -14
- package/core/components/ui/table/table-td.d.ts +2 -0
- package/core/components/ui/table/table-td.js +8 -5
- package/core/components/ui/table/table-tfoot.js +5 -7
- package/core/components/ui/table/table-th.d.ts +2 -0
- package/core/components/ui/table/table-th.js +12 -9
- package/core/components/ui/table/table-thead.js +1 -6
- package/core/components/ui/table/table-tr.js +4 -6
- package/core/components/ui/table/table.d.ts +0 -3
- package/core/components/ui/table/table.js +14 -31
- package/core/components/ui/taxonomy/taxonomy.d.ts +6 -3
- package/core/components/ui/taxonomy/taxonomy.js +9 -9
- package/core/components/ui/theme/theme-collection/core-variables.js +13 -11
- package/core/components/ui/theme/theme-collection/dark.js +1 -1
- package/core/components/ui/theme/theme.d.ts +1 -6
- package/core/components/ui/theme/theme.js +7 -36
- package/core/components/ui/toast/message-subscriber.d.ts +13 -7
- package/core/components/ui/toast/toast-item.js +1 -1
- package/core/components/ui/toast/toast.d.ts +2 -1
- package/core/components/ui/toast/toast.js +29 -14
- package/core/components/ui/tooltip/tooltip.d.ts +1 -0
- package/core/components/ui/tooltip/tooltip.js +35 -14
- package/core/components/ui/ui.js +0 -3
- package/core/core.js +5 -6
- package/core/mixins/Fetcher.d.ts +19 -10
- package/core/mixins/Fetcher.js +26 -10
- package/core/mixins/FormCheckable.d.ts +17 -8
- package/core/mixins/FormCheckable.js +177 -22
- package/core/mixins/FormElement.d.ts +12 -7
- package/core/mixins/FormElement.js +42 -26
- package/core/mixins/FormInput.d.ts +8 -4
- package/core/mixins/FormInput.js +4 -3
- package/core/mixins/Subscriber.d.ts +7 -5
- package/core/mixins/Subscriber.js +34 -32
- package/core/utils/Arrays.d.ts +15 -15
- package/core/utils/DataBindObserver.d.ts +16 -9
- package/core/utils/DataBindObserver.js +23 -28
- package/core/utils/Electron.d.ts +5 -1
- package/core/utils/Electron.js +4 -2
- package/core/utils/HTML.d.ts +9 -2
- package/core/utils/HTML.js +22 -3
- package/core/utils/LocationHandler.d.ts +6 -5
- package/core/utils/LocationHandler.js +19 -8
- package/core/utils/Objects.d.ts +7 -4
- package/core/utils/Objects.js +28 -6
- package/core/utils/{PublisherProxy.d.mts → PublisherProxy.d.ts} +40 -31
- package/core/utils/{PublisherProxy.mjs → PublisherProxy.js} +54 -28
- package/core/utils/Utils.d.ts +3 -0
- package/core/utils/Utils.js +18 -0
- package/core/utils/api.d.ts +39 -7
- package/core/utils/api.js +45 -32
- package/img/concorde-logo.svg +1 -0
- package/img/concorde.png +0 -0
- package/img/concorde_def.png +0 -0
- package/mixins.d.ts +36 -18
- package/mixins.js +3 -4
- package/package.json +45 -10
- package/svg/regular/plane.svg +1 -0
- package/svg/solid/plane.svg +1 -0
- package/test-utils/TestUtils.d.ts +4 -0
- package/test-utils/TestUtils.js +12 -0
- package/utils.d.ts +3 -1
- package/utils.js +7 -5
- package/core/components/functional/configuration/configuration.d.ts +0 -5
- package/core/components/functional/configuration/configuration.js +0 -22
- package/core/components/ui/tabs/tab.d.ts +0 -6
- package/core/components/ui/tabs/tab.js +0 -46
- package/core/components/ui/tabs/tabs.d.ts +0 -15
- package/core/components/ui/tabs/tabs.js +0 -129
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import DataBindObserver from "@supersoniks/concorde/core/utils/DataBindObserver";
|
|
2
|
+
import Publisher from "../utils/PublisherProxy";
|
|
3
|
+
export interface ConcordeWindow extends Window {
|
|
4
|
+
SonicPublisherManager: any;
|
|
5
|
+
SonicDataBindObserver: DataBindObserver;
|
|
6
|
+
PasswordCredential: new (options: {
|
|
7
|
+
id: string;
|
|
8
|
+
password: string;
|
|
9
|
+
}) => any;
|
|
10
|
+
grecaptcha: {
|
|
11
|
+
ready: (handler: () => void) => void;
|
|
12
|
+
execute: (key: string, options: {
|
|
13
|
+
action: string;
|
|
14
|
+
}) => Promise<string>;
|
|
15
|
+
};
|
|
16
|
+
SonicModal: any;
|
|
17
|
+
SonicToast: any;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
export declare type CoreJSType = Object | string | number | boolean | BigInt | undefined | null | symbol;
|
|
21
|
+
export declare type PublisherContentType = CoreJSType & {
|
|
22
|
+
__value?: any;
|
|
23
|
+
} & Record<string, any>;
|
|
24
|
+
export declare type PublisherInterface<T extends PublisherContentType = any> = Publisher<T> & any;
|
|
25
|
+
export declare type TypeAndRecordOfType<U> = U & Record<string, U>;
|
|
26
|
+
export declare type HTMLFormControl = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { LitElement, nothing } from "lit";
|
|
2
|
-
declare
|
|
2
|
+
declare type DateTimeFormatPartExtended = {
|
|
3
|
+
hidden?: boolean;
|
|
4
|
+
source?: string;
|
|
5
|
+
type: string;
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
declare const SonicDate_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<any>) & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/TemplatesContainer").TemplatesContainerInterface) & typeof LitElement;
|
|
3
9
|
export declare class SonicDate extends SonicDate_base {
|
|
4
10
|
pageLanguage: string;
|
|
5
11
|
private duAu;
|
|
@@ -18,18 +24,20 @@ export declare class SonicDate extends SonicDate_base {
|
|
|
18
24
|
year: "numeric" | "2-digit";
|
|
19
25
|
month: "numeric" | "2-digit" | "narrow" | "short" | "long";
|
|
20
26
|
day: "numeric" | "2-digit";
|
|
21
|
-
weekday: "narrow" | "short" | "long";
|
|
22
|
-
hour: "numeric" | "2-digit" |
|
|
23
|
-
minute: "numeric" | "2-digit" |
|
|
27
|
+
weekday: "narrow" | "short" | "long" | "hidden";
|
|
28
|
+
hour: "numeric" | "2-digit" | "hidden";
|
|
29
|
+
minute: "numeric" | "2-digit" | "hidden";
|
|
24
30
|
language: string;
|
|
25
31
|
renderIf: boolean;
|
|
32
|
+
now: boolean;
|
|
26
33
|
private startDateObject;
|
|
27
34
|
private endDateObject;
|
|
28
35
|
connectedCallback(): void;
|
|
29
36
|
/**
|
|
30
37
|
* 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.
|
|
31
38
|
*/
|
|
32
|
-
getDatesParts(start_date: number, end_date: number, options:
|
|
39
|
+
getDatesParts(start_date: number, end_date: number, options: Intl.DateTimeFormatOptions): DateTimeFormatPartExtended[];
|
|
40
|
+
dateStringToSeconds(dateString: string): number;
|
|
33
41
|
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
34
42
|
}
|
|
35
43
|
export {};
|
|
@@ -4,12 +4,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html, LitElement, nothing } from "lit";
|
|
8
|
-
import { customElement, property } from "lit/decorators.js";
|
|
9
7
|
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
10
|
-
import HTML from "@supersoniks/concorde/core/utils/HTML";
|
|
11
|
-
import Format from "@supersoniks/concorde/core/utils/Format";
|
|
12
8
|
import TemplatesContainer from "@supersoniks/concorde/core/mixins/TemplatesContainer";
|
|
9
|
+
import Format from "@supersoniks/concorde/core/utils/Format";
|
|
10
|
+
import HTML from "@supersoniks/concorde/core/utils/HTML";
|
|
11
|
+
import { html, LitElement, nothing } from "lit";
|
|
12
|
+
import { customElement, property } from "lit/decorators.js";
|
|
13
13
|
const tagName = "sonic-date";
|
|
14
14
|
let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement)) {
|
|
15
15
|
constructor() {
|
|
@@ -23,7 +23,7 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
|
|
|
23
23
|
this.date_string = null;
|
|
24
24
|
this.start_date_string = null;
|
|
25
25
|
this.end_date_string = null;
|
|
26
|
-
this.start_date =
|
|
26
|
+
this.start_date = 0;
|
|
27
27
|
this.end_date = 0;
|
|
28
28
|
this.era = "";
|
|
29
29
|
this.year = "numeric";
|
|
@@ -34,6 +34,7 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
|
|
|
34
34
|
this.minute = "2-digit";
|
|
35
35
|
this.language = "";
|
|
36
36
|
this.renderIf = true;
|
|
37
|
+
this.now = false;
|
|
37
38
|
// @property({type:String}) second: 'numeric' | '2-digit'= "2-digit"
|
|
38
39
|
// @property({ type: String }) hour12: boolean = false;
|
|
39
40
|
this.startDateObject = new Date();
|
|
@@ -49,7 +50,8 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
|
|
|
49
50
|
this.requestUpdate();
|
|
50
51
|
}
|
|
51
52
|
connectedCallback() {
|
|
52
|
-
this.wording_billet_periode_validite
|
|
53
|
+
if (!this.hasAttribute("wording_billet_periode_validite"))
|
|
54
|
+
this.wording_billet_periode_validite = "Du %s au %s";
|
|
53
55
|
this.pageLanguage = HTML.getLanguage();
|
|
54
56
|
super.connectedCallback();
|
|
55
57
|
}
|
|
@@ -59,31 +61,29 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
|
|
|
59
61
|
getDatesParts(start_date, end_date, options) {
|
|
60
62
|
let start = this.startDateObject;
|
|
61
63
|
start.setTime(start_date * 1000);
|
|
62
|
-
let parts =
|
|
64
|
+
let parts = [];
|
|
63
65
|
if (end_date > 0) {
|
|
64
66
|
let end = this.endDateObject;
|
|
65
67
|
end.setTime(end_date * 1000);
|
|
66
|
-
|
|
68
|
+
//
|
|
69
|
+
//on affiche pas l'heure si les dates sont les mêmes
|
|
70
|
+
const isSameDay = start.toDateString() == end.toDateString();
|
|
71
|
+
if (!isSameDay) {
|
|
67
72
|
delete options.hour;
|
|
68
73
|
delete options.minute;
|
|
69
74
|
}
|
|
70
75
|
let format = new Intl.DateTimeFormat(this.language || this.pageLanguage, options);
|
|
71
76
|
parts = format.formatRangeToParts(start, end);
|
|
77
|
+
//En mode design on cache les ","
|
|
72
78
|
if (this.designMode) {
|
|
73
|
-
|
|
74
|
-
if (part.type == "literal" && this.designMode && part.value.trim() == ",") {
|
|
75
|
-
part.hidden = true;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
79
|
+
parts.forEach((part) => (part.hidden = part.value.trim() == ","));
|
|
78
80
|
}
|
|
79
|
-
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
81
|
+
//on affiche du au uniquement si on a deux dates différentes
|
|
82
|
+
if (!isSameDay) {
|
|
83
|
+
let to = parts.find((part) => part.type == "literal" && part.source == "shared" && part.value.trim().length > 0);
|
|
84
|
+
if (to) {
|
|
85
|
+
to.value = " " + this.duAu[1] + " ";
|
|
86
|
+
to.type = "to";
|
|
87
87
|
}
|
|
88
88
|
if (!this.designMode)
|
|
89
89
|
parts.unshift({ type: "from", value: this.duAu[0] + " ", source: "shared" });
|
|
@@ -94,39 +94,55 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
|
|
|
94
94
|
parts = format.formatToParts(start);
|
|
95
95
|
}
|
|
96
96
|
parts[0].value = Format.ucFirst(parts[0].value);
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
return parts.filter((p) => p.hidden !== true);
|
|
98
|
+
}
|
|
99
|
+
dateStringToSeconds(dateString) {
|
|
100
|
+
return new Date(dateString).getTime() / 1000;
|
|
99
101
|
}
|
|
100
102
|
render() {
|
|
101
103
|
if (!this.renderIf)
|
|
102
104
|
return nothing;
|
|
105
|
+
/* *
|
|
106
|
+
* Normalisation en fonction des valeurs de dates passées *
|
|
107
|
+
* */
|
|
103
108
|
if (this.date_string)
|
|
104
|
-
this.date =
|
|
109
|
+
this.date = this.dateStringToSeconds(this.date_string);
|
|
105
110
|
if (this.date)
|
|
106
111
|
this.start_date = this.date;
|
|
107
112
|
if (this.start_date_string)
|
|
108
|
-
this.start_date =
|
|
113
|
+
this.start_date = this.dateStringToSeconds(this.start_date_string);
|
|
109
114
|
if (this.end_date_string)
|
|
110
|
-
this.end_date =
|
|
115
|
+
this.end_date = this.dateStringToSeconds(this.end_date_string);
|
|
116
|
+
if (!this.start_date && !this.now && !this.end_date)
|
|
117
|
+
return nothing;
|
|
118
|
+
if (!this.start_date)
|
|
119
|
+
this.start_date = Date.now() / 1000;
|
|
111
120
|
if (this.end_date > 0 && this.end_date < this.start_date) {
|
|
112
121
|
const copy = this.start_date;
|
|
113
122
|
this.start_date = this.end_date;
|
|
114
123
|
this.end_date = copy;
|
|
115
124
|
}
|
|
125
|
+
/* *
|
|
126
|
+
* gestion des options d'affichage des dates
|
|
127
|
+
* */
|
|
116
128
|
let options = {
|
|
117
|
-
weekday: this.weekday,
|
|
118
129
|
year: this.year,
|
|
119
130
|
month: this.month,
|
|
120
131
|
day: this.day,
|
|
121
132
|
};
|
|
122
|
-
if (this.
|
|
133
|
+
if (this.weekday !== "hidden")
|
|
134
|
+
options.weekday = this.weekday;
|
|
135
|
+
if (this.hour !== "hidden")
|
|
123
136
|
options.hour = this.hour;
|
|
124
|
-
if (this.minute)
|
|
137
|
+
if (this.minute !== "hidden")
|
|
125
138
|
options.minute = this.minute;
|
|
126
139
|
if (this.era)
|
|
127
140
|
options.era = this.era;
|
|
128
141
|
if (this.time_zone)
|
|
129
142
|
options.timeZone = this.time_zone;
|
|
143
|
+
/**
|
|
144
|
+
* On récupère les différentes partie affichées en vu de l'injection dans le template
|
|
145
|
+
*/
|
|
130
146
|
let parts = this.getDatesParts(this.start_date, this.end_date, options);
|
|
131
147
|
return html `${parts.map((part) => {
|
|
132
148
|
let template = this.templateParts[part.type];
|
|
@@ -195,6 +211,9 @@ __decorate([
|
|
|
195
211
|
__decorate([
|
|
196
212
|
property({ type: Boolean })
|
|
197
213
|
], SonicDate.prototype, "renderIf", void 0);
|
|
214
|
+
__decorate([
|
|
215
|
+
property({ type: Boolean })
|
|
216
|
+
], SonicDate.prototype, "now", void 0);
|
|
198
217
|
SonicDate = __decorate([
|
|
199
218
|
customElement(tagName)
|
|
200
219
|
], SonicDate);
|
|
@@ -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) & typeof LitElement;
|
|
2
|
+
declare const SonicComponent_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<any>) & typeof LitElement;
|
|
3
3
|
export declare class SonicComponent extends SonicComponent_base {
|
|
4
4
|
text: string;
|
|
5
5
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { LitElement } from "lit";
|
|
2
3
|
declare const Fetch_base: {
|
|
3
4
|
new (...args: any[]): {
|
|
4
|
-
api: import("../../../utils/api").default | null;
|
|
5
|
+
api: import("../../../utils/api").default<any, any> | null;
|
|
5
6
|
key: String;
|
|
6
7
|
isFirstLoad: boolean;
|
|
7
8
|
isLoading: boolean;
|
|
@@ -10,8 +11,11 @@ declare const Fetch_base: {
|
|
|
10
11
|
isFetchEnabled: boolean;
|
|
11
12
|
_endPoint: string;
|
|
12
13
|
endPoint: string;
|
|
14
|
+
requestId: number;
|
|
15
|
+
refetchEveryMs: number;
|
|
16
|
+
refetchTimeOutId?: NodeJS.Timeout | undefined;
|
|
13
17
|
_fetchData(): Promise<void>;
|
|
14
|
-
onInvalidate
|
|
18
|
+
onInvalidate?: (() => void) | undefined;
|
|
15
19
|
disconnectedCallback(): void;
|
|
16
20
|
connectedCallback(): void;
|
|
17
21
|
firstUpdated(): void;
|
|
@@ -28,6 +32,7 @@ declare const Fetch_base: {
|
|
|
28
32
|
debug: HTMLElement | null;
|
|
29
33
|
defferedDebug: boolean | null;
|
|
30
34
|
displayContents: boolean;
|
|
35
|
+
shadowRoot?: ShadowRoot | undefined;
|
|
31
36
|
dispatchEvent(event: Event): void;
|
|
32
37
|
setAttribute(name: string, value: string): void;
|
|
33
38
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
@@ -39,7 +44,39 @@ declare const Fetch_base: {
|
|
|
39
44
|
getAttribute(name: string): string;
|
|
40
45
|
hasAttribute(attributeName: String): boolean;
|
|
41
46
|
};
|
|
42
|
-
} & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface) & typeof LitElement;
|
|
47
|
+
} & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<any>) & typeof LitElement;
|
|
48
|
+
/**
|
|
49
|
+
* ###Fetch charge un contenu via un appel d'api web.
|
|
50
|
+
* Extends mixins : Fetcher, [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
|
|
51
|
+
*
|
|
52
|
+
* #### Configuration via les attributs
|
|
53
|
+
*
|
|
54
|
+
* | nom | sur quelle balise | Description | Exemple de valeur | défaut / requis |
|
|
55
|
+
* | -------------------------------------------------------------------------------------- |
|
|
56
|
+
* | serviceURL |Fetcher ou un de ses parents | URL de base des services. | http://la-billetterie.net/api/v2 | domain du site |
|
|
57
|
+
* | endpoint |Fetcher | point d'accès d'un service | user/2 | valeur de l'attribut dataProvider |
|
|
58
|
+
* | dataProvider |Fetcher ou un de ses parents | Identifiant d'un publisher qui stock les données, voir [subscriber](./?path=/docs/miscallenous-🔔-subscriber--page). | billetterie/user/2 | *REQUIS* |
|
|
59
|
+
* | headersDataProvider |Fetcher ou un de ses parents | Identifiant d'un publisher qui stock les données destinées à être envoyées en entêtes de la requetes | MyCoockieHEaders | null |
|
|
60
|
+
* | key |Fetcher | extrait une sous propriété de la donnée chargée avant de l'assignée à son publisher | ma.data | null |
|
|
61
|
+
*
|
|
62
|
+
* *Si la données est `{ma:{data:{a:1,b:2}}}` et `key="ma.data"`, la données disponible dans le composant sera `{a:1, b:2}`*
|
|
63
|
+
|
|
64
|
+
#### Intégration auto de basic auth (pour tester une api qui nécessite une authentification)
|
|
65
|
+
|
|
66
|
+
* Fetch utilise le service pour générer le token et l'ajoute au header de l'appel qui récupère les données.
|
|
67
|
+
|
|
68
|
+
* | nom | sur quelle balise | Description | Exemple de valeur | défaut / requis |
|
|
69
|
+
* | -------------------------------------------------------------------------------------- |
|
|
70
|
+
* | userName | Fetcher ou un de ses parents | Nom de l'utilisateur | DjuDju | null |
|
|
71
|
+
* | password | Fetcher ou un de ses parents | mot de passe | pom_549 | null |
|
|
72
|
+
* | tokenProvider | Fetcher ou un de ses parents | point d'accès du service fournissant le token | auth | null |
|
|
73
|
+
* | token | Fetcher ou un de ses parents | A fournir à la place des autres attributs si on le possède | q<d34gb | null |
|
|
74
|
+
|
|
75
|
+
#### Autres choses utiles
|
|
76
|
+
* * L'attribut *noLoader* du composant permet de désactiver l'affichage du loader par défaut.
|
|
77
|
+
* * On peut appeler la methode invalidate() sur le publisher associé au composant pour declencher le rechargement des données.
|
|
78
|
+
* * endPoint est une propriété réctive, par conséquent, sa modification, manuelle via template ou data binbding provoque la mise à jour du contenu.
|
|
79
|
+
*/
|
|
43
80
|
export declare class Fetch extends Fetch_base {
|
|
44
81
|
static styles: import("lit").CSSResult[];
|
|
45
82
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -8,6 +8,7 @@ import { css, html, LitElement } from "lit";
|
|
|
8
8
|
import { customElement } from "lit/decorators.js";
|
|
9
9
|
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
10
10
|
import Fetcher from "@supersoniks/concorde/core/mixins/Fetcher";
|
|
11
|
+
const tagName = "sonic-fetch"; // For Astro.build
|
|
11
12
|
/**
|
|
12
13
|
* ###Fetch charge un contenu via un appel d'api web.
|
|
13
14
|
* Extends mixins : Fetcher, [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
|
|
@@ -19,6 +20,7 @@ import Fetcher from "@supersoniks/concorde/core/mixins/Fetcher";
|
|
|
19
20
|
* | serviceURL |Fetcher ou un de ses parents | URL de base des services. | http://la-billetterie.net/api/v2 | domain du site |
|
|
20
21
|
* | endpoint |Fetcher | point d'accès d'un service | user/2 | valeur de l'attribut dataProvider |
|
|
21
22
|
* | dataProvider |Fetcher ou un de ses parents | Identifiant d'un publisher qui stock les données, voir [subscriber](./?path=/docs/miscallenous-🔔-subscriber--page). | billetterie/user/2 | *REQUIS* |
|
|
23
|
+
* | headersDataProvider |Fetcher ou un de ses parents | Identifiant d'un publisher qui stock les données destinées à être envoyées en entêtes de la requetes | MyCoockieHEaders | null |
|
|
22
24
|
* | key |Fetcher | extrait une sous propriété de la donnée chargée avant de l'assignée à son publisher | ma.data | null |
|
|
23
25
|
*
|
|
24
26
|
* *Si la données est `{ma:{data:{a:1,b:2}}}` et `key="ma.data"`, la données disponible dans le composant sera `{a:1, b:2}`*
|
|
@@ -39,7 +41,6 @@ import Fetcher from "@supersoniks/concorde/core/mixins/Fetcher";
|
|
|
39
41
|
* * On peut appeler la methode invalidate() sur le publisher associé au composant pour declencher le rechargement des données.
|
|
40
42
|
* * endPoint est une propriété réctive, par conséquent, sa modification, manuelle via template ou data binbding provoque la mise à jour du contenu.
|
|
41
43
|
*/
|
|
42
|
-
const tagName = "sonic-fetch"; // For Astro.build
|
|
43
44
|
let Fetch = class Fetch extends Fetcher(Subscriber(LitElement)) {
|
|
44
45
|
render() {
|
|
45
46
|
return html `<slot></slot>`;
|
|
@@ -56,8 +57,3 @@ Fetch = __decorate([
|
|
|
56
57
|
customElement(tagName)
|
|
57
58
|
], Fetch);
|
|
58
59
|
export { Fetch };
|
|
59
|
-
//Ajout pour custom-elements-manifesy pour storybook notamment
|
|
60
|
-
try {
|
|
61
|
-
customElements.define(tagName, Fetch);
|
|
62
|
-
}
|
|
63
|
-
catch (e) { }
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { LitElement, nothing } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* Le composant *sonic-if* affiche son contenu dans le slot principal si sa propriété .condition est évaluée à true
|
|
4
|
+
*/
|
|
2
5
|
export declare class SonicIF extends LitElement {
|
|
3
6
|
static styles: import("lit").CSSResult;
|
|
4
7
|
/**
|
|
@@ -6,10 +6,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { css, html, LitElement, nothing } from "lit";
|
|
8
8
|
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
const tagName = "sonic-if"; // For Astro.build
|
|
9
10
|
/**
|
|
10
11
|
* Le composant *sonic-if* affiche son contenu dans le slot principal si sa propriété .condition est évaluée à true
|
|
11
12
|
*/
|
|
12
|
-
const tagName = "sonic-if"; // For Astro.build
|
|
13
13
|
let SonicIF = class SonicIF extends LitElement {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
@@ -21,14 +21,13 @@ let SonicIF = class SonicIF extends LitElement {
|
|
|
21
21
|
render() {
|
|
22
22
|
if (!this.condition)
|
|
23
23
|
return nothing;
|
|
24
|
-
return html `
|
|
25
|
-
<slot></slot>
|
|
26
|
-
`;
|
|
24
|
+
return html ` <slot></slot> `;
|
|
27
25
|
}
|
|
28
26
|
};
|
|
29
|
-
SonicIF.styles = css
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
SonicIF.styles = css `
|
|
28
|
+
:host {
|
|
29
|
+
display: contents;
|
|
30
|
+
}
|
|
32
31
|
`;
|
|
33
32
|
__decorate([
|
|
34
33
|
property({ type: Boolean })
|
|
@@ -37,8 +36,3 @@ SonicIF = __decorate([
|
|
|
37
36
|
customElement(tagName)
|
|
38
37
|
], SonicIF);
|
|
39
38
|
export { SonicIF };
|
|
40
|
-
//Ajout pour custom-elements-manifesy pour storybook notamment
|
|
41
|
-
try {
|
|
42
|
-
customElements.define(tagName, SonicIF);
|
|
43
|
-
}
|
|
44
|
-
catch (e) { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./if";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { expect } from "@jest/globals";
|
|
11
|
+
import TestUtils from "@supersoniks/concorde/test-utils/TestUtils";
|
|
12
|
+
import "./if";
|
|
13
|
+
function create() {
|
|
14
|
+
return TestUtils.bootstrap(`<sonic-if>Some Content</sonic-if>`)[0];
|
|
15
|
+
}
|
|
16
|
+
test("shows ''Some Content'' condition = true set by property accessor", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
const elt = create();
|
|
18
|
+
elt.condition = true;
|
|
19
|
+
yield elt.updated();
|
|
20
|
+
const renderedText = elt.shadowRoot.children[0].assignedNodes()[0].textContent;
|
|
21
|
+
expect(renderedText).toBe("Some Content");
|
|
22
|
+
}));
|
|
23
|
+
test("shows nothing condition = false set by property accessor", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
const elt = create();
|
|
25
|
+
elt.condition = false;
|
|
26
|
+
yield elt.updated();
|
|
27
|
+
const children = Array.from(elt.shadowRoot.children).filter((elt) => elt.nodeName.toLowerCase() != "style");
|
|
28
|
+
const length = children.length;
|
|
29
|
+
expect(length).toBe(0);
|
|
30
|
+
}));
|
|
31
|
+
test("shows ''Some Content'' condition = true set by attribute", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
const elt = create();
|
|
33
|
+
elt.setAttribute("condition", "");
|
|
34
|
+
yield elt.updated();
|
|
35
|
+
const renderedText = elt.shadowRoot.children[0].assignedNodes()[0].textContent;
|
|
36
|
+
expect(renderedText).toBe("Some Content");
|
|
37
|
+
}));
|
|
38
|
+
test("shows nothing condition not set", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
const elt = create();
|
|
40
|
+
yield elt.updated();
|
|
41
|
+
const children = Array.from(elt.shadowRoot.children).filter((elt) => elt.nodeName.toLowerCase() != "style");
|
|
42
|
+
const length = children.length;
|
|
43
|
+
expect(length).toBe(0);
|
|
44
|
+
}));
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { LitElement } from "lit";
|
|
2
3
|
import "@supersoniks/concorde/core/components/ui/loader/loader";
|
|
3
4
|
import "@supersoniks/concorde/core/components/functional/subscriber/subscriber";
|
|
5
|
+
import { DirectiveResult } from "lit/directive";
|
|
6
|
+
import { TemplateContentDirective } from "lit/directives/template-content.js";
|
|
7
|
+
import { TemplateResult } from "lit";
|
|
4
8
|
declare const List_base: {
|
|
5
9
|
new (...args: any[]): {
|
|
6
|
-
api: import("../../../utils/api").default | null;
|
|
10
|
+
api: import("../../../utils/api").default<any, any> | null;
|
|
7
11
|
key: String;
|
|
8
12
|
isFirstLoad: boolean;
|
|
9
13
|
isLoading: boolean;
|
|
@@ -12,8 +16,11 @@ declare const List_base: {
|
|
|
12
16
|
isFetchEnabled: boolean;
|
|
13
17
|
_endPoint: string;
|
|
14
18
|
endPoint: string;
|
|
19
|
+
requestId: number;
|
|
20
|
+
refetchEveryMs: number;
|
|
21
|
+
refetchTimeOutId?: NodeJS.Timeout | undefined;
|
|
15
22
|
_fetchData(): Promise<void>;
|
|
16
|
-
onInvalidate
|
|
23
|
+
onInvalidate?: (() => void) | undefined;
|
|
17
24
|
disconnectedCallback(): void;
|
|
18
25
|
connectedCallback(): void;
|
|
19
26
|
firstUpdated(): void;
|
|
@@ -30,6 +37,7 @@ declare const List_base: {
|
|
|
30
37
|
debug: HTMLElement | null;
|
|
31
38
|
defferedDebug: boolean | null;
|
|
32
39
|
displayContents: boolean;
|
|
40
|
+
shadowRoot?: ShadowRoot | undefined;
|
|
33
41
|
dispatchEvent(event: Event): void;
|
|
34
42
|
setAttribute(name: string, value: string): void;
|
|
35
43
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
@@ -41,10 +49,26 @@ declare const List_base: {
|
|
|
41
49
|
getAttribute(name: string): string;
|
|
42
50
|
hasAttribute(attributeName: String): boolean;
|
|
43
51
|
};
|
|
44
|
-
} & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface) & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/TemplatesContainer").TemplatesContainerInterface) & typeof LitElement;
|
|
52
|
+
} & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<any>) & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/TemplatesContainer").TemplatesContainerInterface) & typeof LitElement;
|
|
53
|
+
/**
|
|
54
|
+
* ### 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
|
+
*
|
|
56
|
+
* Extends mixins : Fetcher, [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
|
|
57
|
+
*
|
|
58
|
+
* * Si le composant possède un attribut *fetch*, il charge un contenu via un appel d'api web.<br>
|
|
59
|
+
* Voir [fetcher](./?path=/docs/core-components-functional-fetch--basic) pour la configuration des autres attributs.
|
|
60
|
+
* * Chaque élément créé est englobé dans un objet [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page).<br>
|
|
61
|
+
* Un dataProvider y est associé a l'adresse suivante *dataProvider-de-la-liste$/*index-de-la-ligne-courante*
|
|
62
|
+
* Les données de la ligne sont donc disponible pour les élements internes (subscribers, data-binding)
|
|
63
|
+
* * Lors du chargement un objet loader inline est affiché.
|
|
64
|
+
* * Si le résultat de la requête est un objet, il est imbriqué dans un tableau pour garantir le fonctionnement.<br>
|
|
65
|
+
* Cependant, si l'attribut `extractValues` est présent, les valeurs des propriétés de l'objet sont mises dans dans un tableau pour le rendu.
|
|
66
|
+
* * La propriété _key_ est ajoutés à la donnée de chaque item. Elle contient l'index dans le cas d'un liste simple ou la clés associée à la valeur si `extractValues` est définit.
|
|
67
|
+
* * On peut appler la methode invalidate() sur son publishe pour declencher le rechargement des données
|
|
68
|
+
* *
|
|
69
|
+
*/
|
|
45
70
|
export declare class List extends List_base {
|
|
46
|
-
|
|
47
|
-
itemPropertyMap: Object | null;
|
|
71
|
+
itemPropertyMap?: Object;
|
|
48
72
|
/**
|
|
49
73
|
* 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.
|
|
50
74
|
* 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é.
|
|
@@ -55,9 +79,9 @@ export declare class List extends List_base {
|
|
|
55
79
|
*/
|
|
56
80
|
idKey: string;
|
|
57
81
|
connectedCallback(): void;
|
|
58
|
-
renderLoadingState():
|
|
59
|
-
renderNoResultState():
|
|
82
|
+
renderLoadingState(): DirectiveResult<typeof TemplateContentDirective> | TemplateResult;
|
|
83
|
+
renderNoResultState(): TemplateResult<1>;
|
|
60
84
|
formatProps(): any;
|
|
61
|
-
render():
|
|
85
|
+
render(): DirectiveResult<typeof TemplateContentDirective>;
|
|
62
86
|
}
|
|
63
87
|
export {};
|