@supersoniks/concorde 1.1.43 → 1.1.45
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 +9 -7
- package/concorde-core.bundle.js +20 -20
- package/concorde-core.es.js +987 -804
- package/core/_types/types.d.ts +13 -8
- package/core/_types/types.js +1 -0
- package/core/components/functional/date/date.d.ts +2 -2
- package/core/components/functional/date/date.js +10 -10
- package/core/components/functional/example/example.d.ts +1 -1
- package/core/components/functional/fetch/fetch.d.ts +8 -6
- package/core/components/functional/list/list.d.ts +16 -8
- package/core/components/functional/list/list.js +29 -14
- package/core/components/functional/mix/mix.d.ts +5 -5
- package/core/components/functional/mix/mix.js +11 -8
- package/core/components/functional/queue/queue.d.ts +13 -4
- package/core/components/functional/queue/queue.js +33 -27
- package/core/components/functional/router/redirect.d.ts +2 -2
- package/core/components/functional/router/redirect.js +2 -6
- package/core/components/functional/router/router.d.ts +1 -1
- package/core/components/functional/router/router.js +22 -13
- package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +0 -1
- package/core/components/functional/sdui/SDUIDescriptorTransformer.js +35 -36
- package/core/components/functional/sdui/sdui-utils.js +11 -11
- package/core/components/functional/sdui/sdui.d.ts +11 -10
- package/core/components/functional/sdui/sdui.js +33 -34
- package/core/components/functional/sdui/types.d.ts +8 -8
- package/core/components/functional/states/states.d.ts +3 -3
- package/core/components/functional/states/states.js +9 -8
- package/core/components/functional/submit/submit.d.ts +1 -1
- package/core/components/functional/submit/submit.js +16 -16
- package/core/components/functional/subscriber/subscriber.d.ts +1 -1
- package/core/components/functional/value/value.d.ts +1 -1
- package/core/components/functional/value/value.js +3 -2
- package/core/components/ui/_css/size.d.ts +1 -1
- package/core/components/ui/button/button.d.ts +6 -4
- package/core/components/ui/button/button.js +34 -30
- package/core/components/ui/captcha/captcha.d.ts +2 -2
- package/core/components/ui/captcha/captcha.js +2 -2
- package/core/components/ui/card/card-header.js +5 -1
- package/core/components/ui/card/card.js +7 -5
- package/core/components/ui/form/checkbox/checkbox.d.ts +36 -12
- package/core/components/ui/form/fieldset/fieldset.d.ts +1 -1
- package/core/components/ui/form/form-layout/form-layout.d.ts +1 -1
- package/core/components/ui/form/input/input.d.ts +14 -9
- package/core/components/ui/form/input/input.js +2 -2
- package/core/components/ui/form/input/password-helper.d.ts +1 -1
- package/core/components/ui/form/input/password-helper.js +1 -1
- package/core/components/ui/form/input/same-value-helper.d.ts +1 -1
- package/core/components/ui/form/input/same-value-helper.js +2 -2
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +1 -1
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +1 -1
- package/core/components/ui/form/select/select.d.ts +5 -4
- package/core/components/ui/form/select/select.js +24 -12
- package/core/components/ui/form/textarea/textarea.d.ts +11 -9
- package/core/components/ui/form/textarea/textarea.js +1 -1
- package/core/components/ui/group/group.js +8 -2
- package/core/components/ui/icon/icons.js +15 -13
- package/core/components/ui/loader/loader.d.ts +1 -1
- package/core/components/ui/loader/loader.js +1 -1
- package/core/components/ui/menu/menu.js +15 -16
- package/core/components/ui/modal/modal.d.ts +1 -1
- package/core/components/ui/modal/modal.js +1 -1
- package/core/components/ui/pop/pop.d.ts +6 -5
- package/core/components/ui/pop/pop.js +76 -46
- package/core/components/ui/table/table-tbody.js +1 -1
- package/core/components/ui/theme/theme.js +15 -13
- package/core/components/ui/toast/message-subscriber.d.ts +12 -9
- package/core/components/ui/toast/message-subscriber.js +10 -8
- package/core/components/ui/toast/toast.d.ts +1 -1
- package/core/components/ui/toast/toast.js +7 -8
- package/core/components/ui/toast/types.d.ts +3 -2
- package/core/components/ui/tooltip/tooltip.js +4 -4
- package/core/components/ui/ui.d.ts +1 -1
- package/core/components/ui/ui.js +1 -1
- package/core/mixins/Fetcher.d.ts +15 -17
- package/core/mixins/Fetcher.js +19 -10
- package/core/mixins/FormCheckable.d.ts +8 -5
- package/core/mixins/FormCheckable.js +21 -19
- package/core/mixins/FormElement.d.ts +10 -7
- package/core/mixins/FormElement.js +24 -23
- package/core/mixins/FormInput.d.ts +16 -10
- package/core/mixins/FormInput.js +1 -1
- package/core/mixins/Subscriber.d.ts +8 -6
- package/core/mixins/Subscriber.js +24 -23
- package/core/mixins/TemplatesContainer.d.ts +2 -1
- package/core/mixins/TemplatesContainer.js +2 -2
- package/core/utils/Arrays.js +12 -9
- package/core/utils/DataBindObserver.d.ts +4 -4
- package/core/utils/DataBindObserver.js +26 -28
- package/core/utils/HTML.d.ts +1 -1
- package/core/utils/HTML.js +2 -2
- package/core/utils/LocationHandler.js +10 -10
- package/core/utils/Objects.js +10 -4
- package/core/utils/PublisherProxy.d.ts +21 -15
- package/core/utils/PublisherProxy.js +67 -63
- package/core/utils/api.d.ts +40 -32
- package/core/utils/api.js +127 -32
- package/mixins.d.ts +25 -19
- package/package.json +11 -6
- package/core/components/ui/taxonomy/taxonomy.d.ts +0 -44
- package/core/components/ui/taxonomy/taxonomy.js +0 -115
package/mixins.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export declare const Fetcher: <
|
|
2
|
+
export declare const Fetcher: <T extends new (...args: any[]) => mySubscriber.SubscriberInterface<PropsType>, PropsType extends import("./core/_types/types").PublisherContentType = import("./core/_types/types").PublisherContentType>(superClass: T, propsType?: PropsType | undefined) => {
|
|
3
3
|
new (...args: any[]): {
|
|
4
|
-
api: import("./core/utils/api").default
|
|
5
|
-
key:
|
|
4
|
+
api: import("./core/utils/api").default | null;
|
|
5
|
+
key: string;
|
|
6
6
|
isFirstLoad: boolean;
|
|
7
7
|
isLoading: boolean;
|
|
8
8
|
iObserver: IntersectionObserver | null;
|
|
9
9
|
isDefaultLoaderEnabled: boolean;
|
|
10
10
|
isFetchEnabled: boolean;
|
|
11
11
|
_endPoint: string;
|
|
12
|
+
props: (PropsType & import("./core/utils/api").ResultTypeInterface) | null;
|
|
12
13
|
endPoint: string;
|
|
13
14
|
requestId: number;
|
|
14
15
|
refetchEveryMs: number;
|
|
@@ -19,9 +20,10 @@ export declare const Fetcher: <PropsType = any, T extends new (...args: any[]) =
|
|
|
19
20
|
connectedCallback(): void;
|
|
20
21
|
firstUpdated(): void;
|
|
21
22
|
onIntersection(entries: IntersectionObserverEntry[]): void;
|
|
22
|
-
|
|
23
|
-
propertyMap: Object;
|
|
23
|
+
propertyMap: object;
|
|
24
24
|
isConnected: boolean;
|
|
25
|
+
children: HTMLCollection;
|
|
26
|
+
appendChild(node: Node): Node;
|
|
25
27
|
getAncestorAttributeValue(attributeName: string): string;
|
|
26
28
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
27
29
|
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
@@ -41,7 +43,7 @@ export declare const Fetcher: <PropsType = any, T extends new (...args: any[]) =
|
|
|
41
43
|
getApiConfiguration(): import("./core/utils/api").APIConfiguration;
|
|
42
44
|
requestUpdate(): void;
|
|
43
45
|
getAttribute(name: string): string;
|
|
44
|
-
hasAttribute(attributeName:
|
|
46
|
+
hasAttribute(attributeName: string): boolean;
|
|
45
47
|
};
|
|
46
48
|
} & T;
|
|
47
49
|
export declare const FormCheckable: <T extends new (...args: any[]) => myFormElement.FormElementInterface>(superClass: T) => {
|
|
@@ -79,9 +81,11 @@ export declare const FormCheckable: <T extends new (...args: any[]) => myFormEle
|
|
|
79
81
|
ariaLabel?: string | undefined;
|
|
80
82
|
_name: string;
|
|
81
83
|
name: string;
|
|
82
|
-
props:
|
|
83
|
-
propertyMap:
|
|
84
|
+
props: import("./core/_types/types").CoreJSType;
|
|
85
|
+
propertyMap: object;
|
|
84
86
|
isConnected: boolean;
|
|
87
|
+
children: HTMLCollection;
|
|
88
|
+
appendChild(node: Node): Node;
|
|
85
89
|
getAncestorAttributeValue(attributeName: string): string;
|
|
86
90
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
87
91
|
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
@@ -100,17 +104,17 @@ export declare const FormCheckable: <T extends new (...args: any[]) => myFormEle
|
|
|
100
104
|
getApiConfiguration(): import("./core/utils/api").APIConfiguration;
|
|
101
105
|
requestUpdate(): void;
|
|
102
106
|
getAttribute(name: string): string;
|
|
103
|
-
hasAttribute(attributeName:
|
|
107
|
+
hasAttribute(attributeName: string): boolean;
|
|
104
108
|
};
|
|
105
109
|
} & T;
|
|
106
110
|
import * as myFormElement from "@supersoniks/concorde/core/mixins/FormElement";
|
|
107
|
-
export declare const FormElement: <T extends new (...args: any[]) => mySubscriber.SubscriberInterface<
|
|
111
|
+
export declare const FormElement: <T extends new (...args: any[]) => mySubscriber.SubscriberInterface<import("./core/_types/types").CoreJSType>>(superClass: T) => (new (...args: any[]) => myFormElement.FormElementInterface) & T;
|
|
108
112
|
export declare const FormInput: <T extends new (...args: any[]) => myFormElement.FormElementInterface>(superClass: T) => {
|
|
109
113
|
new (...args: any[]): {
|
|
110
114
|
validateFormElement(): void;
|
|
111
115
|
forceAutoFill: boolean;
|
|
112
|
-
_type: "number" | "search" | "file" | "button" | "
|
|
113
|
-
type: "number" | "search" | "file" | "button" | "
|
|
116
|
+
_type: "number" | "search" | "file" | "button" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local" | "password";
|
|
117
|
+
type: "number" | "search" | "file" | "button" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local" | "password";
|
|
114
118
|
_description?: string | undefined;
|
|
115
119
|
description: string | undefined;
|
|
116
120
|
_label?: string | undefined;
|
|
@@ -121,7 +125,7 @@ export declare const FormInput: <T extends new (...args: any[]) => myFormElement
|
|
|
121
125
|
updateDataValue(): void;
|
|
122
126
|
handleChange(e?: Event | undefined): void;
|
|
123
127
|
handleBlur(e?: Event | undefined): void;
|
|
124
|
-
getValueForFormPublisher():
|
|
128
|
+
getValueForFormPublisher(): string | object | string[] | null | undefined;
|
|
125
129
|
focus?: (() => void) | undefined;
|
|
126
130
|
shadowRoot?: ShadowRoot | undefined;
|
|
127
131
|
error: boolean;
|
|
@@ -131,13 +135,15 @@ export declare const FormInput: <T extends new (...args: any[]) => myFormElement
|
|
|
131
135
|
formDataProvider: string;
|
|
132
136
|
ariaLabelledby?: string | undefined;
|
|
133
137
|
ariaLabel?: string | undefined;
|
|
134
|
-
_value: string | null;
|
|
135
|
-
value: string | null;
|
|
138
|
+
_value: string | object | string[] | null | undefined;
|
|
139
|
+
value: string | object | string[] | null | undefined;
|
|
136
140
|
_name: string;
|
|
137
141
|
name: string;
|
|
138
|
-
props:
|
|
139
|
-
propertyMap:
|
|
142
|
+
props: import("./core/_types/types").CoreJSType;
|
|
143
|
+
propertyMap: object;
|
|
140
144
|
isConnected: boolean;
|
|
145
|
+
children: HTMLCollection;
|
|
146
|
+
appendChild(node: Node): Node;
|
|
141
147
|
getAncestorAttributeValue(attributeName: string): string;
|
|
142
148
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
143
149
|
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
@@ -157,11 +163,11 @@ export declare const FormInput: <T extends new (...args: any[]) => myFormElement
|
|
|
157
163
|
connectedCallback(): void;
|
|
158
164
|
requestUpdate(): void;
|
|
159
165
|
getAttribute(name: string): string;
|
|
160
|
-
hasAttribute(attributeName:
|
|
166
|
+
hasAttribute(attributeName: string): boolean;
|
|
161
167
|
disconnectedCallback(): void;
|
|
162
168
|
};
|
|
163
169
|
} & T;
|
|
164
170
|
import * as mySubscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
165
|
-
export declare const Subscriber: <PropsType =
|
|
171
|
+
export declare const Subscriber: <PropsType = import("./core/_types/types").CoreJSType, T extends new (...args: any[]) => import("lit").LitElement = new (...args: any[]) => import("lit").LitElement>(superClass: T, type?: PropsType | undefined) => (new (...args: any[]) => mySubscriber.SubscriberInterface<PropsType>) & T;
|
|
166
172
|
import * as myTemplatesContainer from "@supersoniks/concorde/core/mixins/TemplatesContainer";
|
|
167
173
|
export declare const TemplatesContainer: <T extends new (...args: any[]) => import("lit").LitElement>(superClass: T) => (new (...args: any[]) => myTemplatesContainer.TemplatesContainerInterface) & T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supersoniks/concorde",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.45",
|
|
4
4
|
"customElements": "custom-elements.json",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -23,10 +23,15 @@
|
|
|
23
23
|
"@types/intl": "^1.2.0",
|
|
24
24
|
"@types/jest": "^29.2.6",
|
|
25
25
|
"@types/node": "^18.11.18",
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^5.49.0",
|
|
27
|
+
"@typescript-eslint/parser": "^5.49.0",
|
|
28
|
+
"add": "^2.0.6",
|
|
26
29
|
"autoprefixer": "^10.4.5",
|
|
30
|
+
"eslint": "^8.32.0",
|
|
31
|
+
"eslint-config-prettier": "^8.6.0",
|
|
27
32
|
"intl": "^1.2.5",
|
|
28
33
|
"jest": "^29.3.1",
|
|
29
|
-
"jest-environment-jsdom": "^29.
|
|
34
|
+
"jest-environment-jsdom": "^29.4.1",
|
|
30
35
|
"postcss": "^8.4.12",
|
|
31
36
|
"rollup-plugin-minify-html-literals": "^1.2.6",
|
|
32
37
|
"rollup-plugin-postcss-lit": "^2.0.0",
|
|
@@ -36,7 +41,8 @@
|
|
|
36
41
|
"ts-node": "^10.9.1",
|
|
37
42
|
"typescript": "^4.6.4",
|
|
38
43
|
"vite": "^2.6.14",
|
|
39
|
-
"vite-jest": "^0.1.4"
|
|
44
|
+
"vite-jest": "^0.1.4",
|
|
45
|
+
"yarn": "^1.22.19"
|
|
40
46
|
},
|
|
41
47
|
"exports": {
|
|
42
48
|
"./components": "./components.js",
|
|
@@ -67,6 +73,8 @@
|
|
|
67
73
|
"./functional/sdui/SDUIDescriptorTransformer": "./core/components/functional/sdui/SDUIDescriptorTransformer.js",
|
|
68
74
|
"./core/components/functional/sdui/default-library.json": "./core/components/functional/sdui/default-library.json",
|
|
69
75
|
"./functional/sdui/default-library.json": "./core/components/functional/sdui/default-library.json",
|
|
76
|
+
"./core/components/functional/sdui/example.json": "./core/components/functional/sdui/example.json",
|
|
77
|
+
"./functional/sdui/example.json": "./core/components/functional/sdui/example.json",
|
|
70
78
|
"./core/components/functional/sdui/sdui-utils": "./core/components/functional/sdui/sdui-utils.js",
|
|
71
79
|
"./functional/sdui/sdui-utils": "./core/components/functional/sdui/sdui-utils.js",
|
|
72
80
|
"./core/components/functional/sdui/sdui": "./core/components/functional/sdui/sdui.js",
|
|
@@ -191,8 +199,6 @@
|
|
|
191
199
|
"./ui/table/table-tr": "./core/components/ui/table/table-tr.js",
|
|
192
200
|
"./core/components/ui/table/table": "./core/components/ui/table/table.js",
|
|
193
201
|
"./ui/table": "./core/components/ui/table/table.js",
|
|
194
|
-
"./core/components/ui/taxonomy/taxonomy": "./core/components/ui/taxonomy/taxonomy.js",
|
|
195
|
-
"./ui/taxonomy": "./core/components/ui/taxonomy/taxonomy.js",
|
|
196
202
|
"./core/components/ui/theme/theme-collection/core-variables": "./core/components/ui/theme/theme-collection/core-variables.js",
|
|
197
203
|
"./ui/theme/theme-collection/core-variables": "./core/components/ui/theme/theme-collection/core-variables.js",
|
|
198
204
|
"./core/components/ui/theme/theme-collection/dark": "./core/components/ui/theme/theme-collection/dark.js",
|
|
@@ -256,7 +262,6 @@
|
|
|
256
262
|
"./docs/navigation/navigation": "./docs/navigation/navigation.js",
|
|
257
263
|
"./docs/navigation": "./docs/navigation/navigation.js",
|
|
258
264
|
"./docs/prism/index": "./docs/prism/index.js",
|
|
259
|
-
"./docs/search/doc-search.json": "./docs/search/doc-search.json",
|
|
260
265
|
"./docs/search/docs-search.json": "./docs/search/docs-search.json",
|
|
261
266
|
"./docs/search/markdown-renderer": "./docs/search/markdown-renderer.js",
|
|
262
267
|
"./docs/search/page": "./docs/search/page.js",
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { LitElement, nothing } from "lit";
|
|
2
|
-
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
3
|
-
import "@supersoniks/concorde/core/components/ui/badge/badge";
|
|
4
|
-
import { IconConf } from "../icon/icons";
|
|
5
|
-
declare type TaxonomyConf = Record<string, boolean | string>;
|
|
6
|
-
/**
|
|
7
|
-
* 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*)
|
|
8
|
-
*/
|
|
9
|
-
export declare class Taxonomy extends LitElement {
|
|
10
|
-
static styles: import("lit").CSSResult;
|
|
11
|
-
/**
|
|
12
|
-
* Identifiant d'icone passé en interne au composant *sonic-icon*
|
|
13
|
-
*/
|
|
14
|
-
icon: IconConf;
|
|
15
|
-
/**
|
|
16
|
-
* Tableau d'objets de la forme :{*key*_name:*"Une taxonomie"*} ou *key* correspond à la valeur fournie à la propriété *key*.
|
|
17
|
-
* Dans ce cas *"une taxonomie"* sera un des termes affiches dans le composant.
|
|
18
|
-
*/
|
|
19
|
-
taxonomy: TaxonomyConf[];
|
|
20
|
-
/**
|
|
21
|
-
* Chaque terme sera séparé par la valeur contenue dans cette propriété
|
|
22
|
-
*/
|
|
23
|
-
separator: string;
|
|
24
|
-
/**
|
|
25
|
-
* La clée utilisé pour extraire le terme de la donnée. (voir la propriété *taxonomy*)
|
|
26
|
-
*/
|
|
27
|
-
key: string;
|
|
28
|
-
/**
|
|
29
|
-
* Le type change surtout la couleur composant : voir *Badge*, *Button*
|
|
30
|
-
*/
|
|
31
|
-
type: "primary" | "warning" | "danger" | "success" | "info" | "default";
|
|
32
|
-
/**
|
|
33
|
-
* Le composant par defaut sans se paramètre à forte afordance
|
|
34
|
-
* * gost : composant super léger visuellement
|
|
35
|
-
* * outline : composant légé avec une bordure
|
|
36
|
-
*/
|
|
37
|
-
variant: "default" | "outline" | "ghost";
|
|
38
|
-
/**
|
|
39
|
-
* Taille du composant, implique notamment des modifications de typo et de marge interne
|
|
40
|
-
*/
|
|
41
|
-
size: "md" | "xs" | "sm" | "lg";
|
|
42
|
-
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
43
|
-
}
|
|
44
|
-
export {};
|
|
@@ -1,115 +0,0 @@
|
|
|
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 { css, html, LitElement, nothing } from "lit";
|
|
8
|
-
import { customElement, property } from "lit/decorators.js";
|
|
9
|
-
import { repeat } from "lit/directives/repeat.js";
|
|
10
|
-
import "@supersoniks/concorde/core/components/ui/icon/icon";
|
|
11
|
-
import "@supersoniks/concorde/core/components/ui/badge/badge";
|
|
12
|
-
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
13
|
-
import { ifDefined } from "lit/directives/if-defined.js";
|
|
14
|
-
const tagName = "sonic-taxonomy";
|
|
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*)
|
|
17
|
-
*/
|
|
18
|
-
let Taxonomy = class Taxonomy extends LitElement {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
/**
|
|
22
|
-
* Identifiant d'icone passé en interne au composant *sonic-icon*
|
|
23
|
-
*/
|
|
24
|
-
this.icon = { name: "" };
|
|
25
|
-
/**
|
|
26
|
-
* Tableau d'objets de la forme :{*key*_name:*"Une taxonomie"*} ou *key* correspond à la valeur fournie à la propriété *key*.
|
|
27
|
-
* Dans ce cas *"une taxonomie"* sera un des termes affiches dans le composant.
|
|
28
|
-
*/
|
|
29
|
-
this.taxonomy = [];
|
|
30
|
-
/**
|
|
31
|
-
* Chaque terme sera séparé par la valeur contenue dans cette propriété
|
|
32
|
-
*/
|
|
33
|
-
this.separator = ", ";
|
|
34
|
-
/**
|
|
35
|
-
* La clée utilisé pour extraire le terme de la donnée. (voir la propriété *taxonomy*)
|
|
36
|
-
*/
|
|
37
|
-
this.key = "";
|
|
38
|
-
/**
|
|
39
|
-
* Le type change surtout la couleur composant : voir *Badge*, *Button*
|
|
40
|
-
*/
|
|
41
|
-
this.type = "default";
|
|
42
|
-
/**
|
|
43
|
-
* Le composant par defaut sans se paramètre à forte afordance
|
|
44
|
-
* * gost : composant super léger visuellement
|
|
45
|
-
* * outline : composant légé avec une bordure
|
|
46
|
-
*/
|
|
47
|
-
this.variant = "default";
|
|
48
|
-
/**
|
|
49
|
-
* Taille du composant, implique notamment des modifications de typo et de marge interne
|
|
50
|
-
*/
|
|
51
|
-
this.size = "md";
|
|
52
|
-
}
|
|
53
|
-
render() {
|
|
54
|
-
if (!Array.isArray(this.taxonomy))
|
|
55
|
-
return nothing;
|
|
56
|
-
let key = this.key + "_display";
|
|
57
|
-
let taxo = this.taxonomy.filter((elt) => elt != null && (elt[key] === true || elt[key] == "1" || !elt.hasOwnProperty(key)));
|
|
58
|
-
if (taxo.length === 0) {
|
|
59
|
-
this.style.display = "none";
|
|
60
|
-
return nothing;
|
|
61
|
-
}
|
|
62
|
-
this.style.removeProperty("display");
|
|
63
|
-
return html `
|
|
64
|
-
<sonic-badge type=${this.type} variant=${this.variant} size=${this.size}>
|
|
65
|
-
<sonic-icon
|
|
66
|
-
slot="prefix"
|
|
67
|
-
library=${ifDefined(this.icon.library)}
|
|
68
|
-
prefix=${ifDefined(this.icon.prefix)}
|
|
69
|
-
name=${ifDefined(this.icon.name)}
|
|
70
|
-
></sonic-icon>
|
|
71
|
-
<span class="taxonomy-list">
|
|
72
|
-
${repeat(taxo, (item) => item[this.key + "_id"], (item) => {
|
|
73
|
-
return html `<span> ${item[this.key + "_name"] || item["name"]}</span
|
|
74
|
-
><span class="sonic-taxonomy-separator">${unsafeHTML(this.separator)}</span>`;
|
|
75
|
-
})}
|
|
76
|
-
</span>
|
|
77
|
-
</sonic-badge>
|
|
78
|
-
`;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
Taxonomy.styles = css `
|
|
82
|
-
:host .sonic-taxonomy-separator:last-child {
|
|
83
|
-
display: none;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.taxonomy-list {
|
|
87
|
-
display: flex;
|
|
88
|
-
flex-wrap: wrap;
|
|
89
|
-
}
|
|
90
|
-
`;
|
|
91
|
-
__decorate([
|
|
92
|
-
property({ type: Object })
|
|
93
|
-
], Taxonomy.prototype, "icon", void 0);
|
|
94
|
-
__decorate([
|
|
95
|
-
property({ type: Array })
|
|
96
|
-
], Taxonomy.prototype, "taxonomy", void 0);
|
|
97
|
-
__decorate([
|
|
98
|
-
property({ type: String })
|
|
99
|
-
], Taxonomy.prototype, "separator", void 0);
|
|
100
|
-
__decorate([
|
|
101
|
-
property({ type: String })
|
|
102
|
-
], Taxonomy.prototype, "key", void 0);
|
|
103
|
-
__decorate([
|
|
104
|
-
property({ type: String, reflect: true })
|
|
105
|
-
], Taxonomy.prototype, "type", void 0);
|
|
106
|
-
__decorate([
|
|
107
|
-
property({ type: String, reflect: true })
|
|
108
|
-
], Taxonomy.prototype, "variant", void 0);
|
|
109
|
-
__decorate([
|
|
110
|
-
property({ type: String, reflect: true })
|
|
111
|
-
], Taxonomy.prototype, "size", void 0);
|
|
112
|
-
Taxonomy = __decorate([
|
|
113
|
-
customElement(tagName)
|
|
114
|
-
], Taxonomy);
|
|
115
|
-
export { Taxonomy };
|