@hashicorp/design-system-components 6.4.0 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/component-catalog.json +13139 -0
- package/declarations/components/hds/advanced-table/column-manager/index.d.ts +5 -7
- package/declarations/components/hds/advanced-table/column-manager/width.d.ts +17 -20
- package/declarations/components/hds/advanced-table/index.d.ts +3 -2
- package/declarations/components/hds/advanced-table/th-context-menu.d.ts +2 -1
- package/declarations/components/hds/advanced-table/th-resize-handle.d.ts +8 -19
- package/declarations/components/hds/advanced-table/th.d.ts +5 -19
- package/declarations/components/hds/advanced-table/tr.d.ts +3 -0
- package/declarations/components/hds/advanced-table/types.d.ts +1 -1
- package/declarations/components/hds/advanced-table/utils.d.ts +1 -0
- package/declarations/components/hds/composite/index.d.ts +1 -0
- package/declarations/components/hds/icon/index.d.ts +1 -1
- package/declarations/components/hds/segmented-group/index.d.ts +13 -3
- package/declarations/components/hds/stepper/task/indicator.d.ts +1 -1
- package/declarations/components/hds/table/index.d.ts +1 -0
- package/declarations/components/hds/table/tr.d.ts +4 -0
- package/dist/components/hds/advanced-table/column-manager/index.js +1 -1
- package/dist/components/hds/advanced-table/column-manager/index.js.map +1 -1
- package/dist/components/hds/advanced-table/column-manager/order.js +2 -1
- package/dist/components/hds/advanced-table/column-manager/order.js.map +1 -1
- package/dist/components/hds/advanced-table/column-manager/width.js +96 -183
- package/dist/components/hds/advanced-table/column-manager/width.js.map +1 -1
- package/dist/components/hds/advanced-table/index.js +1 -1
- package/dist/components/hds/advanced-table/th-context-menu.js +14 -7
- package/dist/components/hds/advanced-table/th-context-menu.js.map +1 -1
- package/dist/components/hds/advanced-table/th-reorder-drop-target.js +1 -1
- package/dist/components/hds/advanced-table/th-resize-handle.js +1 -1
- package/dist/components/hds/advanced-table/th-selectable.js +1 -1
- package/dist/components/hds/advanced-table/th.js +1 -1
- package/dist/components/hds/advanced-table/tr.js +3 -1
- package/dist/components/hds/advanced-table/tr.js.map +1 -1
- package/dist/components/hds/advanced-table/types.js.map +1 -1
- package/dist/components/hds/advanced-table/utils.js +8 -1
- package/dist/components/hds/advanced-table/utils.js.map +1 -1
- package/dist/components/hds/composite/index.js +6 -0
- package/dist/components/hds/composite/index.js.map +1 -1
- package/dist/components/hds/filter-bar/index.js +1 -1
- package/dist/components/hds/filter-bar/index.js.map +1 -1
- package/dist/components/hds/segmented-group/index.js +36 -13
- package/dist/components/hds/segmented-group/index.js.map +1 -1
- package/dist/components/hds/stepper/list/step.js +6 -2
- package/dist/components/hds/stepper/list/step.js.map +1 -1
- package/dist/components/hds/stepper/nav/step.js +6 -2
- package/dist/components/hds/stepper/nav/step.js.map +1 -1
- package/dist/components/hds/table/index.js +9 -0
- package/dist/components/hds/table/index.js.map +1 -1
- package/dist/components/hds/table/tr.js +27 -15
- package/dist/components/hds/table/tr.js.map +1 -1
- package/dist/components.js +1 -1
- package/dist/{index-DtMB-P9m.js → index-Cx64Nvu4.js} +111 -226
- package/dist/index-Cx64Nvu4.js.map +1 -0
- package/dist/modifiers/hds-scroll-into-view-on-focus.js +4 -0
- package/dist/modifiers/hds-scroll-into-view-on-focus.js.map +1 -1
- package/dist/styles/@hashicorp/design-system-components.css +86 -22
- package/dist/styles/@hashicorp/design-system-components.css.map +1 -1
- package/dist/styles/components/advanced-table.scss +4 -1
- package/dist/styles/components/badge-count.scss +1 -1
- package/dist/styles/components/badge.scss +1 -1
- package/dist/styles/components/filter-bar.scss +10 -2
- package/dist/styles/components/form/character-count.scss +1 -1
- package/dist/styles/components/form/error.scss +1 -1
- package/dist/styles/components/form/helper-text.scss +1 -1
- package/dist/styles/components/form/indicator.scss +1 -1
- package/dist/styles/components/form/label.scss +1 -1
- package/dist/styles/components/form/legend.scss +1 -1
- package/dist/styles/components/icon-tile.scss +1 -1
- package/dist/styles/components/link/standalone.scss +1 -1
- package/dist/styles/components/segmented-group.scss +43 -6
- package/dist/styles/components/tag.scss +1 -1
- package/package.json +7 -4
- package/translations/hds/components/stepper/en-us.yaml +1 -0
- package/dist/index-DtMB-P9m.js.map +0 -1
|
@@ -27,14 +27,14 @@ import HdsAdvancedTableThButtonSort from './components/hds/advanced-table/th-but
|
|
|
27
27
|
import HdsAdvancedTableThButtonTooltip from './components/hds/advanced-table/th-button-tooltip.js';
|
|
28
28
|
import HdsAdvancedTableThContextMenu from './components/hds/advanced-table/th-context-menu.js';
|
|
29
29
|
import HdsAdvancedTableThReorderHandle from './components/hds/advanced-table/th-reorder-handle.js';
|
|
30
|
-
import { parsePixel, requestAnimationFrameWaiter } from './components/hds/advanced-table/utils.js';
|
|
30
|
+
import { parsePixel, measureColumnWidth, requestAnimationFrameWaiter } from './components/hds/advanced-table/utils.js';
|
|
31
31
|
import HdsAdvancedTableBody from './components/hds/advanced-table/body.js';
|
|
32
32
|
import HdsAdvancedTableTd from './components/hds/advanced-table/td.js';
|
|
33
33
|
import HdsTHelper from './helpers/hds-t.js';
|
|
34
34
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
35
35
|
import { setComponentTemplate } from '@ember/component';
|
|
36
36
|
import { g, i, n } from 'decorator-transforms/runtime';
|
|
37
|
-
import { DEFAULT_MIN_WIDTH
|
|
37
|
+
import { DEFAULT_MIN_WIDTH } from './components/hds/advanced-table/column-manager/width.js';
|
|
38
38
|
import { onFocusTrapDeactivate } from './modifiers/hds-advanced-table-cell/dom-management.js';
|
|
39
39
|
import HdsFormCheckboxBase from './components/hds/form/checkbox/base.js';
|
|
40
40
|
|
|
@@ -43,32 +43,6 @@ import HdsFormCheckboxBase from './components/hds/form/checkbox/base.js';
|
|
|
43
43
|
* SPDX-License-Identifier: MPL-2.0
|
|
44
44
|
*/
|
|
45
45
|
const KEYBOARD_RESIZE_STEP = 10;
|
|
46
|
-
function calculateEffectiveDelta(deltaX, col, startColW, nextCol, startNextColW) {
|
|
47
|
-
const colMin = parsePixel(col.minWidth ?? DEFAULT_MIN_WIDTH) ?? 0;
|
|
48
|
-
const colMax = parsePixel(col.maxWidth ?? DEFAULT_MAX_WIDTH) ?? Infinity;
|
|
49
|
-
const nextMin = parsePixel(nextCol.minWidth ?? DEFAULT_MIN_WIDTH) ?? 0;
|
|
50
|
-
const nextMax = parsePixel(nextCol.maxWidth ?? DEFAULT_MAX_WIDTH) ?? Infinity;
|
|
51
|
-
let effectiveDelta = 0;
|
|
52
|
-
// expanding col, shrinking nextCol
|
|
53
|
-
if (deltaX > 0) {
|
|
54
|
-
const maxCanExpandCol = colMax - startColW;
|
|
55
|
-
const maxCanShrinkNext = startNextColW - nextMin;
|
|
56
|
-
effectiveDelta = Math.min(deltaX, maxCanExpandCol, maxCanShrinkNext);
|
|
57
|
-
effectiveDelta = Math.max(0, effectiveDelta);
|
|
58
|
-
} else if (deltaX < 0) {
|
|
59
|
-
const absDeltaX = -deltaX;
|
|
60
|
-
const maxCanShrinkCol = startColW - colMin;
|
|
61
|
-
let maxCanExpandNext;
|
|
62
|
-
if (startNextColW > nextMax) {
|
|
63
|
-
maxCanExpandNext = Infinity;
|
|
64
|
-
} else {
|
|
65
|
-
maxCanExpandNext = nextMax - startNextColW;
|
|
66
|
-
}
|
|
67
|
-
effectiveDelta = -Math.min(absDeltaX, maxCanShrinkCol, maxCanExpandNext);
|
|
68
|
-
effectiveDelta = Math.min(0, effectiveDelta);
|
|
69
|
-
}
|
|
70
|
-
return effectiveDelta;
|
|
71
|
-
}
|
|
72
46
|
class HdsAdvancedTableThResizeHandle extends Component {
|
|
73
47
|
static {
|
|
74
48
|
g(this.prototype, "resizing", [tracked], function () {
|
|
@@ -81,7 +55,7 @@ class HdsAdvancedTableThResizeHandle extends Component {
|
|
|
81
55
|
return 0;
|
|
82
56
|
});
|
|
83
57
|
}
|
|
84
|
-
#_transientDelta = (i(this, "_transientDelta"), void 0);
|
|
58
|
+
#_transientDelta = (i(this, "_transientDelta"), void 0);
|
|
85
59
|
static {
|
|
86
60
|
g(this.prototype, "_isUpdateQueued", [tracked], function () {
|
|
87
61
|
return false;
|
|
@@ -113,14 +87,27 @@ class HdsAdvancedTableThResizeHandle extends Component {
|
|
|
113
87
|
if (column === undefined || onGetAppliedWidth === undefined) {
|
|
114
88
|
return 0;
|
|
115
89
|
}
|
|
116
|
-
const
|
|
117
|
-
|
|
90
|
+
const pixelWidth = parsePixel(onGetAppliedWidth(column.key));
|
|
91
|
+
if (pixelWidth !== undefined) {
|
|
92
|
+
return Math.round(pixelWidth);
|
|
93
|
+
}
|
|
94
|
+
// the applied width is an `fr` weight once a resize commits, and parsing that
|
|
95
|
+
// would report 0 — measure the rendered cell instead
|
|
96
|
+
return parsePixel(measureColumnWidth(this._handleElement)) ?? 0;
|
|
118
97
|
}
|
|
119
98
|
get minWidthInPixels() {
|
|
120
99
|
return parsePixel(this.args.column?.minWidth ?? DEFAULT_MIN_WIDTH) ?? 0;
|
|
121
100
|
}
|
|
122
101
|
get maxWidthInPixels() {
|
|
123
|
-
|
|
102
|
+
const explicitMax = parsePixel(this.args.column?.maxWidth);
|
|
103
|
+
if (explicitMax !== undefined) {
|
|
104
|
+
return explicitMax;
|
|
105
|
+
}
|
|
106
|
+
const table = this._handleElement?.closest('.hds-advanced-table');
|
|
107
|
+
return table instanceof HTMLElement ? table.offsetWidth : this.minWidthInPixels;
|
|
108
|
+
}
|
|
109
|
+
get widthValueText() {
|
|
110
|
+
return `${this.currentWidthInPixels}px`;
|
|
124
111
|
}
|
|
125
112
|
get height() {
|
|
126
113
|
const {
|
|
@@ -138,23 +125,6 @@ class HdsAdvancedTableThResizeHandle extends Component {
|
|
|
138
125
|
}
|
|
139
126
|
return classes.join(' ');
|
|
140
127
|
}
|
|
141
|
-
_applyTransientWidths() {
|
|
142
|
-
const {
|
|
143
|
-
column,
|
|
144
|
-
siblingColumnKeys,
|
|
145
|
-
onApplyTransientWidth
|
|
146
|
-
} = this.args;
|
|
147
|
-
if (column === undefined || onApplyTransientWidth === undefined) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
const {
|
|
151
|
-
next: nextColumnKey
|
|
152
|
-
} = siblingColumnKeys ?? {};
|
|
153
|
-
onApplyTransientWidth(column.key);
|
|
154
|
-
if (nextColumnKey !== undefined) {
|
|
155
|
-
onApplyTransientWidth(nextColumnKey);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
128
|
onColumnResize(key, width) {
|
|
159
129
|
const {
|
|
160
130
|
onColumnResize
|
|
@@ -166,6 +136,21 @@ class HdsAdvancedTableThResizeHandle extends Component {
|
|
|
166
136
|
static {
|
|
167
137
|
n(this.prototype, "onColumnResize", [action]);
|
|
168
138
|
}
|
|
139
|
+
_finishColumnResize(columnKey) {
|
|
140
|
+
const {
|
|
141
|
+
onCommitColumnWidths,
|
|
142
|
+
onResetTransientColumnWidths
|
|
143
|
+
} = this.args;
|
|
144
|
+
if (this._transientDelta !== 0) {
|
|
145
|
+
onCommitColumnWidths?.();
|
|
146
|
+
}
|
|
147
|
+
onResetTransientColumnWidths?.();
|
|
148
|
+
this.resizing = null;
|
|
149
|
+
this._transientDelta = 0;
|
|
150
|
+
requestAnimationFrameWaiter(() => {
|
|
151
|
+
this.onColumnResize(columnKey, measureColumnWidth(this._handleElement));
|
|
152
|
+
});
|
|
153
|
+
}
|
|
169
154
|
handleKeydown(event) {
|
|
170
155
|
const validKeys = ['ArrowLeft', 'ArrowRight'];
|
|
171
156
|
if (!validKeys.includes(event.key)) {
|
|
@@ -175,28 +160,17 @@ class HdsAdvancedTableThResizeHandle extends Component {
|
|
|
175
160
|
event.stopPropagation();
|
|
176
161
|
const {
|
|
177
162
|
column,
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
onResetTransientColumnWidths,
|
|
183
|
-
onUpdateResizeDebt
|
|
163
|
+
onBeginColumnResize,
|
|
164
|
+
onResizeColumnByDelta,
|
|
165
|
+
onCommitColumnWidths,
|
|
166
|
+
onResetTransientColumnWidths
|
|
184
167
|
} = this.args;
|
|
185
|
-
|
|
186
|
-
next: nextColumnKey
|
|
187
|
-
} = siblingColumnKeys ?? {};
|
|
188
|
-
if (column === undefined || nextColumnKey === undefined || onApplyTransientWidth === undefined || onGetAppliedWidth === undefined || onSetTransientColumnWidths === undefined || onUpdateResizeDebt === undefined || onResetTransientColumnWidths === undefined) {
|
|
168
|
+
if (column === undefined || onBeginColumnResize === undefined || onResizeColumnByDelta === undefined || onCommitColumnWidths === undefined || onResetTransientColumnWidths === undefined) {
|
|
189
169
|
return;
|
|
190
170
|
}
|
|
191
|
-
|
|
192
|
-
roundValues: true
|
|
193
|
-
});
|
|
194
|
-
const startColumnAppliedWidth = onGetAppliedWidth(column.key);
|
|
195
|
-
const startNextColumnAppliedWidth = onGetAppliedWidth(nextColumnKey);
|
|
196
|
-
const startColumnPxWidth = Math.round(parsePixel(startColumnAppliedWidth) ?? 0);
|
|
197
|
-
const startNextColumnPxWidth = Math.round(parsePixel(startNextColumnAppliedWidth) ?? 0);
|
|
171
|
+
onBeginColumnResize();
|
|
198
172
|
const deltaX = event.key === 'ArrowRight' ? KEYBOARD_RESIZE_STEP : -KEYBOARD_RESIZE_STEP;
|
|
199
|
-
this.
|
|
173
|
+
this._transientDelta = onResizeColumnByDelta(column.key, deltaX);
|
|
200
174
|
// ensure the resize handle remains visible during keyboard navigation.
|
|
201
175
|
this._handleElement.scrollIntoView({
|
|
202
176
|
behavior: 'smooth',
|
|
@@ -204,17 +178,7 @@ class HdsAdvancedTableThResizeHandle extends Component {
|
|
|
204
178
|
inline: 'nearest'
|
|
205
179
|
});
|
|
206
180
|
// use a microtask to commit the final state after the render pass.
|
|
207
|
-
queueMicrotask(() =>
|
|
208
|
-
if (this._transientDelta !== 0) {
|
|
209
|
-
onUpdateResizeDebt(this._transientDelta);
|
|
210
|
-
}
|
|
211
|
-
// reset transient values
|
|
212
|
-
onApplyTransientWidth(column.key);
|
|
213
|
-
onApplyTransientWidth(nextColumnKey);
|
|
214
|
-
onResetTransientColumnWidths();
|
|
215
|
-
this._transientDelta = 0;
|
|
216
|
-
this.onColumnResize(column.key, column.width);
|
|
217
|
-
});
|
|
181
|
+
queueMicrotask(() => this._finishColumnResize(column.key));
|
|
218
182
|
}
|
|
219
183
|
static {
|
|
220
184
|
n(this.prototype, "handleKeydown", [action]);
|
|
@@ -227,25 +191,14 @@ class HdsAdvancedTableThResizeHandle extends Component {
|
|
|
227
191
|
event.stopPropagation();
|
|
228
192
|
const {
|
|
229
193
|
column,
|
|
230
|
-
|
|
231
|
-
onGetAppliedWidth,
|
|
232
|
-
onSetTransientColumnWidths
|
|
194
|
+
onBeginColumnResize
|
|
233
195
|
} = this.args;
|
|
234
|
-
if (column === undefined ||
|
|
196
|
+
if (column === undefined || onBeginColumnResize === undefined) {
|
|
235
197
|
return;
|
|
236
198
|
}
|
|
237
|
-
|
|
238
|
-
next: nextColumnKey
|
|
239
|
-
} = siblingColumnKeys ?? {};
|
|
240
|
-
onSetTransientColumnWidths({});
|
|
241
|
-
const startColumnAppliedWidth = onGetAppliedWidth(column.key);
|
|
242
|
-
const startNextColumnAppliedWidth = nextColumnKey !== undefined ? onGetAppliedWidth(nextColumnKey) : undefined;
|
|
243
|
-
const startColumnPxWidth = Math.round(parsePixel(startColumnAppliedWidth) ?? 0);
|
|
244
|
-
const startNextColumnPxWidth = Math.round(parsePixel(startNextColumnAppliedWidth) ?? 0);
|
|
199
|
+
onBeginColumnResize();
|
|
245
200
|
this.resizing = {
|
|
246
|
-
startX: event.clientX
|
|
247
|
-
startColumnPxWidth,
|
|
248
|
-
startNextColumnPxWidth
|
|
201
|
+
startX: event.clientX
|
|
249
202
|
};
|
|
250
203
|
window.addEventListener('pointermove', this._boundResize);
|
|
251
204
|
window.addEventListener('pointerup', this._boundStopResize);
|
|
@@ -253,44 +206,6 @@ class HdsAdvancedTableThResizeHandle extends Component {
|
|
|
253
206
|
static {
|
|
254
207
|
n(this.prototype, "startResize", [action]);
|
|
255
208
|
}
|
|
256
|
-
_setColumnWidth(column, width) {
|
|
257
|
-
const {
|
|
258
|
-
onSetTransientColumnWidth
|
|
259
|
-
} = this.args;
|
|
260
|
-
if (column === undefined || onSetTransientColumnWidth === undefined) {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
onSetTransientColumnWidth(column.key, `${width}px`);
|
|
264
|
-
}
|
|
265
|
-
_applyResizeDelta(deltaX, startColumnPxWidth, column, nextColumnKey, startNextColumnPxWidth) {
|
|
266
|
-
const {
|
|
267
|
-
onGetAppliedWidth,
|
|
268
|
-
onGetColumnByKey,
|
|
269
|
-
onSetTransientColumnWidth
|
|
270
|
-
} = this.args;
|
|
271
|
-
if (column === undefined || onGetAppliedWidth === undefined || onGetColumnByKey === undefined) {
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
const canResizeNeighbor = nextColumnKey !== undefined && startNextColumnPxWidth !== undefined;
|
|
275
|
-
if (canResizeNeighbor) {
|
|
276
|
-
const nextColumn = onGetColumnByKey(nextColumnKey);
|
|
277
|
-
if (nextColumn === undefined) {
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
const effectiveDelta = calculateEffectiveDelta(deltaX, column, startColumnPxWidth, nextColumn, startNextColumnPxWidth);
|
|
281
|
-
// set the width for the current column
|
|
282
|
-
this._setColumnWidth(column, Math.round(startColumnPxWidth + effectiveDelta));
|
|
283
|
-
// the actual new column width may differ from the intended width due to min/max constraints.
|
|
284
|
-
const columnAppliedWidth = onGetAppliedWidth(column.key);
|
|
285
|
-
const actualNewColumnWidth = parsePixel(columnAppliedWidth) ?? startColumnPxWidth;
|
|
286
|
-
const actualAppliedDelta = actualNewColumnWidth - startColumnPxWidth;
|
|
287
|
-
// set the width for the next sibling column
|
|
288
|
-
this._setColumnWidth(nextColumn, Math.round(startNextColumnPxWidth - actualAppliedDelta));
|
|
289
|
-
this._transientDelta = actualAppliedDelta;
|
|
290
|
-
} else if (onSetTransientColumnWidth !== undefined) {
|
|
291
|
-
onSetTransientColumnWidth(column.key, `${Math.round(startColumnPxWidth + deltaX)}px`);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
209
|
_resize(event) {
|
|
295
210
|
this._lastPointerEvent = event;
|
|
296
211
|
if (this._isUpdateQueued) {
|
|
@@ -306,48 +221,31 @@ class HdsAdvancedTableThResizeHandle extends Component {
|
|
|
306
221
|
event.preventDefault();
|
|
307
222
|
const {
|
|
308
223
|
column,
|
|
309
|
-
|
|
224
|
+
onResizeColumnByDelta
|
|
310
225
|
} = this.args;
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
startX,
|
|
316
|
-
startColumnPxWidth,
|
|
317
|
-
startNextColumnPxWidth
|
|
318
|
-
} = this.resizing;
|
|
319
|
-
const deltaX = event.clientX - startX;
|
|
320
|
-
this._applyResizeDelta(deltaX, startColumnPxWidth, column, nextColumnKey, startNextColumnPxWidth // Width of next col at the start of the drag
|
|
321
|
-
);
|
|
226
|
+
if (column !== undefined && onResizeColumnByDelta !== undefined) {
|
|
227
|
+
const deltaX = event.clientX - this.resizing.startX;
|
|
228
|
+
this._transientDelta = onResizeColumnByDelta(column.key, deltaX);
|
|
229
|
+
}
|
|
322
230
|
this._isUpdateQueued = false;
|
|
323
231
|
});
|
|
324
232
|
}
|
|
325
233
|
_stopResize() {
|
|
234
|
+
window.removeEventListener('pointermove', this._boundResize);
|
|
235
|
+
window.removeEventListener('pointerup', this._boundStopResize);
|
|
326
236
|
const {
|
|
327
|
-
column
|
|
328
|
-
onGetAppliedWidth,
|
|
329
|
-
onResetTransientColumnWidths,
|
|
330
|
-
onUpdateResizeDebt
|
|
237
|
+
column
|
|
331
238
|
} = this.args;
|
|
332
|
-
if (column === undefined
|
|
239
|
+
if (column === undefined) {
|
|
240
|
+
this.args.onResetTransientColumnWidths?.();
|
|
241
|
+
this.resizing = null;
|
|
242
|
+
this._transientDelta = 0;
|
|
333
243
|
return;
|
|
334
244
|
}
|
|
335
|
-
|
|
336
|
-
window.removeEventListener('pointerup', this._boundStopResize);
|
|
337
|
-
if (this._transientDelta !== 0) {
|
|
338
|
-
onUpdateResizeDebt(this._transientDelta);
|
|
339
|
-
}
|
|
340
|
-
this._applyTransientWidths();
|
|
341
|
-
// reset the transient width
|
|
342
|
-
onResetTransientColumnWidths();
|
|
343
|
-
// reset the resizing state
|
|
344
|
-
this.resizing = null;
|
|
345
|
-
this._transientDelta = 0;
|
|
346
|
-
const appliedWidth = onGetAppliedWidth(column.key);
|
|
347
|
-
this.onColumnResize(column.key, appliedWidth);
|
|
245
|
+
this._finishColumnResize(column.key);
|
|
348
246
|
}
|
|
349
247
|
static {
|
|
350
|
-
setComponentTemplate(precompileTemplate("{{!-- template-lint-disable no-pointer-down-event-binding --}}\n<div class={{this.classNames}} draggable=\"false\" role=\"slider\" aria-orientation=\"horizontal\" aria-valuenow={{this.currentWidthInPixels}} aria-valuemin={{this.minWidthInPixels}} aria-valuemax={{this.maxWidthInPixels}} tabindex=\"0\" aria-label={{hdsT \"hds.components.advanced-table.th-resize-handle.aria-label\" columnLabel=@column.label default=(concat \"Resize \" @column.label \" column\")}} {{this._registerHandleElement}} {{on \"pointerdown\" this.startResize}} {{on \"keydown\" this.handleKeydown}} {{style height=this.height}} ...attributes />", {
|
|
248
|
+
setComponentTemplate(precompileTemplate("{{!-- template-lint-disable no-pointer-down-event-binding --}}\n<div class={{this.classNames}} draggable=\"false\" role=\"slider\" aria-orientation=\"horizontal\" aria-valuenow={{this.currentWidthInPixels}} aria-valuemin={{this.minWidthInPixels}} aria-valuemax={{this.maxWidthInPixels}} aria-valuetext={{this.widthValueText}} tabindex=\"0\" aria-label={{hdsT \"hds.components.advanced-table.th-resize-handle.aria-label\" columnLabel=@column.label default=(concat \"Resize \" @column.label \" column\")}} {{this._registerHandleElement}} {{on \"pointerdown\" this.startResize}} {{on \"keydown\" this.handleKeydown}} {{style height=this.height}} ...attributes />", {
|
|
351
249
|
strictMode: true,
|
|
352
250
|
scope: () => ({
|
|
353
251
|
hdsT: HdsTHelper,
|
|
@@ -678,12 +576,6 @@ class HdsAdvancedTableTh extends Component {
|
|
|
678
576
|
static {
|
|
679
577
|
n(this.prototype, "focusReorderHandle", [action]);
|
|
680
578
|
}
|
|
681
|
-
applyTransientWidth(columnKey) {
|
|
682
|
-
this.args.onApplyTransientWidth?.(columnKey);
|
|
683
|
-
}
|
|
684
|
-
static {
|
|
685
|
-
n(this.prototype, "applyTransientWidth", [action]);
|
|
686
|
-
}
|
|
687
579
|
resetTransientColumnWidths() {
|
|
688
580
|
this.args.onResetTransientColumnWidths?.();
|
|
689
581
|
}
|
|
@@ -696,36 +588,12 @@ class HdsAdvancedTableTh extends Component {
|
|
|
696
588
|
static {
|
|
697
589
|
n(this.prototype, "getAppliedWidth", [action]);
|
|
698
590
|
}
|
|
699
|
-
getColumnByKey(columnKey) {
|
|
700
|
-
return this.args.onGetColumnByKey?.(columnKey);
|
|
701
|
-
}
|
|
702
|
-
static {
|
|
703
|
-
n(this.prototype, "getColumnByKey", [action]);
|
|
704
|
-
}
|
|
705
591
|
setDraggedColumnKey(columnKey) {
|
|
706
592
|
this.args.onSetDraggedColumnKey?.(columnKey);
|
|
707
593
|
}
|
|
708
594
|
static {
|
|
709
595
|
n(this.prototype, "setDraggedColumnKey", [action]);
|
|
710
596
|
}
|
|
711
|
-
setTransientColumnWidth(columnKey, width) {
|
|
712
|
-
const {
|
|
713
|
-
column,
|
|
714
|
-
onSetTransientColumnWidth
|
|
715
|
-
} = this.args;
|
|
716
|
-
if (column !== undefined && onSetTransientColumnWidth !== undefined) {
|
|
717
|
-
onSetTransientColumnWidth(columnKey, width);
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
static {
|
|
721
|
-
n(this.prototype, "setTransientColumnWidth", [action]);
|
|
722
|
-
}
|
|
723
|
-
setTransientColumnWidths(options) {
|
|
724
|
-
this.args.onSetTransientColumnWidths?.(options);
|
|
725
|
-
}
|
|
726
|
-
static {
|
|
727
|
-
n(this.prototype, "setTransientColumnWidths", [action]);
|
|
728
|
-
}
|
|
729
597
|
stepColumn(step) {
|
|
730
598
|
const {
|
|
731
599
|
column,
|
|
@@ -738,18 +606,6 @@ class HdsAdvancedTableTh extends Component {
|
|
|
738
606
|
static {
|
|
739
607
|
n(this.prototype, "stepColumn", [action]);
|
|
740
608
|
}
|
|
741
|
-
updateResizeDebt(delta) {
|
|
742
|
-
const {
|
|
743
|
-
column,
|
|
744
|
-
onUpdateResizeDebt
|
|
745
|
-
} = this.args;
|
|
746
|
-
if (column !== undefined && onUpdateResizeDebt !== undefined) {
|
|
747
|
-
onUpdateResizeDebt(column.key, delta);
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
static {
|
|
751
|
-
n(this.prototype, "updateResizeDebt", [action]);
|
|
752
|
-
}
|
|
753
609
|
setElement(element) {
|
|
754
610
|
// eslint-disable-next-line ember/no-runloop, ember/no-incorrect-calls-with-inline-anonymous-functions
|
|
755
611
|
scheduleOnce('afterRender', () => {
|
|
@@ -780,7 +636,7 @@ class HdsAdvancedTableTh extends Component {
|
|
|
780
636
|
};
|
|
781
637
|
});
|
|
782
638
|
static {
|
|
783
|
-
setComponentTemplate(precompileTemplate("<div class={{this.classNames}} role={{this.role}} aria-sort={{this.ariaSort}} aria-rowspan={{@rowspan}} aria-colspan={{@colspan}} aria-describedby={{@parentId}} {{style grid-row=this.rowspan grid-column=this.colspan padding-left=this.paddingLeft}} {{hdsAdvancedTableCell handleEnableFocusTrap=this.enableFocusTrap shouldTrapFocus=this._shouldTrapFocus setCellElement=this.setElement}} {{focusTrap isActive=this._shouldTrapFocus focusTrapOptions=(hash onDeactivate=this.onFocusTrapDeactivate initialFocus=this.getInitialFocus clickOutsideDeactivates=true)}} {{@compositeItem disabled=@isCompositeItemDisabled}} {{hdsScrollIntoViewOnFocus options=(hash block=\"center\" inline=\"center\")}} ...attributes>\n <HdsLayoutFlex @justify=\"space-between\" @align=\"center\" @gap=\"8\">\n {{#if @column.isVisuallyHidden}}\n <span class=\"sr-only\">{{yield}}</span>\n {{else}}\n {{#if (and @isExpandable (not this.isSortable))}}\n <HdsAdvancedTableThButtonExpand @labelId={{this._labelId}} @onToggle={{@onClickToggle}} @isExpanded={{@isExpanded}} @isExpandAll={{@hasExpandAllButton}} {{this._manageExpandButton}} />\n {{/if}}\n <div class=\"hds-advanced-table__th-content\">\n <span id={{this._labelId}} class=\"hds-advanced-table__th-content-text hds-typography-body-200 hds-font-weight-semibold\">\n {{yield}}\n </span>\n {{#if @tooltip}}\n <HdsAdvancedTableThButtonTooltip @tooltip={{@tooltip}} @labelId={{this._labelId}} />\n {{/if}}\n </div>\n {{#if this.isSortable}}\n <HdsAdvancedTableThButtonSort @sortOrder={{@sortOrder}} @onClick={{@onClickSort}} @labelId={{this._labelId}} />\n {{/if}}\n {{#if @column}}\n <HdsAdvancedTableThContextMenu @column={{@column}} @hasReorderableColumns={{@hasReorderableColumns}} @hasResizableColumns={{@hasResizableColumns}} @isFirstColumn={{this.isFirstColumn}} @isFirstNonStickyColumn={{this.isFirstNonStickyColumn}} @isLastColumn={{this.isLastColumn}} @isStickyColumn={{@isStickyColumn}} @reorderHandleElement={{this._reorderHandleElement}} @resizeHandleElement={{this._resizeHandleElement}} @onColumnResize={{@onColumnResize}} @onFocusReorderHandle={{this.focusReorderHandle}} @onMoveColumnToTerminalPosition={{@onMoveColumnToTerminalPosition}} @onPinFirstColumn={{@onPinFirstColumn}} @onRestoreColumnWidth={{@onRestoreColumnWidth}} />\n {{#if (and @hasReorderableColumns (not @isStickyColumn))}}\n <HdsAdvancedTableThReorderHandle @column={{@column}} @tableHeight={{@tableHeight}} @thElement={{this._element}} @onFocusReorderHandle={{this.focusReorderHandle}} @onSetDraggedColumnKey={{this.setDraggedColumnKey}} @onStepColumn={{this.stepColumn}} {{this._registerReorderHandleElement}} />\n {{/if}}\n {{#if this.showResizeHandle}}\n <HdsAdvancedTableThResizeHandle @column={{@column}} @
|
|
639
|
+
setComponentTemplate(precompileTemplate("<div class={{this.classNames}} role={{this.role}} aria-sort={{this.ariaSort}} aria-rowspan={{@rowspan}} aria-colspan={{@colspan}} aria-describedby={{@parentId}} {{style grid-row=this.rowspan grid-column=this.colspan padding-left=this.paddingLeft}} {{hdsAdvancedTableCell handleEnableFocusTrap=this.enableFocusTrap shouldTrapFocus=this._shouldTrapFocus setCellElement=this.setElement}} {{focusTrap isActive=this._shouldTrapFocus focusTrapOptions=(hash onDeactivate=this.onFocusTrapDeactivate initialFocus=this.getInitialFocus clickOutsideDeactivates=true)}} {{@compositeItem disabled=@isCompositeItemDisabled}} {{hdsScrollIntoViewOnFocus options=(hash block=\"center\" inline=\"center\")}} ...attributes>\n <HdsLayoutFlex @justify=\"space-between\" @align=\"center\" @gap=\"8\">\n {{#if @column.isVisuallyHidden}}\n <span class=\"sr-only\">{{yield}}</span>\n {{else}}\n {{#if (and @isExpandable (not this.isSortable))}}\n <HdsAdvancedTableThButtonExpand @labelId={{this._labelId}} @onToggle={{@onClickToggle}} @isExpanded={{@isExpanded}} @isExpandAll={{@hasExpandAllButton}} {{this._manageExpandButton}} />\n {{/if}}\n <div class=\"hds-advanced-table__th-content\">\n <span id={{this._labelId}} class=\"hds-advanced-table__th-content-text hds-typography-body-200 hds-font-weight-semibold\">\n {{yield}}\n </span>\n {{#if @tooltip}}\n <HdsAdvancedTableThButtonTooltip @tooltip={{@tooltip}} @labelId={{this._labelId}} />\n {{/if}}\n </div>\n {{#if this.isSortable}}\n <HdsAdvancedTableThButtonSort @sortOrder={{@sortOrder}} @onClick={{@onClickSort}} @labelId={{this._labelId}} />\n {{/if}}\n {{#if @column}}\n <HdsAdvancedTableThContextMenu @column={{@column}} @hasReorderableColumns={{@hasReorderableColumns}} @hasResizableColumns={{@hasResizableColumns}} @isFirstColumn={{this.isFirstColumn}} @isFirstNonStickyColumn={{this.isFirstNonStickyColumn}} @isLastColumn={{this.isLastColumn}} @isStickyColumn={{@isStickyColumn}} @reorderHandleElement={{this._reorderHandleElement}} @resizeHandleElement={{this._resizeHandleElement}} @onColumnResize={{@onColumnResize}} @onFocusReorderHandle={{this.focusReorderHandle}} @onMoveColumnToTerminalPosition={{@onMoveColumnToTerminalPosition}} @onPinFirstColumn={{@onPinFirstColumn}} @onRestoreColumnWidth={{@onRestoreColumnWidth}} @onGetRenderedWidth={{@onGetRenderedWidth}} />\n {{#if (and @hasReorderableColumns (not @isStickyColumn))}}\n <HdsAdvancedTableThReorderHandle @column={{@column}} @tableHeight={{@tableHeight}} @thElement={{this._element}} @onFocusReorderHandle={{this.focusReorderHandle}} @onSetDraggedColumnKey={{this.setDraggedColumnKey}} @onStepColumn={{this.stepColumn}} {{this._registerReorderHandleElement}} />\n {{/if}}\n {{#if this.showResizeHandle}}\n <HdsAdvancedTableThResizeHandle @column={{@column}} @tableHeight={{@tableHeight}} @onColumnResize={{@onColumnResize}} @onBeginColumnResize={{@onBeginColumnResize}} @onResizeColumnByDelta={{@onResizeColumnByDelta}} @onCommitColumnWidths={{@onCommitColumnWidths}} @onGetAppliedWidth={{this.getAppliedWidth}} @onResetTransientColumnWidths={{this.resetTransientColumnWidths}} {{this._registerResizeHandleElement}} />\n {{/if}}\n {{/if}}\n {{/if}}\n </HdsLayoutFlex>\n {{#if this.showDropTarget}}\n <HdsAdvancedTableThReorderDropTarget @column={{@column}} @draggedColumnKey={{@draggedColumnKey}} @hasSelectableRows={{@hasSelectableRows}} @isFirstColumn={{this.isFirstColumn}} @isLastColumn={{this.isLastColumn}} @reorderHoveredColumnKey={{@reorderHoveredColumnKey}} @draggedColumnSiblingColumnKeys={{@draggedColumnSiblingColumnKeys}} @tableHeight={{@tableHeight}} @onReorderDrop={{@onReorderDrop}} @onSetReorderHoveredColumnKey={{@onSetReorderHoveredColumnKey}} />\n {{/if}}\n</div>", {
|
|
784
640
|
strictMode: true,
|
|
785
641
|
scope: () => ({
|
|
786
642
|
style,
|
|
@@ -890,23 +746,12 @@ class HdsAdvancedTableThSelectable extends Component {
|
|
|
890
746
|
* Copyright IBM Corp. 2021, 2026
|
|
891
747
|
* SPDX-License-Identifier: MPL-2.0
|
|
892
748
|
*/
|
|
893
|
-
/*
|
|
894
|
-
* NOTE: There is currently an issue with `WithBoundArgs` or Glint that causes a typing error where @selectionKey is set as always required.
|
|
895
|
-
*
|
|
896
|
-
* Until this is fixed, we are holding off on doing a union with the SelectableHdsAdvancedTableTrArgs
|
|
897
|
-
*/
|
|
898
|
-
// Extended interface for selectable rows
|
|
899
|
-
// export interface SelectableHdsAdvancedTableTrArgs
|
|
900
|
-
// extends BaseHdsAdvancedTableTrSignature {
|
|
901
|
-
// Args: BaseHdsAdvancedTableTrSignature['Args'] & {
|
|
902
|
-
// isSelectable: true;
|
|
903
|
-
// selectionScope?: HdsAdvancedTableScopeValues.Row;
|
|
904
|
-
// selectionKey: string; // Now required for selectable rows
|
|
905
|
-
// };
|
|
906
|
-
// }
|
|
907
|
-
// Union type to combine both possible states
|
|
908
749
|
// | SelectableHdsAdvancedTableTrArgs;
|
|
909
750
|
class HdsAdvancedTableTr extends Component {
|
|
751
|
+
static {
|
|
752
|
+
g(this.prototype, "isSelectedOverride", [tracked]);
|
|
753
|
+
}
|
|
754
|
+
#isSelectedOverride = (i(this, "isSelectedOverride"), void 0);
|
|
910
755
|
get selectionKey() {
|
|
911
756
|
if (this.args.isSelectable && this.args.selectionScope === 'row') {
|
|
912
757
|
assert(`@selectionKey must be defined on Table::Tr or B.Tr when @isSelectable is true`, this.args.selectionKey);
|
|
@@ -914,6 +759,10 @@ class HdsAdvancedTableTr extends Component {
|
|
|
914
759
|
}
|
|
915
760
|
return undefined;
|
|
916
761
|
}
|
|
762
|
+
// Carbon applies styles to the entire row when it is selected, so we need a state to track the selection state to toggle the appropriate class.
|
|
763
|
+
get isSelected() {
|
|
764
|
+
return this.isSelectedOverride ?? this.args.isSelected ?? false;
|
|
765
|
+
}
|
|
917
766
|
get classNames() {
|
|
918
767
|
const {
|
|
919
768
|
depth,
|
|
@@ -934,6 +783,9 @@ class HdsAdvancedTableTr extends Component {
|
|
|
934
783
|
if (isLastRow) {
|
|
935
784
|
classes.push('hds-advanced-table__tr--last-row');
|
|
936
785
|
}
|
|
786
|
+
if (this.isSelected) {
|
|
787
|
+
classes.push(`hds-advanced-table__tr--is-selected`);
|
|
788
|
+
}
|
|
937
789
|
return classes.join(' ');
|
|
938
790
|
}
|
|
939
791
|
get cells() {
|
|
@@ -970,8 +822,17 @@ class HdsAdvancedTableTr extends Component {
|
|
|
970
822
|
return this.cells;
|
|
971
823
|
}
|
|
972
824
|
}
|
|
825
|
+
onSelectionChange = (checkbox, selectionKey) => {
|
|
826
|
+
this.isSelectedOverride = checkbox?.checked ?? false;
|
|
827
|
+
const {
|
|
828
|
+
onSelectionChange
|
|
829
|
+
} = this.args;
|
|
830
|
+
if (typeof onSelectionChange === 'function') {
|
|
831
|
+
onSelectionChange(checkbox, selectionKey);
|
|
832
|
+
}
|
|
833
|
+
};
|
|
973
834
|
static {
|
|
974
|
-
setComponentTemplate(precompileTemplate("<div class={{this.classNames}} role=\"row\" {{@compositeGroup}} ...attributes>\n {{#if @isSelectable}}\n <HdsAdvancedTableThSelectable role={{if (eq @selectionScope \"row\") \"gridcell\" \"columnheader\"}} @compositeItem={{@compositeItem}} @isCompositeItemDisabled={{@isCompositeItemDisabled}} @isSelected={{
|
|
835
|
+
setComponentTemplate(precompileTemplate("<div class={{this.classNames}} role=\"row\" {{@compositeGroup}} ...attributes>\n {{#if @isSelectable}}\n <HdsAdvancedTableThSelectable role={{if (eq @selectionScope \"row\") \"gridcell\" \"columnheader\"}} @compositeItem={{@compositeItem}} @isCompositeItemDisabled={{@isCompositeItemDisabled}} @isSelected={{this.isSelected}} @selectionScope={{@selectionScope}} @selectionKey={{this.selectionKey}} @selectionAriaLabelSuffix={{@selectionAriaLabelSuffix}} @sortBySelectedOrder={{@sortBySelectedOrder}} @didInsert={{@didInsert}} @willDestroy={{@willDestroy}} @onClickSortBySelected={{@onClickSortBySelected}} @onSelectionChange={{this.onSelectionChange}} @isStickyColumn={{@hasStickyColumn}} @isStickyColumnPinned={{@isStickyColumnPinned}} />\n {{/if}}\n\n {{yield (hash orderedCells=this.orderedCells)}}\n</div>", {
|
|
975
836
|
strictMode: true,
|
|
976
837
|
scope: () => ({
|
|
977
838
|
HdsAdvancedTableThSelectable,
|
|
@@ -1064,6 +925,7 @@ class HdsAdvancedTable extends Component {
|
|
|
1064
925
|
}
|
|
1065
926
|
#_tableHeight = (i(this, "_tableHeight"), void 0);
|
|
1066
927
|
_selectableRows = [];
|
|
928
|
+
_isBulkSelectionChange = false;
|
|
1067
929
|
_captionId = 'caption-' + guidFor(this);
|
|
1068
930
|
_scrollHandler;
|
|
1069
931
|
_dragOverHandler;
|
|
@@ -1147,6 +1009,22 @@ class HdsAdvancedTable extends Component {
|
|
|
1147
1009
|
const updateHorizontalScrollIndicators = () => {
|
|
1148
1010
|
this.showScrollIndicatorRight = element.clientWidth < element.scrollWidth;
|
|
1149
1011
|
};
|
|
1012
|
+
const updateBottomScrollIndicator = () => {
|
|
1013
|
+
// when hasReorderableColumns is true, the reorder handles are absolutely
|
|
1014
|
+
// positioned with translateY(50%), which causes them to overflow the
|
|
1015
|
+
// header's bottom edge by half their height, inflating scrollHeight even
|
|
1016
|
+
// when there is no actual scrollable content. visibility:hidden means
|
|
1017
|
+
// getBoundingClientRect() returns zeros at mount time, so we use
|
|
1018
|
+
// offsetHeight / 2 instead.
|
|
1019
|
+
let reorderHandleOverflow = 0;
|
|
1020
|
+
if (this.args.hasReorderableColumns) {
|
|
1021
|
+
const firstHandle = this._theadElement?.querySelector('.hds-advanced-table__th-reorder-handle');
|
|
1022
|
+
if (firstHandle) {
|
|
1023
|
+
reorderHandleOverflow = firstHandle.offsetHeight / 2;
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
this.showScrollIndicatorBottom = element.scrollHeight - reorderHandleOverflow - element.clientHeight > 0;
|
|
1027
|
+
};
|
|
1150
1028
|
this._scrollHandler = () => {
|
|
1151
1029
|
this._updateScrollIndicators(element);
|
|
1152
1030
|
};
|
|
@@ -1211,6 +1089,7 @@ class HdsAdvancedTable extends Component {
|
|
|
1211
1089
|
entries.forEach(() => {
|
|
1212
1090
|
updateMeasurements();
|
|
1213
1091
|
updateHorizontalScrollIndicators();
|
|
1092
|
+
updateBottomScrollIndicator();
|
|
1214
1093
|
});
|
|
1215
1094
|
});
|
|
1216
1095
|
this._resizeObserver.observe(element);
|
|
@@ -1218,9 +1097,7 @@ class HdsAdvancedTable extends Component {
|
|
|
1218
1097
|
// on render check if should show right scroll indicator
|
|
1219
1098
|
updateHorizontalScrollIndicators();
|
|
1220
1099
|
// on render check if should show bottom scroll indicator
|
|
1221
|
-
|
|
1222
|
-
this.showScrollIndicatorBottom = true;
|
|
1223
|
-
}
|
|
1100
|
+
updateBottomScrollIndicator();
|
|
1224
1101
|
return () => {
|
|
1225
1102
|
element.removeEventListener('scroll', this._scrollHandler);
|
|
1226
1103
|
element.removeEventListener('dragover', this._dragOverHandler);
|
|
@@ -1528,9 +1405,14 @@ class HdsAdvancedTable extends Component {
|
|
|
1528
1405
|
n(this.prototype, "toggleRow", [action]);
|
|
1529
1406
|
}
|
|
1530
1407
|
onSelectionAllChange() {
|
|
1408
|
+
this._isBulkSelectionChange = true;
|
|
1531
1409
|
this._selectableRows.forEach(row => {
|
|
1532
1410
|
row.checkbox.checked = this._selectAllCheckbox?.checked ?? false;
|
|
1411
|
+
row.checkbox.dispatchEvent(new Event('change', {
|
|
1412
|
+
bubbles: true
|
|
1413
|
+
}));
|
|
1533
1414
|
});
|
|
1415
|
+
this._isBulkSelectionChange = false;
|
|
1534
1416
|
this._isSelectAllCheckboxSelected = this._selectAllCheckbox?.checked ?? false;
|
|
1535
1417
|
this.onSelectionChangeCallback(this._selectAllCheckbox, 'all');
|
|
1536
1418
|
}
|
|
@@ -1538,6 +1420,9 @@ class HdsAdvancedTable extends Component {
|
|
|
1538
1420
|
n(this.prototype, "onSelectionAllChange", [action]);
|
|
1539
1421
|
}
|
|
1540
1422
|
onSelectionRowChange(checkbox, selectionKey) {
|
|
1423
|
+
if (this._isBulkSelectionChange) {
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1541
1426
|
this.setSelectAllState();
|
|
1542
1427
|
this.onSelectionChangeCallback(checkbox, selectionKey);
|
|
1543
1428
|
}
|
|
@@ -1664,7 +1549,7 @@ class HdsAdvancedTable extends Component {
|
|
|
1664
1549
|
this._updateScrollIndicators(this._scrollWrapperElement);
|
|
1665
1550
|
};
|
|
1666
1551
|
static {
|
|
1667
|
-
setComponentTemplate(precompileTemplate("<div class=\"hds-advanced-table__actions-container-wrapper\">\n {{#if (has-block \"actions\")}}\n <div class=\"hds-advanced-table__actions\">\n {{yield (hash FilterBar=(component HdsFilterBar)) to=\"actions\"}}\n </div>\n {{/if}}\n\n <div class=\"hds-advanced-table__container\n {{(if this.isStickyHeaderPinned \"hds-advanced-table__container--header-is-pinned\")}}\" {{this._syncSortArgs}} ...attributes>\n {{!-- Caption --}}\n <div id={{this._captionId}} class=\"sr-only hds-advanced-table__caption\" aria-live=\"polite\">\n {{@caption}}\n {{this.sortedMessageText}}\n {{this.reorderedMessageText}}\n </div>\n\n <HdsAdvancedTableColumnManager @columns={{@columns}} @columnOrder={{@columnOrder}} @hasReorderableColumns={{@hasReorderableColumns}} @hasStickyFirstColumn={{this.hasStickyFirstColumn}} @isSelectable={{@isSelectable}} @onColumnReorder={{this._onColumnReorder}} as |CM|>\n <HdsComposite as |C|>\n {{!-- Grid --}}\n <div class={{this.classNames}} role=\"grid\" aria-describedby={{this._captionId}} {{style grid-template-columns=CM.gridTemplateColumns --hds-advanced-table-sticky-column-offset=this.stickyColumnOffset max-height=@maxHeight}} {{this._setUpScrollWrapper}} {{CM.syncColumnOrder CM.columns @columnOrder}} {{CM.syncWidthValues}} {{C.composite}}>\n {{!-- Header --}}\n <div class={{this.theadClassNames}} role=\"rowgroup\" {{this._setUpThead}} {{on \"dragleave\" (fn CM.setReorderHoveredColumnKey null)}}>\n <HdsAdvancedTableTr @compositeGroup={{C.group}} @compositeItem={{C.item}} @selectionScope=\"col\" @onClickSortBySelected={{if @selectableColumnKey (fn this.setSortBy @selectableColumnKey)}} @sortBySelectedOrder={{if (eq this.currentSortBy @selectableColumnKey) this.currentSortOrder}} @isSelectable={{this.isSelectable}} @onSelectionChange={{this.onSelectionAllChange}} @didInsert={{this.didInsertSelectAllCheckbox}} @willDestroy={{this.willDestroySelectAllCheckbox}} @selectionAriaLabelSuffix=\"all rows\" @hasStickyColumn={{this.hasStickyFirstColumn}} @isStickyColumnPinned={{this.isStickyColumnPinned}}>\n {{#each CM.orderedColumns as |column|}}\n <HdsAdvancedTableTh @align={{column.align}} @column={{column}} @compositeItem={{C.item}} @draggedColumnKey={{CM.draggedColumnKey}} @firstColumnKey={{CM.firstColumnKey}} @firstNonStickyColumnKey={{CM.firstNonStickyColumnKey}} @hasReorderableColumns={{@hasReorderableColumns}} @hasResizableColumns={{@hasResizableColumns}} @hasSelectableRows={{this.isSelectable}} @hasStickyFirstColumn={{this.hasStickyFirstColumn}} @isStickyColumn={{if (and (eq column.key CM.firstColumnKey) (notEq this.hasStickyFirstColumn undefined)) this.hasStickyFirstColumn undefined}} @isStickyColumnPinned={{this.isStickyColumnPinned}} @lastColumnKey={{CM.lastColumnKey}} @reorderHoveredColumnKey={{CM.reorderHoveredColumnKey}} @draggedColumnSiblingColumnKeys={{if CM.draggedColumnKey (CM.getSiblingColumnKeys CM.draggedColumnKey)}} @
|
|
1552
|
+
setComponentTemplate(precompileTemplate("<div class=\"hds-advanced-table__actions-container-wrapper\">\n {{#if (has-block \"actions\")}}\n <div class=\"hds-advanced-table__actions\">\n {{yield (hash FilterBar=(component HdsFilterBar)) to=\"actions\"}}\n </div>\n {{/if}}\n\n <div class=\"hds-advanced-table__container\n {{(if this.isStickyHeaderPinned \"hds-advanced-table__container--header-is-pinned\")}}\" {{this._syncSortArgs}} ...attributes>\n {{!-- Caption --}}\n <div id={{this._captionId}} class=\"sr-only hds-advanced-table__caption\" aria-live=\"polite\">\n {{@caption}}\n {{this.sortedMessageText}}\n {{this.reorderedMessageText}}\n </div>\n\n <HdsAdvancedTableColumnManager @columns={{@columns}} @columnOrder={{@columnOrder}} @hasReorderableColumns={{@hasReorderableColumns}} @hasStickyFirstColumn={{this.hasStickyFirstColumn}} @isSelectable={{@isSelectable}} @onColumnReorder={{this._onColumnReorder}} as |CM|>\n <HdsComposite as |C|>\n {{!-- Grid --}}\n <div class={{this.classNames}} role=\"grid\" aria-describedby={{this._captionId}} {{style grid-template-columns=CM.gridTemplateColumns --hds-advanced-table-sticky-column-offset=this.stickyColumnOffset max-height=@maxHeight}} {{this._setUpScrollWrapper}} {{CM.syncColumnOrder CM.columns @columnOrder}} {{CM.syncWidthValues}} {{C.composite}}>\n {{!-- Header --}}\n <div class={{this.theadClassNames}} role=\"rowgroup\" {{this._setUpThead}} {{on \"dragleave\" (fn CM.setReorderHoveredColumnKey null)}}>\n <HdsAdvancedTableTr @compositeGroup={{C.group}} @compositeItem={{C.item}} @selectionScope=\"col\" @onClickSortBySelected={{if @selectableColumnKey (fn this.setSortBy @selectableColumnKey)}} @sortBySelectedOrder={{if (eq this.currentSortBy @selectableColumnKey) this.currentSortOrder}} @isSelectable={{this.isSelectable}} @onSelectionChange={{this.onSelectionAllChange}} @didInsert={{this.didInsertSelectAllCheckbox}} @willDestroy={{this.willDestroySelectAllCheckbox}} @selectionAriaLabelSuffix=\"all rows\" @hasStickyColumn={{this.hasStickyFirstColumn}} @isStickyColumnPinned={{this.isStickyColumnPinned}}>\n {{#each CM.orderedColumns as |column|}}\n <HdsAdvancedTableTh @align={{column.align}} @column={{column}} @compositeItem={{C.item}} @draggedColumnKey={{CM.draggedColumnKey}} @firstColumnKey={{CM.firstColumnKey}} @firstNonStickyColumnKey={{CM.firstNonStickyColumnKey}} @hasReorderableColumns={{@hasReorderableColumns}} @hasResizableColumns={{@hasResizableColumns}} @hasSelectableRows={{this.isSelectable}} @hasStickyFirstColumn={{this.hasStickyFirstColumn}} @isStickyColumn={{if (and (eq column.key CM.firstColumnKey) (notEq this.hasStickyFirstColumn undefined)) this.hasStickyFirstColumn undefined}} @isStickyColumnPinned={{this.isStickyColumnPinned}} @lastColumnKey={{CM.lastColumnKey}} @reorderHoveredColumnKey={{CM.reorderHoveredColumnKey}} @draggedColumnSiblingColumnKeys={{if CM.draggedColumnKey (CM.getSiblingColumnKeys CM.draggedColumnKey)}} @tableHeight={{this._tableHeight}} @tooltip={{column.tooltip}} @hasExpandAllButton={{this.hasRowsWithChildren}} @isExpanded={{this.isAllExpanded}} @isExpandable={{column.isExpandable}} @sortOrder={{if (eq column.key this.currentSortBy) this.currentSortOrder}} @onBeginColumnResize={{CM.beginColumnResize}} @onClickSort={{if column.isSortable (fn this.setSortBy column.key)}} @onClickToggle={{this.toggleExpandAll}} @onColumnResize={{@onColumnResize}} @onCommitColumnWidths={{CM.commitColumnWidths}} @onGetAppliedWidth={{CM.getAppliedWidth}} @onGetRenderedWidth={{CM.getRenderedWidth}} @onMoveColumnToTerminalPosition={{CM.moveColumnToTerminalPosition}} @onPinFirstColumn={{this._onPinFirstColumn}} @onReorderDrop={{CM.moveColumnToDropTarget}} @onResetTransientColumnWidths={{CM.resetTransientColumnWidths}} @onResizeColumnByDelta={{CM.resizeColumnByDelta}} @onRestoreColumnWidth={{CM.restoreColumnWidth}} @onSetDraggedColumnKey={{CM.setDraggedColumnKey}} @onSetReorderHoveredColumnKey={{CM.setReorderHoveredColumnKey}} @onStepColumn={{CM.stepColumn}} {{CM.syncThElements column.key}}>\n {{column.label}}\n </HdsAdvancedTableTh>\n {{/each}}\n </HdsAdvancedTableTr>\n\n {{#if this.showScrollIndicatorTop}}\n <div class=\"hds-advanced-table__scroll-indicator hds-advanced-table__scroll-indicator-top\" />\n {{/if}}\n </div>\n\n {{!-- Body --}}\n <HdsAdvancedTableBody @childrenKey={{this.childrenKey}} @expandedRowIds={{this.expandedRowIds}} {{!-- @glint-expect-error: [HDS-4380](https://hashicorp.atlassian.net/browse/HDS-4380) --}} @sortedModel={{sortBy this.sortCriteria @model}} as |B|>\n {{#each B.rows key=\"id\" as |row index|}}\n {{#let (and (not this.hasRowsWithChildren) (not row.hasChildren)) as |isSelectionAllowed|}}\n {{yield (hash Tr=(this.asTr (component HdsAdvancedTableTr columnOrder=CM.columnOrder compositeGroup=C.group compositeItem=C.item data=(this.asRowData row.source) depth=row.depth isCompositeItemDisabled=(not row.isVisible) isParentRow=row.hasChildren isLastRow=(and (eq row.id B.lastVisibleRowId) (notEq B.lastVisibleRowId undefined)) displayRow=row.isVisible selectionScope=(if isSelectionAllowed (this.asScope \"row\")) isSelectable=(if isSelectionAllowed this.isSelectable) onSelectionChange=(if isSelectionAllowed this.onSelectionRowChange) didInsert=(if isSelectionAllowed this.didInsertRowCheckbox) willDestroy=(if isSelectionAllowed this.willDestroyRowCheckbox) hasStickyColumn=this.hasStickyFirstColumn isStickyColumnPinned=this.isStickyColumnPinned)) Th=(component HdsAdvancedTableTh compositeItem=C.item isCompositeItemDisabled=(not row.isVisible) isExpandable=row.hasChildren isExpanded=row.isExpanded onClickToggle=(fn this.toggleRow row.id) depth=row.depth scope=\"row\" newLabel=row.id parentId=undefined isStickyColumnPinned=this.isStickyColumnPinned) Td=(component HdsAdvancedTableTd align=@align compositeItem=C.item isCompositeItemDisabled=(not row.isVisible)) data=(this.asRowData row.source) rowIndex=index isOpen=row.isExpanded) to=\"body\"}}\n {{/let}}\n {{/each}}\n </HdsAdvancedTableBody>\n </div>\n </HdsComposite>\n </HdsAdvancedTableColumnManager>\n\n {{!-- Empty state --}}\n {{#if this.isEmpty}}\n <div class=\"hds-advanced-table__empty-state\">\n {{#if (has-block \"emptyState\")}}\n {{yield to=\"emptyState\"}}\n {{else}}\n <HdsApplicationState as |A|>\n <A.Header @title={{hdsT \"hds.components.advanced-table.empty-state.title\" default=\"No data available\"}} />\n <A.Body @text={{hdsT \"hds.components.advanced-table.empty-state.description\" default=\"There is currently no data to display in the table.\"}} />\n </HdsApplicationState>\n {{/if}}\n </div>\n {{/if}}\n\n {{#if this.showScrollIndicatorLeft}}\n <div class=\"hds-advanced-table__scroll-indicator hds-advanced-table__scroll-indicator-left\" {{style height=this.scrollIndicatorDimensions.height left=this.scrollIndicatorDimensions.left}} />\n {{/if}}\n\n {{#if this.showScrollIndicatorRight}}\n <div class=\"hds-advanced-table__scroll-indicator hds-advanced-table__scroll-indicator-right\" {{style height=this.scrollIndicatorDimensions.height right=this.scrollIndicatorDimensions.right}} />\n {{/if}}\n\n {{#if (and this.showScrollIndicatorBottom (not this.isEmpty))}}\n <div class=\"hds-advanced-table__scroll-indicator hds-advanced-table__scroll-indicator-bottom\" {{style bottom=this.scrollIndicatorDimensions.bottom width=this.scrollIndicatorDimensions.width}} />\n {{/if}}\n </div>\n</div>", {
|
|
1668
1553
|
strictMode: true,
|
|
1669
1554
|
scope: () => ({
|
|
1670
1555
|
hash,
|
|
@@ -1691,4 +1576,4 @@ class HdsAdvancedTable extends Component {
|
|
|
1691
1576
|
}
|
|
1692
1577
|
|
|
1693
1578
|
export { ALIGNMENTS as A, BORDER_WIDTH as B, DEFAULT_ALIGN as D, HdsAdvancedTable as H, VALIGNMENTS as V, HdsAdvancedTableTh as a, HdsAdvancedTableThSelectable as b, HdsAdvancedTableTr as c, HdsAdvancedTableThResizeHandle as d, HdsAdvancedTableThReorderDropTarget as e, DEFAULT_DENSITY as f, DEFAULT_VALIGN as g, DENSITIES as h };
|
|
1694
|
-
//# sourceMappingURL=index-
|
|
1579
|
+
//# sourceMappingURL=index-Cx64Nvu4.js.map
|