@supersoniks/concorde 1.1.0 → 1.1.3
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/core/components/functional/list/list.d.ts +1 -0
- package/core/components/functional/list/list.js +7 -1
- package/core/components/functional/queue/queue.d.ts +1 -0
- package/core/components/functional/queue/queue.js +5 -0
- package/core/components/ui/link/link.d.ts +1 -0
- package/core/components/ui/link/link.js +6 -1
- package/core/components/ui/theme/theme-collection/core-variables.js +1 -1
- package/core/components/ui/toast/toast.js +3 -1
- package/core/mixins/Subscriber.js +4 -0
- package/core/utils/PublisherProxy.mjs +9 -0
- package/package.json +1 -1
|
@@ -52,6 +52,7 @@ declare const List_base: {
|
|
|
52
52
|
*/
|
|
53
53
|
export declare class List extends List_base {
|
|
54
54
|
static styles: import("lit").CSSResult[];
|
|
55
|
+
itemPropertyMap: Object | null;
|
|
55
56
|
/**
|
|
56
57
|
* La propriété templateKey contient le nom de la propriété qui sera utilisé pour identifier le template à utiliser dans la donnée de la ligne.
|
|
57
58
|
* Par exemple si templateIdentifier = "name" et que la donnée de la ligne est {name: "myTemplate" ... }, alors le template possédant l'attribut data-value="myTemplate" sera utilisé.
|
|
@@ -31,6 +31,7 @@ import TemplatesContainer from "@supersoniks/concorde/core/mixins/TemplatesConta
|
|
|
31
31
|
let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))) {
|
|
32
32
|
constructor() {
|
|
33
33
|
super(...arguments);
|
|
34
|
+
this.itemPropertyMap = null;
|
|
34
35
|
/**
|
|
35
36
|
* La propriété templateKey contient le nom de la propriété qui sera utilisé pour identifier le template à utiliser dans la donnée de la ligne.
|
|
36
37
|
* Par exemple si templateIdentifier = "name" et que la donnée de la ligne est {name: "myTemplate" ... }, alors le template possédant l'attribut data-value="myTemplate" sera utilisé.
|
|
@@ -54,7 +55,8 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
54
55
|
// si props est une string on considère qu'il n'y a pas de résultats
|
|
55
56
|
if (typeof this.props == "string") {
|
|
56
57
|
return html `<div class="sonic-no-result-container">
|
|
57
|
-
<sonic-icon prefix="iconoir" name="emoji-think-left" size="lg"></sonic-icon
|
|
58
|
+
<sonic-icon prefix="iconoir" name="emoji-think-left" size="lg"></sonic-icon
|
|
59
|
+
><span class="sonic-no-result-text">${this.props}</span>
|
|
58
60
|
</div>`;
|
|
59
61
|
}
|
|
60
62
|
// si props est un objet mais qu'il n'y a pas de contenu on retourn une div vide (nécessaire pour le lazyload)
|
|
@@ -90,6 +92,7 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
90
92
|
.bindPublisher=${function () {
|
|
91
93
|
return pub;
|
|
92
94
|
}}
|
|
95
|
+
.?propertyMap="${this.itemPropertyMap}"
|
|
93
96
|
dataProvider="${this.dataProvider}/list-item/${index}"
|
|
94
97
|
>
|
|
95
98
|
${hasCustomTemplate
|
|
@@ -115,6 +118,9 @@ List.styles = [
|
|
|
115
118
|
}
|
|
116
119
|
`,
|
|
117
120
|
];
|
|
121
|
+
__decorate([
|
|
122
|
+
property({ type: Object })
|
|
123
|
+
], List.prototype, "itemPropertyMap", void 0);
|
|
118
124
|
__decorate([
|
|
119
125
|
property({ type: String })
|
|
120
126
|
], List.prototype, "templateKey", void 0);
|
|
@@ -26,6 +26,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
26
26
|
this.templates = null;
|
|
27
27
|
this.lastRequestTime = 0;
|
|
28
28
|
this.key = "";
|
|
29
|
+
this.itemPropertyMap = null;
|
|
29
30
|
/**
|
|
30
31
|
* Durée cible en ms d'une requête pour afficher 1 lot.
|
|
31
32
|
*/
|
|
@@ -147,6 +148,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
147
148
|
${repeat(this.props, (item) => item.id, (item) => html `
|
|
148
149
|
<sonic-list
|
|
149
150
|
fetch
|
|
151
|
+
.?itemPropertyMap=${this.itemPropertyMap}
|
|
150
152
|
debug=${ifDefined(this.defferedDebug)}
|
|
151
153
|
@load=${this.next}
|
|
152
154
|
key=${this.key}
|
|
@@ -161,6 +163,9 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
161
163
|
}
|
|
162
164
|
};
|
|
163
165
|
Queue.instanceCounter = 0;
|
|
166
|
+
__decorate([
|
|
167
|
+
property({ type: Object })
|
|
168
|
+
], Queue.prototype, "itemPropertyMap", void 0);
|
|
164
169
|
__decorate([
|
|
165
170
|
property()
|
|
166
171
|
], Queue.prototype, "targetRequestDuration", void 0);
|
|
@@ -7,11 +7,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import LocationHandler from "@supersoniks/concorde/core/utils/LocationHandler";
|
|
8
8
|
import { html, LitElement, css } from "lit";
|
|
9
9
|
import { customElement, property } from "lit/decorators.js";
|
|
10
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
11
|
let Link = class Link extends LitElement {
|
|
11
12
|
constructor() {
|
|
12
13
|
super(...arguments);
|
|
13
14
|
this.href = "";
|
|
14
15
|
this._location = "";
|
|
16
|
+
this.target = null;
|
|
15
17
|
/**
|
|
16
18
|
* Si présent on passe en mode pushstate
|
|
17
19
|
*/
|
|
@@ -43,7 +45,7 @@ let Link = class Link extends LitElement {
|
|
|
43
45
|
if (!this.href)
|
|
44
46
|
return html `<slot></slot>`;
|
|
45
47
|
return html `
|
|
46
|
-
<a href="${this.href}" @click=${this.pushState ? this.handlePushState : null}>
|
|
48
|
+
<a href="${this.href}" target=${ifDefined(this.target)} @click=${this.pushState ? this.handlePushState : null}>
|
|
47
49
|
<slot></slot>
|
|
48
50
|
</a>
|
|
49
51
|
`;
|
|
@@ -61,6 +63,9 @@ Link.styles = [
|
|
|
61
63
|
__decorate([
|
|
62
64
|
property({ type: String })
|
|
63
65
|
], Link.prototype, "href", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
property({ type: String })
|
|
68
|
+
], Link.prototype, "target", void 0);
|
|
64
69
|
__decorate([
|
|
65
70
|
property({ type: Boolean })
|
|
66
71
|
], Link.prototype, "pushState", void 0);
|
|
@@ -4,7 +4,7 @@ export const coreVariables = css `
|
|
|
4
4
|
/* --sc-rfs: 16px; */
|
|
5
5
|
|
|
6
6
|
/* polices*/
|
|
7
|
-
--sc-font-family-base:
|
|
7
|
+
--sc-font-family-base: aileron, -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;
|
|
@@ -87,12 +87,14 @@ let SonicToast = class SonicToast extends LitElement {
|
|
|
87
87
|
// Ajoute le toast à la liste
|
|
88
88
|
let toastComponent = document.querySelector("sonic-toast");
|
|
89
89
|
const nextId = new Date().valueOf();
|
|
90
|
+
const interactiveRegExp = new RegExp('<\/a>|<\/button>');
|
|
91
|
+
const hasInteractive = interactiveRegExp.test(conf.text);
|
|
90
92
|
const currentToast = {
|
|
91
93
|
id: nextId,
|
|
92
94
|
text: conf.text,
|
|
93
95
|
title: conf.title,
|
|
94
96
|
status: conf.status,
|
|
95
|
-
preserve: conf.preserve,
|
|
97
|
+
preserve: hasInteractive ? true : conf.preserve,
|
|
96
98
|
ghost: conf.ghost,
|
|
97
99
|
marginTop: conf.marginTop,
|
|
98
100
|
};
|
|
@@ -52,6 +52,7 @@ const Subscriber = (superClass) => {
|
|
|
52
52
|
* Cela se fait à l'initialisation uniquement et n'est pas modifiable lors de la vie du composant.
|
|
53
53
|
*/
|
|
54
54
|
this.noShadowDom = null;
|
|
55
|
+
this.propertyMap = null;
|
|
55
56
|
this.title = "";
|
|
56
57
|
/**
|
|
57
58
|
* L'id / l'adresse du publisher accessible via PublisherManager.get(dataProvider)
|
|
@@ -359,6 +360,9 @@ const Subscriber = (superClass) => {
|
|
|
359
360
|
}
|
|
360
361
|
}
|
|
361
362
|
SubscriberElement.instanceCounter = 0;
|
|
363
|
+
__decorate([
|
|
364
|
+
property({ type: Object })
|
|
365
|
+
], SubscriberElement.prototype, "propertyMap", void 0);
|
|
362
366
|
__decorate([
|
|
363
367
|
property({ type: String, attribute: "data-title" })
|
|
364
368
|
], SubscriberElement.prototype, "title", void 0);
|
|
@@ -68,6 +68,12 @@ export class PublisherProxy {
|
|
|
68
68
|
}
|
|
69
69
|
_publishTemplateFilling_(key, value) {
|
|
70
70
|
this._templateFillListeners_.forEach((handler) => {
|
|
71
|
+
let desc = Object.getOwnPropertyDescriptor(handler, key);
|
|
72
|
+
if (desc && !desc.set)
|
|
73
|
+
return;
|
|
74
|
+
if (handler.propertyMap && handler.propertyMap[key]) {
|
|
75
|
+
key = handler.propertyMap[key];
|
|
76
|
+
}
|
|
71
77
|
if (typeof handler[key] != "undefined" && handler[key] !== value) {
|
|
72
78
|
handler[key] = value;
|
|
73
79
|
}
|
|
@@ -113,6 +119,9 @@ export class PublisherProxy {
|
|
|
113
119
|
this._templateFillListeners_.add(handler);
|
|
114
120
|
for (var z in this._value_) {
|
|
115
121
|
const value = this._value_[z];
|
|
122
|
+
if (handler.propertyMap && handler.propertyMap[z]) {
|
|
123
|
+
z = handler.propertyMap[z];
|
|
124
|
+
}
|
|
116
125
|
if (typeof handler[z] != "undefined" && handler[z] !== value) {
|
|
117
126
|
handler[z] = value;
|
|
118
127
|
}
|