@kubex/zinc 1.0.13 → 1.0.15
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/dist/custom-elements.json +135 -24
- package/dist/vscode.html-custom-data.json +2 -2
- package/dist/web-types.json +8 -8
- package/dist/zn.d.ts +11 -4
- package/dist/zn.min.js +204 -172
- package/docs/pages/components/note.md +11 -1
- package/package.json +1 -1
- package/src/components/content-block/content-block.scss +35 -23
- package/src/components/data-table/data-table.component.ts +160 -45
- package/src/components/data-table/data-table.scss +56 -10
- package/src/components/editor/editor.component.ts +1 -1
- package/src/components/filter-container/filter-container.component.ts +1 -1
- package/src/components/filter-wrapper/filter-wrapper.component.ts +1 -1
- package/src/components/form-group/form-group.component.ts +0 -1
- package/src/components/form-group/form-group.scss +0 -1
- package/src/components/note/note.component.ts +20 -34
- package/src/components/note/note.scss +8 -0
- package/src/components/tile/tile.component.ts +3 -1
|
@@ -9,7 +9,17 @@ layout: component
|
|
|
9
9
|
|
|
10
10
|
<zn-note color="gray">
|
|
11
11
|
<span slot="caption">The caption</span>
|
|
12
|
-
<
|
|
12
|
+
<div slot="snippet">This is a short version of the below.</div>
|
|
13
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam, autem deleniti, dolore dolores ea enim fugit
|
|
14
|
+
harum incidunt minima numquam possimus praesentium quaerat quasi sequi sunt temporibus ut velit, veniam. Aut dolor
|
|
15
|
+
eius quae. Consequatur deleniti ipsum itaque pariatur ullam velit! Alias aut delectus dolores esse fuga iure laborum
|
|
16
|
+
magnam maiores minima, minus, natus placeat provident quasi ratione ullam ut? Fugit nisi placeat quidem suscipit
|
|
17
|
+
voluptatum? Adipisci aspernatur assumenda consequatur dolore ea esse exercitationem ipsum maiores minima neque saepe,
|
|
18
|
+
voluptates voluptatibus! A ab adipisci consequatur, esse eveniet itaque sed soluta! Aliquid animi blanditiis dolores
|
|
19
|
+
dolorum eum facere fugit harum id illo, laboriosam laborum libero magni minus natus nihil perspiciatis porro quae
|
|
20
|
+
quisquam, ratione rem repellat sequi sit suscipit voluptas voluptatum. Atque delectus eos fugit illo sit soluta
|
|
21
|
+
suscipit vero? At consectetur culpa dolor, dolores ea earum enim error et expedita iste laudantium nam necessitatibus
|
|
22
|
+
quaerat, quis sed tempora vel voluptatum?
|
|
13
23
|
<span slot="date">
|
|
14
24
|
<small>11/10/24</small>
|
|
15
25
|
</span>
|
package/package.json
CHANGED
|
@@ -73,52 +73,59 @@ zn-panel:not(.content-block--short) zn-header::part(header-description) {
|
|
|
73
73
|
display: none;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
counter-
|
|
76
|
+
ol {
|
|
77
|
+
counter-reset: list-0 0;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
@supports (counter-set:none) {
|
|
81
|
-
li
|
|
81
|
+
ol li, ul li {
|
|
82
82
|
counter-set: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
ol, ul {
|
|
87
|
+
padding: 0;
|
|
88
|
+
margin: 0;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
li[data-list=checked] > .ql-ui
|
|
91
|
-
|
|
91
|
+
li[data-list=checked] > .ql-ui, li[data-list=unchecked] > .ql-ui {
|
|
92
|
+
color: #777;
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
li
|
|
95
|
-
|
|
95
|
+
li {
|
|
96
|
+
list-style-type: none;
|
|
97
|
+
padding-left: 1em;
|
|
98
|
+
position: relative;
|
|
96
99
|
}
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
content:
|
|
101
|
+
ul > li::before {
|
|
102
|
+
content: "•";
|
|
100
103
|
}
|
|
101
104
|
|
|
102
|
-
ol {
|
|
103
|
-
|
|
104
|
-
margin: 0;
|
|
105
|
+
ol > li {
|
|
106
|
+
counter-increment: list-0;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
ol > li::before {
|
|
110
|
+
content: counter(list-0) ". ";
|
|
109
111
|
}
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
/* Checkbox list markers */
|
|
114
|
+
li[data-list="checked"]::before {
|
|
115
|
+
content: "☑";
|
|
113
116
|
}
|
|
114
117
|
|
|
115
|
-
li {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
li[data-list="unchecked"]::before {
|
|
119
|
+
content: "☐";
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
li[data-list="checked"]::before,
|
|
123
|
+
li[data-list="unchecked"]::before {
|
|
124
|
+
color: #777;
|
|
119
125
|
}
|
|
120
126
|
|
|
121
|
-
li
|
|
127
|
+
ol li::before,
|
|
128
|
+
ul li::before {
|
|
122
129
|
display: inline-block;
|
|
123
130
|
margin-left: -1.5em;
|
|
124
131
|
margin-right: 0.3em;
|
|
@@ -126,3 +133,8 @@ li > .ql-ui::before {
|
|
|
126
133
|
white-space: nowrap;
|
|
127
134
|
width: 1.2em;
|
|
128
135
|
}
|
|
136
|
+
|
|
137
|
+
li:has(> .ql-ui)::before {
|
|
138
|
+
content: none;
|
|
139
|
+
display: none;
|
|
140
|
+
}
|
|
@@ -92,6 +92,7 @@ interface HeaderConfig {
|
|
|
92
92
|
filterable?: boolean;
|
|
93
93
|
hideHeader?: boolean;
|
|
94
94
|
hideColumn?: boolean;
|
|
95
|
+
secondary?: boolean;
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
interface DataRequest {
|
|
@@ -157,6 +158,7 @@ export default class ZnDataTable extends ZincElement {
|
|
|
157
158
|
@property({attribute: 'data', type: Object, reflect: true}) data: any;
|
|
158
159
|
@property({attribute: 'sort-column'}) sortColumn: string;
|
|
159
160
|
@property({attribute: 'sort-direction'}) sortDirection: string = "asc";
|
|
161
|
+
@property({attribute: 'local-sort', type: Boolean}) localSort: boolean = false;
|
|
160
162
|
@property({attribute: 'filter'}) filter: string = '';
|
|
161
163
|
@property({attribute: 'wide-column'}) wideColumn: string;
|
|
162
164
|
@property({attribute: 'key'}) key: string = 'id';
|
|
@@ -252,7 +254,7 @@ export default class ZnDataTable extends ZincElement {
|
|
|
252
254
|
const params: Record<string, any> = {};
|
|
253
255
|
if (inputs) {
|
|
254
256
|
inputs.forEach((input) => {
|
|
255
|
-
const allowedInputs = ['zn-input', 'zn-select', 'zn-query-builder', 'zn-multiselect', 'zn-params-select', 'input', 'select', 'textarea'];
|
|
257
|
+
const allowedInputs = ['zn-input', 'zn-select', 'zn-query-builder', 'zn-multiselect', 'zn-params-select', 'zn-datepicker', 'input', 'select', 'textarea'];
|
|
256
258
|
if (allowedInputs.includes(input.tagName.toLowerCase())) {
|
|
257
259
|
const value = (input as AllowedInputElement).value as string || input.getAttribute('value');
|
|
258
260
|
const name = (input as AllowedInputElement).name || input.getAttribute('name');
|
|
@@ -289,6 +291,10 @@ export default class ZnDataTable extends ZincElement {
|
|
|
289
291
|
|
|
290
292
|
private rowHasActions: boolean = false;
|
|
291
293
|
|
|
294
|
+
private _expandedRows: Set<string> = new Set();
|
|
295
|
+
private _hiddenCells: Map<string, Cell[]> = new Map();
|
|
296
|
+
private _secondaryHeaders: HeaderConfig[];
|
|
297
|
+
|
|
292
298
|
requestParams: Record<string, any> = {};
|
|
293
299
|
|
|
294
300
|
refresh() {
|
|
@@ -458,22 +464,40 @@ export default class ZnDataTable extends ZincElement {
|
|
|
458
464
|
}
|
|
459
465
|
|
|
460
466
|
public renderTableData(data: any) {
|
|
467
|
+
// Primary (visible) headers exclude those explicitly hidden and those marked as secondary
|
|
461
468
|
const filteredHeaders = Object.values(this.headers).filter((header: HeaderConfig) => {
|
|
462
|
-
if (header.hideHeader || header.hideColumn)
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
469
|
+
if (header.hideHeader || header.hideColumn) return false;
|
|
470
|
+
|
|
471
|
+
if (Object.values(this.hiddenColumns).includes(header.key)) return false;
|
|
472
|
+
|
|
473
|
+
return !header.secondary;
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
// Secondary headers (shown in expandable details)
|
|
477
|
+
this._secondaryHeaders = Object.values(this.headers).filter((header: HeaderConfig) => {
|
|
478
|
+
if (header.hideColumn) return false;
|
|
479
|
+
|
|
480
|
+
if (Object.values(this.hiddenColumns).includes(header.key)) return false;
|
|
481
|
+
|
|
482
|
+
return header.secondary === true;
|
|
466
483
|
});
|
|
467
484
|
|
|
468
485
|
this.rowHasActions = this._rows.some((row: Row) => row.actions && row.actions.length > 0);
|
|
469
486
|
|
|
470
|
-
//
|
|
487
|
+
// Compute and store hidden cells per row (secondary items only), and reorder visible cells to match header order
|
|
488
|
+
const secondaryKeys = new Set(this._secondaryHeaders.map(h => h.key));
|
|
489
|
+
this._hiddenCells.clear();
|
|
490
|
+
const visibleRowCells: Map<string, Cell[]> = new Map();
|
|
491
|
+
|
|
471
492
|
this._rows.forEach((row: Row) => {
|
|
493
|
+
const originalCells = Array.isArray(row.cells) ? row.cells : [];
|
|
472
494
|
const orderedCells: Cell[] = [];
|
|
473
|
-
|
|
495
|
+
|
|
496
|
+
const hiddenCells = originalCells.filter((c: Cell) => secondaryKeys.has(c.column));
|
|
497
|
+
this._hiddenCells.set(row.id, hiddenCells);
|
|
474
498
|
|
|
475
499
|
filteredHeaders.forEach((header: HeaderConfig) => {
|
|
476
|
-
const cell =
|
|
500
|
+
const cell = originalCells.find((c: Cell) => c.column === header.key);
|
|
477
501
|
if (cell) {
|
|
478
502
|
orderedCells.push(cell);
|
|
479
503
|
} else {
|
|
@@ -481,9 +505,12 @@ export default class ZnDataTable extends ZincElement {
|
|
|
481
505
|
}
|
|
482
506
|
});
|
|
483
507
|
|
|
484
|
-
row.
|
|
508
|
+
visibleRowCells.set(row.id, orderedCells);
|
|
485
509
|
});
|
|
486
510
|
|
|
511
|
+
const anyHidden = this.hasHiddenColumns();
|
|
512
|
+
const colCount = filteredHeaders.length + (this.rowHasActions ? 1 : 0) + (anyHidden ? 1 : 0);
|
|
513
|
+
|
|
487
514
|
return html`
|
|
488
515
|
<div style="overflow-x: auto">
|
|
489
516
|
<table class="${classMap({
|
|
@@ -493,17 +520,27 @@ export default class ZnDataTable extends ZincElement {
|
|
|
493
520
|
})}">
|
|
494
521
|
<thead>
|
|
495
522
|
<tr>
|
|
523
|
+
${anyHidden ? html`
|
|
524
|
+
<th class="table__head table__head--expander"></th>` : nothing}
|
|
496
525
|
${filteredHeaders.map((header: HeaderConfig) => this.renderCellHeader(header))}
|
|
497
526
|
${this.rowHasActions ? html`
|
|
498
527
|
<th></th>` : html``}
|
|
499
528
|
</tr>
|
|
500
529
|
</thead>
|
|
501
530
|
<tbody>
|
|
502
|
-
${data.map((row: Row) => html`
|
|
503
|
-
<tr class="${classMap({
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
531
|
+
${(data as Row[]).map((row: Row, rowIndex: number) => html`
|
|
532
|
+
<tr class="${classMap({
|
|
533
|
+
'table__row--selected': this.isRowSelected(row),
|
|
534
|
+
'table__row--data': true,
|
|
535
|
+
'table__row--even': (rowIndex % 2) === 0,
|
|
536
|
+
'table__row--odd': (rowIndex % 2) === 1,
|
|
537
|
+
})}" data-row-id="${row.id}">
|
|
538
|
+
${anyHidden ? this.renderExpanderCell(row) : nothing}
|
|
539
|
+
${(visibleRowCells.get(row.id) || row.cells).map((value: Cell, index: number) => this.renderCellBody(index, value))}
|
|
540
|
+
${this.rowHasActions ? this.renderActions(row) : nothing}
|
|
541
|
+
</tr>
|
|
542
|
+
${this._expandedRows.has(row.id) ? this.renderDetailsRow(row, colCount) : nothing}
|
|
543
|
+
`)}
|
|
507
544
|
</tbody>
|
|
508
545
|
</table>
|
|
509
546
|
</div>
|
|
@@ -743,7 +780,7 @@ export default class ZnDataTable extends ZincElement {
|
|
|
743
780
|
return;
|
|
744
781
|
}
|
|
745
782
|
|
|
746
|
-
const rows = Array.from(this.renderRoot.querySelectorAll('tbody tr'));
|
|
783
|
+
const rows = Array.from(this.renderRoot.querySelectorAll('tbody tr:not([data-details="true"])'));
|
|
747
784
|
const index = rows.indexOf(parent as HTMLTableRowElement);
|
|
748
785
|
if (index === -1) return;
|
|
749
786
|
|
|
@@ -777,7 +814,13 @@ export default class ZnDataTable extends ZincElement {
|
|
|
777
814
|
return () => {
|
|
778
815
|
this.sortColumn = key;
|
|
779
816
|
this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
|
|
780
|
-
|
|
817
|
+
|
|
818
|
+
if (this.localSort) {
|
|
819
|
+
this._rows = this.sortLocalData(this._rows as Row[]);
|
|
820
|
+
this.requestUpdate();
|
|
821
|
+
} else {
|
|
822
|
+
this._dataTask.run().then(r => r);
|
|
823
|
+
}
|
|
781
824
|
};
|
|
782
825
|
}
|
|
783
826
|
|
|
@@ -900,15 +943,24 @@ export default class ZnDataTable extends ZincElement {
|
|
|
900
943
|
|
|
901
944
|
private renderCellHeader(header: HeaderConfig) {
|
|
902
945
|
const sortable = !Object.values(this.unsortableHeaders).includes(header.key) && !Object.values(this.hiddenHeaders).includes(header.key) && !this.unsortable;
|
|
903
|
-
|
|
904
|
-
|
|
946
|
+
|
|
947
|
+
// Determine the last visible header considering secondary flags and hidden columns
|
|
948
|
+
const lastVisibleHeaderKey = Object.values(this.headers)
|
|
949
|
+
.filter((h: HeaderConfig) => {
|
|
950
|
+
if (h.hideHeader || h.hideColumn) return false;
|
|
951
|
+
|
|
952
|
+
if (Object.values(this.hiddenColumns).includes(h.key)) return false;
|
|
953
|
+
|
|
954
|
+
return !h.secondary;
|
|
955
|
+
})
|
|
956
|
+
.slice(-1)[0]?.key;
|
|
905
957
|
|
|
906
958
|
return html`
|
|
907
959
|
<th
|
|
908
960
|
class="${classMap({
|
|
909
961
|
'table__head': true,
|
|
910
962
|
'table__head--wide': header.key === this.wideColumn,
|
|
911
|
-
'table__head--last': header.key ===
|
|
963
|
+
'table__head--last': header.key === lastVisibleHeaderKey,
|
|
912
964
|
'table__head--hidden': Object.values(this.hiddenHeaders).includes(header.key),
|
|
913
965
|
})}"
|
|
914
966
|
@click="${sortable ? this.updateSort(header.key) : undefined}">
|
|
@@ -922,16 +974,13 @@ export default class ZnDataTable extends ZincElement {
|
|
|
922
974
|
|
|
923
975
|
private renderCellBody(index: number, value: Cell) {
|
|
924
976
|
const filteredHeaders = Object.values(this.headers).filter((header: HeaderConfig) => {
|
|
925
|
-
if (header.hideHeader || header.hideColumn)
|
|
926
|
-
return false;
|
|
927
|
-
}
|
|
928
|
-
return !Object.values(this.hiddenColumns).includes(header.key);
|
|
929
|
-
});
|
|
977
|
+
if (header.hideHeader || header.hideColumn) return false;
|
|
930
978
|
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
979
|
+
if (Object.values(this.hiddenColumns).includes(header.key)) return false;
|
|
980
|
+
|
|
981
|
+
return !header.secondary;
|
|
982
|
+
});
|
|
983
|
+
const headerKey: string = filteredHeaders[index]?.key;
|
|
935
984
|
|
|
936
985
|
return html`
|
|
937
986
|
<td
|
|
@@ -945,28 +994,75 @@ export default class ZnDataTable extends ZincElement {
|
|
|
945
994
|
</td>`;
|
|
946
995
|
}
|
|
947
996
|
|
|
997
|
+
private hasHiddenColumns(): boolean {
|
|
998
|
+
return this._secondaryHeaders.length > 0;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
private renderExpanderCell(row: Row) {
|
|
1002
|
+
const hasHidden = (this._hiddenCells.get(row.id) || []).length > 0;
|
|
1003
|
+
if (!hasHidden) return html`
|
|
1004
|
+
<td class="table__cell table__cell--expander"></td>`;
|
|
1005
|
+
|
|
1006
|
+
const expanded = this._expandedRows.has(row.id);
|
|
1007
|
+
const icon = expanded ? 'expand_more' : 'chevron_right';
|
|
1008
|
+
|
|
1009
|
+
return html`
|
|
1010
|
+
<td class="table__cell table__cell--expander">
|
|
1011
|
+
<zn-button
|
|
1012
|
+
color="transparent"
|
|
1013
|
+
size="x-small"
|
|
1014
|
+
icon="${icon}"
|
|
1015
|
+
icon-size="18"
|
|
1016
|
+
aria-label="${expanded ? 'Collapse row' : 'Expand row'}"
|
|
1017
|
+
@click="${(e: Event) => this.toggleRowExpansion(e, row)}">
|
|
1018
|
+
</zn-button>
|
|
1019
|
+
</td>`;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
private renderDetailsRow(row: Row, colSpan: number) {
|
|
1023
|
+
const hiddenCells = this._hiddenCells.get(row.id) || [];
|
|
1024
|
+
if (hiddenCells.length === 0) return html``;
|
|
1025
|
+
|
|
1026
|
+
return html`
|
|
1027
|
+
<tr class="table__row--details" data-details="true">
|
|
1028
|
+
<td colspan="${colSpan}">
|
|
1029
|
+
<div class="table__details">
|
|
1030
|
+
${hiddenCells.map((cell: Cell) => {
|
|
1031
|
+
const header = Object.values(this.headers).find((h: HeaderConfig) => h.key === cell.column);
|
|
1032
|
+
const label = header?.label || this.humanize(cell.column);
|
|
1033
|
+
return html`
|
|
1034
|
+
<div class="table__details__item">
|
|
1035
|
+
<div class="table__details__label">${label}</div>
|
|
1036
|
+
<div class="table__details__value">${this.renderCell(cell)}</div>
|
|
1037
|
+
</div>`;
|
|
1038
|
+
})}
|
|
1039
|
+
</div>
|
|
1040
|
+
</td>
|
|
1041
|
+
</tr>`;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
private toggleRowExpansion(e: Event, row: Row) {
|
|
1045
|
+
e.stopPropagation();
|
|
1046
|
+
|
|
1047
|
+
if (this._expandedRows.has(row.id)) {
|
|
1048
|
+
this._expandedRows.delete(row.id);
|
|
1049
|
+
} else {
|
|
1050
|
+
this._expandedRows.add(row.id);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
this.requestUpdate();
|
|
1054
|
+
}
|
|
1055
|
+
|
|
948
1056
|
private isRowSelected(row: Row): boolean {
|
|
949
1057
|
return this.selectedRows.some((r: Row) => r.id === row.id);
|
|
950
1058
|
}
|
|
951
1059
|
|
|
952
1060
|
private getRows(data: Response): Row[] {
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
sourceRows.sort((rowA: Row, rowB: Row) => {
|
|
960
|
-
const getCellForSort = (row: Row): Cell => {
|
|
961
|
-
const byHeading = row.cells.find((cell: Cell) => cell.column === this.sortColumn);
|
|
962
|
-
if (byHeading !== undefined) return byHeading as unknown as Cell;
|
|
963
|
-
return row.cells[sortIndex];
|
|
964
|
-
};
|
|
965
|
-
|
|
966
|
-
const aVal = getCellForSort(rowA);
|
|
967
|
-
const bVal = getCellForSort(rowB);
|
|
968
|
-
return this.sortData(aVal, bVal);
|
|
969
|
-
});
|
|
1061
|
+
// Copy rows to avoid mutating original data
|
|
1062
|
+
const sourceRows = Array.isArray(data.rows) ? data.rows.slice() : [];
|
|
1063
|
+
|
|
1064
|
+
if (this.localSort && this.sortColumn) {
|
|
1065
|
+
return this.sortLocalData(sourceRows);
|
|
970
1066
|
}
|
|
971
1067
|
|
|
972
1068
|
return sourceRows;
|
|
@@ -1035,6 +1131,25 @@ export default class ZnDataTable extends ZincElement {
|
|
|
1035
1131
|
return aNormal < bNormal ? 1 : aNormal > bNormal ? -1 : 0;
|
|
1036
1132
|
}
|
|
1037
1133
|
|
|
1134
|
+
private sortLocalData(rows: Row[]): Row[] {
|
|
1135
|
+
if (!this.sortColumn) return rows;
|
|
1136
|
+
|
|
1137
|
+
const headerKeys = Object.keys(this.headers);
|
|
1138
|
+
const sortIndex = headerKeys.indexOf(this.sortColumn);
|
|
1139
|
+
|
|
1140
|
+
const getCellForSort = (row: Row): Cell => {
|
|
1141
|
+
const byHeading = row.cells.find((cell: Cell) => cell.column === this.sortColumn);
|
|
1142
|
+
if (byHeading !== undefined) return byHeading as unknown as Cell;
|
|
1143
|
+
return row.cells[sortIndex];
|
|
1144
|
+
};
|
|
1145
|
+
|
|
1146
|
+
return rows.slice().sort((rowA: Row, rowB: Row) => {
|
|
1147
|
+
const aVal = getCellForSort(rowA);
|
|
1148
|
+
const bVal = getCellForSort(rowB);
|
|
1149
|
+
return this.sortData(aVal, bVal);
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1038
1153
|
private loadingTable() {
|
|
1039
1154
|
return html`
|
|
1040
1155
|
<div class="table-container">
|
|
@@ -18,6 +18,18 @@ table {
|
|
|
18
18
|
table-layout: auto;
|
|
19
19
|
text-align: left;
|
|
20
20
|
|
|
21
|
+
tbody tr:nth-of-type(even) {
|
|
22
|
+
background-color: unset !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
tbody tr.table__row--data.table__row--odd:not(.table__row--selected) td {
|
|
26
|
+
background-color: rgba(var(--zn-body));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
tbody tr.table__row--details td {
|
|
30
|
+
background-color: rgb(var(--zn-shadow));
|
|
31
|
+
}
|
|
32
|
+
|
|
21
33
|
&.table--standalone {
|
|
22
34
|
background-color: rgb(var(--zn-panel));
|
|
23
35
|
border-radius: var(--zn-border-radius-large);
|
|
@@ -34,11 +46,16 @@ table {
|
|
|
34
46
|
border-bottom: 1px solid rgb(var(--zn-border-color)) !important;
|
|
35
47
|
}
|
|
36
48
|
|
|
37
|
-
&.with-hover tbody tr:hover {
|
|
49
|
+
&.with-hover tbody tr.table__row--data:not(.table__row--selected):hover td {
|
|
38
50
|
background-color: rgba(var(--zn-primary), 0.05) !important;
|
|
39
51
|
cursor: pointer;
|
|
40
52
|
}
|
|
41
53
|
|
|
54
|
+
&.with-hover tbody tr.table__row--details:hover {
|
|
55
|
+
background-color: inherit;
|
|
56
|
+
cursor: default;
|
|
57
|
+
}
|
|
58
|
+
|
|
42
59
|
tbody tr td {
|
|
43
60
|
border-top: 1px solid rgb(var(--zn-border-color)) !important;
|
|
44
61
|
}
|
|
@@ -47,10 +64,6 @@ table {
|
|
|
47
64
|
border-top: 0 !important;
|
|
48
65
|
}
|
|
49
66
|
|
|
50
|
-
tbody tr:nth-of-type(even) {
|
|
51
|
-
background-color: rgba(var(--zn-body));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
67
|
thead tr th:first-of-type,
|
|
55
68
|
tbody tr td:first-of-type {
|
|
56
69
|
padding-left: 14px;
|
|
@@ -169,6 +182,12 @@ table {
|
|
|
169
182
|
visibility: hidden;
|
|
170
183
|
}
|
|
171
184
|
}
|
|
185
|
+
|
|
186
|
+
&--expander {
|
|
187
|
+
width: 28px;
|
|
188
|
+
min-width: 28px;
|
|
189
|
+
padding-right: 0;
|
|
190
|
+
}
|
|
172
191
|
}
|
|
173
192
|
|
|
174
193
|
&__cell {
|
|
@@ -232,6 +251,11 @@ table {
|
|
|
232
251
|
gap: var(--zn-spacing-small);
|
|
233
252
|
}
|
|
234
253
|
}
|
|
254
|
+
|
|
255
|
+
&--expander {
|
|
256
|
+
width: 28px;
|
|
257
|
+
min-width: 28px;
|
|
258
|
+
}
|
|
235
259
|
}
|
|
236
260
|
|
|
237
261
|
&__header {
|
|
@@ -306,6 +330,28 @@ table {
|
|
|
306
330
|
}
|
|
307
331
|
}
|
|
308
332
|
}
|
|
333
|
+
|
|
334
|
+
&__details {
|
|
335
|
+
display: grid;
|
|
336
|
+
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
337
|
+
gap: var(--zn-spacing-x-large) !important;
|
|
338
|
+
|
|
339
|
+
&__item {
|
|
340
|
+
display: flex;
|
|
341
|
+
flex-direction: column;
|
|
342
|
+
gap: var(--zn-spacing-2x-small, 4px);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
&__label {
|
|
346
|
+
font-size: 12px;
|
|
347
|
+
color: rgb(var(--zn-text-subtle, var(--zn-text)));
|
|
348
|
+
opacity: 0.8;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
&__value {
|
|
352
|
+
font-size: 14px;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
309
355
|
}
|
|
310
356
|
|
|
311
357
|
.reduced-opacity .table tbody {
|
|
@@ -335,10 +381,6 @@ table {
|
|
|
335
381
|
table tbody tr.table__row--selected {
|
|
336
382
|
background-color: var(--zn-color-purple-100);
|
|
337
383
|
|
|
338
|
-
&:nth-of-type(even) {
|
|
339
|
-
background-color: hsla(from var(--zn-color-purple-200) h s l / 0.8);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
384
|
&:hover {
|
|
343
385
|
background-color: var(--zn-color-purple-200) !important;
|
|
344
386
|
}
|
|
@@ -393,13 +435,16 @@ table tbody tr.table__row--selected {
|
|
|
393
435
|
border-bottom-right-radius: 0;
|
|
394
436
|
}
|
|
395
437
|
}
|
|
438
|
+
|
|
439
|
+
&.table__row--odd {
|
|
440
|
+
background-color: hsla(from var(--zn-color-purple-200) h s l / 0.8);
|
|
441
|
+
}
|
|
396
442
|
}
|
|
397
443
|
|
|
398
444
|
table:has(tbody tr:first-of-type.table__row--selected) thead tr th {
|
|
399
445
|
border-bottom-color: var(--zn-color-purple-600) !important;
|
|
400
446
|
}
|
|
401
447
|
|
|
402
|
-
|
|
403
448
|
.table-group__title {
|
|
404
449
|
font-weight: var(--zn-font-weight-semibold);
|
|
405
450
|
font-size: var(--zn-font-size-large);
|
|
@@ -411,3 +456,4 @@ table:has(tbody tr:first-of-type.table__row--selected) thead tr th {
|
|
|
411
456
|
white-space: nowrap;
|
|
412
457
|
text-overflow: ellipsis;
|
|
413
458
|
}
|
|
459
|
+
|
|
@@ -374,7 +374,7 @@ export default class ZnEditor extends ZincElement implements ZincFormControl {
|
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
private _handleTextChange() {
|
|
377
|
-
this.value = this.quillElement.
|
|
377
|
+
this.value = this.quillElement.getSemanticHTML();
|
|
378
378
|
this.editorHtml.value = this.value;
|
|
379
379
|
this.emit('zn-change');
|
|
380
380
|
}
|
|
@@ -47,7 +47,7 @@ export default class ZnFilterWrapper extends ZincElement {
|
|
|
47
47
|
event.preventDefault();
|
|
48
48
|
const dataTable: ZnDataTable | null = this.closest('zn-data-table');
|
|
49
49
|
if (dataTable) {
|
|
50
|
-
const allowedInputs = ['zn-input', 'zn-select', 'zn-query-builder', 'zn-data-select', 'input', 'select', 'textarea'];
|
|
50
|
+
const allowedInputs = ['zn-input', 'zn-select', 'zn-query-builder', 'zn-data-select', 'zn-datepicker', 'input', 'select', 'textarea'];
|
|
51
51
|
const inputs = Array.from(this.querySelectorAll(allowedInputs.join(','))) as AllowedInputElement[];
|
|
52
52
|
const params: Record<string, any> = {};
|
|
53
53
|
inputs.forEach(input => {
|
|
@@ -35,7 +35,6 @@ export default class ZnFormGroup extends ZincElement {
|
|
|
35
35
|
/** The form groups help text. If you need to display HTML, use the `help-text` slot instead. */
|
|
36
36
|
@property({attribute: 'help-text'}) helpText = '';
|
|
37
37
|
|
|
38
|
-
|
|
39
38
|
render() {
|
|
40
39
|
const hasLabelSlot = this.hasSlotController.test('label');
|
|
41
40
|
const hasLabelTooltipSlot = this.hasSlotController.test('label-tooltip');
|