xv-webcomponents 2.0.0-beta.2 → 2.0.0-beta.28
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/README.md +3 -2
- package/dist/angular/index.d.ts +1 -1
- package/dist/angular/index.js +3 -4
- package/dist/angular/proxies.d.ts +60 -34
- package/dist/angular/proxies.js +51 -67
- package/dist/angular/web-components.module.d.ts +1 -1
- package/dist/angular/web-components.module.js +10 -13
- package/dist/cjs/{index-Cfa6bBQW.js → index-DaTpiyaU.js} +1 -1
- package/dist/cjs/{index-Cixkr3sz.js → index-Dwhgrew8.js} +15 -10
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{xv-accordion-v2_50.cjs.entry.js → xv-accordion-v2_49.cjs.entry.js} +1529 -147
- package/dist/cjs/xv-header-next.cjs.entry.js +2 -2
- package/dist/cjs/xv-mega-menu-next.cjs.entry.js +2 -2
- package/dist/cjs/xv-webcomponents.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +1 -2
- package/dist/collection/components/xv-overflow-menu/xv-overflow-menu.js +9 -8
- package/dist/collection/components/xv-table/xv-table-cell/xv-table-cell.css +129 -61
- package/dist/collection/components/xv-table/xv-table-cell/xv-table-cell.js +277 -78
- package/dist/collection/components/xv-table/xv-table-row/xv-table-row.css +138 -24
- package/dist/collection/components/xv-table/xv-table-row/xv-table-row.js +334 -168
- package/dist/collection/components/xv-table/xv-table.css +240 -99
- package/dist/collection/components/xv-table/xv-table.js +2056 -63
- package/dist/collection/components/xv-table/xv-table.model.js +10 -0
- package/dist/collection/components/xv-table/xv-table.utils.js +243 -0
- package/dist/collection/components/xv-tabs/xv-tab/xv-tab.js +1 -1
- package/dist/collection/components/xv-tag/xv-tag.js +1 -1
- package/dist/collection/components/xv-tag-combobox/xv-tag-combobox.js +2 -2
- package/dist/collection/components/xv-text-input/xv-text-input.js +2 -2
- package/dist/collection/components/xv-textarea/xv-textarea.js +2 -2
- package/dist/collection/components/xv-tile/xv-tile.js +2 -2
- package/dist/collection/components/xv-toggle/xv-toggle.js +1 -1
- package/dist/collection/components/xv-toggle-tip/xv-toggle-tip.js +1 -1
- package/dist/collection/components/xv-tooltip/xv-tooltip.js +2 -2
- package/dist/collection/utils/table-layout.js +130 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-B0kwaJ8n.js +1 -0
- package/dist/components/{p-CbVZCn2p.js → p-BEoh0dZI.js} +1 -1
- package/dist/components/{p-ZYJfCCwX.js → p-BaZ-srfu.js} +1 -1
- package/dist/components/{p-DyGMZIub.js → p-Bej2l-wN.js} +1 -1
- package/dist/components/{p-Ddx5DwV5.js → p-BfhvpeQh.js} +1 -1
- package/dist/components/{p-kQVUwJXZ.js → p-CSYnNMKb.js} +1 -1
- package/dist/components/{p-BNP2Lw34.js → p-CspyoLL9.js} +1 -1
- package/dist/components/p-CvgDDcjp.js +1 -0
- package/dist/components/{p-COoj5JkZ.js → p-D4FwGeDJ.js} +1 -1
- package/dist/components/p-DCvH_Br_.js +1 -0
- package/dist/components/{p-CEjlxnKY.js → p-DFe9Mtw_.js} +1 -1
- package/dist/components/{p-BRZwUlfE.js → p-DFtMwE-h.js} +1 -1
- package/dist/components/p-DIvi4fI3.js +1 -0
- package/dist/components/{p-DTwz9Fsh.js → p-DNRISLNf.js} +1 -1
- package/dist/components/p-DPnvoOYj.js +1 -0
- package/dist/components/{p-Dzz9jxLm.js → p-Dwbe941A.js} +1 -1
- package/dist/components/{p-CMAJWZsP.js → p-JClekcEh.js} +1 -1
- package/dist/components/{p-DtUNYh73.js → p-NoM9oIJn.js} +1 -1
- package/dist/components/{p-DlLBjhuH.js → p-XEk4dHG3.js} +1 -1
- package/dist/components/p-i7_81si-.js +1 -0
- package/dist/components/{p-BRYrLHiz.js → p-i82EFiq6.js} +1 -1
- package/dist/components/{p-BXB4D7j4.js → p-jD7nSJaM.js} +1 -1
- package/dist/components/xv-accordion-v2-item.js +1 -1
- package/dist/components/xv-accordion-v2.js +1 -1
- package/dist/components/xv-breadcrumbs-v2.js +1 -1
- package/dist/components/xv-button-group-v2.js +1 -1
- package/dist/components/xv-button-v2.js +1 -1
- package/dist/components/xv-card-v2.js +1 -1
- package/dist/components/xv-checkbox-v2.js +1 -1
- package/dist/components/xv-content-switcher-item-v2.js +1 -1
- package/dist/components/xv-content-switcher-v2.js +1 -1
- package/dist/components/xv-data-table-cell.js +1 -1
- package/dist/components/xv-data-table-collapse.js +1 -1
- package/dist/components/xv-data-table-row.js +1 -1
- package/dist/components/xv-data-table.js +2 -2
- package/dist/components/xv-date-picker.js +1 -1
- package/dist/components/xv-datepicker.js +1 -1
- package/dist/components/xv-dropdown-v2-item.js +1 -1
- package/dist/components/xv-dropdown-v2.js +1 -1
- package/dist/components/xv-file-uploader.js +1 -1
- package/dist/components/xv-footer.js +1 -1
- package/dist/components/xv-geo-map-v2.js +1 -1
- package/dist/components/xv-header-next.js +1 -1
- package/dist/components/xv-header.js +1 -1
- package/dist/components/xv-image-viewer.js +1 -1
- package/dist/components/xv-link-v2.js +1 -1
- package/dist/components/xv-loader-v2.js +1 -1
- package/dist/components/xv-login-modal.js +1 -1
- package/dist/components/xv-mega-menu-next.js +1 -1
- package/dist/components/xv-mega-menu.js +1 -1
- package/dist/components/xv-modal-v2.js +1 -1
- package/dist/components/xv-notification-v2.js +1 -1
- package/dist/components/xv-number-input-v2.js +1 -1
- package/dist/components/xv-overflow-menu-v2-item.js +1 -1
- package/dist/components/xv-overflow-menu-v2.js +1 -1
- package/dist/components/xv-pagination.js +1 -1
- package/dist/components/xv-progress-indicator-v2-item.js +1 -1
- package/dist/components/xv-progress-indicator-v2.js +1 -1
- package/dist/components/xv-radio-v2.js +1 -1
- package/dist/components/xv-slider-v2.js +1 -1
- package/dist/components/xv-tab-v2.js +1 -1
- package/dist/components/{xv-table-v2-row.d.ts → xv-table-cell.d.ts} +4 -4
- package/dist/components/xv-table-cell.js +1 -0
- package/dist/components/{xv-table-v2-cell.d.ts → xv-table-row.d.ts} +4 -4
- package/dist/components/xv-table-row.js +1 -0
- package/dist/components/{xv-table-v2.d.ts → xv-table.d.ts} +4 -4
- package/dist/components/xv-table.js +1 -0
- package/dist/components/xv-tabs-v2.js +1 -1
- package/dist/components/xv-tag-combobox.js +1 -1
- package/dist/components/xv-tag-v2.js +1 -1
- package/dist/components/xv-text-input-v2.js +1 -1
- package/dist/components/xv-textarea.js +1 -1
- package/dist/components/xv-tile.js +1 -1
- package/dist/components/xv-toggle-tip.js +1 -1
- package/dist/components/xv-toggle.js +1 -1
- package/dist/components/xv-tooltip-v2.js +1 -1
- package/dist/custom-elements.json +1765 -294
- package/dist/docs.json +2749 -443
- package/dist/esm/{index-B6cY-_U1.js → index-ClusqSO5.js} +1 -1
- package/dist/esm/{index-Bu8SrOeR.js → index-DJC3-dS3.js} +15 -10
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{xv-accordion-v2_50.entry.js → xv-accordion-v2_49.entry.js} +1527 -144
- package/dist/esm/xv-header-next.entry.js +2 -2
- package/dist/esm/xv-mega-menu-next.entry.js +2 -2
- package/dist/esm/xv-webcomponents.js +4 -4
- package/dist/react/components.d.ts +3 -4
- package/dist/react/components.js +3 -4
- package/dist/react/{xv-table-v2-expand.d.ts → xv-table-cell.d.ts} +3 -3
- package/dist/react/xv-table-cell.js +14 -0
- package/dist/react/{xv-table-v2.d.ts → xv-table-row.d.ts} +3 -3
- package/dist/react/{xv-table-v2.js → xv-table-row.js} +5 -5
- package/dist/react/xv-table.d.ts +18 -0
- package/dist/react/xv-table.js +22 -0
- package/dist/types/components/xv-table/xv-table-cell/xv-table-cell.d.ts +43 -8
- package/dist/types/components/xv-table/xv-table-row/xv-table-row.d.ts +57 -18
- package/dist/types/components/xv-table/xv-table.d.ts +298 -9
- package/dist/types/components/xv-table/xv-table.model.d.ts +78 -0
- package/dist/types/components/xv-table/xv-table.utils.d.ts +47 -0
- package/dist/types/components.d.ts +899 -118
- package/dist/types/stencil-public-runtime.d.ts +61 -55
- package/dist/types/utils/table-layout.d.ts +7 -0
- package/dist/vscode-data.json +347 -56
- package/dist/xv-webcomponents/index.esm.js +1 -1
- package/dist/xv-webcomponents/{p-1ffb0b4f.entry.js → p-0c30d09f.entry.js} +1 -1
- package/dist/xv-webcomponents/{p-eb9d7750.entry.js → p-6b58979e.entry.js} +2 -2
- package/dist/xv-webcomponents/{p-Bu8SrOeR.js → p-DJC3-dS3.js} +2 -2
- package/dist/xv-webcomponents/{p-DB4KqDJz.js → p-DSFVdw3w.js} +1 -1
- package/dist/xv-webcomponents/{p-d4d26ff2.entry.js → p-c4173686.entry.js} +1 -1
- package/dist/xv-webcomponents/xv-webcomponents.esm.js +1 -1
- package/package.json +139 -139
- package/dist/collection/components/xv-table/_vars.js +0 -2
- package/dist/collection/components/xv-table/xv-table-expand/xv-table-expand.css +0 -58
- package/dist/collection/components/xv-table/xv-table-expand/xv-table-expand.js +0 -75
- package/dist/components/p-CHtssNO9.js +0 -1
- package/dist/components/p-CILNPUHH.js +0 -1
- package/dist/components/p-DVZ2BlIP.js +0 -1
- package/dist/components/p-bdaoJ1tx.js +0 -1
- package/dist/components/xv-table-v2-cell.js +0 -1
- package/dist/components/xv-table-v2-expand.d.ts +0 -11
- package/dist/components/xv-table-v2-expand.js +0 -1
- package/dist/components/xv-table-v2-row.js +0 -1
- package/dist/components/xv-table-v2.js +0 -1
- package/dist/react/xv-table-v2-cell.d.ts +0 -12
- package/dist/react/xv-table-v2-cell.js +0 -14
- package/dist/react/xv-table-v2-expand.js +0 -14
- package/dist/react/xv-table-v2-row.d.ts +0 -13
- package/dist/react/xv-table-v2-row.js +0 -17
- package/dist/types/components/xv-table/_vars.d.ts +0 -15
- package/dist/types/components/xv-table/xv-table-expand/xv-table-expand.d.ts +0 -8
|
@@ -1,43 +1,1043 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
2
|
import { SIZE_VAR } from "../../types/enum";
|
|
3
|
+
import { deleteLayout, readLayout, writeLayout } from "../../utils/table-layout";
|
|
4
|
+
import { XV_TABLE_CONTROL_WIDTH, XV_TABLE_CELL_TAG, XV_TABLE_MIN_COLUMN_WIDTH, XV_TABLE_ROW_TAG, } from "./xv-table.model";
|
|
5
|
+
import { applyLayout, buildColumnTemplate, buildColumnTracks, cellValue, clampPage, clampWidth, columnAllows, diffLayout, formatCell, hideableColumns, isLayoutChanged, mergeVisibleOrder, moveItem, nextSortDirection, pageSlice, parsePageSizes, parseProp, parseSortBy, sortName, sortRows, tableMinWidth, totalPages, visibleColumns, } from "./xv-table.utils";
|
|
6
|
+
const CHECKBOX_EVENT = 'eventChange';
|
|
7
|
+
const INTERACTIVE = 'a,button,input,select,textarea,[role="button"],xv-button-v2,xv-link-v2,xv-checkbox-v2,xv-radio-v2,xv-overflow-menu-v2,xv-tooltip-v2';
|
|
8
|
+
/**
|
|
9
|
+
* A data table built on CSS grid with `subgrid` rows, so a row keeps its own box while its cells
|
|
10
|
+
* stay aligned to the table's columns and an expanded panel can span the full width.
|
|
11
|
+
*
|
|
12
|
+
* `columns` always describes the structure — widths, order, sorting, resizing, hiding and the
|
|
13
|
+
* stored layout all read from it. Rows come either from `rows` as data, or as slotted
|
|
14
|
+
* `xv-table-row` children when the cells hold arbitrary markup.
|
|
15
|
+
*
|
|
16
|
+
* @slot - Slotted `xv-table-row` children, used instead of the `rows` prop.
|
|
17
|
+
* @slot toolbar - Controls above the table. Slotted content spans the bar; `flex: 0 0 auto` opts out.
|
|
18
|
+
* @slot batch - Actions shown in the bar that replaces the toolbar while rows are selected.
|
|
19
|
+
* @slot footer - Rows rendered after the body, for subtotals.
|
|
20
|
+
* @slot empty - Shown instead of the body when there is nothing to render.
|
|
21
|
+
* @slot label - Replaces the `label` prop with markup.
|
|
22
|
+
* @slot description - Replaces the `description` prop with markup.
|
|
23
|
+
* @part heading - The title block.
|
|
24
|
+
* @part title - The title text.
|
|
25
|
+
* @part description - The description text.
|
|
26
|
+
* @part bar - The toolbar and batch bar wrapper.
|
|
27
|
+
* @part toolbar - The toolbar.
|
|
28
|
+
* @part batch - The batch actions bar.
|
|
29
|
+
* @part scroll - The horizontal scroll container.
|
|
30
|
+
* @part grid - The grid itself.
|
|
31
|
+
* @part head - The header row.
|
|
32
|
+
* @part header-cell - One header cell.
|
|
33
|
+
* @part body - The body wrapper.
|
|
34
|
+
* @part pagination - The pagination block.
|
|
35
|
+
* @part column-picker - The menu that hides and shows columns.
|
|
36
|
+
* @part empty - The empty state.
|
|
37
|
+
* @part loading - The loading overlay.
|
|
38
|
+
*/
|
|
3
39
|
export class XvTable {
|
|
4
40
|
constructor() {
|
|
41
|
+
/** Column definitions. Accepts its JSON string form so it is settable from plain markup. */
|
|
42
|
+
this.columns = [];
|
|
43
|
+
/** Row data. Ignored when `xv-table-row` children are slotted. */
|
|
44
|
+
this.rows = [];
|
|
45
|
+
/** Property of a row object that identifies it in selection and expansion payloads. */
|
|
46
|
+
this.rowKey = 'id';
|
|
47
|
+
/** Row height ladder. */
|
|
5
48
|
this.size = SIZE_VAR.MD;
|
|
6
|
-
|
|
7
|
-
this.
|
|
49
|
+
/** Stretches the table to the full width of its container. */
|
|
50
|
+
this.block = false;
|
|
51
|
+
/** Covers the body with a loading state. */
|
|
52
|
+
this.loading = false;
|
|
53
|
+
/** Placeholder rows drawn while `loading`. Zero draws a spinner instead. */
|
|
54
|
+
this.skeletonRows = 0;
|
|
55
|
+
/** Highlights a row on pointer hover. */
|
|
56
|
+
this.hover = false;
|
|
57
|
+
/** Emits `rowClick` when a row is clicked outside an interactive element. */
|
|
58
|
+
this.rowClickable = false;
|
|
59
|
+
/** Title above the table. */
|
|
60
|
+
this.label = '';
|
|
61
|
+
/** Supporting text under the title. */
|
|
62
|
+
this.description = '';
|
|
63
|
+
/** Shown when there are no rows. */
|
|
64
|
+
this.emptyLabel = '';
|
|
65
|
+
/** Text of the batch bar counter. `{count}` is replaced with the number of selected rows. */
|
|
66
|
+
this.selectedLabel = '';
|
|
67
|
+
/** Tooltip on the column picker trigger. */
|
|
68
|
+
this.columnsLabel = 'Columns';
|
|
69
|
+
/** Text of the button that restores the declared column layout. */
|
|
70
|
+
this.resetLabel = 'Reset';
|
|
71
|
+
/** Accessible name of a row's expand toggle. */
|
|
72
|
+
this.expandLabel = 'Toggle row';
|
|
73
|
+
/** Accessible name of a row's drag grip. */
|
|
74
|
+
this.reorderLabel = 'Drag to reorder';
|
|
75
|
+
/**
|
|
76
|
+
* `none` makes headers inert whatever the column says; `client` sorts the `rows` prop itself;
|
|
77
|
+
* `server` offers the affordance and only emits `sortChange` for the consumer to reload.
|
|
78
|
+
*/
|
|
79
|
+
this.sortMode = 'none';
|
|
80
|
+
/** Active sort, as `asc(field)` / `desc(field)` or an object. */
|
|
81
|
+
this.sortBy = '';
|
|
82
|
+
/** `multiple` renders checkboxes, `single` renders radios. */
|
|
83
|
+
this.selection = 'none';
|
|
84
|
+
/** Values of the selected rows. */
|
|
85
|
+
this.selected = [];
|
|
86
|
+
/** Whether rows expand, and whether more than one may be open. */
|
|
87
|
+
this.expandMode = 'none';
|
|
88
|
+
/** Values of the expanded rows. */
|
|
89
|
+
this.expanded = [];
|
|
90
|
+
/** `client` slices the `rows` prop; `server` only emits `pageChange`. */
|
|
91
|
+
this.paginationMode = 'none';
|
|
92
|
+
/** Current page, 1-based. */
|
|
93
|
+
this.page = 1;
|
|
94
|
+
/** Rows per page. */
|
|
95
|
+
this.pageSize = 10;
|
|
96
|
+
/** Total row count, for `server` pagination. */
|
|
97
|
+
this.total = 0;
|
|
98
|
+
/** Page size choices. Accepts a comma-separated attribute. */
|
|
99
|
+
this.pageSizeOptions = [10, 20, 30, 40, 50, 100];
|
|
100
|
+
/**
|
|
101
|
+
* Allows dragging column edges. Off by default: no handle is rendered and nothing is bound
|
|
102
|
+
* until it is switched on. A column may switch itself off, never on.
|
|
103
|
+
*/
|
|
104
|
+
this.resizable = false;
|
|
105
|
+
/** Allows dragging column headers into a new order. Off by default, like `resizable`. */
|
|
106
|
+
this.reorderable = false;
|
|
107
|
+
/**
|
|
108
|
+
* Allows dragging rows into a new order. Off by default: nothing is bound and no handle is
|
|
109
|
+
* rendered until it is switched on.
|
|
110
|
+
*/
|
|
111
|
+
this.rowReorderable = false;
|
|
112
|
+
/** Whether the whole row drags, or only a grip in a leading control cell. */
|
|
113
|
+
this.rowReorderHandle = 'icon';
|
|
114
|
+
/** Keeps the header visible while the body scrolls. */
|
|
115
|
+
this.stickyHeader = false;
|
|
116
|
+
/**
|
|
117
|
+
* Width below which the table scrolls instead of squeezing, at any viewport. Left unset, a table
|
|
118
|
+
* only stops squeezing below 1180px, where it scrolls at the width its columns declared.
|
|
119
|
+
*/
|
|
120
|
+
this.minWidth = 0;
|
|
121
|
+
/** Persists the column layout under this key. Empty means the layout is not remembered. */
|
|
122
|
+
this.storageKey = '';
|
|
123
|
+
/** Scopes the stored layout to a user. */
|
|
124
|
+
this.storageOwner = 'anonymous';
|
|
125
|
+
/** Controlled column layout. Overrides whatever is stored. */
|
|
126
|
+
this.layout = null;
|
|
127
|
+
/** Locale used for sorting and cell formatting. Falls back to the nearest `[lang]` ancestor. */
|
|
128
|
+
this.locale = '';
|
|
129
|
+
this.columnState = [];
|
|
130
|
+
this.sortState = null;
|
|
131
|
+
this.selectedValues = [];
|
|
132
|
+
this.expandedValues = [];
|
|
133
|
+
this.layoutPending = false;
|
|
134
|
+
this.columnDragging = false;
|
|
135
|
+
this.dragOverId = '';
|
|
136
|
+
this.dropRowIndex = -1;
|
|
137
|
+
this.slottedRowCount = 0;
|
|
138
|
+
this.derivedTracks = [];
|
|
139
|
+
this.hasSlottedHeader = false;
|
|
140
|
+
this.hasSlottedHeading = false;
|
|
141
|
+
this.hasSlottedEmpty = false;
|
|
142
|
+
this.overflowing = false;
|
|
143
|
+
this.declared = [];
|
|
144
|
+
this.declaredSignature = '';
|
|
145
|
+
/** Whether the columns came from a slotted header rather than the `columns` prop. */
|
|
146
|
+
this.fromMarkup = false;
|
|
147
|
+
this.rowData = [];
|
|
148
|
+
this.seededExpanded = false;
|
|
149
|
+
// Only rows this table collapsed are re-shown, so a consumer's own [hidden] is left alone.
|
|
150
|
+
this.collapsed = new WeakSet();
|
|
151
|
+
this.dragRowIndex = -1;
|
|
152
|
+
this.layoutToken = 0;
|
|
153
|
+
this.dragColumnId = '';
|
|
154
|
+
/**
|
|
155
|
+
* A declared width is a floor, so columns that cannot fit overflow rather than squeeze. The table
|
|
156
|
+
* scrolls them into reach instead of letting them hang outside the block they were given.
|
|
157
|
+
*/
|
|
158
|
+
this.measureOverflow = () => {
|
|
159
|
+
if (!this.scrollEl)
|
|
160
|
+
return;
|
|
161
|
+
const overflowing = this.scrollEl.scrollWidth - this.scrollEl.clientWidth > 1;
|
|
162
|
+
if (overflowing !== this.overflowing)
|
|
163
|
+
this.overflowing = overflowing;
|
|
164
|
+
};
|
|
165
|
+
this.toggleSort = (column) => {
|
|
166
|
+
var _a;
|
|
167
|
+
// A finished column drag still fires a click on the header — that must not sort it.
|
|
168
|
+
if (!this.isSortable(column) || this.columnDragging)
|
|
169
|
+
return;
|
|
170
|
+
const name = sortName(column);
|
|
171
|
+
const direction = nextSortDirection(((_a = this.sortState) === null || _a === void 0 ? void 0 : _a.name) === name ? this.sortState.direction : null);
|
|
172
|
+
this.sortState = { name, direction };
|
|
173
|
+
this.sortChange.emit(this.sortState);
|
|
174
|
+
};
|
|
175
|
+
this.resizeStart = (event, column, handle) => {
|
|
176
|
+
if (event.button !== 0)
|
|
177
|
+
return;
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
event.stopPropagation();
|
|
180
|
+
const shown = this.visible;
|
|
181
|
+
const index = shown.indexOf(column);
|
|
182
|
+
// Trading with a neighbour keeps the total, so the table never stops filling its container.
|
|
183
|
+
const pairIndex = index + 1 < shown.length ? index + 1 : index - 1;
|
|
184
|
+
const pair = shown[pairIndex];
|
|
185
|
+
const cells = this.headerCells();
|
|
186
|
+
const startWidth = cells[index].getBoundingClientRect().width;
|
|
187
|
+
const pairStart = pair ? cells[pairIndex].getBoundingClientRect().width : 0;
|
|
188
|
+
const startX = event.clientX;
|
|
189
|
+
const offset = this.leadingTracks.length;
|
|
190
|
+
let width = startWidth;
|
|
191
|
+
let pairWidth = pairStart;
|
|
192
|
+
handle.setPointerCapture(event.pointerId);
|
|
193
|
+
// Written straight onto the grid: a re-render per pointermove stutters on a full page.
|
|
194
|
+
const move = (moveEvent) => {
|
|
195
|
+
var _a;
|
|
196
|
+
width = clampWidth(startWidth + moveEvent.clientX - startX, column);
|
|
197
|
+
if (pair) {
|
|
198
|
+
// The neighbour's own floor caps the drag, so neither column is squeezed past its minimum.
|
|
199
|
+
pairWidth = clampWidth(pairStart - (width - startWidth), pair);
|
|
200
|
+
width = clampWidth(startWidth + (pairStart - pairWidth), column);
|
|
201
|
+
}
|
|
202
|
+
const tracks = buildColumnTracks(this.columnState, this.leadingTracks, this.trailingTracks);
|
|
203
|
+
tracks[index + offset] = `${width}px`;
|
|
204
|
+
if (pair)
|
|
205
|
+
tracks[pairIndex + offset] = `${pairWidth}px`;
|
|
206
|
+
(_a = this.gridEl) === null || _a === void 0 ? void 0 : _a.style.setProperty('--xv-table-columns', tracks.join(' '));
|
|
207
|
+
};
|
|
208
|
+
const stop = () => {
|
|
209
|
+
handle.removeEventListener('pointermove', move);
|
|
210
|
+
handle.removeEventListener('pointerup', stop);
|
|
211
|
+
handle.removeEventListener('pointercancel', stop);
|
|
212
|
+
this.columnState = this.columnState.map(item => {
|
|
213
|
+
if (item.id === column.id)
|
|
214
|
+
return Object.assign(Object.assign({}, item), { width });
|
|
215
|
+
if (pair && item.id === pair.id)
|
|
216
|
+
return Object.assign(Object.assign({}, item), { width: pairWidth });
|
|
217
|
+
return item;
|
|
218
|
+
});
|
|
219
|
+
this.commitLayout();
|
|
220
|
+
};
|
|
221
|
+
handle.addEventListener('pointermove', move);
|
|
222
|
+
handle.addEventListener('pointerup', stop);
|
|
223
|
+
handle.addEventListener('pointercancel', stop);
|
|
224
|
+
};
|
|
225
|
+
this.resizeReset = (column) => {
|
|
226
|
+
var _a;
|
|
227
|
+
const width = (_a = this.declared.find(item => item.id === column.id)) === null || _a === void 0 ? void 0 : _a.width;
|
|
228
|
+
this.columnState = this.columnState.map(item => (item.id === column.id ? Object.assign(Object.assign({}, item), { width }) : item));
|
|
229
|
+
this.commitLayout();
|
|
230
|
+
};
|
|
231
|
+
this.headPointerDown = (event) => {
|
|
232
|
+
const hit = this.headerCellFrom(event);
|
|
233
|
+
if (!hit)
|
|
234
|
+
return;
|
|
235
|
+
const path = event.composedPath();
|
|
236
|
+
if (!path.some(node => { var _a; return (_a = node === null || node === void 0 ? void 0 : node.classList) === null || _a === void 0 ? void 0 : _a.contains('resize'); }))
|
|
237
|
+
return;
|
|
238
|
+
this.resizeStart(event, hit.column, event.composedPath()[0]);
|
|
239
|
+
};
|
|
240
|
+
this.headKeyDown = (event) => {
|
|
241
|
+
if (event.key !== 'Enter' && event.key !== ' ')
|
|
242
|
+
return;
|
|
243
|
+
const hit = this.headerCellFrom(event);
|
|
244
|
+
if (!hit)
|
|
245
|
+
return;
|
|
246
|
+
event.preventDefault();
|
|
247
|
+
this.toggleSort(hit.column);
|
|
248
|
+
};
|
|
249
|
+
this.headDblClick = (event) => {
|
|
250
|
+
const path = event.composedPath();
|
|
251
|
+
if (!path.some(node => { var _a; return (_a = node === null || node === void 0 ? void 0 : node.classList) === null || _a === void 0 ? void 0 : _a.contains('resize'); }))
|
|
252
|
+
return;
|
|
253
|
+
const hit = this.headerCellFrom(event);
|
|
254
|
+
if (hit)
|
|
255
|
+
this.resizeReset(hit.column);
|
|
256
|
+
};
|
|
257
|
+
this.headDragStart = (event) => {
|
|
258
|
+
const hit = this.headerCellFrom(event);
|
|
259
|
+
if (hit)
|
|
260
|
+
this.dragStart(event, hit.column);
|
|
261
|
+
};
|
|
262
|
+
this.headDragOver = (event) => {
|
|
263
|
+
const hit = this.headerCellFrom(event);
|
|
264
|
+
if (hit)
|
|
265
|
+
this.dragOver(event, hit.column, hit.cell);
|
|
266
|
+
};
|
|
267
|
+
this.headDrop = (event) => {
|
|
268
|
+
const hit = this.headerCellFrom(event);
|
|
269
|
+
if (hit)
|
|
270
|
+
this.drop(event, hit.column);
|
|
271
|
+
};
|
|
272
|
+
this.dragStart = (event, column) => {
|
|
273
|
+
var _a;
|
|
274
|
+
this.dragColumnId = column.id;
|
|
275
|
+
this.columnDragging = true;
|
|
276
|
+
(_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.setData('text/plain', column.id);
|
|
277
|
+
if (event.dataTransfer)
|
|
278
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
279
|
+
};
|
|
280
|
+
this.dragOver = (event, column, cell) => {
|
|
281
|
+
if (!this.dragColumnId || column.id === this.dragColumnId)
|
|
282
|
+
return;
|
|
283
|
+
if (!columnAllows(column, this.reorderable, 'reorderable'))
|
|
284
|
+
return;
|
|
285
|
+
event.preventDefault();
|
|
286
|
+
if (this.dragOverId === column.id)
|
|
287
|
+
return;
|
|
288
|
+
this.dragOverId = column.id;
|
|
289
|
+
this.headerCells().forEach(item => item.classList.toggle('drag-over', item === cell));
|
|
290
|
+
};
|
|
291
|
+
this.drop = (event, column) => {
|
|
292
|
+
event.preventDefault();
|
|
293
|
+
this.clearDragOver();
|
|
294
|
+
if (!this.dragColumnId || column.id === this.dragColumnId)
|
|
295
|
+
return;
|
|
296
|
+
if (!columnAllows(column, this.reorderable, 'reorderable'))
|
|
297
|
+
return;
|
|
298
|
+
const shown = this.visible;
|
|
299
|
+
const from = shown.findIndex(item => item.id === this.dragColumnId);
|
|
300
|
+
const to = shown.findIndex(item => item.id === column.id);
|
|
301
|
+
if (from < 0 || to < 0)
|
|
302
|
+
return;
|
|
303
|
+
this.columnState = mergeVisibleOrder(this.columnState, moveItem(shown, from, to));
|
|
304
|
+
this.commitLayout();
|
|
305
|
+
};
|
|
306
|
+
this.dragEnd = () => {
|
|
307
|
+
this.dragColumnId = '';
|
|
308
|
+
this.clearDragOver();
|
|
309
|
+
// The trailing click lands after dragend, so the sort guard has to outlive the gesture.
|
|
310
|
+
setTimeout(() => (this.columnDragging = false), 0);
|
|
311
|
+
};
|
|
312
|
+
this.toggleSelectAll = () => {
|
|
313
|
+
// Tri-state: a partial box clears what is picked rather than completing the set.
|
|
314
|
+
this.setSelection(this.selectedValues.length ? [] : this.rowValues());
|
|
315
|
+
};
|
|
316
|
+
this.toggleColumn = (column) => {
|
|
317
|
+
this.columnState = this.columnState.map(item => item.id === column.id ? Object.assign(Object.assign({}, item), { hidden: !item.hidden }) : item);
|
|
318
|
+
this.commitLayout();
|
|
319
|
+
};
|
|
320
|
+
this.rowDragStart = (event) => {
|
|
321
|
+
const row = this.rowFrom(event);
|
|
322
|
+
if (!row || row.group || row.disabled)
|
|
323
|
+
return;
|
|
324
|
+
this.dragRowIndex = this.bodyRows().indexOf(row);
|
|
325
|
+
if (this.dragRowIndex < 0)
|
|
326
|
+
return;
|
|
327
|
+
row.classList.add('is-dragging');
|
|
328
|
+
if (event.dataTransfer)
|
|
329
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
330
|
+
};
|
|
331
|
+
this.rowDragOver = (event) => {
|
|
332
|
+
if (this.dragRowIndex < 0)
|
|
333
|
+
return;
|
|
334
|
+
const row = this.rowFrom(event);
|
|
335
|
+
if (!row || row.group)
|
|
336
|
+
return;
|
|
337
|
+
const index = this.bodyRows().indexOf(row);
|
|
338
|
+
if (index < 0 || index === this.dragRowIndex)
|
|
339
|
+
return;
|
|
340
|
+
event.preventDefault();
|
|
341
|
+
if (index === this.dropRowIndex)
|
|
342
|
+
return;
|
|
343
|
+
this.dropRowIndex = index;
|
|
344
|
+
// The line marks the edge the row will land against, so its side follows the drag direction.
|
|
345
|
+
this.bodyRows().forEach((item, i) => {
|
|
346
|
+
item.classList.toggle('drop-above', i === index && index < this.dragRowIndex);
|
|
347
|
+
item.classList.toggle('drop-below', i === index && index > this.dragRowIndex);
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
this.rowDrop = (event) => {
|
|
351
|
+
if (this.dragRowIndex < 0)
|
|
352
|
+
return;
|
|
353
|
+
event.preventDefault();
|
|
354
|
+
const to = this.dropRowIndex;
|
|
355
|
+
const from = this.dragRowIndex;
|
|
356
|
+
this.rowDragEnd();
|
|
357
|
+
if (to < 0 || from === to)
|
|
358
|
+
return;
|
|
359
|
+
this.rowOrderChange.emit({ from, to });
|
|
360
|
+
};
|
|
361
|
+
this.rowDragEnd = () => {
|
|
362
|
+
this.bodyRows().forEach(row => row.classList.remove('is-dragging', 'drop-above', 'drop-below'));
|
|
363
|
+
this.dragRowIndex = -1;
|
|
364
|
+
this.dropRowIndex = -1;
|
|
365
|
+
};
|
|
366
|
+
/** One listener for the whole body instead of a child event per row. */
|
|
367
|
+
this.bodyChange = (event) => {
|
|
368
|
+
var _a;
|
|
369
|
+
const path = event.composedPath();
|
|
370
|
+
const row = path.find(node => { var _a; return ((_a = node === null || node === void 0 ? void 0 : node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === XV_TABLE_ROW_TAG; });
|
|
371
|
+
if (!row || row.disabled)
|
|
372
|
+
return;
|
|
373
|
+
// A checkbox the consumer put in a cell is its own; only the row's own control selects a row.
|
|
374
|
+
const control = path.find(node => { var _a; return (_a = node === null || node === void 0 ? void 0 : node.classList) === null || _a === void 0 ? void 0 : _a.contains('control_input'); });
|
|
375
|
+
if (!control || !((_a = row.shadowRoot) === null || _a === void 0 ? void 0 : _a.contains(control)))
|
|
376
|
+
return;
|
|
377
|
+
event.stopPropagation();
|
|
378
|
+
if (row.hasAttribute('header'))
|
|
379
|
+
return this.toggleSelectAll();
|
|
380
|
+
this.toggleRowSelection(row.value);
|
|
381
|
+
};
|
|
382
|
+
this.gridClick = (event) => {
|
|
383
|
+
const path = event.composedPath();
|
|
384
|
+
if (path.some(node => { var _a; return (_a = node === null || node === void 0 ? void 0 : node.classList) === null || _a === void 0 ? void 0 : _a.contains('resize'); }))
|
|
385
|
+
return;
|
|
386
|
+
const header = this.headerCellFrom(event);
|
|
387
|
+
if (header)
|
|
388
|
+
return this.toggleSort(header.column);
|
|
389
|
+
this.bodyClick(event);
|
|
390
|
+
};
|
|
391
|
+
this.bodyClick = (event) => {
|
|
392
|
+
const path = event.composedPath();
|
|
393
|
+
const row = path.find(node => { var _a; return ((_a = node === null || node === void 0 ? void 0 : node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === XV_TABLE_ROW_TAG; });
|
|
394
|
+
if (!row || row.disabled)
|
|
395
|
+
return;
|
|
396
|
+
if (path.some(node => { var _a; return ((_a = node === null || node === void 0 ? void 0 : node.getAttribute) === null || _a === void 0 ? void 0 : _a.call(node, 'part')) === 'expand-button'; })) {
|
|
397
|
+
this.toggleExpanded(row.value);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
if (!this.rowClickable)
|
|
401
|
+
return;
|
|
402
|
+
// event.target is retargeted to the row at this boundary, so the path is the only honest check.
|
|
403
|
+
if (path.some(node => { var _a; return node !== row && ((_a = node === null || node === void 0 ? void 0 : node.matches) === null || _a === void 0 ? void 0 : _a.call(node, INTERACTIVE)); }))
|
|
404
|
+
return;
|
|
405
|
+
this.rowClick.emit({ value: row.value, index: this.renderedRows().indexOf(row) });
|
|
406
|
+
};
|
|
407
|
+
this.paginationChanged = (event) => {
|
|
408
|
+
event.stopPropagation();
|
|
409
|
+
this.page = event.detail.page || this.page;
|
|
410
|
+
this.pageSize = event.detail.itemsPerPage || this.pageSize;
|
|
411
|
+
this.pageChange.emit({ page: this.page, pageSize: this.pageSize });
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
componentWillLoad() {
|
|
415
|
+
this.declared = parseProp(this.columns, []);
|
|
416
|
+
this.rowData = parseProp(this.rows, []);
|
|
417
|
+
this.columnState = this.declared.map(column => (Object.assign({}, column)));
|
|
418
|
+
this.sortState = parseSortBy(this.sortBy);
|
|
419
|
+
this.selectedValues = parseProp(this.selected, []);
|
|
420
|
+
this.expandedValues = parseProp(this.expanded, []);
|
|
421
|
+
this.slottedRowCount = this.slottedRows().length;
|
|
422
|
+
if (this.storageKey || this.layout)
|
|
423
|
+
this.restoreLayout();
|
|
424
|
+
}
|
|
425
|
+
componentDidLoad() {
|
|
426
|
+
// Bound imperatively: a custom event has no typed JSX handler on a plain element.
|
|
427
|
+
this.el.addEventListener(CHECKBOX_EVENT, this.bodyChange);
|
|
428
|
+
// Absent in mock-doc and in hydrate builds; componentDidRender still keeps the rows in sync.
|
|
429
|
+
if (typeof MutationObserver !== 'undefined') {
|
|
430
|
+
this.rowObserver = new MutationObserver(records => {
|
|
431
|
+
// A framework re-rendering its own markup inside a cell must not trigger a full resync.
|
|
432
|
+
if (!records.some(record => this.touchesStructure(record)))
|
|
433
|
+
return;
|
|
434
|
+
this.syncStructure();
|
|
435
|
+
this.syncRows();
|
|
436
|
+
});
|
|
437
|
+
this.rowObserver.observe(this.el, {
|
|
438
|
+
childList: true,
|
|
439
|
+
subtree: true,
|
|
440
|
+
// A framework can reflect these after the table has already read the header once.
|
|
441
|
+
attributes: true,
|
|
442
|
+
attributeFilter: ['column-id', 'width', 'sortable', 'hideable', 'parent'],
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
// Fires after layout, so reading the two widths costs no extra reflow.
|
|
446
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
447
|
+
this.sizeObserver = new ResizeObserver(() => this.measureOverflow());
|
|
448
|
+
if (this.scrollEl)
|
|
449
|
+
this.sizeObserver.observe(this.scrollEl);
|
|
450
|
+
if (this.gridEl)
|
|
451
|
+
this.sizeObserver.observe(this.gridEl);
|
|
452
|
+
}
|
|
453
|
+
this.syncStructure();
|
|
454
|
+
this.syncRows();
|
|
455
|
+
}
|
|
456
|
+
componentDidRender() {
|
|
457
|
+
this.syncRows();
|
|
458
|
+
}
|
|
459
|
+
disconnectedCallback() {
|
|
460
|
+
var _a, _b;
|
|
461
|
+
this.el.removeEventListener(CHECKBOX_EVENT, this.bodyChange);
|
|
462
|
+
(_a = this.rowObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
463
|
+
this.rowObserver = undefined;
|
|
464
|
+
(_b = this.sizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
465
|
+
this.sizeObserver = undefined;
|
|
8
466
|
}
|
|
9
|
-
|
|
10
|
-
|
|
467
|
+
columnsChanged() {
|
|
468
|
+
this.declared = parseProp(this.columns, []);
|
|
469
|
+
this.restoreLayout();
|
|
470
|
+
}
|
|
471
|
+
layoutInputChanged() {
|
|
472
|
+
this.restoreLayout();
|
|
473
|
+
}
|
|
474
|
+
sortByChanged() {
|
|
475
|
+
this.sortState = parseSortBy(this.sortBy);
|
|
476
|
+
}
|
|
477
|
+
selectedChanged() {
|
|
478
|
+
this.selectedValues = parseProp(this.selected, []);
|
|
479
|
+
}
|
|
480
|
+
expandedChanged() {
|
|
481
|
+
this.expandedValues = parseProp(this.expanded, []);
|
|
482
|
+
}
|
|
483
|
+
rowsChanged() {
|
|
484
|
+
this.rowData = parseProp(this.rows, []);
|
|
485
|
+
}
|
|
486
|
+
/** Selects every selectable row. */
|
|
487
|
+
async selectAll() {
|
|
488
|
+
this.setSelection(this.rowValues());
|
|
489
|
+
}
|
|
490
|
+
/** Clears the selection. */
|
|
491
|
+
async clearSelection() {
|
|
492
|
+
this.setSelection([]);
|
|
493
|
+
}
|
|
494
|
+
/** Drops the stored layout and returns to the declared columns. */
|
|
495
|
+
async resetLayout() {
|
|
496
|
+
this.columnState = this.declared.map(column => (Object.assign({}, column)));
|
|
497
|
+
await deleteLayout(this.storageOwner, this.storageKey);
|
|
498
|
+
this.layoutChange.emit(diffLayout(this.columnState, this.declared));
|
|
499
|
+
}
|
|
500
|
+
/** The layout as it would be stored: only the deviations from the declared columns. */
|
|
501
|
+
async getLayout() {
|
|
502
|
+
return diffLayout(this.columnState, this.declared);
|
|
503
|
+
}
|
|
504
|
+
async restoreLayout() {
|
|
505
|
+
const token = ++this.layoutToken;
|
|
506
|
+
const controlled = parseProp(this.layout, null);
|
|
507
|
+
if (controlled) {
|
|
508
|
+
this.columnState = applyLayout(this.declared, controlled);
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
if (!this.storageKey) {
|
|
512
|
+
this.columnState = this.declared.map(column => (Object.assign({}, column)));
|
|
11
513
|
return;
|
|
12
|
-
if (detail.checked) {
|
|
13
|
-
this.selected.set(detail.name, detail);
|
|
14
514
|
}
|
|
15
|
-
|
|
16
|
-
|
|
515
|
+
// Painting declared widths and correcting them afterwards is visible, so the body waits.
|
|
516
|
+
this.layoutPending = true;
|
|
517
|
+
const stored = await readLayout(this.storageOwner, this.storageKey);
|
|
518
|
+
if (token !== this.layoutToken)
|
|
519
|
+
return;
|
|
520
|
+
this.columnState = applyLayout(this.declared, stored);
|
|
521
|
+
this.layoutPending = false;
|
|
522
|
+
}
|
|
523
|
+
commitLayout() {
|
|
524
|
+
const next = diffLayout(this.columnState, this.declared);
|
|
525
|
+
void writeLayout(this.storageOwner, this.storageKey, next);
|
|
526
|
+
this.layoutChange.emit(next);
|
|
527
|
+
}
|
|
528
|
+
get localeTag() {
|
|
529
|
+
var _a;
|
|
530
|
+
return this.locale || ((_a = this.el.closest('[lang]')) === null || _a === void 0 ? void 0 : _a.getAttribute('lang')) || 'de';
|
|
531
|
+
}
|
|
532
|
+
get visible() {
|
|
533
|
+
return visibleColumns(this.columnState);
|
|
534
|
+
}
|
|
535
|
+
get hasSelection() {
|
|
536
|
+
return this.selection !== 'none';
|
|
537
|
+
}
|
|
538
|
+
get hasExpand() {
|
|
539
|
+
return this.expandMode !== 'none';
|
|
540
|
+
}
|
|
541
|
+
get template() {
|
|
542
|
+
if (this.columnState.length) {
|
|
543
|
+
return buildColumnTemplate(this.columnState, this.leadingTracks, this.trailingTracks);
|
|
544
|
+
}
|
|
545
|
+
// No columns declared: a plain table takes its structure from the markup itself.
|
|
546
|
+
return [...this.leadingTracks.map(w => `${w}px`), ...this.derivedTracks, ...this.trailingTracks.map(w => `${w}px`)].join(' ');
|
|
547
|
+
}
|
|
548
|
+
/** Grip, then the expand toggle, then selection — one track each, in render order. */
|
|
549
|
+
get leadingTracks() {
|
|
550
|
+
return [
|
|
551
|
+
...(this.rowReorderable ? [XV_TABLE_CONTROL_WIDTH] : []),
|
|
552
|
+
...(this.hasExpand ? [XV_TABLE_CONTROL_WIDTH] : []),
|
|
553
|
+
...(this.hasSelection ? [XV_TABLE_CONTROL_WIDTH] : []),
|
|
554
|
+
];
|
|
555
|
+
}
|
|
556
|
+
get trailingTracks() {
|
|
557
|
+
return [];
|
|
558
|
+
}
|
|
559
|
+
get dataRows() {
|
|
560
|
+
const all = this.rowData;
|
|
561
|
+
const sorted = this.sortMode === 'client' && this.sortState
|
|
562
|
+
? sortRows(all, this.columnBySortName(this.sortState.name), this.sortState.direction, this.localeTag)
|
|
563
|
+
: all;
|
|
564
|
+
return this.paginationMode === 'client' ? pageSlice(sorted, this.page, this.pageSize) : sorted;
|
|
565
|
+
}
|
|
566
|
+
get rowTotal() {
|
|
567
|
+
if (this.paginationMode === 'server')
|
|
568
|
+
return this.total;
|
|
569
|
+
const slotted = this.topRows(this.slottedRows()).length;
|
|
570
|
+
return slotted || this.rowData.length;
|
|
571
|
+
}
|
|
572
|
+
// Nothing to show is not the same as something to say: a consumer that draws its own empty state
|
|
573
|
+
// next to the table would otherwise get an empty frame above it.
|
|
574
|
+
get isEmpty() {
|
|
575
|
+
return !this.loading && !this.rowTotal && (!!this.emptyLabel || this.hasSlottedEmpty);
|
|
576
|
+
}
|
|
577
|
+
columnBySortName(name) {
|
|
578
|
+
return this.columnState.find(column => sortName(column) === name) || null;
|
|
579
|
+
}
|
|
580
|
+
touchesStructure(record) {
|
|
581
|
+
// The filter already narrows attributes to the ones that shape a column.
|
|
582
|
+
if (record.type === 'attributes')
|
|
583
|
+
return true;
|
|
584
|
+
const structural = (node) => {
|
|
585
|
+
var _a;
|
|
586
|
+
const tag = (_a = node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
587
|
+
// Anything that fills a slot shapes the table; markup inside a cell does not.
|
|
588
|
+
return tag === XV_TABLE_ROW_TAG || tag === XV_TABLE_CELL_TAG || !!node.slot;
|
|
589
|
+
};
|
|
590
|
+
return (Array.from(record.addedNodes).some(structural) || Array.from(record.removedNodes).some(structural));
|
|
591
|
+
}
|
|
592
|
+
isBodyRow(row) {
|
|
593
|
+
return !row.hasAttribute('header') && row.getAttribute('slot') !== 'footer';
|
|
594
|
+
}
|
|
595
|
+
/** Body rows only — these are the ones selection and expansion count. */
|
|
596
|
+
slottedRows() {
|
|
597
|
+
return this.slottedRowsAll().filter(row => this.isBodyRow(row));
|
|
598
|
+
}
|
|
599
|
+
/** A page is counted in top-level rows: a group and its children travel together. */
|
|
600
|
+
topRows(rows) {
|
|
601
|
+
return rows.filter(row => this.isBodyRow(row) && !this.parentOf(row));
|
|
602
|
+
}
|
|
603
|
+
/** Every slotted row, footer included: they all need the column tracks lined up. */
|
|
604
|
+
slottedRowsAll() {
|
|
605
|
+
return Array.from(this.el.children).filter(child => child.tagName.toLowerCase() === XV_TABLE_ROW_TAG);
|
|
606
|
+
}
|
|
607
|
+
/** Every row on screen, whichever mode produced it. */
|
|
608
|
+
renderedRows() {
|
|
609
|
+
var _a;
|
|
610
|
+
const slotted = this.slottedRows();
|
|
611
|
+
if (slotted.length)
|
|
612
|
+
return slotted;
|
|
613
|
+
return Array.from(((_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(`${XV_TABLE_ROW_TAG}:not([header])`)) || []);
|
|
614
|
+
}
|
|
615
|
+
rowValues() {
|
|
616
|
+
const slotted = this.slottedRows();
|
|
617
|
+
if (slotted.length) {
|
|
618
|
+
const parents = this.parentValues(slotted);
|
|
619
|
+
return slotted
|
|
620
|
+
.filter(row => !this.isDisabled(row))
|
|
621
|
+
.map(row => row.value)
|
|
622
|
+
.filter(value => !parents.has(String(value)));
|
|
623
|
+
}
|
|
624
|
+
return this.dataRows.map(row => row === null || row === void 0 ? void 0 : row[this.rowKey]);
|
|
625
|
+
}
|
|
626
|
+
/** A disabled row is not selectable, so it stays out of every selection set. */
|
|
627
|
+
isDisabled(row) {
|
|
628
|
+
return !!row.disabled || row.hasAttribute('disabled');
|
|
629
|
+
}
|
|
630
|
+
/** `parent` may arrive as an attribute or as a property, depending on the consumer. */
|
|
631
|
+
parentOf(row) {
|
|
632
|
+
return String(row.parent || row.getAttribute('parent') || '');
|
|
633
|
+
}
|
|
634
|
+
parentValues(rows) {
|
|
635
|
+
return new Set(rows.map(row => this.parentOf(row)).filter(Boolean));
|
|
636
|
+
}
|
|
637
|
+
childValuesOf(value) {
|
|
638
|
+
return this.buildTree(this.slottedRows()).get(String(value)) || [];
|
|
639
|
+
}
|
|
640
|
+
/** One walk of the rows answers every parent/child question asked during a sync. */
|
|
641
|
+
buildTree(rows) {
|
|
642
|
+
const children = new Map();
|
|
643
|
+
rows.forEach(row => {
|
|
644
|
+
const parent = this.parentOf(row);
|
|
645
|
+
if (!parent)
|
|
646
|
+
return;
|
|
647
|
+
const values = children.get(parent) || [];
|
|
648
|
+
if (!this.isDisabled(row))
|
|
649
|
+
values.push(row.value);
|
|
650
|
+
children.set(parent, values);
|
|
651
|
+
});
|
|
652
|
+
return children;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Child rows declare their parent by value. They stay siblings in the grid — that is what keeps
|
|
656
|
+
* them in the table's columns, rather than a nested table inside a panel.
|
|
657
|
+
*/
|
|
658
|
+
syncRowTree(rows, children, expanded) {
|
|
659
|
+
const page = this.pageWindow(rows);
|
|
660
|
+
const groups = new Map();
|
|
661
|
+
rows.forEach(row => {
|
|
662
|
+
var _a;
|
|
663
|
+
const value = String((_a = row.value) !== null && _a !== void 0 ? _a : '');
|
|
664
|
+
if (value && !this.parentOf(row))
|
|
665
|
+
groups.set(value, row);
|
|
666
|
+
});
|
|
667
|
+
rows.forEach(row => {
|
|
668
|
+
var _a;
|
|
669
|
+
const props = row;
|
|
670
|
+
const parent = this.parentOf(row);
|
|
671
|
+
const value = String((_a = props.value) !== null && _a !== void 0 ? _a : '');
|
|
672
|
+
if (parent) {
|
|
673
|
+
const group = groups.get(parent);
|
|
674
|
+
// A child follows its group: it shows when the group is open and on the current page.
|
|
675
|
+
const show = expanded.has(parent) && (!page || (!!group && page.has(group)));
|
|
676
|
+
this.showRow(row, show);
|
|
677
|
+
props.expandable = false;
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
const hasChildren = children.has(value);
|
|
681
|
+
const panel = !!row.querySelector('[slot="expand"]');
|
|
682
|
+
// a row is expandable when it has children, or content for the panel
|
|
683
|
+
props.expandable = hasChildren || panel;
|
|
684
|
+
props.hasPanel = panel;
|
|
685
|
+
row.classList.toggle('has-children', hasChildren);
|
|
686
|
+
this.showRow(row, !page || !this.isBodyRow(row) || page.has(row));
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
/** Only rows this table hid are shown again, so a consumer's own `hidden` survives a sync. */
|
|
690
|
+
showRow(row, show) {
|
|
691
|
+
if (!show) {
|
|
692
|
+
this.collapsed.add(row);
|
|
693
|
+
row.hidden = true;
|
|
694
|
+
return;
|
|
17
695
|
}
|
|
18
|
-
|
|
696
|
+
if (this.collapsed.delete(row))
|
|
697
|
+
row.hidden = false;
|
|
698
|
+
}
|
|
699
|
+
/** The rows of the current page, or null while the table is not the one paging. */
|
|
700
|
+
pageWindow(rows) {
|
|
701
|
+
if (this.paginationMode !== 'client')
|
|
702
|
+
return null;
|
|
703
|
+
const top = this.topRows(rows);
|
|
704
|
+
if (!top.length)
|
|
705
|
+
return null;
|
|
706
|
+
const size = this.pageSize || 10;
|
|
707
|
+
const start = (clampPage(this.page, totalPages(top.length, size)) - 1) * size;
|
|
708
|
+
return new Set(top.slice(start, start + size));
|
|
709
|
+
}
|
|
710
|
+
/** Cells are written in declared order; hiding and reordering only move them visually. */
|
|
711
|
+
syncCells(row, order) {
|
|
712
|
+
const cells = Array.from(row.children).filter(cell => cell.getAttribute('slot') !== 'expand');
|
|
713
|
+
cells.forEach((cell, index) => {
|
|
714
|
+
var _a;
|
|
715
|
+
const column = this.declared[index];
|
|
716
|
+
if (!column)
|
|
717
|
+
return;
|
|
718
|
+
const current = this.columnState.find(item => item.id === column.id);
|
|
719
|
+
const props = cell;
|
|
720
|
+
props.columnId = column.id;
|
|
721
|
+
if (column.align)
|
|
722
|
+
props.align = column.align;
|
|
723
|
+
if (column.overflow)
|
|
724
|
+
props.overflow = column.overflow;
|
|
725
|
+
if (column.clampLines)
|
|
726
|
+
props.clampLines = column.clampLines;
|
|
727
|
+
cell.style.order = String((_a = order.get(column.id)) !== null && _a !== void 0 ? _a : index);
|
|
728
|
+
cell.hidden = !!(current === null || current === void 0 ? void 0 : current.hidden);
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
/** Structure writes @State, so it runs outside the render cycle: on load and on childList. */
|
|
732
|
+
syncStructure() {
|
|
733
|
+
const rows = this.slottedRowsAll();
|
|
734
|
+
this.slottedRowCount = this.slottedRows().length;
|
|
735
|
+
// The heading block is not rendered at all unless something fills it, and a slotted title is
|
|
736
|
+
// just as much a title as the prop.
|
|
737
|
+
const heading = Array.from(this.el.children).some(child => child.slot === 'label' || child.slot === 'description');
|
|
738
|
+
if (this.hasSlottedHeading !== heading)
|
|
739
|
+
this.hasSlottedHeading = heading;
|
|
740
|
+
const empty = Array.from(this.el.children).some(child => child.slot === 'empty');
|
|
741
|
+
if (this.hasSlottedEmpty !== empty)
|
|
742
|
+
this.hasSlottedEmpty = empty;
|
|
743
|
+
this.seedExpanded(rows);
|
|
744
|
+
this.syncDerivedTracks(rows);
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* A row may declare itself open in markup. Read once, before the table starts writing the
|
|
748
|
+
* attribute itself — after that there is no telling a declared value from a toggled one.
|
|
749
|
+
*/
|
|
750
|
+
seedExpanded(rows) {
|
|
751
|
+
// Rows that arrive from an HTTP call are not there on the first pass, so seeding waits for them.
|
|
752
|
+
if (this.seededExpanded || !rows.length)
|
|
753
|
+
return;
|
|
754
|
+
this.seededExpanded = true;
|
|
755
|
+
const open = rows
|
|
756
|
+
.filter(row => row.hasAttribute('expanded'))
|
|
757
|
+
.map(row => row.value)
|
|
758
|
+
.filter(value => value !== '' && value !== undefined);
|
|
759
|
+
const merged = [...this.expandedValues, ...open.filter(v => !this.expandedValues.includes(v))];
|
|
760
|
+
if (merged.length !== this.expandedValues.length)
|
|
761
|
+
this.expandedValues = merged;
|
|
762
|
+
}
|
|
763
|
+
/** Pushing props onto children is safe during render; nothing here touches @State. */
|
|
764
|
+
syncRows() {
|
|
765
|
+
const rows = this.slottedRowsAll();
|
|
766
|
+
const tree = this.buildTree(rows);
|
|
767
|
+
// A value may reach the table as a number and come back from an attribute as a string.
|
|
768
|
+
const expanded = new Set(this.expandedValues.map(String));
|
|
769
|
+
const selected = new Set(this.selectedValues.map(String));
|
|
770
|
+
const order = new Map(this.columnState.map((column, index) => [column.id, index]));
|
|
771
|
+
this.syncRowTree(rows, tree, expanded);
|
|
772
|
+
this.syncHeaderCells(rows.find(row => row.hasAttribute('header')));
|
|
773
|
+
rows.forEach(row => {
|
|
774
|
+
const value = row.value;
|
|
775
|
+
const props = row;
|
|
776
|
+
props.selectionMode = this.selection;
|
|
777
|
+
props.expandMode = this.expandMode;
|
|
778
|
+
props.size = this.size;
|
|
779
|
+
props.hover = this.hover;
|
|
780
|
+
props.rowReorderable = this.rowReorderable;
|
|
781
|
+
props.rowReorderHandle = this.rowReorderHandle;
|
|
782
|
+
props.expandLabel = this.expandLabel;
|
|
783
|
+
props.reorderLabel = this.reorderLabel;
|
|
784
|
+
if (row.hasAttribute('header')) {
|
|
785
|
+
// A slotted header carries select-all too, so it reflects the whole table.
|
|
786
|
+
const all = this.rowValues();
|
|
787
|
+
const picked = this.selectedValues.length;
|
|
788
|
+
props.selected = !!picked && picked === all.length;
|
|
789
|
+
props.partial = !!picked && picked < all.length;
|
|
790
|
+
props.selectable = all.length > 0;
|
|
791
|
+
this.syncCells(row, order);
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
const children = tree.get(String(value)) || [];
|
|
795
|
+
if (children.length) {
|
|
796
|
+
const picked = children.filter(child => selected.has(String(child)));
|
|
797
|
+
props.selected = picked.length === children.length;
|
|
798
|
+
props.partial = !!picked.length && picked.length < children.length;
|
|
799
|
+
}
|
|
800
|
+
else {
|
|
801
|
+
props.selected = selected.has(String(value));
|
|
802
|
+
props.partial = false;
|
|
803
|
+
}
|
|
804
|
+
props.expanded = expanded.has(String(value));
|
|
805
|
+
this.syncCells(row, order);
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
/** Sorting is offered only when a mode asks for it, so `none` and `server` cannot look alike. */
|
|
809
|
+
isSortable(column) {
|
|
810
|
+
return !!column.sortable && this.sortMode !== 'none';
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* A slotted header is the consumer's markup, so the table pushes the column state onto its cells
|
|
814
|
+
* rather than rendering a second header of its own.
|
|
815
|
+
*/
|
|
816
|
+
syncHeaderCells(header) {
|
|
817
|
+
if (!header)
|
|
818
|
+
return;
|
|
819
|
+
const cells = Array.from(header.children).filter(child => child.tagName.toLowerCase() === XV_TABLE_CELL_TAG);
|
|
820
|
+
cells.forEach((cell, index) => {
|
|
821
|
+
var _a;
|
|
822
|
+
const declared = cell.columnId || cell.getAttribute('column-id');
|
|
823
|
+
const column = declared
|
|
824
|
+
? this.columnState.find(item => item.id === declared)
|
|
825
|
+
: this.visible[index];
|
|
826
|
+
const props = cell;
|
|
827
|
+
props.header = true;
|
|
828
|
+
props.reorderLabel = this.reorderLabel;
|
|
829
|
+
if (!column) {
|
|
830
|
+
props.resizable = false;
|
|
831
|
+
props.reorderable = false;
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
const sortable = this.isSortable(column);
|
|
835
|
+
props.columnId = column.id;
|
|
836
|
+
// A markup header declares `sortable` itself. Writing the table's own idea of it back would
|
|
837
|
+
// overwrite what the consumer just bound, and the table would then read its own answer.
|
|
838
|
+
if (!this.fromMarkup)
|
|
839
|
+
props.sortable = sortable;
|
|
840
|
+
props.sortDirection =
|
|
841
|
+
sortable && ((_a = this.sortState) === null || _a === void 0 ? void 0 : _a.name) === sortName(column) ? this.sortState.direction : '';
|
|
842
|
+
props.resizable = columnAllows(column, this.resizable, 'resizable');
|
|
843
|
+
props.reorderable = columnAllows(column, this.reorderable, 'reorderable');
|
|
844
|
+
if (column.headerAlign)
|
|
845
|
+
props.align = column.headerAlign;
|
|
846
|
+
cell.draggable = props.reorderable;
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
/** Reads the column shape out of the markup when no `columns` prop was given. */
|
|
850
|
+
syncDerivedTracks(rows) {
|
|
851
|
+
const header = rows.find(row => row.hasAttribute('header')) || null;
|
|
852
|
+
if (this.hasSlottedHeader !== !!header)
|
|
853
|
+
this.hasSlottedHeader = !!header;
|
|
854
|
+
// Re-read the header while it is the declaration: a framework sets `sortable`, `hideable` or a
|
|
855
|
+
// width as properties, and those can land after the first read. `columns` wins when it is given.
|
|
856
|
+
if (header && (this.fromMarkup || !this.declared.length))
|
|
857
|
+
this.deriveColumns(header);
|
|
858
|
+
if (this.columnState.length)
|
|
859
|
+
return;
|
|
860
|
+
const source = header || rows[0];
|
|
861
|
+
if (!source)
|
|
862
|
+
return;
|
|
863
|
+
const cells = Array.from(source.children).filter(cell => cell.getAttribute('slot') !== 'expand');
|
|
864
|
+
const widths = cells.map(cell => String(cell.width || cell.getAttribute('width') || ''));
|
|
865
|
+
// Every width fixed leaves nothing to absorb the slack, so they share it by weight.
|
|
866
|
+
const share = widths.length > 0 && widths.every(width => /^[0-9.]+$/.test(width));
|
|
867
|
+
const tracks = widths.map(width => {
|
|
868
|
+
if (!width)
|
|
869
|
+
return `minmax(${XV_TABLE_MIN_COLUMN_WIDTH}px,1fr)`;
|
|
870
|
+
if (!/^[0-9.]+$/.test(width))
|
|
871
|
+
return width;
|
|
872
|
+
return share ? `minmax(${width}px,${width}fr)` : `${width}px`;
|
|
873
|
+
});
|
|
874
|
+
if (tracks.join(' ') !== this.derivedTracks.join(' '))
|
|
875
|
+
this.derivedTracks = tracks;
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* With no `columns` prop the header cells are the declaration: their attributes carry the id,
|
|
879
|
+
* width and switches, so a markup-only table still resizes, reorders and remembers its layout.
|
|
880
|
+
*/
|
|
881
|
+
deriveColumns(header) {
|
|
882
|
+
const cells = Array.from(header.children).filter(child => child.tagName.toLowerCase() === XV_TABLE_CELL_TAG);
|
|
883
|
+
if (!cells.length)
|
|
884
|
+
return;
|
|
885
|
+
const taken = new Set();
|
|
886
|
+
const derived = cells.map((cell, index) => {
|
|
887
|
+
var _a;
|
|
888
|
+
// The property wins over the attribute: a framework binds properties, and it may have done so
|
|
889
|
+
// before the cell upgraded. The attribute is the fallback for plain markup.
|
|
890
|
+
const props = cell;
|
|
891
|
+
const flag = (name, value) => (value !== null && value !== void 0 ? value : cell.hasAttribute(name));
|
|
892
|
+
// `240` and `240px` are both pixels; `25%`, `auto` or `12rem` land in the track as written.
|
|
893
|
+
const width = String(props.width || cell.getAttribute('width') || '');
|
|
894
|
+
const pixels = /^([0-9.]+)(px)?$/.exec(width);
|
|
895
|
+
// Two columns may honestly carry the same name — a details and a delete cell both keyed by
|
|
896
|
+
// `id`. Ids address a column, so a repeat is made unique here rather than silently sharing
|
|
897
|
+
// a track with the column it collides with.
|
|
898
|
+
let id = props.columnId || cell.getAttribute('column-id') || `col-${index}`;
|
|
899
|
+
while (taken.has(id))
|
|
900
|
+
id = `${id}-${index}`;
|
|
901
|
+
taken.add(id);
|
|
902
|
+
return {
|
|
903
|
+
id,
|
|
904
|
+
label: ((_a = cell.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || '',
|
|
905
|
+
sortable: flag('sortable', props.sortable),
|
|
906
|
+
hideable: flag('hideable', props.hideable),
|
|
907
|
+
width: !width ? undefined : pixels ? Number(pixels[1]) : width,
|
|
908
|
+
};
|
|
909
|
+
});
|
|
910
|
+
// Compared on everything the header declares, not only the ids: a framework sets `sortable` as
|
|
911
|
+
// a property, and it may land after the table first read the markup. Ids alone would freeze
|
|
912
|
+
// that first reading and quietly drop the sort affordance the consumer asked for.
|
|
913
|
+
const signature = derived.map(c => `${c.id}|${c.sortable}|${c.hideable}|${c.width}`).join();
|
|
914
|
+
if (signature === this.declaredSignature)
|
|
915
|
+
return;
|
|
916
|
+
this.declaredSignature = signature;
|
|
917
|
+
this.fromMarkup = true;
|
|
918
|
+
this.declared = derived;
|
|
919
|
+
this.columnState = derived.map(column => (Object.assign({}, column)));
|
|
920
|
+
if (this.storageKey)
|
|
921
|
+
this.restoreLayout();
|
|
19
922
|
}
|
|
20
|
-
|
|
923
|
+
/** Every header cell on screen, whether the table rendered it or the consumer slotted it. */
|
|
924
|
+
headerCells() {
|
|
21
925
|
var _a;
|
|
22
|
-
|
|
926
|
+
const row = this.slottedRowsAll().find(item => item.hasAttribute('header')) ||
|
|
927
|
+
((_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`${XV_TABLE_ROW_TAG}[header]`));
|
|
928
|
+
if (!row)
|
|
929
|
+
return [];
|
|
930
|
+
return Array.from(row.children).filter(
|
|
931
|
+
// Hidden cells are left out: these are indexed against the visible columns.
|
|
932
|
+
child => child.tagName.toLowerCase() === XV_TABLE_CELL_TAG && !child.hidden);
|
|
933
|
+
}
|
|
934
|
+
/** A header cell knows its column by id, or failing that by its position in the row. */
|
|
935
|
+
columnOf(cell) {
|
|
936
|
+
const id = cell.columnId || cell.getAttribute('column-id');
|
|
937
|
+
if (id)
|
|
938
|
+
return this.columnState.find(column => column.id === id) || null;
|
|
939
|
+
const index = this.headerCells().indexOf(cell);
|
|
940
|
+
return this.visible[index] || null;
|
|
941
|
+
}
|
|
942
|
+
headerCellFrom(event) {
|
|
943
|
+
const path = event.composedPath();
|
|
944
|
+
const cell = path.find(node => { var _a; return ((_a = node === null || node === void 0 ? void 0 : node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === XV_TABLE_CELL_TAG && node.hasAttribute('header'); });
|
|
945
|
+
if (!cell)
|
|
946
|
+
return null;
|
|
947
|
+
const column = this.columnOf(cell);
|
|
948
|
+
return column ? { cell, column } : null;
|
|
949
|
+
}
|
|
950
|
+
clearDragOver() {
|
|
951
|
+
this.dragOverId = '';
|
|
952
|
+
this.headerCells().forEach(item => item.classList.remove('drag-over'));
|
|
953
|
+
}
|
|
954
|
+
setSelection(values) {
|
|
955
|
+
this.selectedValues = values;
|
|
956
|
+
const all = !!values.length && values.length === this.rowValues().length;
|
|
957
|
+
this.selectedChange.emit({ values, all, partial: !!values.length && !all });
|
|
958
|
+
}
|
|
959
|
+
toggleRowSelection(value) {
|
|
960
|
+
const children = this.childValuesOf(value);
|
|
961
|
+
if (children.length) {
|
|
962
|
+
const picked = children.some(child => this.selectedValues.includes(child));
|
|
963
|
+
this.setSelection(picked
|
|
964
|
+
? this.selectedValues.filter(item => !children.includes(item))
|
|
965
|
+
: [...this.selectedValues, ...children]);
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
if (this.selection === 'single') {
|
|
969
|
+
this.setSelection(this.selectedValues.includes(value) ? [] : [value]);
|
|
23
970
|
return;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return 'minmax(0, auto)';
|
|
30
|
-
return `calc(${v} - ${50 / this.colsSize.length}px)`;
|
|
31
|
-
})
|
|
32
|
-
.join(' ') + ' repeat(auto-fit, minmax(0, 1fr))');
|
|
971
|
+
}
|
|
972
|
+
const next = this.selectedValues.includes(value)
|
|
973
|
+
? this.selectedValues.filter(item => item !== value)
|
|
974
|
+
: [...this.selectedValues, value];
|
|
975
|
+
this.setSelection(next);
|
|
33
976
|
}
|
|
34
|
-
|
|
35
|
-
|
|
977
|
+
toggleExpanded(value) {
|
|
978
|
+
const open = this.expandedValues.includes(value);
|
|
979
|
+
const next = open
|
|
980
|
+
? this.expandedValues.filter(item => item !== value)
|
|
981
|
+
: this.expandMode === 'single'
|
|
982
|
+
? [value]
|
|
983
|
+
: [...this.expandedValues, value];
|
|
984
|
+
this.expandedValues = next;
|
|
985
|
+
this.expandedChange.emit({ values: next });
|
|
36
986
|
}
|
|
37
|
-
|
|
38
|
-
|
|
987
|
+
bodyRows() {
|
|
988
|
+
// A collapsed child is not on screen, so it must not take an index in `rowOrderChange`.
|
|
989
|
+
return this.renderedRows().filter(row => row.getAttribute('slot') !== 'footer' && !row.hidden);
|
|
990
|
+
}
|
|
991
|
+
rowFrom(event) {
|
|
992
|
+
if (!this.rowReorderable)
|
|
993
|
+
return null;
|
|
994
|
+
const path = event.composedPath();
|
|
995
|
+
return path.find(node => { var _a; return ((_a = node === null || node === void 0 ? void 0 : node.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === XV_TABLE_ROW_TAG; }) || null;
|
|
996
|
+
}
|
|
997
|
+
/** The same row and cell components the consumer would write by hand. */
|
|
998
|
+
renderHead() {
|
|
999
|
+
const values = this.rowValues();
|
|
1000
|
+
const count = this.selectedValues.length;
|
|
1001
|
+
return (h("xv-table-row", { header: true, part: "head", size: this.size, selectionMode: this.selection, expandMode: this.expandMode, expandable: this.expandMode !== 'none', rowReorderable: this.rowReorderable, rowReorderHandle: this.rowReorderHandle, selected: !!count && count === values.length, partial: !!count && count < values.length, selectable: values.length > 0 }, this.visible.map(column => {
|
|
1002
|
+
var _a;
|
|
1003
|
+
const sortable = this.isSortable(column);
|
|
1004
|
+
const active = sortable && ((_a = this.sortState) === null || _a === void 0 ? void 0 : _a.name) === sortName(column);
|
|
1005
|
+
return (h("xv-table-cell", { key: column.id, header: true, part: "header-cell", columnId: column.id, align: column.headerAlign || 'start', tooltip: column.headerTooltip || '', sortable: sortable, sortDirection: active ? this.sortState.direction : '', resizable: columnAllows(column, this.resizable, 'resizable'), reorderable: columnAllows(column, this.reorderable, 'reorderable'), reorderLabel: this.reorderLabel, ref: element => element && (element.draggable = columnAllows(column, this.reorderable, 'reorderable')) }, column.label));
|
|
1006
|
+
})));
|
|
1007
|
+
}
|
|
1008
|
+
renderDataRow(row, index) {
|
|
1009
|
+
const value = row === null || row === void 0 ? void 0 : row[this.rowKey];
|
|
1010
|
+
return (h("xv-table-row", { key: value !== null && value !== void 0 ? value : index, value: value, size: this.size, hover: this.hover, selectionMode: this.selection, expandMode: this.expandMode, expandable: this.expandMode !== 'none', rowReorderable: this.rowReorderable, rowReorderHandle: this.rowReorderHandle, expandLabel: this.expandLabel, reorderLabel: this.reorderLabel, selected: this.selectedValues.includes(value), expanded: this.expandedValues.includes(value) }, this.visible.map(column => (h("xv-table-cell", { key: column.id, columnId: column.id, align: column.align || 'start', overflow: column.overflow || 'ellipsis', clampLines: column.clampLines || 2 }, formatCell(cellValue(row, column), column, this.localeTag))))));
|
|
1011
|
+
}
|
|
1012
|
+
renderSkeleton() {
|
|
1013
|
+
return Array.from({ length: this.skeletonRows }).map((_, index) => (h("div", { class: "skeleton_row", key: `skeleton-${index}`, "aria-hidden": "true" }, this.visible.map(column => (h("div", { class: "skeleton_cell", key: column.id }, h("span", { class: "skeleton_bar" })))))));
|
|
1014
|
+
}
|
|
1015
|
+
renderColumnPicker() {
|
|
1016
|
+
const hideable = hideableColumns(this.columnState);
|
|
1017
|
+
if (!hideable.length)
|
|
1018
|
+
return null;
|
|
1019
|
+
const changed = isLayoutChanged(diffLayout(this.columnState, this.declared));
|
|
1020
|
+
return (
|
|
1021
|
+
// The picker sits at the right edge, so it opens inward or a container with overflow clips it.
|
|
1022
|
+
h("xv-overflow-menu-v2", { class: "picker", part: "column-picker", position: "right", tooltip: this.columnsLabel }, h("span", { slot: "trigger", class: "picker_trigger" }, h("svg", { viewBox: "0 0 640 512", width: "16", height: "16", role: "img", "aria-hidden": "true" }, h("path", { fill: "currentColor", d: "M448 80l0 352 128 0c8.8 0 16-7.2 16-16l0-320c0-8.8-7.2-16-16-16L448 80zm-48 0L240 80l0 352 160 0 0-352zM192 432l0-352L64 80c-8.8 0-16 7.2-16 16l0 320c0 8.8 7.2 16 16 16l128 0zM0 96C0 60.7 28.7 32 64 32l512 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96z" })), changed && h("span", { class: "picker_marker" })), h("div", { class: "picker_list" }, hideable.map(column => (h("xv-checkbox-v2", { key: column.id, class: "picker_item", checked: !column.hidden, label: column.label || column.id, size: this.size, onEventChange: () => this.toggleColumn(column) }))), changed && (h("xv-button-v2", { variant: "tertiary", size: "sm", onClick: () => this.resetLayout() }, this.resetLabel)))));
|
|
39
1023
|
}
|
|
40
|
-
|
|
1024
|
+
render() {
|
|
1025
|
+
const hasHeading = !!this.label || !!this.description || this.hasSlottedHeading;
|
|
1026
|
+
const count = this.selectedValues.length;
|
|
1027
|
+
const composed = !!this.slottedRowCount;
|
|
1028
|
+
const pages = totalPages(this.rowTotal, this.pageSize);
|
|
1029
|
+
return (h(Host, { key: 'c2f1eeb31477c009112ea67964859a06f32fb0be', class: { 'is-dragging': this.columnDragging } }, hasHeading && (h("div", { key: 'b16d5ed6a0ec41e1e93938c136720a9b3f076718', class: "heading", part: "heading" }, h("slot", { key: 'b5597ee8f3e1b43c8a003bf51f0dd1fdea307584', name: "label" }, this.label && h("h3", { key: '7b5c70866bbea7f38bd9ed3f12f5f79abdec9b5b', class: "heading_title", part: "title" }, this.label)), h("slot", { key: 'e3fc65553d7d8afa5617116ef03c0e71c4083092', name: "description" }, this.description && h("p", { key: 'f3545d3da1697eadb58b081db1f63dbc758446a2', class: "heading_description", part: "description" }, this.description)))), h("div", { key: 'b2363cd4706ef813a7986a46e634c7a17c2887e7', class: "bar", part: "bar" }, h("div", { key: 'b4ed99838d302c23e539d3f0aed986d6597cfa97', class: "bar_toolbar", part: "toolbar" }, h("slot", { key: '7dfe5fe111ac94245b57d9b16db98e86df96e14d', name: "toolbar" }), this.renderColumnPicker()), !!count && (h("div", { key: '00e6baa9e59099c688f398f98552e96accfcfdbd', class: "bar_batch", part: "batch" }, h("slot", { key: '719ccca8dc2d5728ceec0fa5953ec45148fbfca7', name: "batch" }), !!this.selectedLabel && (h("span", { key: 'ae71c3c543d5faef29145a32c0cee9f2d9c5441e', class: "bar_count" }, this.selectedLabel.replace('{count}', String(count))))))), h("div", { key: '0739869a681a870c611b50b8cec858bf8c60b2fb', class: { scroll: true, 'scroll--overflowing': this.overflowing }, part: "scroll", ref: element => (this.scrollEl = element) }, h("div", { key: '978390fa1eed594533ac9911eae893cdbcb48f01', class: "grid", part: "grid", role: "table", onPointerDown: this.headPointerDown, onDblClick: this.headDblClick, onKeyDown: this.headKeyDown, onDragStart: this.headDragStart, onDragOver: this.headDragOver, onDrop: this.headDrop, onDragEnd: this.dragEnd, ref: element => (this.gridEl = element), style: {
|
|
1030
|
+
'--xv-table-columns': this.template,
|
|
1031
|
+
// Handed to CSS rather than applied here: a wide table squeezes like a real one, and
|
|
1032
|
+
// only a narrow viewport turns this into the width it scrolls at.
|
|
1033
|
+
'--xv-table-min-width': `${tableMinWidth(this.columnState, this.minWidth, [...this.leadingTracks, ...this.trailingTracks].reduce((a, b) => a + b, 0))}px`,
|
|
1034
|
+
}, onClick: this.gridClick }, !this.hasSlottedHeader && this.renderHead(), h("div", { key: '22295be916a60272a46fe01cf3399b345e274948', class: "body", part: "body", role: "rowgroup", hidden: this.layoutPending, onDragStart: this.rowReorderable ? this.rowDragStart : undefined, onDragOver: this.rowReorderable ? this.rowDragOver : undefined, onDrop: this.rowReorderable ? this.rowDrop : undefined, onDragEnd: this.rowReorderable ? this.rowDragEnd : undefined }, this.loading && this.skeletonRows > 0
|
|
1035
|
+
? this.renderSkeleton()
|
|
1036
|
+
: composed
|
|
1037
|
+
? null
|
|
1038
|
+
: this.dataRows.map((row, index) => this.renderDataRow(row, index)), h("slot", { key: '05441531d73c716d3846794bea921eafa2b61533' })), h("slot", { key: 'e9f573271b2a6b19f212b598cd4471ee0070e340', name: "footer" }))), this.isEmpty && (h("div", { key: '4ceb6586322442b2fe48c3191641ce7857ef8f4b', class: "empty", part: "empty" }, h("slot", { key: '6213459f9c9657174edbb8b41daa48672b8f0a51', name: "empty" }, this.emptyLabel))), this.loading && !this.skeletonRows && (h("div", { key: 'edd362ca185dcd335b76b6c1c1369b886a97864c', class: "loading", part: "loading" }, h("xv-loader-v2", { key: '8d73899654faa6bb8b403f1aad2a426ad595bfa9', size: SIZE_VAR.LG }))), this.paginationMode !== 'none' && !!this.rowTotal && (h("xv-pagination", { key: '64f7884cf9dd446c5cad790f5bca97fbe33522b9', class: "pagination", part: "pagination", size: this.size, variant: "full", block: true, total: pages, page: this.page, totalItems: this.rowTotal, itemsPerPage: this.pageSize, itemsPerPageOptions: parsePageSizes(this.pageSizeOptions), responsiveVariant: { compact: [0, 768] }, onPageChange: this.paginationChanged }))));
|
|
1039
|
+
}
|
|
1040
|
+
static get is() { return "xv-table"; }
|
|
41
1041
|
static get encapsulation() { return "shadow"; }
|
|
42
1042
|
static get originalStyleUrls() {
|
|
43
1043
|
return {
|
|
@@ -51,6 +1051,73 @@ export class XvTable {
|
|
|
51
1051
|
}
|
|
52
1052
|
static get properties() {
|
|
53
1053
|
return {
|
|
1054
|
+
"columns": {
|
|
1055
|
+
"type": "string",
|
|
1056
|
+
"mutable": false,
|
|
1057
|
+
"complexType": {
|
|
1058
|
+
"original": "string | XvTableColumn[]",
|
|
1059
|
+
"resolved": "XvTableColumn[] | string",
|
|
1060
|
+
"references": {
|
|
1061
|
+
"XvTableColumn": {
|
|
1062
|
+
"location": "import",
|
|
1063
|
+
"path": "./xv-table.model",
|
|
1064
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTableColumn",
|
|
1065
|
+
"referenceLocation": "XvTableColumn"
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
},
|
|
1069
|
+
"required": false,
|
|
1070
|
+
"optional": false,
|
|
1071
|
+
"docs": {
|
|
1072
|
+
"tags": [],
|
|
1073
|
+
"text": "Column definitions. Accepts its JSON string form so it is settable from plain markup."
|
|
1074
|
+
},
|
|
1075
|
+
"getter": false,
|
|
1076
|
+
"setter": false,
|
|
1077
|
+
"reflect": false,
|
|
1078
|
+
"attribute": "columns",
|
|
1079
|
+
"defaultValue": "[]"
|
|
1080
|
+
},
|
|
1081
|
+
"rows": {
|
|
1082
|
+
"type": "string",
|
|
1083
|
+
"mutable": false,
|
|
1084
|
+
"complexType": {
|
|
1085
|
+
"original": "string | any[]",
|
|
1086
|
+
"resolved": "any[] | string",
|
|
1087
|
+
"references": {}
|
|
1088
|
+
},
|
|
1089
|
+
"required": false,
|
|
1090
|
+
"optional": false,
|
|
1091
|
+
"docs": {
|
|
1092
|
+
"tags": [],
|
|
1093
|
+
"text": "Row data. Ignored when `xv-table-row` children are slotted."
|
|
1094
|
+
},
|
|
1095
|
+
"getter": false,
|
|
1096
|
+
"setter": false,
|
|
1097
|
+
"reflect": false,
|
|
1098
|
+
"attribute": "rows",
|
|
1099
|
+
"defaultValue": "[]"
|
|
1100
|
+
},
|
|
1101
|
+
"rowKey": {
|
|
1102
|
+
"type": "string",
|
|
1103
|
+
"mutable": false,
|
|
1104
|
+
"complexType": {
|
|
1105
|
+
"original": "string",
|
|
1106
|
+
"resolved": "string",
|
|
1107
|
+
"references": {}
|
|
1108
|
+
},
|
|
1109
|
+
"required": false,
|
|
1110
|
+
"optional": false,
|
|
1111
|
+
"docs": {
|
|
1112
|
+
"tags": [],
|
|
1113
|
+
"text": "Property of a row object that identifies it in selection and expansion payloads."
|
|
1114
|
+
},
|
|
1115
|
+
"getter": false,
|
|
1116
|
+
"setter": false,
|
|
1117
|
+
"reflect": false,
|
|
1118
|
+
"attribute": "row-key",
|
|
1119
|
+
"defaultValue": "'id'"
|
|
1120
|
+
},
|
|
54
1121
|
"size": {
|
|
55
1122
|
"type": "string",
|
|
56
1123
|
"mutable": false,
|
|
@@ -70,7 +1137,7 @@ export class XvTable {
|
|
|
70
1137
|
"optional": false,
|
|
71
1138
|
"docs": {
|
|
72
1139
|
"tags": [],
|
|
73
|
-
"text": ""
|
|
1140
|
+
"text": "Row height ladder."
|
|
74
1141
|
},
|
|
75
1142
|
"getter": false,
|
|
76
1143
|
"setter": false,
|
|
@@ -78,7 +1145,7 @@ export class XvTable {
|
|
|
78
1145
|
"attribute": "size",
|
|
79
1146
|
"defaultValue": "SIZE_VAR.MD"
|
|
80
1147
|
},
|
|
81
|
-
"
|
|
1148
|
+
"block": {
|
|
82
1149
|
"type": "boolean",
|
|
83
1150
|
"mutable": false,
|
|
84
1151
|
"complexType": {
|
|
@@ -87,15 +1154,16 @@ export class XvTable {
|
|
|
87
1154
|
"references": {}
|
|
88
1155
|
},
|
|
89
1156
|
"required": false,
|
|
90
|
-
"optional":
|
|
1157
|
+
"optional": false,
|
|
91
1158
|
"docs": {
|
|
92
1159
|
"tags": [],
|
|
93
|
-
"text": ""
|
|
1160
|
+
"text": "Stretches the table to the full width of its container."
|
|
94
1161
|
},
|
|
95
1162
|
"getter": false,
|
|
96
1163
|
"setter": false,
|
|
97
1164
|
"reflect": true,
|
|
98
|
-
"attribute": "
|
|
1165
|
+
"attribute": "block",
|
|
1166
|
+
"defaultValue": "false"
|
|
99
1167
|
},
|
|
100
1168
|
"loading": {
|
|
101
1169
|
"type": "boolean",
|
|
@@ -106,55 +1174,980 @@ export class XvTable {
|
|
|
106
1174
|
"references": {}
|
|
107
1175
|
},
|
|
108
1176
|
"required": false,
|
|
109
|
-
"optional":
|
|
1177
|
+
"optional": false,
|
|
110
1178
|
"docs": {
|
|
111
1179
|
"tags": [],
|
|
112
|
-
"text": ""
|
|
1180
|
+
"text": "Covers the body with a loading state."
|
|
113
1181
|
},
|
|
114
1182
|
"getter": false,
|
|
115
1183
|
"setter": false,
|
|
116
1184
|
"reflect": true,
|
|
117
|
-
"attribute": "loading"
|
|
1185
|
+
"attribute": "loading",
|
|
1186
|
+
"defaultValue": "false"
|
|
1187
|
+
},
|
|
1188
|
+
"skeletonRows": {
|
|
1189
|
+
"type": "number",
|
|
1190
|
+
"mutable": false,
|
|
1191
|
+
"complexType": {
|
|
1192
|
+
"original": "number",
|
|
1193
|
+
"resolved": "number",
|
|
1194
|
+
"references": {}
|
|
1195
|
+
},
|
|
1196
|
+
"required": false,
|
|
1197
|
+
"optional": false,
|
|
1198
|
+
"docs": {
|
|
1199
|
+
"tags": [],
|
|
1200
|
+
"text": "Placeholder rows drawn while `loading`. Zero draws a spinner instead."
|
|
1201
|
+
},
|
|
1202
|
+
"getter": false,
|
|
1203
|
+
"setter": false,
|
|
1204
|
+
"reflect": false,
|
|
1205
|
+
"attribute": "skeleton-rows",
|
|
1206
|
+
"defaultValue": "0"
|
|
118
1207
|
},
|
|
119
|
-
"
|
|
120
|
-
"type": "
|
|
1208
|
+
"hover": {
|
|
1209
|
+
"type": "boolean",
|
|
121
1210
|
"mutable": false,
|
|
122
1211
|
"complexType": {
|
|
123
|
-
"original": "
|
|
124
|
-
"resolved": "
|
|
1212
|
+
"original": "boolean",
|
|
1213
|
+
"resolved": "boolean",
|
|
125
1214
|
"references": {}
|
|
126
1215
|
},
|
|
127
1216
|
"required": false,
|
|
128
|
-
"optional":
|
|
1217
|
+
"optional": false,
|
|
129
1218
|
"docs": {
|
|
130
1219
|
"tags": [],
|
|
131
|
-
"text": ""
|
|
1220
|
+
"text": "Highlights a row on pointer hover."
|
|
132
1221
|
},
|
|
133
1222
|
"getter": false,
|
|
134
|
-
"setter": false
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
1223
|
+
"setter": false,
|
|
1224
|
+
"reflect": true,
|
|
1225
|
+
"attribute": "hover",
|
|
1226
|
+
"defaultValue": "false"
|
|
1227
|
+
},
|
|
1228
|
+
"rowClickable": {
|
|
1229
|
+
"type": "boolean",
|
|
1230
|
+
"mutable": false,
|
|
1231
|
+
"complexType": {
|
|
1232
|
+
"original": "boolean",
|
|
1233
|
+
"resolved": "boolean",
|
|
1234
|
+
"references": {}
|
|
1235
|
+
},
|
|
1236
|
+
"required": false,
|
|
1237
|
+
"optional": false,
|
|
1238
|
+
"docs": {
|
|
1239
|
+
"tags": [],
|
|
1240
|
+
"text": "Emits `rowClick` when a row is clicked outside an interactive element."
|
|
1241
|
+
},
|
|
1242
|
+
"getter": false,
|
|
1243
|
+
"setter": false,
|
|
1244
|
+
"reflect": true,
|
|
1245
|
+
"attribute": "row-clickable",
|
|
1246
|
+
"defaultValue": "false"
|
|
1247
|
+
},
|
|
1248
|
+
"label": {
|
|
1249
|
+
"type": "string",
|
|
1250
|
+
"mutable": false,
|
|
1251
|
+
"complexType": {
|
|
1252
|
+
"original": "string",
|
|
1253
|
+
"resolved": "string",
|
|
1254
|
+
"references": {}
|
|
1255
|
+
},
|
|
1256
|
+
"required": false,
|
|
1257
|
+
"optional": false,
|
|
1258
|
+
"docs": {
|
|
1259
|
+
"tags": [],
|
|
1260
|
+
"text": "Title above the table."
|
|
1261
|
+
},
|
|
1262
|
+
"getter": false,
|
|
1263
|
+
"setter": false,
|
|
1264
|
+
"reflect": false,
|
|
1265
|
+
"attribute": "label",
|
|
1266
|
+
"defaultValue": "''"
|
|
1267
|
+
},
|
|
1268
|
+
"description": {
|
|
1269
|
+
"type": "string",
|
|
1270
|
+
"mutable": false,
|
|
1271
|
+
"complexType": {
|
|
1272
|
+
"original": "string",
|
|
1273
|
+
"resolved": "string",
|
|
1274
|
+
"references": {}
|
|
1275
|
+
},
|
|
1276
|
+
"required": false,
|
|
1277
|
+
"optional": false,
|
|
1278
|
+
"docs": {
|
|
1279
|
+
"tags": [],
|
|
1280
|
+
"text": "Supporting text under the title."
|
|
1281
|
+
},
|
|
1282
|
+
"getter": false,
|
|
1283
|
+
"setter": false,
|
|
1284
|
+
"reflect": false,
|
|
1285
|
+
"attribute": "description",
|
|
1286
|
+
"defaultValue": "''"
|
|
1287
|
+
},
|
|
1288
|
+
"emptyLabel": {
|
|
1289
|
+
"type": "string",
|
|
1290
|
+
"mutable": false,
|
|
1291
|
+
"complexType": {
|
|
1292
|
+
"original": "string",
|
|
1293
|
+
"resolved": "string",
|
|
1294
|
+
"references": {}
|
|
1295
|
+
},
|
|
1296
|
+
"required": false,
|
|
1297
|
+
"optional": false,
|
|
1298
|
+
"docs": {
|
|
1299
|
+
"tags": [],
|
|
1300
|
+
"text": "Shown when there are no rows."
|
|
1301
|
+
},
|
|
1302
|
+
"getter": false,
|
|
1303
|
+
"setter": false,
|
|
1304
|
+
"reflect": false,
|
|
1305
|
+
"attribute": "empty-label",
|
|
1306
|
+
"defaultValue": "''"
|
|
1307
|
+
},
|
|
1308
|
+
"selectedLabel": {
|
|
1309
|
+
"type": "string",
|
|
1310
|
+
"mutable": false,
|
|
1311
|
+
"complexType": {
|
|
1312
|
+
"original": "string",
|
|
1313
|
+
"resolved": "string",
|
|
1314
|
+
"references": {}
|
|
1315
|
+
},
|
|
1316
|
+
"required": false,
|
|
1317
|
+
"optional": false,
|
|
1318
|
+
"docs": {
|
|
1319
|
+
"tags": [],
|
|
1320
|
+
"text": "Text of the batch bar counter. `{count}` is replaced with the number of selected rows."
|
|
1321
|
+
},
|
|
1322
|
+
"getter": false,
|
|
1323
|
+
"setter": false,
|
|
1324
|
+
"reflect": false,
|
|
1325
|
+
"attribute": "selected-label",
|
|
1326
|
+
"defaultValue": "''"
|
|
1327
|
+
},
|
|
1328
|
+
"columnsLabel": {
|
|
1329
|
+
"type": "string",
|
|
1330
|
+
"mutable": false,
|
|
1331
|
+
"complexType": {
|
|
1332
|
+
"original": "string",
|
|
1333
|
+
"resolved": "string",
|
|
1334
|
+
"references": {}
|
|
1335
|
+
},
|
|
1336
|
+
"required": false,
|
|
1337
|
+
"optional": false,
|
|
1338
|
+
"docs": {
|
|
1339
|
+
"tags": [],
|
|
1340
|
+
"text": "Tooltip on the column picker trigger."
|
|
1341
|
+
},
|
|
1342
|
+
"getter": false,
|
|
1343
|
+
"setter": false,
|
|
1344
|
+
"reflect": false,
|
|
1345
|
+
"attribute": "columns-label",
|
|
1346
|
+
"defaultValue": "'Columns'"
|
|
1347
|
+
},
|
|
1348
|
+
"resetLabel": {
|
|
1349
|
+
"type": "string",
|
|
1350
|
+
"mutable": false,
|
|
1351
|
+
"complexType": {
|
|
1352
|
+
"original": "string",
|
|
1353
|
+
"resolved": "string",
|
|
1354
|
+
"references": {}
|
|
1355
|
+
},
|
|
1356
|
+
"required": false,
|
|
1357
|
+
"optional": false,
|
|
1358
|
+
"docs": {
|
|
1359
|
+
"tags": [],
|
|
1360
|
+
"text": "Text of the button that restores the declared column layout."
|
|
1361
|
+
},
|
|
1362
|
+
"getter": false,
|
|
1363
|
+
"setter": false,
|
|
1364
|
+
"reflect": false,
|
|
1365
|
+
"attribute": "reset-label",
|
|
1366
|
+
"defaultValue": "'Reset'"
|
|
1367
|
+
},
|
|
1368
|
+
"expandLabel": {
|
|
1369
|
+
"type": "string",
|
|
1370
|
+
"mutable": false,
|
|
1371
|
+
"complexType": {
|
|
1372
|
+
"original": "string",
|
|
1373
|
+
"resolved": "string",
|
|
1374
|
+
"references": {}
|
|
1375
|
+
},
|
|
1376
|
+
"required": false,
|
|
1377
|
+
"optional": false,
|
|
1378
|
+
"docs": {
|
|
1379
|
+
"tags": [],
|
|
1380
|
+
"text": "Accessible name of a row's expand toggle."
|
|
1381
|
+
},
|
|
1382
|
+
"getter": false,
|
|
1383
|
+
"setter": false,
|
|
1384
|
+
"reflect": false,
|
|
1385
|
+
"attribute": "expand-label",
|
|
1386
|
+
"defaultValue": "'Toggle row'"
|
|
1387
|
+
},
|
|
1388
|
+
"reorderLabel": {
|
|
1389
|
+
"type": "string",
|
|
1390
|
+
"mutable": false,
|
|
1391
|
+
"complexType": {
|
|
1392
|
+
"original": "string",
|
|
1393
|
+
"resolved": "string",
|
|
1394
|
+
"references": {}
|
|
1395
|
+
},
|
|
1396
|
+
"required": false,
|
|
1397
|
+
"optional": false,
|
|
1398
|
+
"docs": {
|
|
1399
|
+
"tags": [],
|
|
1400
|
+
"text": "Accessible name of a row's drag grip."
|
|
1401
|
+
},
|
|
1402
|
+
"getter": false,
|
|
1403
|
+
"setter": false,
|
|
1404
|
+
"reflect": false,
|
|
1405
|
+
"attribute": "reorder-label",
|
|
1406
|
+
"defaultValue": "'Drag to reorder'"
|
|
1407
|
+
},
|
|
1408
|
+
"sortMode": {
|
|
1409
|
+
"type": "string",
|
|
1410
|
+
"mutable": false,
|
|
1411
|
+
"complexType": {
|
|
1412
|
+
"original": "XvTableMode",
|
|
1413
|
+
"resolved": "\"client\" | \"none\" | \"server\"",
|
|
1414
|
+
"references": {
|
|
1415
|
+
"XvTableMode": {
|
|
1416
|
+
"location": "import",
|
|
1417
|
+
"path": "./xv-table.model",
|
|
1418
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTableMode",
|
|
1419
|
+
"referenceLocation": "XvTableMode"
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
},
|
|
1423
|
+
"required": false,
|
|
1424
|
+
"optional": false,
|
|
1425
|
+
"docs": {
|
|
1426
|
+
"tags": [],
|
|
1427
|
+
"text": "`none` makes headers inert whatever the column says; `client` sorts the `rows` prop itself;\n`server` offers the affordance and only emits `sortChange` for the consumer to reload."
|
|
1428
|
+
},
|
|
1429
|
+
"getter": false,
|
|
1430
|
+
"setter": false,
|
|
1431
|
+
"reflect": false,
|
|
1432
|
+
"attribute": "sort-mode",
|
|
1433
|
+
"defaultValue": "'none'"
|
|
1434
|
+
},
|
|
1435
|
+
"sortBy": {
|
|
1436
|
+
"type": "string",
|
|
1437
|
+
"mutable": false,
|
|
1438
|
+
"complexType": {
|
|
1439
|
+
"original": "string | XvTableSort",
|
|
1440
|
+
"resolved": "XvTableSort | string",
|
|
1441
|
+
"references": {
|
|
1442
|
+
"XvTableSort": {
|
|
1443
|
+
"location": "import",
|
|
1444
|
+
"path": "./xv-table.model",
|
|
1445
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTableSort",
|
|
1446
|
+
"referenceLocation": "XvTableSort"
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
},
|
|
1450
|
+
"required": false,
|
|
1451
|
+
"optional": false,
|
|
1452
|
+
"docs": {
|
|
1453
|
+
"tags": [],
|
|
1454
|
+
"text": "Active sort, as `asc(field)` / `desc(field)` or an object."
|
|
1455
|
+
},
|
|
1456
|
+
"getter": false,
|
|
1457
|
+
"setter": false,
|
|
1458
|
+
"reflect": false,
|
|
1459
|
+
"attribute": "sort-by",
|
|
1460
|
+
"defaultValue": "''"
|
|
1461
|
+
},
|
|
1462
|
+
"selection": {
|
|
1463
|
+
"type": "string",
|
|
1464
|
+
"mutable": false,
|
|
1465
|
+
"complexType": {
|
|
1466
|
+
"original": "XvTableSelectionMode",
|
|
1467
|
+
"resolved": "\"multiple\" | \"none\" | \"single\"",
|
|
1468
|
+
"references": {
|
|
1469
|
+
"XvTableSelectionMode": {
|
|
1470
|
+
"location": "import",
|
|
1471
|
+
"path": "./xv-table.model",
|
|
1472
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTableSelectionMode",
|
|
1473
|
+
"referenceLocation": "XvTableSelectionMode"
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
},
|
|
1477
|
+
"required": false,
|
|
1478
|
+
"optional": false,
|
|
1479
|
+
"docs": {
|
|
1480
|
+
"tags": [],
|
|
1481
|
+
"text": "`multiple` renders checkboxes, `single` renders radios."
|
|
1482
|
+
},
|
|
1483
|
+
"getter": false,
|
|
1484
|
+
"setter": false,
|
|
1485
|
+
"reflect": true,
|
|
1486
|
+
"attribute": "selection",
|
|
1487
|
+
"defaultValue": "'none'"
|
|
1488
|
+
},
|
|
1489
|
+
"selected": {
|
|
1490
|
+
"type": "string",
|
|
1491
|
+
"mutable": false,
|
|
1492
|
+
"complexType": {
|
|
1493
|
+
"original": "string | unknown[]",
|
|
1494
|
+
"resolved": "string | unknown[]",
|
|
1495
|
+
"references": {}
|
|
1496
|
+
},
|
|
1497
|
+
"required": false,
|
|
1498
|
+
"optional": false,
|
|
1499
|
+
"docs": {
|
|
1500
|
+
"tags": [],
|
|
1501
|
+
"text": "Values of the selected rows."
|
|
1502
|
+
},
|
|
1503
|
+
"getter": false,
|
|
1504
|
+
"setter": false,
|
|
1505
|
+
"reflect": false,
|
|
1506
|
+
"attribute": "selected",
|
|
1507
|
+
"defaultValue": "[]"
|
|
1508
|
+
},
|
|
1509
|
+
"expandMode": {
|
|
1510
|
+
"type": "string",
|
|
1511
|
+
"mutable": false,
|
|
1512
|
+
"complexType": {
|
|
1513
|
+
"original": "XvTableExpandMode",
|
|
1514
|
+
"resolved": "\"multiple\" | \"none\" | \"single\"",
|
|
1515
|
+
"references": {
|
|
1516
|
+
"XvTableExpandMode": {
|
|
1517
|
+
"location": "import",
|
|
1518
|
+
"path": "./xv-table.model",
|
|
1519
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTableExpandMode",
|
|
1520
|
+
"referenceLocation": "XvTableExpandMode"
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
},
|
|
1524
|
+
"required": false,
|
|
1525
|
+
"optional": false,
|
|
1526
|
+
"docs": {
|
|
1527
|
+
"tags": [],
|
|
1528
|
+
"text": "Whether rows expand, and whether more than one may be open."
|
|
1529
|
+
},
|
|
1530
|
+
"getter": false,
|
|
1531
|
+
"setter": false,
|
|
1532
|
+
"reflect": true,
|
|
1533
|
+
"attribute": "expand-mode",
|
|
1534
|
+
"defaultValue": "'none'"
|
|
1535
|
+
},
|
|
1536
|
+
"expanded": {
|
|
1537
|
+
"type": "string",
|
|
1538
|
+
"mutable": false,
|
|
1539
|
+
"complexType": {
|
|
1540
|
+
"original": "string | unknown[]",
|
|
1541
|
+
"resolved": "string | unknown[]",
|
|
1542
|
+
"references": {}
|
|
1543
|
+
},
|
|
1544
|
+
"required": false,
|
|
1545
|
+
"optional": false,
|
|
1546
|
+
"docs": {
|
|
1547
|
+
"tags": [],
|
|
1548
|
+
"text": "Values of the expanded rows."
|
|
1549
|
+
},
|
|
1550
|
+
"getter": false,
|
|
1551
|
+
"setter": false,
|
|
1552
|
+
"reflect": false,
|
|
1553
|
+
"attribute": "expanded",
|
|
1554
|
+
"defaultValue": "[]"
|
|
1555
|
+
},
|
|
1556
|
+
"paginationMode": {
|
|
1557
|
+
"type": "string",
|
|
1558
|
+
"mutable": false,
|
|
1559
|
+
"complexType": {
|
|
1560
|
+
"original": "XvTableMode",
|
|
1561
|
+
"resolved": "\"client\" | \"none\" | \"server\"",
|
|
1562
|
+
"references": {
|
|
1563
|
+
"XvTableMode": {
|
|
1564
|
+
"location": "import",
|
|
1565
|
+
"path": "./xv-table.model",
|
|
1566
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTableMode",
|
|
1567
|
+
"referenceLocation": "XvTableMode"
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
},
|
|
1571
|
+
"required": false,
|
|
1572
|
+
"optional": false,
|
|
1573
|
+
"docs": {
|
|
1574
|
+
"tags": [],
|
|
1575
|
+
"text": "`client` slices the `rows` prop; `server` only emits `pageChange`."
|
|
1576
|
+
},
|
|
1577
|
+
"getter": false,
|
|
1578
|
+
"setter": false,
|
|
1579
|
+
"reflect": false,
|
|
1580
|
+
"attribute": "pagination-mode",
|
|
1581
|
+
"defaultValue": "'none'"
|
|
1582
|
+
},
|
|
1583
|
+
"page": {
|
|
1584
|
+
"type": "number",
|
|
1585
|
+
"mutable": true,
|
|
1586
|
+
"complexType": {
|
|
1587
|
+
"original": "number",
|
|
1588
|
+
"resolved": "number",
|
|
1589
|
+
"references": {}
|
|
1590
|
+
},
|
|
1591
|
+
"required": false,
|
|
1592
|
+
"optional": false,
|
|
1593
|
+
"docs": {
|
|
1594
|
+
"tags": [],
|
|
1595
|
+
"text": "Current page, 1-based."
|
|
1596
|
+
},
|
|
1597
|
+
"getter": false,
|
|
1598
|
+
"setter": false,
|
|
1599
|
+
"reflect": false,
|
|
1600
|
+
"attribute": "page",
|
|
1601
|
+
"defaultValue": "1"
|
|
1602
|
+
},
|
|
1603
|
+
"pageSize": {
|
|
1604
|
+
"type": "number",
|
|
1605
|
+
"mutable": true,
|
|
1606
|
+
"complexType": {
|
|
1607
|
+
"original": "number",
|
|
1608
|
+
"resolved": "number",
|
|
1609
|
+
"references": {}
|
|
1610
|
+
},
|
|
1611
|
+
"required": false,
|
|
1612
|
+
"optional": false,
|
|
1613
|
+
"docs": {
|
|
1614
|
+
"tags": [],
|
|
1615
|
+
"text": "Rows per page."
|
|
1616
|
+
},
|
|
1617
|
+
"getter": false,
|
|
1618
|
+
"setter": false,
|
|
1619
|
+
"reflect": false,
|
|
1620
|
+
"attribute": "page-size",
|
|
1621
|
+
"defaultValue": "10"
|
|
1622
|
+
},
|
|
1623
|
+
"total": {
|
|
1624
|
+
"type": "number",
|
|
1625
|
+
"mutable": false,
|
|
1626
|
+
"complexType": {
|
|
1627
|
+
"original": "number",
|
|
1628
|
+
"resolved": "number",
|
|
1629
|
+
"references": {}
|
|
1630
|
+
},
|
|
1631
|
+
"required": false,
|
|
1632
|
+
"optional": false,
|
|
1633
|
+
"docs": {
|
|
1634
|
+
"tags": [],
|
|
1635
|
+
"text": "Total row count, for `server` pagination."
|
|
1636
|
+
},
|
|
1637
|
+
"getter": false,
|
|
1638
|
+
"setter": false,
|
|
1639
|
+
"reflect": false,
|
|
1640
|
+
"attribute": "total",
|
|
1641
|
+
"defaultValue": "0"
|
|
1642
|
+
},
|
|
1643
|
+
"pageSizeOptions": {
|
|
1644
|
+
"type": "string",
|
|
1645
|
+
"mutable": false,
|
|
1646
|
+
"complexType": {
|
|
1647
|
+
"original": "string | number[]",
|
|
1648
|
+
"resolved": "number[] | string",
|
|
1649
|
+
"references": {}
|
|
1650
|
+
},
|
|
1651
|
+
"required": false,
|
|
1652
|
+
"optional": false,
|
|
1653
|
+
"docs": {
|
|
1654
|
+
"tags": [],
|
|
1655
|
+
"text": "Page size choices. Accepts a comma-separated attribute."
|
|
1656
|
+
},
|
|
1657
|
+
"getter": false,
|
|
1658
|
+
"setter": false,
|
|
1659
|
+
"reflect": false,
|
|
1660
|
+
"attribute": "page-size-options",
|
|
1661
|
+
"defaultValue": "[10, 20, 30, 40, 50, 100]"
|
|
1662
|
+
},
|
|
1663
|
+
"resizable": {
|
|
1664
|
+
"type": "boolean",
|
|
1665
|
+
"mutable": false,
|
|
1666
|
+
"complexType": {
|
|
1667
|
+
"original": "boolean",
|
|
1668
|
+
"resolved": "boolean",
|
|
1669
|
+
"references": {}
|
|
1670
|
+
},
|
|
1671
|
+
"required": false,
|
|
1672
|
+
"optional": false,
|
|
1673
|
+
"docs": {
|
|
1674
|
+
"tags": [],
|
|
1675
|
+
"text": "Allows dragging column edges. Off by default: no handle is rendered and nothing is bound\nuntil it is switched on. A column may switch itself off, never on."
|
|
1676
|
+
},
|
|
1677
|
+
"getter": false,
|
|
1678
|
+
"setter": false,
|
|
1679
|
+
"reflect": false,
|
|
1680
|
+
"attribute": "resizable",
|
|
1681
|
+
"defaultValue": "false"
|
|
1682
|
+
},
|
|
1683
|
+
"reorderable": {
|
|
1684
|
+
"type": "boolean",
|
|
1685
|
+
"mutable": false,
|
|
1686
|
+
"complexType": {
|
|
1687
|
+
"original": "boolean",
|
|
1688
|
+
"resolved": "boolean",
|
|
1689
|
+
"references": {}
|
|
1690
|
+
},
|
|
1691
|
+
"required": false,
|
|
1692
|
+
"optional": false,
|
|
1693
|
+
"docs": {
|
|
1694
|
+
"tags": [],
|
|
1695
|
+
"text": "Allows dragging column headers into a new order. Off by default, like `resizable`."
|
|
1696
|
+
},
|
|
1697
|
+
"getter": false,
|
|
1698
|
+
"setter": false,
|
|
1699
|
+
"reflect": false,
|
|
1700
|
+
"attribute": "reorderable",
|
|
1701
|
+
"defaultValue": "false"
|
|
1702
|
+
},
|
|
1703
|
+
"rowReorderable": {
|
|
1704
|
+
"type": "boolean",
|
|
1705
|
+
"mutable": false,
|
|
1706
|
+
"complexType": {
|
|
1707
|
+
"original": "boolean",
|
|
1708
|
+
"resolved": "boolean",
|
|
1709
|
+
"references": {}
|
|
1710
|
+
},
|
|
1711
|
+
"required": false,
|
|
1712
|
+
"optional": false,
|
|
1713
|
+
"docs": {
|
|
1714
|
+
"tags": [],
|
|
1715
|
+
"text": "Allows dragging rows into a new order. Off by default: nothing is bound and no handle is\nrendered until it is switched on."
|
|
1716
|
+
},
|
|
1717
|
+
"getter": false,
|
|
1718
|
+
"setter": false,
|
|
1719
|
+
"reflect": false,
|
|
1720
|
+
"attribute": "row-reorderable",
|
|
1721
|
+
"defaultValue": "false"
|
|
1722
|
+
},
|
|
1723
|
+
"rowReorderHandle": {
|
|
1724
|
+
"type": "string",
|
|
1725
|
+
"mutable": false,
|
|
1726
|
+
"complexType": {
|
|
1727
|
+
"original": "'icon' | 'row'",
|
|
1728
|
+
"resolved": "\"icon\" | \"row\"",
|
|
1729
|
+
"references": {}
|
|
1730
|
+
},
|
|
1731
|
+
"required": false,
|
|
1732
|
+
"optional": false,
|
|
1733
|
+
"docs": {
|
|
1734
|
+
"tags": [],
|
|
1735
|
+
"text": "Whether the whole row drags, or only a grip in a leading control cell."
|
|
1736
|
+
},
|
|
1737
|
+
"getter": false,
|
|
1738
|
+
"setter": false,
|
|
1739
|
+
"reflect": false,
|
|
1740
|
+
"attribute": "row-reorder-handle",
|
|
1741
|
+
"defaultValue": "'icon'"
|
|
1742
|
+
},
|
|
1743
|
+
"stickyHeader": {
|
|
1744
|
+
"type": "boolean",
|
|
1745
|
+
"mutable": false,
|
|
1746
|
+
"complexType": {
|
|
1747
|
+
"original": "boolean",
|
|
1748
|
+
"resolved": "boolean",
|
|
1749
|
+
"references": {}
|
|
1750
|
+
},
|
|
1751
|
+
"required": false,
|
|
1752
|
+
"optional": false,
|
|
1753
|
+
"docs": {
|
|
1754
|
+
"tags": [],
|
|
1755
|
+
"text": "Keeps the header visible while the body scrolls."
|
|
1756
|
+
},
|
|
1757
|
+
"getter": false,
|
|
1758
|
+
"setter": false,
|
|
1759
|
+
"reflect": true,
|
|
1760
|
+
"attribute": "sticky-header",
|
|
1761
|
+
"defaultValue": "false"
|
|
1762
|
+
},
|
|
1763
|
+
"minWidth": {
|
|
1764
|
+
"type": "number",
|
|
1765
|
+
"mutable": false,
|
|
1766
|
+
"complexType": {
|
|
1767
|
+
"original": "number",
|
|
1768
|
+
"resolved": "number",
|
|
1769
|
+
"references": {}
|
|
1770
|
+
},
|
|
1771
|
+
"required": false,
|
|
1772
|
+
"optional": false,
|
|
1773
|
+
"docs": {
|
|
1774
|
+
"tags": [],
|
|
1775
|
+
"text": "Width below which the table scrolls instead of squeezing, at any viewport. Left unset, a table\nonly stops squeezing below 1180px, where it scrolls at the width its columns declared."
|
|
1776
|
+
},
|
|
1777
|
+
"getter": false,
|
|
1778
|
+
"setter": false,
|
|
1779
|
+
"reflect": true,
|
|
1780
|
+
"attribute": "min-width",
|
|
1781
|
+
"defaultValue": "0"
|
|
1782
|
+
},
|
|
1783
|
+
"storageKey": {
|
|
1784
|
+
"type": "string",
|
|
1785
|
+
"mutable": false,
|
|
1786
|
+
"complexType": {
|
|
1787
|
+
"original": "string",
|
|
1788
|
+
"resolved": "string",
|
|
1789
|
+
"references": {}
|
|
1790
|
+
},
|
|
1791
|
+
"required": false,
|
|
1792
|
+
"optional": false,
|
|
1793
|
+
"docs": {
|
|
1794
|
+
"tags": [],
|
|
1795
|
+
"text": "Persists the column layout under this key. Empty means the layout is not remembered."
|
|
1796
|
+
},
|
|
1797
|
+
"getter": false,
|
|
1798
|
+
"setter": false,
|
|
1799
|
+
"reflect": false,
|
|
1800
|
+
"attribute": "storage-key",
|
|
1801
|
+
"defaultValue": "''"
|
|
1802
|
+
},
|
|
1803
|
+
"storageOwner": {
|
|
1804
|
+
"type": "string",
|
|
1805
|
+
"mutable": false,
|
|
1806
|
+
"complexType": {
|
|
1807
|
+
"original": "string",
|
|
1808
|
+
"resolved": "string",
|
|
1809
|
+
"references": {}
|
|
1810
|
+
},
|
|
1811
|
+
"required": false,
|
|
1812
|
+
"optional": false,
|
|
1813
|
+
"docs": {
|
|
1814
|
+
"tags": [],
|
|
1815
|
+
"text": "Scopes the stored layout to a user."
|
|
1816
|
+
},
|
|
1817
|
+
"getter": false,
|
|
1818
|
+
"setter": false,
|
|
1819
|
+
"reflect": false,
|
|
1820
|
+
"attribute": "storage-owner",
|
|
1821
|
+
"defaultValue": "'anonymous'"
|
|
1822
|
+
},
|
|
1823
|
+
"layout": {
|
|
1824
|
+
"type": "string",
|
|
1825
|
+
"mutable": false,
|
|
1826
|
+
"complexType": {
|
|
1827
|
+
"original": "string | XvTableLayout",
|
|
1828
|
+
"resolved": "XvTableLayout | string",
|
|
1829
|
+
"references": {
|
|
1830
|
+
"XvTableLayout": {
|
|
1831
|
+
"location": "import",
|
|
1832
|
+
"path": "./xv-table.model",
|
|
1833
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTableLayout",
|
|
1834
|
+
"referenceLocation": "XvTableLayout"
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
},
|
|
1838
|
+
"required": false,
|
|
1839
|
+
"optional": false,
|
|
1840
|
+
"docs": {
|
|
1841
|
+
"tags": [],
|
|
1842
|
+
"text": "Controlled column layout. Overrides whatever is stored."
|
|
1843
|
+
},
|
|
1844
|
+
"getter": false,
|
|
1845
|
+
"setter": false,
|
|
1846
|
+
"reflect": false,
|
|
1847
|
+
"attribute": "layout",
|
|
1848
|
+
"defaultValue": "null"
|
|
1849
|
+
},
|
|
1850
|
+
"locale": {
|
|
1851
|
+
"type": "string",
|
|
1852
|
+
"mutable": false,
|
|
1853
|
+
"complexType": {
|
|
1854
|
+
"original": "string",
|
|
1855
|
+
"resolved": "string",
|
|
1856
|
+
"references": {}
|
|
1857
|
+
},
|
|
1858
|
+
"required": false,
|
|
1859
|
+
"optional": false,
|
|
1860
|
+
"docs": {
|
|
1861
|
+
"tags": [],
|
|
1862
|
+
"text": "Locale used for sorting and cell formatting. Falls back to the nearest `[lang]` ancestor."
|
|
1863
|
+
},
|
|
1864
|
+
"getter": false,
|
|
1865
|
+
"setter": false,
|
|
1866
|
+
"reflect": false,
|
|
1867
|
+
"attribute": "locale",
|
|
1868
|
+
"defaultValue": "''"
|
|
1869
|
+
}
|
|
1870
|
+
};
|
|
1871
|
+
}
|
|
1872
|
+
static get states() {
|
|
1873
|
+
return {
|
|
1874
|
+
"columnState": {},
|
|
1875
|
+
"sortState": {},
|
|
1876
|
+
"selectedValues": {},
|
|
1877
|
+
"expandedValues": {},
|
|
1878
|
+
"layoutPending": {},
|
|
1879
|
+
"columnDragging": {},
|
|
1880
|
+
"dragOverId": {},
|
|
1881
|
+
"dropRowIndex": {},
|
|
1882
|
+
"slottedRowCount": {},
|
|
1883
|
+
"derivedTracks": {},
|
|
1884
|
+
"hasSlottedHeader": {},
|
|
1885
|
+
"hasSlottedHeading": {},
|
|
1886
|
+
"hasSlottedEmpty": {},
|
|
1887
|
+
"overflowing": {}
|
|
1888
|
+
};
|
|
1889
|
+
}
|
|
1890
|
+
static get events() {
|
|
1891
|
+
return [{
|
|
1892
|
+
"method": "sortChange",
|
|
1893
|
+
"name": "sortChange",
|
|
1894
|
+
"bubbles": true,
|
|
1895
|
+
"cancelable": true,
|
|
1896
|
+
"composed": true,
|
|
1897
|
+
"docs": {
|
|
1898
|
+
"tags": [],
|
|
1899
|
+
"text": "Emitted when a sortable header is activated."
|
|
1900
|
+
},
|
|
1901
|
+
"complexType": {
|
|
1902
|
+
"original": "XvTableSort",
|
|
1903
|
+
"resolved": "XvTableSort",
|
|
1904
|
+
"references": {
|
|
1905
|
+
"XvTableSort": {
|
|
1906
|
+
"location": "import",
|
|
1907
|
+
"path": "./xv-table.model",
|
|
1908
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTableSort",
|
|
1909
|
+
"referenceLocation": "XvTableSort"
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
}, {
|
|
1914
|
+
"method": "selectedChange",
|
|
1915
|
+
"name": "selectedChange",
|
|
1916
|
+
"bubbles": true,
|
|
1917
|
+
"cancelable": true,
|
|
1918
|
+
"composed": true,
|
|
1919
|
+
"docs": {
|
|
1920
|
+
"tags": [],
|
|
1921
|
+
"text": "Emitted when the set of selected rows changes. Named after the `selected` prop it reports:\n`selectionChange` is refused by Stencil as a native DOM event name."
|
|
1922
|
+
},
|
|
1923
|
+
"complexType": {
|
|
1924
|
+
"original": "XvTableSelectionDetail",
|
|
1925
|
+
"resolved": "XvTableSelectionDetail",
|
|
1926
|
+
"references": {
|
|
1927
|
+
"XvTableSelectionDetail": {
|
|
1928
|
+
"location": "import",
|
|
1929
|
+
"path": "./xv-table.model",
|
|
1930
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTableSelectionDetail",
|
|
1931
|
+
"referenceLocation": "XvTableSelectionDetail"
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
}, {
|
|
1936
|
+
"method": "expandedChange",
|
|
1937
|
+
"name": "expandedChange",
|
|
1938
|
+
"bubbles": true,
|
|
1939
|
+
"cancelable": true,
|
|
1940
|
+
"composed": true,
|
|
1941
|
+
"docs": {
|
|
1942
|
+
"tags": [],
|
|
1943
|
+
"text": "Emitted when the set of expanded rows changes."
|
|
1944
|
+
},
|
|
1945
|
+
"complexType": {
|
|
1946
|
+
"original": "XvTableExpandedDetail",
|
|
1947
|
+
"resolved": "XvTableExpandedDetail",
|
|
1948
|
+
"references": {
|
|
1949
|
+
"XvTableExpandedDetail": {
|
|
1950
|
+
"location": "import",
|
|
1951
|
+
"path": "./xv-table.model",
|
|
1952
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTableExpandedDetail",
|
|
1953
|
+
"referenceLocation": "XvTableExpandedDetail"
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
}, {
|
|
1958
|
+
"method": "pageChange",
|
|
1959
|
+
"name": "pageChange",
|
|
1960
|
+
"bubbles": true,
|
|
1961
|
+
"cancelable": true,
|
|
1962
|
+
"composed": true,
|
|
1963
|
+
"docs": {
|
|
1964
|
+
"tags": [],
|
|
1965
|
+
"text": "Emitted when the page or the page size changes."
|
|
1966
|
+
},
|
|
1967
|
+
"complexType": {
|
|
1968
|
+
"original": "XvTablePage",
|
|
1969
|
+
"resolved": "XvTablePage",
|
|
1970
|
+
"references": {
|
|
1971
|
+
"XvTablePage": {
|
|
1972
|
+
"location": "import",
|
|
1973
|
+
"path": "./xv-table.model",
|
|
1974
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTablePage",
|
|
1975
|
+
"referenceLocation": "XvTablePage"
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
}, {
|
|
1980
|
+
"method": "layoutChange",
|
|
1981
|
+
"name": "layoutChange",
|
|
1982
|
+
"bubbles": true,
|
|
1983
|
+
"cancelable": true,
|
|
1984
|
+
"composed": true,
|
|
1985
|
+
"docs": {
|
|
1986
|
+
"tags": [],
|
|
1987
|
+
"text": "Emitted after a column is resized, reordered, hidden or reset."
|
|
1988
|
+
},
|
|
1989
|
+
"complexType": {
|
|
1990
|
+
"original": "XvTableLayout",
|
|
1991
|
+
"resolved": "XvTableLayout",
|
|
1992
|
+
"references": {
|
|
1993
|
+
"XvTableLayout": {
|
|
1994
|
+
"location": "import",
|
|
1995
|
+
"path": "./xv-table.model",
|
|
1996
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTableLayout",
|
|
1997
|
+
"referenceLocation": "XvTableLayout"
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
}, {
|
|
2002
|
+
"method": "rowClick",
|
|
2003
|
+
"name": "rowClick",
|
|
2004
|
+
"bubbles": true,
|
|
2005
|
+
"cancelable": true,
|
|
2006
|
+
"composed": true,
|
|
2007
|
+
"docs": {
|
|
2008
|
+
"tags": [],
|
|
2009
|
+
"text": "Emitted when a row is clicked, while `rowClickable` is set."
|
|
2010
|
+
},
|
|
2011
|
+
"complexType": {
|
|
2012
|
+
"original": "XvTableRowClickDetail",
|
|
2013
|
+
"resolved": "XvTableRowClickDetail",
|
|
2014
|
+
"references": {
|
|
2015
|
+
"XvTableRowClickDetail": {
|
|
2016
|
+
"location": "import",
|
|
2017
|
+
"path": "./xv-table.model",
|
|
2018
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTableRowClickDetail",
|
|
2019
|
+
"referenceLocation": "XvTableRowClickDetail"
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
}, {
|
|
2024
|
+
"method": "rowOrderChange",
|
|
2025
|
+
"name": "rowOrderChange",
|
|
2026
|
+
"bubbles": true,
|
|
2027
|
+
"cancelable": true,
|
|
2028
|
+
"composed": true,
|
|
2029
|
+
"docs": {
|
|
2030
|
+
"tags": [],
|
|
2031
|
+
"text": "Emitted when a row is dropped in a new position. The table does not move the row itself \u2014\nreorder the data and it re-renders, which keeps the DOM and the data from drifting apart."
|
|
2032
|
+
},
|
|
2033
|
+
"complexType": {
|
|
2034
|
+
"original": "XvTableRowOrder",
|
|
2035
|
+
"resolved": "XvTableRowOrder",
|
|
2036
|
+
"references": {
|
|
2037
|
+
"XvTableRowOrder": {
|
|
2038
|
+
"location": "import",
|
|
2039
|
+
"path": "./xv-table.model",
|
|
2040
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTableRowOrder",
|
|
2041
|
+
"referenceLocation": "XvTableRowOrder"
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
}];
|
|
2046
|
+
}
|
|
2047
|
+
static get methods() {
|
|
2048
|
+
return {
|
|
2049
|
+
"selectAll": {
|
|
2050
|
+
"complexType": {
|
|
2051
|
+
"signature": "() => Promise<void>",
|
|
2052
|
+
"parameters": [],
|
|
2053
|
+
"references": {
|
|
2054
|
+
"Promise": {
|
|
2055
|
+
"location": "global",
|
|
2056
|
+
"id": "global::Promise"
|
|
2057
|
+
}
|
|
2058
|
+
},
|
|
2059
|
+
"return": "Promise<void>"
|
|
2060
|
+
},
|
|
2061
|
+
"docs": {
|
|
2062
|
+
"text": "Selects every selectable row.",
|
|
2063
|
+
"tags": []
|
|
2064
|
+
}
|
|
2065
|
+
},
|
|
2066
|
+
"clearSelection": {
|
|
2067
|
+
"complexType": {
|
|
2068
|
+
"signature": "() => Promise<void>",
|
|
2069
|
+
"parameters": [],
|
|
2070
|
+
"references": {
|
|
2071
|
+
"Promise": {
|
|
2072
|
+
"location": "global",
|
|
2073
|
+
"id": "global::Promise"
|
|
2074
|
+
}
|
|
2075
|
+
},
|
|
2076
|
+
"return": "Promise<void>"
|
|
2077
|
+
},
|
|
2078
|
+
"docs": {
|
|
2079
|
+
"text": "Clears the selection.",
|
|
2080
|
+
"tags": []
|
|
2081
|
+
}
|
|
2082
|
+
},
|
|
2083
|
+
"resetLayout": {
|
|
2084
|
+
"complexType": {
|
|
2085
|
+
"signature": "() => Promise<void>",
|
|
2086
|
+
"parameters": [],
|
|
2087
|
+
"references": {
|
|
2088
|
+
"Promise": {
|
|
2089
|
+
"location": "global",
|
|
2090
|
+
"id": "global::Promise"
|
|
2091
|
+
}
|
|
2092
|
+
},
|
|
2093
|
+
"return": "Promise<void>"
|
|
2094
|
+
},
|
|
2095
|
+
"docs": {
|
|
2096
|
+
"text": "Drops the stored layout and returns to the declared columns.",
|
|
2097
|
+
"tags": []
|
|
2098
|
+
}
|
|
2099
|
+
},
|
|
2100
|
+
"getLayout": {
|
|
2101
|
+
"complexType": {
|
|
2102
|
+
"signature": "() => Promise<XvTableLayout>",
|
|
2103
|
+
"parameters": [],
|
|
2104
|
+
"references": {
|
|
2105
|
+
"Promise": {
|
|
2106
|
+
"location": "global",
|
|
2107
|
+
"id": "global::Promise"
|
|
2108
|
+
},
|
|
2109
|
+
"XvTableLayout": {
|
|
2110
|
+
"location": "import",
|
|
2111
|
+
"path": "./xv-table.model",
|
|
2112
|
+
"id": "src/components/xv-table/xv-table.model.ts::XvTableLayout",
|
|
2113
|
+
"referenceLocation": "XvTableLayout"
|
|
2114
|
+
}
|
|
2115
|
+
},
|
|
2116
|
+
"return": "Promise<XvTableLayout>"
|
|
2117
|
+
},
|
|
2118
|
+
"docs": {
|
|
2119
|
+
"text": "The layout as it would be stored: only the deviations from the declared columns.",
|
|
2120
|
+
"tags": []
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
};
|
|
2124
|
+
}
|
|
2125
|
+
static get elementRef() { return "el"; }
|
|
2126
|
+
static get watchers() {
|
|
152
2127
|
return [{
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
|
|
156
|
-
"
|
|
157
|
-
"
|
|
2128
|
+
"propName": "columns",
|
|
2129
|
+
"methodName": "columnsChanged"
|
|
2130
|
+
}, {
|
|
2131
|
+
"propName": "layout",
|
|
2132
|
+
"methodName": "layoutInputChanged"
|
|
2133
|
+
}, {
|
|
2134
|
+
"propName": "storageKey",
|
|
2135
|
+
"methodName": "layoutInputChanged"
|
|
2136
|
+
}, {
|
|
2137
|
+
"propName": "storageOwner",
|
|
2138
|
+
"methodName": "layoutInputChanged"
|
|
2139
|
+
}, {
|
|
2140
|
+
"propName": "sortBy",
|
|
2141
|
+
"methodName": "sortByChanged"
|
|
2142
|
+
}, {
|
|
2143
|
+
"propName": "selected",
|
|
2144
|
+
"methodName": "selectedChanged"
|
|
2145
|
+
}, {
|
|
2146
|
+
"propName": "expanded",
|
|
2147
|
+
"methodName": "expandedChanged"
|
|
2148
|
+
}, {
|
|
2149
|
+
"propName": "rows",
|
|
2150
|
+
"methodName": "rowsChanged"
|
|
158
2151
|
}];
|
|
159
2152
|
}
|
|
160
2153
|
}
|