@supersoniks/concorde 1.1.40 → 1.1.41
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/components.d.ts +0 -0
- package/components.js +0 -0
- package/concorde-core.bundle.js +28 -21
- package/concorde-core.es.js +849 -448
- package/core/components/functional/configuration/configuration.d.ts +0 -0
- package/core/components/functional/configuration/configuration.js +0 -0
- package/core/components/functional/date/date.d.ts +0 -0
- package/core/components/functional/date/date.js +0 -0
- package/core/components/functional/example/example.d.ts +0 -0
- package/core/components/functional/example/example.js +0 -0
- package/core/components/functional/fetch/fetch.d.ts +0 -0
- package/core/components/functional/fetch/fetch.js +0 -0
- package/core/components/functional/functional.d.ts +0 -0
- package/core/components/functional/functional.js +0 -0
- package/core/components/functional/if/if.d.ts +0 -0
- package/core/components/functional/if/if.js +0 -0
- package/core/components/functional/list/list.d.ts +0 -0
- package/core/components/functional/list/list.js +0 -0
- package/core/components/functional/queue/queue.d.ts +0 -0
- package/core/components/functional/queue/queue.js +0 -0
- package/core/components/functional/router/redirect.d.ts +0 -0
- package/core/components/functional/router/redirect.js +0 -0
- package/core/components/functional/router/router.d.ts +0 -0
- package/core/components/functional/router/router.js +0 -0
- package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +59 -0
- package/core/components/functional/sdui/SDUIDescriptorTransformer.js +219 -0
- package/core/components/functional/sdui/sdui.d.ts +77 -21
- package/core/components/functional/sdui/sdui.js +177 -78
- package/core/components/functional/sdui/types.d.ts +35 -0
- package/core/components/functional/sdui/types.js +1 -0
- package/core/components/functional/sonic-scope/sonic-scope.d.ts +0 -0
- package/core/components/functional/sonic-scope/sonic-scope.js +0 -0
- package/core/components/functional/states/states.d.ts +0 -0
- package/core/components/functional/states/states.js +0 -0
- package/core/components/functional/submit/submit.d.ts +0 -0
- package/core/components/functional/submit/submit.js +0 -0
- package/core/components/functional/subscriber/subscriber.d.ts +0 -0
- package/core/components/functional/subscriber/subscriber.js +0 -0
- package/core/components/ui/_css/scroll.d.ts +0 -0
- package/core/components/ui/_css/scroll.js +0 -0
- package/core/components/ui/_css/size.d.ts +0 -0
- package/core/components/ui/_css/size.js +0 -0
- package/core/components/ui/_css/type.d.ts +0 -0
- package/core/components/ui/_css/type.js +0 -0
- package/core/components/ui/alert/alert.d.ts +2 -2
- package/core/components/ui/alert/alert.js +12 -11
- package/core/components/ui/badge/badge.d.ts +0 -0
- package/core/components/ui/badge/badge.js +0 -0
- package/core/components/ui/button/button.d.ts +0 -0
- package/core/components/ui/button/button.js +0 -0
- package/core/components/ui/captcha/captcha.d.ts +0 -0
- package/core/components/ui/captcha/captcha.js +0 -0
- package/core/components/ui/card/card-footer.d.ts +0 -0
- package/core/components/ui/card/card-footer.js +0 -0
- package/core/components/ui/card/card-header-descripton.d.ts +0 -0
- package/core/components/ui/card/card-header-descripton.js +0 -0
- package/core/components/ui/card/card-header.d.ts +0 -0
- package/core/components/ui/card/card-header.js +0 -0
- package/core/components/ui/card/card-main.d.ts +0 -0
- package/core/components/ui/card/card-main.js +0 -0
- package/core/components/ui/card/card.d.ts +0 -0
- package/core/components/ui/card/card.js +0 -0
- package/core/components/ui/divider/divider.d.ts +0 -0
- package/core/components/ui/divider/divider.js +0 -0
- package/core/components/ui/form/checkbox/checkbox.d.ts +0 -0
- package/core/components/ui/form/checkbox/checkbox.js +2 -1
- package/core/components/ui/form/css/form-control.d.ts +0 -0
- package/core/components/ui/form/css/form-control.js +0 -0
- package/core/components/ui/form/fieldset/fieldset.d.ts +0 -0
- package/core/components/ui/form/fieldset/fieldset.js +0 -0
- package/core/components/ui/form/fieldset/legend-description.d.ts +0 -0
- package/core/components/ui/form/fieldset/legend-description.js +0 -0
- package/core/components/ui/form/fieldset/legend.d.ts +0 -0
- package/core/components/ui/form/fieldset/legend.js +0 -0
- package/core/components/ui/form/form-actions/form-actions.d.ts +0 -0
- package/core/components/ui/form/form-actions/form-actions.js +0 -0
- package/core/components/ui/form/form-layout/form-layout.d.ts +0 -0
- package/core/components/ui/form/form-layout/form-layout.js +0 -0
- package/core/components/ui/form/input/input.d.ts +4 -0
- package/core/components/ui/form/input/input.js +20 -3
- package/core/components/ui/form/input/password-helper.d.ts +19 -0
- package/core/components/ui/form/input/password-helper.js +96 -0
- package/core/components/ui/form/input/same-value-helper.d.ts +16 -0
- package/core/components/ui/form/input/same-value-helper.js +76 -0
- package/core/components/ui/form/radio/radio.d.ts +0 -0
- package/core/components/ui/form/radio/radio.js +0 -0
- package/core/components/ui/form/select/select.d.ts +0 -0
- package/core/components/ui/form/select/select.js +5 -1
- package/core/components/ui/form/textarea/textarea.d.ts +0 -0
- package/core/components/ui/form/textarea/textarea.js +5 -1
- package/core/components/ui/group/group.d.ts +0 -0
- package/core/components/ui/group/group.js +0 -0
- package/core/components/ui/icon/icon.d.ts +0 -0
- package/core/components/ui/icon/icon.js +0 -0
- package/core/components/ui/icon/icons.d.ts +0 -0
- package/core/components/ui/icon/icons.js +0 -0
- package/core/components/ui/icon/icons.json +0 -0
- package/core/components/ui/image/image.d.ts +0 -0
- package/core/components/ui/image/image.js +0 -0
- package/core/components/ui/link/link.d.ts +0 -0
- package/core/components/ui/link/link.js +0 -0
- package/core/components/ui/loader/loader.d.ts +0 -0
- package/core/components/ui/loader/loader.js +0 -0
- package/core/components/ui/loader/styles/fixed.d.ts +0 -0
- package/core/components/ui/loader/styles/fixed.js +0 -0
- package/core/components/ui/loader/styles/inline.d.ts +0 -0
- package/core/components/ui/loader/styles/inline.js +0 -0
- package/core/components/ui/menu/menu-item.d.ts +0 -0
- package/core/components/ui/menu/menu-item.js +0 -0
- package/core/components/ui/menu/menu.d.ts +0 -0
- package/core/components/ui/menu/menu.js +0 -0
- package/core/components/ui/modal/modal-actions.d.ts +0 -0
- package/core/components/ui/modal/modal-actions.js +0 -0
- package/core/components/ui/modal/modal-close.d.ts +0 -0
- package/core/components/ui/modal/modal-close.js +0 -0
- package/core/components/ui/modal/modal-content.d.ts +0 -0
- package/core/components/ui/modal/modal-content.js +0 -0
- package/core/components/ui/modal/modal-subtitle.d.ts +0 -0
- package/core/components/ui/modal/modal-subtitle.js +0 -0
- package/core/components/ui/modal/modal-title.d.ts +0 -0
- package/core/components/ui/modal/modal-title.js +0 -0
- package/core/components/ui/modal/modal.d.ts +0 -0
- package/core/components/ui/modal/modal.js +0 -0
- package/core/components/ui/pop/pop.d.ts +0 -0
- package/core/components/ui/pop/pop.js +0 -0
- package/core/components/ui/progress/progress.d.ts +0 -0
- package/core/components/ui/progress/progress.js +0 -0
- package/core/components/ui/table/table-caption.d.ts +0 -0
- package/core/components/ui/table/table-caption.js +0 -0
- package/core/components/ui/table/table-tbody.d.ts +0 -0
- package/core/components/ui/table/table-tbody.js +0 -0
- package/core/components/ui/table/table-td.d.ts +0 -0
- package/core/components/ui/table/table-td.js +0 -0
- package/core/components/ui/table/table-tfoot.d.ts +0 -0
- package/core/components/ui/table/table-tfoot.js +0 -0
- package/core/components/ui/table/table-th.d.ts +0 -0
- package/core/components/ui/table/table-th.js +0 -0
- package/core/components/ui/table/table-thead.d.ts +0 -0
- package/core/components/ui/table/table-thead.js +0 -0
- package/core/components/ui/table/table-tr.d.ts +0 -0
- package/core/components/ui/table/table-tr.js +0 -0
- package/core/components/ui/table/table.d.ts +0 -0
- package/core/components/ui/table/table.js +0 -0
- package/core/components/ui/tabs/tab.d.ts +0 -0
- package/core/components/ui/tabs/tab.js +0 -0
- package/core/components/ui/tabs/tabs.d.ts +0 -0
- package/core/components/ui/tabs/tabs.js +0 -0
- package/core/components/ui/taxonomy/taxonomy.d.ts +0 -0
- package/core/components/ui/taxonomy/taxonomy.js +0 -0
- package/core/components/ui/theme/css/tailwind.css +0 -0
- package/core/components/ui/theme/css/tailwind.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/core-variables.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/core-variables.js +0 -0
- package/core/components/ui/theme/theme-collection/dark.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/dark.js +0 -0
- package/core/components/ui/theme/theme-collection/light.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/light.js +0 -0
- package/core/components/ui/theme/theme.d.ts +0 -0
- package/core/components/ui/theme/theme.js +0 -0
- package/core/components/ui/toast/message-subscriber.d.ts +0 -0
- package/core/components/ui/toast/message-subscriber.js +0 -0
- package/core/components/ui/toast/toast-item.d.ts +0 -0
- package/core/components/ui/toast/toast-item.js +0 -0
- package/core/components/ui/toast/toast.d.ts +0 -0
- package/core/components/ui/toast/toast.js +0 -0
- package/core/components/ui/toast/types.d.ts +0 -0
- package/core/components/ui/toast/types.js +0 -0
- package/core/components/ui/tooltip/tooltip.d.ts +0 -0
- package/core/components/ui/tooltip/tooltip.js +0 -0
- package/core/components/ui/ui.d.ts +2 -0
- package/core/components/ui/ui.js +2 -0
- package/core/core.d.ts +0 -0
- package/core/core.js +0 -0
- package/core/mixins/Fetcher.d.ts +0 -0
- package/core/mixins/Fetcher.js +6 -2
- package/core/mixins/FormCheckable.d.ts +0 -0
- package/core/mixins/FormCheckable.js +0 -0
- package/core/mixins/FormElement.d.ts +0 -0
- package/core/mixins/FormElement.js +0 -0
- package/core/mixins/FormInput.d.ts +0 -0
- package/core/mixins/FormInput.js +0 -0
- package/core/mixins/Subscriber.d.ts +0 -0
- package/core/mixins/Subscriber.js +0 -0
- package/core/mixins/TemplatesContainer.d.ts +0 -0
- package/core/mixins/TemplatesContainer.js +0 -0
- package/core/mixins/mixins.d.ts +0 -0
- package/core/mixins/mixins.js +0 -0
- package/core/utils/Arrays.d.ts +0 -0
- package/core/utils/Arrays.js +0 -0
- package/core/utils/DataBindObserver.d.ts +0 -0
- package/core/utils/DataBindObserver.js +0 -0
- package/core/utils/Electron.d.ts +0 -0
- package/core/utils/Electron.js +0 -0
- package/core/utils/Format.d.ts +0 -0
- package/core/utils/Format.js +0 -0
- package/core/utils/HTML.d.ts +8 -0
- package/core/utils/HTML.js +41 -0
- package/core/utils/LocationHandler.d.ts +0 -0
- package/core/utils/LocationHandler.js +0 -0
- package/core/utils/Objects.d.ts +0 -0
- package/core/utils/Objects.js +0 -0
- package/core/utils/PublisherProxy.d.mts +0 -0
- package/core/utils/PublisherProxy.mjs +0 -0
- package/core/utils/api.d.ts +0 -0
- package/core/utils/api.js +0 -0
- package/mixins.d.ts +0 -0
- package/mixins.js +0 -0
- package/package.json +9 -1
- package/utils.d.ts +0 -0
- package/utils.js +0 -0
|
@@ -16,88 +16,177 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
16
16
|
import { LitElement } from "lit";
|
|
17
17
|
import { customElement, property } from "lit/decorators.js";
|
|
18
18
|
import { Fetcher, Subscriber } from "@supersoniks/concorde/mixins";
|
|
19
|
-
import { Objects } from "@supersoniks/concorde/utils";
|
|
19
|
+
import { HTML, Objects } from "@supersoniks/concorde/utils";
|
|
20
20
|
const tagName = "sonic-sdui"; // For Astro.build
|
|
21
|
-
|
|
21
|
+
import SDUIDescriptorTransformer from "@supersoniks/concorde/core/components/functional/sdui/SDUIDescriptorTransformer";
|
|
22
|
+
/**
|
|
23
|
+
* ### sonic-sdui (Server Driven User Interface) est un fetcher chargant un JSON décrivant une interface utilisateur
|
|
24
|
+
*
|
|
25
|
+
* Extends mixins : Fetcher, [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
|
|
26
|
+
*
|
|
27
|
+
* * Si le composant possède un attribut *fetch*, il charge un contenu via un appel d'api web.<br>
|
|
28
|
+
* Voir [fetcher](./?path=/docs/core-components-functional-fetch--basic) pour la configuration des autres attributs.
|
|
29
|
+
* * Le format du JSON est décrit par le type SDUIDescriptor
|
|
30
|
+
* * Un attribut supplémentaire `transformation` permet de transformer le json reçu avant la générationd e l'interface utilisateur<br>
|
|
31
|
+
* Son format est décrit par le type SDUITransformDescription
|
|
32
|
+
*
|
|
33
|
+
* * Si le résultat de la requête est un objet, il est imbriqué dans un tableau pour garantir le fonctionnement.<br>
|
|
34
|
+
* 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.
|
|
35
|
+
* * 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.
|
|
36
|
+
* * On peut appler la methode invalidate() sur son publishe pour declencher le rechargement des données
|
|
37
|
+
* *
|
|
38
|
+
*/
|
|
39
|
+
let SonicSDUI = class SonicSDUI extends Fetcher(Subscriber(LitElement)) {
|
|
22
40
|
connectedCallback() {
|
|
23
41
|
this.noShadowDom = "";
|
|
42
|
+
this.displayContents = true;
|
|
24
43
|
this.isFetchEnabled = this.hasAttribute("fetch");
|
|
25
44
|
super.connectedCallback();
|
|
26
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* On peut passer la description sous form de props, sinon il faut utiliser l'attribut fetch
|
|
48
|
+
*/
|
|
27
49
|
get props() {
|
|
28
50
|
return super.props;
|
|
29
51
|
}
|
|
30
|
-
loadJS(src) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const p = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
let script = document.createElement("script");
|
|
34
|
-
script.src = src;
|
|
35
|
-
script.onload = () => resolve(true);
|
|
36
|
-
script.onerror = () => resolve(true);
|
|
37
|
-
document.head.appendChild(script);
|
|
38
|
-
}));
|
|
39
|
-
return p;
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
loadCSS(src) {
|
|
43
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const p = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
var cssnode = document.createElement("link");
|
|
46
|
-
cssnode.type = "text/css";
|
|
47
|
-
cssnode.rel = "stylesheet";
|
|
48
|
-
cssnode.href = src;
|
|
49
|
-
cssnode.onload = () => resolve(true);
|
|
50
|
-
cssnode.onerror = () => resolve(true);
|
|
51
|
-
document.head.appendChild(cssnode);
|
|
52
|
-
}));
|
|
53
|
-
return p;
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
52
|
set props(value) {
|
|
57
53
|
super.props = value;
|
|
58
54
|
this.updateContents();
|
|
59
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* updateContents est déclenché quand les props sont renseignées
|
|
58
|
+
* Le contenu du composant est regénéré en fonction du descripteur fourni
|
|
59
|
+
*/
|
|
60
60
|
updateContents() {
|
|
61
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
|
|
63
|
-
this.removeChild(this.children[0]);
|
|
64
|
-
}
|
|
62
|
+
this.removeChildren();
|
|
65
63
|
if (!this.props)
|
|
66
64
|
return;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
65
|
+
this.loadAssets();
|
|
66
|
+
yield this.transformSDUIDescriptor();
|
|
67
|
+
this.parseRootNodes();
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Suppressiond du contenu du composant avant le génération de la nouvelle ui
|
|
72
|
+
*/
|
|
73
|
+
removeChildren() {
|
|
74
|
+
while ([...this.children].filter((elt) => elt.nodeName != "SLOT").length > 0) {
|
|
75
|
+
this.removeChild(this.children[0]);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Chargement de fichiers js et css associés si besoin
|
|
80
|
+
**/
|
|
81
|
+
loadAssets() {
|
|
82
|
+
if (!this.props)
|
|
83
|
+
return;
|
|
84
|
+
if (this.props.js) {
|
|
85
|
+
for (const src of this.props.js)
|
|
86
|
+
HTML.loadJS(src);
|
|
87
|
+
}
|
|
88
|
+
if (this.props.css) {
|
|
89
|
+
for (const src of this.props.css)
|
|
90
|
+
HTML.loadCSS(src);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Transformation de la data fournie via props si il y a un attribut transformation
|
|
95
|
+
* */
|
|
96
|
+
transformSDUIDescriptor() {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
if (!this.hasAttribute("transformation"))
|
|
80
99
|
return;
|
|
100
|
+
let result = yield fetch(this.getAttribute("transformation"));
|
|
101
|
+
let json = yield result.json();
|
|
102
|
+
let transformer = new SDUIDescriptorTransformer();
|
|
103
|
+
yield transformer.transform(this.props, json);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Point d'entrée : transformation des noeuds fournis en éléments graphiques
|
|
108
|
+
**/
|
|
109
|
+
parseRootNodes() {
|
|
110
|
+
if (!this.props)
|
|
111
|
+
return;
|
|
112
|
+
let nodes = this.props.nodes;
|
|
113
|
+
if (!nodes)
|
|
114
|
+
return;
|
|
115
|
+
nodes.forEach((node) => this.appendChild(this.parseChild(node)));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* On parse un noeud ce qui crée un éléments graphique et ses enfants par recursivité via `handleChildNodes`
|
|
119
|
+
*/
|
|
120
|
+
parseChild(node) {
|
|
121
|
+
let tagName = node.tagName || "div";
|
|
122
|
+
let { element, contentElement } = this.handleLibrary(node, tagName);
|
|
123
|
+
this.handleAttributes(node, element);
|
|
124
|
+
element = this.handleMarkup(node, element);
|
|
125
|
+
if (!contentElement)
|
|
126
|
+
contentElement = element;
|
|
127
|
+
this.handleChildNodes(node, contentElement, element);
|
|
128
|
+
this.handleInnerHTML(node, contentElement);
|
|
129
|
+
if (node.prefix || node.suffix) {
|
|
130
|
+
const container = this.handlePrefixSuffix(node, element);
|
|
131
|
+
return container;
|
|
132
|
+
}
|
|
133
|
+
return element;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Si le noeud courant a des propriétés prefix et ou suffix il est entouré des markups fournis dans ces props.
|
|
137
|
+
* Le tout est inclu dans une div en display contents
|
|
138
|
+
*/
|
|
139
|
+
handlePrefixSuffix(node, element) {
|
|
140
|
+
const container = document.createElement("div");
|
|
141
|
+
container.innerHTML = (node.prefix || "") + element.outerHTML + (node.suffix || "");
|
|
142
|
+
container.style.display = "contents";
|
|
143
|
+
return container;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Création des enfants du noeud courant
|
|
147
|
+
* Si l'enfant à un attribut parentElementSelector, il est ajouté dans le noeud correspondant au sélecteur css associé et non pas dans l'élément directement.
|
|
148
|
+
*/
|
|
149
|
+
handleChildNodes(node, contentElement, element) {
|
|
150
|
+
if (node.nodes) {
|
|
151
|
+
let children = node.nodes;
|
|
81
152
|
for (let child of children) {
|
|
82
|
-
this.
|
|
153
|
+
let childElement = this.parseChild(child);
|
|
154
|
+
let nodeToAppendOn = contentElement;
|
|
155
|
+
if (child.parentElementSelector) {
|
|
156
|
+
nodeToAppendOn = element.querySelector(child.parentElementSelector) || contentElement;
|
|
157
|
+
}
|
|
158
|
+
if (nodeToAppendOn.shadowRoot)
|
|
159
|
+
nodeToAppendOn.shadowRoot.appendChild(childElement);
|
|
160
|
+
else
|
|
161
|
+
nodeToAppendOn.appendChild(childElement);
|
|
83
162
|
}
|
|
84
|
-
}
|
|
163
|
+
}
|
|
85
164
|
}
|
|
86
|
-
|
|
87
|
-
|
|
165
|
+
/**
|
|
166
|
+
* Gestion de librarie :
|
|
167
|
+
* * Si l'élément référence un élément de la librairie, on se sert de cet élément comme model pour créer le composant graphique.
|
|
168
|
+
* * Sa propriété contentElement retournée vaut element par défaut.
|
|
169
|
+
* * Si contentElementSelector est definit, alors contentElement correspond à l'élément obtenu par selection css d'après la valeurs de contentElementSelector
|
|
170
|
+
* * Les éléments enfants seront ensuite ajoutés dans contentElement
|
|
171
|
+
*/
|
|
172
|
+
handleLibrary(node, tagName) {
|
|
88
173
|
let element;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
element.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (props.library && this.props.library) {
|
|
96
|
-
element = this.parseChild(this.props.library[props.library] || { type: "div" });
|
|
174
|
+
let contentElement;
|
|
175
|
+
if (node.libraryKey && this.props.library) {
|
|
176
|
+
element = this.parseChild(this.props.library[node.libraryKey] || { tagName: "div" });
|
|
177
|
+
let selector = (this.props.library[node.libraryKey] || {}).contentElementSelector;
|
|
178
|
+
if (selector)
|
|
179
|
+
contentElement = element.querySelector(selector);
|
|
97
180
|
}
|
|
98
181
|
else
|
|
99
|
-
element = document.createElement(
|
|
100
|
-
|
|
182
|
+
element = document.createElement(tagName);
|
|
183
|
+
return { element, contentElement };
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Remplissage des attributs html avec les attributs fournis dans le noeud
|
|
187
|
+
*/
|
|
188
|
+
handleAttributes(node, element) {
|
|
189
|
+
let attributes = node.attributes;
|
|
101
190
|
for (let k in attributes) {
|
|
102
191
|
let attr = attributes[k];
|
|
103
192
|
if (Objects.isObject(attr)) {
|
|
@@ -105,31 +194,41 @@ let SonicComponent = class SonicComponent extends Fetcher(Subscriber(LitElement)
|
|
|
105
194
|
}
|
|
106
195
|
element.setAttribute(k, attr);
|
|
107
196
|
}
|
|
108
|
-
|
|
109
|
-
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Si une propriété markup est fournie, l'élément est créé à partir de la chaine html fournie avant d'être configuré
|
|
200
|
+
*/
|
|
201
|
+
handleMarkup(node, element) {
|
|
202
|
+
if (node.markup) {
|
|
203
|
+
element = document.createElement("div");
|
|
204
|
+
element.style.display = "contents";
|
|
205
|
+
element.innerHTML = node.markup;
|
|
110
206
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
207
|
+
return element;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* si le noeud à une propriété innerHTML, on l'ajout ay innerHTML de l'élément html en cours de création
|
|
211
|
+
*/
|
|
212
|
+
handleInnerHTML(node, contentElement) {
|
|
213
|
+
var _a;
|
|
214
|
+
if (!node.innerHTML)
|
|
215
|
+
return;
|
|
216
|
+
if (node.innerHTML.indexOf("wording_") != -1) {
|
|
217
|
+
let wordingProvider = this.getAncestorAttributeValue("wordingProvider");
|
|
218
|
+
(_a = this.api) === null || _a === void 0 ? void 0 : _a.post(wordingProvider, { labels: [node.innerHTML.substring(8)] }).then((value) => {
|
|
219
|
+
if (contentElement)
|
|
220
|
+
contentElement.innerHTML += value;
|
|
221
|
+
});
|
|
119
222
|
}
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
container.innerHTML = (props.prefix || "") + element.outerHTML + (props.suffix || "");
|
|
123
|
-
container.style.display = "contents";
|
|
124
|
-
return container;
|
|
223
|
+
else if (contentElement) {
|
|
224
|
+
contentElement.innerHTML += node.innerHTML;
|
|
125
225
|
}
|
|
126
|
-
return element;
|
|
127
226
|
}
|
|
128
227
|
};
|
|
129
228
|
__decorate([
|
|
130
229
|
property()
|
|
131
|
-
],
|
|
132
|
-
|
|
230
|
+
], SonicSDUI.prototype, "props", null);
|
|
231
|
+
SonicSDUI = __decorate([
|
|
133
232
|
customElement(tagName)
|
|
134
|
-
],
|
|
135
|
-
export {
|
|
233
|
+
], SonicSDUI);
|
|
234
|
+
export { SonicSDUI };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare type SDUIDescriptor = {
|
|
2
|
+
js?: Array<string>;
|
|
3
|
+
css?: Array<string>;
|
|
4
|
+
library?: Record<string, SDUINode>;
|
|
5
|
+
nodes?: Array<SDUINode>;
|
|
6
|
+
};
|
|
7
|
+
export declare type SDUINode = {
|
|
8
|
+
libraryKey?: string;
|
|
9
|
+
markup?: string;
|
|
10
|
+
tagName?: string;
|
|
11
|
+
attributes: Record<string, string>;
|
|
12
|
+
nodes?: Array<SDUINode>;
|
|
13
|
+
innerHTML?: string;
|
|
14
|
+
prefix?: string;
|
|
15
|
+
suffix?: string;
|
|
16
|
+
contentElementSelector?: string;
|
|
17
|
+
parentElementSelector?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare type SDUITransformDescription = {
|
|
20
|
+
library?: Record<string, SDUINode>;
|
|
21
|
+
transforms: Array<SDUITransformAction>;
|
|
22
|
+
};
|
|
23
|
+
export declare type SDUITransformAction = {
|
|
24
|
+
action: "remap" | "unwrap" | "wrap" | "delete" | "insert" | "move";
|
|
25
|
+
patterns?: Array<SDUINode>;
|
|
26
|
+
after?: SDUINode;
|
|
27
|
+
before?: SDUINode;
|
|
28
|
+
in?: SDUINode;
|
|
29
|
+
ui?: string;
|
|
30
|
+
};
|
|
31
|
+
export declare type SDUITransformList = Array<{
|
|
32
|
+
parent: SDUINode;
|
|
33
|
+
child: SDUINode;
|
|
34
|
+
index: number;
|
|
35
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -13,8 +13,8 @@ export declare class Alert extends LitElement {
|
|
|
13
13
|
* Peut être renseigné dans le slot pour créer des messages plus complexes
|
|
14
14
|
*/
|
|
15
15
|
text: string;
|
|
16
|
-
size?:
|
|
16
|
+
size?: '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
17
17
|
background: boolean;
|
|
18
|
-
status:
|
|
18
|
+
status: 'default' | 'error' | 'warning' | 'primary' | 'info';
|
|
19
19
|
render(): import("lit-html").TemplateResult<1>;
|
|
20
20
|
}
|
|
@@ -26,13 +26,13 @@ let Alert = class Alert extends LitElement {
|
|
|
26
26
|
/**
|
|
27
27
|
* Titre du message d'erreur
|
|
28
28
|
*/
|
|
29
|
-
this.label =
|
|
29
|
+
this.label = '';
|
|
30
30
|
/**
|
|
31
31
|
* Peut être renseigné dans le slot pour créer des messages plus complexes
|
|
32
32
|
*/
|
|
33
|
-
this.text =
|
|
33
|
+
this.text = '';
|
|
34
34
|
this.background = false;
|
|
35
|
-
this.status =
|
|
35
|
+
this.status = 'default';
|
|
36
36
|
}
|
|
37
37
|
render() {
|
|
38
38
|
return html `<div part="alert" class="alert">
|
|
@@ -66,20 +66,21 @@ Alert.styles = [
|
|
|
66
66
|
line-height: 1.2;
|
|
67
67
|
border-radius: var(--sc-alert-rounded);
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
|
|
70
|
+
.label {
|
|
70
71
|
font-weight: var(--sc-alert-label-fw);
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
:host([status=
|
|
74
|
+
:host([status='warning']) {
|
|
74
75
|
--sc-alert-color: var(--sc-warning);
|
|
75
76
|
}
|
|
76
|
-
:host([status=
|
|
77
|
+
:host([status='error']) {
|
|
77
78
|
--sc-alert-color: var(--sc-danger);
|
|
78
79
|
}
|
|
79
|
-
:host([status=
|
|
80
|
+
:host([status='info']) {
|
|
80
81
|
--sc-alert-color: var(--sc-info);
|
|
81
82
|
}
|
|
82
|
-
:host([status=
|
|
83
|
+
:host([status='success']) {
|
|
83
84
|
--sc-alert-color: var(--sc-success);
|
|
84
85
|
}
|
|
85
86
|
|
|
@@ -90,7 +91,7 @@ Alert.styles = [
|
|
|
90
91
|
}
|
|
91
92
|
:host([background]) .alert:before {
|
|
92
93
|
background-color: currentColor;
|
|
93
|
-
content:
|
|
94
|
+
content: '';
|
|
94
95
|
display: block;
|
|
95
96
|
position: absolute;
|
|
96
97
|
left: 0;
|
|
@@ -111,10 +112,10 @@ Alert.styles = [
|
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
/*Rounded*/
|
|
114
|
-
:host([size=
|
|
115
|
+
:host([size='xs']) .alert {
|
|
115
116
|
--sc-alert-rounded: var(--sc-rounded-sm);
|
|
116
117
|
}
|
|
117
|
-
:host([size=
|
|
118
|
+
:host([size='sm']) .alert {
|
|
118
119
|
--sc-alert-rounded: var(--sc-rounded-sm);
|
|
119
120
|
}
|
|
120
121
|
`,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -51,6 +51,7 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
|
|
|
51
51
|
super.connectedCallback();
|
|
52
52
|
}
|
|
53
53
|
render() {
|
|
54
|
+
let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
|
|
54
55
|
return html `
|
|
55
56
|
<label class="checkbox-container ${this.disabled ? "disabled" : ""}">
|
|
56
57
|
<span class="icon-container">
|
|
@@ -68,7 +69,7 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
|
|
|
68
69
|
<sonic-icon name="${this.iconName}" class="sc-input-icon"></sonic-icon>
|
|
69
70
|
</span>
|
|
70
71
|
<div class="checkbox-text">
|
|
71
|
-
${this.label ? unsafeHTML(this.label) : ""}
|
|
72
|
+
${this.label ? unsafeHTML(this.label + labelStarSuffix) : ""}
|
|
72
73
|
<slot></slot>
|
|
73
74
|
<slot name="description" class="${this.hasDescription ? "description" : "hidden"} ">
|
|
74
75
|
${this.description ? html `${unsafeHTML(this.description)}` : ""}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -88,6 +88,10 @@ export declare class Input extends Input_base {
|
|
|
88
88
|
hasSuffix: boolean;
|
|
89
89
|
hasPrefix: boolean;
|
|
90
90
|
updated(): void;
|
|
91
|
+
sameValueAsHandle?: (v: string) => void;
|
|
92
|
+
sameValueAsName?: string;
|
|
93
|
+
connectedCallback(): void;
|
|
94
|
+
disconnectedCallback(): void;
|
|
91
95
|
onSlotChange(): void;
|
|
92
96
|
inlineContentFocus(): void;
|
|
93
97
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -43,6 +43,20 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
43
43
|
this.hasSuffix = ((_c = this.slotSuffixNodes) === null || _c === void 0 ? void 0 : _c.length) ? true : false;
|
|
44
44
|
this.hasPrefix = ((_d = this.slotPrefixNodes) === null || _d === void 0 ? void 0 : _d.length) ? true : false;
|
|
45
45
|
}
|
|
46
|
+
connectedCallback() {
|
|
47
|
+
super.connectedCallback();
|
|
48
|
+
if (this.hasAttribute("sameValueAs")) {
|
|
49
|
+
this.sameValueAsName = this.getAttribute("sameValueAs");
|
|
50
|
+
this.sameValueAsHandle = (v) => (this.pattern = v);
|
|
51
|
+
this.getFormPublisher()[this.sameValueAsName].onAssign(this.sameValueAsHandle);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
disconnectedCallback() {
|
|
55
|
+
super.disconnectedCallback();
|
|
56
|
+
if (this.hasAttribute("sameValueAs") && this.sameValueAsName) {
|
|
57
|
+
this.getFormPublisher()[this.sameValueAsName].offAssign(this.sameValueAsHandle);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
46
60
|
onSlotChange() {
|
|
47
61
|
this.requestUpdate();
|
|
48
62
|
}
|
|
@@ -50,7 +64,6 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
50
64
|
var _a;
|
|
51
65
|
if (!this.inlineContent)
|
|
52
66
|
return;
|
|
53
|
-
console.log("oypouaze");
|
|
54
67
|
(_a = this.input) === null || _a === void 0 ? void 0 : _a.focus();
|
|
55
68
|
}
|
|
56
69
|
render() {
|
|
@@ -58,9 +71,13 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
58
71
|
"has-prefix": this.hasPrefix,
|
|
59
72
|
"has-suffix": this.hasSuffix,
|
|
60
73
|
};
|
|
74
|
+
let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
|
|
61
75
|
return html `
|
|
62
76
|
<label for="form-element" class="${this.hasLabel ? "form-label" : "hidden"}"
|
|
63
|
-
>${this.label ? unsafeHTML(this.label) : ""}<slot
|
|
77
|
+
>${this.label ? unsafeHTML(this.label + labelStarSuffix) : ""}<slot
|
|
78
|
+
name="label"
|
|
79
|
+
@slotchange=${this.onSlotChange}
|
|
80
|
+
></slot
|
|
64
81
|
></label>
|
|
65
82
|
|
|
66
83
|
<div @click=${this.inlineContentFocus} class="form-control ${classMap(slotClasses)}">
|
|
@@ -94,7 +111,7 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
94
111
|
<slot name="suffix" @slotchange=${this.onSlotChange}></slot>
|
|
95
112
|
</div>
|
|
96
113
|
</div>
|
|
97
|
-
<slot name="description" class="
|
|
114
|
+
<slot name="description" class="${this.hasDescription ? "form-description" : "hidden"}">
|
|
98
115
|
${this.description ? html `${unsafeHTML(this.description)}` : ""}
|
|
99
116
|
</slot>
|
|
100
117
|
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LitElement, nothing } from "lit";
|
|
2
|
+
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
3
|
+
declare const SonicComponent_base: (new (...args: any[]) => import("../../../../mixins/Subscriber").SubscriberInterface) & typeof LitElement;
|
|
4
|
+
export declare class SonicComponent extends SonicComponent_base {
|
|
5
|
+
name?: string;
|
|
6
|
+
minChars: number;
|
|
7
|
+
hasNoChar: boolean;
|
|
8
|
+
hasEnoughChars: boolean;
|
|
9
|
+
hasMinuscule: boolean;
|
|
10
|
+
hasMajuscule: boolean;
|
|
11
|
+
hasNumber: boolean;
|
|
12
|
+
hasSpecialChar: boolean;
|
|
13
|
+
checkValue?: (v: string) => void;
|
|
14
|
+
connectedCallback(): void;
|
|
15
|
+
disconnectedCallback(): void;
|
|
16
|
+
getIcon(test: boolean): import("lit-html").TemplateResult<1>;
|
|
17
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
18
|
+
}
|
|
19
|
+
export {};
|