@su-labs/table 20.1.4 → 21.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SuTableController, SU_TABLE_LABELS,
|
|
1
|
+
import { SuTableController, SU_TABLE_LABELS, suTableDropIndex } from '@su-labs/core/table';
|
|
2
2
|
export { SU_TABLE_LABELS, suCheckboxEditor, suDateEditor, suNumberEditor, suSelectEditor, suTextEditor } from '@su-labs/core/table';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { input, inject, TemplateRef, Directive, output, computed, ChangeDetectionStrategy, Component, viewChild, signal, booleanAttribute, ElementRef, contentChildren, DestroyRef, effect, untracked, afterRenderEffect } from '@angular/core';
|
|
@@ -11,36 +11,36 @@ import { NgTemplateOutlet } from '@angular/common';
|
|
|
11
11
|
*/
|
|
12
12
|
class SuTableCellDirective {
|
|
13
13
|
/** The column's key */
|
|
14
|
-
key = input.required(...(ngDevMode ?
|
|
14
|
+
key = input.required({ ...(ngDevMode ? { debugName: "key" } : /* istanbul ignore next */ {}), alias: 'suTableCell' });
|
|
15
15
|
/** The table's rows, to type the template's row */
|
|
16
|
-
rowsOf = input([], ...(ngDevMode ?
|
|
16
|
+
rowsOf = input([], { ...(ngDevMode ? { debugName: "rowsOf" } : /* istanbul ignore next */ {}), alias: 'suTableCellOf' });
|
|
17
17
|
template = inject(TemplateRef);
|
|
18
18
|
static ngTemplateContextGuard(_directive, context) {
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
22
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
21
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuTableCellDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
22
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.26", type: SuTableCellDirective, isStandalone: true, selector: "ng-template[suTableCell]", inputs: { key: { classPropertyName: "key", publicName: "suTableCell", isSignal: true, isRequired: true, transformFunction: null }, rowsOf: { classPropertyName: "rowsOf", publicName: "suTableCellOf", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
23
23
|
}
|
|
24
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuTableCellDirective, decorators: [{
|
|
25
25
|
type: Directive,
|
|
26
26
|
args: [{ selector: 'ng-template[suTableCell]' }]
|
|
27
27
|
}], propDecorators: { key: [{ type: i0.Input, args: [{ isSignal: true, alias: "suTableCell", required: true }] }], rowsOf: [{ type: i0.Input, args: [{ isSignal: true, alias: "suTableCellOf", required: false }] }] } });
|
|
28
28
|
|
|
29
29
|
/** The form control of one field being edited, chosen by its editor's input */
|
|
30
30
|
class SuTableFieldComponent {
|
|
31
|
-
field = input.required(...(ngDevMode ? [{ debugName: "field" }] : []));
|
|
32
|
-
controlId = input.required(...(ngDevMode ? [{ debugName: "controlId" }] : []));
|
|
31
|
+
field = input.required(...(ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []));
|
|
32
|
+
controlId = input.required(...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
|
|
33
33
|
/** The control's name when no visible `<label>` points at it */
|
|
34
|
-
ariaLabel = input(null, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
|
|
35
|
-
mixedLabel = input.required(...(ngDevMode ? [{ debugName: "mixedLabel" }] : []));
|
|
34
|
+
ariaLabel = input(null, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
35
|
+
mixedLabel = input.required(...(ngDevMode ? [{ debugName: "mixedLabel" }] : /* istanbul ignore next */ []));
|
|
36
36
|
valueChange = output();
|
|
37
|
-
errorId = computed(() => `${this.controlId()}-error`, ...(ngDevMode ? [{ debugName: "errorId" }] : []));
|
|
37
|
+
errorId = computed(() => `${this.controlId()}-error`, ...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
38
38
|
placeholder = computed(() => {
|
|
39
39
|
const field = this.field();
|
|
40
40
|
return field.mixed
|
|
41
41
|
? this.mixedLabel()
|
|
42
42
|
: (field.editor.attributes.placeholder ?? null);
|
|
43
|
-
}, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
43
|
+
}, ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
44
44
|
onChange(event) {
|
|
45
45
|
const target = event.target;
|
|
46
46
|
if (target instanceof HTMLInputElement && target.type === 'checkbox') {
|
|
@@ -52,19 +52,19 @@ class SuTableFieldComponent {
|
|
|
52
52
|
this.valueChange.emit(target.value);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
56
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
55
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuTableFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
56
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.26", type: SuTableFieldComponent, isStandalone: true, selector: "su-lib-table-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: true, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, mixedLabel: { classPropertyName: "mixedLabel", publicName: "mixedLabel", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { classAttribute: "su-table-field" }, ngImport: i0, template: "@let item = field();\n@let attributes = item.editor.attributes;\n@switch (item.editor.input) {\n @case ('checkbox') {\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [id]=\"controlId()\"\n [checked]=\"item.value === true\"\n [indeterminate]=\"item.mixed\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (change)=\"onChange($event)\"\n />\n }\n @case ('select') {\n <select\n class=\"su-table-control\"\n [id]=\"controlId()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (change)=\"onChange($event)\"\n >\n @if (item.mixed) {\n <option value=\"\" disabled selected>{{ mixedLabel() }}</option>\n }\n @for (option of item.editor.options; track option.value) {\n <option [value]=\"option.value\" [selected]=\"!item.mixed && option.value === item.value\">\n {{ option.label }}\n </option>\n }\n </select>\n }\n @case ('textarea') {\n <textarea\n class=\"su-table-control\"\n rows=\"2\"\n [id]=\"controlId()\"\n [value]=\"item.value\"\n [attr.placeholder]=\"placeholder()\"\n [attr.maxlength]=\"attributes.maxLength ?? null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (input)=\"onChange($event)\"\n ></textarea>\n }\n @default {\n <input\n class=\"su-table-control\"\n [type]=\"item.editor.input\"\n [id]=\"controlId()\"\n [value]=\"item.value\"\n [attr.placeholder]=\"placeholder()\"\n [attr.min]=\"attributes.min ?? null\"\n [attr.max]=\"attributes.max ?? null\"\n [attr.step]=\"attributes.step ?? null\"\n [attr.maxlength]=\"attributes.maxLength ?? null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (input)=\"onChange($event)\"\n />\n }\n}\n@if (item.error) {\n <span class=\"su-table-error\" [id]=\"errorId()\">{{ item.error }}</span>\n}\n", styles: [":host{display:flex;flex-direction:column;gap:.2rem}.su-table-control{background:var(--su-table-input-background, transparent);border:var(--su-table-input-border, 1px solid rgba(0, 0, 0, .25));border-radius:var(--su-table-input-radius, 6px);box-sizing:border-box;color:inherit;font:inherit}.su-table-control:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-control{min-height:2rem;min-width:6rem;padding:.3rem .45rem;width:100%}.su-table-control[aria-invalid=true]{border-color:var(--su-table-danger-color, #b42318)}.su-table-checkbox{accent-color:var(--su-table-accent, #2563eb);height:1rem;margin:0;width:1rem}.su-table-checkbox:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-error{color:var(--su-table-danger-color, #b42318);font-size:.8em;font-weight:400}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
57
57
|
}
|
|
58
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuTableFieldComponent, decorators: [{
|
|
59
59
|
type: Component,
|
|
60
|
-
args: [{ selector: 'su-lib-table-field', changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'su-table-field' }, template: "@let item = field();\n@let attributes = item.editor.attributes;\n@switch (item.editor.input) {\n @case ('checkbox') {\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [id]=\"controlId()\"\n [checked]=\"item.value === true\"\n [indeterminate]=\"item.mixed\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (change)=\"onChange($event)\"\n />\n }\n @case ('select') {\n <select\n class=\"su-table-control\"\n [id]=\"controlId()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (change)=\"onChange($event)\"\n >\n @if (item.mixed) {\n <option value=\"\" disabled selected>{{ mixedLabel() }}</option>\n }\n @for (option of item.editor.options; track option.value) {\n <option [value]=\"option.value\" [selected]=\"!item.mixed && option.value === item.value\">\n {{ option.label }}\n </option>\n }\n </select>\n }\n @case ('textarea') {\n <textarea\n class=\"su-table-control\"\n rows=\"2\"\n [id]=\"controlId()\"\n [value]=\"item.value\"\n [attr.placeholder]=\"placeholder()\"\n [attr.maxlength]=\"attributes.maxLength ?? null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (input)=\"onChange($event)\"\n ></textarea>\n }\n @default {\n <input\n class=\"su-table-control\"\n [type]=\"item.editor.input\"\n [id]=\"controlId()\"\n [value]=\"item.value\"\n [attr.placeholder]=\"placeholder()\"\n [attr.min]=\"attributes.min ?? null\"\n [attr.max]=\"attributes.max ?? null\"\n [attr.step]=\"attributes.step ?? null\"\n [attr.maxlength]=\"attributes.maxLength ?? null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (input)=\"onChange($event)\"\n />\n }\n}\n@if (item.error) {\n <span class=\"su-table-error\" [id]=\"errorId()\">{{ item.error }}</span>\n}\n", styles: [":host{display:flex;flex-direction:column;gap:.2rem}.su-table-control{background:var(--su-table-input-background, transparent);border:var(--su-table-input-border, 1px solid rgba(0, 0, 0, .25));border-radius:var(--su-table-input-radius, 6px);box-sizing:border-box;color:inherit;font:inherit
|
|
60
|
+
args: [{ selector: 'su-lib-table-field', changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'su-table-field' }, template: "@let item = field();\n@let attributes = item.editor.attributes;\n@switch (item.editor.input) {\n @case ('checkbox') {\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [id]=\"controlId()\"\n [checked]=\"item.value === true\"\n [indeterminate]=\"item.mixed\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (change)=\"onChange($event)\"\n />\n }\n @case ('select') {\n <select\n class=\"su-table-control\"\n [id]=\"controlId()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (change)=\"onChange($event)\"\n >\n @if (item.mixed) {\n <option value=\"\" disabled selected>{{ mixedLabel() }}</option>\n }\n @for (option of item.editor.options; track option.value) {\n <option [value]=\"option.value\" [selected]=\"!item.mixed && option.value === item.value\">\n {{ option.label }}\n </option>\n }\n </select>\n }\n @case ('textarea') {\n <textarea\n class=\"su-table-control\"\n rows=\"2\"\n [id]=\"controlId()\"\n [value]=\"item.value\"\n [attr.placeholder]=\"placeholder()\"\n [attr.maxlength]=\"attributes.maxLength ?? null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (input)=\"onChange($event)\"\n ></textarea>\n }\n @default {\n <input\n class=\"su-table-control\"\n [type]=\"item.editor.input\"\n [id]=\"controlId()\"\n [value]=\"item.value\"\n [attr.placeholder]=\"placeholder()\"\n [attr.min]=\"attributes.min ?? null\"\n [attr.max]=\"attributes.max ?? null\"\n [attr.step]=\"attributes.step ?? null\"\n [attr.maxlength]=\"attributes.maxLength ?? null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-invalid]=\"item.error ? true : null\"\n [attr.aria-describedby]=\"item.error ? errorId() : null\"\n (input)=\"onChange($event)\"\n />\n }\n}\n@if (item.error) {\n <span class=\"su-table-error\" [id]=\"errorId()\">{{ item.error }}</span>\n}\n", styles: [":host{display:flex;flex-direction:column;gap:.2rem}.su-table-control{background:var(--su-table-input-background, transparent);border:var(--su-table-input-border, 1px solid rgba(0, 0, 0, .25));border-radius:var(--su-table-input-radius, 6px);box-sizing:border-box;color:inherit;font:inherit}.su-table-control:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-control{min-height:2rem;min-width:6rem;padding:.3rem .45rem;width:100%}.su-table-control[aria-invalid=true]{border-color:var(--su-table-danger-color, #b42318)}.su-table-checkbox{accent-color:var(--su-table-accent, #2563eb);height:1rem;margin:0;width:1rem}.su-table-checkbox:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-error{color:var(--su-table-danger-color, #b42318);font-size:.8em;font-weight:400}\n"] }]
|
|
61
61
|
}], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], mixedLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "mixedLabel", required: true }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }] } });
|
|
62
62
|
|
|
63
63
|
/** The page controls under a table: rows per page, the range on screen, and previous and next */
|
|
64
64
|
class SuTablePaginatorComponent {
|
|
65
|
-
pagination = input.required(...(ngDevMode ? [{ debugName: "pagination" }] : []));
|
|
66
|
-
labels = input.required(...(ngDevMode ? [{ debugName: "labels" }] : []));
|
|
67
|
-
controlId = input.required(...(ngDevMode ? [{ debugName: "controlId" }] : []));
|
|
65
|
+
pagination = input.required(...(ngDevMode ? [{ debugName: "pagination" }] : /* istanbul ignore next */ []));
|
|
66
|
+
labels = input.required(...(ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []));
|
|
67
|
+
controlId = input.required(...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
|
|
68
68
|
pageChange = output();
|
|
69
69
|
pageSizeChange = output();
|
|
70
70
|
/** The buttons stay focusable at the first and last page (`aria-disabled`), so focus isn't lost on the way */
|
|
@@ -83,23 +83,21 @@ class SuTablePaginatorComponent {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
87
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
86
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuTablePaginatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
87
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.26", type: SuTablePaginatorComponent, isStandalone: true, selector: "su-lib-table-paginator", inputs: { pagination: { classPropertyName: "pagination", publicName: "pagination", isSignal: true, isRequired: true, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: true, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { pageChange: "pageChange", pageSizeChange: "pageSizeChange" }, ngImport: i0, template: "@let paging = pagination();\n@let t = labels();\n<nav class=\"su-table-paginator\" [attr.aria-label]=\"t.pagination\">\n @if (paging.pageSizes.length > 0) {\n <div class=\"su-table-paginator-size\">\n <label [for]=\"controlId()\">{{ t.rowsPerPage }}</label>\n <select class=\"su-table-paginator-select\" [id]=\"controlId()\" (change)=\"onPageSize($event)\">\n @for (size of paging.pageSizes; track size) {\n <option [value]=\"size\" [selected]=\"size === paging.pageSize\">{{ size === 'all' ? t.allRows : size }}</option>\n }\n </select>\n </div>\n }\n <span class=\"su-table-paginator-range\">{{ t.range(paging.rangeStart, paging.rangeEnd, paging.totalRows) }}</span>\n @if (paging.pageCount > 1) {\n <div class=\"su-table-paginator-pages\">\n <button\n type=\"button\"\n class=\"su-table-paginator-button\"\n [attr.aria-label]=\"t.previousPage\"\n [attr.aria-disabled]=\"paging.page === 0\"\n (click)=\"turn(paging.page - 1)\"\n >\n <span aria-hidden=\"true\">\u2039</span>\n </button>\n <span class=\"su-table-paginator-page\">{{ t.page(paging.page + 1, paging.pageCount) }}</span>\n <button\n type=\"button\"\n class=\"su-table-paginator-button\"\n [attr.aria-label]=\"t.nextPage\"\n [attr.aria-disabled]=\"paging.page === paging.pageCount - 1\"\n (click)=\"turn(paging.page + 1)\"\n >\n <span aria-hidden=\"true\">\u203A</span>\n </button>\n </div>\n }\n</nav>\n", styles: [":host{display:block;margin-top:.75rem}.su-table-paginator{align-items:center;display:flex;flex-wrap:wrap;font-size:.875em;gap:.5rem 1.25rem;justify-content:flex-end}.su-table-paginator-size,.su-table-paginator-pages{align-items:center;display:flex;gap:.5rem}.su-table-paginator-range,.su-table-paginator-page{font-variant-numeric:tabular-nums}.su-table-paginator-select,.su-table-paginator-button{background:var(--su-table-input-background, transparent);border:var(--su-table-input-border, 1px solid rgba(0, 0, 0, .25));border-radius:var(--su-table-input-radius, 6px);box-sizing:border-box;color:inherit;font:inherit}.su-table-paginator-select:focus-visible,.su-table-paginator-button:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-paginator-select,.su-table-paginator-button{min-height:2rem}.su-table-paginator-select{padding:.2rem .4rem}.su-table-paginator-button{cursor:pointer;font-size:1.1em;line-height:1;min-width:2rem}.su-table-paginator-button[aria-disabled=true]{cursor:not-allowed;opacity:.4}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
88
88
|
}
|
|
89
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
89
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuTablePaginatorComponent, decorators: [{
|
|
90
90
|
type: Component,
|
|
91
|
-
args: [{ selector: 'su-lib-table-paginator', changeDetection: ChangeDetectionStrategy.OnPush, template: "@let paging = pagination();\n@let t = labels();\n<nav class=\"su-table-paginator\" [attr.aria-label]=\"t.pagination\">\n @if (paging.pageSizes.length > 0) {\n <div class=\"su-table-paginator-size\">\n <label [for]=\"controlId()\">{{ t.rowsPerPage }}</label>\n <select class=\"su-table-paginator-select\" [id]=\"controlId()\" (change)=\"onPageSize($event)\">\n @for (size of paging.pageSizes; track size) {\n <option [value]=\"size\" [selected]=\"size === paging.pageSize\">{{ size === 'all' ? t.allRows : size }}</option>\n }\n </select>\n </div>\n }\n <span class=\"su-table-paginator-range\">{{ t.range(paging.rangeStart, paging.rangeEnd, paging.totalRows) }}</span>\n @if (paging.pageCount > 1) {\n <div class=\"su-table-paginator-pages\">\n <button\n type=\"button\"\n class=\"su-table-paginator-button\"\n [attr.aria-label]=\"t.previousPage\"\n [attr.aria-disabled]=\"paging.page === 0\"\n (click)=\"turn(paging.page - 1)\"\n >\n <span aria-hidden=\"true\">\u2039</span>\n </button>\n <span class=\"su-table-paginator-page\">{{ t.page(paging.page + 1, paging.pageCount) }}</span>\n <button\n type=\"button\"\n class=\"su-table-paginator-button\"\n [attr.aria-label]=\"t.nextPage\"\n [attr.aria-disabled]=\"paging.page === paging.pageCount - 1\"\n (click)=\"turn(paging.page + 1)\"\n >\n <span aria-hidden=\"true\">\u203A</span>\n </button>\n </div>\n }\n</nav>\n", styles: [":host{display:block;margin-top:.75rem}.su-table-paginator{align-items:center;display:flex;flex-wrap:wrap;font-size:.875em;gap:.5rem 1.25rem;justify-content:flex-end}.su-table-paginator-size,.su-table-paginator-pages{align-items:center;display:flex;gap:.5rem}.su-table-paginator-range,.su-table-paginator-page{font-variant-numeric:tabular-nums}.su-table-paginator-select,.su-table-paginator-button{background:var(--su-table-input-background, transparent);border:var(--su-table-input-border, 1px solid rgba(0, 0, 0, .25));border-radius:var(--su-table-input-radius, 6px);box-sizing:border-box;color:inherit;font:inherit
|
|
91
|
+
args: [{ selector: 'su-lib-table-paginator', changeDetection: ChangeDetectionStrategy.OnPush, template: "@let paging = pagination();\n@let t = labels();\n<nav class=\"su-table-paginator\" [attr.aria-label]=\"t.pagination\">\n @if (paging.pageSizes.length > 0) {\n <div class=\"su-table-paginator-size\">\n <label [for]=\"controlId()\">{{ t.rowsPerPage }}</label>\n <select class=\"su-table-paginator-select\" [id]=\"controlId()\" (change)=\"onPageSize($event)\">\n @for (size of paging.pageSizes; track size) {\n <option [value]=\"size\" [selected]=\"size === paging.pageSize\">{{ size === 'all' ? t.allRows : size }}</option>\n }\n </select>\n </div>\n }\n <span class=\"su-table-paginator-range\">{{ t.range(paging.rangeStart, paging.rangeEnd, paging.totalRows) }}</span>\n @if (paging.pageCount > 1) {\n <div class=\"su-table-paginator-pages\">\n <button\n type=\"button\"\n class=\"su-table-paginator-button\"\n [attr.aria-label]=\"t.previousPage\"\n [attr.aria-disabled]=\"paging.page === 0\"\n (click)=\"turn(paging.page - 1)\"\n >\n <span aria-hidden=\"true\">\u2039</span>\n </button>\n <span class=\"su-table-paginator-page\">{{ t.page(paging.page + 1, paging.pageCount) }}</span>\n <button\n type=\"button\"\n class=\"su-table-paginator-button\"\n [attr.aria-label]=\"t.nextPage\"\n [attr.aria-disabled]=\"paging.page === paging.pageCount - 1\"\n (click)=\"turn(paging.page + 1)\"\n >\n <span aria-hidden=\"true\">\u203A</span>\n </button>\n </div>\n }\n</nav>\n", styles: [":host{display:block;margin-top:.75rem}.su-table-paginator{align-items:center;display:flex;flex-wrap:wrap;font-size:.875em;gap:.5rem 1.25rem;justify-content:flex-end}.su-table-paginator-size,.su-table-paginator-pages{align-items:center;display:flex;gap:.5rem}.su-table-paginator-range,.su-table-paginator-page{font-variant-numeric:tabular-nums}.su-table-paginator-select,.su-table-paginator-button{background:var(--su-table-input-background, transparent);border:var(--su-table-input-border, 1px solid rgba(0, 0, 0, .25));border-radius:var(--su-table-input-radius, 6px);box-sizing:border-box;color:inherit;font:inherit}.su-table-paginator-select:focus-visible,.su-table-paginator-button:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-paginator-select,.su-table-paginator-button{min-height:2rem}.su-table-paginator-select{padding:.2rem .4rem}.su-table-paginator-button{cursor:pointer;font-size:1.1em;line-height:1;min-width:2rem}.su-table-paginator-button[aria-disabled=true]{cursor:not-allowed;opacity:.4}\n"] }]
|
|
92
92
|
}], propDecorators: { pagination: [{ type: i0.Input, args: [{ isSignal: true, alias: "pagination", required: true }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: true }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: true }] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], pageSizeChange: [{ type: i0.Output, args: ["pageSizeChange"] }] } });
|
|
93
93
|
|
|
94
94
|
/** Makes a table cell stick to its edge while the other columns scroll */
|
|
95
95
|
class SuTablePinDirective {
|
|
96
|
-
placement = input(null, ...(ngDevMode ?
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.35", ngImport: i0, type: SuTablePinDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
100
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.35", type: SuTablePinDirective, isStandalone: true, selector: "[suTablePin]", inputs: { placement: { classPropertyName: "placement", publicName: "suTablePin", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.is-pinned-start": "placement()?.pin === 'start'", "class.is-pinned-end": "placement()?.pin === 'end'", "class.is-pinned-edge": "placement()?.edge", "style.inset-inline-start.px": "placement()?.pin === 'start' ? placement()?.offset : null", "style.inset-inline-end.px": "placement()?.pin === 'end' ? placement()?.offset : null" } }, ngImport: i0 });
|
|
96
|
+
placement = input(null, { ...(ngDevMode ? { debugName: "placement" } : /* istanbul ignore next */ {}), alias: 'suTablePin' });
|
|
97
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuTablePinDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
98
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.26", type: SuTablePinDirective, isStandalone: true, selector: "[suTablePin]", inputs: { placement: { classPropertyName: "placement", publicName: "suTablePin", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.is-pinned-start": "placement()?.pin === 'start'", "class.is-pinned-end": "placement()?.pin === 'end'", "class.is-pinned-edge": "placement()?.edge", "style.inset-inline-start.px": "placement()?.pin === 'start' ? placement()?.offset : null", "style.inset-inline-end.px": "placement()?.pin === 'end' ? placement()?.offset : null" } }, ngImport: i0 });
|
|
101
99
|
}
|
|
102
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuTablePinDirective, decorators: [{
|
|
103
101
|
type: Directive,
|
|
104
102
|
args: [{
|
|
105
103
|
selector: '[suTablePin]',
|
|
@@ -115,11 +113,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImpo
|
|
|
115
113
|
|
|
116
114
|
/** The pin drawn on pinned columns and pin buttons: `<svg suTablePinIcon></svg>` */
|
|
117
115
|
class SuTablePinIconComponent {
|
|
118
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
119
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
116
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuTablePinIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
117
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.26", type: SuTablePinIconComponent, isStandalone: true, selector: "svg[suTablePinIcon]", host: { attributes: { "viewBox": "0 0 16 16", "aria-hidden": "true", "fill": "currentColor" } }, ngImport: i0, template: `<svg:path
|
|
120
118
|
d="M10 1.5 14.5 6l-1.6 1.6-1-.3-2.4 2.4.2 2.8-1.3 1.3L6 11 2.5 14.5 1.5 13.5 5 10 2.2 7.6l1.3-1.3 2.8.2 2.4-2.4-.3-1z" />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
121
119
|
}
|
|
122
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
120
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuTablePinIconComponent, decorators: [{
|
|
123
121
|
type: Component,
|
|
124
122
|
args: [{
|
|
125
123
|
selector: 'svg[suTablePinIcon]',
|
|
@@ -132,29 +130,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImpo
|
|
|
132
130
|
|
|
133
131
|
/** The bar above a table: the search box, and the Columns button with its menu to show, hide and pin columns */
|
|
134
132
|
class SuTableToolbarComponent {
|
|
135
|
-
labels = input.required(...(ngDevMode ? [{ debugName: "labels" }] : []));
|
|
133
|
+
labels = input.required(...(ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []));
|
|
136
134
|
/** Prefix for the ids of the controls */
|
|
137
|
-
controlId = input.required(...(ngDevMode ? [{ debugName: "controlId" }] : []));
|
|
138
|
-
searchable = input(false, ...(ngDevMode ? [{ debugName: "searchable" }] : []));
|
|
139
|
-
query = input('', ...(ngDevMode ? [{ debugName: "query" }] : []));
|
|
140
|
-
columnControls = input(false, ...(ngDevMode ? [{ debugName: "columnControls" }] : []));
|
|
135
|
+
controlId = input.required(...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
|
|
136
|
+
searchable = input(false, ...(ngDevMode ? [{ debugName: "searchable" }] : /* istanbul ignore next */ []));
|
|
137
|
+
query = input('', ...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
138
|
+
columnControls = input(false, ...(ngDevMode ? [{ debugName: "columnControls" }] : /* istanbul ignore next */ []));
|
|
141
139
|
/** The columns in the order they were set up */
|
|
142
|
-
columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
140
|
+
columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
143
141
|
queryChange = output();
|
|
144
142
|
pinnableChange = output();
|
|
145
143
|
visibilityChange = output();
|
|
146
144
|
/** Every column shown (true), or all hidden but one (false) */
|
|
147
145
|
allVisibilityChange = output();
|
|
148
|
-
menu = viewChild('menu', ...(ngDevMode ? [{ debugName: "menu" }] : []));
|
|
149
|
-
menuButton = viewChild('menuButton', ...(ngDevMode ? [{ debugName: "menuButton" }] : []));
|
|
150
|
-
columnsOpen = signal(false, ...(ngDevMode ? [{ debugName: "columnsOpen" }] : []));
|
|
151
|
-
columnQuery = signal('', ...(ngDevMode ? [{ debugName: "columnQuery" }] : []));
|
|
146
|
+
menu = viewChild('menu', ...(ngDevMode ? [{ debugName: "menu" }] : /* istanbul ignore next */ []));
|
|
147
|
+
menuButton = viewChild('menuButton', ...(ngDevMode ? [{ debugName: "menuButton" }] : /* istanbul ignore next */ []));
|
|
148
|
+
columnsOpen = signal(false, ...(ngDevMode ? [{ debugName: "columnsOpen" }] : /* istanbul ignore next */ []));
|
|
149
|
+
columnQuery = signal('', ...(ngDevMode ? [{ debugName: "columnQuery" }] : /* istanbul ignore next */ []));
|
|
152
150
|
/** The columns matching the menu's search */
|
|
153
151
|
listedColumns = computed(() => {
|
|
154
152
|
const query = this.columnQuery().trim().toLocaleLowerCase();
|
|
155
153
|
return this.columns().filter(column => column.header.toLocaleLowerCase().includes(query));
|
|
156
|
-
}, ...(ngDevMode ? [{ debugName: "listedColumns" }] : []));
|
|
157
|
-
shownCount = computed(() => this.columns().filter(column => column.visible).length, ...(ngDevMode ? [{ debugName: "shownCount" }] : []));
|
|
154
|
+
}, ...(ngDevMode ? [{ debugName: "listedColumns" }] : /* istanbul ignore next */ []));
|
|
155
|
+
shownCount = computed(() => this.columns().filter(column => column.visible).length, ...(ngDevMode ? [{ debugName: "shownCount" }] : /* istanbul ignore next */ []));
|
|
158
156
|
toggleMenu() {
|
|
159
157
|
this.columnsOpen.update(open => !open);
|
|
160
158
|
this.columnQuery.set('');
|
|
@@ -202,12 +200,12 @@ class SuTableToolbarComponent {
|
|
|
202
200
|
togglePinnable(column) {
|
|
203
201
|
this.pinnableChange.emit({ key: column.key, pinnable: !column.pinnable });
|
|
204
202
|
}
|
|
205
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
206
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
203
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuTableToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
204
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.26", type: SuTableToolbarComponent, isStandalone: true, selector: "su-lib-table-toolbar", inputs: { labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: true, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: true, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, columnControls: { classPropertyName: "columnControls", publicName: "columnControls", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { queryChange: "queryChange", pinnableChange: "pinnableChange", visibilityChange: "visibilityChange", allVisibilityChange: "allVisibilityChange" }, host: { listeners: { "document:pointerdown": "closeOutside($event)" } }, viewQueries: [{ propertyName: "menu", first: true, predicate: ["menu"], descendants: true, isSignal: true }, { propertyName: "menuButton", first: true, predicate: ["menuButton"], descendants: true, isSignal: true }], ngImport: i0, template: "@let t = labels();\n<div class=\"su-table-bar\">\n @if (searchable()) {\n <div class=\"su-table-search\">\n <svg class=\"su-table-search-icon\" viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\">\n <circle cx=\"7\" cy=\"7\" r=\"4.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" />\n <path d=\"m10.5 10.5 3.5 3.5\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" />\n </svg>\n <input\n type=\"search\"\n class=\"su-table-search-input\"\n [id]=\"controlId() + '-search'\"\n [value]=\"query()\"\n [attr.aria-label]=\"t.search\"\n [attr.placeholder]=\"t.search\"\n (input)=\"onQuery($event)\"\n (keydown.escape)=\"clearQuery($event)\"\n />\n </div>\n }\n @if (columnControls()) {\n <div #menu class=\"su-table-columns\">\n <button\n #menuButton\n type=\"button\"\n class=\"su-table-button\"\n [attr.aria-expanded]=\"columnsOpen()\"\n [attr.aria-controls]=\"controlId() + '-columns'\"\n (click)=\"toggleMenu()\"\n >\n {{ t.columns }}\n </button>\n @if (columnsOpen()) {\n <div\n class=\"su-table-menu\"\n role=\"group\"\n [id]=\"controlId() + '-columns'\"\n [attr.aria-labelledby]=\"controlId() + '-columns-title'\"\n (keydown.escape)=\"closeMenu()\"\n >\n <p class=\"su-table-menu-title\" [id]=\"controlId() + '-columns-title'\">{{ t.columns }}</p>\n <div class=\"su-table-search\">\n <svg class=\"su-table-search-icon\" viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\">\n <circle cx=\"7\" cy=\"7\" r=\"4.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" />\n <path d=\"m10.5 10.5 3.5 3.5\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" />\n </svg>\n <input\n type=\"search\"\n class=\"su-table-search-input\"\n [value]=\"columnQuery()\"\n [attr.aria-label]=\"t.searchColumns\"\n [attr.placeholder]=\"t.search\"\n (input)=\"onColumnQuery($event)\"\n />\n </div>\n <label class=\"su-table-menu-item is-all\">\n <input\n type=\"checkbox\"\n [checked]=\"shownCount() === columns().length\"\n [indeterminate]=\"shownCount() > 0 && shownCount() < columns().length\"\n (change)=\"onAllVisible($event)\"\n />\n <span>{{ t.allColumns }}</span>\n </label>\n <ul class=\"su-table-menu-list\">\n @for (column of listedColumns(); track column.key) {\n <li class=\"su-table-menu-item\">\n <label>\n <input\n type=\"checkbox\"\n [checked]=\"column.visible\"\n [disabled]=\"column.visible && shownCount() === 1\"\n (change)=\"onVisible(column.key, $event)\"\n />\n <span>{{ column.header }}</span>\n </label>\n <button\n type=\"button\"\n class=\"su-table-menu-pin\"\n [attr.aria-label]=\"t.showPin(column.header)\"\n [attr.aria-pressed]=\"column.pinnable\"\n [disabled]=\"!column.visible\"\n (click)=\"togglePinnable(column)\"\n >\n <svg suTablePinIcon width=\"13\" height=\"13\"></svg>\n </button>\n </li>\n }\n </ul>\n </div>\n }\n </div>\n }\n</div>\n", styles: [":host{display:block}.su-table-bar{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem;justify-content:flex-end;margin-bottom:.75rem}.su-table-search{align-items:center;display:flex;flex:1 1 14rem;margin-inline-end:auto;max-width:22rem;position:relative}.su-table-search-icon{inset-inline-start:.6rem;opacity:.55;pointer-events:none;position:absolute}.su-table-search-input{background:var(--su-table-input-background, transparent);border:var(--su-table-input-border, 1px solid rgba(0, 0, 0, .25));border-radius:var(--su-table-input-radius, 6px);box-sizing:border-box;color:inherit;font:inherit}.su-table-search-input:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-search-input{min-height:2.1rem;padding:.3rem .6rem .3rem 2rem;width:100%}.su-table-button{background:var(--su-table-button-background, transparent);border:var(--su-table-button-border, 1px solid rgba(0, 0, 0, .2));border-radius:var(--su-table-button-radius, 6px);color:var(--su-table-button-color, inherit);cursor:pointer;font:inherit;font-size:.875em;padding:var(--su-table-button-padding, .3rem .7rem);white-space:nowrap}.su-table-button:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-button:disabled{cursor:not-allowed;opacity:.45}.su-table-button.is-primary{background:var(--su-table-primary-background, #111);border-color:transparent;color:var(--su-table-primary-color, #fff)}.su-table-button.is-danger{border-color:var(--su-table-danger-border, color-mix(in srgb, #b42318 35%, transparent));color:var(--su-table-danger-color, #b42318)}.su-table-button.is-quiet{border-color:transparent}.su-table-columns{position:relative}.su-table-menu{background:var(--su-table-menu-background, Canvas);border:var(--su-table-border, 1px solid rgba(0, 0, 0, .12));border-radius:var(--su-table-radius, 10px);box-shadow:var(--su-table-menu-shadow, 0 12px 32px rgba(0, 0, 0, .18));box-sizing:border-box;display:grid;gap:.6rem;inset-inline-end:0;max-height:22rem;max-width:calc(100vw - 2rem);overflow:auto;padding:.85rem;position:absolute;top:calc(100% + .4rem);width:16rem;z-index:10}.su-table-menu .su-table-search{flex:none;margin:0;max-width:none}.su-table-menu-title{font-weight:600;margin:0}.su-table-menu-list{display:grid;gap:.15rem;list-style:none;margin:0;padding:0}.su-table-menu-item{align-items:center;display:flex;gap:.5rem;justify-content:space-between}.su-table-menu-item label{align-items:center;cursor:pointer;display:flex;flex:1;gap:.55rem;min-width:0;padding:.3rem 0}.su-table-menu-item input{accent-color:var(--su-table-accent, #2563eb);flex:none;height:1rem;margin:0;width:1rem}.su-table-menu-item input:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-menu-item.is-all{border-bottom:var(--su-table-row-border, 1px solid rgba(0, 0, 0, .08));cursor:pointer;gap:.55rem;justify-content:flex-start;padding:.3rem 0 .5rem}.su-table-menu-pin:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-menu-pin{align-items:center;background:none;border:1px solid transparent;border-radius:6px;color:inherit;cursor:pointer;display:inline-flex;height:1.75rem;justify-content:center;width:1.75rem}.su-table-menu-pin svg{opacity:.35}.su-table-menu-pin[aria-pressed=true]{border-color:var(--su-table-accent, #2563eb);color:var(--su-table-accent, #2563eb)}.su-table-menu-pin[aria-pressed=true] svg{opacity:1}.su-table-menu-pin:disabled{cursor:not-allowed;opacity:.4}\n"], dependencies: [{ kind: "component", type: SuTablePinIconComponent, selector: "svg[suTablePinIcon]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
207
205
|
}
|
|
208
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
206
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuTableToolbarComponent, decorators: [{
|
|
209
207
|
type: Component,
|
|
210
|
-
args: [{ selector: 'su-lib-table-toolbar', changeDetection: ChangeDetectionStrategy.OnPush, imports: [SuTablePinIconComponent], host: { '(document:pointerdown)': 'closeOutside($event)' }, template: "@let t = labels();\n<div class=\"su-table-bar\">\n @if (searchable()) {\n <div class=\"su-table-search\">\n <svg class=\"su-table-search-icon\" viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\">\n <circle cx=\"7\" cy=\"7\" r=\"4.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" />\n <path d=\"m10.5 10.5 3.5 3.5\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" />\n </svg>\n <input\n type=\"search\"\n class=\"su-table-search-input\"\n [id]=\"controlId() + '-search'\"\n [value]=\"query()\"\n [attr.aria-label]=\"t.search\"\n [attr.placeholder]=\"t.search\"\n (input)=\"onQuery($event)\"\n (keydown.escape)=\"clearQuery($event)\"\n />\n </div>\n }\n @if (columnControls()) {\n <div #menu class=\"su-table-columns\">\n <button\n #menuButton\n type=\"button\"\n class=\"su-table-button\"\n [attr.aria-expanded]=\"columnsOpen()\"\n [attr.aria-controls]=\"controlId() + '-columns'\"\n (click)=\"toggleMenu()\"\n >\n {{ t.columns }}\n </button>\n @if (columnsOpen()) {\n <div\n class=\"su-table-menu\"\n role=\"group\"\n [id]=\"controlId() + '-columns'\"\n [attr.aria-labelledby]=\"controlId() + '-columns-title'\"\n (keydown.escape)=\"closeMenu()\"\n >\n <p class=\"su-table-menu-title\" [id]=\"controlId() + '-columns-title'\">{{ t.columns }}</p>\n <div class=\"su-table-search\">\n <svg class=\"su-table-search-icon\" viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\">\n <circle cx=\"7\" cy=\"7\" r=\"4.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" />\n <path d=\"m10.5 10.5 3.5 3.5\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" />\n </svg>\n <input\n type=\"search\"\n class=\"su-table-search-input\"\n [value]=\"columnQuery()\"\n [attr.aria-label]=\"t.searchColumns\"\n [attr.placeholder]=\"t.search\"\n (input)=\"onColumnQuery($event)\"\n />\n </div>\n <label class=\"su-table-menu-item is-all\">\n <input\n type=\"checkbox\"\n [checked]=\"shownCount() === columns().length\"\n [indeterminate]=\"shownCount() > 0 && shownCount() < columns().length\"\n (change)=\"onAllVisible($event)\"\n />\n <span>{{ t.allColumns }}</span>\n </label>\n <ul class=\"su-table-menu-list\">\n @for (column of listedColumns(); track column.key) {\n <li class=\"su-table-menu-item\">\n <label>\n <input\n type=\"checkbox\"\n [checked]=\"column.visible\"\n [disabled]=\"column.visible && shownCount() === 1\"\n (change)=\"onVisible(column.key, $event)\"\n />\n <span>{{ column.header }}</span>\n </label>\n <button\n type=\"button\"\n class=\"su-table-menu-pin\"\n [attr.aria-label]=\"t.showPin(column.header)\"\n [attr.aria-pressed]=\"column.pinnable\"\n [disabled]=\"!column.visible\"\n (click)=\"togglePinnable(column)\"\n >\n <svg suTablePinIcon width=\"13\" height=\"13\"></svg>\n </button>\n </li>\n }\n </ul>\n </div>\n }\n </div>\n }\n</div>\n", styles: [":host{display:block}.su-table-bar{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem;justify-content:flex-end;margin-bottom:.75rem}.su-table-search{align-items:center;display:flex;flex:1 1 14rem;margin-inline-end:auto;max-width:22rem;position:relative}.su-table-search-icon{inset-inline-start:.6rem;opacity:.55;pointer-events:none;position:absolute}.su-table-search-input{background:var(--su-table-input-background, transparent);border:var(--su-table-input-border, 1px solid rgba(0, 0, 0, .25));border-radius:var(--su-table-input-radius, 6px);box-sizing:border-box;color:inherit;font:inherit
|
|
208
|
+
args: [{ selector: 'su-lib-table-toolbar', changeDetection: ChangeDetectionStrategy.OnPush, imports: [SuTablePinIconComponent], host: { '(document:pointerdown)': 'closeOutside($event)' }, template: "@let t = labels();\n<div class=\"su-table-bar\">\n @if (searchable()) {\n <div class=\"su-table-search\">\n <svg class=\"su-table-search-icon\" viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\">\n <circle cx=\"7\" cy=\"7\" r=\"4.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" />\n <path d=\"m10.5 10.5 3.5 3.5\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" />\n </svg>\n <input\n type=\"search\"\n class=\"su-table-search-input\"\n [id]=\"controlId() + '-search'\"\n [value]=\"query()\"\n [attr.aria-label]=\"t.search\"\n [attr.placeholder]=\"t.search\"\n (input)=\"onQuery($event)\"\n (keydown.escape)=\"clearQuery($event)\"\n />\n </div>\n }\n @if (columnControls()) {\n <div #menu class=\"su-table-columns\">\n <button\n #menuButton\n type=\"button\"\n class=\"su-table-button\"\n [attr.aria-expanded]=\"columnsOpen()\"\n [attr.aria-controls]=\"controlId() + '-columns'\"\n (click)=\"toggleMenu()\"\n >\n {{ t.columns }}\n </button>\n @if (columnsOpen()) {\n <div\n class=\"su-table-menu\"\n role=\"group\"\n [id]=\"controlId() + '-columns'\"\n [attr.aria-labelledby]=\"controlId() + '-columns-title'\"\n (keydown.escape)=\"closeMenu()\"\n >\n <p class=\"su-table-menu-title\" [id]=\"controlId() + '-columns-title'\">{{ t.columns }}</p>\n <div class=\"su-table-search\">\n <svg class=\"su-table-search-icon\" viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\">\n <circle cx=\"7\" cy=\"7\" r=\"4.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" />\n <path d=\"m10.5 10.5 3.5 3.5\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" />\n </svg>\n <input\n type=\"search\"\n class=\"su-table-search-input\"\n [value]=\"columnQuery()\"\n [attr.aria-label]=\"t.searchColumns\"\n [attr.placeholder]=\"t.search\"\n (input)=\"onColumnQuery($event)\"\n />\n </div>\n <label class=\"su-table-menu-item is-all\">\n <input\n type=\"checkbox\"\n [checked]=\"shownCount() === columns().length\"\n [indeterminate]=\"shownCount() > 0 && shownCount() < columns().length\"\n (change)=\"onAllVisible($event)\"\n />\n <span>{{ t.allColumns }}</span>\n </label>\n <ul class=\"su-table-menu-list\">\n @for (column of listedColumns(); track column.key) {\n <li class=\"su-table-menu-item\">\n <label>\n <input\n type=\"checkbox\"\n [checked]=\"column.visible\"\n [disabled]=\"column.visible && shownCount() === 1\"\n (change)=\"onVisible(column.key, $event)\"\n />\n <span>{{ column.header }}</span>\n </label>\n <button\n type=\"button\"\n class=\"su-table-menu-pin\"\n [attr.aria-label]=\"t.showPin(column.header)\"\n [attr.aria-pressed]=\"column.pinnable\"\n [disabled]=\"!column.visible\"\n (click)=\"togglePinnable(column)\"\n >\n <svg suTablePinIcon width=\"13\" height=\"13\"></svg>\n </button>\n </li>\n }\n </ul>\n </div>\n }\n </div>\n }\n</div>\n", styles: [":host{display:block}.su-table-bar{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem;justify-content:flex-end;margin-bottom:.75rem}.su-table-search{align-items:center;display:flex;flex:1 1 14rem;margin-inline-end:auto;max-width:22rem;position:relative}.su-table-search-icon{inset-inline-start:.6rem;opacity:.55;pointer-events:none;position:absolute}.su-table-search-input{background:var(--su-table-input-background, transparent);border:var(--su-table-input-border, 1px solid rgba(0, 0, 0, .25));border-radius:var(--su-table-input-radius, 6px);box-sizing:border-box;color:inherit;font:inherit}.su-table-search-input:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-search-input{min-height:2.1rem;padding:.3rem .6rem .3rem 2rem;width:100%}.su-table-button{background:var(--su-table-button-background, transparent);border:var(--su-table-button-border, 1px solid rgba(0, 0, 0, .2));border-radius:var(--su-table-button-radius, 6px);color:var(--su-table-button-color, inherit);cursor:pointer;font:inherit;font-size:.875em;padding:var(--su-table-button-padding, .3rem .7rem);white-space:nowrap}.su-table-button:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-button:disabled{cursor:not-allowed;opacity:.45}.su-table-button.is-primary{background:var(--su-table-primary-background, #111);border-color:transparent;color:var(--su-table-primary-color, #fff)}.su-table-button.is-danger{border-color:var(--su-table-danger-border, color-mix(in srgb, #b42318 35%, transparent));color:var(--su-table-danger-color, #b42318)}.su-table-button.is-quiet{border-color:transparent}.su-table-columns{position:relative}.su-table-menu{background:var(--su-table-menu-background, Canvas);border:var(--su-table-border, 1px solid rgba(0, 0, 0, .12));border-radius:var(--su-table-radius, 10px);box-shadow:var(--su-table-menu-shadow, 0 12px 32px rgba(0, 0, 0, .18));box-sizing:border-box;display:grid;gap:.6rem;inset-inline-end:0;max-height:22rem;max-width:calc(100vw - 2rem);overflow:auto;padding:.85rem;position:absolute;top:calc(100% + .4rem);width:16rem;z-index:10}.su-table-menu .su-table-search{flex:none;margin:0;max-width:none}.su-table-menu-title{font-weight:600;margin:0}.su-table-menu-list{display:grid;gap:.15rem;list-style:none;margin:0;padding:0}.su-table-menu-item{align-items:center;display:flex;gap:.5rem;justify-content:space-between}.su-table-menu-item label{align-items:center;cursor:pointer;display:flex;flex:1;gap:.55rem;min-width:0;padding:.3rem 0}.su-table-menu-item input{accent-color:var(--su-table-accent, #2563eb);flex:none;height:1rem;margin:0;width:1rem}.su-table-menu-item input:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-menu-item.is-all{border-bottom:var(--su-table-row-border, 1px solid rgba(0, 0, 0, .08));cursor:pointer;gap:.55rem;justify-content:flex-start;padding:.3rem 0 .5rem}.su-table-menu-pin:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-menu-pin{align-items:center;background:none;border:1px solid transparent;border-radius:6px;color:inherit;cursor:pointer;display:inline-flex;height:1.75rem;justify-content:center;width:1.75rem}.su-table-menu-pin svg{opacity:.35}.su-table-menu-pin[aria-pressed=true]{border-color:var(--su-table-accent, #2563eb);color:var(--su-table-accent, #2563eb)}.su-table-menu-pin[aria-pressed=true] svg{opacity:1}.su-table-menu-pin:disabled{cursor:not-allowed;opacity:.4}\n"] }]
|
|
211
209
|
}], propDecorators: { labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: true }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: true }] }], searchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchable", required: false }] }], query: [{ type: i0.Input, args: [{ isSignal: true, alias: "query", required: false }] }], columnControls: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnControls", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], queryChange: [{ type: i0.Output, args: ["queryChange"] }], pinnableChange: [{ type: i0.Output, args: ["pinnableChange"] }], visibilityChange: [{ type: i0.Output, args: ["visibilityChange"] }], allVisibilityChange: [{ type: i0.Output, args: ["allVisibilityChange"] }], menu: [{ type: i0.ViewChild, args: ['menu', { isSignal: true }] }], menuButton: [{ type: i0.ViewChild, args: ['menuButton', { isSignal: true }] }] } });
|
|
212
210
|
|
|
213
211
|
/** The action id the table handles itself: it edits the row inline */
|
|
@@ -223,46 +221,46 @@ const SEARCH_DELAY = 200;
|
|
|
223
221
|
* changes. Edited rows come out in the API's own shape through `edited`.
|
|
224
222
|
*/
|
|
225
223
|
class SuTableComponent {
|
|
226
|
-
columns = input.required(...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
227
|
-
rows = input.required(...(ngDevMode ? [{ debugName: "rows" }] : []));
|
|
224
|
+
columns = input.required(...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
225
|
+
rows = input.required(...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
228
226
|
/** The table's name for screen readers, shown as its caption */
|
|
229
|
-
caption = input.required(...(ngDevMode ? [{ debugName: "caption" }] : []));
|
|
227
|
+
caption = input.required(...(ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []));
|
|
230
228
|
/** Shows the caption on screen too @default false */
|
|
231
|
-
showCaption = input(false, ...(ngDevMode ?
|
|
229
|
+
showCaption = input(false, { ...(ngDevMode ? { debugName: "showCaption" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
232
230
|
/** The row's identity, e.g. the API's id; keeps the selection and edits across new rows */
|
|
233
|
-
rowId = input(...(ngDevMode ? [undefined, { debugName: "rowId" }] : []));
|
|
231
|
+
rowId = input(...(ngDevMode ? [undefined, { debugName: "rowId" }] : /* istanbul ignore next */ []));
|
|
234
232
|
/** Buttons on each row; the `edit` id edits the row inline */
|
|
235
|
-
actions = input([], ...(ngDevMode ? [{ debugName: "actions" }] : []));
|
|
233
|
+
actions = input([], ...(ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []));
|
|
236
234
|
/** Rows can be selected, to edit or act on many at once @default false */
|
|
237
|
-
selectable = input(false, ...(ngDevMode ?
|
|
235
|
+
selectable = input(false, { ...(ngDevMode ? { debugName: "selectable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
238
236
|
/** Rows can be reordered, by dragging or with the keyboard @default false */
|
|
239
|
-
reorderable = input(false, ...(ngDevMode ?
|
|
237
|
+
reorderable = input(false, { ...(ngDevMode ? { debugName: "reorderable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
240
238
|
/** A Columns button with a menu to show or hide columns and the pin in their headings @default false */
|
|
241
|
-
columnControls = input(false, ...(ngDevMode ?
|
|
239
|
+
columnControls = input(false, { ...(ngDevMode ? { debugName: "columnControls" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
242
240
|
/** A search box above the table that narrows the rows by their text @default false */
|
|
243
|
-
searchable = input(false, ...(ngDevMode ?
|
|
241
|
+
searchable = input(false, { ...(ngDevMode ? { debugName: "searchable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
244
242
|
/**
|
|
245
243
|
* The most the table grows before it scrolls inside, any CSS length (e.g. `'28rem'`); the header and the pinned
|
|
246
244
|
* rows stay in view while the rows scroll under them
|
|
247
245
|
*/
|
|
248
|
-
maxHeight = input(...(ngDevMode ? [undefined, { debugName: "maxHeight" }] : []));
|
|
246
|
+
maxHeight = input(...(ngDevMode ? [undefined, { debugName: "maxHeight" }] : /* istanbul ignore next */ []));
|
|
249
247
|
/**
|
|
250
248
|
* Extra classes for a row, e.g. `(user) => (user.active ? null : 'is-muted')`. The table styles `is-muted` and
|
|
251
249
|
* `is-highlighted`; other classes are yours to style
|
|
252
250
|
*/
|
|
253
|
-
rowClass = input(...(ngDevMode ? [undefined, { debugName: "rowClass" }] : []));
|
|
251
|
+
rowClass = input(...(ngDevMode ? [undefined, { debugName: "rowClass" }] : /* istanbul ignore next */ []));
|
|
254
252
|
/** A double-click on an editable cell edits its row, starting in that field @default true */
|
|
255
|
-
editOnDoubleClick = input(true, ...(ngDevMode ?
|
|
253
|
+
editOnDoubleClick = input(true, { ...(ngDevMode ? { debugName: "editOnDoubleClick" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
256
254
|
/** Rows per page; without it, every row shows @default 'all' */
|
|
257
|
-
pageSize = input(...(ngDevMode ? [undefined, { debugName: "pageSize" }] : []));
|
|
255
|
+
pageSize = input(...(ngDevMode ? [undefined, { debugName: "pageSize" }] : /* istanbul ignore next */ []));
|
|
258
256
|
/** The page sizes people choose from under the table, e.g. `[10, 25, 50, 'all']` */
|
|
259
|
-
pageSizes = input([], ...(ngDevMode ? [{ debugName: "pageSizes" }] : []));
|
|
257
|
+
pageSizes = input([], ...(ngDevMode ? [{ debugName: "pageSizes" }] : /* istanbul ignore next */ []));
|
|
260
258
|
/** A Pin button on each row, keeping it above the others on every page @default false */
|
|
261
|
-
rowPinning = input(false, ...(ngDevMode ?
|
|
259
|
+
rowPinning = input(false, { ...(ngDevMode ? { debugName: "rowPinning" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
262
260
|
/** The ids of the rows pinned to start with */
|
|
263
|
-
pinnedRows = input(...(ngDevMode ? [undefined, { debugName: "pinnedRows" }] : []));
|
|
261
|
+
pinnedRows = input(...(ngDevMode ? [undefined, { debugName: "pinnedRows" }] : /* istanbul ignore next */ []));
|
|
264
262
|
/** Texts to replace, e.g. in the page's language */
|
|
265
|
-
labels = input({}, ...(ngDevMode ? [{ debugName: "labels" }] : []));
|
|
263
|
+
labels = input({}, ...(ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []));
|
|
266
264
|
/** Rows were edited and saved; send them to the API as they are */
|
|
267
265
|
edited = output();
|
|
268
266
|
reordered = output();
|
|
@@ -279,47 +277,47 @@ class SuTableComponent {
|
|
|
279
277
|
pageChange = output();
|
|
280
278
|
controller = new SuTableController();
|
|
281
279
|
host = inject(ElementRef);
|
|
282
|
-
cellTemplates = contentChildren(SuTableCellDirective, ...(ngDevMode ? [{ debugName: "cellTemplates" }] : []));
|
|
283
|
-
focusHandleId = signal(null, ...(ngDevMode ? [{ debugName: "focusHandleId" }] : []));
|
|
280
|
+
cellTemplates = contentChildren(SuTableCellDirective, ...(ngDevMode ? [{ debugName: "cellTemplates" }] : /* istanbul ignore next */ []));
|
|
281
|
+
focusHandleId = signal(null, ...(ngDevMode ? [{ debugName: "focusHandleId" }] : /* istanbul ignore next */ []));
|
|
284
282
|
/** The id of the field to focus once it renders, after a double-click */
|
|
285
|
-
focusFieldId = signal(null, ...(ngDevMode ? [{ debugName: "focusFieldId" }] : []));
|
|
283
|
+
focusFieldId = signal(null, ...(ngDevMode ? [{ debugName: "focusFieldId" }] : /* istanbul ignore next */ []));
|
|
286
284
|
searchTimer;
|
|
287
|
-
headerWidths = signal([], ...(ngDevMode ? [{ debugName: "headerWidths" }] : []));
|
|
288
|
-
scrollerWidth = signal(0, ...(ngDevMode ? [{ debugName: "scrollerWidth" }] : []));
|
|
285
|
+
headerWidths = signal([], ...(ngDevMode ? [{ debugName: "headerWidths" }] : /* istanbul ignore next */ []));
|
|
286
|
+
scrollerWidth = signal(0, ...(ngDevMode ? [{ debugName: "scrollerWidth" }] : /* istanbul ignore next */ []));
|
|
289
287
|
headerLayout = computed(() => `${this.state()
|
|
290
288
|
.columns.map(column => `${String(column.key)}:${column.pinned}`)
|
|
291
289
|
.join()}|${this.reorderable()}|${this.selectable()}|${this.hasActions()}|${this.state()
|
|
292
290
|
.pinnedRows.map(row => row.id)
|
|
293
|
-
.join()}`, ...(ngDevMode ? [{ debugName: "headerLayout" }] : []));
|
|
294
|
-
headerHeight = signal(0, ...(ngDevMode ? [{ debugName: "headerHeight" }] : []));
|
|
295
|
-
pinnedRowHeights = signal([], ...(ngDevMode ? [{ debugName: "pinnedRowHeights" }] : []));
|
|
291
|
+
.join()}`, ...(ngDevMode ? [{ debugName: "headerLayout" }] : /* istanbul ignore next */ []));
|
|
292
|
+
headerHeight = signal(0, ...(ngDevMode ? [{ debugName: "headerHeight" }] : /* istanbul ignore next */ []));
|
|
293
|
+
pinnedRowHeights = signal([], ...(ngDevMode ? [{ debugName: "pinnedRowHeights" }] : /* istanbul ignore next */ []));
|
|
296
294
|
tableId = `su-table-${nextTableId++}`;
|
|
297
|
-
state = signal(this.controller.state.get(), ...(ngDevMode ? [{ debugName: "state" }] : []));
|
|
295
|
+
state = signal(this.controller.state.get(), ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
298
296
|
text = computed(() => ({
|
|
299
297
|
...SU_TABLE_LABELS,
|
|
300
298
|
...this.labels(),
|
|
301
|
-
}), ...(ngDevMode ? [{ debugName: "text" }] : []));
|
|
302
|
-
drag = signal(null, ...(ngDevMode ? [{ debugName: "drag" }] : []));
|
|
299
|
+
}), ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
|
|
300
|
+
drag = signal(null, ...(ngDevMode ? [{ debugName: "drag" }] : /* istanbul ignore next */ []));
|
|
303
301
|
inlineDraft = computed(() => {
|
|
304
302
|
const draft = this.state().draft;
|
|
305
303
|
return draft && !draft.bulk ? draft : null;
|
|
306
|
-
}, ...(ngDevMode ? [{ debugName: "inlineDraft" }] : []));
|
|
304
|
+
}, ...(ngDevMode ? [{ debugName: "inlineDraft" }] : /* istanbul ignore next */ []));
|
|
307
305
|
bulkDraft = computed(() => {
|
|
308
306
|
const draft = this.state().draft;
|
|
309
307
|
return draft?.bulk ? draft : null;
|
|
310
|
-
}, ...(ngDevMode ? [{ debugName: "bulkDraft" }] : []));
|
|
308
|
+
}, ...(ngDevMode ? [{ debugName: "bulkDraft" }] : /* istanbul ignore next */ []));
|
|
311
309
|
/** The actions column also shows, for Save and Cancel, while a row is edited by double-click */
|
|
312
310
|
hasActions = computed(() => this.actions().length > 0 ||
|
|
313
311
|
this.rowPinning() ||
|
|
314
|
-
this.inlineDraft() !== null, ...(ngDevMode ? [{ debugName: "hasActions" }] : []));
|
|
312
|
+
this.inlineDraft() !== null, ...(ngDevMode ? [{ debugName: "hasActions" }] : /* istanbul ignore next */ []));
|
|
315
313
|
/** The pinned rows, then the current page */
|
|
316
314
|
bodyRows = computed(() => {
|
|
317
315
|
const { pinnedRows, rows } = this.state();
|
|
318
316
|
return [...pinnedRows, ...rows];
|
|
319
|
-
}, ...(ngDevMode ? [{ debugName: "bodyRows" }] : []));
|
|
320
|
-
scrolledFromStart = signal(false, ...(ngDevMode ? [{ debugName: "scrolledFromStart" }] : []));
|
|
321
|
-
moreAtEnd = signal(false, ...(ngDevMode ? [{ debugName: "moreAtEnd" }] : []));
|
|
322
|
-
scrolledFromTop = signal(false, ...(ngDevMode ? [{ debugName: "scrolledFromTop" }] : []));
|
|
317
|
+
}, ...(ngDevMode ? [{ debugName: "bodyRows" }] : /* istanbul ignore next */ []));
|
|
318
|
+
scrolledFromStart = signal(false, ...(ngDevMode ? [{ debugName: "scrolledFromStart" }] : /* istanbul ignore next */ []));
|
|
319
|
+
moreAtEnd = signal(false, ...(ngDevMode ? [{ debugName: "moreAtEnd" }] : /* istanbul ignore next */ []));
|
|
320
|
+
scrolledFromTop = signal(false, ...(ngDevMode ? [{ debugName: "scrolledFromTop" }] : /* istanbul ignore next */ []));
|
|
323
321
|
/** Where each pinned row sticks: under the header and the pinned rows above it */
|
|
324
322
|
pinnedRowTops = computed(() => {
|
|
325
323
|
let top = this.headerHeight();
|
|
@@ -328,8 +326,8 @@ class SuTableComponent {
|
|
|
328
326
|
top += height;
|
|
329
327
|
return rowTop;
|
|
330
328
|
});
|
|
331
|
-
}, ...(ngDevMode ? [{ debugName: "pinnedRowTops" }] : []));
|
|
332
|
-
columnSlot = computed(() => Number(this.reorderable()) + Number(this.selectable()), ...(ngDevMode ? [{ debugName: "columnSlot" }] : []));
|
|
329
|
+
}, ...(ngDevMode ? [{ debugName: "pinnedRowTops" }] : /* istanbul ignore next */ []));
|
|
330
|
+
columnSlot = computed(() => Number(this.reorderable()) + Number(this.selectable()), ...(ngDevMode ? [{ debugName: "columnSlot" }] : /* istanbul ignore next */ []));
|
|
333
331
|
/**
|
|
334
332
|
* Where each header slot sticks, in order: the move handles, the checkboxes, the columns and the actions. The
|
|
335
333
|
* handles and checkboxes stay with columns pinned to the start, the actions with columns pinned to the end.
|
|
@@ -349,12 +347,30 @@ class SuTableComponent {
|
|
|
349
347
|
...columns.map(column => column.pinned),
|
|
350
348
|
...(this.hasActions() ? [actionsPin] : []),
|
|
351
349
|
];
|
|
352
|
-
|
|
353
|
-
|
|
350
|
+
const widths = this.headerWidths();
|
|
351
|
+
const pinnedWidth = pins.reduce((sum, pin, index) => (pin ? sum + (widths[index] ?? 0) : sum), 0);
|
|
352
|
+
if (pinnedWidth > this.scrollerWidth() - MIN_SCROLLING_WIDTH) {
|
|
353
|
+
return pins.map(() => null);
|
|
354
|
+
}
|
|
355
|
+
const lastStart = pins.lastIndexOf('start');
|
|
356
|
+
const firstEnd = pins.indexOf('end');
|
|
357
|
+
const widthOf = (pin, from, to) => pins
|
|
358
|
+
.slice(from, to)
|
|
359
|
+
.reduce((sum, slotPin, index) => slotPin === pin ? sum + (widths[from + index] ?? 0) : sum, 0);
|
|
360
|
+
return pins.map((pin, index) => pin
|
|
361
|
+
? {
|
|
362
|
+
pin,
|
|
363
|
+
offset: pin === 'start'
|
|
364
|
+
? widthOf(pin, 0, index)
|
|
365
|
+
: widthOf(pin, index + 1, pins.length),
|
|
366
|
+
edge: index === (pin === 'start' ? lastStart : firstEnd),
|
|
367
|
+
}
|
|
368
|
+
: null);
|
|
369
|
+
}, ...(ngDevMode ? [{ debugName: "placements" }] : /* istanbul ignore next */ []));
|
|
354
370
|
columnCount = computed(() => this.state().columns.length +
|
|
355
371
|
Number(this.reorderable()) +
|
|
356
372
|
Number(this.selectable()) +
|
|
357
|
-
Number(this.hasActions()), ...(ngDevMode ? [{ debugName: "columnCount" }] : []));
|
|
373
|
+
Number(this.hasActions()), ...(ngDevMode ? [{ debugName: "columnCount" }] : /* istanbul ignore next */ []));
|
|
358
374
|
constructor() {
|
|
359
375
|
const unsubscribe = this.controller.state.subscribe(state => this.state.set(state));
|
|
360
376
|
inject(DestroyRef).onDestroy(() => {
|
|
@@ -672,10 +688,10 @@ class SuTableComponent {
|
|
|
672
688
|
emitReorder(ids) {
|
|
673
689
|
this.reordered.emit({ ids, rows: this.controller.rowsOf(ids) });
|
|
674
690
|
}
|
|
675
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
676
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.35", type: SuTableComponent, isStandalone: true, selector: "su-lib-table", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: true, transformFunction: null }, caption: { classPropertyName: "caption", publicName: "caption", isSignal: true, isRequired: true, transformFunction: null }, showCaption: { classPropertyName: "showCaption", publicName: "showCaption", isSignal: true, isRequired: false, transformFunction: null }, rowId: { classPropertyName: "rowId", publicName: "rowId", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, reorderable: { classPropertyName: "reorderable", publicName: "reorderable", isSignal: true, isRequired: false, transformFunction: null }, columnControls: { classPropertyName: "columnControls", publicName: "columnControls", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, rowClass: { classPropertyName: "rowClass", publicName: "rowClass", isSignal: true, isRequired: false, transformFunction: null }, editOnDoubleClick: { classPropertyName: "editOnDoubleClick", publicName: "editOnDoubleClick", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, pageSizes: { classPropertyName: "pageSizes", publicName: "pageSizes", isSignal: true, isRequired: false, transformFunction: null }, rowPinning: { classPropertyName: "rowPinning", publicName: "rowPinning", isSignal: true, isRequired: false, transformFunction: null }, pinnedRows: { classPropertyName: "pinnedRows", publicName: "pinnedRows", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { edited: "edited", reordered: "reordered", action: "action", sortChange: "sortChange", selectionChange: "selectionChange", searchChange: "searchChange", pinnedRowsChange: "pinnedRowsChange", columnsChange: "columnsChange", pageChange: "pageChange" }, host: { classAttribute: "su-table" }, queries: [{ propertyName: "cellTemplates", predicate: SuTableCellDirective, isSignal: true }], ngImport: i0, template: "@let current = state();\n@let t = text();\n@let selectedCount = current.selectedIds.length;\n@let pins = placements();\n@let firstColumnSlot = columnSlot();\n@if (searchable() || columnControls()) {\n <su-lib-table-toolbar\n [labels]=\"t\"\n [controlId]=\"tableId\"\n [searchable]=\"searchable()\"\n [query]=\"current.query\"\n [columnControls]=\"columnControls()\"\n [columns]=\"current.allColumns\"\n (queryChange)=\"search($event)\"\n (pinnableChange)=\"setColumnPinnable($event)\"\n (visibilityChange)=\"setColumnVisible($event)\"\n (allVisibilityChange)=\"setColumnsVisible($event)\"\n />\n}\n@if (selectable() && selectedCount > 0) {\n <div class=\"su-table-toolbar\" role=\"toolbar\" [attr.aria-label]=\"t.selected(selectedCount)\">\n <span class=\"su-table-toolbar-count\">{{ t.selected(selectedCount) }}</span>\n @if (current.editable && !current.draft) {\n <button type=\"button\" class=\"su-table-button\" (click)=\"editSelected()\">\n {{ t.editSelected(selectedCount) }}\n </button>\n }\n @for (action of current.bulkActions; track action.id) {\n <button type=\"button\" class=\"su-table-button\" [class.is-danger]=\"action.danger\" (click)=\"runBulkAction(action)\">\n {{ action.label }}\n </button>\n }\n <button type=\"button\" class=\"su-table-button is-quiet\" (click)=\"selectAll(false)\">{{ t.clearSelection }}</button>\n </div>\n}\n\n@if (bulkDraft(); as draft) {\n <form\n class=\"su-table-bulk\"\n [attr.aria-labelledby]=\"tableId + '-bulk-title'\"\n (submit)=\"save($event)\"\n (keydown.escape)=\"cancelEdit()\"\n >\n <h3 class=\"su-table-bulk-title\" [id]=\"tableId + '-bulk-title'\">{{ t.editing(draft.ids.length) }}</h3>\n <div class=\"su-table-bulk-fields\">\n @for (field of draft.fields; track field.key) {\n <div class=\"su-table-bulk-field\">\n <label class=\"su-table-label\" [for]=\"controlId('bulk', field.key)\">{{ field.header }}</label>\n <su-lib-table-field\n [field]=\"field\"\n [controlId]=\"controlId('bulk', field.key)\"\n [mixedLabel]=\"t.mixed\"\n (valueChange)=\"setDraft(field.key, $event)\"\n />\n </div>\n }\n </div>\n <div class=\"su-table-bulk-actions\">\n <button type=\"submit\" class=\"su-table-button is-primary\">{{ t.save }}</button>\n <button type=\"button\" class=\"su-table-button\" (click)=\"cancelEdit()\">{{ t.cancel }}</button>\n </div>\n </form>\n}\n\n<div\n class=\"su-table-scroll\"\n [class.is-scrolled-start]=\"scrolledFromStart()\"\n [class.has-more-end]=\"moreAtEnd()\"\n [class.is-scrolled-top]=\"scrolledFromTop()\"\n [class.has-pinned-rows]=\"current.pinnedRows.length > 0\"\n [style.max-height]=\"maxHeight()\"\n (scroll)=\"onScroll($event)\"\n>\n <table class=\"su-table-grid\" [class.is-dragging-rows]=\"drag() !== null\">\n <caption [class.su-table-visually-hidden]=\"!showCaption()\">{{ caption() }}</caption>\n <thead>\n <tr>\n @if (reorderable()) {\n <th scope=\"col\" class=\"su-table-handle-cell\" [suTablePin]=\"pins[0]\">\n <span class=\"su-table-visually-hidden\">{{ t.order }}</span>\n </th>\n }\n @if (selectable()) {\n <th scope=\"col\" class=\"su-table-select-cell\" [suTablePin]=\"pins[firstColumnSlot - 1]\">\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [checked]=\"current.selection === 'all'\"\n [indeterminate]=\"current.selection === 'some'\"\n [disabled]=\"current.rows.length === 0\"\n [attr.aria-label]=\"t.selectAll\"\n (change)=\"selectAll()\"\n />\n </th>\n }\n @for (column of current.columns; track column.key; let columnIndex = $index) {\n <th\n scope=\"col\"\n class=\"su-table-align-{{ column.align }}\"\n [class.is-sorted]=\"column.sort !== 'none'\"\n [suTablePin]=\"pins[firstColumnSlot + columnIndex]\"\n [attr.aria-sort]=\"column.sort === 'none' ? null : column.sort\"\n >\n @if (column.sortable) {\n <button type=\"button\" class=\"su-table-sort\" (click)=\"sortBy(column.key)\">\n {{ column.header }}\n <span class=\"su-table-sort-icon is-{{ column.sort }}\" aria-hidden=\"true\"></span>\n </button>\n } @else {\n {{ column.header }}\n }\n @if (column.pinnable) {\n <button\n type=\"button\"\n class=\"su-table-header-pin\"\n [attr.aria-label]=\"t.pinColumn(column.header)\"\n [attr.aria-pressed]=\"column.pinned !== null\"\n (click)=\"toggleColumnPin(column.key, column.pinned)\"\n >\n <svg suTablePinIcon width=\"12\" height=\"12\"></svg>\n </button>\n } @else if (pins[firstColumnSlot + columnIndex]) {\n <svg suTablePinIcon class=\"su-table-pinned-icon\" width=\"11\" height=\"11\"></svg>\n }\n </th>\n }\n @if (hasActions()) {\n <th scope=\"col\" class=\"su-table-actions-cell\" [suTablePin]=\"pins[pins.length - 1]\">{{ t.actions }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of bodyRows(); track row.id; let rowIndex = $index) {\n @let editing = inlineDraft()?.ids?.[0] === row.id;\n @let index = rowIndex - current.pinnedRows.length;\n <tr\n [attr.data-su-row]=\"row.pinned ? null : ''\"\n [class.is-pinned-row]=\"row.pinned\"\n [class.is-last-pinned-row]=\"index === -1\"\n [style.--su-table-row-top]=\"row.pinned ? pinnedRowTops()[rowIndex] + 'px' : null\"\n [class.is-selected]=\"row.selected\"\n [class.is-editing]=\"editing\"\n [class.is-grabbed]=\"current.grabbedId === row.id\"\n [class]=\"rowClassOf(row)\"\n [class.is-dragging]=\"drag()?.id === row.id\"\n [class.is-drop-before]=\"dropSide(index) === 'before'\"\n [class.is-drop-after]=\"dropSide(index) === 'after'\"\n [style.transform]=\"dragTransform(index)\"\n (keydown)=\"editing && onEditKey($event)\"\n >\n @if (reorderable()) {\n <td class=\"su-table-handle-cell\" [suTablePin]=\"pins[0]\">\n @if (!row.pinned && !current.searching) {\n <button\n type=\"button\"\n class=\"su-table-handle\"\n [attr.data-su-handle]=\"row.id\"\n [attr.aria-label]=\"t.moveRow(row.label)\"\n [attr.aria-pressed]=\"current.grabbedId === row.id\"\n (keydown)=\"onHandleKey($event, row.id)\"\n (pointerdown)=\"onHandleDown($event, row.id, index)\"\n (pointermove)=\"onHandleMove($event)\"\n (pointerup)=\"onHandleUp()\"\n (pointercancel)=\"onHandleCancel()\"\n >\n <span class=\"su-table-grip\" aria-hidden=\"true\"></span>\n </button>\n }\n </td>\n }\n @if (selectable()) {\n <td class=\"su-table-select-cell\" [suTablePin]=\"pins[firstColumnSlot - 1]\">\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [checked]=\"row.selected\"\n [attr.aria-label]=\"t.selectRow(row.label)\"\n (change)=\"select(row.id)\"\n />\n </td>\n }\n @for (cell of row.cells; track cell.key; let cellIndex = $index) {\n @let column = current.columns[cellIndex];\n @let pin = pins[firstColumnSlot + cellIndex];\n <td\n class=\"su-table-align-{{ column.align }}\"\n [attr.role]=\"cell.key === current.rowHeaderKey ? 'rowheader' : null\"\n [class.su-table-row-header]=\"cell.key === current.rowHeaderKey\"\n [class.is-sorted]=\"column.sort !== 'none'\"\n [class.is-editable]=\"!editing && editsOnDoubleClick(cell.key)\"\n [suTablePin]=\"pin\"\n (mousedown)=\"keepTextUnselected($event, cell.key)\"\n (dblclick)=\"editCell(row, cell.key)\"\n >\n @if (editing && inlineField(cell.key); as field) {\n <su-lib-table-field\n [field]=\"field\"\n [controlId]=\"controlId(row.id, cell.key)\"\n [ariaLabel]=\"column.header\"\n [mixedLabel]=\"t.mixed\"\n (valueChange)=\"setDraft(cell.key, $event)\"\n />\n } @else {\n @if (cellTemplate(cell.key); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: row.data, text: cell.text }\" />\n } @else {\n {{ cell.text }}\n }\n }\n </td>\n }\n @if (hasActions()) {\n <td class=\"su-table-actions-cell\" [suTablePin]=\"pins[pins.length - 1]\">\n <div class=\"su-table-actions\">\n @if (editing) {\n <button type=\"button\" class=\"su-table-button is-primary\" (click)=\"save()\">{{ t.save }}</button>\n <button type=\"button\" class=\"su-table-button\" (click)=\"cancelEdit()\">{{ t.cancel }}</button>\n } @else {\n @if (rowPinning()) {\n <button\n type=\"button\"\n class=\"su-table-button su-table-pin-button\"\n [attr.aria-pressed]=\"row.pinned\"\n [attr.aria-label]=\"t.pinRow + ', ' + row.label\"\n (click)=\"pinRow(row.id)\"\n >\n <svg suTablePinIcon width=\"12\" height=\"12\"></svg>\n {{ t.pinRow }}\n </button>\n }\n @for (action of row.actions; track action.id) {\n <button\n type=\"button\"\n class=\"su-table-button\"\n [class.is-danger]=\"action.danger\"\n [disabled]=\"action.disabled\"\n [attr.aria-label]=\"action.label + ', ' + row.label\"\n (click)=\"runAction(action, row)\"\n >\n {{ action.label }}\n </button>\n }\n }\n </div>\n </td>\n }\n </tr>\n }\n @if (current.rows.length === 0) {\n <tr>\n <td class=\"su-table-empty\" [attr.colspan]=\"columnCount()\">\n {{ current.searching ? t.noMatches(current.query) : t.empty }}\n </td>\n </tr>\n }\n </tbody>\n </table>\n</div>\n\n@if (current.pagination.pageSizes.length > 0 || current.pagination.pageSize !== 'all') {\n <su-lib-table-paginator\n [pagination]=\"current.pagination\"\n [labels]=\"t\"\n [controlId]=\"tableId + '-page-size'\"\n (pageChange)=\"setPage($event)\"\n (pageSizeChange)=\"setPageSize($event)\"\n />\n}\n\n<div class=\"su-table-visually-hidden\" role=\"status\">{{ current.announcement }}</div>\n", styles: [":host{color:var(--su-table-text-color, inherit);display:block;min-width:0;font-family:var(--su-table-font-family, inherit);font-size:var(--su-table-font-size, .95rem)}.su-table-scroll{border:var(--su-table-border, 1px solid rgba(0, 0, 0, .12));border-radius:var(--su-table-radius, 10px);overflow:auto}.su-table-grid{background:var(--su-table-background, transparent);border-collapse:separate;border-spacing:0;min-width:100%}caption{caption-side:top;color:var(--su-table-caption-color, inherit);font-size:var(--su-table-caption-font-size, inherit);font-weight:600;padding:var(--su-table-cell-padding, .6rem .75rem);text-align:start}th,td{background-image:linear-gradient(var(--su-table-cell-tint, transparent),var(--su-table-cell-tint, transparent));border-bottom:var(--su-table-row-border, 1px solid rgba(0, 0, 0, .08));padding:var(--su-table-cell-padding, .6rem .75rem);text-align:start;vertical-align:var(--su-table-cell-vertical-align, middle)}thead th{--su-table-row-tint: var(--su-table-header-background, rgb(0 0 0 / .03));border-bottom:var(--su-table-header-border, var(--su-table-row-border, 1px solid rgba(0, 0, 0, .08)));color:var(--su-table-header-color, inherit);font-size:var(--su-table-header-font-size, inherit);font-weight:var(--su-table-header-font-weight, 600);letter-spacing:var(--su-table-header-letter-spacing, normal);padding:var(--su-table-header-padding, var(--su-table-cell-padding, .6rem .75rem));text-transform:var(--su-table-header-text-transform, none);white-space:nowrap}.is-sorted{--su-table-cell-tint: var(--su-table-sorted-background, transparent)}td.is-editable:hover,th.is-editable:hover{--su-table-cell-tint: var(--su-table-editable-hover-background, color-mix(in srgb, currentColor 6%, transparent))}.su-table-row-header{font-weight:var(--su-table-row-header-weight, 600)}tbody tr:last-child>*{border-bottom:none}tbody tr{--su-table-row-tint: var(--su-table-row-background, transparent);background:var(--su-table-row-tint);color:var(--su-table-row-color, inherit)}tbody tr:nth-child(2n){--su-table-row-tint: var(--su-table-stripe-background, var(--su-table-row-background, transparent))}tbody tr.is-muted{--su-table-row-tint: var(--su-table-muted-background, transparent);color:color-mix(in srgb,currentColor var(--su-table-muted-text, 55%),transparent)}tbody tr.is-highlighted{--su-table-row-tint: var(--su-table-highlight-background, color-mix(in srgb, #f59e0b 14%, transparent))}tbody tr:hover{--su-table-row-tint: var(--su-table-hover-background, rgb(0 0 0 / .025))}tbody tr.is-selected{--su-table-row-tint: var(--su-table-selected-background, color-mix(in srgb, #2563eb 8%, transparent));color:var(--su-table-selected-color, inherit)}tbody tr.is-editing{--su-table-row-tint: var(--su-table-editing-background, color-mix(in srgb, #2563eb 5%, transparent))}tbody tr.is-pinned-row{--su-table-row-tint: var(--su-table-pinned-row-background, color-mix(in srgb, #2563eb 6%, transparent))}tbody tr.is-last-pinned-row>*{border-bottom:var(--su-table-pinned-row-border, 2px solid color-mix(in srgb, #2563eb 40%, transparent))}tbody tr.is-grabbed,tbody tr.is-dragging{--su-table-row-tint: var(--su-table-grabbed-background, color-mix(in srgb, #2563eb 14%, transparent));outline:var(--su-table-grabbed-outline, 2px solid color-mix(in srgb, #2563eb 60%, transparent));outline-offset:-2px}tbody tr.is-dragging{background:linear-gradient(var(--su-table-row-tint),var(--su-table-row-tint)),var(--su-table-dragging-background, Canvas);box-shadow:var(--su-table-dragging-shadow, 0 8px 24px rgba(0, 0, 0, .18));cursor:grabbing;position:relative;z-index:3}tbody tr.is-drop-before>*{box-shadow:inset 0 var(--su-table-drop-line-width, 2px) 0 var(--su-table-drop-line-color, #2563eb)}tbody tr.is-drop-after>*{box-shadow:inset 0 calc(-1 * var(--su-table-drop-line-width, 2px)) 0 var(--su-table-drop-line-color, #2563eb)}thead th,tbody tr.is-pinned-row>*,.is-pinned-start,.is-pinned-end{background:linear-gradient(var(--su-table-cell-tint, transparent),var(--su-table-cell-tint, transparent)),linear-gradient(var(--su-table-row-tint, transparent),var(--su-table-row-tint, transparent)),var(--su-table-pinned-background, Canvas);position:sticky;z-index:1}thead th{top:0;z-index:4}thead th.is-pinned-start,thead th.is-pinned-end{z-index:5}tbody tr.is-pinned-row>*{top:var(--su-table-row-top, 0);z-index:2}tbody tr.is-pinned-row>*.is-pinned-start,tbody tr.is-pinned-row>*.is-pinned-end{z-index:3}.is-scrolled-top:not(.has-pinned-rows) thead th,.is-scrolled-top tr.is-last-pinned-row>*{box-shadow:var(--su-table-sticky-shadow, 0 6px 8px -6px rgba(0, 0, 0, .25))}.is-pinned-edge:after{content:\"\";inset-block:0;opacity:0;pointer-events:none;position:absolute;transition:opacity .15s ease-out;width:1rem}.is-pinned-start.is-pinned-edge{border-inline-end:var(--su-table-pinned-border, 1px solid rgba(0, 0, 0, .14))}.is-pinned-end.is-pinned-edge{border-inline-start:var(--su-table-pinned-border, 1px solid rgba(0, 0, 0, .14))}.su-table-pinned-icon{margin-inline-start:.35rem;opacity:.45;vertical-align:-1px}.su-table-header-pin{background:none;border:none;border-radius:4px;color:inherit;cursor:pointer;margin-inline-start:.2rem;opacity:.3;padding:.2rem;vertical-align:middle}.su-table-header-pin:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-header-pin:hover{opacity:.7}.su-table-header-pin[aria-pressed=true]{color:var(--su-table-accent, #2563eb);opacity:1}.is-pinned-start.is-pinned-edge:after{background:linear-gradient(to right,var(--su-table-pinned-shadow, rgba(0, 0, 0, .22)),transparent);inset-inline-start:100%}.is-pinned-end.is-pinned-edge:after{background:linear-gradient(to left,var(--su-table-pinned-shadow, rgba(0, 0, 0, .22)),transparent);inset-inline-end:100%}.is-scrolled-start .is-pinned-start.is-pinned-edge:after,.has-more-end .is-pinned-end.is-pinned-edge:after{opacity:1}@media(prefers-reduced-motion:no-preference){.is-dragging-rows tbody tr:not(.is-dragging){transition:transform .15s ease-out}}td.is-editable,th.is-editable{cursor:text}.su-table-align-start{text-align:start}.su-table-align-center{text-align:center}.su-table-align-end{text-align:end}.su-table-handle-cell,.su-table-select-cell{text-align:center;width:1%}.su-table-actions-cell{text-align:end;width:1%}.su-table-actions{display:flex;gap:.35rem;justify-content:flex-end}.su-table-sort{align-items:center;background:none;border:none;border-radius:4px;color:inherit;cursor:pointer;display:inline-flex;font:inherit;letter-spacing:inherit;text-transform:inherit;gap:.35rem;margin:-.2rem -.35rem;padding:.2rem .35rem}.su-table-sort-icon{border-left:.3rem solid transparent;border-right:.3rem solid transparent;height:0;opacity:.35;width:0}.su-table-sort-icon.is-none,.su-table-sort-icon.is-ascending{border-bottom:.4rem solid currentColor}.su-table-sort-icon.is-descending{border-top:.4rem solid currentColor}.su-table-sort-icon.is-ascending,.su-table-sort-icon.is-descending{opacity:1}.su-table-handle{background:none;border:none;border-radius:4px;color:var(--su-table-handle-color, inherit);cursor:grab;display:inline-flex;padding:.35rem .3rem;touch-action:none}.su-table-handle:active{cursor:grabbing}.su-table-grip{background-image:radial-gradient(currentColor 1.2px,transparent 1.4px);background-size:6px 6px;display:block;height:18px;opacity:.6;width:12px}.su-table-button{background:var(--su-table-button-background, transparent);border:var(--su-table-button-border, 1px solid rgba(0, 0, 0, .2));border-radius:var(--su-table-button-radius, 6px);color:var(--su-table-button-color, inherit);cursor:pointer;font:inherit;font-size:.875em;padding:var(--su-table-button-padding, .3rem .7rem);white-space:nowrap}.su-table-button:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-button:disabled{cursor:not-allowed;opacity:.45}.su-table-button.is-primary{background:var(--su-table-primary-background, #111);border-color:transparent;color:var(--su-table-primary-color, #fff)}.su-table-button.is-danger{border-color:var(--su-table-danger-border, color-mix(in srgb, #b42318 35%, transparent));color:var(--su-table-danger-color, #b42318)}.su-table-button.is-quiet{border-color:transparent}.su-table-button.su-table-pin-button{align-items:center;display:inline-flex;gap:.3rem}.su-table-button.su-table-pin-button svg{opacity:.5}.su-table-button.su-table-pin-button[aria-pressed=true]{border-color:var(--su-table-accent, #2563eb);color:var(--su-table-accent, #2563eb)}.su-table-button.su-table-pin-button[aria-pressed=true] svg{opacity:1}.su-table-sort:focus-visible,.su-table-handle:focus-visible,.su-table-checkbox:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-checkbox{accent-color:var(--su-table-accent, #2563eb);height:var(--su-table-checkbox-size, 1rem);margin:0;width:var(--su-table-checkbox-size, 1rem)}.su-table-toolbar,.su-table-bulk{background:var(--su-table-panel-background, rgba(0, 0, 0, .03));border-radius:var(--su-table-radius, 10px);margin-bottom:.75rem;padding:.6rem .75rem}.su-table-toolbar{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem}.su-table-toolbar-count{font-weight:600;margin-right:auto}.su-table-bulk-title{font-size:1rem;margin:0 0 .75rem}.su-table-bulk-fields{display:grid;gap:.75rem;grid-template-columns:repeat(auto-fill,minmax(12rem,1fr))}.su-table-bulk-field{display:flex;flex-direction:column;gap:.3rem}.su-table-label{font-size:.85em;font-weight:600}.su-table-bulk-actions{display:flex;gap:.5rem;margin-top:.75rem}.su-table-empty{opacity:.7;padding:1.5rem;text-align:center}.su-table-visually-hidden{clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}@media(prefers-reduced-motion:no-preference){tbody tr{transition:background-color .12s ease-out}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SuTableFieldComponent, selector: "su-lib-table-field", inputs: ["field", "controlId", "ariaLabel", "mixedLabel"], outputs: ["valueChange"] }, { kind: "component", type: SuTablePaginatorComponent, selector: "su-lib-table-paginator", inputs: ["pagination", "labels", "controlId"], outputs: ["pageChange", "pageSizeChange"] }, { kind: "directive", type: SuTablePinDirective, selector: "[suTablePin]", inputs: ["suTablePin"] }, { kind: "component", type: SuTablePinIconComponent, selector: "svg[suTablePinIcon]" }, { kind: "component", type: SuTableToolbarComponent, selector: "su-lib-table-toolbar", inputs: ["labels", "controlId", "searchable", "query", "columnControls", "columns"], outputs: ["queryChange", "pinnableChange", "visibilityChange", "allVisibilityChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
691
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
692
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.26", type: SuTableComponent, isStandalone: true, selector: "su-lib-table", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: true, transformFunction: null }, caption: { classPropertyName: "caption", publicName: "caption", isSignal: true, isRequired: true, transformFunction: null }, showCaption: { classPropertyName: "showCaption", publicName: "showCaption", isSignal: true, isRequired: false, transformFunction: null }, rowId: { classPropertyName: "rowId", publicName: "rowId", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, reorderable: { classPropertyName: "reorderable", publicName: "reorderable", isSignal: true, isRequired: false, transformFunction: null }, columnControls: { classPropertyName: "columnControls", publicName: "columnControls", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, rowClass: { classPropertyName: "rowClass", publicName: "rowClass", isSignal: true, isRequired: false, transformFunction: null }, editOnDoubleClick: { classPropertyName: "editOnDoubleClick", publicName: "editOnDoubleClick", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, pageSizes: { classPropertyName: "pageSizes", publicName: "pageSizes", isSignal: true, isRequired: false, transformFunction: null }, rowPinning: { classPropertyName: "rowPinning", publicName: "rowPinning", isSignal: true, isRequired: false, transformFunction: null }, pinnedRows: { classPropertyName: "pinnedRows", publicName: "pinnedRows", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { edited: "edited", reordered: "reordered", action: "action", sortChange: "sortChange", selectionChange: "selectionChange", searchChange: "searchChange", pinnedRowsChange: "pinnedRowsChange", columnsChange: "columnsChange", pageChange: "pageChange" }, host: { classAttribute: "su-table" }, queries: [{ propertyName: "cellTemplates", predicate: SuTableCellDirective, isSignal: true }], ngImport: i0, template: "@let current = state();\n@let t = text();\n@let selectedCount = current.selectedIds.length;\n@let pins = placements();\n@let firstColumnSlot = columnSlot();\n@if (searchable() || columnControls()) {\n <su-lib-table-toolbar\n [labels]=\"t\"\n [controlId]=\"tableId\"\n [searchable]=\"searchable()\"\n [query]=\"current.query\"\n [columnControls]=\"columnControls()\"\n [columns]=\"current.allColumns\"\n (queryChange)=\"search($event)\"\n (pinnableChange)=\"setColumnPinnable($event)\"\n (visibilityChange)=\"setColumnVisible($event)\"\n (allVisibilityChange)=\"setColumnsVisible($event)\"\n />\n}\n@if (selectable() && selectedCount > 0) {\n <div class=\"su-table-toolbar\" role=\"toolbar\" [attr.aria-label]=\"t.selected(selectedCount)\">\n <span class=\"su-table-toolbar-count\">{{ t.selected(selectedCount) }}</span>\n @if (current.editable && !current.draft) {\n <button type=\"button\" class=\"su-table-button\" (click)=\"editSelected()\">\n {{ t.editSelected(selectedCount) }}\n </button>\n }\n @for (action of current.bulkActions; track action.id) {\n <button type=\"button\" class=\"su-table-button\" [class.is-danger]=\"action.danger\" (click)=\"runBulkAction(action)\">\n {{ action.label }}\n </button>\n }\n <button type=\"button\" class=\"su-table-button is-quiet\" (click)=\"selectAll(false)\">{{ t.clearSelection }}</button>\n </div>\n}\n\n@if (bulkDraft(); as draft) {\n <form\n class=\"su-table-bulk\"\n [attr.aria-labelledby]=\"tableId + '-bulk-title'\"\n (submit)=\"save($event)\"\n (keydown.escape)=\"cancelEdit()\"\n >\n <h3 class=\"su-table-bulk-title\" [id]=\"tableId + '-bulk-title'\">{{ t.editing(draft.ids.length) }}</h3>\n <div class=\"su-table-bulk-fields\">\n @for (field of draft.fields; track field.key) {\n <div class=\"su-table-bulk-field\">\n <label class=\"su-table-label\" [for]=\"controlId('bulk', field.key)\">{{ field.header }}</label>\n <su-lib-table-field\n [field]=\"field\"\n [controlId]=\"controlId('bulk', field.key)\"\n [mixedLabel]=\"t.mixed\"\n (valueChange)=\"setDraft(field.key, $event)\"\n />\n </div>\n }\n </div>\n <div class=\"su-table-bulk-actions\">\n <button type=\"submit\" class=\"su-table-button is-primary\">{{ t.save }}</button>\n <button type=\"button\" class=\"su-table-button\" (click)=\"cancelEdit()\">{{ t.cancel }}</button>\n </div>\n </form>\n}\n\n<div\n class=\"su-table-scroll\"\n [class.is-scrolled-start]=\"scrolledFromStart()\"\n [class.has-more-end]=\"moreAtEnd()\"\n [class.is-scrolled-top]=\"scrolledFromTop()\"\n [class.has-pinned-rows]=\"current.pinnedRows.length > 0\"\n [style.max-height]=\"maxHeight()\"\n (scroll)=\"onScroll($event)\"\n>\n <table class=\"su-table-grid\" [class.is-dragging-rows]=\"drag() !== null\">\n <caption [class.su-table-visually-hidden]=\"!showCaption()\">{{ caption() }}</caption>\n <thead>\n <tr>\n @if (reorderable()) {\n <th scope=\"col\" class=\"su-table-handle-cell\" [suTablePin]=\"pins[0]\">\n <span class=\"su-table-visually-hidden\">{{ t.order }}</span>\n </th>\n }\n @if (selectable()) {\n <th scope=\"col\" class=\"su-table-select-cell\" [suTablePin]=\"pins[firstColumnSlot - 1]\">\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [checked]=\"current.selection === 'all'\"\n [indeterminate]=\"current.selection === 'some'\"\n [disabled]=\"current.rows.length === 0\"\n [attr.aria-label]=\"t.selectAll\"\n (change)=\"selectAll()\"\n />\n </th>\n }\n @for (column of current.columns; track column.key; let columnIndex = $index) {\n <th\n scope=\"col\"\n class=\"su-table-align-{{ column.align }}\"\n [class.is-sorted]=\"column.sort !== 'none'\"\n [suTablePin]=\"pins[firstColumnSlot + columnIndex]\"\n [attr.aria-sort]=\"column.sort === 'none' ? null : column.sort\"\n >\n @if (column.sortable) {\n <button type=\"button\" class=\"su-table-sort\" (click)=\"sortBy(column.key)\">\n {{ column.header }}\n <span class=\"su-table-sort-icon is-{{ column.sort }}\" aria-hidden=\"true\"></span>\n </button>\n } @else {\n {{ column.header }}\n }\n @if (column.pinnable) {\n <button\n type=\"button\"\n class=\"su-table-header-pin\"\n [attr.aria-label]=\"t.pinColumn(column.header)\"\n [attr.aria-pressed]=\"column.pinned !== null\"\n (click)=\"toggleColumnPin(column.key, column.pinned)\"\n >\n <svg suTablePinIcon width=\"12\" height=\"12\"></svg>\n </button>\n } @else if (pins[firstColumnSlot + columnIndex]) {\n <svg suTablePinIcon class=\"su-table-pinned-icon\" width=\"11\" height=\"11\"></svg>\n }\n </th>\n }\n @if (hasActions()) {\n <th scope=\"col\" class=\"su-table-actions-cell\" [suTablePin]=\"pins[pins.length - 1]\">{{ t.actions }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of bodyRows(); track row.id; let rowIndex = $index) {\n @let editing = inlineDraft()?.ids?.[0] === row.id;\n @let index = rowIndex - current.pinnedRows.length;\n <tr\n [attr.data-su-row]=\"row.pinned ? null : ''\"\n [class.is-pinned-row]=\"row.pinned\"\n [class.is-last-pinned-row]=\"index === -1\"\n [style.--su-table-row-top]=\"row.pinned ? pinnedRowTops()[rowIndex] + 'px' : null\"\n [class.is-selected]=\"row.selected\"\n [class.is-editing]=\"editing\"\n [class.is-grabbed]=\"current.grabbedId === row.id\"\n [class]=\"rowClassOf(row)\"\n [class.is-dragging]=\"drag()?.id === row.id\"\n [class.is-drop-before]=\"dropSide(index) === 'before'\"\n [class.is-drop-after]=\"dropSide(index) === 'after'\"\n [style.transform]=\"dragTransform(index)\"\n (keydown)=\"editing && onEditKey($event)\"\n >\n @if (reorderable()) {\n <td class=\"su-table-handle-cell\" [suTablePin]=\"pins[0]\">\n @if (!row.pinned && !current.searching) {\n <button\n type=\"button\"\n class=\"su-table-handle\"\n [attr.data-su-handle]=\"row.id\"\n [attr.aria-label]=\"t.moveRow(row.label)\"\n [attr.aria-pressed]=\"current.grabbedId === row.id\"\n (keydown)=\"onHandleKey($event, row.id)\"\n (pointerdown)=\"onHandleDown($event, row.id, index)\"\n (pointermove)=\"onHandleMove($event)\"\n (pointerup)=\"onHandleUp()\"\n (pointercancel)=\"onHandleCancel()\"\n >\n <span class=\"su-table-grip\" aria-hidden=\"true\"></span>\n </button>\n }\n </td>\n }\n @if (selectable()) {\n <td class=\"su-table-select-cell\" [suTablePin]=\"pins[firstColumnSlot - 1]\">\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [checked]=\"row.selected\"\n [attr.aria-label]=\"t.selectRow(row.label)\"\n (change)=\"select(row.id)\"\n />\n </td>\n }\n @for (cell of row.cells; track cell.key; let cellIndex = $index) {\n @let column = current.columns[cellIndex];\n @let pin = pins[firstColumnSlot + cellIndex];\n <td\n class=\"su-table-align-{{ column.align }}\"\n [attr.role]=\"cell.key === current.rowHeaderKey ? 'rowheader' : null\"\n [class.su-table-row-header]=\"cell.key === current.rowHeaderKey\"\n [class.is-sorted]=\"column.sort !== 'none'\"\n [class.is-editable]=\"!editing && editsOnDoubleClick(cell.key)\"\n [suTablePin]=\"pin\"\n (mousedown)=\"keepTextUnselected($event, cell.key)\"\n (dblclick)=\"editCell(row, cell.key)\"\n >\n @if (editing && inlineField(cell.key); as field) {\n <su-lib-table-field\n [field]=\"field\"\n [controlId]=\"controlId(row.id, cell.key)\"\n [ariaLabel]=\"column.header\"\n [mixedLabel]=\"t.mixed\"\n (valueChange)=\"setDraft(cell.key, $event)\"\n />\n } @else {\n @if (cellTemplate(cell.key); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: row.data, text: cell.text }\" />\n } @else {\n {{ cell.text }}\n }\n }\n </td>\n }\n @if (hasActions()) {\n <td class=\"su-table-actions-cell\" [suTablePin]=\"pins[pins.length - 1]\">\n <div class=\"su-table-actions\">\n @if (editing) {\n <button type=\"button\" class=\"su-table-button is-primary\" (click)=\"save()\">{{ t.save }}</button>\n <button type=\"button\" class=\"su-table-button\" (click)=\"cancelEdit()\">{{ t.cancel }}</button>\n } @else {\n @if (rowPinning()) {\n <button\n type=\"button\"\n class=\"su-table-button su-table-pin-button\"\n [attr.aria-pressed]=\"row.pinned\"\n [attr.aria-label]=\"t.pinRow + ', ' + row.label\"\n (click)=\"pinRow(row.id)\"\n >\n <svg suTablePinIcon width=\"12\" height=\"12\"></svg>\n {{ t.pinRow }}\n </button>\n }\n @for (action of row.actions; track action.id) {\n <button\n type=\"button\"\n class=\"su-table-button\"\n [class.is-danger]=\"action.danger\"\n [disabled]=\"action.disabled\"\n [attr.aria-label]=\"action.label + ', ' + row.label\"\n (click)=\"runAction(action, row)\"\n >\n {{ action.label }}\n </button>\n }\n }\n </div>\n </td>\n }\n </tr>\n }\n @if (current.rows.length === 0) {\n <tr>\n <td class=\"su-table-empty\" [attr.colspan]=\"columnCount()\">\n {{ current.searching ? t.noMatches(current.query) : t.empty }}\n </td>\n </tr>\n }\n </tbody>\n </table>\n</div>\n\n@if (current.pagination.pageSizes.length > 0 || current.pagination.pageSize !== 'all') {\n <su-lib-table-paginator\n [pagination]=\"current.pagination\"\n [labels]=\"t\"\n [controlId]=\"tableId + '-page-size'\"\n (pageChange)=\"setPage($event)\"\n (pageSizeChange)=\"setPageSize($event)\"\n />\n}\n\n<div class=\"su-table-visually-hidden\" role=\"status\">{{ current.announcement }}</div>\n", styles: [":host{color:var(--su-table-text-color, inherit);display:block;min-width:0;font-family:var(--su-table-font-family, inherit);font-size:var(--su-table-font-size, .95rem)}.su-table-scroll{border:var(--su-table-border, 1px solid rgba(0, 0, 0, .12));border-radius:var(--su-table-radius, 10px);overflow:auto}.su-table-grid{background:var(--su-table-background, transparent);border-collapse:separate;border-spacing:0;min-width:100%}caption{caption-side:top;color:var(--su-table-caption-color, inherit);font-size:var(--su-table-caption-font-size, inherit);font-weight:600;padding:var(--su-table-cell-padding, .6rem .75rem);text-align:start}th,td{background-image:linear-gradient(var(--su-table-cell-tint, transparent),var(--su-table-cell-tint, transparent));border-bottom:var(--su-table-row-border, 1px solid rgba(0, 0, 0, .08));padding:var(--su-table-cell-padding, .6rem .75rem);text-align:start;vertical-align:var(--su-table-cell-vertical-align, middle)}thead th{--su-table-row-tint: var(--su-table-header-background, rgb(0 0 0 / .03));border-bottom:var(--su-table-header-border, var(--su-table-row-border, 1px solid rgba(0, 0, 0, .08)));color:var(--su-table-header-color, inherit);font-size:var(--su-table-header-font-size, inherit);font-weight:var(--su-table-header-font-weight, 600);letter-spacing:var(--su-table-header-letter-spacing, normal);padding:var(--su-table-header-padding, var(--su-table-cell-padding, .6rem .75rem));text-transform:var(--su-table-header-text-transform, none);white-space:nowrap}.is-sorted{--su-table-cell-tint: var(--su-table-sorted-background, transparent)}td.is-editable:hover,th.is-editable:hover{--su-table-cell-tint: var(--su-table-editable-hover-background, color-mix(in srgb, currentColor 6%, transparent))}.su-table-row-header{font-weight:var(--su-table-row-header-weight, 600)}tbody tr:last-child>*{border-bottom:none}tbody tr{--su-table-row-tint: var(--su-table-row-background, transparent);background:var(--su-table-row-tint);color:var(--su-table-row-color, inherit)}tbody tr:nth-child(2n){--su-table-row-tint: var(--su-table-stripe-background, var(--su-table-row-background, transparent))}tbody tr.is-muted{--su-table-row-tint: var(--su-table-muted-background, transparent);color:color-mix(in srgb,currentColor var(--su-table-muted-text, 55%),transparent)}tbody tr.is-highlighted{--su-table-row-tint: var(--su-table-highlight-background, color-mix(in srgb, #f59e0b 14%, transparent))}tbody tr:hover{--su-table-row-tint: var(--su-table-hover-background, rgb(0 0 0 / .025))}tbody tr.is-selected{--su-table-row-tint: var(--su-table-selected-background, color-mix(in srgb, #2563eb 8%, transparent));color:var(--su-table-selected-color, inherit)}tbody tr.is-editing{--su-table-row-tint: var(--su-table-editing-background, color-mix(in srgb, #2563eb 5%, transparent))}tbody tr.is-pinned-row{--su-table-row-tint: var(--su-table-pinned-row-background, color-mix(in srgb, #2563eb 6%, transparent))}tbody tr.is-last-pinned-row>*{border-bottom:var(--su-table-pinned-row-border, 2px solid color-mix(in srgb, #2563eb 40%, transparent))}tbody tr.is-grabbed,tbody tr.is-dragging{--su-table-row-tint: var(--su-table-grabbed-background, color-mix(in srgb, #2563eb 14%, transparent));outline:var(--su-table-grabbed-outline, 2px solid color-mix(in srgb, #2563eb 60%, transparent));outline-offset:-2px}tbody tr.is-dragging{background:linear-gradient(var(--su-table-row-tint),var(--su-table-row-tint)),var(--su-table-dragging-background, Canvas);box-shadow:var(--su-table-dragging-shadow, 0 8px 24px rgba(0, 0, 0, .18));cursor:grabbing;position:relative;z-index:3}tbody tr.is-drop-before>*{box-shadow:inset 0 var(--su-table-drop-line-width, 2px) 0 var(--su-table-drop-line-color, #2563eb)}tbody tr.is-drop-after>*{box-shadow:inset 0 calc(-1 * var(--su-table-drop-line-width, 2px)) 0 var(--su-table-drop-line-color, #2563eb)}thead th,tbody tr.is-pinned-row>*,.is-pinned-start,.is-pinned-end{background:linear-gradient(var(--su-table-cell-tint, transparent),var(--su-table-cell-tint, transparent)),linear-gradient(var(--su-table-row-tint, transparent),var(--su-table-row-tint, transparent)),var(--su-table-pinned-background, Canvas);position:sticky;z-index:1}thead th{top:0;z-index:4}thead th.is-pinned-start,thead th.is-pinned-end{z-index:5}tbody tr.is-pinned-row>*{top:var(--su-table-row-top, 0);z-index:2}tbody tr.is-pinned-row>*.is-pinned-start,tbody tr.is-pinned-row>*.is-pinned-end{z-index:3}.is-scrolled-top:not(.has-pinned-rows) thead th,.is-scrolled-top tr.is-last-pinned-row>*{box-shadow:var(--su-table-sticky-shadow, 0 6px 8px -6px rgba(0, 0, 0, .25))}.is-pinned-edge:after{content:\"\";inset-block:0;opacity:0;pointer-events:none;position:absolute;transition:opacity .15s ease-out;width:1rem}.is-pinned-start.is-pinned-edge{border-inline-end:var(--su-table-pinned-border, 1px solid rgba(0, 0, 0, .14))}.is-pinned-end.is-pinned-edge{border-inline-start:var(--su-table-pinned-border, 1px solid rgba(0, 0, 0, .14))}.su-table-pinned-icon{margin-inline-start:.35rem;opacity:.45;vertical-align:-1px}.su-table-header-pin:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-header-pin{background:none;border:none;border-radius:4px;color:inherit;cursor:pointer;margin-inline-start:.2rem;opacity:.3;padding:.2rem;vertical-align:middle}.su-table-header-pin:hover{opacity:.7}.su-table-header-pin[aria-pressed=true]{color:var(--su-table-accent, #2563eb);opacity:1}.is-pinned-start.is-pinned-edge:after{background:linear-gradient(to right,var(--su-table-pinned-shadow, rgba(0, 0, 0, .22)),transparent);inset-inline-start:100%}.is-pinned-end.is-pinned-edge:after{background:linear-gradient(to left,var(--su-table-pinned-shadow, rgba(0, 0, 0, .22)),transparent);inset-inline-end:100%}.is-scrolled-start .is-pinned-start.is-pinned-edge:after,.has-more-end .is-pinned-end.is-pinned-edge:after{opacity:1}@media(prefers-reduced-motion:no-preference){.is-dragging-rows tbody tr:not(.is-dragging){transition:transform .15s ease-out}}td.is-editable,th.is-editable{cursor:text}.su-table-align-start{text-align:start}.su-table-align-center{text-align:center}.su-table-align-end{text-align:end}.su-table-handle-cell,.su-table-select-cell{text-align:center;width:1%}.su-table-actions-cell{text-align:end;width:1%}.su-table-actions{display:flex;gap:.35rem;justify-content:flex-end}.su-table-sort{align-items:center;background:none;border:none;border-radius:4px;color:inherit;cursor:pointer;display:inline-flex;font:inherit;letter-spacing:inherit;text-transform:inherit;gap:.35rem;margin:-.2rem -.35rem;padding:.2rem .35rem}.su-table-sort-icon{border-left:.3rem solid transparent;border-right:.3rem solid transparent;height:0;opacity:.35;width:0}.su-table-sort-icon.is-none,.su-table-sort-icon.is-ascending{border-bottom:.4rem solid currentColor}.su-table-sort-icon.is-descending{border-top:.4rem solid currentColor}.su-table-sort-icon.is-ascending,.su-table-sort-icon.is-descending{opacity:1}.su-table-handle{background:none;border:none;border-radius:4px;color:var(--su-table-handle-color, inherit);cursor:grab;display:inline-flex;padding:.35rem .3rem;touch-action:none}.su-table-handle:active{cursor:grabbing}.su-table-grip{background-image:radial-gradient(currentColor 1.2px,transparent 1.4px);background-size:6px 6px;display:block;height:18px;opacity:.6;width:12px}.su-table-button{background:var(--su-table-button-background, transparent);border:var(--su-table-button-border, 1px solid rgba(0, 0, 0, .2));border-radius:var(--su-table-button-radius, 6px);color:var(--su-table-button-color, inherit);cursor:pointer;font:inherit;font-size:.875em;padding:var(--su-table-button-padding, .3rem .7rem);white-space:nowrap}.su-table-button:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-button:disabled{cursor:not-allowed;opacity:.45}.su-table-button.is-primary{background:var(--su-table-primary-background, #111);border-color:transparent;color:var(--su-table-primary-color, #fff)}.su-table-button.is-danger{border-color:var(--su-table-danger-border, color-mix(in srgb, #b42318 35%, transparent));color:var(--su-table-danger-color, #b42318)}.su-table-button.is-quiet{border-color:transparent}.su-table-button.su-table-pin-button{align-items:center;display:inline-flex;gap:.3rem}.su-table-button.su-table-pin-button svg{opacity:.5}.su-table-button.su-table-pin-button[aria-pressed=true]{border-color:var(--su-table-accent, #2563eb);color:var(--su-table-accent, #2563eb)}.su-table-button.su-table-pin-button[aria-pressed=true] svg{opacity:1}.su-table-sort:focus-visible,.su-table-handle:focus-visible,.su-table-checkbox:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-checkbox{accent-color:var(--su-table-accent, #2563eb);height:var(--su-table-checkbox-size, 1rem);margin:0;width:var(--su-table-checkbox-size, 1rem)}.su-table-toolbar,.su-table-bulk{background:var(--su-table-panel-background, rgba(0, 0, 0, .03));border-radius:var(--su-table-radius, 10px);margin-bottom:.75rem;padding:.6rem .75rem}.su-table-toolbar{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem}.su-table-toolbar-count{font-weight:600;margin-right:auto}.su-table-bulk-title{font-size:1rem;margin:0 0 .75rem}.su-table-bulk-fields{display:grid;gap:.75rem;grid-template-columns:repeat(auto-fill,minmax(12rem,1fr))}.su-table-bulk-field{display:flex;flex-direction:column;gap:.3rem}.su-table-label{font-size:.85em;font-weight:600}.su-table-bulk-actions{display:flex;gap:.5rem;margin-top:.75rem}.su-table-empty{opacity:.7;padding:1.5rem;text-align:center}.su-table-visually-hidden{clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}@media(prefers-reduced-motion:no-preference){tbody tr{transition:background-color .12s ease-out}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SuTableFieldComponent, selector: "su-lib-table-field", inputs: ["field", "controlId", "ariaLabel", "mixedLabel"], outputs: ["valueChange"] }, { kind: "component", type: SuTablePaginatorComponent, selector: "su-lib-table-paginator", inputs: ["pagination", "labels", "controlId"], outputs: ["pageChange", "pageSizeChange"] }, { kind: "directive", type: SuTablePinDirective, selector: "[suTablePin]", inputs: ["suTablePin"] }, { kind: "component", type: SuTablePinIconComponent, selector: "svg[suTablePinIcon]" }, { kind: "component", type: SuTableToolbarComponent, selector: "su-lib-table-toolbar", inputs: ["labels", "controlId", "searchable", "query", "columnControls", "columns"], outputs: ["queryChange", "pinnableChange", "visibilityChange", "allVisibilityChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
677
693
|
}
|
|
678
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
694
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.26", ngImport: i0, type: SuTableComponent, decorators: [{
|
|
679
695
|
type: Component,
|
|
680
696
|
args: [{ selector: 'su-lib-table', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
681
697
|
NgTemplateOutlet,
|
|
@@ -684,7 +700,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.35", ngImpo
|
|
|
684
700
|
SuTablePinDirective,
|
|
685
701
|
SuTablePinIconComponent,
|
|
686
702
|
SuTableToolbarComponent,
|
|
687
|
-
], host: { class: 'su-table' }, template: "@let current = state();\n@let t = text();\n@let selectedCount = current.selectedIds.length;\n@let pins = placements();\n@let firstColumnSlot = columnSlot();\n@if (searchable() || columnControls()) {\n <su-lib-table-toolbar\n [labels]=\"t\"\n [controlId]=\"tableId\"\n [searchable]=\"searchable()\"\n [query]=\"current.query\"\n [columnControls]=\"columnControls()\"\n [columns]=\"current.allColumns\"\n (queryChange)=\"search($event)\"\n (pinnableChange)=\"setColumnPinnable($event)\"\n (visibilityChange)=\"setColumnVisible($event)\"\n (allVisibilityChange)=\"setColumnsVisible($event)\"\n />\n}\n@if (selectable() && selectedCount > 0) {\n <div class=\"su-table-toolbar\" role=\"toolbar\" [attr.aria-label]=\"t.selected(selectedCount)\">\n <span class=\"su-table-toolbar-count\">{{ t.selected(selectedCount) }}</span>\n @if (current.editable && !current.draft) {\n <button type=\"button\" class=\"su-table-button\" (click)=\"editSelected()\">\n {{ t.editSelected(selectedCount) }}\n </button>\n }\n @for (action of current.bulkActions; track action.id) {\n <button type=\"button\" class=\"su-table-button\" [class.is-danger]=\"action.danger\" (click)=\"runBulkAction(action)\">\n {{ action.label }}\n </button>\n }\n <button type=\"button\" class=\"su-table-button is-quiet\" (click)=\"selectAll(false)\">{{ t.clearSelection }}</button>\n </div>\n}\n\n@if (bulkDraft(); as draft) {\n <form\n class=\"su-table-bulk\"\n [attr.aria-labelledby]=\"tableId + '-bulk-title'\"\n (submit)=\"save($event)\"\n (keydown.escape)=\"cancelEdit()\"\n >\n <h3 class=\"su-table-bulk-title\" [id]=\"tableId + '-bulk-title'\">{{ t.editing(draft.ids.length) }}</h3>\n <div class=\"su-table-bulk-fields\">\n @for (field of draft.fields; track field.key) {\n <div class=\"su-table-bulk-field\">\n <label class=\"su-table-label\" [for]=\"controlId('bulk', field.key)\">{{ field.header }}</label>\n <su-lib-table-field\n [field]=\"field\"\n [controlId]=\"controlId('bulk', field.key)\"\n [mixedLabel]=\"t.mixed\"\n (valueChange)=\"setDraft(field.key, $event)\"\n />\n </div>\n }\n </div>\n <div class=\"su-table-bulk-actions\">\n <button type=\"submit\" class=\"su-table-button is-primary\">{{ t.save }}</button>\n <button type=\"button\" class=\"su-table-button\" (click)=\"cancelEdit()\">{{ t.cancel }}</button>\n </div>\n </form>\n}\n\n<div\n class=\"su-table-scroll\"\n [class.is-scrolled-start]=\"scrolledFromStart()\"\n [class.has-more-end]=\"moreAtEnd()\"\n [class.is-scrolled-top]=\"scrolledFromTop()\"\n [class.has-pinned-rows]=\"current.pinnedRows.length > 0\"\n [style.max-height]=\"maxHeight()\"\n (scroll)=\"onScroll($event)\"\n>\n <table class=\"su-table-grid\" [class.is-dragging-rows]=\"drag() !== null\">\n <caption [class.su-table-visually-hidden]=\"!showCaption()\">{{ caption() }}</caption>\n <thead>\n <tr>\n @if (reorderable()) {\n <th scope=\"col\" class=\"su-table-handle-cell\" [suTablePin]=\"pins[0]\">\n <span class=\"su-table-visually-hidden\">{{ t.order }}</span>\n </th>\n }\n @if (selectable()) {\n <th scope=\"col\" class=\"su-table-select-cell\" [suTablePin]=\"pins[firstColumnSlot - 1]\">\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [checked]=\"current.selection === 'all'\"\n [indeterminate]=\"current.selection === 'some'\"\n [disabled]=\"current.rows.length === 0\"\n [attr.aria-label]=\"t.selectAll\"\n (change)=\"selectAll()\"\n />\n </th>\n }\n @for (column of current.columns; track column.key; let columnIndex = $index) {\n <th\n scope=\"col\"\n class=\"su-table-align-{{ column.align }}\"\n [class.is-sorted]=\"column.sort !== 'none'\"\n [suTablePin]=\"pins[firstColumnSlot + columnIndex]\"\n [attr.aria-sort]=\"column.sort === 'none' ? null : column.sort\"\n >\n @if (column.sortable) {\n <button type=\"button\" class=\"su-table-sort\" (click)=\"sortBy(column.key)\">\n {{ column.header }}\n <span class=\"su-table-sort-icon is-{{ column.sort }}\" aria-hidden=\"true\"></span>\n </button>\n } @else {\n {{ column.header }}\n }\n @if (column.pinnable) {\n <button\n type=\"button\"\n class=\"su-table-header-pin\"\n [attr.aria-label]=\"t.pinColumn(column.header)\"\n [attr.aria-pressed]=\"column.pinned !== null\"\n (click)=\"toggleColumnPin(column.key, column.pinned)\"\n >\n <svg suTablePinIcon width=\"12\" height=\"12\"></svg>\n </button>\n } @else if (pins[firstColumnSlot + columnIndex]) {\n <svg suTablePinIcon class=\"su-table-pinned-icon\" width=\"11\" height=\"11\"></svg>\n }\n </th>\n }\n @if (hasActions()) {\n <th scope=\"col\" class=\"su-table-actions-cell\" [suTablePin]=\"pins[pins.length - 1]\">{{ t.actions }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of bodyRows(); track row.id; let rowIndex = $index) {\n @let editing = inlineDraft()?.ids?.[0] === row.id;\n @let index = rowIndex - current.pinnedRows.length;\n <tr\n [attr.data-su-row]=\"row.pinned ? null : ''\"\n [class.is-pinned-row]=\"row.pinned\"\n [class.is-last-pinned-row]=\"index === -1\"\n [style.--su-table-row-top]=\"row.pinned ? pinnedRowTops()[rowIndex] + 'px' : null\"\n [class.is-selected]=\"row.selected\"\n [class.is-editing]=\"editing\"\n [class.is-grabbed]=\"current.grabbedId === row.id\"\n [class]=\"rowClassOf(row)\"\n [class.is-dragging]=\"drag()?.id === row.id\"\n [class.is-drop-before]=\"dropSide(index) === 'before'\"\n [class.is-drop-after]=\"dropSide(index) === 'after'\"\n [style.transform]=\"dragTransform(index)\"\n (keydown)=\"editing && onEditKey($event)\"\n >\n @if (reorderable()) {\n <td class=\"su-table-handle-cell\" [suTablePin]=\"pins[0]\">\n @if (!row.pinned && !current.searching) {\n <button\n type=\"button\"\n class=\"su-table-handle\"\n [attr.data-su-handle]=\"row.id\"\n [attr.aria-label]=\"t.moveRow(row.label)\"\n [attr.aria-pressed]=\"current.grabbedId === row.id\"\n (keydown)=\"onHandleKey($event, row.id)\"\n (pointerdown)=\"onHandleDown($event, row.id, index)\"\n (pointermove)=\"onHandleMove($event)\"\n (pointerup)=\"onHandleUp()\"\n (pointercancel)=\"onHandleCancel()\"\n >\n <span class=\"su-table-grip\" aria-hidden=\"true\"></span>\n </button>\n }\n </td>\n }\n @if (selectable()) {\n <td class=\"su-table-select-cell\" [suTablePin]=\"pins[firstColumnSlot - 1]\">\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [checked]=\"row.selected\"\n [attr.aria-label]=\"t.selectRow(row.label)\"\n (change)=\"select(row.id)\"\n />\n </td>\n }\n @for (cell of row.cells; track cell.key; let cellIndex = $index) {\n @let column = current.columns[cellIndex];\n @let pin = pins[firstColumnSlot + cellIndex];\n <td\n class=\"su-table-align-{{ column.align }}\"\n [attr.role]=\"cell.key === current.rowHeaderKey ? 'rowheader' : null\"\n [class.su-table-row-header]=\"cell.key === current.rowHeaderKey\"\n [class.is-sorted]=\"column.sort !== 'none'\"\n [class.is-editable]=\"!editing && editsOnDoubleClick(cell.key)\"\n [suTablePin]=\"pin\"\n (mousedown)=\"keepTextUnselected($event, cell.key)\"\n (dblclick)=\"editCell(row, cell.key)\"\n >\n @if (editing && inlineField(cell.key); as field) {\n <su-lib-table-field\n [field]=\"field\"\n [controlId]=\"controlId(row.id, cell.key)\"\n [ariaLabel]=\"column.header\"\n [mixedLabel]=\"t.mixed\"\n (valueChange)=\"setDraft(cell.key, $event)\"\n />\n } @else {\n @if (cellTemplate(cell.key); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: row.data, text: cell.text }\" />\n } @else {\n {{ cell.text }}\n }\n }\n </td>\n }\n @if (hasActions()) {\n <td class=\"su-table-actions-cell\" [suTablePin]=\"pins[pins.length - 1]\">\n <div class=\"su-table-actions\">\n @if (editing) {\n <button type=\"button\" class=\"su-table-button is-primary\" (click)=\"save()\">{{ t.save }}</button>\n <button type=\"button\" class=\"su-table-button\" (click)=\"cancelEdit()\">{{ t.cancel }}</button>\n } @else {\n @if (rowPinning()) {\n <button\n type=\"button\"\n class=\"su-table-button su-table-pin-button\"\n [attr.aria-pressed]=\"row.pinned\"\n [attr.aria-label]=\"t.pinRow + ', ' + row.label\"\n (click)=\"pinRow(row.id)\"\n >\n <svg suTablePinIcon width=\"12\" height=\"12\"></svg>\n {{ t.pinRow }}\n </button>\n }\n @for (action of row.actions; track action.id) {\n <button\n type=\"button\"\n class=\"su-table-button\"\n [class.is-danger]=\"action.danger\"\n [disabled]=\"action.disabled\"\n [attr.aria-label]=\"action.label + ', ' + row.label\"\n (click)=\"runAction(action, row)\"\n >\n {{ action.label }}\n </button>\n }\n }\n </div>\n </td>\n }\n </tr>\n }\n @if (current.rows.length === 0) {\n <tr>\n <td class=\"su-table-empty\" [attr.colspan]=\"columnCount()\">\n {{ current.searching ? t.noMatches(current.query) : t.empty }}\n </td>\n </tr>\n }\n </tbody>\n </table>\n</div>\n\n@if (current.pagination.pageSizes.length > 0 || current.pagination.pageSize !== 'all') {\n <su-lib-table-paginator\n [pagination]=\"current.pagination\"\n [labels]=\"t\"\n [controlId]=\"tableId + '-page-size'\"\n (pageChange)=\"setPage($event)\"\n (pageSizeChange)=\"setPageSize($event)\"\n />\n}\n\n<div class=\"su-table-visually-hidden\" role=\"status\">{{ current.announcement }}</div>\n", styles: [":host{color:var(--su-table-text-color, inherit);display:block;min-width:0;font-family:var(--su-table-font-family, inherit);font-size:var(--su-table-font-size, .95rem)}.su-table-scroll{border:var(--su-table-border, 1px solid rgba(0, 0, 0, .12));border-radius:var(--su-table-radius, 10px);overflow:auto}.su-table-grid{background:var(--su-table-background, transparent);border-collapse:separate;border-spacing:0;min-width:100%}caption{caption-side:top;color:var(--su-table-caption-color, inherit);font-size:var(--su-table-caption-font-size, inherit);font-weight:600;padding:var(--su-table-cell-padding, .6rem .75rem);text-align:start}th,td{background-image:linear-gradient(var(--su-table-cell-tint, transparent),var(--su-table-cell-tint, transparent));border-bottom:var(--su-table-row-border, 1px solid rgba(0, 0, 0, .08));padding:var(--su-table-cell-padding, .6rem .75rem);text-align:start;vertical-align:var(--su-table-cell-vertical-align, middle)}thead th{--su-table-row-tint: var(--su-table-header-background, rgb(0 0 0 / .03));border-bottom:var(--su-table-header-border, var(--su-table-row-border, 1px solid rgba(0, 0, 0, .08)));color:var(--su-table-header-color, inherit);font-size:var(--su-table-header-font-size, inherit);font-weight:var(--su-table-header-font-weight, 600);letter-spacing:var(--su-table-header-letter-spacing, normal);padding:var(--su-table-header-padding, var(--su-table-cell-padding, .6rem .75rem));text-transform:var(--su-table-header-text-transform, none);white-space:nowrap}.is-sorted{--su-table-cell-tint: var(--su-table-sorted-background, transparent)}td.is-editable:hover,th.is-editable:hover{--su-table-cell-tint: var(--su-table-editable-hover-background, color-mix(in srgb, currentColor 6%, transparent))}.su-table-row-header{font-weight:var(--su-table-row-header-weight, 600)}tbody tr:last-child>*{border-bottom:none}tbody tr{--su-table-row-tint: var(--su-table-row-background, transparent);background:var(--su-table-row-tint);color:var(--su-table-row-color, inherit)}tbody tr:nth-child(2n){--su-table-row-tint: var(--su-table-stripe-background, var(--su-table-row-background, transparent))}tbody tr.is-muted{--su-table-row-tint: var(--su-table-muted-background, transparent);color:color-mix(in srgb,currentColor var(--su-table-muted-text, 55%),transparent)}tbody tr.is-highlighted{--su-table-row-tint: var(--su-table-highlight-background, color-mix(in srgb, #f59e0b 14%, transparent))}tbody tr:hover{--su-table-row-tint: var(--su-table-hover-background, rgb(0 0 0 / .025))}tbody tr.is-selected{--su-table-row-tint: var(--su-table-selected-background, color-mix(in srgb, #2563eb 8%, transparent));color:var(--su-table-selected-color, inherit)}tbody tr.is-editing{--su-table-row-tint: var(--su-table-editing-background, color-mix(in srgb, #2563eb 5%, transparent))}tbody tr.is-pinned-row{--su-table-row-tint: var(--su-table-pinned-row-background, color-mix(in srgb, #2563eb 6%, transparent))}tbody tr.is-last-pinned-row>*{border-bottom:var(--su-table-pinned-row-border, 2px solid color-mix(in srgb, #2563eb 40%, transparent))}tbody tr.is-grabbed,tbody tr.is-dragging{--su-table-row-tint: var(--su-table-grabbed-background, color-mix(in srgb, #2563eb 14%, transparent));outline:var(--su-table-grabbed-outline, 2px solid color-mix(in srgb, #2563eb 60%, transparent));outline-offset:-2px}tbody tr.is-dragging{background:linear-gradient(var(--su-table-row-tint),var(--su-table-row-tint)),var(--su-table-dragging-background, Canvas);box-shadow:var(--su-table-dragging-shadow, 0 8px 24px rgba(0, 0, 0, .18));cursor:grabbing;position:relative;z-index:3}tbody tr.is-drop-before>*{box-shadow:inset 0 var(--su-table-drop-line-width, 2px) 0 var(--su-table-drop-line-color, #2563eb)}tbody tr.is-drop-after>*{box-shadow:inset 0 calc(-1 * var(--su-table-drop-line-width, 2px)) 0 var(--su-table-drop-line-color, #2563eb)}thead th,tbody tr.is-pinned-row>*,.is-pinned-start,.is-pinned-end{background:linear-gradient(var(--su-table-cell-tint, transparent),var(--su-table-cell-tint, transparent)),linear-gradient(var(--su-table-row-tint, transparent),var(--su-table-row-tint, transparent)),var(--su-table-pinned-background, Canvas);position:sticky;z-index:1}thead th{top:0;z-index:4}thead th.is-pinned-start,thead th.is-pinned-end{z-index:5}tbody tr.is-pinned-row>*{top:var(--su-table-row-top, 0);z-index:2}tbody tr.is-pinned-row>*.is-pinned-start,tbody tr.is-pinned-row>*.is-pinned-end{z-index:3}.is-scrolled-top:not(.has-pinned-rows) thead th,.is-scrolled-top tr.is-last-pinned-row>*{box-shadow:var(--su-table-sticky-shadow, 0 6px 8px -6px rgba(0, 0, 0, .25))}.is-pinned-edge:after{content:\"\";inset-block:0;opacity:0;pointer-events:none;position:absolute;transition:opacity .15s ease-out;width:1rem}.is-pinned-start.is-pinned-edge{border-inline-end:var(--su-table-pinned-border, 1px solid rgba(0, 0, 0, .14))}.is-pinned-end.is-pinned-edge{border-inline-start:var(--su-table-pinned-border, 1px solid rgba(0, 0, 0, .14))}.su-table-pinned-icon{margin-inline-start:.35rem;opacity:.45;vertical-align:-1px}.su-table-header-pin{background:none;border:none;border-radius:4px;color:inherit;cursor:pointer;margin-inline-start:.2rem;opacity:.3;padding:.2rem;vertical-align:middle}.su-table-header-pin:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-header-pin:hover{opacity:.7}.su-table-header-pin[aria-pressed=true]{color:var(--su-table-accent, #2563eb);opacity:1}.is-pinned-start.is-pinned-edge:after{background:linear-gradient(to right,var(--su-table-pinned-shadow, rgba(0, 0, 0, .22)),transparent);inset-inline-start:100%}.is-pinned-end.is-pinned-edge:after{background:linear-gradient(to left,var(--su-table-pinned-shadow, rgba(0, 0, 0, .22)),transparent);inset-inline-end:100%}.is-scrolled-start .is-pinned-start.is-pinned-edge:after,.has-more-end .is-pinned-end.is-pinned-edge:after{opacity:1}@media(prefers-reduced-motion:no-preference){.is-dragging-rows tbody tr:not(.is-dragging){transition:transform .15s ease-out}}td.is-editable,th.is-editable{cursor:text}.su-table-align-start{text-align:start}.su-table-align-center{text-align:center}.su-table-align-end{text-align:end}.su-table-handle-cell,.su-table-select-cell{text-align:center;width:1%}.su-table-actions-cell{text-align:end;width:1%}.su-table-actions{display:flex;gap:.35rem;justify-content:flex-end}.su-table-sort{align-items:center;background:none;border:none;border-radius:4px;color:inherit;cursor:pointer;display:inline-flex;font:inherit;letter-spacing:inherit;text-transform:inherit;gap:.35rem;margin:-.2rem -.35rem;padding:.2rem .35rem}.su-table-sort-icon{border-left:.3rem solid transparent;border-right:.3rem solid transparent;height:0;opacity:.35;width:0}.su-table-sort-icon.is-none,.su-table-sort-icon.is-ascending{border-bottom:.4rem solid currentColor}.su-table-sort-icon.is-descending{border-top:.4rem solid currentColor}.su-table-sort-icon.is-ascending,.su-table-sort-icon.is-descending{opacity:1}.su-table-handle{background:none;border:none;border-radius:4px;color:var(--su-table-handle-color, inherit);cursor:grab;display:inline-flex;padding:.35rem .3rem;touch-action:none}.su-table-handle:active{cursor:grabbing}.su-table-grip{background-image:radial-gradient(currentColor 1.2px,transparent 1.4px);background-size:6px 6px;display:block;height:18px;opacity:.6;width:12px}.su-table-button{background:var(--su-table-button-background, transparent);border:var(--su-table-button-border, 1px solid rgba(0, 0, 0, .2));border-radius:var(--su-table-button-radius, 6px);color:var(--su-table-button-color, inherit);cursor:pointer;font:inherit;font-size:.875em;padding:var(--su-table-button-padding, .3rem .7rem);white-space:nowrap}.su-table-button:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-button:disabled{cursor:not-allowed;opacity:.45}.su-table-button.is-primary{background:var(--su-table-primary-background, #111);border-color:transparent;color:var(--su-table-primary-color, #fff)}.su-table-button.is-danger{border-color:var(--su-table-danger-border, color-mix(in srgb, #b42318 35%, transparent));color:var(--su-table-danger-color, #b42318)}.su-table-button.is-quiet{border-color:transparent}.su-table-button.su-table-pin-button{align-items:center;display:inline-flex;gap:.3rem}.su-table-button.su-table-pin-button svg{opacity:.5}.su-table-button.su-table-pin-button[aria-pressed=true]{border-color:var(--su-table-accent, #2563eb);color:var(--su-table-accent, #2563eb)}.su-table-button.su-table-pin-button[aria-pressed=true] svg{opacity:1}.su-table-sort:focus-visible,.su-table-handle:focus-visible,.su-table-checkbox:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-checkbox{accent-color:var(--su-table-accent, #2563eb);height:var(--su-table-checkbox-size, 1rem);margin:0;width:var(--su-table-checkbox-size, 1rem)}.su-table-toolbar,.su-table-bulk{background:var(--su-table-panel-background, rgba(0, 0, 0, .03));border-radius:var(--su-table-radius, 10px);margin-bottom:.75rem;padding:.6rem .75rem}.su-table-toolbar{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem}.su-table-toolbar-count{font-weight:600;margin-right:auto}.su-table-bulk-title{font-size:1rem;margin:0 0 .75rem}.su-table-bulk-fields{display:grid;gap:.75rem;grid-template-columns:repeat(auto-fill,minmax(12rem,1fr))}.su-table-bulk-field{display:flex;flex-direction:column;gap:.3rem}.su-table-label{font-size:.85em;font-weight:600}.su-table-bulk-actions{display:flex;gap:.5rem;margin-top:.75rem}.su-table-empty{opacity:.7;padding:1.5rem;text-align:center}.su-table-visually-hidden{clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}@media(prefers-reduced-motion:no-preference){tbody tr{transition:background-color .12s ease-out}}\n"] }]
|
|
703
|
+
], host: { class: 'su-table' }, template: "@let current = state();\n@let t = text();\n@let selectedCount = current.selectedIds.length;\n@let pins = placements();\n@let firstColumnSlot = columnSlot();\n@if (searchable() || columnControls()) {\n <su-lib-table-toolbar\n [labels]=\"t\"\n [controlId]=\"tableId\"\n [searchable]=\"searchable()\"\n [query]=\"current.query\"\n [columnControls]=\"columnControls()\"\n [columns]=\"current.allColumns\"\n (queryChange)=\"search($event)\"\n (pinnableChange)=\"setColumnPinnable($event)\"\n (visibilityChange)=\"setColumnVisible($event)\"\n (allVisibilityChange)=\"setColumnsVisible($event)\"\n />\n}\n@if (selectable() && selectedCount > 0) {\n <div class=\"su-table-toolbar\" role=\"toolbar\" [attr.aria-label]=\"t.selected(selectedCount)\">\n <span class=\"su-table-toolbar-count\">{{ t.selected(selectedCount) }}</span>\n @if (current.editable && !current.draft) {\n <button type=\"button\" class=\"su-table-button\" (click)=\"editSelected()\">\n {{ t.editSelected(selectedCount) }}\n </button>\n }\n @for (action of current.bulkActions; track action.id) {\n <button type=\"button\" class=\"su-table-button\" [class.is-danger]=\"action.danger\" (click)=\"runBulkAction(action)\">\n {{ action.label }}\n </button>\n }\n <button type=\"button\" class=\"su-table-button is-quiet\" (click)=\"selectAll(false)\">{{ t.clearSelection }}</button>\n </div>\n}\n\n@if (bulkDraft(); as draft) {\n <form\n class=\"su-table-bulk\"\n [attr.aria-labelledby]=\"tableId + '-bulk-title'\"\n (submit)=\"save($event)\"\n (keydown.escape)=\"cancelEdit()\"\n >\n <h3 class=\"su-table-bulk-title\" [id]=\"tableId + '-bulk-title'\">{{ t.editing(draft.ids.length) }}</h3>\n <div class=\"su-table-bulk-fields\">\n @for (field of draft.fields; track field.key) {\n <div class=\"su-table-bulk-field\">\n <label class=\"su-table-label\" [for]=\"controlId('bulk', field.key)\">{{ field.header }}</label>\n <su-lib-table-field\n [field]=\"field\"\n [controlId]=\"controlId('bulk', field.key)\"\n [mixedLabel]=\"t.mixed\"\n (valueChange)=\"setDraft(field.key, $event)\"\n />\n </div>\n }\n </div>\n <div class=\"su-table-bulk-actions\">\n <button type=\"submit\" class=\"su-table-button is-primary\">{{ t.save }}</button>\n <button type=\"button\" class=\"su-table-button\" (click)=\"cancelEdit()\">{{ t.cancel }}</button>\n </div>\n </form>\n}\n\n<div\n class=\"su-table-scroll\"\n [class.is-scrolled-start]=\"scrolledFromStart()\"\n [class.has-more-end]=\"moreAtEnd()\"\n [class.is-scrolled-top]=\"scrolledFromTop()\"\n [class.has-pinned-rows]=\"current.pinnedRows.length > 0\"\n [style.max-height]=\"maxHeight()\"\n (scroll)=\"onScroll($event)\"\n>\n <table class=\"su-table-grid\" [class.is-dragging-rows]=\"drag() !== null\">\n <caption [class.su-table-visually-hidden]=\"!showCaption()\">{{ caption() }}</caption>\n <thead>\n <tr>\n @if (reorderable()) {\n <th scope=\"col\" class=\"su-table-handle-cell\" [suTablePin]=\"pins[0]\">\n <span class=\"su-table-visually-hidden\">{{ t.order }}</span>\n </th>\n }\n @if (selectable()) {\n <th scope=\"col\" class=\"su-table-select-cell\" [suTablePin]=\"pins[firstColumnSlot - 1]\">\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [checked]=\"current.selection === 'all'\"\n [indeterminate]=\"current.selection === 'some'\"\n [disabled]=\"current.rows.length === 0\"\n [attr.aria-label]=\"t.selectAll\"\n (change)=\"selectAll()\"\n />\n </th>\n }\n @for (column of current.columns; track column.key; let columnIndex = $index) {\n <th\n scope=\"col\"\n class=\"su-table-align-{{ column.align }}\"\n [class.is-sorted]=\"column.sort !== 'none'\"\n [suTablePin]=\"pins[firstColumnSlot + columnIndex]\"\n [attr.aria-sort]=\"column.sort === 'none' ? null : column.sort\"\n >\n @if (column.sortable) {\n <button type=\"button\" class=\"su-table-sort\" (click)=\"sortBy(column.key)\">\n {{ column.header }}\n <span class=\"su-table-sort-icon is-{{ column.sort }}\" aria-hidden=\"true\"></span>\n </button>\n } @else {\n {{ column.header }}\n }\n @if (column.pinnable) {\n <button\n type=\"button\"\n class=\"su-table-header-pin\"\n [attr.aria-label]=\"t.pinColumn(column.header)\"\n [attr.aria-pressed]=\"column.pinned !== null\"\n (click)=\"toggleColumnPin(column.key, column.pinned)\"\n >\n <svg suTablePinIcon width=\"12\" height=\"12\"></svg>\n </button>\n } @else if (pins[firstColumnSlot + columnIndex]) {\n <svg suTablePinIcon class=\"su-table-pinned-icon\" width=\"11\" height=\"11\"></svg>\n }\n </th>\n }\n @if (hasActions()) {\n <th scope=\"col\" class=\"su-table-actions-cell\" [suTablePin]=\"pins[pins.length - 1]\">{{ t.actions }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of bodyRows(); track row.id; let rowIndex = $index) {\n @let editing = inlineDraft()?.ids?.[0] === row.id;\n @let index = rowIndex - current.pinnedRows.length;\n <tr\n [attr.data-su-row]=\"row.pinned ? null : ''\"\n [class.is-pinned-row]=\"row.pinned\"\n [class.is-last-pinned-row]=\"index === -1\"\n [style.--su-table-row-top]=\"row.pinned ? pinnedRowTops()[rowIndex] + 'px' : null\"\n [class.is-selected]=\"row.selected\"\n [class.is-editing]=\"editing\"\n [class.is-grabbed]=\"current.grabbedId === row.id\"\n [class]=\"rowClassOf(row)\"\n [class.is-dragging]=\"drag()?.id === row.id\"\n [class.is-drop-before]=\"dropSide(index) === 'before'\"\n [class.is-drop-after]=\"dropSide(index) === 'after'\"\n [style.transform]=\"dragTransform(index)\"\n (keydown)=\"editing && onEditKey($event)\"\n >\n @if (reorderable()) {\n <td class=\"su-table-handle-cell\" [suTablePin]=\"pins[0]\">\n @if (!row.pinned && !current.searching) {\n <button\n type=\"button\"\n class=\"su-table-handle\"\n [attr.data-su-handle]=\"row.id\"\n [attr.aria-label]=\"t.moveRow(row.label)\"\n [attr.aria-pressed]=\"current.grabbedId === row.id\"\n (keydown)=\"onHandleKey($event, row.id)\"\n (pointerdown)=\"onHandleDown($event, row.id, index)\"\n (pointermove)=\"onHandleMove($event)\"\n (pointerup)=\"onHandleUp()\"\n (pointercancel)=\"onHandleCancel()\"\n >\n <span class=\"su-table-grip\" aria-hidden=\"true\"></span>\n </button>\n }\n </td>\n }\n @if (selectable()) {\n <td class=\"su-table-select-cell\" [suTablePin]=\"pins[firstColumnSlot - 1]\">\n <input\n type=\"checkbox\"\n class=\"su-table-checkbox\"\n [checked]=\"row.selected\"\n [attr.aria-label]=\"t.selectRow(row.label)\"\n (change)=\"select(row.id)\"\n />\n </td>\n }\n @for (cell of row.cells; track cell.key; let cellIndex = $index) {\n @let column = current.columns[cellIndex];\n @let pin = pins[firstColumnSlot + cellIndex];\n <td\n class=\"su-table-align-{{ column.align }}\"\n [attr.role]=\"cell.key === current.rowHeaderKey ? 'rowheader' : null\"\n [class.su-table-row-header]=\"cell.key === current.rowHeaderKey\"\n [class.is-sorted]=\"column.sort !== 'none'\"\n [class.is-editable]=\"!editing && editsOnDoubleClick(cell.key)\"\n [suTablePin]=\"pin\"\n (mousedown)=\"keepTextUnselected($event, cell.key)\"\n (dblclick)=\"editCell(row, cell.key)\"\n >\n @if (editing && inlineField(cell.key); as field) {\n <su-lib-table-field\n [field]=\"field\"\n [controlId]=\"controlId(row.id, cell.key)\"\n [ariaLabel]=\"column.header\"\n [mixedLabel]=\"t.mixed\"\n (valueChange)=\"setDraft(cell.key, $event)\"\n />\n } @else {\n @if (cellTemplate(cell.key); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: { $implicit: row.data, text: cell.text }\" />\n } @else {\n {{ cell.text }}\n }\n }\n </td>\n }\n @if (hasActions()) {\n <td class=\"su-table-actions-cell\" [suTablePin]=\"pins[pins.length - 1]\">\n <div class=\"su-table-actions\">\n @if (editing) {\n <button type=\"button\" class=\"su-table-button is-primary\" (click)=\"save()\">{{ t.save }}</button>\n <button type=\"button\" class=\"su-table-button\" (click)=\"cancelEdit()\">{{ t.cancel }}</button>\n } @else {\n @if (rowPinning()) {\n <button\n type=\"button\"\n class=\"su-table-button su-table-pin-button\"\n [attr.aria-pressed]=\"row.pinned\"\n [attr.aria-label]=\"t.pinRow + ', ' + row.label\"\n (click)=\"pinRow(row.id)\"\n >\n <svg suTablePinIcon width=\"12\" height=\"12\"></svg>\n {{ t.pinRow }}\n </button>\n }\n @for (action of row.actions; track action.id) {\n <button\n type=\"button\"\n class=\"su-table-button\"\n [class.is-danger]=\"action.danger\"\n [disabled]=\"action.disabled\"\n [attr.aria-label]=\"action.label + ', ' + row.label\"\n (click)=\"runAction(action, row)\"\n >\n {{ action.label }}\n </button>\n }\n }\n </div>\n </td>\n }\n </tr>\n }\n @if (current.rows.length === 0) {\n <tr>\n <td class=\"su-table-empty\" [attr.colspan]=\"columnCount()\">\n {{ current.searching ? t.noMatches(current.query) : t.empty }}\n </td>\n </tr>\n }\n </tbody>\n </table>\n</div>\n\n@if (current.pagination.pageSizes.length > 0 || current.pagination.pageSize !== 'all') {\n <su-lib-table-paginator\n [pagination]=\"current.pagination\"\n [labels]=\"t\"\n [controlId]=\"tableId + '-page-size'\"\n (pageChange)=\"setPage($event)\"\n (pageSizeChange)=\"setPageSize($event)\"\n />\n}\n\n<div class=\"su-table-visually-hidden\" role=\"status\">{{ current.announcement }}</div>\n", styles: [":host{color:var(--su-table-text-color, inherit);display:block;min-width:0;font-family:var(--su-table-font-family, inherit);font-size:var(--su-table-font-size, .95rem)}.su-table-scroll{border:var(--su-table-border, 1px solid rgba(0, 0, 0, .12));border-radius:var(--su-table-radius, 10px);overflow:auto}.su-table-grid{background:var(--su-table-background, transparent);border-collapse:separate;border-spacing:0;min-width:100%}caption{caption-side:top;color:var(--su-table-caption-color, inherit);font-size:var(--su-table-caption-font-size, inherit);font-weight:600;padding:var(--su-table-cell-padding, .6rem .75rem);text-align:start}th,td{background-image:linear-gradient(var(--su-table-cell-tint, transparent),var(--su-table-cell-tint, transparent));border-bottom:var(--su-table-row-border, 1px solid rgba(0, 0, 0, .08));padding:var(--su-table-cell-padding, .6rem .75rem);text-align:start;vertical-align:var(--su-table-cell-vertical-align, middle)}thead th{--su-table-row-tint: var(--su-table-header-background, rgb(0 0 0 / .03));border-bottom:var(--su-table-header-border, var(--su-table-row-border, 1px solid rgba(0, 0, 0, .08)));color:var(--su-table-header-color, inherit);font-size:var(--su-table-header-font-size, inherit);font-weight:var(--su-table-header-font-weight, 600);letter-spacing:var(--su-table-header-letter-spacing, normal);padding:var(--su-table-header-padding, var(--su-table-cell-padding, .6rem .75rem));text-transform:var(--su-table-header-text-transform, none);white-space:nowrap}.is-sorted{--su-table-cell-tint: var(--su-table-sorted-background, transparent)}td.is-editable:hover,th.is-editable:hover{--su-table-cell-tint: var(--su-table-editable-hover-background, color-mix(in srgb, currentColor 6%, transparent))}.su-table-row-header{font-weight:var(--su-table-row-header-weight, 600)}tbody tr:last-child>*{border-bottom:none}tbody tr{--su-table-row-tint: var(--su-table-row-background, transparent);background:var(--su-table-row-tint);color:var(--su-table-row-color, inherit)}tbody tr:nth-child(2n){--su-table-row-tint: var(--su-table-stripe-background, var(--su-table-row-background, transparent))}tbody tr.is-muted{--su-table-row-tint: var(--su-table-muted-background, transparent);color:color-mix(in srgb,currentColor var(--su-table-muted-text, 55%),transparent)}tbody tr.is-highlighted{--su-table-row-tint: var(--su-table-highlight-background, color-mix(in srgb, #f59e0b 14%, transparent))}tbody tr:hover{--su-table-row-tint: var(--su-table-hover-background, rgb(0 0 0 / .025))}tbody tr.is-selected{--su-table-row-tint: var(--su-table-selected-background, color-mix(in srgb, #2563eb 8%, transparent));color:var(--su-table-selected-color, inherit)}tbody tr.is-editing{--su-table-row-tint: var(--su-table-editing-background, color-mix(in srgb, #2563eb 5%, transparent))}tbody tr.is-pinned-row{--su-table-row-tint: var(--su-table-pinned-row-background, color-mix(in srgb, #2563eb 6%, transparent))}tbody tr.is-last-pinned-row>*{border-bottom:var(--su-table-pinned-row-border, 2px solid color-mix(in srgb, #2563eb 40%, transparent))}tbody tr.is-grabbed,tbody tr.is-dragging{--su-table-row-tint: var(--su-table-grabbed-background, color-mix(in srgb, #2563eb 14%, transparent));outline:var(--su-table-grabbed-outline, 2px solid color-mix(in srgb, #2563eb 60%, transparent));outline-offset:-2px}tbody tr.is-dragging{background:linear-gradient(var(--su-table-row-tint),var(--su-table-row-tint)),var(--su-table-dragging-background, Canvas);box-shadow:var(--su-table-dragging-shadow, 0 8px 24px rgba(0, 0, 0, .18));cursor:grabbing;position:relative;z-index:3}tbody tr.is-drop-before>*{box-shadow:inset 0 var(--su-table-drop-line-width, 2px) 0 var(--su-table-drop-line-color, #2563eb)}tbody tr.is-drop-after>*{box-shadow:inset 0 calc(-1 * var(--su-table-drop-line-width, 2px)) 0 var(--su-table-drop-line-color, #2563eb)}thead th,tbody tr.is-pinned-row>*,.is-pinned-start,.is-pinned-end{background:linear-gradient(var(--su-table-cell-tint, transparent),var(--su-table-cell-tint, transparent)),linear-gradient(var(--su-table-row-tint, transparent),var(--su-table-row-tint, transparent)),var(--su-table-pinned-background, Canvas);position:sticky;z-index:1}thead th{top:0;z-index:4}thead th.is-pinned-start,thead th.is-pinned-end{z-index:5}tbody tr.is-pinned-row>*{top:var(--su-table-row-top, 0);z-index:2}tbody tr.is-pinned-row>*.is-pinned-start,tbody tr.is-pinned-row>*.is-pinned-end{z-index:3}.is-scrolled-top:not(.has-pinned-rows) thead th,.is-scrolled-top tr.is-last-pinned-row>*{box-shadow:var(--su-table-sticky-shadow, 0 6px 8px -6px rgba(0, 0, 0, .25))}.is-pinned-edge:after{content:\"\";inset-block:0;opacity:0;pointer-events:none;position:absolute;transition:opacity .15s ease-out;width:1rem}.is-pinned-start.is-pinned-edge{border-inline-end:var(--su-table-pinned-border, 1px solid rgba(0, 0, 0, .14))}.is-pinned-end.is-pinned-edge{border-inline-start:var(--su-table-pinned-border, 1px solid rgba(0, 0, 0, .14))}.su-table-pinned-icon{margin-inline-start:.35rem;opacity:.45;vertical-align:-1px}.su-table-header-pin:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-header-pin{background:none;border:none;border-radius:4px;color:inherit;cursor:pointer;margin-inline-start:.2rem;opacity:.3;padding:.2rem;vertical-align:middle}.su-table-header-pin:hover{opacity:.7}.su-table-header-pin[aria-pressed=true]{color:var(--su-table-accent, #2563eb);opacity:1}.is-pinned-start.is-pinned-edge:after{background:linear-gradient(to right,var(--su-table-pinned-shadow, rgba(0, 0, 0, .22)),transparent);inset-inline-start:100%}.is-pinned-end.is-pinned-edge:after{background:linear-gradient(to left,var(--su-table-pinned-shadow, rgba(0, 0, 0, .22)),transparent);inset-inline-end:100%}.is-scrolled-start .is-pinned-start.is-pinned-edge:after,.has-more-end .is-pinned-end.is-pinned-edge:after{opacity:1}@media(prefers-reduced-motion:no-preference){.is-dragging-rows tbody tr:not(.is-dragging){transition:transform .15s ease-out}}td.is-editable,th.is-editable{cursor:text}.su-table-align-start{text-align:start}.su-table-align-center{text-align:center}.su-table-align-end{text-align:end}.su-table-handle-cell,.su-table-select-cell{text-align:center;width:1%}.su-table-actions-cell{text-align:end;width:1%}.su-table-actions{display:flex;gap:.35rem;justify-content:flex-end}.su-table-sort{align-items:center;background:none;border:none;border-radius:4px;color:inherit;cursor:pointer;display:inline-flex;font:inherit;letter-spacing:inherit;text-transform:inherit;gap:.35rem;margin:-.2rem -.35rem;padding:.2rem .35rem}.su-table-sort-icon{border-left:.3rem solid transparent;border-right:.3rem solid transparent;height:0;opacity:.35;width:0}.su-table-sort-icon.is-none,.su-table-sort-icon.is-ascending{border-bottom:.4rem solid currentColor}.su-table-sort-icon.is-descending{border-top:.4rem solid currentColor}.su-table-sort-icon.is-ascending,.su-table-sort-icon.is-descending{opacity:1}.su-table-handle{background:none;border:none;border-radius:4px;color:var(--su-table-handle-color, inherit);cursor:grab;display:inline-flex;padding:.35rem .3rem;touch-action:none}.su-table-handle:active{cursor:grabbing}.su-table-grip{background-image:radial-gradient(currentColor 1.2px,transparent 1.4px);background-size:6px 6px;display:block;height:18px;opacity:.6;width:12px}.su-table-button{background:var(--su-table-button-background, transparent);border:var(--su-table-button-border, 1px solid rgba(0, 0, 0, .2));border-radius:var(--su-table-button-radius, 6px);color:var(--su-table-button-color, inherit);cursor:pointer;font:inherit;font-size:.875em;padding:var(--su-table-button-padding, .3rem .7rem);white-space:nowrap}.su-table-button:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-button:disabled{cursor:not-allowed;opacity:.45}.su-table-button.is-primary{background:var(--su-table-primary-background, #111);border-color:transparent;color:var(--su-table-primary-color, #fff)}.su-table-button.is-danger{border-color:var(--su-table-danger-border, color-mix(in srgb, #b42318 35%, transparent));color:var(--su-table-danger-color, #b42318)}.su-table-button.is-quiet{border-color:transparent}.su-table-button.su-table-pin-button{align-items:center;display:inline-flex;gap:.3rem}.su-table-button.su-table-pin-button svg{opacity:.5}.su-table-button.su-table-pin-button[aria-pressed=true]{border-color:var(--su-table-accent, #2563eb);color:var(--su-table-accent, #2563eb)}.su-table-button.su-table-pin-button[aria-pressed=true] svg{opacity:1}.su-table-sort:focus-visible,.su-table-handle:focus-visible,.su-table-checkbox:focus-visible{outline:var(--su-table-focus-outline, 2px solid currentColor);outline-offset:2px}.su-table-checkbox{accent-color:var(--su-table-accent, #2563eb);height:var(--su-table-checkbox-size, 1rem);margin:0;width:var(--su-table-checkbox-size, 1rem)}.su-table-toolbar,.su-table-bulk{background:var(--su-table-panel-background, rgba(0, 0, 0, .03));border-radius:var(--su-table-radius, 10px);margin-bottom:.75rem;padding:.6rem .75rem}.su-table-toolbar{align-items:center;display:flex;flex-wrap:wrap;gap:.5rem}.su-table-toolbar-count{font-weight:600;margin-right:auto}.su-table-bulk-title{font-size:1rem;margin:0 0 .75rem}.su-table-bulk-fields{display:grid;gap:.75rem;grid-template-columns:repeat(auto-fill,minmax(12rem,1fr))}.su-table-bulk-field{display:flex;flex-direction:column;gap:.3rem}.su-table-label{font-size:.85em;font-weight:600}.su-table-bulk-actions{display:flex;gap:.5rem;margin-top:.75rem}.su-table-empty{opacity:.7;padding:1.5rem;text-align:center}.su-table-visually-hidden{clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}@media(prefers-reduced-motion:no-preference){tbody tr{transition:background-color .12s ease-out}}\n"] }]
|
|
688
704
|
}], ctorParameters: () => [], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: true }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: true }] }], caption: [{ type: i0.Input, args: [{ isSignal: true, alias: "caption", required: true }] }], showCaption: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCaption", required: false }] }], rowId: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowId", required: false }] }], actions: [{ type: i0.Input, args: [{ isSignal: true, alias: "actions", required: false }] }], selectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectable", required: false }] }], reorderable: [{ type: i0.Input, args: [{ isSignal: true, alias: "reorderable", required: false }] }], columnControls: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnControls", required: false }] }], searchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchable", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], rowClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowClass", required: false }] }], editOnDoubleClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "editOnDoubleClick", required: false }] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }], pageSizes: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSizes", required: false }] }], rowPinning: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowPinning", required: false }] }], pinnedRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinnedRows", required: false }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }], edited: [{ type: i0.Output, args: ["edited"] }], reordered: [{ type: i0.Output, args: ["reordered"] }], action: [{ type: i0.Output, args: ["action"] }], sortChange: [{ type: i0.Output, args: ["sortChange"] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], searchChange: [{ type: i0.Output, args: ["searchChange"] }], pinnedRowsChange: [{ type: i0.Output, args: ["pinnedRowsChange"] }], columnsChange: [{ type: i0.Output, args: ["columnsChange"] }], pageChange: [{ type: i0.Output, args: ["pageChange"] }], cellTemplates: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SuTableCellDirective), { isSignal: true }] }] } });
|
|
689
705
|
|
|
690
706
|
/**
|