@supersoniks/concorde 1.1.39 → 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/concorde-core.bundle.js +28 -21
- package/concorde-core.es.js +866 -483
- package/core/components/functional/fetch/fetch.d.ts +1 -0
- package/core/components/functional/list/list.d.ts +1 -0
- package/core/components/functional/queue/queue.d.ts +0 -3
- package/core/components/functional/queue/queue.js +1 -18
- 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 +78 -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/ui/alert/alert.d.ts +2 -2
- package/core/components/ui/alert/alert.js +19 -20
- package/core/components/ui/button/button.d.ts +1 -0
- package/core/components/ui/card/card-header.d.ts +1 -1
- package/core/components/ui/card/card-header.js +11 -10
- package/core/components/ui/divider/divider.js +3 -2
- package/core/components/ui/form/checkbox/checkbox.d.ts +2 -0
- package/core/components/ui/form/checkbox/checkbox.js +4 -2
- package/core/components/ui/form/fieldset/legend.js +5 -2
- package/core/components/ui/form/input/input.d.ts +15 -0
- package/core/components/ui/form/input/input.js +22 -4
- 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/select/select.js +7 -2
- package/core/components/ui/form/textarea/textarea.d.ts +1 -0
- package/core/components/ui/form/textarea/textarea.js +7 -2
- package/core/components/ui/ui.d.ts +2 -0
- package/core/components/ui/ui.js +2 -0
- package/core/mixins/Fetcher.d.ts +1 -0
- package/core/mixins/Fetcher.js +6 -2
- package/core/mixins/FormCheckable.d.ts +2 -3
- package/core/mixins/FormInput.d.ts +1 -0
- package/core/mixins/Subscriber.d.ts +1 -0
- package/core/mixins/Subscriber.js +10 -12
- package/core/utils/HTML.d.ts +8 -0
- package/core/utils/HTML.js +41 -0
- package/mixins.d.ts +3 -0
- package/package.json +9 -1
|
@@ -14,6 +14,7 @@ import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
|
|
|
14
14
|
import FormInput from "@supersoniks/concorde/core/mixins/FormInput";
|
|
15
15
|
import { classMap } from "lit/directives/class-map.js";
|
|
16
16
|
import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
|
|
17
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
17
18
|
/**
|
|
18
19
|
* ### Le composent sonic-input étend les mixins FormInput, FormElement et Subscriber
|
|
19
20
|
* **FormElement :**
|
|
@@ -42,6 +43,20 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
42
43
|
this.hasSuffix = ((_c = this.slotSuffixNodes) === null || _c === void 0 ? void 0 : _c.length) ? true : false;
|
|
43
44
|
this.hasPrefix = ((_d = this.slotPrefixNodes) === null || _d === void 0 ? void 0 : _d.length) ? true : false;
|
|
44
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
|
+
}
|
|
45
60
|
onSlotChange() {
|
|
46
61
|
this.requestUpdate();
|
|
47
62
|
}
|
|
@@ -49,7 +64,6 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
49
64
|
var _a;
|
|
50
65
|
if (!this.inlineContent)
|
|
51
66
|
return;
|
|
52
|
-
console.log("oypouaze");
|
|
53
67
|
(_a = this.input) === null || _a === void 0 ? void 0 : _a.focus();
|
|
54
68
|
}
|
|
55
69
|
render() {
|
|
@@ -57,9 +71,13 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
57
71
|
"has-prefix": this.hasPrefix,
|
|
58
72
|
"has-suffix": this.hasSuffix,
|
|
59
73
|
};
|
|
74
|
+
let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
|
|
60
75
|
return html `
|
|
61
76
|
<label for="form-element" class="${this.hasLabel ? "form-label" : "hidden"}"
|
|
62
|
-
>${this.label ? this.label : ""}<slot
|
|
77
|
+
>${this.label ? unsafeHTML(this.label + labelStarSuffix) : ""}<slot
|
|
78
|
+
name="label"
|
|
79
|
+
@slotchange=${this.onSlotChange}
|
|
80
|
+
></slot
|
|
63
81
|
></label>
|
|
64
82
|
|
|
65
83
|
<div @click=${this.inlineContentFocus} class="form-control ${classMap(slotClasses)}">
|
|
@@ -93,8 +111,8 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
|
93
111
|
<slot name="suffix" @slotchange=${this.onSlotChange}></slot>
|
|
94
112
|
</div>
|
|
95
113
|
</div>
|
|
96
|
-
<slot name="description" class="
|
|
97
|
-
${this.description ? html `${this.description}` : ""}
|
|
114
|
+
<slot name="description" class="${this.hasDescription ? "form-description" : "hidden"}">
|
|
115
|
+
${this.description ? html `${unsafeHTML(this.description)}` : ""}
|
|
98
116
|
</slot>
|
|
99
117
|
`;
|
|
100
118
|
}
|
|
@@ -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 {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement, nothing } from "lit";
|
|
8
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
9
|
+
import { Subscriber } from "@supersoniks/concorde/mixins";
|
|
10
|
+
import { PublisherManager } from "@supersoniks/concorde/utils";
|
|
11
|
+
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
12
|
+
const tagName = "sonic-password-helper"; // For Astro.build
|
|
13
|
+
console.log("HEY");
|
|
14
|
+
let SonicComponent = class SonicComponent extends Subscriber(LitElement) {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.minChars = 8;
|
|
18
|
+
this.hasNoChar = true;
|
|
19
|
+
this.hasEnoughChars = false;
|
|
20
|
+
this.hasMinuscule = false;
|
|
21
|
+
this.hasMajuscule = false;
|
|
22
|
+
this.hasNumber = false;
|
|
23
|
+
this.hasSpecialChar = false;
|
|
24
|
+
}
|
|
25
|
+
connectedCallback() {
|
|
26
|
+
super.connectedCallback();
|
|
27
|
+
if (this.name) {
|
|
28
|
+
this.checkValue = (v) => {
|
|
29
|
+
if (v) {
|
|
30
|
+
this.hasNoChar = v.length == 0;
|
|
31
|
+
this.hasEnoughChars = v.length > this.minChars;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.hasNoChar = true;
|
|
35
|
+
this.hasEnoughChars = false;
|
|
36
|
+
}
|
|
37
|
+
this.hasMinuscule = /[a-z]/.test(v);
|
|
38
|
+
this.hasMajuscule = /[A-Z]/.test(v);
|
|
39
|
+
this.hasNumber = /[0-9]/.test(v);
|
|
40
|
+
this.hasSpecialChar = /[!"#$%&'()*+,\-\.\/:;<=>?@[\]^_`{|}~]/.test(v);
|
|
41
|
+
};
|
|
42
|
+
PublisherManager.get(this.getAncestorAttributeValue("formDataProvider"))[this.name].onAssign(this.checkValue);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
disconnectedCallback() {
|
|
46
|
+
if (this.checkValue && this.name) {
|
|
47
|
+
PublisherManager.get(this.getAncestorAttributeValue("formDataProvider"))[this.name].offAssign(this.checkValue);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
getIcon(test) {
|
|
51
|
+
return test
|
|
52
|
+
? html `<sonic-icon library="heroicons" , name="face-smile"></sonic-icon>`
|
|
53
|
+
: html `<sonic-icon library="heroicons" , name="x-circle"></sonic-icon>`;
|
|
54
|
+
}
|
|
55
|
+
//TODO Multilangue
|
|
56
|
+
render() {
|
|
57
|
+
if (this.hasNoChar)
|
|
58
|
+
return nothing;
|
|
59
|
+
return html `
|
|
60
|
+
<div>Le mot de passe doit contenir au moins :</div>
|
|
61
|
+
<div>${this.getIcon(this.hasEnoughChars)} 8 caractères</div>
|
|
62
|
+
<div>${this.getIcon(this.hasMinuscule)} 1 minuscule</div>
|
|
63
|
+
<div>${this.getIcon(this.hasMajuscule)} 1 majuscule</div>
|
|
64
|
+
<div>${this.getIcon(this.hasNumber)} 1 chiffre</div>
|
|
65
|
+
<div>${this.getIcon(this.hasSpecialChar)} 1 caractère spécial parmi !"#$%&'()*+,-./:;<=>?@[]^_\`{|}~</div>
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
__decorate([
|
|
70
|
+
property()
|
|
71
|
+
], SonicComponent.prototype, "name", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
property()
|
|
74
|
+
], SonicComponent.prototype, "minChars", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
state()
|
|
77
|
+
], SonicComponent.prototype, "hasNoChar", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
state()
|
|
80
|
+
], SonicComponent.prototype, "hasEnoughChars", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
state()
|
|
83
|
+
], SonicComponent.prototype, "hasMinuscule", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
state()
|
|
86
|
+
], SonicComponent.prototype, "hasMajuscule", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
state()
|
|
89
|
+
], SonicComponent.prototype, "hasNumber", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
state()
|
|
92
|
+
], SonicComponent.prototype, "hasSpecialChar", void 0);
|
|
93
|
+
SonicComponent = __decorate([
|
|
94
|
+
customElement(tagName)
|
|
95
|
+
], SonicComponent);
|
|
96
|
+
export { SonicComponent };
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
sameValueAs?: string;
|
|
7
|
+
descriptionWhenEqual: string;
|
|
8
|
+
descriptionWhenNotEqual: string;
|
|
9
|
+
areEqual: boolean;
|
|
10
|
+
hasNoChar: boolean;
|
|
11
|
+
checkValue?: (v: string) => void;
|
|
12
|
+
connectedCallback(): void;
|
|
13
|
+
disconnectedCallback(): void;
|
|
14
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement, nothing } from "lit";
|
|
8
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
9
|
+
import { Subscriber } from "@supersoniks/concorde/mixins";
|
|
10
|
+
import { PublisherManager } from "@supersoniks/concorde/utils";
|
|
11
|
+
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
12
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
13
|
+
const tagName = "sonic-same-value-helper"; // For Astro.build
|
|
14
|
+
let SonicComponent = class SonicComponent extends Subscriber(LitElement) {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.descriptionWhenEqual = "Correspondance : oui";
|
|
18
|
+
this.descriptionWhenNotEqual = "Correspondance : non";
|
|
19
|
+
this.areEqual = false;
|
|
20
|
+
this.hasNoChar = true;
|
|
21
|
+
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
super.connectedCallback();
|
|
24
|
+
let formDataProvider = PublisherManager.get(this.getAncestorAttributeValue("formDataProvider"));
|
|
25
|
+
if (this.name && this.sameValueAs) {
|
|
26
|
+
this.checkValue = (v) => {
|
|
27
|
+
if (v)
|
|
28
|
+
this.hasNoChar = v.length == 0;
|
|
29
|
+
else
|
|
30
|
+
this.hasNoChar = true;
|
|
31
|
+
if (this.name && this.sameValueAs) {
|
|
32
|
+
this.areEqual = formDataProvider[this.name].get() == formDataProvider[this.sameValueAs].get();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
formDataProvider[this.name].onAssign(this.checkValue);
|
|
36
|
+
formDataProvider[this.sameValueAs].onAssign(this.checkValue);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
disconnectedCallback() {
|
|
40
|
+
if (this.checkValue && this.name && this.sameValueAs) {
|
|
41
|
+
let formDataProvider = PublisherManager.get(this.getAncestorAttributeValue("formDataProvider"));
|
|
42
|
+
formDataProvider[this.name].offAssign(this.checkValue);
|
|
43
|
+
formDataProvider[this.sameValueAs].offAssign(this.checkValue);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//TODO Multilangue
|
|
47
|
+
render() {
|
|
48
|
+
if (this.hasNoChar)
|
|
49
|
+
return nothing;
|
|
50
|
+
return html `
|
|
51
|
+
<span> ${this.areEqual ? unsafeHTML(this.descriptionWhenEqual) : unsafeHTML(this.descriptionWhenNotEqual)} </span>
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
__decorate([
|
|
56
|
+
property()
|
|
57
|
+
], SonicComponent.prototype, "name", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
property()
|
|
60
|
+
], SonicComponent.prototype, "sameValueAs", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
property()
|
|
63
|
+
], SonicComponent.prototype, "descriptionWhenEqual", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
property()
|
|
66
|
+
], SonicComponent.prototype, "descriptionWhenNotEqual", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
state()
|
|
69
|
+
], SonicComponent.prototype, "areEqual", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
state()
|
|
72
|
+
], SonicComponent.prototype, "hasNoChar", void 0);
|
|
73
|
+
SonicComponent = __decorate([
|
|
74
|
+
customElement(tagName)
|
|
75
|
+
], SonicComponent);
|
|
76
|
+
export { SonicComponent };
|
|
@@ -14,6 +14,7 @@ import { formControl } from "@supersoniks/concorde/core/components/ui/form/css/f
|
|
|
14
14
|
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
15
15
|
import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
|
|
16
16
|
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
17
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
17
18
|
/**
|
|
18
19
|
* #### FormElement :
|
|
19
20
|
* * La propriété value est remplie automatiquement a l'aide de l'attribut name renseigné, ceci en prenant la valeur de la propriété du même nom dans les données du dataprovider associé.
|
|
@@ -122,9 +123,13 @@ let Select = class Select extends FormElement(Subscriber(LitElement)) {
|
|
|
122
123
|
"has-prefix": this.hasPrefix,
|
|
123
124
|
"has-suffix": this.hasSuffix,
|
|
124
125
|
};
|
|
126
|
+
let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
|
|
125
127
|
return html `
|
|
126
128
|
<label for="form-element" class="${this.hasLabel ? "form-label" : "hidden"}"
|
|
127
|
-
>${this.label ? this.label : ""}<slot
|
|
129
|
+
>${this.label ? unsafeHTML(this.label + labelStarSuffix) : ""}<slot
|
|
130
|
+
name="label"
|
|
131
|
+
@slotchange=${this.onSlotChange}
|
|
132
|
+
></slot
|
|
128
133
|
></label>
|
|
129
134
|
|
|
130
135
|
<div class="form-control ${classMap(slotClasses)}">
|
|
@@ -155,7 +160,7 @@ let Select = class Select extends FormElement(Subscriber(LitElement)) {
|
|
|
155
160
|
</div>
|
|
156
161
|
|
|
157
162
|
<slot name="description" class=" ${this.hasDescription ? "form-description" : "hidden"}">
|
|
158
|
-
${this.description ? html `${this.description}` : ""}
|
|
163
|
+
${this.description ? html `${unsafeHTML(this.description)}` : ""}
|
|
159
164
|
</slot>
|
|
160
165
|
`;
|
|
161
166
|
}
|
|
@@ -36,6 +36,7 @@ declare const Textarea_base: {
|
|
|
36
36
|
noShadowDom: string | null;
|
|
37
37
|
debug: HTMLElement | null;
|
|
38
38
|
defferedDebug: boolean | null;
|
|
39
|
+
displayContents: boolean;
|
|
39
40
|
dispatchEvent(event: Event): void;
|
|
40
41
|
setAttribute(name: string, value: string): void;
|
|
41
42
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
@@ -12,6 +12,7 @@ import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
|
12
12
|
import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
|
|
13
13
|
import FormInput from "@supersoniks/concorde/core/mixins/FormInput";
|
|
14
14
|
import { customScroll } from "@supersoniks/concorde/core/components/ui/_css/scroll";
|
|
15
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
15
16
|
const tagName = "sonic-textarea";
|
|
16
17
|
let Textarea = class Textarea extends FormInput(FormElement(Subscriber(LitElement))) {
|
|
17
18
|
constructor() {
|
|
@@ -47,9 +48,13 @@ let Textarea = class Textarea extends FormInput(FormElement(Subscriber(LitElemen
|
|
|
47
48
|
textarea.reportValidity();
|
|
48
49
|
}
|
|
49
50
|
render() {
|
|
51
|
+
let labelStarSuffix = this.label && this.required && this.label.indexOf("*") == -1 ? " *" : "";
|
|
50
52
|
return html `
|
|
51
53
|
<label for="form-element" class="${this.hasLabel ? "form-label" : "hidden"}"
|
|
52
|
-
>${this.label ? this.label : ""}<slot
|
|
54
|
+
>${this.label ? unsafeHTML(this.label + labelStarSuffix) : ""}<slot
|
|
55
|
+
name="label"
|
|
56
|
+
@slotchange=${this.onSlotChange}
|
|
57
|
+
></slot
|
|
53
58
|
></label>
|
|
54
59
|
|
|
55
60
|
<div class="form-control">
|
|
@@ -76,7 +81,7 @@ ${this.value}</textarea
|
|
|
76
81
|
</div>
|
|
77
82
|
|
|
78
83
|
<slot name="description" class=" ${this.hasDescription ? "form-description" : "hidden"}">
|
|
79
|
-
${this.description ? html `${this.description}` : ""}
|
|
84
|
+
${this.description ? html `${unsafeHTML(this.description)}` : ""}
|
|
80
85
|
</slot>
|
|
81
86
|
`;
|
|
82
87
|
}
|
|
@@ -4,6 +4,8 @@ import "./button/button";
|
|
|
4
4
|
import "./link/link";
|
|
5
5
|
import "./progress/progress";
|
|
6
6
|
import "./form/input/input";
|
|
7
|
+
import "./form/input/password-helper";
|
|
8
|
+
import "./form/input/same-value-helper";
|
|
7
9
|
import "./form/checkbox/checkbox";
|
|
8
10
|
import "./form/radio/radio";
|
|
9
11
|
import "./form/select/select";
|
package/core/components/ui/ui.js
CHANGED
|
@@ -7,6 +7,8 @@ import "./link/link";
|
|
|
7
7
|
import "./progress/progress";
|
|
8
8
|
// FORMS
|
|
9
9
|
import "./form/input/input";
|
|
10
|
+
import "./form/input/password-helper";
|
|
11
|
+
import "./form/input/same-value-helper";
|
|
10
12
|
import "./form/checkbox/checkbox";
|
|
11
13
|
import "./form/radio/radio";
|
|
12
14
|
import "./form/select/select";
|
package/core/mixins/Fetcher.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface>>(superClass:
|
|
|
62
62
|
noShadowDom: string | null;
|
|
63
63
|
debug: HTMLElement | null;
|
|
64
64
|
defferedDebug: boolean | null;
|
|
65
|
+
displayContents: boolean;
|
|
65
66
|
dispatchEvent(event: Event): void;
|
|
66
67
|
setAttribute(name: string, value: string): void;
|
|
67
68
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
package/core/mixins/Fetcher.js
CHANGED
|
@@ -86,14 +86,18 @@ const Fetcher = (superClass) => {
|
|
|
86
86
|
Loader.show();
|
|
87
87
|
let headerData = PublisherManager.getInstance().get(this.getAncestorAttributeValue("headersDataProvider")).get();
|
|
88
88
|
data = yield this.api.get(this.endPoint || this.dataProvider || "", headerData);
|
|
89
|
-
//
|
|
90
|
-
if (!data
|
|
89
|
+
// Je garde ça mais normalement ça n'arrive jamais
|
|
90
|
+
if (!data) {
|
|
91
91
|
SonicToast.add({ text: "Network Error", status: "error" });
|
|
92
92
|
this.isLoading = false;
|
|
93
93
|
if (hasLoader)
|
|
94
94
|
Loader.hide();
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
+
// Si data ne contient que la réponse HTTP, avec un statut not ok, on affiche un message
|
|
98
|
+
else if (data._sonic_http_response_ && !data._sonic_http_response_.ok && Object.keys(data).length === 1) {
|
|
99
|
+
SonicToast.add({ text: "Network Error", status: "error" });
|
|
100
|
+
}
|
|
97
101
|
if (hasLoader)
|
|
98
102
|
Loader.hide();
|
|
99
103
|
if (this.key) {
|
|
@@ -57,6 +57,7 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
57
57
|
noShadowDom: string | null;
|
|
58
58
|
debug: HTMLElement | null;
|
|
59
59
|
defferedDebug: boolean | null;
|
|
60
|
+
displayContents: boolean;
|
|
60
61
|
dispatchEvent(event: Event): void;
|
|
61
62
|
setAttribute(name: string, value: string): void;
|
|
62
63
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
@@ -64,9 +65,7 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
64
65
|
removeAttribute(name: string): void;
|
|
65
66
|
getApiConfiguration(): import("../utils/api").APIConfiguration;
|
|
66
67
|
connectedCallback(): void;
|
|
67
|
-
requestUpdate(): void;
|
|
68
|
-
Active le mode radio
|
|
69
|
-
*/
|
|
68
|
+
requestUpdate(): void;
|
|
70
69
|
getAttribute(name: string): string;
|
|
71
70
|
hasAttribute(attributeName: String): boolean;
|
|
72
71
|
disconnectedCallback(): void;
|
|
@@ -42,6 +42,7 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
42
42
|
noShadowDom: string | null;
|
|
43
43
|
debug: HTMLElement | null;
|
|
44
44
|
defferedDebug: boolean | null;
|
|
45
|
+
displayContents: boolean;
|
|
45
46
|
dispatchEvent(event: Event): void;
|
|
46
47
|
setAttribute(name: string, value: string): void;
|
|
47
48
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
@@ -13,6 +13,7 @@ export interface SubscriberInterface {
|
|
|
13
13
|
noShadowDom: string | null;
|
|
14
14
|
debug: HTMLElement | null;
|
|
15
15
|
defferedDebug: boolean | null;
|
|
16
|
+
displayContents: boolean;
|
|
16
17
|
dispatchEvent(event: Event): void;
|
|
17
18
|
setAttribute(name: string, value: string): void;
|
|
18
19
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -46,6 +46,7 @@ const Subscriber = (superClass) => {
|
|
|
46
46
|
class SubscriberElement extends superClass {
|
|
47
47
|
constructor(...args) {
|
|
48
48
|
super();
|
|
49
|
+
this.displayContents = false;
|
|
49
50
|
/**
|
|
50
51
|
* noAutoFill permet de désactiver le remplissage automatique des propriétés par le publisher dans le cas ou on utilise "props" seulement ou le dataBinding par exemple
|
|
51
52
|
*/
|
|
@@ -130,18 +131,12 @@ const Subscriber = (superClass) => {
|
|
|
130
131
|
}
|
|
131
132
|
updated(_changedProperties) {
|
|
132
133
|
super.updated(_changedProperties);
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
else {
|
|
140
|
-
if (this.children.length == 0)
|
|
141
|
-
this.style.display = "none";
|
|
142
|
-
else
|
|
143
|
-
this.style.removeProperty("display");
|
|
144
|
-
}
|
|
134
|
+
let ref = this.shadowRoot || this;
|
|
135
|
+
let display = this.displayContents ? "contents" : ref.children.length == 0 ? "none" : null;
|
|
136
|
+
if (display)
|
|
137
|
+
this.style.display = display;
|
|
138
|
+
else
|
|
139
|
+
this.style.removeProperty("display");
|
|
145
140
|
}
|
|
146
141
|
connectedCallback() {
|
|
147
142
|
if (this.hasAttribute("lazyRendering")) {
|
|
@@ -359,6 +354,9 @@ const Subscriber = (superClass) => {
|
|
|
359
354
|
}
|
|
360
355
|
}
|
|
361
356
|
SubscriberElement.instanceCounter = 0;
|
|
357
|
+
__decorate([
|
|
358
|
+
property({ type: Boolean })
|
|
359
|
+
], SubscriberElement.prototype, "displayContents", void 0);
|
|
362
360
|
__decorate([
|
|
363
361
|
property({ type: Boolean })
|
|
364
362
|
], SubscriberElement.prototype, "noAutoFill", void 0);
|
package/core/utils/HTML.d.ts
CHANGED
|
@@ -10,5 +10,13 @@ declare class HTML {
|
|
|
10
10
|
* @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
|
|
11
11
|
*/
|
|
12
12
|
static getAncestorAttributeValue(node: any, attributeName: string): string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Lance le chargement d'un js et retourne une promise qui resoud à true lorsque le chargement à réussi et à false, sinon.
|
|
15
|
+
* */
|
|
16
|
+
static loadJS(src: string): Promise<unknown>;
|
|
17
|
+
/**
|
|
18
|
+
* Lance le chargement d'un css et retourne une promise qui resoud à true lorsque le chargement à réussi et à false, sinon.
|
|
19
|
+
* */
|
|
20
|
+
static loadCSS(src: string): Promise<unknown>;
|
|
13
21
|
}
|
|
14
22
|
export default HTML;
|
package/core/utils/HTML.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
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
|
+
};
|
|
1
10
|
class HTML {
|
|
2
11
|
/**
|
|
3
12
|
* retourne la langue de la page courante telle que défini via l'attribut lang de la balise html
|
|
@@ -29,5 +38,37 @@ class HTML {
|
|
|
29
38
|
}
|
|
30
39
|
return node.getAttribute(attributeName);
|
|
31
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Lance le chargement d'un js et retourne une promise qui resoud à true lorsque le chargement à réussi et à false, sinon.
|
|
43
|
+
* */
|
|
44
|
+
static loadJS(src) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const p = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
let script = document.createElement("script");
|
|
48
|
+
script.src = src;
|
|
49
|
+
script.onload = () => resolve(true);
|
|
50
|
+
script.onerror = () => resolve(true);
|
|
51
|
+
document.head.appendChild(script);
|
|
52
|
+
}));
|
|
53
|
+
return p;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Lance le chargement d'un css et retourne une promise qui resoud à true lorsque le chargement à réussi et à false, sinon.
|
|
58
|
+
* */
|
|
59
|
+
static loadCSS(src) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const p = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
var cssnode = document.createElement("link");
|
|
63
|
+
cssnode.type = "text/css";
|
|
64
|
+
cssnode.rel = "stylesheet";
|
|
65
|
+
cssnode.href = src;
|
|
66
|
+
cssnode.onload = () => resolve(true);
|
|
67
|
+
cssnode.onerror = () => resolve(true);
|
|
68
|
+
document.head.appendChild(cssnode);
|
|
69
|
+
}));
|
|
70
|
+
return p;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
32
73
|
}
|
|
33
74
|
export default HTML;
|
package/mixins.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare const Fetcher: <T extends new (...args: any[]) => mySubscriber.Su
|
|
|
26
26
|
noShadowDom: string | null;
|
|
27
27
|
debug: HTMLElement | null;
|
|
28
28
|
defferedDebug: boolean | null;
|
|
29
|
+
displayContents: boolean;
|
|
29
30
|
dispatchEvent(event: Event): void;
|
|
30
31
|
setAttribute(name: string, value: string): void;
|
|
31
32
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
@@ -74,6 +75,7 @@ export declare const FormCheckable: <T extends new (...args: any[]) => myFormEle
|
|
|
74
75
|
noShadowDom: string | null;
|
|
75
76
|
debug: HTMLElement | null;
|
|
76
77
|
defferedDebug: boolean | null;
|
|
78
|
+
displayContents: boolean;
|
|
77
79
|
dispatchEvent(event: Event): void;
|
|
78
80
|
setAttribute(name: string, value: string): void;
|
|
79
81
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
@@ -126,6 +128,7 @@ export declare const FormInput: <T extends new (...args: any[]) => myFormElement
|
|
|
126
128
|
noShadowDom: string | null;
|
|
127
129
|
debug: HTMLElement | null;
|
|
128
130
|
defferedDebug: boolean | null;
|
|
131
|
+
displayContents: boolean;
|
|
129
132
|
dispatchEvent(event: Event): void;
|
|
130
133
|
setAttribute(name: string, value: string): void;
|
|
131
134
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supersoniks/concorde",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.41",
|
|
4
4
|
"customElements": "custom-elements.json",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -46,8 +46,12 @@
|
|
|
46
46
|
"./functional/router/redirect": "./core/components/functional/router/redirect.js",
|
|
47
47
|
"./core/components/functional/router/router": "./core/components/functional/router/router.js",
|
|
48
48
|
"./functional/router": "./core/components/functional/router/router.js",
|
|
49
|
+
"./core/components/functional/sdui/SDUIDescriptorTransformer": "./core/components/functional/sdui/SDUIDescriptorTransformer.js",
|
|
50
|
+
"./functional/sdui/SDUIDescriptorTransformer": "./core/components/functional/sdui/SDUIDescriptorTransformer.js",
|
|
49
51
|
"./core/components/functional/sdui/sdui": "./core/components/functional/sdui/sdui.js",
|
|
50
52
|
"./functional/sdui": "./core/components/functional/sdui/sdui.js",
|
|
53
|
+
"./core/components/functional/sdui/types": "./core/components/functional/sdui/types.js",
|
|
54
|
+
"./functional/sdui/types": "./core/components/functional/sdui/types.js",
|
|
51
55
|
"./core/components/functional/sonic-scope/sonic-scope": "./core/components/functional/sonic-scope/sonic-scope.js",
|
|
52
56
|
"./functional/sonic-scope": "./core/components/functional/sonic-scope/sonic-scope.js",
|
|
53
57
|
"./core/components/functional/states/states": "./core/components/functional/states/states.js",
|
|
@@ -98,6 +102,10 @@
|
|
|
98
102
|
"./ui/form/form-layout": "./core/components/ui/form/form-layout/form-layout.js",
|
|
99
103
|
"./core/components/ui/form/input/input": "./core/components/ui/form/input/input.js",
|
|
100
104
|
"./ui/form/input": "./core/components/ui/form/input/input.js",
|
|
105
|
+
"./core/components/ui/form/input/password-helper": "./core/components/ui/form/input/password-helper.js",
|
|
106
|
+
"./ui/form/input/password-helper": "./core/components/ui/form/input/password-helper.js",
|
|
107
|
+
"./core/components/ui/form/input/same-value-helper": "./core/components/ui/form/input/same-value-helper.js",
|
|
108
|
+
"./ui/form/input/same-value-helper": "./core/components/ui/form/input/same-value-helper.js",
|
|
101
109
|
"./core/components/ui/form/radio/radio": "./core/components/ui/form/radio/radio.js",
|
|
102
110
|
"./ui/form/radio": "./core/components/ui/form/radio/radio.js",
|
|
103
111
|
"./core/components/ui/form/select/select": "./core/components/ui/form/select/select.js",
|