@kubex/zinc 1.0.7 → 1.0.9
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 +411 -83
- package/dist/vscode.html-custom-data.json +45 -16
- package/dist/web-types.json +104 -34
- package/dist/zn.d.ts +57 -3
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +464 -408
- package/docs/data/products-table.json +203 -0
- package/docs/pages/components/button.md +39 -0
- package/docs/pages/components/data-table.md +21 -0
- package/docs/pages/components/header.md +7 -0
- package/docs/pages/components/order-table.md +82 -5
- package/package.json +1 -1
- package/scss/themes/_light.scss +1 -1
- package/src/components/button/button.component.ts +160 -10
- package/src/components/button/button.scss +85 -0
- package/src/components/content-block/content-block.component.ts +18 -7
- package/src/components/content-block/content-block.scss +58 -2
- package/src/components/data-select/data-select.component.ts +0 -1
- package/src/components/data-table/data-table.component.ts +133 -22
- package/src/components/data-table/data-table.scss +14 -3
- package/src/components/editor/editor.scss +1 -1
- package/src/components/expanding-action/expanding-action.component.ts +1 -1
- package/src/components/header/header.component.ts +8 -2
- package/src/components/header/header.scss +5 -1
- package/src/components/linked-select/linked-select.component.ts +1 -0
- package/src/components/menu/menu.component.ts +0 -1
- package/src/components/navbar/navbar.component.ts +1 -1
- package/src/components/note/note.component.ts +70 -2
- package/src/components/note/note.scss +26 -4
- package/src/components/order-table/order-table.component.ts +49 -28
- package/src/components/panel/panel.component.ts +8 -2
- package/src/components/panel/panel.scss +4 -0
- package/src/components/rating/rating.component.ts +10 -9
- package/src/components/rating/rating.scss +15 -1
- package/src/components/settings-container/settings-container.component.ts +1 -1
- package/src/components/tabs/tabs.component.ts +24 -6
- package/src/internal/form.ts +41 -3
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
border-color: transparent;
|
|
24
24
|
height: 100%;
|
|
25
25
|
display: inline-flex;
|
|
26
|
+
position: relative;
|
|
26
27
|
|
|
27
28
|
&.button--info {
|
|
28
29
|
--btn-color: var(--zn-color-info);
|
|
@@ -39,6 +40,10 @@
|
|
|
39
40
|
&.button--success {
|
|
40
41
|
--btn-color: var(--zn-color-success);
|
|
41
42
|
}
|
|
43
|
+
|
|
44
|
+
&__label--hidden {
|
|
45
|
+
visibility: hidden;
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
.button.button--muted-notification {
|
|
@@ -306,6 +311,86 @@
|
|
|
306
311
|
}
|
|
307
312
|
}
|
|
308
313
|
|
|
314
|
+
.button--loading-bg {
|
|
315
|
+
&-transparent {
|
|
316
|
+
background-color: transparent;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.button--loading {
|
|
321
|
+
&-fill {
|
|
322
|
+
pointer-events: none;
|
|
323
|
+
position: absolute;
|
|
324
|
+
z-index: 1;
|
|
325
|
+
background-color: rgba(var(--btn-color), .85);
|
|
326
|
+
border-radius: inherit;
|
|
327
|
+
transition: width 0s;
|
|
328
|
+
animation: loading-fill-grow var(--loading-duration, 2s) linear forwards;
|
|
329
|
+
inset: -1px;
|
|
330
|
+
|
|
331
|
+
&-transparent {
|
|
332
|
+
background-color: rgba(var(--zn-primary), 0.1);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
&-container {
|
|
337
|
+
position: absolute;
|
|
338
|
+
top: 0;
|
|
339
|
+
left: 0;
|
|
340
|
+
width: 100%;
|
|
341
|
+
height: 100%;
|
|
342
|
+
display: flex;
|
|
343
|
+
align-items: center;
|
|
344
|
+
justify-content: center;
|
|
345
|
+
pointer-events: none;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
&-text {
|
|
349
|
+
z-index: 5;
|
|
350
|
+
width: 100%;
|
|
351
|
+
height: 100%;
|
|
352
|
+
display: flex;
|
|
353
|
+
align-items: center;
|
|
354
|
+
justify-content: center;
|
|
355
|
+
font-size: inherit;
|
|
356
|
+
font-weight: inherit;
|
|
357
|
+
user-select: none;
|
|
358
|
+
position: absolute;
|
|
359
|
+
pointer-events: none;
|
|
360
|
+
color: inherit;
|
|
361
|
+
|
|
362
|
+
.loading-countdown {
|
|
363
|
+
margin-left: 3px;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
&-left {
|
|
367
|
+
justify-content: flex-start;
|
|
368
|
+
padding-inline-start: 7px;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
&-right {
|
|
372
|
+
justify-content: flex-end;
|
|
373
|
+
padding-inline-end: 7px;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.button--relative-wrapper {
|
|
379
|
+
position: relative;
|
|
380
|
+
display: inline-flex;
|
|
381
|
+
height: 100%;
|
|
382
|
+
width: 100%;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
@keyframes loading-fill-grow {
|
|
386
|
+
from {
|
|
387
|
+
width: 0;
|
|
388
|
+
}
|
|
389
|
+
to {
|
|
390
|
+
width: 100%;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
309
394
|
:host([vertical-align="center"]) {
|
|
310
395
|
align-self: center;
|
|
311
396
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {classMap} from "lit/directives/class-map.js";
|
|
2
2
|
import {deepQuerySelectorAll} from "../../utilities/query";
|
|
3
3
|
import {HasSlotController} from "../../internal/slot";
|
|
4
|
+
import type {PropertyValues} from 'lit';
|
|
4
5
|
import {html, nothing, unsafeCSS} from 'lit';
|
|
5
6
|
import {property, queryAssignedNodes, queryAsync} from 'lit/decorators.js';
|
|
6
7
|
import {unsafeHTML} from 'lit-html/directives/unsafe-html.js';
|
|
7
8
|
import ZincElement from "../../internal/zinc-element";
|
|
8
|
-
import type {PropertyValues} from 'lit';
|
|
9
9
|
import type ZnTile from "../tile";
|
|
10
10
|
|
|
11
11
|
import styles from './content-block.scss';
|
|
@@ -29,7 +29,11 @@ export default class ContentBlock extends ZincElement {
|
|
|
29
29
|
@property() avatar = '';
|
|
30
30
|
|
|
31
31
|
@property({type: Boolean, reflect: true}) outbound = false;
|
|
32
|
+
|
|
33
|
+
@property({type: Boolean, attribute: "no-collapse"}) noCollapse = false;
|
|
34
|
+
|
|
32
35
|
@property({type: Boolean, reflect: true}) short = false;
|
|
36
|
+
|
|
33
37
|
@property({attribute: 'default-display', reflect: true}) defaultDisplay: 'text' | 'html' = 'text';
|
|
34
38
|
|
|
35
39
|
@queryAssignedNodes({slot: 'html', flatten: true}) htmlNodes!: Node[];
|
|
@@ -84,6 +88,9 @@ export default class ContentBlock extends ZincElement {
|
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
private _collapseContent(e: Event) {
|
|
91
|
+
if (this.noCollapse) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
87
94
|
const target = e.target as HTMLElement;
|
|
88
95
|
const headerClick = target.classList.contains('content-block-header') ||
|
|
89
96
|
target.parentElement?.classList.contains('content-block-header');
|
|
@@ -186,20 +193,24 @@ export default class ContentBlock extends ZincElement {
|
|
|
186
193
|
flush-footer="${hasFooter || nothing}"
|
|
187
194
|
class="${classMap({
|
|
188
195
|
'content-block--outbound': this.outbound,
|
|
189
|
-
'content-block--short': this.short
|
|
196
|
+
'content-block--short': this.short,
|
|
197
|
+
'content-block--collapsible': !this.noCollapse
|
|
190
198
|
})}">
|
|
191
199
|
|
|
192
200
|
<zn-header class="content-block-header"
|
|
193
|
-
caption="${this.sender}"
|
|
194
201
|
description="${this.truncateText()}"
|
|
195
202
|
@click="${this._collapseContent}">
|
|
196
203
|
|
|
197
|
-
<
|
|
198
|
-
|
|
199
|
-
|
|
204
|
+
<slot name="icon">
|
|
205
|
+
<zn-icon src="${this.avatar}"
|
|
206
|
+
library="avatar"
|
|
207
|
+
round></zn-icon>
|
|
208
|
+
</slot>
|
|
209
|
+
|
|
210
|
+
<slot name="caption" slot="caption">${this.sender}</slot>
|
|
200
211
|
|
|
201
212
|
<div slot="actions">
|
|
202
|
-
<small>${this.time}</small>
|
|
213
|
+
<slot name="actions"><small>${this.time}</small></slot>
|
|
203
214
|
${showActions ? html`
|
|
204
215
|
<zn-dropdown>
|
|
205
216
|
<zn-button slot="trigger" icon="more_vert" icon-size="24" color="transparent"
|
|
@@ -19,8 +19,10 @@ zn-header div[slot='actions'] {
|
|
|
19
19
|
gap: 10px;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
.content-block--collapsible {
|
|
23
|
+
zn-header::part(base) {
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
}
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
zn-header::part(header-left) {
|
|
@@ -70,3 +72,57 @@ zn-panel:not(.content-block--short) zn-header::part(header-description) {
|
|
|
70
72
|
.hidden {
|
|
71
73
|
display: none;
|
|
72
74
|
}
|
|
75
|
+
|
|
76
|
+
li[data-list="ordered"] {
|
|
77
|
+
counter-increment: list-0 1;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@supports (counter-set:none) {
|
|
81
|
+
li[data-list] {
|
|
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
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
li[data-list=bullet] > .ql-ui:before {
|
|
87
|
+
content: "•";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
li[data-list=checked] > .ql-ui:before {
|
|
91
|
+
content: "☑";
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
li[data-list=unchecked] > .ql-ui:before {
|
|
95
|
+
content: "☐";
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
li[data-list="ordered"] > .ql-ui::before {
|
|
99
|
+
content: counter(list-0) ". ";
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
ol {
|
|
103
|
+
padding: 0;
|
|
104
|
+
margin: 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
li[data-list=checked] > .ql-ui, li[data-list=unchecked] > .ql-ui {
|
|
108
|
+
color: #777;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.ql-ui {
|
|
112
|
+
position: absolute;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
li {
|
|
116
|
+
list-style-type: none;
|
|
117
|
+
padding-left: 1em;
|
|
118
|
+
position: relative;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
li > .ql-ui::before {
|
|
122
|
+
display: inline-block;
|
|
123
|
+
margin-left: -1.5em;
|
|
124
|
+
margin-right: 0.3em;
|
|
125
|
+
text-align: right;
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
width: 1.2em;
|
|
128
|
+
}
|
|
@@ -231,7 +231,6 @@ export default class ZnDataSelect extends ZincElement implements ZincFormControl
|
|
|
231
231
|
private _updatePrefix() {
|
|
232
232
|
// Set the prefix of the select to the selected values prefix
|
|
233
233
|
const selectedOption = this.select.selectedOptions[0];
|
|
234
|
-
console.log('selectedOption', selectedOption);
|
|
235
234
|
if (selectedOption && (this.iconPosition !== 'none' || this.iconOnly) && this.selectPrefix) {
|
|
236
235
|
if (this.iconPosition === 'none' && this.iconOnly) {
|
|
237
236
|
this.iconPosition = 'start';
|
|
@@ -2,7 +2,7 @@ import {classMap} from "lit/directives/class-map.js";
|
|
|
2
2
|
import {type CSSResultGroup, html, nothing, type TemplateResult, unsafeCSS} from 'lit';
|
|
3
3
|
import {HasSlotController} from "../../internal/slot";
|
|
4
4
|
import {ifDefined} from "lit/directives/if-defined.js";
|
|
5
|
-
import {property} from 'lit/decorators.js';
|
|
5
|
+
import {property, query} from 'lit/decorators.js';
|
|
6
6
|
import {ref} from "lit/directives/ref.js";
|
|
7
7
|
import {Task} from "@lit/task";
|
|
8
8
|
import {unsafeHTML} from "lit/directives/unsafe-html.js";
|
|
@@ -90,6 +90,8 @@ interface HeaderConfig {
|
|
|
90
90
|
default?: boolean;
|
|
91
91
|
sortable?: boolean;
|
|
92
92
|
filterable?: boolean;
|
|
93
|
+
hideHeader?: boolean;
|
|
94
|
+
hideColumn?: boolean;
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
interface DataRequest {
|
|
@@ -184,7 +186,7 @@ export default class ZnDataTable extends ZincElement {
|
|
|
184
186
|
@property({attribute: "empty-state-icon"}) emptyStateIcon: string = "data_alert";
|
|
185
187
|
|
|
186
188
|
// Hide the checkbox column
|
|
187
|
-
@property({attribute: 'hide-checkboxes', type: Boolean}) hideCheckboxes: boolean
|
|
189
|
+
@property({attribute: 'hide-checkboxes', type: Boolean}) hideCheckboxes: boolean;
|
|
188
190
|
|
|
189
191
|
@property() filters: [] = [];
|
|
190
192
|
|
|
@@ -192,6 +194,12 @@ export default class ZnDataTable extends ZincElement {
|
|
|
192
194
|
|
|
193
195
|
@property({attribute: "no-initial-load", type: Boolean}) noInitialLoad: boolean = false;
|
|
194
196
|
|
|
197
|
+
@property({attribute: 'group-by'}) groupBy = '';
|
|
198
|
+
|
|
199
|
+
@property() groups = '';
|
|
200
|
+
|
|
201
|
+
@query('#select-all-rows') selectAllButton: ZnButton;
|
|
202
|
+
|
|
195
203
|
// Data Table Properties
|
|
196
204
|
private _initialLoad = true;
|
|
197
205
|
private _lastTableContent: TemplateResult = html``;
|
|
@@ -226,6 +234,11 @@ export default class ZnDataTable extends ZincElement {
|
|
|
226
234
|
return {rows: [], page: 1, perPage: this.itemsPerPage, total: 0};
|
|
227
235
|
}
|
|
228
236
|
|
|
237
|
+
if (this.groupBy) {
|
|
238
|
+
// we want to load all the data possible so we can group and show multiple tables
|
|
239
|
+
this.itemsPerPage = 1000;
|
|
240
|
+
}
|
|
241
|
+
|
|
229
242
|
const requestData: DataRequest = {
|
|
230
243
|
page: this.page,
|
|
231
244
|
perPage: this.itemsPerPage,
|
|
@@ -390,13 +403,68 @@ export default class ZnDataTable extends ZincElement {
|
|
|
390
403
|
return this.emptyState();
|
|
391
404
|
}
|
|
392
405
|
|
|
393
|
-
|
|
406
|
+
this._rows = this.getRows(data);
|
|
407
|
+
|
|
408
|
+
if (this.groupBy) {
|
|
409
|
+
// we need to group the rows by the group column
|
|
410
|
+
const groupedRows: Record<string, Row[]> = {};
|
|
411
|
+
|
|
412
|
+
// add groups to the current rows
|
|
413
|
+
const toAdd = this.groups.split(',').map(g => g.trim()).filter(g => g.length > 0);
|
|
414
|
+
toAdd.forEach((group) => {
|
|
415
|
+
if (!groupedRows[this.humanize(group)]) {
|
|
416
|
+
groupedRows[this.humanize(group)] = [];
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
this._rows.forEach((row: Row) => {
|
|
421
|
+
const groupCell = row.cells.find((cell: Cell) => cell.column === this.groupBy);
|
|
422
|
+
const groupValue = groupCell ? groupCell.text : 'Ungrouped';
|
|
423
|
+
if (!groupedRows[this.humanize(groupValue)] && (!this.groups || groupValue === 'Ungrouped')) {
|
|
424
|
+
groupedRows[this.humanize(groupValue)] = [];
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
if (groupedRows[this.humanize(groupValue)]) {
|
|
428
|
+
groupedRows[this.humanize(groupValue)].push(row);
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
// remove empty groups
|
|
433
|
+
Object.keys(groupedRows).forEach((groupKey) => {
|
|
434
|
+
if (groupedRows[groupKey].length === 0) {
|
|
435
|
+
delete groupedRows[groupKey];
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
// render a table for each group
|
|
440
|
+
return html`
|
|
441
|
+
<zn-sp flush>
|
|
442
|
+
${Object.keys(groupedRows).map((groupKey) => html`
|
|
443
|
+
<div class="table-group">
|
|
444
|
+
<h3 class="table-group__title">${groupKey === "Ungrouped" ? "" : groupKey}</h3>
|
|
445
|
+
${this.renderTableData(groupedRows[groupKey])}
|
|
446
|
+
</div>`
|
|
447
|
+
)}
|
|
448
|
+
</zn-sp>
|
|
449
|
+
`;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
return this.renderTableData(this._rows);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
public humanize(str: string) {
|
|
457
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
public renderTableData(data: any) {
|
|
461
|
+
const filteredHeaders = Object.values(this.headers).filter((header: HeaderConfig) => {
|
|
462
|
+
if (header.hideHeader || header.hideColumn) {
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
394
465
|
return !Object.values(this.hiddenColumns).includes(header.key);
|
|
395
466
|
});
|
|
396
467
|
|
|
397
|
-
this._rows = this.getRows(data);
|
|
398
|
-
|
|
399
|
-
const hasSelectedRows = this.selectedRows.length > 0;
|
|
400
468
|
this.rowHasActions = this._rows.some((row: Row) => row.actions && row.actions.length > 0);
|
|
401
469
|
|
|
402
470
|
// To make sure the cells are in the same order as the headers, we need to map them cell.col to heading.key
|
|
@@ -421,21 +489,17 @@ export default class ZnDataTable extends ZincElement {
|
|
|
421
489
|
<table class="${classMap({
|
|
422
490
|
'table': true,
|
|
423
491
|
'table--standalone': this.standalone,
|
|
424
|
-
'with-hover': !this.unsortable,
|
|
492
|
+
'with-hover': !this.unsortable && !this.hideCheckboxes,
|
|
425
493
|
})}">
|
|
426
494
|
<thead>
|
|
427
495
|
<tr>
|
|
428
|
-
${this.hideCheckboxes || !hasSelectedRows ? html`` : html`
|
|
429
|
-
<th>
|
|
430
|
-
<div><input type="checkbox" @change="${this.selectAll}"></div>
|
|
431
|
-
</th>`}
|
|
432
496
|
${filteredHeaders.map((header: HeaderConfig) => this.renderCellHeader(header))}
|
|
433
497
|
${this.rowHasActions ? html`
|
|
434
498
|
<th></th>` : html``}
|
|
435
499
|
</tr>
|
|
436
500
|
</thead>
|
|
437
501
|
<tbody>
|
|
438
|
-
${
|
|
502
|
+
${data.map((row: Row) => html`
|
|
439
503
|
<tr class="${classMap({'table__row--selected': this.isRowSelected(row)})}">
|
|
440
504
|
${row.cells.map((value: Cell, index: number) => this.renderCellBody(index, value))}
|
|
441
505
|
${this.rowHasActions ? this.renderActions(row) : null}
|
|
@@ -552,10 +616,37 @@ export default class ZnDataTable extends ZincElement {
|
|
|
552
616
|
getActions() {
|
|
553
617
|
const actions = [];
|
|
554
618
|
|
|
619
|
+
const hasSlots = this.hasSlotController.test(ActionSlots.delete.valueOf())
|
|
620
|
+
|| this.hasSlotController.test(ActionSlots.modify.valueOf())
|
|
621
|
+
|| this.hasSlotController.test(ActionSlots.create.valueOf());
|
|
622
|
+
|
|
623
|
+
if (!hasSlots) {
|
|
624
|
+
return [];
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
if (!this.hideCheckboxes && this._rows.length > 0) {
|
|
628
|
+
actions.push(html`
|
|
629
|
+
<zn-button @click="${this.selectAll}"
|
|
630
|
+
id="select-all-rows"
|
|
631
|
+
color="transparent"
|
|
632
|
+
size="x-small"
|
|
633
|
+
icon="indeterminate_check_box"
|
|
634
|
+
icon-size="22"
|
|
635
|
+
icon-color="primary"
|
|
636
|
+
tooltip="Select All"
|
|
637
|
+
slot="trigger">
|
|
638
|
+
</zn-button>`);
|
|
639
|
+
}
|
|
640
|
+
|
|
555
641
|
if (this.selectedRows.length > 0) {
|
|
556
642
|
actions.push(html`
|
|
557
|
-
<zn-button @click="${this.clearSelectedRows}"
|
|
558
|
-
|
|
643
|
+
<zn-button @click="${this.clearSelectedRows}"
|
|
644
|
+
color="transparent"
|
|
645
|
+
size="x-small"
|
|
646
|
+
icon="disabled_by_default"
|
|
647
|
+
icon-size="22"
|
|
648
|
+
tooltip="Clear Selection"
|
|
649
|
+
slot="trigger">
|
|
559
650
|
</zn-button>`);
|
|
560
651
|
|
|
561
652
|
if (this.hasSlotController.test(ActionSlots.delete.valueOf())) {
|
|
@@ -613,21 +704,25 @@ export default class ZnDataTable extends ZincElement {
|
|
|
613
704
|
}
|
|
614
705
|
|
|
615
706
|
selectAll(event: Event) {
|
|
616
|
-
const
|
|
617
|
-
|
|
707
|
+
const button = event.target as ZnButton;
|
|
708
|
+
if (button.disabled) return;
|
|
618
709
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
710
|
+
if (this.numberOfRowsSelected === this._rows.length) {
|
|
711
|
+
this.clearSelectedRows(event);
|
|
712
|
+
return;
|
|
622
713
|
}
|
|
623
714
|
|
|
624
|
-
this.selectedRows =
|
|
715
|
+
this.selectedRows = this._rows;
|
|
625
716
|
this.numberOfRowsSelected = this.selectedRows.length;
|
|
626
717
|
this.updateKeys();
|
|
627
718
|
this.requestUpdate();
|
|
628
719
|
}
|
|
629
720
|
|
|
630
721
|
selectRow(e: Event) {
|
|
722
|
+
if (this.hideCheckboxes) {
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
|
|
631
726
|
if (!(e.target && (e.target instanceof Element))) {
|
|
632
727
|
return;
|
|
633
728
|
}
|
|
@@ -826,6 +921,13 @@ export default class ZnDataTable extends ZincElement {
|
|
|
826
921
|
}
|
|
827
922
|
|
|
828
923
|
private renderCellBody(index: number, value: Cell) {
|
|
924
|
+
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
|
+
});
|
|
930
|
+
|
|
829
931
|
const headerKeys: string[] = Object.keys(this.headers).filter(
|
|
830
932
|
(key) => !Object.values(this.hiddenColumns).includes(key)
|
|
831
933
|
);
|
|
@@ -833,11 +935,11 @@ export default class ZnDataTable extends ZincElement {
|
|
|
833
935
|
|
|
834
936
|
return html`
|
|
835
937
|
<td
|
|
836
|
-
@click="${this.selectRow}"
|
|
938
|
+
@click="${this.hideCheckboxes ? undefined : this.selectRow}"
|
|
837
939
|
class="${classMap({
|
|
838
940
|
'table__cell': true,
|
|
839
941
|
'table__cell--wide': headerKey === this.wideColumn,
|
|
840
|
-
'table__cell--last':
|
|
942
|
+
'table__cell--last': index === filteredHeaders.length - 1,
|
|
841
943
|
})}">
|
|
842
944
|
<div>${this.renderCell(value)}</div>
|
|
843
945
|
</td>`;
|
|
@@ -889,10 +991,19 @@ export default class ZnDataTable extends ZincElement {
|
|
|
889
991
|
}
|
|
890
992
|
|
|
891
993
|
private updateKeys() {
|
|
994
|
+
this.updateSelectAll();
|
|
892
995
|
this.updateModifyKeys();
|
|
893
996
|
this.updateDeleteKeys();
|
|
894
997
|
}
|
|
895
998
|
|
|
999
|
+
private updateSelectAll() {
|
|
1000
|
+
if (this.numberOfRowsSelected === this._rows.length) {
|
|
1001
|
+
this.selectAllButton.icon = 'check_box';
|
|
1002
|
+
} else {
|
|
1003
|
+
this.selectAllButton.icon = 'indeterminate_check_box';
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
|
|
896
1007
|
private updateModifyKeys() {
|
|
897
1008
|
this.updateActionKeys('modify-action');
|
|
898
1009
|
}
|
|
@@ -364,11 +364,9 @@ table tbody tr.table__row--selected {
|
|
|
364
364
|
border-bottom-right-radius: var(--zn-border-radius-large);
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
-
& + tr td {
|
|
367
|
+
& + tr.table__row--selected td {
|
|
368
368
|
border-top: 0 !important;
|
|
369
|
-
}
|
|
370
369
|
|
|
371
|
-
& + tr.table__row--selected td {
|
|
372
370
|
&:first-of-type {
|
|
373
371
|
border-top-left-radius: 0;
|
|
374
372
|
}
|
|
@@ -400,3 +398,16 @@ table tbody tr.table__row--selected {
|
|
|
400
398
|
table:has(tbody tr:first-of-type.table__row--selected) thead tr th {
|
|
401
399
|
border-bottom-color: var(--zn-color-purple-600) !important;
|
|
402
400
|
}
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
.table-group__title {
|
|
404
|
+
font-weight: var(--zn-font-weight-semibold);
|
|
405
|
+
font-size: var(--zn-font-size-large);
|
|
406
|
+
color: rgba(var(--zn-text-panel-title), 100%);
|
|
407
|
+
line-height: var(--zn-line-height-looser);
|
|
408
|
+
padding-left: var(--zn-spacing-medium);
|
|
409
|
+
margin: 0;
|
|
410
|
+
overflow: hidden;
|
|
411
|
+
white-space: nowrap;
|
|
412
|
+
text-overflow: ellipsis;
|
|
413
|
+
}
|
|
@@ -39,6 +39,7 @@ export default class ZnHeader extends ZincElement {
|
|
|
39
39
|
@property({type: Boolean}) transparent: boolean = false;
|
|
40
40
|
|
|
41
41
|
@property() caption: string;
|
|
42
|
+
@property() icon: string;
|
|
42
43
|
|
|
43
44
|
@property() description: string;
|
|
44
45
|
|
|
@@ -136,7 +137,8 @@ export default class ZnHeader extends ZincElement {
|
|
|
136
137
|
|
|
137
138
|
|
|
138
139
|
<div class="content" part="content">
|
|
139
|
-
${hasBreadcrumb ? html
|
|
140
|
+
${hasBreadcrumb ? html`
|
|
141
|
+
<slot name="breadcrumb" class="breadcrumb"></slot>` : null}
|
|
140
142
|
|
|
141
143
|
${hasPreviousPath ? html`
|
|
142
144
|
<a href="${this.previousPath}" class="caption__back"
|
|
@@ -151,7 +153,11 @@ export default class ZnHeader extends ZincElement {
|
|
|
151
153
|
|
|
152
154
|
<div class="caption">
|
|
153
155
|
<div part="header-left" class="header__left">
|
|
154
|
-
<span class="header__caption" part="header-caption"
|
|
156
|
+
<span class="header__caption" part="header-caption">
|
|
157
|
+
${this.icon ? html`
|
|
158
|
+
<zn-icon class="header__icon" src="${this.icon}"></zn-icon>` : null}
|
|
159
|
+
<slot name="caption">${this.caption}</slot>
|
|
160
|
+
</span>
|
|
155
161
|
${this.description ? html`
|
|
156
162
|
<span class="header__description"
|
|
157
163
|
part="header-description">${this.description}</span>`
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
overflow: hidden;
|
|
25
25
|
white-space: nowrap;
|
|
26
26
|
text-overflow: ellipsis;
|
|
27
|
+
display: flex;
|
|
28
|
+
gap: var(--zn-spacing-x-small);
|
|
29
|
+
align-items: center;
|
|
30
|
+
text-wrap: auto;
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
&--has-breadcrumb {
|
|
@@ -195,7 +199,7 @@
|
|
|
195
199
|
text-decoration: none;
|
|
196
200
|
}
|
|
197
201
|
|
|
198
|
-
zn-icon {
|
|
202
|
+
a zn-icon {
|
|
199
203
|
cursor: pointer;
|
|
200
204
|
|
|
201
205
|
&:hover {
|
|
@@ -169,7 +169,6 @@ export default class ZnMenu extends ZincElement {
|
|
|
169
169
|
// get the parent dropdown and close it
|
|
170
170
|
(closestMenu?.closest('zn-dropdown') as ZnDropdown | null)?.hide();
|
|
171
171
|
|
|
172
|
-
console.log('emitting select')
|
|
173
172
|
this.emit('zn-select', {detail: {item}});
|
|
174
173
|
}
|
|
175
174
|
|