@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
|
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
|
|
File without changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { SDUINode, SDUITransformDescription, SDUITransformAction, SDUITransformList, SDUIDescriptor } from "@supersoniks/concorde/core/components/functional/sdui/types";
|
|
2
|
+
export default class SDUIDescriptorTransformer {
|
|
3
|
+
sduiDescriptor?: SDUIDescriptor;
|
|
4
|
+
constructor();
|
|
5
|
+
/**
|
|
6
|
+
* Tranform un SDUIDescriptor via une SDUITransformDescription
|
|
7
|
+
* Attention fonction non pure : la sduiDescriptor est modifiée en place.
|
|
8
|
+
* * La librarie de la sduiDescriptor est mise à jour avec celle présente dans SDUITransformDescription<br>
|
|
9
|
+
* Si des clefs de librairie correspondent, celles de SDUITransformDescription ecrasent celles existantes
|
|
10
|
+
* * Ensuite des actions de transformations sont menées sur les nodes du SDUIDescriptor
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
transform(sduiDescriptor: SDUIDescriptor, transformDescriptor: SDUITransformDescription): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Effectue une actions de transformation sur les noeuds (nodes) de la sduiDescriptor (SDUIDescriptor)
|
|
16
|
+
* La des noeuds impacté est sélectionnée via pattern matching (voir SDUITransformAction.pattern et getNodesMatchingPatterns);
|
|
17
|
+
* Voir le détail des actions de transformations dns les fonctions appellées dans le switch.
|
|
18
|
+
*/
|
|
19
|
+
transformAction(transformAction: SDUITransformAction): void;
|
|
20
|
+
/**
|
|
21
|
+
* Retourne les noeuds du SDUIDescriptor qui matche la liste de patterns fournis, dans l'ordre des patterns fournis
|
|
22
|
+
*/
|
|
23
|
+
getNodesMatchingPatterns(patterns: Array<SDUINode> | undefined, node?: SDUIDescriptor): SDUITransformList;
|
|
24
|
+
/**
|
|
25
|
+
* Utilisé pour voir si un élément du pattern match le même élement du noeud en cours de traitement
|
|
26
|
+
*/
|
|
27
|
+
stringMatchesExpression(stringToTest?: string, regExpString?: string): true | "" | RegExpMatchArray | null | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Return true si le pattern match avec le noeud, false sinon.
|
|
30
|
+
*/
|
|
31
|
+
nodeMatchesPattern(pattern: SDUINode, node: SDUINode): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Pour chaque élément de la liste, remplace l'élément par ses enfants
|
|
34
|
+
*/
|
|
35
|
+
unWrap(transformAction: SDUITransformAction, list: SDUITransformList): void;
|
|
36
|
+
/**
|
|
37
|
+
* Regroupe tous les éléments de la liste dans l'élément fourni via la prop `ui` de transformAction
|
|
38
|
+
* L'élément créé est inséré en lieu et place du premier élément de la liste
|
|
39
|
+
*/
|
|
40
|
+
wrap(transformAction: SDUITransformAction, list: SDUITransformList): void;
|
|
41
|
+
/**
|
|
42
|
+
* Déplace tous les noeuds de la liste avant ou après le noeuds sélectionné par pattern matching via l'attribut correspondant `before` ou `after`
|
|
43
|
+
*/
|
|
44
|
+
move(transformAction: SDUITransformAction, list: SDUITransformList): void;
|
|
45
|
+
/**
|
|
46
|
+
* Transform ous les éléments fourni dans la liste en un élément créé a partir du model fourni dans ui.
|
|
47
|
+
* Les props attributs et autre props de chaque élément sont conservés si non remapés
|
|
48
|
+
*/
|
|
49
|
+
remap(transformAction: SDUITransformAction, list: SDUITransformList): void;
|
|
50
|
+
/**
|
|
51
|
+
* Supprime tous les éléments de la liste.
|
|
52
|
+
*/
|
|
53
|
+
delete(transformAction: SDUITransformAction, list: SDUITransformList): void;
|
|
54
|
+
/**
|
|
55
|
+
* Ajoute une copie de l'élément décrit dans la propriété ui de transformAction avant ou après chaque élément de la liste
|
|
56
|
+
* La positione st déterminée par l'attribute before ou after ou in qui est un pattern permettant la sélection de l'élément de référence pur l'ajout
|
|
57
|
+
*/
|
|
58
|
+
insert(transformAction: SDUITransformAction, list: SDUITransformList): void;
|
|
59
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
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
|
+
export default class SDUIDescriptorTransformer {
|
|
11
|
+
constructor() { }
|
|
12
|
+
/**
|
|
13
|
+
* Tranform un SDUIDescriptor via une SDUITransformDescription
|
|
14
|
+
* Attention fonction non pure : la sduiDescriptor est modifiée en place.
|
|
15
|
+
* * La librarie de la sduiDescriptor est mise à jour avec celle présente dans SDUITransformDescription<br>
|
|
16
|
+
* Si des clefs de librairie correspondent, celles de SDUITransformDescription ecrasent celles existantes
|
|
17
|
+
* * Ensuite des actions de transformations sont menées sur les nodes du SDUIDescriptor
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
transform(sduiDescriptor, transformDescriptor) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
this.sduiDescriptor = sduiDescriptor;
|
|
23
|
+
if (this.sduiDescriptor.library) {
|
|
24
|
+
for (let key in transformDescriptor.library) {
|
|
25
|
+
this.sduiDescriptor.library[key] = transformDescriptor.library[key];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
for (let item of transformDescriptor.transforms) {
|
|
29
|
+
this.transformAction(item);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Effectue une actions de transformation sur les noeuds (nodes) de la sduiDescriptor (SDUIDescriptor)
|
|
35
|
+
* La des noeuds impacté est sélectionnée via pattern matching (voir SDUITransformAction.pattern et getNodesMatchingPatterns);
|
|
36
|
+
* Voir le détail des actions de transformations dns les fonctions appellées dans le switch.
|
|
37
|
+
*/
|
|
38
|
+
transformAction(transformAction) {
|
|
39
|
+
let uis = this.getNodesMatchingPatterns(transformAction.patterns, this.sduiDescriptor);
|
|
40
|
+
this[transformAction.action](transformAction, uis);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Retourne les noeuds du SDUIDescriptor qui matche la liste de patterns fournis, dans l'ordre des patterns fournis
|
|
44
|
+
*/
|
|
45
|
+
getNodesMatchingPatterns(patterns, node) {
|
|
46
|
+
if (!patterns)
|
|
47
|
+
return [];
|
|
48
|
+
if (!node)
|
|
49
|
+
return [];
|
|
50
|
+
let nodes = node.nodes;
|
|
51
|
+
if (!nodes)
|
|
52
|
+
return [];
|
|
53
|
+
let result = [];
|
|
54
|
+
let index = 0;
|
|
55
|
+
for (let pattern of patterns) {
|
|
56
|
+
for (let child of nodes) {
|
|
57
|
+
if (this.nodeMatchesPattern(pattern, child)) {
|
|
58
|
+
result.push({ parent: node, child: child, index: index });
|
|
59
|
+
}
|
|
60
|
+
result = result.concat(this.getNodesMatchingPatterns([pattern], child));
|
|
61
|
+
index++;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Utilisé pour voir si un élément du pattern match le même élement du noeud en cours de traitement
|
|
68
|
+
*/
|
|
69
|
+
stringMatchesExpression(stringToTest, regExpString) {
|
|
70
|
+
return !regExpString || (stringToTest && stringToTest.match(regExpString));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Return true si le pattern match avec le noeud, false sinon.
|
|
74
|
+
*/
|
|
75
|
+
nodeMatchesPattern(pattern, node) {
|
|
76
|
+
let patternDynamic = pattern;
|
|
77
|
+
let nodeDynamic = node;
|
|
78
|
+
let keys = ["libraryKey", "innerHTML", "prefix", "suffix", "markup"];
|
|
79
|
+
for (let key of keys) {
|
|
80
|
+
if (!this.stringMatchesExpression(nodeDynamic[key], patternDynamic[key])) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
let patternAttributes = pattern.attributes;
|
|
85
|
+
let nodeAttributes = node.attributes;
|
|
86
|
+
if (patternAttributes && !nodeAttributes)
|
|
87
|
+
return false;
|
|
88
|
+
if (patternAttributes) {
|
|
89
|
+
for (let name in patternAttributes) {
|
|
90
|
+
if (!this.stringMatchesExpression(nodeAttributes[name], patternAttributes[name])) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Pour chaque élément de la liste, remplace l'élément par ses enfants
|
|
99
|
+
*/
|
|
100
|
+
unWrap(transformAction, list) {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
transformAction;
|
|
103
|
+
for (let item of list) {
|
|
104
|
+
(_a = item.parent.nodes) === null || _a === void 0 ? void 0 : _a.splice(item.parent.nodes.indexOf(item.child), 1);
|
|
105
|
+
if (item.child.nodes) {
|
|
106
|
+
(_b = item.parent.nodes) === null || _b === void 0 ? void 0 : _b.splice(item.parent.nodes.indexOf(item.child), 0, ...item.child.nodes);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Regroupe tous les éléments de la liste dans l'élément fourni via la prop `ui` de transformAction
|
|
112
|
+
* L'élément créé est inséré en lieu et place du premier élément de la liste
|
|
113
|
+
*/
|
|
114
|
+
wrap(transformAction, list) {
|
|
115
|
+
var _a, _b, _c, _d, _e;
|
|
116
|
+
let wrapper = Object.assign({}, transformAction.ui);
|
|
117
|
+
if (!wrapper.nodes)
|
|
118
|
+
wrapper.nodes = [];
|
|
119
|
+
let i = 0;
|
|
120
|
+
for (let item of list) {
|
|
121
|
+
(_a = wrapper.nodes) === null || _a === void 0 ? void 0 : _a.push(item.child);
|
|
122
|
+
if (i > 0) {
|
|
123
|
+
(_b = item.parent.nodes) === null || _b === void 0 ? void 0 : _b.splice(item.parent.nodes.indexOf(item.child), 1);
|
|
124
|
+
}
|
|
125
|
+
i++;
|
|
126
|
+
}
|
|
127
|
+
let idx = (_c = list[0].parent.nodes) === null || _c === void 0 ? void 0 : _c.indexOf(list[0].child);
|
|
128
|
+
if (idx) {
|
|
129
|
+
(_d = list[0].parent.nodes) === null || _d === void 0 ? void 0 : _d.splice(idx, 1);
|
|
130
|
+
(_e = list[0].parent.nodes) === null || _e === void 0 ? void 0 : _e.splice(idx, 0, wrapper);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Déplace tous les noeuds de la liste avant ou après le noeuds sélectionné par pattern matching via l'attribut correspondant `before` ou `after`
|
|
135
|
+
*/
|
|
136
|
+
move(transformAction, list) {
|
|
137
|
+
var _a, _b;
|
|
138
|
+
for (let item of list) {
|
|
139
|
+
(_a = item.parent.nodes) === null || _a === void 0 ? void 0 : _a.splice(item.parent.nodes.indexOf(item.child), 1);
|
|
140
|
+
let positionType = transformAction.after ? "after" : "before";
|
|
141
|
+
let element = this.getNodesMatchingPatterns([transformAction[positionType]], this.sduiDescriptor)[0];
|
|
142
|
+
if (element) {
|
|
143
|
+
(_b = element.parent.nodes) === null || _b === void 0 ? void 0 : _b.splice(element.parent.nodes.indexOf(element.child) + (positionType == "after" ? 1 : 0), 0, item.child);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Transform ous les éléments fourni dans la liste en un élément créé a partir du model fourni dans ui.
|
|
149
|
+
* Les props attributs et autre props de chaque élément sont conservés si non remapés
|
|
150
|
+
*/
|
|
151
|
+
remap(transformAction, list) {
|
|
152
|
+
var _a, _b, _c;
|
|
153
|
+
console.log(list);
|
|
154
|
+
for (let item of list) {
|
|
155
|
+
let newUI = Object.assign({}, transformAction.ui);
|
|
156
|
+
if (!newUI.attributes) {
|
|
157
|
+
newUI.attributes = {};
|
|
158
|
+
}
|
|
159
|
+
let childAttributes = item.child.attributes;
|
|
160
|
+
if (childAttributes) {
|
|
161
|
+
for (let key in childAttributes) {
|
|
162
|
+
if (!newUI.attributes.hasOwnProperty("key"))
|
|
163
|
+
newUI.attributes[key] = childAttributes[key];
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
let keys = ["libraryKey", "innerHTML", "prefix", "suffix", "markup"];
|
|
167
|
+
let childDynamic = item.child;
|
|
168
|
+
let newUIDynamic = newUI;
|
|
169
|
+
for (let key of keys) {
|
|
170
|
+
if (!newUI.hasOwnProperty(key) && childDynamic[key])
|
|
171
|
+
newUIDynamic[key] = childDynamic[key];
|
|
172
|
+
}
|
|
173
|
+
if (!newUI.nodes) {
|
|
174
|
+
newUI.nodes = [];
|
|
175
|
+
}
|
|
176
|
+
let childNodes = item.child.nodes;
|
|
177
|
+
if (childNodes) {
|
|
178
|
+
for (let node of childNodes) {
|
|
179
|
+
newUI.nodes.push(node);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
let idx = ((_a = item.parent.nodes) === null || _a === void 0 ? void 0 : _a.indexOf(item.child)) || -1;
|
|
183
|
+
if (idx != -1) {
|
|
184
|
+
(_b = item.parent.nodes) === null || _b === void 0 ? void 0 : _b.splice(idx, 1);
|
|
185
|
+
(_c = item.parent.nodes) === null || _c === void 0 ? void 0 : _c.splice(idx, 0, newUI);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Supprime tous les éléments de la liste.
|
|
191
|
+
*/
|
|
192
|
+
delete(transformAction, list) {
|
|
193
|
+
var _a;
|
|
194
|
+
transformAction;
|
|
195
|
+
for (let item of list) {
|
|
196
|
+
(_a = item.parent.nodes) === null || _a === void 0 ? void 0 : _a.splice(item.parent.nodes.indexOf(item.child), 1);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Ajoute une copie de l'élément décrit dans la propriété ui de transformAction avant ou après chaque élément de la liste
|
|
201
|
+
* La positione st déterminée par l'attribute before ou after ou in qui est un pattern permettant la sélection de l'élément de référence pur l'ajout
|
|
202
|
+
*/
|
|
203
|
+
insert(transformAction, list) {
|
|
204
|
+
var _a;
|
|
205
|
+
list;
|
|
206
|
+
let positionType = transformAction.after ? "after" : transformAction.before ? "before" : "in";
|
|
207
|
+
let node = this.getNodesMatchingPatterns([transformAction[positionType]], this.sduiDescriptor)[0];
|
|
208
|
+
if (node) {
|
|
209
|
+
if (positionType == "in") {
|
|
210
|
+
if (!node.child.nodes)
|
|
211
|
+
node.child.nodes = [];
|
|
212
|
+
node.child.nodes.push(Object.assign({}, transformAction.ui));
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
(_a = node.parent.nodes) === null || _a === void 0 ? void 0 : _a.splice(node.parent.nodes.indexOf(node.child) + (positionType == "after" ? 1 : 0), 0, Object.assign({}, transformAction.ui));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
css?: Array<string>;
|
|
5
|
-
library?: Record<string, SDUINode>;
|
|
6
|
-
nodes?: Array<SDUINode>;
|
|
7
|
-
};
|
|
8
|
-
declare type SDUINode = {
|
|
9
|
-
library?: string;
|
|
10
|
-
markup?: string;
|
|
11
|
-
type?: string;
|
|
12
|
-
attributes: Record<string, string>;
|
|
13
|
-
nodes?: Array<SDUINode>;
|
|
14
|
-
innerHTML?: string;
|
|
15
|
-
prefix?: string;
|
|
16
|
-
suffix?: string;
|
|
17
|
-
};
|
|
18
|
-
declare const SonicComponent_base: {
|
|
2
|
+
import { SDUIDescriptor } from "@supersoniks/concorde/core/components/functional/sdui/types";
|
|
3
|
+
declare const SonicSDUI_base: {
|
|
19
4
|
new (...args: any[]): {
|
|
20
5
|
api: import("../../../utils/api").default | null;
|
|
21
6
|
key: String;
|
|
@@ -56,13 +41,84 @@ declare const SonicComponent_base: {
|
|
|
56
41
|
hasAttribute(attributeName: String): boolean;
|
|
57
42
|
};
|
|
58
43
|
} & (new (...args: any[]) => import("../../../mixins/Subscriber").SubscriberInterface) & typeof LitElement;
|
|
59
|
-
|
|
44
|
+
/**
|
|
45
|
+
* ### sonic-sdui (Server Driven User Interface) est un fetcher chargant un JSON décrivant une interface utilisateur
|
|
46
|
+
*
|
|
47
|
+
* Extends mixins : Fetcher, [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
|
|
48
|
+
*
|
|
49
|
+
* * Si le composant possède un attribut *fetch*, il charge un contenu via un appel d'api web.<br>
|
|
50
|
+
* Voir [fetcher](./?path=/docs/core-components-functional-fetch--basic) pour la configuration des autres attributs.
|
|
51
|
+
* * Le format du JSON est décrit par le type SDUIDescriptor
|
|
52
|
+
* * Un attribut supplémentaire `transformation` permet de transformer le json reçu avant la générationd e l'interface utilisateur<br>
|
|
53
|
+
* Son format est décrit par le type SDUITransformDescription
|
|
54
|
+
*
|
|
55
|
+
* * Si le résultat de la requête est un objet, il est imbriqué dans un tableau pour garantir le fonctionnement.<br>
|
|
56
|
+
* 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.
|
|
57
|
+
* * 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.
|
|
58
|
+
* * On peut appler la methode invalidate() sur son publishe pour declencher le rechargement des données
|
|
59
|
+
* *
|
|
60
|
+
*/
|
|
61
|
+
export declare class SonicSDUI extends SonicSDUI_base {
|
|
60
62
|
connectedCallback(): void;
|
|
63
|
+
/**
|
|
64
|
+
* On peut passer la description sous form de props, sinon il faut utiliser l'attribut fetch
|
|
65
|
+
*/
|
|
61
66
|
get props(): SDUIDescriptor;
|
|
62
|
-
loadJS(src: string): Promise<unknown>;
|
|
63
|
-
loadCSS(src: string): Promise<unknown>;
|
|
64
67
|
set props(value: SDUIDescriptor);
|
|
68
|
+
/**
|
|
69
|
+
* updateContents est déclenché quand les props sont renseignées
|
|
70
|
+
* Le contenu du composant est regénéré en fonction du descripteur fourni
|
|
71
|
+
*/
|
|
65
72
|
updateContents(): Promise<void>;
|
|
66
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Suppressiond du contenu du composant avant le génération de la nouvelle ui
|
|
75
|
+
*/
|
|
76
|
+
private removeChildren;
|
|
77
|
+
/**
|
|
78
|
+
* Chargement de fichiers js et css associés si besoin
|
|
79
|
+
**/
|
|
80
|
+
private loadAssets;
|
|
81
|
+
/**
|
|
82
|
+
* Transformation de la data fournie via props si il y a un attribut transformation
|
|
83
|
+
* */
|
|
84
|
+
private transformSDUIDescriptor;
|
|
85
|
+
/**
|
|
86
|
+
* Point d'entrée : transformation des noeuds fournis en éléments graphiques
|
|
87
|
+
**/
|
|
88
|
+
private parseRootNodes;
|
|
89
|
+
/**
|
|
90
|
+
* On parse un noeud ce qui crée un éléments graphique et ses enfants par recursivité via `handleChildNodes`
|
|
91
|
+
*/
|
|
92
|
+
private parseChild;
|
|
93
|
+
/**
|
|
94
|
+
* Si le noeud courant a des propriétés prefix et ou suffix il est entouré des markups fournis dans ces props.
|
|
95
|
+
* Le tout est inclu dans une div en display contents
|
|
96
|
+
*/
|
|
97
|
+
private handlePrefixSuffix;
|
|
98
|
+
/**
|
|
99
|
+
* Création des enfants du noeud courant
|
|
100
|
+
* 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.
|
|
101
|
+
*/
|
|
102
|
+
private handleChildNodes;
|
|
103
|
+
/**
|
|
104
|
+
* Gestion de librarie :
|
|
105
|
+
* * 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.
|
|
106
|
+
* * Sa propriété contentElement retournée vaut element par défaut.
|
|
107
|
+
* * Si contentElementSelector est definit, alors contentElement correspond à l'élément obtenu par selection css d'après la valeurs de contentElementSelector
|
|
108
|
+
* * Les éléments enfants seront ensuite ajoutés dans contentElement
|
|
109
|
+
*/
|
|
110
|
+
private handleLibrary;
|
|
111
|
+
/**
|
|
112
|
+
* Remplissage des attributs html avec les attributs fournis dans le noeud
|
|
113
|
+
*/
|
|
114
|
+
private handleAttributes;
|
|
115
|
+
/**
|
|
116
|
+
* Si une propriété markup est fournie, l'élément est créé à partir de la chaine html fournie avant d'être configuré
|
|
117
|
+
*/
|
|
118
|
+
private handleMarkup;
|
|
119
|
+
/**
|
|
120
|
+
* si le noeud à une propriété innerHTML, on l'ajout ay innerHTML de l'élément html en cours de création
|
|
121
|
+
*/
|
|
122
|
+
private handleInnerHTML;
|
|
67
123
|
}
|
|
68
124
|
export {};
|