@supersoniks/concorde 1.1.7 → 1.1.8

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.
@@ -65,6 +65,6 @@ export declare class List extends List_base {
65
65
  */
66
66
  idKey: string;
67
67
  connectedCallback(): void;
68
- render(): import("lit-html").TemplateResult<1>;
68
+ render(): import("lit-html/directive").DirectiveResult<typeof import("lit-html/directives/template-content").TemplateContentDirective>;
69
69
  }
70
70
  export {};
@@ -48,11 +48,15 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
48
48
  this.defferedDebug = this.hasAttribute("debug") || null;
49
49
  this.isDefaultLoaderEnabled = false;
50
50
  this.isFetchEnabled = this.hasAttribute("fetch");
51
+ if (this.isFetchEnabled)
52
+ this.isLoading = true;
51
53
  super.connectedCallback();
52
54
  }
53
55
  render() {
54
56
  if (this.isLoading && !Array.isArray(this.props))
55
- return html `<sonic-loader mode="inline"></sonic-loader>`;
57
+ return this.templateParts["skeleton"]
58
+ ? templateContent(this.templateParts["skeleton"])
59
+ : html `<sonic-loader mode="inline"></sonic-loader>`;
56
60
  // si props est une string on considère qu'il n'y a pas de résultats
57
61
  if (typeof this.props == "string") {
58
62
  return html `<div class="sonic-no-result-container">
@@ -61,7 +65,7 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
61
65
  </div>`;
62
66
  }
63
67
  // si props est un objet mais qu'il n'y a pas de contenu on retourn une div vide (nécessaire pour le lazyload)
64
- if (!Objects.isObject(this.props) || Object.keys(this.props).length == 0) {
68
+ if (!Objects.isObject(this.props)) {
65
69
  return html `<div></div>`;
66
70
  }
67
71
  let props = this.props;
@@ -75,6 +79,10 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
75
79
  props = [props];
76
80
  }
77
81
  }
82
+ // On peut définir un template spécifique si le résultat est un tableau vide
83
+ if (props.length == 0 && this.templateParts["no-item"]) {
84
+ return templateContent(this.templateParts["no-item"]);
85
+ }
78
86
  // Resultats
79
87
  let templateCount = this.templateList.length;
80
88
  let counter = -1;
@@ -146,7 +146,10 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
146
146
  if (!Array.isArray(this.props))
147
147
  return nothing;
148
148
  return html `
149
- ${repeat(this.props, (item) => item.id, (item) => html `
149
+ ${repeat(this.props, (item) => item.id, (item, index) => {
150
+ var _a;
151
+ let templates = index == 0 ? this.templates : (_a = this.templates) === null || _a === void 0 ? void 0 : _a.filter(elt => elt.getAttribute("data-value") != "no-item");
152
+ return html `
150
153
  <sonic-list
151
154
  fetch
152
155
  .itemPropertyMap=${this.itemPropertyMap}
@@ -156,10 +159,11 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
156
159
  @loading=${this.resetDuration}
157
160
  dataProvider="${item.dataProvider}"
158
161
  idKey=${this.idKey}
159
- .templates=${this.templates}
162
+ .templates=${templates}
160
163
  >
161
164
  </sonic-list>
162
- `)}
165
+ `;
166
+ })}
163
167
  `;
164
168
  }
165
169
  };
