@supersoniks/concorde 1.1.10 → 1.1.11

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.
@@ -8,6 +8,8 @@ declare const Fetch_base: {
8
8
  iObserver: IntersectionObserver | null;
9
9
  isDefaultLoaderEnabled: boolean;
10
10
  isFetchEnabled: boolean;
11
+ _endPoint: string;
12
+ endPoint: string;
11
13
  _fetchData(): Promise<void>;
12
14
  onInvalidate: any;
13
15
  disconnectedCallback(): void;
@@ -15,11 +17,12 @@ declare const Fetch_base: {
15
17
  firstUpdated(): void;
16
18
  onIntersection(entries: IntersectionObserverEntry[]): void;
17
19
  props: any;
20
+ isConnected: boolean;
18
21
  getAncestorAttributeValue(attributeName: string): string;
19
22
  hasAncestorAttribute(attributeName: string): boolean;
20
23
  querySelectorAll(selector: string): NodeListOf<Element>;
21
24
  publisher: any;
22
- dataProvider: String;
25
+ dataProvider: string | null;
23
26
  noShadowDom: string | null;
24
27
  debug: HTMLElement | null;
25
28
  defferedDebug: boolean | null;
@@ -64,6 +67,7 @@ declare const Fetch_base: {
64
67
  #### Autres choses utiles
65
68
  * * L'attribut *noLoader* du composant permet de désactiver l'affichage du loader par défaut.
66
69
  * * On peut appeler la methode invalidate() sur le publisher associé au composant pour declencher le rechargement des données.
70
+ * * endPoint est une propriété réctive, par conséquent, sa modification, manuelle via template ou data binbding provoque la mise à jour du contenu.
67
71
  */
68
72
  export declare class Fetch extends Fetch_base {
69
73
  static styles: import("lit").CSSResult[];
@@ -37,6 +37,7 @@ import Fetcher from "@supersoniks/concorde/core/mixins/Fetcher";
37
37
  #### Autres choses utiles
38
38
  * * L'attribut *noLoader* du composant permet de désactiver l'affichage du loader par défaut.
39
39
  * * On peut appeler la methode invalidate() sur le publisher associé au composant pour declencher le rechargement des données.
40
+ * * endPoint est une propriété réctive, par conséquent, sa modification, manuelle via template ou data binbding provoque la mise à jour du contenu.
40
41
  */
41
42
  let Fetch = class Fetch extends Fetcher(Subscriber(LitElement)) {
42
43
  render() {
@@ -10,6 +10,8 @@ declare const List_base: {
10
10
  iObserver: IntersectionObserver | null;
11
11
  isDefaultLoaderEnabled: boolean;
12
12
  isFetchEnabled: boolean;
13
+ _endPoint: string;
14
+ endPoint: string;
13
15
  _fetchData(): Promise<void>;
14
16
  onInvalidate: any;
15
17
  disconnectedCallback(): void;
@@ -17,11 +19,12 @@ declare const List_base: {
17
19
  firstUpdated(): void;
18
20
  onIntersection(entries: IntersectionObserverEntry[]): void;
19
21
  props: any;
22
+ isConnected: boolean;
20
23
  getAncestorAttributeValue(attributeName: string): string;
21
24
  hasAncestorAttribute(attributeName: string): boolean;
22
25
  querySelectorAll(selector: string): NodeListOf<Element>;
23
26
  publisher: any;
24
- dataProvider: String;
27
+ dataProvider: string | null;
25
28
  noShadowDom: string | null;
26
29
  debug: HTMLElement | null;
27
30
  defferedDebug: boolean | null;
@@ -27,11 +27,12 @@ declare const Button_base: {
27
27
  required: true | null;
28
28
  formDataProvider: string;
29
29
  props: any;
30
+ isConnected: boolean;
30
31
  getAncestorAttributeValue(attributeName: string): string;
31
32
  hasAncestorAttribute(attributeName: string): boolean;
32
33
  querySelectorAll(selector: string): NodeListOf<Element>;
33
34
  publisher: any;
34
- dataProvider: String;
35
+ dataProvider: string | null;
35
36
  noShadowDom: string | null;
36
37
  debug: HTMLElement | null;
37
38
  defferedDebug: boolean | null;
@@ -94,6 +95,13 @@ export declare class Button extends Button_base {
94
95
  * Propriété min-width du bouton
95
96
  */
96
97
  minWidth: string;
98
+ /**
99
+ * mode d'activation du bouton :
100
+ * - strict : l'url courante match exactement avec le href du bouton
101
+ * - partial : l'url courante match à gauche avec le href du bouton
102
+ * - disabled : aucune activation / désactivation
103
+ */
104
+ autoActive: "strict" | "partial" | "disabled";
97
105
  /**
98
106
  * Laisse apparaitre un loader en remplacement du contenu du bouton.
99
107
  * Désactive également le clic sur le bouton
@@ -59,6 +59,13 @@ let Button = class Button extends FormCheckable(FormElement(Subscriber(LitElemen
59
59
  * Propriété min-width du bouton
60
60
  */
61
61
  this.minWidth = "0";
62
+ /**
63
+ * mode d'activation du bouton :
64
+ * - strict : l'url courante match exactement avec le href du bouton
65
+ * - partial : l'url courante match à gauche avec le href du bouton
66
+ * - disabled : aucune activation / désactivation
67
+ */
68
+ this.autoActive = "partial";
62
69
  /**
63
70
  * Laisse apparaitre un loader en remplacement du contenu du bouton.
64
71
  * Désactive également le clic sur le bouton
@@ -109,18 +116,6 @@ let Button = class Button extends FormCheckable(FormElement(Subscriber(LitElemen
109
116
  connectedCallback() {
110
117
  super.connectedCallback();
111
118
  }
112
- // _checked: true | null = null;
113
- // @property() get checked(): true | null {
114
- // return this._checked;
115
- // }
116
- // set checked(checked: true | null) {
117
- // if (this.name) {
118
- // if (checked == this._checked) return;
119
- // super.setCheckedValue(checked);
120
- // if (this._checked) this.setAttribute("active", "true");
121
- // else this.removeAttribute("active");
122
- // }
123
- // }
124
119
  setCheckedValue(checked) {
125
120
  if (this.name) {
126
121
  if (checked == this._checked)
@@ -530,6 +525,9 @@ __decorate([
530
525
  __decorate([
531
526
  property({ type: String })
532
527
  ], Button.prototype, "minWidth", void 0);
528
+ __decorate([
529
+ property({ type: String })
530
+ ], Button.prototype, "autoActive", void 0);
533
531
  __decorate([
534
532
  property({ type: Boolean, reflect: true })
535
533
  ], Button.prototype, "loading", void 0);
@@ -23,11 +23,12 @@ declare const Checkbox_base: {
23
23
  required: true | null;
24
24
  formDataProvider: string;
25
25
  props: any;
26
+ isConnected: boolean;
26
27
  getAncestorAttributeValue(attributeName: string): string;
27
28
  hasAncestorAttribute(attributeName: string): boolean;
28
29
  querySelectorAll(selector: string): NodeListOf<Element>;
29
30
  publisher: any;
30
- dataProvider: String;
31
+ dataProvider: string | null;
31
32
  noShadowDom: string | null;
32
33
  debug: HTMLElement | null;
33
34
  defferedDebug: boolean | null;
@@ -62,11 +63,12 @@ declare const Checkbox_base: {
62
63
  _name: string;
63
64
  name: string;
64
65
  props: any;
66
+ isConnected: boolean;
65
67
  getAncestorAttributeValue(attributeName: string): string;
66
68
  hasAncestorAttribute(attributeName: string): boolean;
67
69
  querySelectorAll(selector: string): NodeListOf<Element>;
68
70
  publisher: any;
69
- dataProvider: String;
71
+ dataProvider: string | null;
70
72
  noShadowDom: string | null;
71
73
  debug: HTMLElement | null;
72
74
  defferedDebug: boolean | null;
@@ -55,9 +55,9 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
55
55
  <input
56
56
  type="${this.type}"
57
57
  @change=${this.handleChange}
58
- ?disabled=${this.disabled}
59
- ?required=${this.required}
60
- ?checked=${this.checked}
58
+ .disabled=${ifDefined(this.disabled)}
59
+ .required=${ifDefined(this.required)}
60
+ .checked=${ifDefined(this.checked)}
61
61
  .name=${this.name}
62
62
  .value=${this.value}
63
63
  autofocus=${ifDefined(this.autofocus)}
@@ -74,7 +74,6 @@ let Checkbox = class Checkbox extends FormCheckable(FormInput(FormElement(Subscr
74
74
  <slot>
75
75
  </div>
76
76
  </label>
77
-
78
77
  `;
79
78
  }
80
79
  };
@@ -18,11 +18,12 @@ declare const Input_base: {
18
18
  _name: string;
19
19
  name: string;
20
20
  props: any;
21
+ isConnected: boolean;
21
22
  getAncestorAttributeValue(attributeName: string): string;
22
23
  hasAncestorAttribute(attributeName: string): boolean;
23
24
  querySelectorAll(selector: string): NodeListOf<Element>;
24
25
  publisher: any;
25
- dataProvider: String;
26
+ dataProvider: string | null;
26
27
  noShadowDom: string | null;
27
28
  debug: HTMLElement | null;
28
29
  defferedDebug: boolean | null;
@@ -18,11 +18,12 @@ declare const Textarea_base: {
18
18
  _name: string;
19
19
  name: string;
20
20
  props: any;
21
+ isConnected: boolean;
21
22
  getAncestorAttributeValue(attributeName: string): string;
22
23
  hasAncestorAttribute(attributeName: string): boolean;
23
24
  querySelectorAll(selector: string): NodeListOf<Element>;
24
25
  publisher: any;
25
- dataProvider: String;
26
+ dataProvider: string | null;
26
27
  noShadowDom: string | null;
27
28
  debug: HTMLElement | null;
28
29
  defferedDebug: boolean | null;
@@ -5,6 +5,13 @@ export declare class Link extends LitElement {
5
5
  private _location;
6
6
  get location(): string;
7
7
  set location(value: string);
8
+ /**
9
+ * mode d'activation du bouton :
10
+ * - strict : l'url courante match exactement avec le href du bouton
11
+ * - partial : l'url courante match à gauche avec le href du bouton
12
+ * - disabled : aucune activation / désactivation
13
+ */
14
+ autoActive: "strict" | "partial" | "disabled";
8
15
  connectedCallback(): void;
9
16
  disconnectedCallback(): void;
10
17
  target: null;
@@ -13,6 +13,13 @@ let Link = class Link extends LitElement {
13
13
  super(...arguments);
14
14
  this.href = "";
15
15
  this._location = "";
16
+ /**
17
+ * mode d'activation du bouton :
18
+ * - strict : l'url courante match exactement avec le href du bouton
19
+ * - partial : l'url courante match à gauche avec le href du bouton
20
+ * - disabled : aucune activation / désactivation
21
+ */
22
+ this.autoActive = "partial";
16
23
  this.target = null;
17
24
  /**
18
25
  * Si présent on passe en mode pushstate
@@ -63,6 +70,9 @@ Link.styles = [
63
70
  __decorate([
64
71
  property({ type: String })
65
72
  ], Link.prototype, "href", void 0);
73
+ __decorate([
74
+ property({ type: String })
75
+ ], Link.prototype, "autoActive", void 0);
66
76
  __decorate([
67
77
  property({ type: String })
68
78
  ], Link.prototype, "target", void 0);
@@ -1,7 +1,7 @@
1
1
  import { LitElement } from "lit";
2
2
  export declare class Tooltip extends LitElement {
3
3
  static styles: import("lit").CSSResult[];
4
- tooltipText: string;
4
+ label: string;
5
5
  disabled: boolean;
6
6
  render(): import("lit-html").TemplateResult<1>;
7
7
  }
@@ -9,13 +9,13 @@ import { customElement, property } from "lit/decorators.js";
9
9
  let Tooltip = class Tooltip extends LitElement {
10
10
  constructor() {
11
11
  super(...arguments);
12
- this.tooltipText = "";
12
+ this.label = "";
13
13
  this.disabled = false;
14
14
  }
15
15
  render() {
16
- let disabledClass = this.disabled || this.tooltipText == "" ? "disabled" : "";
16
+ let disabledClass = this.disabled || this.label == "" ? "disabled" : "";
17
17
  return html `<div
18
- data-tooltip-text="${this.tooltipText.trim().replace("&nbsp;", " ")}"
18
+ data-tooltip-text="${this.label.trim().replace("&nbsp;", " ")}"
19
19
  class="tooltip ${disabledClass}"
20
20
  >
21
21
  <slot></slot>
@@ -58,7 +58,7 @@ Tooltip.styles = [
58
58
  ];
59
59
  __decorate([
60
60
  property({ type: String })
61
- ], Tooltip.prototype, "tooltipText", void 0);
61
+ ], Tooltip.prototype, "label", void 0);
62
62
  __decorate([
63
63
  property({ type: Boolean })
64
64
  ], Tooltip.prototype, "disabled", void 0);
@@ -31,6 +31,8 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface>>(superClass:
31
31
  * Cela est le cas pour le composant sonic-list qui ne fetch que si l'attribut fetch est renseigné
32
32
  */
33
33
  isFetchEnabled: boolean;
34
+ _endPoint: string;
35
+ endPoint: string;
34
36
  /**
35
37
  *
36
38
  * C'est ici que les données sont chargées via l'utilitaire API
@@ -47,23 +49,26 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface>>(superClass:
47
49
  firstUpdated(): void;
48
50
  onIntersection(entries: IntersectionObserverEntry[]): void;
49
51
  props: any;
52
+ isConnected: boolean;
50
53
  getAncestorAttributeValue(attributeName: string): string;
51
54
  hasAncestorAttribute(attributeName: string): boolean;
52
55
  querySelectorAll(selector: string): NodeListOf<Element>;
53
- /**
54
- * isFirstLoad vaut true jusqu'au premier chargement de données
55
- */
56
56
  publisher: any;
57
- dataProvider: String;
57
+ dataProvider: string | null;
58
58
  noShadowDom: string | null;
59
59
  debug: HTMLElement | null;
60
- defferedDebug: boolean | null;
60
+ defferedDebug: boolean | null; /**
61
+ * isLoading vaut true pendant le chargement des données
62
+ */
61
63
  dispatchEvent(event: Event): void;
62
64
  setAttribute(name: string, value: string): void;
63
65
  addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
64
66
  removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
65
67
  removeAttribute(name: string): void;
66
- initPublisher(): void;
68
+ initPublisher(): void; /**
69
+ * On peut désactiver le fetch programmatiquement via cette propriété.
70
+ * Cela est le cas pour le composant sonic-list qui ne fetch que si l'attribut fetch est renseigné
71
+ */
67
72
  getApiConfiguration(): import("@supersoniks/concorde/core/utils/api").APIConfiguration;
68
73
  requestUpdate(): void;
69
74
  getAttribute(name: string): string;
@@ -1,3 +1,9 @@
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
+ };
1
7
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
8
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
9
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -12,6 +18,7 @@ import { SonicToast } from "../components/ui/toast/toast";
12
18
  import API from "@supersoniks/concorde/core/utils/api";
13
19
  import "../components/ui/button/button";
14
20
  import Objects from "../utils/Objects";
21
+ import { property } from "lit/decorators.js";
15
22
  const Fetcher = (superClass) => {
16
23
  class FetcherElement extends superClass {
17
24
  constructor(...args) {
@@ -43,9 +50,18 @@ const Fetcher = (superClass) => {
43
50
  * Cela est le cas pour le composant sonic-list qui ne fetch que si l'attribut fetch est renseigné
44
51
  */
45
52
  this.isFetchEnabled = true;
53
+ this._endPoint = "";
46
54
  args;
47
55
  this.dataProvider = "";
48
56
  }
57
+ set endPoint(value) {
58
+ this._endPoint = value;
59
+ if (this.isConnected)
60
+ this._fetchData();
61
+ }
62
+ get endPoint() {
63
+ return this._endPoint;
64
+ }
49
65
  /**
50
66
  *
51
67
  * C'est ici que les données sont chargées via l'utilitaire API
@@ -59,8 +75,7 @@ const Fetcher = (superClass) => {
59
75
  this.api = new API(this.getApiConfiguration());
60
76
  if (!this.api)
61
77
  return;
62
- if (!this.dataProvider)
63
- return;
78
+ // if (!this.dataProvider) return;
64
79
  this.dispatchEvent(new CustomEvent("loading", { detail: this }));
65
80
  this.isLoading = true;
66
81
  this.requestUpdate();
@@ -68,7 +83,7 @@ const Fetcher = (superClass) => {
68
83
  let hasLoader = this.isDefaultLoaderEnabled && !this.hasAttribute("noLoader");
69
84
  if (hasLoader)
70
85
  Loader.show();
71
- data = yield this.api.get(this.getAttribute("endPoint") || this.dataProvider);
86
+ data = yield this.api.get(this.endPoint || this.dataProvider || "");
72
87
  if (!data) {
73
88
  SonicToast.add({ text: "Network Error", status: "error" });
74
89
  this.isLoading = false;
@@ -79,7 +94,7 @@ const Fetcher = (superClass) => {
79
94
  if (hasLoader)
80
95
  Loader.hide();
81
96
  if (this.key) {
82
- data = Objects.traverse(data, this.key.split("."), true);
97
+ data = Objects.traverse(data, this.key.split("."), false);
83
98
  }
84
99
  this.props = data;
85
100
  this.dispatchEvent(new CustomEvent("load", { detail: this }));
@@ -148,6 +163,9 @@ const Fetcher = (superClass) => {
148
163
  }
149
164
  }
150
165
  }
166
+ __decorate([
167
+ property({ type: String })
168
+ ], FetcherElement.prototype, "endPoint", null);
151
169
  return FetcherElement; // as Constructor<SubscriberInterface> & T;
152
170
  };
153
171
  export default Fetcher;
@@ -47,11 +47,12 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
47
47
  required: true | null;
48
48
  formDataProvider: string;
49
49
  props: any;
50
+ isConnected: boolean;
50
51
  getAncestorAttributeValue(attributeName: string): string;
51
52
  hasAncestorAttribute(attributeName: string): boolean;
52
53
  querySelectorAll(selector: string): NodeListOf<Element>;
53
54
  publisher: any;
54
- dataProvider: String;
55
+ dataProvider: string | null;
55
56
  noShadowDom: string | null;
56
57
  debug: HTMLElement | null;
57
58
  defferedDebug: boolean | null;
@@ -64,9 +65,7 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
64
65
  connectedCallback(): void;
65
66
  requestUpdate(): void;
66
67
  getAttribute(name: string): string;
67
- hasAttribute(attributeName: String): boolean; /**
68
- * comme radio,mais peut être désélectionné après sélection
69
- */
68
+ hasAttribute(attributeName: String): boolean;
70
69
  disconnectedCallback(): void;
71
70
  };
72
71
  } & T;
@@ -23,11 +23,12 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
23
23
  _name: string;
24
24
  name: string;
25
25
  props: any;
26
+ isConnected: boolean;
26
27
  getAncestorAttributeValue(attributeName: string): string;
27
28
  hasAncestorAttribute(attributeName: string): boolean;
28
29
  querySelectorAll(selector: string): NodeListOf<Element>;
29
30
  publisher: any;
30
- dataProvider: String;
31
+ dataProvider: string | null;
31
32
  noShadowDom: string | null;
32
33
  debug: HTMLElement | null;
33
34
  defferedDebug: boolean | null;
@@ -4,11 +4,12 @@ import { APIConfiguration } from "@supersoniks/concorde/core/utils/api";
4
4
  declare type Constructor<T> = new (...args: any[]) => T;
5
5
  export interface SubscriberInterface {
6
6
  props: any;
7
+ isConnected: boolean;
7
8
  getAncestorAttributeValue(attributeName: string): string;
8
9
  hasAncestorAttribute(attributeName: string): boolean;
9
10
  querySelectorAll(selector: string): NodeListOf<Element>;
10
11
  publisher: any;
11
- dataProvider: String;
12
+ dataProvider: string | null;
12
13
  noShadowDom: string | null;
13
14
  debug: HTMLElement | null;
14
15
  defferedDebug: boolean | null;
@@ -4,6 +4,7 @@ declare type Listener = {
4
4
  declare type ActivableLink = {
5
5
  location: string;
6
6
  href: string;
7
+ autoActive: "strict" | "partial" | "disabled";
7
8
  setAttribute(name: string, value: string): void;
8
9
  removeAttribute(name: string): void;
9
10
  };
@@ -37,7 +38,7 @@ export default class LocationHandler {
37
38
  /**
38
39
  *
39
40
  * @param component ActivableLink
40
- * Ajoute l'attribut "active" à l'élément si l'url correspond à la location
41
+ * Ajoute l'attribut "active" à l'élément si l'url correspond à la location en donction du mode d'activation
41
42
  */
42
43
  static updateComponentActiveState(component: ActivableLink): void;
43
44
  }
@@ -78,13 +78,21 @@ export default class LocationHandler {
78
78
  /**
79
79
  *
80
80
  * @param component ActivableLink
81
- * Ajoute l'attribut "active" à l'élément si l'url correspond à la location
81
+ * Ajoute l'attribut "active" à l'élément si l'url correspond à la location en donction du mode d'activation
82
82
  */
83
83
  static updateComponentActiveState(component) {
84
+ if (component.autoActive == "disabled")
85
+ return;
84
86
  if (component.href && component.href.indexOf("http") != 0) {
85
87
  let url1 = new URL(component.href, document.location.href);
86
88
  let url2 = new URL(component.location, document.location.origin);
87
- if (url1.pathname == url2.pathname && url1.hash == url2.hash && url1.search == url2.search)
89
+ let isActive = false;
90
+ if (component.autoActive == "strict") {
91
+ isActive = url1.pathname == url2.pathname && url1.hash == url2.hash && url1.search == url2.search;
92
+ }
93
+ else
94
+ isActive = url2.href.indexOf(url1.href) == 0;
95
+ if (isActive)
88
96
  component.setAttribute("active", "true");
89
97
  else
90
98
  component.removeAttribute("active");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supersoniks/concorde",
3
- "version": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "customElements": "custom-elements.json",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -10,6 +10,7 @@
10
10
  "@lit-labs/motion": "^1.0.1",
11
11
  "@lit-labs/observers": "^1.0.1",
12
12
  "chart.js": "^3.9.1",
13
+ "jsbarcode": "^3.11.5",
13
14
  "lit": "^2.2.3",
14
15
  "url-pattern": "^1.0.3"
15
16
  },
@@ -202,6 +203,7 @@
202
203
  "./utils/PublisherProxy.mjs": "./core/utils/PublisherProxy",
203
204
  "./core/utils/api": "./core/utils/api",
204
205
  "./utils/api": "./core/utils/api",
206
+ "./index-shared": "./index-shared",
205
207
  "./index": "./index"
206
208
  },
207
209
  "bin": "./bin/cli.js"