ngwr 16.3.0 → 16.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/carousel/styles/_index.scss +53 -1
- package/fesm2022/ngwr-breadcrumbs.mjs +2 -2
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-carousel-testing.mjs +24 -1
- package/fesm2022/ngwr-carousel-testing.mjs.map +1 -1
- package/fesm2022/ngwr-carousel.mjs +67 -4
- package/fesm2022/ngwr-carousel.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +10 -23
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +16 -1
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +18 -4
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +7 -3
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-graph-testing.mjs +27 -0
- package/fesm2022/ngwr-graph-testing.mjs.map +1 -1
- package/fesm2022/ngwr-graph.mjs +568 -7
- package/fesm2022/ngwr-graph.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +8 -4
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +8 -4
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +8 -4
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +8 -4
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +8 -4
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +8 -4
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +8 -4
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +8 -4
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +8 -4
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +8 -4
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +8 -4
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +8 -4
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +8 -4
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +8 -4
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +8 -4
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +8 -4
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +8 -4
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +8 -4
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +8 -4
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +8 -4
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +8 -4
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +8 -4
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +2 -2
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +2 -2
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +1 -0
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-schema-form.mjs +1 -0
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +100 -3
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list.mjs +2 -2
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-table-testing.mjs +71 -3
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +171 -11
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tour-testing.mjs +13 -1
- package/fesm2022/ngwr-tour-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +13 -9
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +12 -1
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-utils.mjs +64 -1
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/graph/styles/_index.scss +87 -0
- package/i18n/ar.json +8 -4
- package/i18n/cs.json +8 -4
- package/i18n/de.json +8 -4
- package/i18n/en.json +8 -4
- package/i18n/es.json +8 -4
- package/i18n/fr.json +8 -4
- package/i18n/he.json +8 -4
- package/i18n/hi.json +8 -4
- package/i18n/id.json +8 -4
- package/i18n/it.json +8 -4
- package/i18n/ja.json +8 -4
- package/i18n/ko.json +8 -4
- package/i18n/nl.json +8 -4
- package/i18n/pl.json +8 -4
- package/i18n/pt.json +8 -4
- package/i18n/ru.json +8 -4
- package/i18n/sv.json +8 -4
- package/i18n/tr.json +8 -4
- package/i18n/uk.json +8 -4
- package/i18n/vi.json +8 -4
- package/i18n/zh-TW.json +8 -4
- package/i18n/zh.json +8 -4
- package/llms-full.txt +4 -4
- package/llms.txt +57 -24
- package/package.json +1 -1
- package/schematics/collection.json +5 -0
- package/schematics/eject/index.js +158 -0
- package/schematics/eject/schema.js +8 -0
- package/schematics/eject/schema.json +24 -0
- package/schematics/eject/source.js +295 -0
- package/schematics/use/symbol-map.json +1 -0
- package/select/styles/_index.scss +13 -0
- package/skills/ngwr/SKILL.md +30 -3
- package/skills/ngwr/references/catalog.md +1 -1
- package/table/styles/_index.scss +24 -0
- package/theme/styles/_focus.scss +11 -1
- package/types/ngwr-carousel-testing.d.ts +27 -6
- package/types/ngwr-carousel.d.ts +42 -6
- package/types/ngwr-cascader.d.ts +3 -5
- package/types/ngwr-context-menu.d.ts +2 -0
- package/types/ngwr-dropdown.d.ts +2 -0
- package/types/ngwr-file-upload.d.ts +8 -2
- package/types/ngwr-graph-testing.d.ts +28 -0
- package/types/ngwr-graph.d.ts +247 -91
- package/types/ngwr-select.d.ts +37 -0
- package/types/ngwr-table-testing.d.ts +52 -1
- package/types/ngwr-table.d.ts +101 -9
- package/types/ngwr-tour-testing.d.ts +10 -0
- package/types/ngwr-tour.d.ts +11 -2
- package/types/ngwr-tree.d.ts +2 -0
- package/types/ngwr-utils.d.ts +79 -1
- package/types/ngwr-version.d.ts +1 -1
package/fesm2022/ngwr-table.mjs
CHANGED
|
@@ -96,6 +96,146 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
96
96
|
* Use of this source code is governed by an MIT-style license that can be
|
|
97
97
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
98
98
|
*/
|
|
99
|
+
var WrTableColumnChooser = class WrTableColumnChooser {
|
|
100
|
+
constructor() {
|
|
101
|
+
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("table");
|
|
102
|
+
}
|
|
103
|
+
table = input.required(...ngDevMode ? [{ debugName: "table" }] : /* istanbul ignore next */ []);
|
|
104
|
+
showAllLabel = input(null, ...ngDevMode ? [{ debugName: "showAllLabel" }] : /* istanbul ignore next */ []);
|
|
105
|
+
ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
106
|
+
resolvedShowAll = useI18nText(this.showAllLabel, "table.showAllColumns", "Show all");
|
|
107
|
+
resolvedLabel = useI18nText(this.ariaLabel, "table.columns", "Columns");
|
|
108
|
+
columns = computed(() => this.table().chooserColumns(), ...ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []);
|
|
109
|
+
showAllState = computed(() => {
|
|
110
|
+
const hideable = this.columns().filter((c) => c.hideable);
|
|
111
|
+
const hidden = hideable.filter((c) => c.hidden).length;
|
|
112
|
+
if (hidden === 0) return "all";
|
|
113
|
+
return hidden === hideable.length ? "none" : "some";
|
|
114
|
+
}, ...ngDevMode ? [{ debugName: "showAllState" }] : /* istanbul ignore next */ []);
|
|
115
|
+
showAllDisabled = computed(() => this.columns().every((c) => c.locked), ...ngDevMode ? [{ debugName: "showAllDisabled" }] : /* istanbul ignore next */ []);
|
|
116
|
+
toggleShowAll() {
|
|
117
|
+
const table = this.table();
|
|
118
|
+
if (this.showAllState() !== "all") return table.setHiddenColumns([]);
|
|
119
|
+
table.setHiddenColumns(this.columns().filter((c) => c.hideable).map((c) => c.key));
|
|
120
|
+
}
|
|
121
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
122
|
+
minVersion: "12.0.0",
|
|
123
|
+
version: "22.2.6",
|
|
124
|
+
ngImport: i0,
|
|
125
|
+
type: WrTableColumnChooser,
|
|
126
|
+
deps: [],
|
|
127
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
128
|
+
});
|
|
129
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
130
|
+
minVersion: "17.0.0",
|
|
131
|
+
version: "22.2.6",
|
|
132
|
+
type: WrTableColumnChooser,
|
|
133
|
+
isStandalone: true,
|
|
134
|
+
selector: "wr-table-column-chooser",
|
|
135
|
+
inputs: {
|
|
136
|
+
table: {
|
|
137
|
+
classPropertyName: "table",
|
|
138
|
+
publicName: "table",
|
|
139
|
+
isSignal: true,
|
|
140
|
+
isRequired: true,
|
|
141
|
+
transformFunction: null
|
|
142
|
+
},
|
|
143
|
+
showAllLabel: {
|
|
144
|
+
classPropertyName: "showAllLabel",
|
|
145
|
+
publicName: "showAllLabel",
|
|
146
|
+
isSignal: true,
|
|
147
|
+
isRequired: false,
|
|
148
|
+
transformFunction: null
|
|
149
|
+
},
|
|
150
|
+
ariaLabel: {
|
|
151
|
+
classPropertyName: "ariaLabel",
|
|
152
|
+
publicName: "ariaLabel",
|
|
153
|
+
isSignal: true,
|
|
154
|
+
isRequired: false,
|
|
155
|
+
transformFunction: null
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
host: {
|
|
159
|
+
attributes: { "role": "group" },
|
|
160
|
+
properties: { "attr.aria-label": "resolvedLabel()" },
|
|
161
|
+
classAttribute: "wr-table-column-chooser"
|
|
162
|
+
},
|
|
163
|
+
ngImport: i0,
|
|
164
|
+
template: "@if (columns().length > 0) {\n <wr-checkbox\n class=\"wr-table-column-chooser__all\"\n size=\"sm\"\n [checked]=\"showAllState() === 'all'\"\n [indeterminate]=\"showAllState() === 'some'\"\n [disabled]=\"showAllDisabled()\"\n (checkedChange)=\"toggleShowAll()\"\n >{{ resolvedShowAll() }}</wr-checkbox\n >\n}\n@for (entry of columns(); track entry.key) {\n <wr-checkbox\n class=\"wr-table-column-chooser__item wr-table__columns-item\"\n size=\"sm\"\n [checked]=\"!entry.hidden\"\n [disabled]=\"entry.locked\"\n (checkedChange)=\"table().toggleColumn(entry.key)\"\n >{{ entry.title }}</wr-checkbox\n >\n}\n",
|
|
165
|
+
dependencies: [{
|
|
166
|
+
kind: "component",
|
|
167
|
+
type: WrCheckbox,
|
|
168
|
+
selector: "wr-checkbox",
|
|
169
|
+
inputs: [
|
|
170
|
+
"id",
|
|
171
|
+
"checkboxValue",
|
|
172
|
+
"ariaLabel",
|
|
173
|
+
"ariaLabelledby",
|
|
174
|
+
"checked",
|
|
175
|
+
"disabled",
|
|
176
|
+
"readonly",
|
|
177
|
+
"size",
|
|
178
|
+
"icon",
|
|
179
|
+
"indeterminate"
|
|
180
|
+
],
|
|
181
|
+
outputs: ["checkedChange", "touch"]
|
|
182
|
+
}],
|
|
183
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
187
|
+
minVersion: "12.0.0",
|
|
188
|
+
version: "22.2.6",
|
|
189
|
+
ngImport: i0,
|
|
190
|
+
type: WrTableColumnChooser,
|
|
191
|
+
decorators: [{
|
|
192
|
+
type: Component,
|
|
193
|
+
args: [{
|
|
194
|
+
selector: "wr-table-column-chooser",
|
|
195
|
+
encapsulation: ViewEncapsulation.None,
|
|
196
|
+
host: {
|
|
197
|
+
class: "wr-table-column-chooser",
|
|
198
|
+
role: "group",
|
|
199
|
+
"[attr.aria-label]": "resolvedLabel()"
|
|
200
|
+
},
|
|
201
|
+
imports: [WrCheckbox],
|
|
202
|
+
template: "@if (columns().length > 0) {\n <wr-checkbox\n class=\"wr-table-column-chooser__all\"\n size=\"sm\"\n [checked]=\"showAllState() === 'all'\"\n [indeterminate]=\"showAllState() === 'some'\"\n [disabled]=\"showAllDisabled()\"\n (checkedChange)=\"toggleShowAll()\"\n >{{ resolvedShowAll() }}</wr-checkbox\n >\n}\n@for (entry of columns(); track entry.key) {\n <wr-checkbox\n class=\"wr-table-column-chooser__item wr-table__columns-item\"\n size=\"sm\"\n [checked]=\"!entry.hidden\"\n [disabled]=\"entry.locked\"\n (checkedChange)=\"table().toggleColumn(entry.key)\"\n >{{ entry.title }}</wr-checkbox\n >\n}\n"
|
|
203
|
+
}]
|
|
204
|
+
}],
|
|
205
|
+
ctorParameters: () => [],
|
|
206
|
+
propDecorators: {
|
|
207
|
+
table: [{
|
|
208
|
+
type: i0.Input,
|
|
209
|
+
args: [{
|
|
210
|
+
isSignal: true,
|
|
211
|
+
alias: "table",
|
|
212
|
+
required: true
|
|
213
|
+
}]
|
|
214
|
+
}],
|
|
215
|
+
showAllLabel: [{
|
|
216
|
+
type: i0.Input,
|
|
217
|
+
args: [{
|
|
218
|
+
isSignal: true,
|
|
219
|
+
alias: "showAllLabel",
|
|
220
|
+
required: false
|
|
221
|
+
}]
|
|
222
|
+
}],
|
|
223
|
+
ariaLabel: [{
|
|
224
|
+
type: i0.Input,
|
|
225
|
+
args: [{
|
|
226
|
+
isSignal: true,
|
|
227
|
+
alias: "ariaLabel",
|
|
228
|
+
required: false
|
|
229
|
+
}]
|
|
230
|
+
}]
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
/**
|
|
234
|
+
* @license
|
|
235
|
+
*
|
|
236
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
237
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
238
|
+
*/
|
|
99
239
|
var WrTableEditCell = class WrTableEditCell {
|
|
100
240
|
columnKey = input.required({
|
|
101
241
|
...ngDevMode ? { debugName: "columnKey" } : /* istanbul ignore next */ {},
|
|
@@ -957,21 +1097,30 @@ var WrTable = class WrTable {
|
|
|
957
1097
|
chooserColumns = computed(() => {
|
|
958
1098
|
const shown = new Set(this.displayColumns().map((c) => c.key));
|
|
959
1099
|
return this.orderedColumns().map(({ key, column }) => {
|
|
960
|
-
const
|
|
1100
|
+
const hidden = !shown.has(key);
|
|
961
1101
|
return {
|
|
962
1102
|
key,
|
|
963
1103
|
title: column.title || (column.headerHint ?? key),
|
|
964
|
-
|
|
965
|
-
|
|
1104
|
+
hidden,
|
|
1105
|
+
hideable: column.hideable !== false,
|
|
1106
|
+
locked: column.hideable === false || !hidden && shown.size === 1
|
|
966
1107
|
};
|
|
967
1108
|
});
|
|
968
1109
|
}, ...ngDevMode ? [{ debugName: "chooserColumns" }] : /* istanbul ignore next */ []);
|
|
969
|
-
|
|
970
|
-
const
|
|
971
|
-
if (
|
|
972
|
-
if (!visible && shown.length === 1) return;
|
|
1110
|
+
toggleColumn(key) {
|
|
1111
|
+
const entry = this.chooserColumns().find((c) => c.key === key);
|
|
1112
|
+
if (!entry || entry.locked) return;
|
|
973
1113
|
const hidden = this.hiddenColumns().filter((k) => k !== key);
|
|
974
|
-
this.hiddenColumns.set(
|
|
1114
|
+
this.hiddenColumns.set(entry.hidden ? hidden : [...hidden, key]);
|
|
1115
|
+
this.readerChanges.update((n) => n + 1);
|
|
1116
|
+
}
|
|
1117
|
+
setHiddenColumns(keys) {
|
|
1118
|
+
const asked = new Set(keys);
|
|
1119
|
+
const ordered = this.orderedColumns();
|
|
1120
|
+
const next = ordered.filter((c) => c.column.hideable !== false).filter((c) => asked.has(c.key)).map((c) => c.key);
|
|
1121
|
+
if (ordered.length > 0 && next.length === ordered.length) next.shift();
|
|
1122
|
+
if (sameList(next, this.hiddenColumns())) return;
|
|
1123
|
+
this.hiddenColumns.set(next);
|
|
975
1124
|
this.readerChanges.update((n) => n + 1);
|
|
976
1125
|
}
|
|
977
1126
|
pins = signal({
|
|
@@ -2659,7 +2808,7 @@ var WrTable = class WrTable {
|
|
|
2659
2808
|
}
|
|
2660
2809
|
],
|
|
2661
2810
|
ngImport: i0,
|
|
2662
|
-
template: "@switch (loadingForm()) {\n @case ('overlay') {\n <div class=\"wr-table__loading\" role=\"status\" [attr.aria-label]=\"resolvedLoadingLabel()\">\n <wr-spinner size=\"lg\" />\n </div>\n }\n @case ('bar') {\n <div class=\"wr-table__loading-bar\" role=\"status\" [attr.aria-label]=\"resolvedLoadingLabel()\"></div>\n }\n}\n\n@if (columnChooser()) {\n <div class=\"wr-table__toolbar\">\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-table__columns-btn\"\n position=\"bottom-end\"\n [wrPopover]=\"chooser\"\n [ariaLabel]=\"resolvedColumnsLabel()\"\n >\n {{ resolvedColumnsLabel() }}\n </button>\n <ng-template #chooser>\n <div class=\"wr-table__columns\">\n @for (entry of chooserColumns(); track entry.key) {\n <wr-checkbox\n class=\"wr-table__columns-item\"\n size=\"sm\"\n [checked]=\"entry.visible\"\n [disabled]=\"entry.locked\"\n (checkedChange)=\"setColumnVisible(entry.key, $event)\"\n >{{ entry.title }}</wr-checkbox\n >\n }\n </div>\n </ng-template>\n </div>\n}\n\n<!-- The selection bar lies over the header: a box of no height in front of\n the scroll area, so the bar stays put while the columns scroll under it.\n The count is announced from a region that is in the DOM before it has\n anything to say, and the drawn copy is hidden from it. -->\n@if (hasSelectionBar()) {\n <div class=\"wr-table__selection\">\n <span class=\"wr-table__selection-status\" role=\"status\">{{ selectionBar() ? selectionCountText() : '' }}</span>\n @if (selectionBar(); as tpl) {\n <div\n #selectionBarEl\n class=\"wr-table__selection-bar\"\n [class.wr-table__selection-bar--inset]=\"rowSelection() === 'multiple'\"\n [style.--wr-table-selection-bar-height.px]=\"selectionBarHeight()\"\n >\n <span class=\"wr-table__selection-count\" aria-hidden=\"true\">{{ selectionCountText() }}</span>\n <button wr-btn type=\"button\" size=\"sm\" class=\"wr-table__selection-clear\" (click)=\"clearSelection()\">\n {{ resolvedClearSelectionLabel() }}\n </button>\n <div class=\"wr-table__selection-actions\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"selectionContext()\" />\n </div>\n </div>\n }\n </div>\n}\n\n<!-- With a selection bar the scroll area takes focus from script, for the bar\n to hand it to when it leaves a table that has no checkbox to take it. -->\n<div\n class=\"wr-table__scroll\"\n #scroll\n [style.--wr-table-scroll-height]=\"scrollHeight()\"\n [style.--wr-table-head-height.px]=\"stickyEdges().head\"\n [style.--wr-table-foot-height.px]=\"stickyEdges().foot\"\n [attr.tabindex]=\"scrollable() ? 0 : hasSelectionBar() ? -1 : null\"\n>\n <table\n class=\"wr-table__table\"\n [class.wr-table__table--fixed]=\"fixedLayoutActive()\"\n [style.--wr-table-row-h.px]=\"virtualized() ? effRowH() : null\"\n [attr.aria-rowcount]=\"virtualized() ? renderRows().length + 1 + (hasSummary() && items()?.length ? 1 : 0) : null\"\n [attr.role]=\"treeMode() ? 'treegrid' : editGrid() ? 'grid' : null\"\n [attr.aria-multiselectable]=\"treeMode() && rowSelection() === 'multiple' ? true : null\"\n >\n <colgroup>\n @if (rowSelection()) {\n <col class=\"wr-table__col--lead\" />\n }\n @if (expandable()) {\n <col class=\"wr-table__col--lead\" />\n }\n @for (col of cellColumns(); track col.key) {\n <col [style.width.px]=\"col.width\" />\n }\n </colgroup>\n <thead #head>\n <tr\n cdkDropList\n cdkDropListOrientation=\"horizontal\"\n [cdkDropListSortPredicate]=\"sortPredicate\"\n (cdkDropListDropped)=\"onColumnDrop($event)\"\n (cdkDropListSorted)=\"onColumnListSorted($event)\"\n (cdkDropListEntered)=\"onColumnListEntered()\"\n (cdkDropListExited)=\"onColumnListExited()\"\n >\n @if (rowSelection()) {\n <th class=\"wr-table__th wr-table__th--select\">\n @if (rowSelection() === 'multiple') {\n <!-- Disabled with nothing to sweep, the way `wr-transfer` guards its\n own select-all. `[checked]` is a one-way binding over a checkbox\n that owns its state, and on zero rows `allSelected()` answers\n `false` before and after the click — an unchanged input is never\n written back, so the box latched CHECKED over an empty table and\n stayed that way when rows returned. -->\n <wr-checkbox\n size=\"sm\"\n [checked]=\"allSelected()\"\n [indeterminate]=\"someSelected()\"\n [disabled]=\"selectAllKeys().size === 0\"\n (checkedChange)=\"toggleAll($event)\"\n [ariaLabel]=\"resolvedSelectAllLabel()\"\n />\n }\n </th>\n }\n @if (expandable()) {\n <th class=\"wr-table__th wr-table__th--expand\"></th>\n }\n <!-- `inert` under the selection bar: a control the bar covers takes no\n focus and no click. The select-all cell stays out from under it. -->\n @for (col of cellColumns(); track col.key) {\n <th\n #thCell\n cdkDrag\n [attr.inert]=\"selectionBar() ? '' : null\"\n [cdkDragDisabled]=\"!reorderable() || col.pinned\"\n (cdkDragStarted)=\"onColumnDragStart($event)\"\n (cdkDragMoved)=\"onColumnDragMoved($event)\"\n (cdkDragEnded)=\"onColumnDragEnd()\"\n [class]=\"col.thClass\"\n [attr.aria-sort]=\"ariaSortFor(col.key, col.column.sortable)\"\n [attr.aria-label]=\"col.column.title ? null : (col.column.headerHint ?? null)\"\n [class.wr-table__th--draggable]=\"reorderable() && !col.pinned\"\n [class.wr-table__th--pin-left]=\"col.pinLeft\"\n [class.wr-table__th--pin-right]=\"col.pinRight\"\n [class.wr-table__th--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__th--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n >\n <div class=\"wr-table__th-inner\">\n <span class=\"wr-table__title\">{{ col.column.title }}</span>\n\n @if (col.column.sortable) {\n <button\n type=\"button\"\n class=\"wr-table__sort-btn\"\n [attr.aria-label]=\"sortLabelFor(headerName(col.column))\"\n (click)=\"cycleSort(col.key)\"\n >\n <wr-table-sort [direction]=\"directionFor(col.key)\" />\n </button>\n <!-- A column's place in a multi-column sort. Drawn, because only the\n primary key announces `aria-sort` (see ariaSortFor). Beside the\n button rather than in it: inside, the digit is visible text the\n button's name (\"Sort Role\") does not contain, which is a WCAG\n 2.5.3 label-in-name failure. Hidden, so the column header's own\n name stays its title. -->\n @if (sortOrderFor(col.key); as order) {\n <span class=\"wr-table__sort-order\" aria-hidden=\"true\">{{ order }}</span>\n }\n }\n\n @if (col.column.filterItems; as filterItems) {\n @if (filterItems.length) {\n <wr-table-filter\n [items]=\"filterItems\"\n [column]=\"headerName(col.column)\"\n (selectionChange)=\"onFilter(col.key, $event)\"\n />\n }\n }\n </div>\n\n @if (col.column.resizable) {\n <span\n class=\"wr-table__resize-handle\"\n aria-hidden=\"true\"\n (pointerdown)=\"onResizeStart($event, col.key, thCell)\"\n (pointermove)=\"onResizeMove($event)\"\n (pointerup)=\"onResizeEnd($event)\"\n (pointercancel)=\"onResizeEnd($event)\"\n (mousedown)=\"$event.stopPropagation()\"\n (touchstart)=\"$event.stopPropagation()\"\n ></span>\n }\n </th>\n }\n </tr>\n </thead>\n\n <!-- One delegated listener for `rowClick`, which is pointer only by contract:\n the body is no control, and a row's keyboard path is the consumer's own\n button or link in a cell. The other three serve inline editing and\n return at once in a table with no edit template. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <tbody\n (click)=\"onBodyClick($event)\"\n (dblclick)=\"onCellDblclick($event)\"\n (keydown)=\"onCellKeydown($event)\"\n (focusin)=\"onCellFocusin($event)\"\n >\n @if (visibleItems()) {\n @if (virtualized() && virtualWindow().padTop > 0) {\n <tr class=\"wr-table__spacer\" aria-hidden=\"true\">\n <td [attr.colspan]=\"totalCols()\" [style.height.px]=\"virtualWindow().padTop\"></td>\n </tr>\n }\n @let edit = editing();\n @for (entry of windowRows(); track entry.id; let i = $index) {\n @if (entry.kind === 'group') {\n <tr class=\"wr-table__group-row\" [class.wr-table__group-row--collapsed]=\"entry.group.collapsed\">\n <td class=\"wr-table__group-cell\" [attr.colspan]=\"totalCols()\">\n <!-- The cell spans the full table width; this inner box is what sticks. -->\n <div class=\"wr-table__group-inner\">\n @if (rowSelection() === 'multiple') {\n <wr-checkbox\n class=\"wr-table__group-select\"\n size=\"sm\"\n [checked]=\"groupChecked(entry.group.rows)\"\n [indeterminate]=\"groupIndeterminate(entry.group.rows)\"\n (checkedChange)=\"toggleGroupSelection(entry.group.rows, $event)\"\n [ariaLabelledby]=\"groupControlLabelledby('select-group', entry.id)\"\n />\n }\n @if (groupTemplate(); as tpl) {\n <button\n type=\"button\"\n class=\"wr-table__group-toggle wr-table__group-toggle--icon\"\n [attr.aria-expanded]=\"!entry.group.collapsed\"\n [attr.aria-labelledby]=\"groupControlLabelledby('toggle-group', entry.id)\"\n (click)=\"toggleGroupCollapse(entry.group.value)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__group-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"entry.group\" />\n <!-- The group's name for the two controls above. A custom header\n is the consumer's markup, with nothing in it to point at. -->\n <span hidden [id]=\"groupLabelId(entry.id)\">{{ entry.group.label }}</span>\n } @else {\n <button\n type=\"button\"\n class=\"wr-table__group-toggle\"\n [attr.aria-expanded]=\"!entry.group.collapsed\"\n [attr.aria-labelledby]=\"groupToggleLabelledby(entry.id)\"\n (click)=\"toggleGroupCollapse(entry.group.value)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__group-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n <span class=\"wr-table__group-label\" [id]=\"groupLabelId(entry.id)\">{{ entry.group.label }}</span>\n @if (showGroupCount()) {\n <!-- A real space between the label and the count. Whitespace\n alone draws nothing in a flex row, and without it the\n button's text reads \"admin2\" — which the name\n \"Toggle group admin 2\" does not contain, a label-in-name\n mismatch for any tool that compares the two. -->\n &ngsp;<span class=\"wr-table__group-count\" [id]=\"groupCountId(entry.id)\">{{\n entry.group.count\n }}</span>\n }\n </button>\n }\n </div>\n </td>\n </tr>\n } @else if (entry.kind === 'group-foot') {\n <tr class=\"wr-table__group-foot-row\">\n @if (rowSelection()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @if (expandable()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @for (col of cellColumns(); track col.key) {\n <td\n [class]=\"col.footClass\"\n [class.wr-table__td--pin-left]=\"col.pinLeft\"\n [class.wr-table__td--pin-right]=\"col.pinRight\"\n [class.wr-table__td--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__td--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n >\n {{ entry.summaries.get(col.key) ?? '' }}\n </td>\n }\n </tr>\n } @else {\n <tr\n #rowEl\n [class]=\"rowClasses(entry.row, i)\"\n [class.wr-table__tr--selected]=\"rowSelection() && isRowSelected(entry.row)\"\n [class.wr-table__tr--child]=\"entry.depth > 0\"\n [attr.aria-rowindex]=\"virtualized() ? windowStart() + i + 2 : null\"\n [attr.aria-level]=\"treeMode() ? entry.depth + 1 : null\"\n [attr.aria-posinset]=\"treeMode() ? entry.posinset : null\"\n [attr.aria-setsize]=\"treeMode() ? entry.setsize : null\"\n [attr.aria-expanded]=\"entry.open\"\n [attr.aria-selected]=\"treeMode() && rowSelection() ? isRowSelected(entry.row) : null\"\n [attr.tabindex]=\"treeMode() ? (entry.id === tabStopRowId() ? 0 : -1) : null\"\n [style.--wr-table-depth]=\"treeMode() ? entry.depth : null\"\n >\n @if (rowSelection()) {\n <td class=\"wr-table__td wr-table__td--select\">\n <wr-checkbox\n size=\"sm\"\n [checked]=\"isRowSelected(entry.row)\"\n (checkedChange)=\"toggleRow(entry.row, $event)\"\n [ariaLabelledby]=\"rowControlLabelledby('select-row', entry.id)\"\n />\n </td>\n }\n @if (expandable()) {\n <td class=\"wr-table__td wr-table__td--expand\">\n <button\n type=\"button\"\n class=\"wr-table__expand-btn\"\n [class.wr-table__expand-btn--open]=\"isExpanded(entry.row)\"\n [attr.aria-expanded]=\"isExpanded(entry.row)\"\n [attr.aria-labelledby]=\"rowControlLabelledby('expand-row', entry.id)\"\n (click)=\"toggleExpand(entry.row)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__expand-icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n </td>\n }\n @for (col of cellColumns(); track col.key) {\n @let cellEdit = edit !== null && edit.row === entry.row && edit.key === col.key ? edit : null;\n <td\n [class]=\"col.tdClass\"\n [class.wr-table__td--pin-left]=\"col.pinLeft\"\n [class.wr-table__td--pin-right]=\"col.pinRight\"\n [class.wr-table__td--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__td--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n [style.max-width.px]=\"col.maxWidth\"\n [attr.data-label]=\"col.column.title\"\n [attr.id]=\"col.label ? rowLabelId(entry.id) : null\"\n [attr.tabindex]=\"editGrid() ? cellTabindex(entry, col) : null\"\n [class.wr-table__td--editable]=\"col.editTemplate ? cellEditable(entry.row, col) : false\"\n [class.wr-table__td--editing]=\"cellEdit !== null\"\n >\n @if (col.tree) {\n <span class=\"wr-table__tree-lead\">\n @if (entry.parent) {\n <button\n type=\"button\"\n class=\"wr-table__tree-toggle\"\n [class.wr-table__tree-toggle--open]=\"entry.open\"\n [attr.aria-expanded]=\"entry.open\"\n [attr.aria-labelledby]=\"rowControlLabelledby('toggle-row', entry.id)\"\n (click)=\"toggleTreeRow(entry.row)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__tree-icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n } @else {\n <span class=\"wr-table__tree-toggle wr-table__tree-toggle--leaf\" aria-hidden=\"true\"></span>\n }\n </span>\n }\n @if (cellEdit) {\n <ng-container\n [ngTemplateOutlet]=\"col.editTemplate ?? null\"\n [ngTemplateOutletContext]=\"cellEdit.context\"\n />\n } @else if (col.template; as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"cellContext(entry.row, col)\" />\n } @else {\n {{ cellText(entry.row, col.key, col.column) }}\n }\n </td>\n }\n </tr>\n @if (expandable() && isExpanded(entry.row)) {\n <tr class=\"wr-table__detail-row\">\n <td class=\"wr-table__detail\" [attr.colspan]=\"totalCols()\">\n <ng-container\n [ngTemplateOutlet]=\"expandTemplate() ?? null\"\n [ngTemplateOutletContext]=\"expandContext(entry.row)\"\n />\n </td>\n </tr>\n }\n }\n }\n @if (virtualized() && virtualWindow().padBottom > 0) {\n <tr class=\"wr-table__spacer\" aria-hidden=\"true\">\n <td [attr.colspan]=\"totalCols()\" [style.height.px]=\"virtualWindow().padBottom\"></td>\n </tr>\n }\n }\n <!-- Sibling of the row loop rather than its `@empty` branch, and gated on\n `loading()`. As the `@empty` branch it lived INSIDE `@if (visibleItems())`,\n which passes a nullish `[items]` straight through — so the input's own\n default rendered a header over a blank body with no \"No data\" anywhere,\n the opposite of what `items`'s docs promise. And the veil is translucent,\n so on the documented `[items]=\"[]\" [loading]=\"true\"` pair the row read\n \"No data\" through the spinner. -->\n @if (!loading() && !renderRows().length) {\n <tr>\n <td class=\"wr-table__empty\" [attr.colspan]=\"totalCols()\">{{ resolvedEmptyLabel() }}</td>\n </tr>\n }\n </tbody>\n\n @if (hasSummary() && items()?.length) {\n <tfoot #foot>\n <tr class=\"wr-table__foot-row\">\n @if (rowSelection()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @if (expandable()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @for (col of cellColumns(); track col.key) {\n <td\n [class]=\"col.footClass\"\n [class.wr-table__td--pin-left]=\"col.pinLeft\"\n [class.wr-table__td--pin-right]=\"col.pinRight\"\n [class.wr-table__td--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__td--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n >\n {{ summaryFor(col.key) }}\n </td>\n }\n </tr>\n </tfoot>\n }\n </table>\n</div>\n\n@if (showPager()) {\n <div class=\"wr-table__pager\">\n <wr-pagination\n [page]=\"page()\"\n (pageChange)=\"onPagerPage($event)\"\n [pageSize]=\"currentPageSize()\"\n (pageSizeChange)=\"onPageSizeChange($event)\"\n [total]=\"resolvedTotal()\"\n [size]=\"paginationSize()\"\n [showSizeChanger]=\"pageSizeOptions().length > 0\"\n [pageSizeOptions]=\"pageSizeOptions()\"\n />\n </div>\n}\n\n<!-- The table's one tooltip, for a header hint or a cut cell (see `tip`). -->\n@if (tip(); as shown) {\n <span hidden [wrPopover]=\"shown.text\" mode=\"tooltip\" [wrPopoverOrigin]=\"shown.el\"></span>\n}\n\n<!-- The action words the row and group controls are named with, once per table.\n `aria-labelledby` reads a hidden element it points at, so each control joins\n one of these to its own row's (or group's) label. Only the words a control\n in this table uses are rendered. -->\n@if (rowSelection() || expandable() || treeMode() || groupBy() !== null) {\n <div hidden>\n @if (rowSelection()) {\n <span [id]=\"actionId('select-row')\">{{ resolvedSelectRowLabel() }}</span>\n }\n @if (expandable()) {\n <span [id]=\"actionId('expand-row')\">{{ resolvedExpandRowLabel() }}</span>\n }\n @if (treeMode()) {\n <span [id]=\"actionId('toggle-row')\">{{ resolvedToggleRowLabel() }}</span>\n }\n @if (groupBy() !== null) {\n @if (rowSelection() === 'multiple') {\n <span [id]=\"actionId('select-group')\">{{ resolvedSelectGroupLabel() }}</span>\n }\n <span [id]=\"actionId('toggle-group')\">{{ resolvedToggleGroupLabel() }}</span>\n }\n </div>\n}\n",
|
|
2811
|
+
template: "@switch (loadingForm()) {\n @case ('overlay') {\n <div class=\"wr-table__loading\" role=\"status\" [attr.aria-label]=\"resolvedLoadingLabel()\">\n <wr-spinner size=\"lg\" />\n </div>\n }\n @case ('bar') {\n <div class=\"wr-table__loading-bar\" role=\"status\" [attr.aria-label]=\"resolvedLoadingLabel()\"></div>\n }\n}\n\n@if (columnChooser()) {\n <div class=\"wr-table__toolbar\">\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-table__columns-btn\"\n position=\"bottom-end\"\n [wrPopover]=\"chooser\"\n [ariaLabel]=\"resolvedColumnsLabel()\"\n >\n {{ resolvedColumnsLabel() }}\n </button>\n <ng-template #chooser>\n <div class=\"wr-table__columns\">\n <wr-table-column-chooser [table]=\"this\" [ariaLabel]=\"resolvedColumnsLabel()\" />\n </div>\n </ng-template>\n </div>\n}\n\n<!-- The selection bar lies over the header: a box of no height in front of\n the scroll area, so the bar stays put while the columns scroll under it.\n The count is announced from a region that is in the DOM before it has\n anything to say, and the drawn copy is hidden from it. -->\n@if (hasSelectionBar()) {\n <div class=\"wr-table__selection\">\n <span class=\"wr-table__selection-status\" role=\"status\">{{ selectionBar() ? selectionCountText() : '' }}</span>\n @if (selectionBar(); as tpl) {\n <div\n #selectionBarEl\n class=\"wr-table__selection-bar\"\n [class.wr-table__selection-bar--inset]=\"rowSelection() === 'multiple'\"\n [style.--wr-table-selection-bar-height.px]=\"selectionBarHeight()\"\n >\n <span class=\"wr-table__selection-count\" aria-hidden=\"true\">{{ selectionCountText() }}</span>\n <button wr-btn type=\"button\" size=\"sm\" class=\"wr-table__selection-clear\" (click)=\"clearSelection()\">\n {{ resolvedClearSelectionLabel() }}\n </button>\n <div class=\"wr-table__selection-actions\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"selectionContext()\" />\n </div>\n </div>\n }\n </div>\n}\n\n<!-- With a selection bar the scroll area takes focus from script, for the bar\n to hand it to when it leaves a table that has no checkbox to take it. -->\n<div\n class=\"wr-table__scroll\"\n #scroll\n [style.--wr-table-scroll-height]=\"scrollHeight()\"\n [style.--wr-table-head-height.px]=\"stickyEdges().head\"\n [style.--wr-table-foot-height.px]=\"stickyEdges().foot\"\n [attr.tabindex]=\"scrollable() ? 0 : hasSelectionBar() ? -1 : null\"\n>\n <table\n class=\"wr-table__table\"\n [class.wr-table__table--fixed]=\"fixedLayoutActive()\"\n [style.--wr-table-row-h.px]=\"virtualized() ? effRowH() : null\"\n [attr.aria-rowcount]=\"virtualized() ? renderRows().length + 1 + (hasSummary() && items()?.length ? 1 : 0) : null\"\n [attr.role]=\"treeMode() ? 'treegrid' : editGrid() ? 'grid' : null\"\n [attr.aria-multiselectable]=\"treeMode() && rowSelection() === 'multiple' ? true : null\"\n >\n <colgroup>\n @if (rowSelection()) {\n <col class=\"wr-table__col--lead\" />\n }\n @if (expandable()) {\n <col class=\"wr-table__col--lead\" />\n }\n @for (col of cellColumns(); track col.key) {\n <col [style.width.px]=\"col.width\" />\n }\n </colgroup>\n <thead #head>\n <tr\n cdkDropList\n cdkDropListOrientation=\"horizontal\"\n [cdkDropListSortPredicate]=\"sortPredicate\"\n (cdkDropListDropped)=\"onColumnDrop($event)\"\n (cdkDropListSorted)=\"onColumnListSorted($event)\"\n (cdkDropListEntered)=\"onColumnListEntered()\"\n (cdkDropListExited)=\"onColumnListExited()\"\n >\n @if (rowSelection()) {\n <th class=\"wr-table__th wr-table__th--select\">\n @if (rowSelection() === 'multiple') {\n <!-- Disabled with nothing to sweep, the way `wr-transfer` guards its\n own select-all. `[checked]` is a one-way binding over a checkbox\n that owns its state, and on zero rows `allSelected()` answers\n `false` before and after the click — an unchanged input is never\n written back, so the box latched CHECKED over an empty table and\n stayed that way when rows returned. -->\n <wr-checkbox\n size=\"sm\"\n [checked]=\"allSelected()\"\n [indeterminate]=\"someSelected()\"\n [disabled]=\"selectAllKeys().size === 0\"\n (checkedChange)=\"toggleAll($event)\"\n [ariaLabel]=\"resolvedSelectAllLabel()\"\n />\n }\n </th>\n }\n @if (expandable()) {\n <th class=\"wr-table__th wr-table__th--expand\"></th>\n }\n <!-- `inert` under the selection bar: a control the bar covers takes no\n focus and no click. The select-all cell stays out from under it. -->\n @for (col of cellColumns(); track col.key) {\n <th\n #thCell\n cdkDrag\n [attr.inert]=\"selectionBar() ? '' : null\"\n [cdkDragDisabled]=\"!reorderable() || col.pinned\"\n (cdkDragStarted)=\"onColumnDragStart($event)\"\n (cdkDragMoved)=\"onColumnDragMoved($event)\"\n (cdkDragEnded)=\"onColumnDragEnd()\"\n [class]=\"col.thClass\"\n [attr.aria-sort]=\"ariaSortFor(col.key, col.column.sortable)\"\n [attr.aria-label]=\"col.column.title ? null : (col.column.headerHint ?? null)\"\n [class.wr-table__th--draggable]=\"reorderable() && !col.pinned\"\n [class.wr-table__th--pin-left]=\"col.pinLeft\"\n [class.wr-table__th--pin-right]=\"col.pinRight\"\n [class.wr-table__th--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__th--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n >\n <div class=\"wr-table__th-inner\">\n <span class=\"wr-table__title\">{{ col.column.title }}</span>\n\n @if (col.column.sortable) {\n <button\n type=\"button\"\n class=\"wr-table__sort-btn\"\n [attr.aria-label]=\"sortLabelFor(headerName(col.column))\"\n (click)=\"cycleSort(col.key)\"\n >\n <wr-table-sort [direction]=\"directionFor(col.key)\" />\n </button>\n <!-- A column's place in a multi-column sort. Drawn, because only the\n primary key announces `aria-sort` (see ariaSortFor). Beside the\n button rather than in it: inside, the digit is visible text the\n button's name (\"Sort Role\") does not contain, which is a WCAG\n 2.5.3 label-in-name failure. Hidden, so the column header's own\n name stays its title. -->\n @if (sortOrderFor(col.key); as order) {\n <span class=\"wr-table__sort-order\" aria-hidden=\"true\">{{ order }}</span>\n }\n }\n\n @if (col.column.filterItems; as filterItems) {\n @if (filterItems.length) {\n <wr-table-filter\n [items]=\"filterItems\"\n [column]=\"headerName(col.column)\"\n (selectionChange)=\"onFilter(col.key, $event)\"\n />\n }\n }\n </div>\n\n @if (col.column.resizable) {\n <span\n class=\"wr-table__resize-handle\"\n aria-hidden=\"true\"\n (pointerdown)=\"onResizeStart($event, col.key, thCell)\"\n (pointermove)=\"onResizeMove($event)\"\n (pointerup)=\"onResizeEnd($event)\"\n (pointercancel)=\"onResizeEnd($event)\"\n (mousedown)=\"$event.stopPropagation()\"\n (touchstart)=\"$event.stopPropagation()\"\n ></span>\n }\n </th>\n }\n </tr>\n </thead>\n\n <!-- One delegated listener for `rowClick`, which is pointer only by contract:\n the body is no control, and a row's keyboard path is the consumer's own\n button or link in a cell. The other three serve inline editing and\n return at once in a table with no edit template. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <tbody\n (click)=\"onBodyClick($event)\"\n (dblclick)=\"onCellDblclick($event)\"\n (keydown)=\"onCellKeydown($event)\"\n (focusin)=\"onCellFocusin($event)\"\n >\n @if (visibleItems()) {\n @if (virtualized() && virtualWindow().padTop > 0) {\n <tr class=\"wr-table__spacer\" aria-hidden=\"true\">\n <td [attr.colspan]=\"totalCols()\" [style.height.px]=\"virtualWindow().padTop\"></td>\n </tr>\n }\n @let edit = editing();\n @for (entry of windowRows(); track entry.id; let i = $index) {\n @if (entry.kind === 'group') {\n <tr class=\"wr-table__group-row\" [class.wr-table__group-row--collapsed]=\"entry.group.collapsed\">\n <td class=\"wr-table__group-cell\" [attr.colspan]=\"totalCols()\">\n <!-- The cell spans the full table width; this inner box is what sticks. -->\n <div class=\"wr-table__group-inner\">\n @if (rowSelection() === 'multiple') {\n <wr-checkbox\n class=\"wr-table__group-select\"\n size=\"sm\"\n [checked]=\"groupChecked(entry.group.rows)\"\n [indeterminate]=\"groupIndeterminate(entry.group.rows)\"\n (checkedChange)=\"toggleGroupSelection(entry.group.rows, $event)\"\n [ariaLabelledby]=\"groupControlLabelledby('select-group', entry.id)\"\n />\n }\n @if (groupTemplate(); as tpl) {\n <button\n type=\"button\"\n class=\"wr-table__group-toggle wr-table__group-toggle--icon\"\n [attr.aria-expanded]=\"!entry.group.collapsed\"\n [attr.aria-labelledby]=\"groupControlLabelledby('toggle-group', entry.id)\"\n (click)=\"toggleGroupCollapse(entry.group.value)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__group-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"entry.group\" />\n <!-- The group's name for the two controls above. A custom header\n is the consumer's markup, with nothing in it to point at. -->\n <span hidden [id]=\"groupLabelId(entry.id)\">{{ entry.group.label }}</span>\n } @else {\n <button\n type=\"button\"\n class=\"wr-table__group-toggle\"\n [attr.aria-expanded]=\"!entry.group.collapsed\"\n [attr.aria-labelledby]=\"groupToggleLabelledby(entry.id)\"\n (click)=\"toggleGroupCollapse(entry.group.value)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__group-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n <span class=\"wr-table__group-label\" [id]=\"groupLabelId(entry.id)\">{{ entry.group.label }}</span>\n @if (showGroupCount()) {\n <!-- A real space between the label and the count. Whitespace\n alone draws nothing in a flex row, and without it the\n button's text reads \"admin2\" — which the name\n \"Toggle group admin 2\" does not contain, a label-in-name\n mismatch for any tool that compares the two. -->\n &ngsp;<span class=\"wr-table__group-count\" [id]=\"groupCountId(entry.id)\">{{\n entry.group.count\n }}</span>\n }\n </button>\n }\n </div>\n </td>\n </tr>\n } @else if (entry.kind === 'group-foot') {\n <tr class=\"wr-table__group-foot-row\">\n @if (rowSelection()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @if (expandable()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @for (col of cellColumns(); track col.key) {\n <td\n [class]=\"col.footClass\"\n [class.wr-table__td--pin-left]=\"col.pinLeft\"\n [class.wr-table__td--pin-right]=\"col.pinRight\"\n [class.wr-table__td--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__td--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n >\n {{ entry.summaries.get(col.key) ?? '' }}\n </td>\n }\n </tr>\n } @else {\n <tr\n #rowEl\n [class]=\"rowClasses(entry.row, i)\"\n [class.wr-table__tr--selected]=\"rowSelection() && isRowSelected(entry.row)\"\n [class.wr-table__tr--child]=\"entry.depth > 0\"\n [attr.aria-rowindex]=\"virtualized() ? windowStart() + i + 2 : null\"\n [attr.aria-level]=\"treeMode() ? entry.depth + 1 : null\"\n [attr.aria-posinset]=\"treeMode() ? entry.posinset : null\"\n [attr.aria-setsize]=\"treeMode() ? entry.setsize : null\"\n [attr.aria-expanded]=\"entry.open\"\n [attr.aria-selected]=\"treeMode() && rowSelection() ? isRowSelected(entry.row) : null\"\n [attr.tabindex]=\"treeMode() ? (entry.id === tabStopRowId() ? 0 : -1) : null\"\n [style.--wr-table-depth]=\"treeMode() ? entry.depth : null\"\n >\n @if (rowSelection()) {\n <td class=\"wr-table__td wr-table__td--select\">\n <wr-checkbox\n size=\"sm\"\n [checked]=\"isRowSelected(entry.row)\"\n (checkedChange)=\"toggleRow(entry.row, $event)\"\n [ariaLabelledby]=\"rowControlLabelledby('select-row', entry.id)\"\n />\n </td>\n }\n @if (expandable()) {\n <td class=\"wr-table__td wr-table__td--expand\">\n <button\n type=\"button\"\n class=\"wr-table__expand-btn\"\n [class.wr-table__expand-btn--open]=\"isExpanded(entry.row)\"\n [attr.aria-expanded]=\"isExpanded(entry.row)\"\n [attr.aria-labelledby]=\"rowControlLabelledby('expand-row', entry.id)\"\n (click)=\"toggleExpand(entry.row)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__expand-icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n </td>\n }\n @for (col of cellColumns(); track col.key) {\n @let cellEdit = edit !== null && edit.row === entry.row && edit.key === col.key ? edit : null;\n <td\n [class]=\"col.tdClass\"\n [class.wr-table__td--pin-left]=\"col.pinLeft\"\n [class.wr-table__td--pin-right]=\"col.pinRight\"\n [class.wr-table__td--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__td--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n [style.max-width.px]=\"col.maxWidth\"\n [attr.data-label]=\"col.column.title\"\n [attr.id]=\"col.label ? rowLabelId(entry.id) : null\"\n [attr.tabindex]=\"editGrid() ? cellTabindex(entry, col) : null\"\n [class.wr-table__td--editable]=\"col.editTemplate ? cellEditable(entry.row, col) : false\"\n [class.wr-table__td--editing]=\"cellEdit !== null\"\n >\n @if (col.tree) {\n <span class=\"wr-table__tree-lead\">\n @if (entry.parent) {\n <button\n type=\"button\"\n class=\"wr-table__tree-toggle\"\n [class.wr-table__tree-toggle--open]=\"entry.open\"\n [attr.aria-expanded]=\"entry.open\"\n [attr.aria-labelledby]=\"rowControlLabelledby('toggle-row', entry.id)\"\n (click)=\"toggleTreeRow(entry.row)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__tree-icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n } @else {\n <span class=\"wr-table__tree-toggle wr-table__tree-toggle--leaf\" aria-hidden=\"true\"></span>\n }\n </span>\n }\n @if (cellEdit) {\n <ng-container\n [ngTemplateOutlet]=\"col.editTemplate ?? null\"\n [ngTemplateOutletContext]=\"cellEdit.context\"\n />\n } @else if (col.template; as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"cellContext(entry.row, col)\" />\n } @else {\n {{ cellText(entry.row, col.key, col.column) }}\n }\n </td>\n }\n </tr>\n @if (expandable() && isExpanded(entry.row)) {\n <tr class=\"wr-table__detail-row\">\n <td class=\"wr-table__detail\" [attr.colspan]=\"totalCols()\">\n <ng-container\n [ngTemplateOutlet]=\"expandTemplate() ?? null\"\n [ngTemplateOutletContext]=\"expandContext(entry.row)\"\n />\n </td>\n </tr>\n }\n }\n }\n @if (virtualized() && virtualWindow().padBottom > 0) {\n <tr class=\"wr-table__spacer\" aria-hidden=\"true\">\n <td [attr.colspan]=\"totalCols()\" [style.height.px]=\"virtualWindow().padBottom\"></td>\n </tr>\n }\n }\n <!-- Sibling of the row loop rather than its `@empty` branch, and gated on\n `loading()`. As the `@empty` branch it lived INSIDE `@if (visibleItems())`,\n which passes a nullish `[items]` straight through — so the input's own\n default rendered a header over a blank body with no \"No data\" anywhere,\n the opposite of what `items`'s docs promise. And the veil is translucent,\n so on the documented `[items]=\"[]\" [loading]=\"true\"` pair the row read\n \"No data\" through the spinner. -->\n @if (!loading() && !renderRows().length) {\n <tr>\n <td class=\"wr-table__empty\" [attr.colspan]=\"totalCols()\">{{ resolvedEmptyLabel() }}</td>\n </tr>\n }\n </tbody>\n\n @if (hasSummary() && items()?.length) {\n <tfoot #foot>\n <tr class=\"wr-table__foot-row\">\n @if (rowSelection()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @if (expandable()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @for (col of cellColumns(); track col.key) {\n <td\n [class]=\"col.footClass\"\n [class.wr-table__td--pin-left]=\"col.pinLeft\"\n [class.wr-table__td--pin-right]=\"col.pinRight\"\n [class.wr-table__td--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__td--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n >\n {{ summaryFor(col.key) }}\n </td>\n }\n </tr>\n </tfoot>\n }\n </table>\n</div>\n\n@if (showPager()) {\n <div class=\"wr-table__pager\">\n <wr-pagination\n [page]=\"page()\"\n (pageChange)=\"onPagerPage($event)\"\n [pageSize]=\"currentPageSize()\"\n (pageSizeChange)=\"onPageSizeChange($event)\"\n [total]=\"resolvedTotal()\"\n [size]=\"paginationSize()\"\n [showSizeChanger]=\"pageSizeOptions().length > 0\"\n [pageSizeOptions]=\"pageSizeOptions()\"\n />\n </div>\n}\n\n<!-- The table's one tooltip, for a header hint or a cut cell (see `tip`). -->\n@if (tip(); as shown) {\n <span hidden [wrPopover]=\"shown.text\" mode=\"tooltip\" [wrPopoverOrigin]=\"shown.el\"></span>\n}\n\n<!-- The action words the row and group controls are named with, once per table.\n `aria-labelledby` reads a hidden element it points at, so each control joins\n one of these to its own row's (or group's) label. Only the words a control\n in this table uses are rendered. -->\n@if (rowSelection() || expandable() || treeMode() || groupBy() !== null) {\n <div hidden>\n @if (rowSelection()) {\n <span [id]=\"actionId('select-row')\">{{ resolvedSelectRowLabel() }}</span>\n }\n @if (expandable()) {\n <span [id]=\"actionId('expand-row')\">{{ resolvedExpandRowLabel() }}</span>\n }\n @if (treeMode()) {\n <span [id]=\"actionId('toggle-row')\">{{ resolvedToggleRowLabel() }}</span>\n }\n @if (groupBy() !== null) {\n @if (rowSelection() === 'multiple') {\n <span [id]=\"actionId('select-group')\">{{ resolvedSelectGroupLabel() }}</span>\n }\n <span [id]=\"actionId('toggle-group')\">{{ resolvedToggleGroupLabel() }}</span>\n }\n </div>\n}\n",
|
|
2663
2812
|
dependencies: [
|
|
2664
2813
|
{
|
|
2665
2814
|
kind: "directive",
|
|
@@ -2784,6 +2933,16 @@ var WrTable = class WrTable {
|
|
|
2784
2933
|
],
|
|
2785
2934
|
outputs: ["pageChange", "pageSizeChange"]
|
|
2786
2935
|
},
|
|
2936
|
+
{
|
|
2937
|
+
kind: "component",
|
|
2938
|
+
type: WrTableColumnChooser,
|
|
2939
|
+
selector: "wr-table-column-chooser",
|
|
2940
|
+
inputs: [
|
|
2941
|
+
"table",
|
|
2942
|
+
"showAllLabel",
|
|
2943
|
+
"ariaLabel"
|
|
2944
|
+
]
|
|
2945
|
+
},
|
|
2787
2946
|
{
|
|
2788
2947
|
kind: "directive",
|
|
2789
2948
|
type: WrPopover,
|
|
@@ -2863,12 +3022,13 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2863
3022
|
WrButton,
|
|
2864
3023
|
WrCheckbox,
|
|
2865
3024
|
WrPagination,
|
|
3025
|
+
WrTableColumnChooser,
|
|
2866
3026
|
WrPopover,
|
|
2867
3027
|
WrSpinner,
|
|
2868
3028
|
WrTableSort,
|
|
2869
3029
|
WrTableFilter
|
|
2870
3030
|
],
|
|
2871
|
-
template: "@switch (loadingForm()) {\n @case ('overlay') {\n <div class=\"wr-table__loading\" role=\"status\" [attr.aria-label]=\"resolvedLoadingLabel()\">\n <wr-spinner size=\"lg\" />\n </div>\n }\n @case ('bar') {\n <div class=\"wr-table__loading-bar\" role=\"status\" [attr.aria-label]=\"resolvedLoadingLabel()\"></div>\n }\n}\n\n@if (columnChooser()) {\n <div class=\"wr-table__toolbar\">\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-table__columns-btn\"\n position=\"bottom-end\"\n [wrPopover]=\"chooser\"\n [ariaLabel]=\"resolvedColumnsLabel()\"\n >\n {{ resolvedColumnsLabel() }}\n </button>\n <ng-template #chooser>\n <div class=\"wr-table__columns\">\n @for (entry of chooserColumns(); track entry.key) {\n <wr-checkbox\n class=\"wr-table__columns-item\"\n size=\"sm\"\n [checked]=\"entry.visible\"\n [disabled]=\"entry.locked\"\n (checkedChange)=\"setColumnVisible(entry.key, $event)\"\n >{{ entry.title }}</wr-checkbox\n >\n }\n </div>\n </ng-template>\n </div>\n}\n\n<!-- The selection bar lies over the header: a box of no height in front of\n the scroll area, so the bar stays put while the columns scroll under it.\n The count is announced from a region that is in the DOM before it has\n anything to say, and the drawn copy is hidden from it. -->\n@if (hasSelectionBar()) {\n <div class=\"wr-table__selection\">\n <span class=\"wr-table__selection-status\" role=\"status\">{{ selectionBar() ? selectionCountText() : '' }}</span>\n @if (selectionBar(); as tpl) {\n <div\n #selectionBarEl\n class=\"wr-table__selection-bar\"\n [class.wr-table__selection-bar--inset]=\"rowSelection() === 'multiple'\"\n [style.--wr-table-selection-bar-height.px]=\"selectionBarHeight()\"\n >\n <span class=\"wr-table__selection-count\" aria-hidden=\"true\">{{ selectionCountText() }}</span>\n <button wr-btn type=\"button\" size=\"sm\" class=\"wr-table__selection-clear\" (click)=\"clearSelection()\">\n {{ resolvedClearSelectionLabel() }}\n </button>\n <div class=\"wr-table__selection-actions\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"selectionContext()\" />\n </div>\n </div>\n }\n </div>\n}\n\n<!-- With a selection bar the scroll area takes focus from script, for the bar\n to hand it to when it leaves a table that has no checkbox to take it. -->\n<div\n class=\"wr-table__scroll\"\n #scroll\n [style.--wr-table-scroll-height]=\"scrollHeight()\"\n [style.--wr-table-head-height.px]=\"stickyEdges().head\"\n [style.--wr-table-foot-height.px]=\"stickyEdges().foot\"\n [attr.tabindex]=\"scrollable() ? 0 : hasSelectionBar() ? -1 : null\"\n>\n <table\n class=\"wr-table__table\"\n [class.wr-table__table--fixed]=\"fixedLayoutActive()\"\n [style.--wr-table-row-h.px]=\"virtualized() ? effRowH() : null\"\n [attr.aria-rowcount]=\"virtualized() ? renderRows().length + 1 + (hasSummary() && items()?.length ? 1 : 0) : null\"\n [attr.role]=\"treeMode() ? 'treegrid' : editGrid() ? 'grid' : null\"\n [attr.aria-multiselectable]=\"treeMode() && rowSelection() === 'multiple' ? true : null\"\n >\n <colgroup>\n @if (rowSelection()) {\n <col class=\"wr-table__col--lead\" />\n }\n @if (expandable()) {\n <col class=\"wr-table__col--lead\" />\n }\n @for (col of cellColumns(); track col.key) {\n <col [style.width.px]=\"col.width\" />\n }\n </colgroup>\n <thead #head>\n <tr\n cdkDropList\n cdkDropListOrientation=\"horizontal\"\n [cdkDropListSortPredicate]=\"sortPredicate\"\n (cdkDropListDropped)=\"onColumnDrop($event)\"\n (cdkDropListSorted)=\"onColumnListSorted($event)\"\n (cdkDropListEntered)=\"onColumnListEntered()\"\n (cdkDropListExited)=\"onColumnListExited()\"\n >\n @if (rowSelection()) {\n <th class=\"wr-table__th wr-table__th--select\">\n @if (rowSelection() === 'multiple') {\n <!-- Disabled with nothing to sweep, the way `wr-transfer` guards its\n own select-all. `[checked]` is a one-way binding over a checkbox\n that owns its state, and on zero rows `allSelected()` answers\n `false` before and after the click — an unchanged input is never\n written back, so the box latched CHECKED over an empty table and\n stayed that way when rows returned. -->\n <wr-checkbox\n size=\"sm\"\n [checked]=\"allSelected()\"\n [indeterminate]=\"someSelected()\"\n [disabled]=\"selectAllKeys().size === 0\"\n (checkedChange)=\"toggleAll($event)\"\n [ariaLabel]=\"resolvedSelectAllLabel()\"\n />\n }\n </th>\n }\n @if (expandable()) {\n <th class=\"wr-table__th wr-table__th--expand\"></th>\n }\n <!-- `inert` under the selection bar: a control the bar covers takes no\n focus and no click. The select-all cell stays out from under it. -->\n @for (col of cellColumns(); track col.key) {\n <th\n #thCell\n cdkDrag\n [attr.inert]=\"selectionBar() ? '' : null\"\n [cdkDragDisabled]=\"!reorderable() || col.pinned\"\n (cdkDragStarted)=\"onColumnDragStart($event)\"\n (cdkDragMoved)=\"onColumnDragMoved($event)\"\n (cdkDragEnded)=\"onColumnDragEnd()\"\n [class]=\"col.thClass\"\n [attr.aria-sort]=\"ariaSortFor(col.key, col.column.sortable)\"\n [attr.aria-label]=\"col.column.title ? null : (col.column.headerHint ?? null)\"\n [class.wr-table__th--draggable]=\"reorderable() && !col.pinned\"\n [class.wr-table__th--pin-left]=\"col.pinLeft\"\n [class.wr-table__th--pin-right]=\"col.pinRight\"\n [class.wr-table__th--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__th--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n >\n <div class=\"wr-table__th-inner\">\n <span class=\"wr-table__title\">{{ col.column.title }}</span>\n\n @if (col.column.sortable) {\n <button\n type=\"button\"\n class=\"wr-table__sort-btn\"\n [attr.aria-label]=\"sortLabelFor(headerName(col.column))\"\n (click)=\"cycleSort(col.key)\"\n >\n <wr-table-sort [direction]=\"directionFor(col.key)\" />\n </button>\n <!-- A column's place in a multi-column sort. Drawn, because only the\n primary key announces `aria-sort` (see ariaSortFor). Beside the\n button rather than in it: inside, the digit is visible text the\n button's name (\"Sort Role\") does not contain, which is a WCAG\n 2.5.3 label-in-name failure. Hidden, so the column header's own\n name stays its title. -->\n @if (sortOrderFor(col.key); as order) {\n <span class=\"wr-table__sort-order\" aria-hidden=\"true\">{{ order }}</span>\n }\n }\n\n @if (col.column.filterItems; as filterItems) {\n @if (filterItems.length) {\n <wr-table-filter\n [items]=\"filterItems\"\n [column]=\"headerName(col.column)\"\n (selectionChange)=\"onFilter(col.key, $event)\"\n />\n }\n }\n </div>\n\n @if (col.column.resizable) {\n <span\n class=\"wr-table__resize-handle\"\n aria-hidden=\"true\"\n (pointerdown)=\"onResizeStart($event, col.key, thCell)\"\n (pointermove)=\"onResizeMove($event)\"\n (pointerup)=\"onResizeEnd($event)\"\n (pointercancel)=\"onResizeEnd($event)\"\n (mousedown)=\"$event.stopPropagation()\"\n (touchstart)=\"$event.stopPropagation()\"\n ></span>\n }\n </th>\n }\n </tr>\n </thead>\n\n <!-- One delegated listener for `rowClick`, which is pointer only by contract:\n the body is no control, and a row's keyboard path is the consumer's own\n button or link in a cell. The other three serve inline editing and\n return at once in a table with no edit template. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <tbody\n (click)=\"onBodyClick($event)\"\n (dblclick)=\"onCellDblclick($event)\"\n (keydown)=\"onCellKeydown($event)\"\n (focusin)=\"onCellFocusin($event)\"\n >\n @if (visibleItems()) {\n @if (virtualized() && virtualWindow().padTop > 0) {\n <tr class=\"wr-table__spacer\" aria-hidden=\"true\">\n <td [attr.colspan]=\"totalCols()\" [style.height.px]=\"virtualWindow().padTop\"></td>\n </tr>\n }\n @let edit = editing();\n @for (entry of windowRows(); track entry.id; let i = $index) {\n @if (entry.kind === 'group') {\n <tr class=\"wr-table__group-row\" [class.wr-table__group-row--collapsed]=\"entry.group.collapsed\">\n <td class=\"wr-table__group-cell\" [attr.colspan]=\"totalCols()\">\n <!-- The cell spans the full table width; this inner box is what sticks. -->\n <div class=\"wr-table__group-inner\">\n @if (rowSelection() === 'multiple') {\n <wr-checkbox\n class=\"wr-table__group-select\"\n size=\"sm\"\n [checked]=\"groupChecked(entry.group.rows)\"\n [indeterminate]=\"groupIndeterminate(entry.group.rows)\"\n (checkedChange)=\"toggleGroupSelection(entry.group.rows, $event)\"\n [ariaLabelledby]=\"groupControlLabelledby('select-group', entry.id)\"\n />\n }\n @if (groupTemplate(); as tpl) {\n <button\n type=\"button\"\n class=\"wr-table__group-toggle wr-table__group-toggle--icon\"\n [attr.aria-expanded]=\"!entry.group.collapsed\"\n [attr.aria-labelledby]=\"groupControlLabelledby('toggle-group', entry.id)\"\n (click)=\"toggleGroupCollapse(entry.group.value)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__group-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"entry.group\" />\n <!-- The group's name for the two controls above. A custom header\n is the consumer's markup, with nothing in it to point at. -->\n <span hidden [id]=\"groupLabelId(entry.id)\">{{ entry.group.label }}</span>\n } @else {\n <button\n type=\"button\"\n class=\"wr-table__group-toggle\"\n [attr.aria-expanded]=\"!entry.group.collapsed\"\n [attr.aria-labelledby]=\"groupToggleLabelledby(entry.id)\"\n (click)=\"toggleGroupCollapse(entry.group.value)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__group-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n <span class=\"wr-table__group-label\" [id]=\"groupLabelId(entry.id)\">{{ entry.group.label }}</span>\n @if (showGroupCount()) {\n <!-- A real space between the label and the count. Whitespace\n alone draws nothing in a flex row, and without it the\n button's text reads \"admin2\" — which the name\n \"Toggle group admin 2\" does not contain, a label-in-name\n mismatch for any tool that compares the two. -->\n &ngsp;<span class=\"wr-table__group-count\" [id]=\"groupCountId(entry.id)\">{{\n entry.group.count\n }}</span>\n }\n </button>\n }\n </div>\n </td>\n </tr>\n } @else if (entry.kind === 'group-foot') {\n <tr class=\"wr-table__group-foot-row\">\n @if (rowSelection()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @if (expandable()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @for (col of cellColumns(); track col.key) {\n <td\n [class]=\"col.footClass\"\n [class.wr-table__td--pin-left]=\"col.pinLeft\"\n [class.wr-table__td--pin-right]=\"col.pinRight\"\n [class.wr-table__td--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__td--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n >\n {{ entry.summaries.get(col.key) ?? '' }}\n </td>\n }\n </tr>\n } @else {\n <tr\n #rowEl\n [class]=\"rowClasses(entry.row, i)\"\n [class.wr-table__tr--selected]=\"rowSelection() && isRowSelected(entry.row)\"\n [class.wr-table__tr--child]=\"entry.depth > 0\"\n [attr.aria-rowindex]=\"virtualized() ? windowStart() + i + 2 : null\"\n [attr.aria-level]=\"treeMode() ? entry.depth + 1 : null\"\n [attr.aria-posinset]=\"treeMode() ? entry.posinset : null\"\n [attr.aria-setsize]=\"treeMode() ? entry.setsize : null\"\n [attr.aria-expanded]=\"entry.open\"\n [attr.aria-selected]=\"treeMode() && rowSelection() ? isRowSelected(entry.row) : null\"\n [attr.tabindex]=\"treeMode() ? (entry.id === tabStopRowId() ? 0 : -1) : null\"\n [style.--wr-table-depth]=\"treeMode() ? entry.depth : null\"\n >\n @if (rowSelection()) {\n <td class=\"wr-table__td wr-table__td--select\">\n <wr-checkbox\n size=\"sm\"\n [checked]=\"isRowSelected(entry.row)\"\n (checkedChange)=\"toggleRow(entry.row, $event)\"\n [ariaLabelledby]=\"rowControlLabelledby('select-row', entry.id)\"\n />\n </td>\n }\n @if (expandable()) {\n <td class=\"wr-table__td wr-table__td--expand\">\n <button\n type=\"button\"\n class=\"wr-table__expand-btn\"\n [class.wr-table__expand-btn--open]=\"isExpanded(entry.row)\"\n [attr.aria-expanded]=\"isExpanded(entry.row)\"\n [attr.aria-labelledby]=\"rowControlLabelledby('expand-row', entry.id)\"\n (click)=\"toggleExpand(entry.row)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__expand-icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n </td>\n }\n @for (col of cellColumns(); track col.key) {\n @let cellEdit = edit !== null && edit.row === entry.row && edit.key === col.key ? edit : null;\n <td\n [class]=\"col.tdClass\"\n [class.wr-table__td--pin-left]=\"col.pinLeft\"\n [class.wr-table__td--pin-right]=\"col.pinRight\"\n [class.wr-table__td--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__td--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n [style.max-width.px]=\"col.maxWidth\"\n [attr.data-label]=\"col.column.title\"\n [attr.id]=\"col.label ? rowLabelId(entry.id) : null\"\n [attr.tabindex]=\"editGrid() ? cellTabindex(entry, col) : null\"\n [class.wr-table__td--editable]=\"col.editTemplate ? cellEditable(entry.row, col) : false\"\n [class.wr-table__td--editing]=\"cellEdit !== null\"\n >\n @if (col.tree) {\n <span class=\"wr-table__tree-lead\">\n @if (entry.parent) {\n <button\n type=\"button\"\n class=\"wr-table__tree-toggle\"\n [class.wr-table__tree-toggle--open]=\"entry.open\"\n [attr.aria-expanded]=\"entry.open\"\n [attr.aria-labelledby]=\"rowControlLabelledby('toggle-row', entry.id)\"\n (click)=\"toggleTreeRow(entry.row)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__tree-icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n } @else {\n <span class=\"wr-table__tree-toggle wr-table__tree-toggle--leaf\" aria-hidden=\"true\"></span>\n }\n </span>\n }\n @if (cellEdit) {\n <ng-container\n [ngTemplateOutlet]=\"col.editTemplate ?? null\"\n [ngTemplateOutletContext]=\"cellEdit.context\"\n />\n } @else if (col.template; as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"cellContext(entry.row, col)\" />\n } @else {\n {{ cellText(entry.row, col.key, col.column) }}\n }\n </td>\n }\n </tr>\n @if (expandable() && isExpanded(entry.row)) {\n <tr class=\"wr-table__detail-row\">\n <td class=\"wr-table__detail\" [attr.colspan]=\"totalCols()\">\n <ng-container\n [ngTemplateOutlet]=\"expandTemplate() ?? null\"\n [ngTemplateOutletContext]=\"expandContext(entry.row)\"\n />\n </td>\n </tr>\n }\n }\n }\n @if (virtualized() && virtualWindow().padBottom > 0) {\n <tr class=\"wr-table__spacer\" aria-hidden=\"true\">\n <td [attr.colspan]=\"totalCols()\" [style.height.px]=\"virtualWindow().padBottom\"></td>\n </tr>\n }\n }\n <!-- Sibling of the row loop rather than its `@empty` branch, and gated on\n `loading()`. As the `@empty` branch it lived INSIDE `@if (visibleItems())`,\n which passes a nullish `[items]` straight through — so the input's own\n default rendered a header over a blank body with no \"No data\" anywhere,\n the opposite of what `items`'s docs promise. And the veil is translucent,\n so on the documented `[items]=\"[]\" [loading]=\"true\"` pair the row read\n \"No data\" through the spinner. -->\n @if (!loading() && !renderRows().length) {\n <tr>\n <td class=\"wr-table__empty\" [attr.colspan]=\"totalCols()\">{{ resolvedEmptyLabel() }}</td>\n </tr>\n }\n </tbody>\n\n @if (hasSummary() && items()?.length) {\n <tfoot #foot>\n <tr class=\"wr-table__foot-row\">\n @if (rowSelection()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @if (expandable()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @for (col of cellColumns(); track col.key) {\n <td\n [class]=\"col.footClass\"\n [class.wr-table__td--pin-left]=\"col.pinLeft\"\n [class.wr-table__td--pin-right]=\"col.pinRight\"\n [class.wr-table__td--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__td--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n >\n {{ summaryFor(col.key) }}\n </td>\n }\n </tr>\n </tfoot>\n }\n </table>\n</div>\n\n@if (showPager()) {\n <div class=\"wr-table__pager\">\n <wr-pagination\n [page]=\"page()\"\n (pageChange)=\"onPagerPage($event)\"\n [pageSize]=\"currentPageSize()\"\n (pageSizeChange)=\"onPageSizeChange($event)\"\n [total]=\"resolvedTotal()\"\n [size]=\"paginationSize()\"\n [showSizeChanger]=\"pageSizeOptions().length > 0\"\n [pageSizeOptions]=\"pageSizeOptions()\"\n />\n </div>\n}\n\n<!-- The table's one tooltip, for a header hint or a cut cell (see `tip`). -->\n@if (tip(); as shown) {\n <span hidden [wrPopover]=\"shown.text\" mode=\"tooltip\" [wrPopoverOrigin]=\"shown.el\"></span>\n}\n\n<!-- The action words the row and group controls are named with, once per table.\n `aria-labelledby` reads a hidden element it points at, so each control joins\n one of these to its own row's (or group's) label. Only the words a control\n in this table uses are rendered. -->\n@if (rowSelection() || expandable() || treeMode() || groupBy() !== null) {\n <div hidden>\n @if (rowSelection()) {\n <span [id]=\"actionId('select-row')\">{{ resolvedSelectRowLabel() }}</span>\n }\n @if (expandable()) {\n <span [id]=\"actionId('expand-row')\">{{ resolvedExpandRowLabel() }}</span>\n }\n @if (treeMode()) {\n <span [id]=\"actionId('toggle-row')\">{{ resolvedToggleRowLabel() }}</span>\n }\n @if (groupBy() !== null) {\n @if (rowSelection() === 'multiple') {\n <span [id]=\"actionId('select-group')\">{{ resolvedSelectGroupLabel() }}</span>\n }\n <span [id]=\"actionId('toggle-group')\">{{ resolvedToggleGroupLabel() }}</span>\n }\n </div>\n}\n"
|
|
3031
|
+
template: "@switch (loadingForm()) {\n @case ('overlay') {\n <div class=\"wr-table__loading\" role=\"status\" [attr.aria-label]=\"resolvedLoadingLabel()\">\n <wr-spinner size=\"lg\" />\n </div>\n }\n @case ('bar') {\n <div class=\"wr-table__loading-bar\" role=\"status\" [attr.aria-label]=\"resolvedLoadingLabel()\"></div>\n }\n}\n\n@if (columnChooser()) {\n <div class=\"wr-table__toolbar\">\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-table__columns-btn\"\n position=\"bottom-end\"\n [wrPopover]=\"chooser\"\n [ariaLabel]=\"resolvedColumnsLabel()\"\n >\n {{ resolvedColumnsLabel() }}\n </button>\n <ng-template #chooser>\n <div class=\"wr-table__columns\">\n <wr-table-column-chooser [table]=\"this\" [ariaLabel]=\"resolvedColumnsLabel()\" />\n </div>\n </ng-template>\n </div>\n}\n\n<!-- The selection bar lies over the header: a box of no height in front of\n the scroll area, so the bar stays put while the columns scroll under it.\n The count is announced from a region that is in the DOM before it has\n anything to say, and the drawn copy is hidden from it. -->\n@if (hasSelectionBar()) {\n <div class=\"wr-table__selection\">\n <span class=\"wr-table__selection-status\" role=\"status\">{{ selectionBar() ? selectionCountText() : '' }}</span>\n @if (selectionBar(); as tpl) {\n <div\n #selectionBarEl\n class=\"wr-table__selection-bar\"\n [class.wr-table__selection-bar--inset]=\"rowSelection() === 'multiple'\"\n [style.--wr-table-selection-bar-height.px]=\"selectionBarHeight()\"\n >\n <span class=\"wr-table__selection-count\" aria-hidden=\"true\">{{ selectionCountText() }}</span>\n <button wr-btn type=\"button\" size=\"sm\" class=\"wr-table__selection-clear\" (click)=\"clearSelection()\">\n {{ resolvedClearSelectionLabel() }}\n </button>\n <div class=\"wr-table__selection-actions\">\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"selectionContext()\" />\n </div>\n </div>\n }\n </div>\n}\n\n<!-- With a selection bar the scroll area takes focus from script, for the bar\n to hand it to when it leaves a table that has no checkbox to take it. -->\n<div\n class=\"wr-table__scroll\"\n #scroll\n [style.--wr-table-scroll-height]=\"scrollHeight()\"\n [style.--wr-table-head-height.px]=\"stickyEdges().head\"\n [style.--wr-table-foot-height.px]=\"stickyEdges().foot\"\n [attr.tabindex]=\"scrollable() ? 0 : hasSelectionBar() ? -1 : null\"\n>\n <table\n class=\"wr-table__table\"\n [class.wr-table__table--fixed]=\"fixedLayoutActive()\"\n [style.--wr-table-row-h.px]=\"virtualized() ? effRowH() : null\"\n [attr.aria-rowcount]=\"virtualized() ? renderRows().length + 1 + (hasSummary() && items()?.length ? 1 : 0) : null\"\n [attr.role]=\"treeMode() ? 'treegrid' : editGrid() ? 'grid' : null\"\n [attr.aria-multiselectable]=\"treeMode() && rowSelection() === 'multiple' ? true : null\"\n >\n <colgroup>\n @if (rowSelection()) {\n <col class=\"wr-table__col--lead\" />\n }\n @if (expandable()) {\n <col class=\"wr-table__col--lead\" />\n }\n @for (col of cellColumns(); track col.key) {\n <col [style.width.px]=\"col.width\" />\n }\n </colgroup>\n <thead #head>\n <tr\n cdkDropList\n cdkDropListOrientation=\"horizontal\"\n [cdkDropListSortPredicate]=\"sortPredicate\"\n (cdkDropListDropped)=\"onColumnDrop($event)\"\n (cdkDropListSorted)=\"onColumnListSorted($event)\"\n (cdkDropListEntered)=\"onColumnListEntered()\"\n (cdkDropListExited)=\"onColumnListExited()\"\n >\n @if (rowSelection()) {\n <th class=\"wr-table__th wr-table__th--select\">\n @if (rowSelection() === 'multiple') {\n <!-- Disabled with nothing to sweep, the way `wr-transfer` guards its\n own select-all. `[checked]` is a one-way binding over a checkbox\n that owns its state, and on zero rows `allSelected()` answers\n `false` before and after the click — an unchanged input is never\n written back, so the box latched CHECKED over an empty table and\n stayed that way when rows returned. -->\n <wr-checkbox\n size=\"sm\"\n [checked]=\"allSelected()\"\n [indeterminate]=\"someSelected()\"\n [disabled]=\"selectAllKeys().size === 0\"\n (checkedChange)=\"toggleAll($event)\"\n [ariaLabel]=\"resolvedSelectAllLabel()\"\n />\n }\n </th>\n }\n @if (expandable()) {\n <th class=\"wr-table__th wr-table__th--expand\"></th>\n }\n <!-- `inert` under the selection bar: a control the bar covers takes no\n focus and no click. The select-all cell stays out from under it. -->\n @for (col of cellColumns(); track col.key) {\n <th\n #thCell\n cdkDrag\n [attr.inert]=\"selectionBar() ? '' : null\"\n [cdkDragDisabled]=\"!reorderable() || col.pinned\"\n (cdkDragStarted)=\"onColumnDragStart($event)\"\n (cdkDragMoved)=\"onColumnDragMoved($event)\"\n (cdkDragEnded)=\"onColumnDragEnd()\"\n [class]=\"col.thClass\"\n [attr.aria-sort]=\"ariaSortFor(col.key, col.column.sortable)\"\n [attr.aria-label]=\"col.column.title ? null : (col.column.headerHint ?? null)\"\n [class.wr-table__th--draggable]=\"reorderable() && !col.pinned\"\n [class.wr-table__th--pin-left]=\"col.pinLeft\"\n [class.wr-table__th--pin-right]=\"col.pinRight\"\n [class.wr-table__th--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__th--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n >\n <div class=\"wr-table__th-inner\">\n <span class=\"wr-table__title\">{{ col.column.title }}</span>\n\n @if (col.column.sortable) {\n <button\n type=\"button\"\n class=\"wr-table__sort-btn\"\n [attr.aria-label]=\"sortLabelFor(headerName(col.column))\"\n (click)=\"cycleSort(col.key)\"\n >\n <wr-table-sort [direction]=\"directionFor(col.key)\" />\n </button>\n <!-- A column's place in a multi-column sort. Drawn, because only the\n primary key announces `aria-sort` (see ariaSortFor). Beside the\n button rather than in it: inside, the digit is visible text the\n button's name (\"Sort Role\") does not contain, which is a WCAG\n 2.5.3 label-in-name failure. Hidden, so the column header's own\n name stays its title. -->\n @if (sortOrderFor(col.key); as order) {\n <span class=\"wr-table__sort-order\" aria-hidden=\"true\">{{ order }}</span>\n }\n }\n\n @if (col.column.filterItems; as filterItems) {\n @if (filterItems.length) {\n <wr-table-filter\n [items]=\"filterItems\"\n [column]=\"headerName(col.column)\"\n (selectionChange)=\"onFilter(col.key, $event)\"\n />\n }\n }\n </div>\n\n @if (col.column.resizable) {\n <span\n class=\"wr-table__resize-handle\"\n aria-hidden=\"true\"\n (pointerdown)=\"onResizeStart($event, col.key, thCell)\"\n (pointermove)=\"onResizeMove($event)\"\n (pointerup)=\"onResizeEnd($event)\"\n (pointercancel)=\"onResizeEnd($event)\"\n (mousedown)=\"$event.stopPropagation()\"\n (touchstart)=\"$event.stopPropagation()\"\n ></span>\n }\n </th>\n }\n </tr>\n </thead>\n\n <!-- One delegated listener for `rowClick`, which is pointer only by contract:\n the body is no control, and a row's keyboard path is the consumer's own\n button or link in a cell. The other three serve inline editing and\n return at once in a table with no edit template. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <tbody\n (click)=\"onBodyClick($event)\"\n (dblclick)=\"onCellDblclick($event)\"\n (keydown)=\"onCellKeydown($event)\"\n (focusin)=\"onCellFocusin($event)\"\n >\n @if (visibleItems()) {\n @if (virtualized() && virtualWindow().padTop > 0) {\n <tr class=\"wr-table__spacer\" aria-hidden=\"true\">\n <td [attr.colspan]=\"totalCols()\" [style.height.px]=\"virtualWindow().padTop\"></td>\n </tr>\n }\n @let edit = editing();\n @for (entry of windowRows(); track entry.id; let i = $index) {\n @if (entry.kind === 'group') {\n <tr class=\"wr-table__group-row\" [class.wr-table__group-row--collapsed]=\"entry.group.collapsed\">\n <td class=\"wr-table__group-cell\" [attr.colspan]=\"totalCols()\">\n <!-- The cell spans the full table width; this inner box is what sticks. -->\n <div class=\"wr-table__group-inner\">\n @if (rowSelection() === 'multiple') {\n <wr-checkbox\n class=\"wr-table__group-select\"\n size=\"sm\"\n [checked]=\"groupChecked(entry.group.rows)\"\n [indeterminate]=\"groupIndeterminate(entry.group.rows)\"\n (checkedChange)=\"toggleGroupSelection(entry.group.rows, $event)\"\n [ariaLabelledby]=\"groupControlLabelledby('select-group', entry.id)\"\n />\n }\n @if (groupTemplate(); as tpl) {\n <button\n type=\"button\"\n class=\"wr-table__group-toggle wr-table__group-toggle--icon\"\n [attr.aria-expanded]=\"!entry.group.collapsed\"\n [attr.aria-labelledby]=\"groupControlLabelledby('toggle-group', entry.id)\"\n (click)=\"toggleGroupCollapse(entry.group.value)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__group-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"entry.group\" />\n <!-- The group's name for the two controls above. A custom header\n is the consumer's markup, with nothing in it to point at. -->\n <span hidden [id]=\"groupLabelId(entry.id)\">{{ entry.group.label }}</span>\n } @else {\n <button\n type=\"button\"\n class=\"wr-table__group-toggle\"\n [attr.aria-expanded]=\"!entry.group.collapsed\"\n [attr.aria-labelledby]=\"groupToggleLabelledby(entry.id)\"\n (click)=\"toggleGroupCollapse(entry.group.value)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__group-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n <span class=\"wr-table__group-label\" [id]=\"groupLabelId(entry.id)\">{{ entry.group.label }}</span>\n @if (showGroupCount()) {\n <!-- A real space between the label and the count. Whitespace\n alone draws nothing in a flex row, and without it the\n button's text reads \"admin2\" — which the name\n \"Toggle group admin 2\" does not contain, a label-in-name\n mismatch for any tool that compares the two. -->\n &ngsp;<span class=\"wr-table__group-count\" [id]=\"groupCountId(entry.id)\">{{\n entry.group.count\n }}</span>\n }\n </button>\n }\n </div>\n </td>\n </tr>\n } @else if (entry.kind === 'group-foot') {\n <tr class=\"wr-table__group-foot-row\">\n @if (rowSelection()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @if (expandable()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @for (col of cellColumns(); track col.key) {\n <td\n [class]=\"col.footClass\"\n [class.wr-table__td--pin-left]=\"col.pinLeft\"\n [class.wr-table__td--pin-right]=\"col.pinRight\"\n [class.wr-table__td--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__td--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n >\n {{ entry.summaries.get(col.key) ?? '' }}\n </td>\n }\n </tr>\n } @else {\n <tr\n #rowEl\n [class]=\"rowClasses(entry.row, i)\"\n [class.wr-table__tr--selected]=\"rowSelection() && isRowSelected(entry.row)\"\n [class.wr-table__tr--child]=\"entry.depth > 0\"\n [attr.aria-rowindex]=\"virtualized() ? windowStart() + i + 2 : null\"\n [attr.aria-level]=\"treeMode() ? entry.depth + 1 : null\"\n [attr.aria-posinset]=\"treeMode() ? entry.posinset : null\"\n [attr.aria-setsize]=\"treeMode() ? entry.setsize : null\"\n [attr.aria-expanded]=\"entry.open\"\n [attr.aria-selected]=\"treeMode() && rowSelection() ? isRowSelected(entry.row) : null\"\n [attr.tabindex]=\"treeMode() ? (entry.id === tabStopRowId() ? 0 : -1) : null\"\n [style.--wr-table-depth]=\"treeMode() ? entry.depth : null\"\n >\n @if (rowSelection()) {\n <td class=\"wr-table__td wr-table__td--select\">\n <wr-checkbox\n size=\"sm\"\n [checked]=\"isRowSelected(entry.row)\"\n (checkedChange)=\"toggleRow(entry.row, $event)\"\n [ariaLabelledby]=\"rowControlLabelledby('select-row', entry.id)\"\n />\n </td>\n }\n @if (expandable()) {\n <td class=\"wr-table__td wr-table__td--expand\">\n <button\n type=\"button\"\n class=\"wr-table__expand-btn\"\n [class.wr-table__expand-btn--open]=\"isExpanded(entry.row)\"\n [attr.aria-expanded]=\"isExpanded(entry.row)\"\n [attr.aria-labelledby]=\"rowControlLabelledby('expand-row', entry.id)\"\n (click)=\"toggleExpand(entry.row)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__expand-icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n </td>\n }\n @for (col of cellColumns(); track col.key) {\n @let cellEdit = edit !== null && edit.row === entry.row && edit.key === col.key ? edit : null;\n <td\n [class]=\"col.tdClass\"\n [class.wr-table__td--pin-left]=\"col.pinLeft\"\n [class.wr-table__td--pin-right]=\"col.pinRight\"\n [class.wr-table__td--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__td--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n [style.max-width.px]=\"col.maxWidth\"\n [attr.data-label]=\"col.column.title\"\n [attr.id]=\"col.label ? rowLabelId(entry.id) : null\"\n [attr.tabindex]=\"editGrid() ? cellTabindex(entry, col) : null\"\n [class.wr-table__td--editable]=\"col.editTemplate ? cellEditable(entry.row, col) : false\"\n [class.wr-table__td--editing]=\"cellEdit !== null\"\n >\n @if (col.tree) {\n <span class=\"wr-table__tree-lead\">\n @if (entry.parent) {\n <button\n type=\"button\"\n class=\"wr-table__tree-toggle\"\n [class.wr-table__tree-toggle--open]=\"entry.open\"\n [attr.aria-expanded]=\"entry.open\"\n [attr.aria-labelledby]=\"rowControlLabelledby('toggle-row', entry.id)\"\n (click)=\"toggleTreeRow(entry.row)\"\n >\n <svg\n class=\"wr-icon__svg wr-table__tree-icon\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n } @else {\n <span class=\"wr-table__tree-toggle wr-table__tree-toggle--leaf\" aria-hidden=\"true\"></span>\n }\n </span>\n }\n @if (cellEdit) {\n <ng-container\n [ngTemplateOutlet]=\"col.editTemplate ?? null\"\n [ngTemplateOutletContext]=\"cellEdit.context\"\n />\n } @else if (col.template; as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" [ngTemplateOutletContext]=\"cellContext(entry.row, col)\" />\n } @else {\n {{ cellText(entry.row, col.key, col.column) }}\n }\n </td>\n }\n </tr>\n @if (expandable() && isExpanded(entry.row)) {\n <tr class=\"wr-table__detail-row\">\n <td class=\"wr-table__detail\" [attr.colspan]=\"totalCols()\">\n <ng-container\n [ngTemplateOutlet]=\"expandTemplate() ?? null\"\n [ngTemplateOutletContext]=\"expandContext(entry.row)\"\n />\n </td>\n </tr>\n }\n }\n }\n @if (virtualized() && virtualWindow().padBottom > 0) {\n <tr class=\"wr-table__spacer\" aria-hidden=\"true\">\n <td [attr.colspan]=\"totalCols()\" [style.height.px]=\"virtualWindow().padBottom\"></td>\n </tr>\n }\n }\n <!-- Sibling of the row loop rather than its `@empty` branch, and gated on\n `loading()`. As the `@empty` branch it lived INSIDE `@if (visibleItems())`,\n which passes a nullish `[items]` straight through — so the input's own\n default rendered a header over a blank body with no \"No data\" anywhere,\n the opposite of what `items`'s docs promise. And the veil is translucent,\n so on the documented `[items]=\"[]\" [loading]=\"true\"` pair the row read\n \"No data\" through the spinner. -->\n @if (!loading() && !renderRows().length) {\n <tr>\n <td class=\"wr-table__empty\" [attr.colspan]=\"totalCols()\">{{ resolvedEmptyLabel() }}</td>\n </tr>\n }\n </tbody>\n\n @if (hasSummary() && items()?.length) {\n <tfoot #foot>\n <tr class=\"wr-table__foot-row\">\n @if (rowSelection()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @if (expandable()) {\n <td class=\"wr-table__foot-cell wr-table__foot-cell--lead\"></td>\n }\n @for (col of cellColumns(); track col.key) {\n <td\n [class]=\"col.footClass\"\n [class.wr-table__td--pin-left]=\"col.pinLeft\"\n [class.wr-table__td--pin-right]=\"col.pinRight\"\n [class.wr-table__td--pin-edge-left]=\"col.edgeLeft\"\n [class.wr-table__td--pin-edge-right]=\"col.edgeRight\"\n [style.inset-inline-start.px]=\"col.start\"\n [style.inset-inline-end.px]=\"col.end\"\n >\n {{ summaryFor(col.key) }}\n </td>\n }\n </tr>\n </tfoot>\n }\n </table>\n</div>\n\n@if (showPager()) {\n <div class=\"wr-table__pager\">\n <wr-pagination\n [page]=\"page()\"\n (pageChange)=\"onPagerPage($event)\"\n [pageSize]=\"currentPageSize()\"\n (pageSizeChange)=\"onPageSizeChange($event)\"\n [total]=\"resolvedTotal()\"\n [size]=\"paginationSize()\"\n [showSizeChanger]=\"pageSizeOptions().length > 0\"\n [pageSizeOptions]=\"pageSizeOptions()\"\n />\n </div>\n}\n\n<!-- The table's one tooltip, for a header hint or a cut cell (see `tip`). -->\n@if (tip(); as shown) {\n <span hidden [wrPopover]=\"shown.text\" mode=\"tooltip\" [wrPopoverOrigin]=\"shown.el\"></span>\n}\n\n<!-- The action words the row and group controls are named with, once per table.\n `aria-labelledby` reads a hidden element it points at, so each control joins\n one of these to its own row's (or group's) label. Only the words a control\n in this table uses are rendered. -->\n@if (rowSelection() || expandable() || treeMode() || groupBy() !== null) {\n <div hidden>\n @if (rowSelection()) {\n <span [id]=\"actionId('select-row')\">{{ resolvedSelectRowLabel() }}</span>\n }\n @if (expandable()) {\n <span [id]=\"actionId('expand-row')\">{{ resolvedExpandRowLabel() }}</span>\n }\n @if (treeMode()) {\n <span [id]=\"actionId('toggle-row')\">{{ resolvedToggleRowLabel() }}</span>\n }\n @if (groupBy() !== null) {\n @if (rowSelection() === 'multiple') {\n <span [id]=\"actionId('select-group')\">{{ resolvedSelectGroupLabel() }}</span>\n }\n <span [id]=\"actionId('toggle-group')\">{{ resolvedToggleGroupLabel() }}</span>\n }\n </div>\n}\n"
|
|
2872
3032
|
}]
|
|
2873
3033
|
}],
|
|
2874
3034
|
ctorParameters: () => [],
|
|
@@ -3384,6 +3544,6 @@ function wrSortRows(rows, sort, accessor = wrReadField) {
|
|
|
3384
3544
|
return 0;
|
|
3385
3545
|
});
|
|
3386
3546
|
}
|
|
3387
|
-
export { WrTable, WrTableCell, WrTableEditCell, WrTableExpand, WrTableFilter, WrTableGroupHeader, WrTableSelectionBar, WrTableSort, wrReadField, wrSortRows };
|
|
3547
|
+
export { WrTable, WrTableCell, WrTableColumnChooser, WrTableEditCell, WrTableExpand, WrTableFilter, WrTableGroupHeader, WrTableSelectionBar, WrTableSort, wrReadField, wrSortRows };
|
|
3388
3548
|
|
|
3389
3549
|
//# sourceMappingURL=ngwr-table.mjs.map
|