@@ -18,7 +18,12 @@ declare const Button_base: {
18
18
  updateDataValue(): void;
19
19
  error: true | null;
20
20
  autofocus: true | null;
21
- disabled: true | null;
21
+ disabled: true | null; /**
22
+ * 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.
23
+ * * L'objet et ses slot sont en display flex avec direction / alignement et justifications configurables
24
+ * * Le bouton est comparable au badge car il possèdent tous les deux les propriétés *type* (primary...), *variant*(outline, ghost), size(xs...)...
25
+ * * Le bouton possède cependant et notamment une propriété href contrairement à un badge
26
+ */
22
27
  required: true | null;
23
28
  formDataProvider: string;
24
29
  props: any;
@@ -99,6 +104,10 @@ export declare class Button extends Button_base {
99
104
  hasSuffix: boolean;
100
105
  prefixes: HTMLElement[];
101
106
  suffixes: HTMLElement[];
107
+ /**
108
+ * target
109
+ */
110
+ target: "_self" | "_blank" | null;
102
111
  /**
103
112
  * L'url
104
113
  */
@@ -11,6 +11,7 @@ import { styleMap } from "lit/directives/style-map.js";
11
11
  import FormElement from "@supersoniks/concorde/core/mixins/FormElement";
12
12
  import FormCheckable from "@supersoniks/concorde/core/mixins/FormCheckable";
13
13
  import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
14
+ import { ifDefined } from "lit/directives/if-defined.js";
14
15
  /**
15
16
  * 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.
16
17
  * * L'objet et ses slot sont en display flex avec direction / alignement et justifications configurables
@@ -65,6 +66,10 @@ let Button = class Button extends FormCheckable(FormElement(Subscriber(LitElemen
65
66
  this.loading = false;
66
67
  this.hasPrefix = false;
67
68
  this.hasSuffix = false;
69
+ /**
70
+ * target
71
+ */
72
+ this.target = null;
68
73
  /**
69
74
  * L'url
70
75
  */
@@ -155,7 +160,7 @@ let Button = class Button extends FormCheckable(FormElement(Subscriber(LitElemen
155
160
  </button>
156
161
  `;
157
162
  return this.href
158
- ? html `<a href="${this.href}" @click=${this.pushState ? this.handlePushState : null}>${btn}</a>`
163
+ ? html `<a href="${this.href}" target=${ifDefined(this.target)} @click=${this.pushState ? this.handlePushState : null}>${btn}</a>`
159
164
  : html `${btn}`;
160
165
  }
161
166
  onSlotChange() {
@@ -540,6 +545,9 @@ __decorate([
540
545
  __decorate([
541
546
  queryAssignedElements({ flatten: true, slot: 'suffix' })
542
547
  ], Button.prototype, "suffixes", void 0);
548
+ __decorate([
549
+ property({ type: String })
550
+ ], Button.prototype, "target", void 0);
543
551
  __decorate([
544
552
  property({ type: String })
545
553
  ], Button.prototype, "href", null);
@@ -4,7 +4,7 @@ export const coreVariables = css `
4
4
  /* --sc-rfs: 16px; */
5
5
 
6
6
  /* polices*/
7
- --sc-font-family-base: "neue-haas-unica", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto,
7
+ --sc-font-family-base: "Inter var", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto,
8
8
  "Helvetica Neue", Arial, sans-serif;
9
9
  --sc-font-weight-base: 400;
10
10
  --sc-font-style-base: inherit;
@@ -56,6 +56,7 @@ const Fetcher = (superClass) => {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
57
  if (!this.isFetchEnabled)
58
58
  return;
59
+ this.api = new API(this.getApiConfiguration());
59
60
  if (!this.api)
60
61
  return;
61
62
  if (!this.dataProvider)
@@ -101,7 +102,6 @@ const Fetcher = (superClass) => {
101
102
  }
102
103
  super.connectedCallback();
103
104
  this.key = this.getAncestorAttributeValue("key");
104
- this.api = new API(this.getApiConfiguration());
105
105
  if (this.props) {
106
106
  this.publisher.set(this.props);
107
107
  }
@@ -15,12 +15,10 @@ export default class DataBindObserver {
15
15
  return;
16
16
  this.enabled = false;
17
17
  Array.from(DataBindObserver.observedElements.keys()).forEach((k) => DataBindObserver.unObserve(k));
18
- console.log("disabled");
19
18
  }
20
19
  static observe(element) {
21
20
  if (!DataBindObserver.enabled)
22
21
  return;
23
- console.log("Observe");
24
22
  if (DataBindObserver.observedElements.has(element))
25
23
  return;
26
24
  let obs = new MutationObserver(DataBindObserver.onMutation);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supersoniks/concorde",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "customElements": "custom-elements.json",
5
5
  "license": "MIT",
6
6
  "publishConfig": {