@supersoniks/concorde 1.1.9 → 1.1.10
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/configuration/configuration.d.ts +5 -0
- package/core/components/functional/configuration/configuration.js +21 -0
- package/core/components/functional/date/date.js +3 -2
- package/core/components/functional/fetch/fetch.d.ts +27 -10
- package/core/components/functional/fetch/fetch.js +27 -12
- package/core/components/functional/functional.d.ts +1 -0
- package/core/components/functional/functional.js +1 -0
- package/core/components/functional/list/list.d.ts +11 -6
- package/core/components/functional/list/list.js +50 -20
- package/core/components/functional/sonic-scope/sonic-scope.d.ts +5 -0
- package/core/components/functional/sonic-scope/sonic-scope.js +20 -0
- package/core/components/functional/states/states.js +0 -2
- package/core/components/functional/submit/submit.d.ts +2 -0
- package/core/components/functional/submit/submit.js +23 -8
- package/core/components/ui/badge/badge.js +0 -1
- package/core/components/ui/button/button.d.ts +0 -1
- package/core/components/ui/button/button.js +1 -1
- package/core/components/ui/card/card-footer.d.ts +5 -0
- package/core/components/ui/card/card-footer.js +27 -0
- package/core/components/ui/card/card-header-descripton.d.ts +5 -0
- package/core/components/ui/card/card-header-descripton.js +33 -0
- package/core/components/ui/card/card-header.d.ts +8 -0
- package/core/components/ui/card/card-header.js +67 -0
- package/core/components/ui/card/card-main.d.ts +5 -0
- package/core/components/ui/card/card-main.js +29 -0
- package/core/components/ui/card/card.d.ts +12 -0
- package/core/components/ui/card/card.js +90 -0
- package/core/components/ui/form/checkbox/checkbox.d.ts +0 -2
- package/core/components/ui/form/checkbox/checkbox.js +3 -3
- package/core/components/ui/form/css/form-control.js +2 -0
- package/core/components/ui/form/fieldset/fieldset.js +1 -1
- package/core/components/ui/form/fieldset/legend-description.d.ts +5 -0
- package/core/components/ui/form/fieldset/legend-description.js +35 -0
- package/core/components/ui/form/fieldset/legend.d.ts +4 -5
- package/core/components/ui/form/fieldset/legend.js +21 -25
- package/core/components/ui/form/input/input.d.ts +1 -2
- package/core/components/ui/form/input/input.js +3 -3
- package/core/components/ui/form/textarea/textarea.d.ts +0 -1
- package/core/components/ui/form/textarea/textarea.js +2 -2
- package/core/components/ui/progress/progress.d.ts +7 -0
- package/core/components/ui/progress/progress.js +63 -0
- package/core/components/ui/table/table-caption.d.ts +5 -0
- package/core/components/ui/table/table-caption.js +24 -0
- package/core/components/ui/table/table-tbody.d.ts +5 -0
- package/core/components/ui/table/table-tbody.js +37 -0
- package/core/components/ui/table/table-td.d.ts +7 -0
- package/core/components/ui/table/table-td.js +45 -0
- package/core/components/ui/table/table-tfoot.d.ts +5 -0
- package/core/components/ui/table/table-tfoot.js +23 -0
- package/core/components/ui/table/table-th.d.ts +6 -0
- package/core/components/ui/table/table-th.js +43 -0
- package/core/components/ui/table/table-thead.d.ts +5 -0
- package/core/components/ui/table/table-thead.js +24 -0
- package/core/components/ui/table/table-tr.d.ts +5 -0
- package/core/components/ui/table/table-tr.js +24 -0
- package/core/components/ui/table/table.d.ts +16 -0
- package/core/components/ui/table/table.js +88 -0
- package/core/components/ui/theme/theme-collection/core-variables.js +1 -1
- package/core/components/ui/theme/theme-collection/dark.js +3 -2
- package/core/components/ui/theme/theme-collection/light.js +1 -0
- package/core/components/ui/ui.d.ts +3 -0
- package/core/components/ui/ui.js +3 -0
- package/core/mixins/Fetcher.d.ts +1 -4
- package/core/mixins/Fetcher.js +1 -1
- package/core/mixins/FormCheckable.d.ts +3 -2
- package/core/mixins/FormInput.d.ts +0 -1
- package/core/mixins/Subscriber.d.ts +0 -1
- package/core/mixins/Subscriber.js +0 -15
- package/core/utils/Objects.d.ts +2 -1
- package/core/utils/Objects.js +8 -2
- package/core/utils/PublisherProxy.mjs +42 -12
- package/core/utils/api.js +1 -1
- package/package.json +36 -1
|
@@ -0,0 +1,45 @@
|
|
|
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 { html, LitElement, css } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
10
|
+
let TableTd = class TableTd extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.colSpan = null;
|
|
14
|
+
this.rowSpan = null;
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
return html `<td
|
|
18
|
+
colspan=${ifDefined(this.colSpan)}
|
|
19
|
+
rowspan=${ifDefined(this.rowSpan)}
|
|
20
|
+
part="td"
|
|
21
|
+
><slot></slot></td>`;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
TableTd.styles = [
|
|
25
|
+
css `
|
|
26
|
+
:host {
|
|
27
|
+
display: contents;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
td {
|
|
31
|
+
text-transform:var(--sc-th-tt);
|
|
32
|
+
text-align:inherit;
|
|
33
|
+
padding:.3em .5em;
|
|
34
|
+
}`
|
|
35
|
+
];
|
|
36
|
+
__decorate([
|
|
37
|
+
property({ type: Number })
|
|
38
|
+
], TableTd.prototype, "colSpan", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
property({ type: Number })
|
|
41
|
+
], TableTd.prototype, "rowSpan", void 0);
|
|
42
|
+
TableTd = __decorate([
|
|
43
|
+
customElement("sonic-td")
|
|
44
|
+
], TableTd);
|
|
45
|
+
export { TableTd };
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { html, LitElement, css } from "lit";
|
|
8
|
+
import { customElement } from "lit/decorators.js";
|
|
9
|
+
let TableTfoot = class TableTfoot extends LitElement {
|
|
10
|
+
render() {
|
|
11
|
+
return html `<tfoot><slot></slot></tfoot>`;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
TableTfoot.styles = [
|
|
15
|
+
css `
|
|
16
|
+
:host {
|
|
17
|
+
display: contents;
|
|
18
|
+
}`
|
|
19
|
+
];
|
|
20
|
+
TableTfoot = __decorate([
|
|
21
|
+
customElement("sonic-tfoot")
|
|
22
|
+
], TableTfoot);
|
|
23
|
+
export { TableTfoot };
|
|
@@ -0,0 +1,43 @@
|
|
|
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 { html, LitElement, css } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
10
|
+
let TableTh = class TableTh extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.align = "left";
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
const styles = {
|
|
17
|
+
textAlign: this.align,
|
|
18
|
+
};
|
|
19
|
+
return html `<th part="th" style=${styleMap(styles)} ><slot></slot></th>
|
|
20
|
+
`;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
TableTh.styles = [
|
|
24
|
+
css `
|
|
25
|
+
:host {
|
|
26
|
+
display: contents;
|
|
27
|
+
--sc-th-tt:uppercase;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
th {
|
|
31
|
+
text-transform:var(--sc-th-tt);
|
|
32
|
+
text-align:inherit;
|
|
33
|
+
padding:.3em .5em;
|
|
34
|
+
}
|
|
35
|
+
`
|
|
36
|
+
];
|
|
37
|
+
__decorate([
|
|
38
|
+
property({ type: String, reflect: true })
|
|
39
|
+
], TableTh.prototype, "align", void 0);
|
|
40
|
+
TableTh = __decorate([
|
|
41
|
+
customElement("sonic-th")
|
|
42
|
+
], TableTh);
|
|
43
|
+
export { TableTh };
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { html, LitElement, css } from "lit";
|
|
8
|
+
import { customElement } from "lit/decorators.js";
|
|
9
|
+
let TableThead = class TableThead extends LitElement {
|
|
10
|
+
render() {
|
|
11
|
+
return html `<slot></slot>`;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
TableThead.styles = [
|
|
15
|
+
css `
|
|
16
|
+
:host {
|
|
17
|
+
display: table-row-group;
|
|
18
|
+
}
|
|
19
|
+
`
|
|
20
|
+
];
|
|
21
|
+
TableThead = __decorate([
|
|
22
|
+
customElement("sonic-thead")
|
|
23
|
+
], TableThead);
|
|
24
|
+
export { TableThead };
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { html, LitElement, css } from "lit";
|
|
8
|
+
import { customElement } from "lit/decorators.js";
|
|
9
|
+
let TableTr = class TableTr extends LitElement {
|
|
10
|
+
render() {
|
|
11
|
+
return html `<slot></slot>`;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
TableTr.styles = [
|
|
15
|
+
css `
|
|
16
|
+
:host {
|
|
17
|
+
display: table-row;
|
|
18
|
+
}
|
|
19
|
+
`
|
|
20
|
+
];
|
|
21
|
+
TableTr = __decorate([
|
|
22
|
+
customElement("sonic-tr")
|
|
23
|
+
], TableTr);
|
|
24
|
+
export { TableTr };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import "./table-tr.ts";
|
|
3
|
+
import "./table-th.ts";
|
|
4
|
+
import "./table-td.ts";
|
|
5
|
+
import "./table-thead.ts";
|
|
6
|
+
import "./table-tbody.ts";
|
|
7
|
+
import "./table-tfoot.ts";
|
|
8
|
+
import "./table-caption.ts";
|
|
9
|
+
export declare class Table extends LitElement {
|
|
10
|
+
static styles: import("lit").CSSResult[];
|
|
11
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
12
|
+
striped: boolean;
|
|
13
|
+
sticky: boolean;
|
|
14
|
+
hover: boolean;
|
|
15
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
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 { html, LitElement, css } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import "./table-tr.ts";
|
|
10
|
+
import "./table-th.ts";
|
|
11
|
+
import "./table-td.ts";
|
|
12
|
+
import "./table-thead.ts";
|
|
13
|
+
import "./table-tbody.ts";
|
|
14
|
+
import "./table-tfoot.ts";
|
|
15
|
+
import "./table-caption.ts";
|
|
16
|
+
let Table = class Table extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.size = "md";
|
|
20
|
+
this.striped = false;
|
|
21
|
+
this.sticky = false;
|
|
22
|
+
this.hover = false;
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return html `
|
|
26
|
+
<div class="table-container">
|
|
27
|
+
<div class="table" ?striped=${this.striped} ?hover=${this.hover} ?sticky=${this.sticky}>
|
|
28
|
+
<slot></slot>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
Table.styles = [
|
|
35
|
+
css `
|
|
36
|
+
:host {
|
|
37
|
+
--sc-table-fw: var(--sc-font-weight-base);
|
|
38
|
+
--sc-table-fst: var(--sc-font-style-base);
|
|
39
|
+
--sc-table-fs: 1rem;
|
|
40
|
+
--sc-table-th-fw: bold;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.table-container {
|
|
44
|
+
overflow-x: auto;
|
|
45
|
+
-webkit-overflow-scrolling: touch;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.table {
|
|
49
|
+
width: 100%;
|
|
50
|
+
font-size: var(--sc-table-fs);
|
|
51
|
+
display: table;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/*SIZE*/
|
|
55
|
+
:host([size="2xs"]) {
|
|
56
|
+
--sc-table-fs: 0.6rem;
|
|
57
|
+
}
|
|
58
|
+
:host([size="xs"]) {
|
|
59
|
+
--sc-table-fs: 0.75rem;
|
|
60
|
+
}
|
|
61
|
+
:host([size="sm"]) {
|
|
62
|
+
--sc-table-fs: 0.85rem;
|
|
63
|
+
}
|
|
64
|
+
:host([size="lg"]) {
|
|
65
|
+
--sc-table-fs: 1.2rem;
|
|
66
|
+
}
|
|
67
|
+
:host([size="xl"]) {
|
|
68
|
+
--sc-table-fs: 1.5rem;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
`,
|
|
72
|
+
];
|
|
73
|
+
__decorate([
|
|
74
|
+
property({ type: String, reflect: true })
|
|
75
|
+
], Table.prototype, "size", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
property({ type: Boolean, reflect: true })
|
|
78
|
+
], Table.prototype, "striped", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
property({ type: Boolean, reflect: true })
|
|
81
|
+
], Table.prototype, "sticky", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
property({ type: Boolean, reflect: true })
|
|
84
|
+
], Table.prototype, "hover", void 0);
|
|
85
|
+
Table = __decorate([
|
|
86
|
+
customElement("sonic-table")
|
|
87
|
+
], Table);
|
|
88
|
+
export { Table };
|
|
@@ -7,7 +7,7 @@ export const coreVariables = css `
|
|
|
7
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
|
-
--sc-font-style-base:
|
|
10
|
+
--sc-font-style-base: normal;
|
|
11
11
|
|
|
12
12
|
--sc-headings-font-family: var(--sc-font-family-base);
|
|
13
13
|
--sc-headings-font-style: var(--sc-font-family-base);
|
|
@@ -12,8 +12,9 @@ const darkCss = css `
|
|
|
12
12
|
--sc-warning-content: var(--sc-dark-warning-content, #382800);
|
|
13
13
|
--sc-success-content: var(--sc-dark-success-content, #003320);
|
|
14
14
|
|
|
15
|
-
--sc-base: var(--sc-dark-base, #
|
|
16
|
-
--sc-base-
|
|
15
|
+
--sc-base: var(--sc-dark-base, #1d2634);
|
|
16
|
+
--sc-base-50: var(--sc-dark-base-50, #1f2937);
|
|
17
|
+
--sc-base-100: var(--sc-dark-base-100, #252C36);
|
|
17
18
|
--sc-base-200: var(--sc-dark-base-200, #2c3543);
|
|
18
19
|
--sc-base-300: var(--sc-dark-base-300, #38414e);
|
|
19
20
|
--sc-base-400: var(--sc-dark-base-400, #515964);
|
|
@@ -2,6 +2,7 @@ import "./theme/theme";
|
|
|
2
2
|
import "./badge/badge";
|
|
3
3
|
import "./button/button";
|
|
4
4
|
import "./link/link";
|
|
5
|
+
import "./progress/progress";
|
|
5
6
|
import "./form/input/input";
|
|
6
7
|
import "./form/checkbox/checkbox";
|
|
7
8
|
import "./form/radio/radio";
|
|
@@ -25,3 +26,5 @@ import "./toast/toast";
|
|
|
25
26
|
import "./tooltip/tooltip";
|
|
26
27
|
import "./pop/pop";
|
|
27
28
|
import "./divider/divider";
|
|
29
|
+
import "./card/card";
|
|
30
|
+
import "./table/table";
|
package/core/components/ui/ui.js
CHANGED
|
@@ -4,6 +4,7 @@ import "./theme/theme";
|
|
|
4
4
|
import "./badge/badge";
|
|
5
5
|
import "./button/button";
|
|
6
6
|
import "./link/link";
|
|
7
|
+
import "./progress/progress";
|
|
7
8
|
// FORMS
|
|
8
9
|
import "./form/input/input";
|
|
9
10
|
import "./form/checkbox/checkbox";
|
|
@@ -32,3 +33,5 @@ import "./toast/toast";
|
|
|
32
33
|
import "./tooltip/tooltip";
|
|
33
34
|
import "./pop/pop";
|
|
34
35
|
import "./divider/divider";
|
|
36
|
+
import "./card/card";
|
|
37
|
+
import "./table/table";
|
package/core/mixins/Fetcher.d.ts
CHANGED
|
@@ -58,10 +58,7 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface>>(superClass:
|
|
|
58
58
|
noShadowDom: string | null;
|
|
59
59
|
debug: HTMLElement | null;
|
|
60
60
|
defferedDebug: boolean | null;
|
|
61
|
-
|
|
62
|
-
dispatchEvent(event: Event): void; /**
|
|
63
|
-
* IObserver est l'intersection observer qui permet de charger les données au scroll si l'attribut lazyload est renseigné
|
|
64
|
-
*/
|
|
61
|
+
dispatchEvent(event: Event): void;
|
|
65
62
|
setAttribute(name: string, value: string): void;
|
|
66
63
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
67
64
|
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void;
|
package/core/mixins/Fetcher.js
CHANGED
|
@@ -79,7 +79,7 @@ const Fetcher = (superClass) => {
|
|
|
79
79
|
if (hasLoader)
|
|
80
80
|
Loader.hide();
|
|
81
81
|
if (this.key) {
|
|
82
|
-
data = Objects.traverse(data, this.key.split("."));
|
|
82
|
+
data = Objects.traverse(data, this.key.split("."), true);
|
|
83
83
|
}
|
|
84
84
|
this.props = data;
|
|
85
85
|
this.dispatchEvent(new CustomEvent("load", { detail: this }));
|
|
@@ -55,7 +55,6 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
55
55
|
noShadowDom: string | null;
|
|
56
56
|
debug: HTMLElement | null;
|
|
57
57
|
defferedDebug: boolean | null;
|
|
58
|
-
makeShadow(props: Record<string, any>, value: any): any;
|
|
59
58
|
dispatchEvent(event: Event): void;
|
|
60
59
|
setAttribute(name: string, value: string): void;
|
|
61
60
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
@@ -65,7 +64,9 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
65
64
|
connectedCallback(): void;
|
|
66
65
|
requestUpdate(): void;
|
|
67
66
|
getAttribute(name: string): string;
|
|
68
|
-
hasAttribute(attributeName: String): boolean;
|
|
67
|
+
hasAttribute(attributeName: String): boolean; /**
|
|
68
|
+
* comme radio,mais peut être désélectionné après sélection
|
|
69
|
+
*/
|
|
69
70
|
disconnectedCallback(): void;
|
|
70
71
|
};
|
|
71
72
|
} & T;
|
|
@@ -31,7 +31,6 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
31
31
|
noShadowDom: string | null;
|
|
32
32
|
debug: HTMLElement | null;
|
|
33
33
|
defferedDebug: boolean | null;
|
|
34
|
-
makeShadow(props: Record<string, any>, value: any): any;
|
|
35
34
|
dispatchEvent(event: Event): void;
|
|
36
35
|
setAttribute(name: string, value: string): void;
|
|
37
36
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
@@ -12,7 +12,6 @@ export interface SubscriberInterface {
|
|
|
12
12
|
noShadowDom: string | null;
|
|
13
13
|
debug: HTMLElement | null;
|
|
14
14
|
defferedDebug: boolean | null;
|
|
15
|
-
makeShadow(props: Record<string, any>, value: any): any;
|
|
16
15
|
dispatchEvent(event: Event): void;
|
|
17
16
|
setAttribute(name: string, value: string): void;
|
|
18
17
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -92,21 +92,6 @@ const Subscriber = (superClass) => {
|
|
|
92
92
|
this.onAssign = null;
|
|
93
93
|
this.args = args;
|
|
94
94
|
}
|
|
95
|
-
/**
|
|
96
|
-
* retourne un objet contenant les propriétés de value + celle de props si elle ne sont pas déjà dans value.
|
|
97
|
-
*/
|
|
98
|
-
makeShadow(props, value) {
|
|
99
|
-
if (typeof value == "object" && value !== null) {
|
|
100
|
-
let newValue = Array.isArray(value) ? [] : {};
|
|
101
|
-
Object.assign(newValue, value);
|
|
102
|
-
value = newValue;
|
|
103
|
-
for (let key in props) {
|
|
104
|
-
if (!value[key])
|
|
105
|
-
value[key] = props[key];
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return value;
|
|
109
|
-
}
|
|
110
95
|
/**
|
|
111
96
|
* va de parent en parent pour trouver un attribut
|
|
112
97
|
* @param attributeName nom de l'attribut
|
package/core/utils/Objects.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ declare class Objects {
|
|
|
17
17
|
static isUndefindOrNull(object: any): boolean;
|
|
18
18
|
/**
|
|
19
19
|
* traverse l'objet pour obtenir la valeur a l'adresse donnée via le tableau de clés pathArray.
|
|
20
|
+
* Si extendValues = true, les propriétés des objets parents sont copiées au fur et a mesure de la descente dans la hierarchie, avant l'assignation des propriétés de l'objet lui même.
|
|
20
21
|
*/
|
|
21
|
-
static traverse(obj: any, pathArray: string[]): any;
|
|
22
|
+
static traverse(obj: any, pathArray: string[], extendValues?: boolean): any;
|
|
22
23
|
}
|
|
23
24
|
export default Objects;
|
package/core/utils/Objects.js
CHANGED
|
@@ -48,14 +48,20 @@ class Objects {
|
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* traverse l'objet pour obtenir la valeur a l'adresse donnée via le tableau de clés pathArray.
|
|
51
|
+
* Si extendValues = true, les propriétés des objets parents sont copiées au fur et a mesure de la descente dans la hierarchie, avant l'assignation des propriétés de l'objet lui même.
|
|
51
52
|
*/
|
|
52
|
-
static traverse(obj, pathArray) {
|
|
53
|
+
static traverse(obj, pathArray, extendValues = false) {
|
|
53
54
|
for (let key of pathArray) {
|
|
54
55
|
let newObj = obj[key];
|
|
55
56
|
if (newObj === undefined) {
|
|
56
57
|
return undefined;
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
+
if (extendValues && Objects.isObject(newObj)) {
|
|
60
|
+
obj = Object.assign(Array.isArray(newObj) ? [] : {}, obj, newObj);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
obj = obj[key];
|
|
64
|
+
}
|
|
59
65
|
}
|
|
60
66
|
return obj;
|
|
61
67
|
}
|
|
@@ -59,7 +59,7 @@ export class PublisherProxy {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
_publishAssignement_(lockInternalMutationsTransmission = false) {
|
|
62
|
-
this._assignListeners_.forEach((handler) => handler(this.
|
|
62
|
+
this._assignListeners_.forEach((handler) => handler(this.get()));
|
|
63
63
|
this._publishInternalMutation_(lockInternalMutationsTransmission);
|
|
64
64
|
}
|
|
65
65
|
_publishInvalidation_() {
|
|
@@ -93,7 +93,7 @@ export class PublisherProxy {
|
|
|
93
93
|
if (typeof handler != "function")
|
|
94
94
|
return;
|
|
95
95
|
this._assignListeners_.add(handler);
|
|
96
|
-
handler(this.
|
|
96
|
+
handler(this.get());
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* Stop les appels de la fonction "handler" (passée en paramettre) lorsque la valeur gérée par le proxy change par assignation
|
|
@@ -181,6 +181,9 @@ export class PublisherProxy {
|
|
|
181
181
|
* Assigne une nouvelle valeur au proxy ce qui déclenche la transmission de la donnée en fonction des "écouteurs" associés
|
|
182
182
|
*/
|
|
183
183
|
set(newValue, lockInternalMutationsTransmission = false) {
|
|
184
|
+
/**
|
|
185
|
+
* On retounre tout de suite si la valeur n'a pas changé
|
|
186
|
+
*/
|
|
184
187
|
if (this._value_ === newValue)
|
|
185
188
|
return true;
|
|
186
189
|
if (this._value_.hasOwnProperty("__value") &&
|
|
@@ -188,24 +191,45 @@ export class PublisherProxy {
|
|
|
188
191
|
this._value_.__value === newValue.__value) {
|
|
189
192
|
return true;
|
|
190
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* On assigne la nouvelle valeur
|
|
196
|
+
*/
|
|
191
197
|
this._value_ = newValue;
|
|
192
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Si il s'agit d'une valeur primitive (un entier, une chaine ) la valeure en renseignée par un objet contenant la vaeur {__value}
|
|
200
|
+
* On publie juste et on sen va.
|
|
201
|
+
*/
|
|
202
|
+
const isPrimitiveValue = (this._value_.hasOwnProperty("__value"));
|
|
203
|
+
if (isPrimitiveValue) {
|
|
193
204
|
this._publishAssignement_(lockInternalMutationsTransmission);
|
|
194
205
|
return true;
|
|
195
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* On fait la diff sur l'existant.
|
|
209
|
+
* On maintient les proxys à supprimer et ceux à ajouter.
|
|
210
|
+
* On met à jour leur valeur interne
|
|
211
|
+
* On publie les maj au fur et a mesure de modifications
|
|
212
|
+
*/
|
|
196
213
|
Array.from(this._proxies_.keys()).forEach((key) => {
|
|
197
|
-
|
|
214
|
+
/**
|
|
215
|
+
* On supprime les proxys qui ne sont plus dans la nouvelle valeur si ils n'on pas d'écouteurs
|
|
216
|
+
**/
|
|
198
217
|
if (!this._value_[key] && this._proxies_.has(key) && !this._proxies_.get(key).hasListener()) {
|
|
199
218
|
this._proxies_.delete(key);
|
|
200
219
|
}
|
|
201
220
|
});
|
|
221
|
+
/**
|
|
222
|
+
* Si la donnée est complexe (objet, tableau)
|
|
223
|
+
* on crée les proxys pour les sous-éléments qui n'en on pas
|
|
224
|
+
* On renseigne les nouvelles valeurs internes des proxies
|
|
225
|
+
*/
|
|
202
226
|
if (isComplex(this._value_)) {
|
|
203
227
|
for (let key in this._value_) {
|
|
204
228
|
let v = newValue[key];
|
|
205
229
|
let isVComplex = isComplex(v);
|
|
206
230
|
let valueV = isVComplex ? v : { __value: v };
|
|
207
231
|
if (!this._proxies_.has(key)) {
|
|
208
|
-
let newPublisher = new Publisher(
|
|
232
|
+
let newPublisher = new Publisher({}, this);
|
|
209
233
|
this._proxies_.set(key, newPublisher, true);
|
|
210
234
|
newPublisher._proxies_.set("_parent_", this);
|
|
211
235
|
}
|
|
@@ -213,6 +237,9 @@ export class PublisherProxy {
|
|
|
213
237
|
this._publishDynamicFilling_(key, v);
|
|
214
238
|
}
|
|
215
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* On prévient les écouteurs que la valeur a changé
|
|
242
|
+
*/
|
|
216
243
|
this._publishAssignement_();
|
|
217
244
|
return true;
|
|
218
245
|
}
|
|
@@ -220,8 +247,10 @@ export class PublisherProxy {
|
|
|
220
247
|
* Extraire la valeur actuelle du proxy
|
|
221
248
|
*/
|
|
222
249
|
get() {
|
|
223
|
-
if (this._value_.hasOwnProperty("__value"))
|
|
224
|
-
|
|
250
|
+
if (this._value_.hasOwnProperty("__value")) {
|
|
251
|
+
let v = this._value_.__value;
|
|
252
|
+
return v != undefined ? v : null;
|
|
253
|
+
}
|
|
225
254
|
return this._value_;
|
|
226
255
|
}
|
|
227
256
|
}
|
|
@@ -344,24 +373,25 @@ export default class Publisher extends PublisherProxy {
|
|
|
344
373
|
* Les gestionnairs associés sopnt déclenchés en conséquence de manière profonde et remontante si nécessaire.
|
|
345
374
|
*/
|
|
346
375
|
set: function (oTarget, sKey, vValue) {
|
|
376
|
+
//Fonctionnement pour la donnée interne pas de dispatch;
|
|
347
377
|
if (sKey == "_value_") {
|
|
348
378
|
oTarget._value_ = vValue;
|
|
349
379
|
return oTarget._value_;
|
|
350
380
|
}
|
|
351
|
-
|
|
381
|
+
//Création du publisher si il n'existe pas
|
|
352
382
|
if (!that._proxies_.has(sKey)) {
|
|
353
|
-
let newPublisher = new Publisher(
|
|
383
|
+
let newPublisher = new Publisher({}, that);
|
|
354
384
|
newPublisher._proxies_.set("_parent_", thisProxy);
|
|
355
385
|
that._proxies_.set(sKey, newPublisher);
|
|
356
386
|
}
|
|
357
|
-
|
|
358
|
-
return vValue;
|
|
387
|
+
//mis à jour et publication de la donnée si elle a changé
|
|
359
388
|
const prevValue = that._value_[sKey];
|
|
360
389
|
if (prevValue !== vValue) {
|
|
361
390
|
that._value_[sKey] = vValue;
|
|
362
391
|
that._publishDynamicFilling_(sKey, vValue);
|
|
392
|
+
that._proxies_.get(sKey).set(isComplex(vValue) ? vValue : { __value: vValue });
|
|
363
393
|
}
|
|
364
|
-
|
|
394
|
+
//on retourne le proxy pour pouvoir chainer les assignements
|
|
365
395
|
return that._proxies_.get(sKey);
|
|
366
396
|
},
|
|
367
397
|
/**
|
package/core/utils/api.js
CHANGED
|
@@ -84,7 +84,7 @@ class API {
|
|
|
84
84
|
* Concatène le serviceURL et le endpoint donné en paramètre
|
|
85
85
|
*/
|
|
86
86
|
computeURL(path) {
|
|
87
|
-
return (this.serviceURL + "/" + path).replace(
|
|
87
|
+
return (this.serviceURL + "/" + path).replace(/([^(https?\:)])\/{2,}/g, "$1/");
|
|
88
88
|
}
|
|
89
89
|
/*
|
|
90
90
|
* Envoie des données au endPoint passé en paramètre. par défaut en POST
|