@supersoniks/concorde 1.1.30 → 1.1.31
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/concorde-core.bundle.js +23 -22
- package/concorde-core.es.js +22 -21
- package/core/components/functional/date/date.js +8 -2
- package/core/components/functional/list/list.js +17 -11
- package/core/components/functional/submit/submit.js +46 -30
- package/core/components/ui/_css/size.js +24 -24
- package/core/components/ui/alert/alert.js +1 -1
- package/core/components/ui/captcha/captcha.d.ts +16 -0
- package/core/components/ui/captcha/captcha.js +54 -0
- package/core/components/ui/form/checkbox/checkbox.d.ts +40 -2
- package/core/components/ui/taxonomy/taxonomy.js +2 -1
- 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.d.ts +1 -0
- package/core/components/ui/theme/theme.js +5 -1
- package/core/components/ui/toast/toast-item.js +24 -6
- package/core/components/ui/toast/toast.js +6 -2
- package/core/components/ui/ui.d.ts +1 -0
- package/core/components/ui/ui.js +1 -0
- package/core/mixins/Fetcher.js +4 -0
- package/core/mixins/FormCheckable.d.ts +0 -3
- package/core/mixins/FormInput.d.ts +0 -4
- package/core/utils/PublisherProxy.d.mts +1 -1
- package/core/utils/PublisherProxy.mjs +3 -3
- package/core/utils/api.js +4 -2
- package/package.json +3 -1
|
@@ -57,13 +57,17 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
|
|
|
57
57
|
* Retourne un tableau des différentes parties de la date en fonction des options données, de la date de début et de fin.
|
|
58
58
|
*/
|
|
59
59
|
getDatesParts(start_date, end_date, options) {
|
|
60
|
-
const format = new Intl.DateTimeFormat(this.language || this.pageLanguage, options);
|
|
61
60
|
let start = this.startDateObject;
|
|
62
61
|
start.setTime(start_date * 1000);
|
|
63
62
|
let parts = null;
|
|
64
63
|
if (end_date > 0) {
|
|
65
64
|
let end = this.endDateObject;
|
|
66
65
|
end.setTime(end_date * 1000);
|
|
66
|
+
if (start.toJSON().substring(0, 10) != end.toJSON().substring(0, 10)) {
|
|
67
|
+
delete options.hour;
|
|
68
|
+
delete options.minute;
|
|
69
|
+
}
|
|
70
|
+
let format = new Intl.DateTimeFormat(this.language || this.pageLanguage, options);
|
|
67
71
|
parts = format.formatRangeToParts(start, end);
|
|
68
72
|
if (this.designMode) {
|
|
69
73
|
for (let part of parts) {
|
|
@@ -85,8 +89,10 @@ let SonicDate = class SonicDate extends Subscriber(TemplatesContainer(LitElement
|
|
|
85
89
|
parts.unshift({ type: "from", value: this.duAu[0] + " ", source: "shared" });
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
|
-
else
|
|
92
|
+
else {
|
|
93
|
+
let format = new Intl.DateTimeFormat(this.language || this.pageLanguage, options);
|
|
89
94
|
parts = format.formatToParts(start);
|
|
95
|
+
}
|
|
90
96
|
parts[0].value = Format.ucFirst(parts[0].value);
|
|
91
97
|
parts = parts.filter((p) => p.hidden !== true);
|
|
92
98
|
return parts;
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html, LitElement, css } from "lit";
|
|
7
|
+
import { html, LitElement, css, nothing } from "lit";
|
|
8
8
|
import { customElement, property } from "lit/decorators.js";
|
|
9
9
|
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
10
10
|
import Fetcher from "@supersoniks/concorde/core/mixins/Fetcher";
|
|
@@ -18,7 +18,7 @@ import TemplatesContainer from "@supersoniks/concorde/core/mixins/TemplatesConta
|
|
|
18
18
|
/**
|
|
19
19
|
* ### List boucle sur sa propriété "props" et crée des éléments a partir des données en bouclant également sur ses templates.
|
|
20
20
|
*
|
|
21
|
-
* Extends mixins : Fetcher, [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
|
|
21
|
+
* Extends mixins : Fetcher, [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
|
|
22
22
|
*
|
|
23
23
|
* * Si le composant possède un attribut *fetch*, il charge un contenu via un appel d'api web.<br>
|
|
24
24
|
* Voir [fetcher](./?path=/docs/core-components-functional-fetch--basic) pour la configuration des autres attributs.
|
|
@@ -62,14 +62,13 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
62
62
|
: html `<sonic-loader mode="inline"></sonic-loader>`;
|
|
63
63
|
}
|
|
64
64
|
renderNoResultState() {
|
|
65
|
-
return html `
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
><span class="sonic-no-result-text">${this.props}</span>
|
|
69
|
-
</div>`;
|
|
65
|
+
return html ` <div class="sonic-no-result-container">
|
|
66
|
+
<sonic-icon name="emoji-puzzled" size="lg"></sonic-icon><span class="sonic-no-result-text">${this.props}</span>
|
|
67
|
+
</div>`;
|
|
70
68
|
}
|
|
71
69
|
formatProps() {
|
|
72
70
|
let props = this.props;
|
|
71
|
+
let response = props._sonic_http_response_;
|
|
73
72
|
let extractValues = this.hasAttribute("extractValues");
|
|
74
73
|
//si props n'est pas un tableau on l'adapte
|
|
75
74
|
if (!Array.isArray(props)) {
|
|
@@ -77,9 +76,14 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
77
76
|
props = Object.entries(props).map(([k, v]) => ({ key: k, value: v }));
|
|
78
77
|
}
|
|
79
78
|
else {
|
|
80
|
-
|
|
79
|
+
if (!response || response.ok)
|
|
80
|
+
props = [props];
|
|
81
|
+
else {
|
|
82
|
+
props = [];
|
|
83
|
+
}
|
|
81
84
|
}
|
|
82
85
|
}
|
|
86
|
+
props._sonic_http_response_ = response;
|
|
83
87
|
return props;
|
|
84
88
|
}
|
|
85
89
|
render() {
|
|
@@ -121,12 +125,14 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
121
125
|
${repeat(props, (item, index) => item[this.idKey] || index, (item, index) => {
|
|
122
126
|
let templatePartName = item[this.templateKey];
|
|
123
127
|
let hasCustomTemplate = templatePartName && this.templateParts[templatePartName];
|
|
124
|
-
counter++;
|
|
125
|
-
if (hasCustomTemplate)
|
|
126
|
-
counter = -1;
|
|
127
128
|
let key = extractValues ? item.key : index;
|
|
129
|
+
if (key == "_sonic_http_response_")
|
|
130
|
+
return nothing;
|
|
128
131
|
let pub = this.publisher[key];
|
|
129
132
|
pub._key_ = key + "";
|
|
133
|
+
counter++;
|
|
134
|
+
if (hasCustomTemplate)
|
|
135
|
+
counter = -1;
|
|
130
136
|
return (item &&
|
|
131
137
|
html `
|
|
132
138
|
<sonic-subscriber
|
|
@@ -55,16 +55,17 @@ let Submit = class Submit extends Subscriber(LitElement) {
|
|
|
55
55
|
this.api = new API(this.getApiConfiguration());
|
|
56
56
|
}
|
|
57
57
|
submit() {
|
|
58
|
-
var _a
|
|
58
|
+
var _a;
|
|
59
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
60
|
const formPublisher = PublisherManager.getInstance().get(this.getAncestorAttributeValue("formDataProvider"));
|
|
61
61
|
//
|
|
62
|
-
// Validation du formulaire
|
|
62
|
+
// Validation du formulaire
|
|
63
63
|
formPublisher.isFormValid = true;
|
|
64
64
|
formPublisher.invalidate();
|
|
65
65
|
if (!formPublisher.isFormValid.get())
|
|
66
66
|
return;
|
|
67
|
-
this.publisher
|
|
67
|
+
if (this.publisher)
|
|
68
|
+
this.publisher.disabled = true;
|
|
68
69
|
formPublisher.isFormValid;
|
|
69
70
|
//
|
|
70
71
|
//Recup données
|
|
@@ -76,34 +77,49 @@ let Submit = class Submit extends Subscriber(LitElement) {
|
|
|
76
77
|
let dataProvider = this.getAncestorAttributeValue("dataProvider");
|
|
77
78
|
let endPoint = this.endPoint || dataProvider;
|
|
78
79
|
Loader.show();
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
80
|
+
let sendData = () => __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
var _b, _c, _d, _e;
|
|
82
|
+
//
|
|
83
|
+
//envoi données
|
|
84
|
+
switch (method) {
|
|
85
|
+
case "put":
|
|
86
|
+
result = yield ((_b = this.api) === null || _b === void 0 ? void 0 : _b.put(endPoint, postData, headerData));
|
|
87
|
+
break;
|
|
88
|
+
case "delete":
|
|
89
|
+
result = yield ((_c = this.api) === null || _c === void 0 ? void 0 : _c.delete(endPoint, postData, headerData));
|
|
90
|
+
break;
|
|
91
|
+
case "get":
|
|
92
|
+
result = yield ((_d = this.api) === null || _d === void 0 ? void 0 : _d.get(endPoint, headerData));
|
|
93
|
+
break;
|
|
94
|
+
default:
|
|
95
|
+
result = yield ((_e = this.api) === null || _e === void 0 ? void 0 : _e.post(endPoint, postData, headerData));
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
Loader.hide();
|
|
99
|
+
//Je garde ça, mais normalement il y a toujours quelquechose
|
|
100
|
+
if (!result)
|
|
101
|
+
result = { messages: [{ content: "Network Error", status: "error" }] };
|
|
102
|
+
let clearedDataProvider = this.getAncestorAttributeValue("clearedDataOnSuccess");
|
|
103
|
+
if (clearedDataProvider) {
|
|
104
|
+
clearedDataProvider.split(" ").forEach((dataProvider) => PublisherManager.get(dataProvider).set({}));
|
|
105
|
+
}
|
|
106
|
+
if (this.submitResultKey) {
|
|
107
|
+
result = Objects.traverse(result, this.submitResultKey.split("."), true);
|
|
108
|
+
}
|
|
109
|
+
PublisherManager.getInstance().get(this.getAncestorAttributeValue("submitResultDataProvider")).set(result);
|
|
110
|
+
if (this.publisher)
|
|
111
|
+
this.publisher.disabled = false;
|
|
112
|
+
});
|
|
113
|
+
if (formPublisher.needsCaptchaValidation.get()) {
|
|
114
|
+
formPublisher.captchaToken = "request_token";
|
|
115
|
+
formPublisher.captchaToken.onAssign((token) => {
|
|
116
|
+
if (token != "request_token")
|
|
117
|
+
sendData();
|
|
118
|
+
});
|
|
101
119
|
}
|
|
102
|
-
|
|
103
|
-
|
|
120
|
+
else {
|
|
121
|
+
sendData();
|
|
104
122
|
}
|
|
105
|
-
PublisherManager.getInstance().get(this.getAncestorAttributeValue("submitResultDataProvider")).set(result);
|
|
106
|
-
this.publisher.disabled = false;
|
|
107
123
|
});
|
|
108
124
|
}
|
|
109
125
|
render() {
|
|
@@ -111,7 +127,7 @@ let Submit = class Submit extends Subscriber(LitElement) {
|
|
|
111
127
|
}
|
|
112
128
|
};
|
|
113
129
|
Submit.styles = css `
|
|
114
|
-
[data-disabled]{
|
|
130
|
+
[data-disabled] {
|
|
115
131
|
opacity: 0.3;
|
|
116
132
|
pointer-events: none;
|
|
117
133
|
user-select: none;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { css } from "lit";
|
|
2
|
-
export const fontSize = css `
|
|
3
|
-
/*SIZES*/
|
|
4
|
-
:host {
|
|
5
|
-
--sc-fs: 1rem;
|
|
6
|
-
font-size: var(--sc-fs);
|
|
7
|
-
}
|
|
8
|
-
:host([size="2xs"]) {
|
|
9
|
-
--sc-fs: 0.68rem;
|
|
10
|
-
}
|
|
11
|
-
:host([size="xs"]) {
|
|
12
|
-
--sc-fs: 0.75rem;
|
|
13
|
-
}
|
|
14
|
-
:host([size="sm"]) {
|
|
15
|
-
--sc-fs: 0.875rem;
|
|
16
|
-
}
|
|
17
|
-
:host([size="lg"]) {
|
|
18
|
-
--sc-fs: 1.125rem;
|
|
19
|
-
}
|
|
20
|
-
:host([size="xl"]) {
|
|
21
|
-
--sc-fs: 1.25rem;
|
|
22
|
-
}
|
|
23
|
-
:host([size="2xl"]) {
|
|
24
|
-
--sc-fs: 1.5rem;
|
|
25
|
-
}
|
|
2
|
+
export const fontSize = css `
|
|
3
|
+
/*SIZES*/
|
|
4
|
+
:host {
|
|
5
|
+
--sc-fs: 1rem;
|
|
6
|
+
font-size: var(--sc-fs);
|
|
7
|
+
}
|
|
8
|
+
:host([size="2xs"]) {
|
|
9
|
+
--sc-fs: 0.68rem;
|
|
10
|
+
}
|
|
11
|
+
:host([size="xs"]) {
|
|
12
|
+
--sc-fs: 0.75rem;
|
|
13
|
+
}
|
|
14
|
+
:host([size="sm"]) {
|
|
15
|
+
--sc-fs: 0.875rem;
|
|
16
|
+
}
|
|
17
|
+
:host([size="lg"]) {
|
|
18
|
+
--sc-fs: 1.125rem;
|
|
19
|
+
}
|
|
20
|
+
:host([size="xl"]) {
|
|
21
|
+
--sc-fs: 1.25rem;
|
|
22
|
+
}
|
|
23
|
+
:host([size="2xl"]) {
|
|
24
|
+
--sc-fs: 1.5rem;
|
|
25
|
+
}
|
|
26
26
|
`;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
declare const Captcha_base: (new (...args: any[]) => import("../../../mixins/Subscriber").SubscriberInterface) & typeof LitElement;
|
|
3
|
+
/**
|
|
4
|
+
* Un bouton simple avec deux slots, un nommé préfix et un nomé suffix de manière à pouvoir mettre (par exemple) une icone avant ou après le contenu.
|
|
5
|
+
* * L'objet et ses slot sont en display flex avec direction / alignement et justifications configurables
|
|
6
|
+
* * Le bouton est comparable au badge car il possèdent tous les deux les propriétés *type* (primary...), *variant*(outline, ghost), size(xs...)...
|
|
7
|
+
* * Le bouton possède cependant et notamment une propriété href contrairement à un badge
|
|
8
|
+
*/
|
|
9
|
+
export declare class Captcha extends Captcha_base {
|
|
10
|
+
key: string;
|
|
11
|
+
formPublisher: any;
|
|
12
|
+
connectedCallback(): void;
|
|
13
|
+
requestToken(): void;
|
|
14
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
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 { Subscriber } from "@supersoniks/concorde/mixins";
|
|
8
|
+
import { PublisherManager } from "@supersoniks/concorde/utils";
|
|
9
|
+
import { html, LitElement } from "lit";
|
|
10
|
+
import { customElement, property } from "lit/decorators.js";
|
|
11
|
+
const tagName = "sonic-captcha";
|
|
12
|
+
/**
|
|
13
|
+
* Un bouton simple avec deux slots, un nommé préfix et un nomé suffix de manière à pouvoir mettre (par exemple) une icone avant ou après le contenu.
|
|
14
|
+
* * L'objet et ses slot sont en display flex avec direction / alignement et justifications configurables
|
|
15
|
+
* * Le bouton est comparable au badge car il possèdent tous les deux les propriétés *type* (primary...), *variant*(outline, ghost), size(xs...)...
|
|
16
|
+
* * Le bouton possède cependant et notamment une propriété href contrairement à un badge
|
|
17
|
+
*/
|
|
18
|
+
let Captcha = class Captcha extends Subscriber(LitElement) {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.key = "";
|
|
22
|
+
}
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
const script = document.createElement("script");
|
|
25
|
+
script.src = "https://www.google.com/recaptcha/api.js?render=" + this.key;
|
|
26
|
+
document.head.appendChild(script);
|
|
27
|
+
super.connectedCallback();
|
|
28
|
+
this.formPublisher = PublisherManager.get(this.getAncestorAttributeValue("formDataProvider"));
|
|
29
|
+
this.formPublisher.needsCaptchaValidation = true;
|
|
30
|
+
this.formPublisher.captchaToken.onAssign((v) => {
|
|
31
|
+
if (v == "request_token") {
|
|
32
|
+
this.requestToken();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
requestToken() {
|
|
37
|
+
const win = window;
|
|
38
|
+
win.grecaptcha.ready(() => {
|
|
39
|
+
win.grecaptcha.execute(this.key, { action: "submit" }).then((token) => {
|
|
40
|
+
this.formPublisher.captchaToken = token;
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
return html ` <slot></slot> `;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
__decorate([
|
|
49
|
+
property()
|
|
50
|
+
], Captcha.prototype, "key", void 0);
|
|
51
|
+
Captcha = __decorate([
|
|
52
|
+
customElement(tagName)
|
|
53
|
+
], Captcha);
|
|
54
|
+
export { Captcha };
|
|
@@ -24,7 +24,26 @@ declare const Checkbox_base: {
|
|
|
24
24
|
required: boolean;
|
|
25
25
|
disabled: true | null;
|
|
26
26
|
formDataProvider: string;
|
|
27
|
-
props: any;
|
|
27
|
+
props: any; /**
|
|
28
|
+
* ### Le composent sonic-checkbox étend les mixins FormCheckable, FormInput, FormElement et Subscriber
|
|
29
|
+
* **FormElement :**
|
|
30
|
+
* * 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é.
|
|
31
|
+
* * Par défault lorsque modifie l'input, la valeur est également mise à jour via le même dataprovider
|
|
32
|
+
* * On peut cependant décider de mettre à jour la donnée à une autre adresse en renseigne l'attribut *formDataProvider*.
|
|
33
|
+
* * Par conséquent on peut par exemple le lier à un composant *queue* (via sa propriété *dataFilterProvider*) de manière à appeller en auto une api avec des filtres.
|
|
34
|
+
* * **FormInput **
|
|
35
|
+
* Uniquement des propriétés classiques d'un input HTML. La prise en compte est ici partielle, par exemple les propriétés *placeholder*, *readonly*, *pattern*, *min* et *max* n'ont pas de sens pour un checkbox.
|
|
36
|
+
* **FormCheckable :**
|
|
37
|
+
* * La propriété checked mise à true si la valeur de la propriété du même nom dans les données du dataprovider associé contient un propriété checked.
|
|
38
|
+
* **Comportements :**
|
|
39
|
+
* * multiple (par défaut):
|
|
40
|
+
* - on peut cocher plusieurs checkbox ayant le même *name*.
|
|
41
|
+
* - la valeur enregistrée dans la propriété nommé du même nom dans formDataProvider est un tableau avec les *value* des cases cochées ayant le même *name*.
|
|
42
|
+
* * unique (Ajouter l'attribute unique au composant a l'intégration):
|
|
43
|
+
* - on ne peut cocher qu'une seule checkbox ayant le même *name*.
|
|
44
|
+
* * radio (Ajouter l'attribute radio au composant a l'intégration):
|
|
45
|
+
* Comme unique, mais on ne peut pas décocher la case sauf en en cochant une autre, comme un bouton radio.
|
|
46
|
+
*/
|
|
28
47
|
isConnected: boolean;
|
|
29
48
|
getAncestorAttributeValue(attributeName: string): string;
|
|
30
49
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
@@ -66,7 +85,26 @@ declare const Checkbox_base: {
|
|
|
66
85
|
value: any;
|
|
67
86
|
_name: string;
|
|
68
87
|
name: string;
|
|
69
|
-
props: any;
|
|
88
|
+
props: any; /**
|
|
89
|
+
* ### Le composent sonic-checkbox étend les mixins FormCheckable, FormInput, FormElement et Subscriber
|
|
90
|
+
* **FormElement :**
|
|
91
|
+
* * 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é.
|
|
92
|
+
* * Par défault lorsque modifie l'input, la valeur est également mise à jour via le même dataprovider
|
|
93
|
+
* * On peut cependant décider de mettre à jour la donnée à une autre adresse en renseigne l'attribut *formDataProvider*.
|
|
94
|
+
* * Par conséquent on peut par exemple le lier à un composant *queue* (via sa propriété *dataFilterProvider*) de manière à appeller en auto une api avec des filtres.
|
|
95
|
+
* * **FormInput **
|
|
96
|
+
* Uniquement des propriétés classiques d'un input HTML. La prise en compte est ici partielle, par exemple les propriétés *placeholder*, *readonly*, *pattern*, *min* et *max* n'ont pas de sens pour un checkbox.
|
|
97
|
+
* **FormCheckable :**
|
|
98
|
+
* * La propriété checked mise à true si la valeur de la propriété du même nom dans les données du dataprovider associé contient un propriété checked.
|
|
99
|
+
* **Comportements :**
|
|
100
|
+
* * multiple (par défaut):
|
|
101
|
+
* - on peut cocher plusieurs checkbox ayant le même *name*.
|
|
102
|
+
* - la valeur enregistrée dans la propriété nommé du même nom dans formDataProvider est un tableau avec les *value* des cases cochées ayant le même *name*.
|
|
103
|
+
* * unique (Ajouter l'attribute unique au composant a l'intégration):
|
|
104
|
+
* - on ne peut cocher qu'une seule checkbox ayant le même *name*.
|
|
105
|
+
* * radio (Ajouter l'attribute radio au composant a l'intégration):
|
|
106
|
+
* Comme unique, mais on ne peut pas décocher la case sauf en en cochant une autre, comme un bouton radio.
|
|
107
|
+
*/
|
|
70
108
|
isConnected: boolean;
|
|
71
109
|
getAncestorAttributeValue(attributeName: string): string;
|
|
72
110
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
@@ -10,6 +10,7 @@ import { repeat } from "lit/directives/repeat.js";
|
|
|
10
10
|
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
11
11
|
import "@supersoniks/concorde/core/components/ui/badge/badge";
|
|
12
12
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
13
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
13
14
|
const tagName = "sonic-taxonomy";
|
|
14
15
|
/**
|
|
15
16
|
* Le composant taxonomy crée un badge (*sonic-badge*) contenant une liste de termes préfixés par une icone (*sonic-icon*) optionelle séparées par une chaine html séparatrice (*separator*)
|
|
@@ -61,7 +62,7 @@ let Taxonomy = class Taxonomy extends LitElement {
|
|
|
61
62
|
this.style.removeProperty("display");
|
|
62
63
|
return html `
|
|
63
64
|
<sonic-badge type=${this.type} variant=${this.variant} size=${this.size}>
|
|
64
|
-
<sonic-icon slot="prefix"
|
|
65
|
+
<sonic-icon slot="prefix" library=${ifDefined(this.icon.library)} prefix=${ifDefined(this.icon.prefix)} name=${ifDefined(this.icon.name)} ></sonic-icon>
|
|
65
66
|
<span class="taxonomy-list">
|
|
66
67
|
${repeat(taxo, (item) => item[this.key + "_id"], (item) => {
|
|
67
68
|
return html `<span> ${item[this.key + "_name"]}</span
|
|
File without changes
|
|
File without changes
|
|
@@ -5,11 +5,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
var Theme_1;
|
|
8
|
-
import { html, LitElement, css } from "lit";
|
|
8
|
+
import { html, LitElement, css, unsafeCSS } from "lit";
|
|
9
9
|
import { customElement, property } from "lit/decorators.js";
|
|
10
10
|
import { coreVariables } from "@supersoniks/concorde/core/components/ui/theme/theme-collection/core-variables";
|
|
11
11
|
import { light } from "@supersoniks/concorde/core/components/ui/theme/theme-collection/light";
|
|
12
12
|
import { dark } from "@supersoniks/concorde/core/components/ui/theme/theme-collection/dark";
|
|
13
|
+
import tailwindImport from "./css/tailwind.css?inline";
|
|
14
|
+
export const tailwind = css `
|
|
15
|
+
${unsafeCSS(tailwindImport)}
|
|
16
|
+
`;
|
|
13
17
|
const tagName = "sonic-theme";
|
|
14
18
|
let Theme = Theme_1 = class Theme extends LitElement {
|
|
15
19
|
constructor() {
|
|
@@ -46,7 +46,7 @@ let SonicToastItem = class SonicToastItem extends LitElement {
|
|
|
46
46
|
>
|
|
47
47
|
|
|
48
48
|
<button aria-label="Close" class="sonic-toast-close" @click=${() => this.hide()}>
|
|
49
|
-
|
|
49
|
+
<sonic-icon name="cancel" size="lg"></sonic-icon>
|
|
50
50
|
</button>
|
|
51
51
|
<div class="sonic-toast-content custom-scroll" style="max-height: ${this.maxHeight} ;">
|
|
52
52
|
|
|
@@ -55,8 +55,8 @@ let SonicToastItem = class SonicToastItem extends LitElement {
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
<div class="sonic-toast-text">
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
${this.title ? html `<div class="sonic-toast-title">${this.title}</div>` : ""}
|
|
59
|
+
${this.text ? unsafeHTML(this.text) : ""}
|
|
60
60
|
<slot></slot>
|
|
61
61
|
</div>
|
|
62
62
|
|
|
@@ -136,15 +136,32 @@ SonicToastItem.styles = [
|
|
|
136
136
|
margin-top: auto;
|
|
137
137
|
margin-bottom: auto;
|
|
138
138
|
max-width:70ch;
|
|
139
|
+
line-height: 1.2;
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
::slotted(a),
|
|
142
|
+
::slotted(a:not(.btn)),
|
|
142
143
|
.sonic-toast-text a {
|
|
143
|
-
color: inherit;
|
|
144
|
-
text-decoration: underline;
|
|
144
|
+
color: inherit !important;
|
|
145
|
+
text-decoration: underline !important;
|
|
145
146
|
text-underline-offset: 0.15rem;
|
|
146
147
|
}
|
|
147
148
|
|
|
149
|
+
::slotted(:is(p, ul, ol, hr, h1, h2, h3, h4, h5, h6)),
|
|
150
|
+
.sonic-toast-text :is(p, ul, ol, hr, h1, h2, h3, h4, h5, h6) {
|
|
151
|
+
margin: 0 0 0.3em !important;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
::slotted(li),
|
|
155
|
+
.sonic-toast-text li {
|
|
156
|
+
margin-bottom: .15em !important;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
::slotted( :is(p, ul, ol, hr, h1, h2, h3, h4, h5, h6):last-child),
|
|
160
|
+
.sonic-toast-text > :is(p, ul, ol, hr, h1, h2, h3, h4, h5, h6):last-child {
|
|
161
|
+
margin-bottom: 0 !important;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
148
165
|
/*BUTTON CLOSE*/
|
|
149
166
|
.sonic-toast-close {
|
|
150
167
|
all: unset;
|
|
@@ -183,6 +200,7 @@ SonicToastItem.styles = [
|
|
|
183
200
|
font-weight: bold;
|
|
184
201
|
font-size: 1.15rem;
|
|
185
202
|
margin: 0.15em 0 0.25em;
|
|
203
|
+
line-height: 1.2;
|
|
186
204
|
}
|
|
187
205
|
|
|
188
206
|
/*STATUS*/
|
|
@@ -10,6 +10,7 @@ import { repeat } from "lit/directives/repeat.js";
|
|
|
10
10
|
import { animate } from "@lit-labs/motion";
|
|
11
11
|
import Objects from "@supersoniks/concorde/core/utils/Objects";
|
|
12
12
|
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
13
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
13
14
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
14
15
|
import { styleMap } from "lit/directives/style-map.js";
|
|
15
16
|
import "@supersoniks/concorde/core/components/ui/toast/toast-item";
|
|
@@ -39,10 +40,12 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
39
40
|
return html `<div aria-live="polite" style=${styleMap(styles)}>
|
|
40
41
|
${repeat(this.toasts, (item) => item.id, (item) => html `
|
|
41
42
|
<sonic-toast-item maxHeight=${isIframe ? 'none' : '10rem'}
|
|
42
|
-
status=${item.status}
|
|
43
|
+
status=${ifDefined(item.status)}
|
|
44
|
+
title=${ifDefined(item.title)}
|
|
43
45
|
?ghost=${item.ghost}
|
|
44
46
|
?dismissForever=${item.dismissForever}
|
|
45
|
-
?preserve=${item.preserve}
|
|
47
|
+
?preserve=${item.preserve}
|
|
48
|
+
id=${ifDefined(item.id)}
|
|
46
49
|
@hide=${() => this.removeItem(item)}
|
|
47
50
|
${animate({
|
|
48
51
|
keyframeOptions: {
|
|
@@ -61,6 +64,7 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
61
64
|
stabilizeOut: true,
|
|
62
65
|
})}
|
|
63
66
|
>
|
|
67
|
+
<!-- Le texte est passé dans le slot et non pas en propriété pour contrer des problèmatiques de shadow-dom et d'appel exterieur (exemple: fancybox) -->
|
|
64
68
|
${item.text ? unsafeHTML(item.text) : ""}
|
|
65
69
|
</sonic-toast-item>
|
|
66
70
|
`)}
|
package/core/components/ui/ui.js
CHANGED
package/core/mixins/Fetcher.js
CHANGED
|
@@ -86,6 +86,7 @@ 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
|
+
// Je garde ça mais normalement ça n'arrive jamais
|
|
89
90
|
if (!data) {
|
|
90
91
|
SonicToast.add({ text: "Network Error", status: "error" });
|
|
91
92
|
this.isLoading = false;
|
|
@@ -96,7 +97,10 @@ const Fetcher = (superClass) => {
|
|
|
96
97
|
if (hasLoader)
|
|
97
98
|
Loader.hide();
|
|
98
99
|
if (this.key) {
|
|
100
|
+
let response = data._sonic_http_response_;
|
|
99
101
|
data = Objects.traverse(data, this.key.split("."), false);
|
|
102
|
+
if (data)
|
|
103
|
+
data._sonic_http_response_ = response;
|
|
100
104
|
}
|
|
101
105
|
this.props = data;
|
|
102
106
|
this.dispatchEvent(new CustomEvent("load", { detail: this }));
|
|
@@ -68,9 +68,6 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
68
68
|
requestUpdate(): void;
|
|
69
69
|
getAttribute(name: string): string;
|
|
70
70
|
hasAttribute(attributeName: String): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* comme radio,mais peut être désélectionné après sélection
|
|
73
|
-
*/
|
|
74
71
|
disconnectedCallback(): void;
|
|
75
72
|
};
|
|
76
73
|
} & T;
|
|
@@ -30,10 +30,6 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
30
30
|
name: string;
|
|
31
31
|
props: any;
|
|
32
32
|
isConnected: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Le type De l'input, comme en html cependant tous les types ne sont pas actuellements compatibles en raison du style en vigueur
|
|
35
|
-
* On peut essayer text, date, color, email par exemple, mais pas radio/checkbox/range a priori
|
|
36
|
-
*/
|
|
37
33
|
getAncestorAttributeValue(attributeName: string): string;
|
|
38
34
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
39
35
|
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
@@ -199,7 +199,7 @@ export class PublisherProxy {
|
|
|
199
199
|
* Si il s'agit d'une valeur primitive (un entier, une chaine ) la valeure en renseignée par un objet contenant la vaeur {__value}
|
|
200
200
|
* On publie juste et on sen va.
|
|
201
201
|
*/
|
|
202
|
-
const isPrimitiveValue =
|
|
202
|
+
const isPrimitiveValue = this._value_.hasOwnProperty("__value");
|
|
203
203
|
if (isPrimitiveValue) {
|
|
204
204
|
this._publishAssignement_(lockInternalMutationsTransmission);
|
|
205
205
|
return true;
|
|
@@ -222,7 +222,7 @@ export class PublisherProxy {
|
|
|
222
222
|
* Si la donnée est complexe (objet, tableau)
|
|
223
223
|
* on crée les proxys pour les sous-éléments qui n'en on pas
|
|
224
224
|
* On renseigne les nouvelles valeurs internes des proxies
|
|
225
|
-
|
|
225
|
+
*/
|
|
226
226
|
if (isComplex(this._value_)) {
|
|
227
227
|
for (let key in this._value_) {
|
|
228
228
|
let v = newValue[key];
|
|
@@ -258,7 +258,7 @@ export class PublisherProxy {
|
|
|
258
258
|
* Utilitaires de gestion des Publisher
|
|
259
259
|
* Obtenir, replacer ou supprimer un Publisher
|
|
260
260
|
*
|
|
261
|
-
*/
|
|
261
|
+
*/
|
|
262
262
|
export class PublisherManager {
|
|
263
263
|
constructor() {
|
|
264
264
|
if (PublisherManager.instance != null)
|