@supersoniks/concorde 1.1.38 → 1.1.40

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.
@@ -6,25 +6,27 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { html, LitElement, css } from "lit";
8
8
  import { customElement, property } from "lit/decorators.js";
9
- import '@supersoniks/concorde/core/components/ui/card/card-header-descripton';
9
+ import "@supersoniks/concorde/core/components/ui/card/card-header-descripton";
10
+ import { unsafeHTML } from "lit/directives/unsafe-html.js";
10
11
  const tagName = "sonic-card-header";
11
12
  let CardHeader = class CardHeader extends LitElement {
12
13
  render() {
13
14
  return html `
14
15
  <div class="header">
15
16
  <div class="header-content">
16
- ${this.label}
17
- ${this.description ? html `<sonic-card-header-description>${this.description}</sonic-card-header-description>` : ""}
17
+ ${unsafeHTML(this.label)}
18
+ ${this.description
19
+ ? html `<sonic-card-header-description>${unsafeHTML(this.description)}</sonic-card-header-description>`
20
+ : ""}
18
21
  <slot></slot>
19
22
  </div>
20
- <slot name="suffix"></slot>
23
+ <slot name="suffix"></slot>
21
24
  </div>
22
25
  `;
23
26
  }
24
27
  };
25
28
  CardHeader.styles = [
26
29
  css `
27
-
28
30
  :host {
29
31
  --sc-card-header-mb: 1.25rem;
30
32
  --sc-card-header-font-size: 1.875rem;
@@ -33,11 +35,11 @@ CardHeader.styles = [
33
35
  --sc-card-header-family: var(--sc-headings-font-family);
34
36
  --sc-card-header-line-height: var(--sc-headings-line-height);
35
37
  }
36
-
38
+
37
39
  .header {
38
40
  display: flex;
39
41
  align-items: flex-start;
40
- gap: .5em 1em;
42
+ gap: 0.5em 1em;
41
43
  margin-bottom: var(--sc-card-header-mb);
42
44
  line-height: var(--sc-card-header-line-height);
43
45
  font-family: var(--sc-card-header-font-family);
@@ -45,7 +47,7 @@ CardHeader.styles = [
45
47
  font-style: var(--sc-card-header-font-style);
46
48
  font-weight: var(--sc-card-header-font-weight);
47
49
  }
48
-
50
+
49
51
  .header-content {
50
52
  flex-grow: 1;
51
53
  }
@@ -53,8 +55,7 @@ CardHeader.styles = [
53
55
  slot[name="suffix"] {
54
56
  flex-shrink: 0;
55
57
  }
56
-
57
- `
58
+ `,
58
59
  ];
59
60
  __decorate([
60
61
  property()
@@ -6,6 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { html, LitElement, css } from "lit";
8
8
  import { customElement, property, queryAssignedNodes, query } from "lit/decorators.js";
9
+ import { unsafeHTML } from "lit/directives/unsafe-html.js";
9
10
  const tagName = "sonic-divider";
10
11
  let Divider = class Divider extends LitElement {
11
12
  constructor() {
@@ -21,7 +22,7 @@ let Divider = class Divider extends LitElement {
21
22
  }
22
23
  render() {
23
24
  return html `<div part="divider">
24
- <span class="text">${this.label}<slot></slot></span>
25
+ <span class="text">${unsafeHTML(this.label)}<slot></slot></span>
25
26
  </div>`;
26
27
  }
27
28
  };
@@ -53,7 +54,7 @@ Divider.styles = [
53
54
  --sc-divider-my: 0.35rem;
54
55
  --sc-divider-fs: 0.68rem;
55
56
  }
56
-
57
+
57
58
  :host([size="xs"]) {
58
59
  --sc-divider-my: 0.5rem;
59
60
  --sc-divider-fs: 0.75rem;
@@ -36,6 +36,7 @@ declare const Checkbox_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;
@@ -85,6 +86,7 @@ declare const Checkbox_base: {
85
86
  noShadowDom: string | null;
86
87
  debug: HTMLElement | null;
87
88
  defferedDebug: boolean | null;
89
+ displayContents: boolean;
88
90
  dispatchEvent(event: Event): void;
89
91
  setAttribute(name: string, value: string): void;
90
92
  addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
@@ -12,6 +12,7 @@ import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
12
12
  import FormInput from "@supersoniks/concorde/core/mixins/FormInput";
13
13
  import FormCheckable from "@supersoniks/concorde/core/mixins/FormCheckable";
14
14
  import "@supersoniks/concorde/core/components/ui/icon/icon";
15
+ import { unsafeHTML } from "lit/directives/unsafe-html.js";
15
16
  import { fontSize } from "@supersoniks/concorde/core/components/ui/_css/size";
16
17
  /**
17
18
  * ### Le composent sonic-checkbox étend les mixins FormCheckable, FormInput, FormElement et Subscriber
@@ -67,10 +68,10 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
67
68
  <sonic-icon name="${this.iconName}" class="sc-input-icon"></sonic-icon>
68
69
  </span>
69
70
  <div class="checkbox-text">
70
- ${this.label ? this.label : ""}
71
+ ${this.label ? unsafeHTML(this.label) : ""}
71
72
  <slot></slot>
72
73
  <slot name="description" class="${this.hasDescription ? "description" : "hidden"} ">
73
- ${this.description ? html `${this.description}` : ""}
74
+ ${this.description ? html `${unsafeHTML(this.description)}` : ""}
74
75
  </slot>
75
76
  </div>
76
77
  </label>
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { html, LitElement, css } from "lit";
8
8
  import { customElement, property } from "lit/decorators.js";
9
9
  import "@supersoniks/concorde/core/components/ui/form/fieldset/legend-description";
10
+ import { unsafeHTML } from "lit/directives/unsafe-html.js";
10
11
  import { ifDefined } from "lit/directives/if-defined.js";
11
12
  const tagName = "sonic-legend";
12
13
  let Legend = class Legend extends LitElement {
@@ -45,8 +46,10 @@ let Legend = class Legend extends LitElement {
45
46
  : ""}
46
47
 
47
48
  <div class="legend-content">
48
- ${this.label}
49
- ${this.description ? html `<sonic-legend-description>${this.description}</sonic-legend-description>` : ""}
49
+ ${unsafeHTML(this.label)}
50
+ ${this.description
51
+ ? html `<sonic-legend-description>${unsafeHTML(this.description)}</sonic-legend-description>`
52
+ : ""}
50
53
  <slot></slot>
51
54
  </div>
52
55
  <slot name="suffix"></slot>
@@ -23,6 +23,16 @@ declare const Input_base: {
23
23
  formDataProvider: string;
24
24
  _value: any;
25
25
  value: any;
26
+ /**
27
+ * ### Le composent sonic-input étend les mixins FormInput, FormElement et Subscriber
28
+ * **FormElement :**
29
+ * * 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é.
30
+ * * Par défault lorsque l'on édite l'input, la valeur est également mise à jour via le même dataprovider
31
+ * * On peut cependant décider de mettre à jour la donnée à une autre adresse en renseigne l'attribut *formDataProvider*.
32
+ * * 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.
33
+ * **FormInput :**
34
+ * Uniquement des propriétés classiques d'un input HTML.
35
+ */
26
36
  _name: string;
27
37
  name: string;
28
38
  props: any;
@@ -36,6 +46,7 @@ declare const Input_base: {
36
46
  noShadowDom: string | null;
37
47
  debug: HTMLElement | null;
38
48
  defferedDebug: boolean | null;
49
+ displayContents: boolean;
39
50
  dispatchEvent(event: Event): void;
40
51
  setAttribute(name: string, value: string): void;
41
52
  addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
@@ -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 :**
@@ -59,7 +60,7 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
59
60
  };
60
61
  return html `
61
62
  <label for="form-element" class="${this.hasLabel ? "form-label" : "hidden"}"
62
- >${this.label ? this.label : ""}<slot name="label" @slotchange=${this.onSlotChange}></slot
63
+ >${this.label ? unsafeHTML(this.label) : ""}<slot name="label" @slotchange=${this.onSlotChange}></slot
63
64
  ></label>
64
65
 
65
66
  <div @click=${this.inlineContentFocus} class="form-control ${classMap(slotClasses)}">
@@ -94,7 +95,7 @@ let Input = class Input extends FormInput(FormElement(Subscriber(LitElement))) {
94
95
  </div>
95
96
  </div>
96
97
  <slot name="description" class=" ${this.hasDescription ? "form-description" : "hidden"}">
97
- ${this.description ? html `${this.description}` : ""}
98
+ ${this.description ? html `${unsafeHTML(this.description)}` : ""}
98
99
  </slot>
99
100
  `;
100
101
  }
@@ -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é.
@@ -124,7 +125,7 @@ let Select = class Select extends FormElement(Subscriber(LitElement)) {
124
125
  };
125
126
  return html `
126
127
  <label for="form-element" class="${this.hasLabel ? "form-label" : "hidden"}"
127
- >${this.label ? this.label : ""}<slot name="label" @slotchange=${this.onSlotChange}></slot
128
+ >${this.label ? unsafeHTML(this.label) : ""}<slot name="label" @slotchange=${this.onSlotChange}></slot
128
129
  ></label>
129
130
 
130
131
  <div class="form-control ${classMap(slotClasses)}">
@@ -155,7 +156,7 @@ let Select = class Select extends FormElement(Subscriber(LitElement)) {
155
156
  </div>
156
157
 
157
158
  <slot name="description" class=" ${this.hasDescription ? "form-description" : "hidden"}">
158
- ${this.description ? html `${this.description}` : ""}
159
+ ${this.description ? html `${unsafeHTML(this.description)}` : ""}
159
160
  </slot>
160
161
  `;
161
162
  }
@@ -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() {
@@ -49,7 +50,7 @@ let Textarea = class Textarea extends FormInput(FormElement(Subscriber(LitElemen
49
50
  render() {
50
51
  return html `
51
52
  <label for="form-element" class="${this.hasLabel ? "form-label" : "hidden"}"
52
- >${this.label ? this.label : ""}<slot name="label" @slotchange=${this.onSlotChange}></slot
53
+ >${this.label ? unsafeHTML(this.label) : ""}<slot name="label" @slotchange=${this.onSlotChange}></slot
53
54
  ></label>
54
55
 
55
56
  <div class="form-control">
@@ -76,7 +77,7 @@ ${this.value}</textarea
76
77
  </div>
77
78
 
78
79
  <slot name="description" class=" ${this.hasDescription ? "form-description" : "hidden"}">
79
- ${this.description ? html `${this.description}` : ""}
80
+ ${this.description ? html `${unsafeHTML(this.description)}` : ""}
80
81
  </slot>
81
82
  `;
82
83
  }
@@ -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;
@@ -86,8 +86,8 @@ 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
90
- if (!data) {
89
+ // Si data est vide OU si data ne contient que la réponse HTTP, avec un statut not ok, on affiche un message
90
+ if (!data || (data._sonic_http_response_ && !data._sonic_http_response_.ok && Object.keys(data).length === 1)) {
91
91
  SonicToast.add({ text: "Network Error", status: "error" });
92
92
  this.isLoading = false;
93
93
  if (hasLoader)
@@ -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
- if (this.shadowRoot) {
134
- if (this.shadowRoot.children.length == 0)
135
- this.style.display = "none";
136
- else
137
- this.style.removeProperty("display");
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/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.38",
3
+ "version": "1.1.40",
4
4
  "customElements": "custom-elements.json",
5
5
  "license": "MIT",
6
6
  "publishConfig": {