lightning-base-components 1.22.2-alpha → 1.22.3-alpha
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 +2 -0
- package/metadata/raptor.json +31 -2
- package/package.json +12 -1
- package/scopedImports/@salesforce-label-LightningRecordPicker.actionIconAlternativeText.js +1 -0
- package/src/lightning/ariaObserver/ariaObserver.js +1 -1
- package/src/lightning/baseCombobox/baseCombobox.html +1 -1
- package/src/lightning/baseCombobox/baseCombobox.js +1 -0
- package/src/lightning/baseCombobox/input-text.slds.css +6 -7
- package/src/lightning/baseComboboxItem/card.lbc.native.css +1 -0
- package/src/lightning/baseComboboxItem/inline.lbc.native.css +1 -0
- package/src/lightning/buttonIcon/button-icon.slds.css +5 -5
- package/src/lightning/buttonIconStateful/button-icon.slds.css +5 -5
- package/src/lightning/buttonMenu/button-icon.slds.css +5 -5
- package/src/lightning/calendar/calendar.slds.css +10 -13
- package/src/lightning/checkboxGroup/checkboxGroup.js +21 -10
- package/src/lightning/checkboxGroup/checkboxGroup.js-meta.xml +3 -0
- package/src/lightning/colorPickerCustom/input-text.slds.css +6 -7
- package/src/lightning/combobox/form-element.slds.css +1 -1
- package/src/lightning/datatable/__docs__/datatable.md +10 -5
- package/src/lightning/datatable/columnResizer.js +3 -2
- package/src/lightning/datatable/columnWidthManager.js +16 -10
- package/src/lightning/datatable/datatable.js +101 -38
- package/src/lightning/datatable/infiniteLoading.js +8 -20
- package/src/lightning/datatable/inlineEdit.js +11 -6
- package/src/lightning/datatable/keyboard.js +58 -55
- package/src/lightning/datatable/resizeObserver.js +10 -5
- package/src/lightning/datatable/rows.js +1 -2
- package/src/lightning/datatable/rowsInlining.js +5 -4
- package/src/lightning/datatable/state.js +1 -2
- package/src/lightning/datatable/templates/div/div.html +150 -43
- package/src/lightning/datatable/templates/div/div.lbc.synthetic.css +8 -7
- package/src/lightning/datatable/templates/table/table.html +153 -46
- package/src/lightning/datatable/utils.js +10 -4
- package/src/lightning/datatable/virtualization.js +6 -4
- package/src/lightning/datatable/wrapText.js +16 -15
- package/src/lightning/datepicker/form-element.slds.css +1 -1
- package/src/lightning/datepicker/input-text.slds.css +6 -7
- package/src/lightning/datetimepicker/form-element.slds.css +1 -1
- package/src/lightning/datetimepicker/input-text.slds.css +6 -7
- package/src/lightning/dualListbox/form-element.slds.css +1 -1
- package/src/lightning/groupedCombobox/form-element.slds.css +1 -1
- package/src/lightning/groupedCombobox/input-text.slds.css +6 -7
- package/src/lightning/helptext/button-icon.slds.css +5 -5
- package/src/lightning/helptext/form-element.slds.css +1 -1
- package/src/lightning/input/form-element.slds.css +1 -1
- package/src/lightning/input/input.html +0 -1
- package/src/lightning/inputAddress/form-element.slds.css +1 -1
- package/src/lightning/inputAddress/input-text.slds.css +6 -7
- package/src/lightning/inputLocation/form-element.slds.css +1 -1
- package/src/lightning/inputLocation/input-text.slds.css +6 -7
- package/src/lightning/inputName/form-element.slds.css +1 -1
- package/src/lightning/inputName/input-text.slds.css +6 -7
- package/src/lightning/lookupAddress/form-element.slds.css +1 -1
- package/src/lightning/modal/__docs__/modal.md +2 -0
- package/src/lightning/modalBase/modalBase.html +2 -0
- package/src/lightning/modalBase/modalBase.js +30 -31
- package/src/lightning/modalBody/modalBody.html +1 -0
- package/src/lightning/modalBody/modalBody.js +3 -0
- package/src/lightning/modalFooter/modalFooter.html +5 -1
- package/src/lightning/modalFooter/modalFooter.js +3 -0
- package/src/lightning/modalHeader/modalHeader.html +4 -1
- package/src/lightning/modalHeader/modalHeader.js +3 -0
- package/src/lightning/overlayManager/overlayManager.js +1 -1
- package/src/lightning/positionLibrary/elementProxy.js +13 -6
- package/src/lightning/positionLibrary/util.js +20 -2
- package/src/lightning/primitiveCellActions/primitiveCellActions.html +1 -0
- package/src/lightning/primitiveCellActions/primitiveCellActions.js +3 -5
- package/src/lightning/primitiveCellButton/primitiveCellButton.html +2 -0
- package/src/lightning/primitiveCellButton/primitiveCellButton.js +3 -5
- package/src/lightning/primitiveCellCheckbox/checkbox.html +3 -2
- package/src/lightning/primitiveCellCheckbox/primitiveCellCheckbox.js +6 -3
- package/src/lightning/primitiveCellCheckbox/radio.html +5 -4
- package/src/lightning/primitiveCellEditableButton/primitiveCellEditableButton.html +1 -1
- package/src/lightning/primitiveCellEditableButton/primitiveCellEditableButton.js +1 -1
- package/src/lightning/primitiveCellFactory/bareCustomCell.html +1 -0
- package/src/lightning/primitiveCellFactory/cellWithStandardLayout.html +1 -0
- package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +4 -6
- package/src/lightning/primitiveColorpickerButton/color-picker-button.slds.css +1 -1
- package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.html +1 -0
- package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.js +1 -1
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.html +3 -1
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.js +3 -3
- package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.html +1 -0
- package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.js +1 -3
- package/src/lightning/primitiveDatatableTooltip/primitiveDatatableTooltip.html +1 -0
- package/src/lightning/primitiveDatatableTooltip/primitiveDatatableTooltip.js +1 -1
- package/src/lightning/primitiveDatatableTooltipBubble/primitiveDatatableTooltipBubble.html +1 -1
- package/src/lightning/primitiveDatatableTooltipBubble/primitiveDatatableTooltipBubble.js +1 -1
- package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.html +1 -0
- package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.js +2 -4
- package/src/lightning/primitiveHeaderFactory/nonsortableHeader.html +8 -3
- package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +43 -13
- package/src/lightning/primitiveHeaderFactory/selectableHeader.html +3 -2
- package/src/lightning/primitiveHeaderFactory/sortableHeader.html +8 -3
- package/src/lightning/primitiveHeaderFactory/sortingMenuHeader.html +1 -1
- package/src/lightning/primitiveIcon/primitiveIcon.css +0 -1
- package/src/lightning/primitiveInputCheckbox/form-element.slds.css +1 -1
- package/src/lightning/primitiveInputCheckboxButton/form-element.slds.css +1 -1
- package/src/lightning/primitiveInputColor/form-element.slds.css +1 -1
- package/src/lightning/primitiveInputColor/input-text.slds.css +6 -7
- package/src/lightning/primitiveInputFile/form-element.slds.css +1 -1
- package/src/lightning/primitiveInputSimple/form-element.slds.css +1 -1
- package/src/lightning/primitiveInputSimple/input-text.slds.css +6 -7
- package/src/lightning/primitiveInputToggle/form-element.slds.css +1 -1
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.html +4 -2
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.js +2 -2
- package/src/lightning/primitiveTreegridCellToggle/primitiveTreegridCellToggle.html +1 -1
- package/src/lightning/primitiveTreegridCellToggle/primitiveTreegridCellToggle.js +1 -1
- package/src/lightning/progressIndicator/progressIndicator.css +1 -1
- package/src/lightning/progressIndicator/progressIndicator.js +14 -6
- package/src/lightning/progressIndicator/progressIndicator.js-meta.xml +3 -0
- package/src/lightning/progressIndicator/progressIndicator.lbc.native.css +2 -0
- package/src/lightning/progressStep/__examples__/basic/basic.html +11 -0
- package/src/lightning/progressStep/__examples__/basic/basic.js +3 -0
- package/src/lightning/progressStep/__examples__/shaded/shaded.html +11 -0
- package/src/lightning/progressStep/__examples__/shaded/shaded.js +3 -0
- package/src/lightning/progressStep/base.html +2 -1
- package/src/lightning/progressStep/progressStep.css +1 -0
- package/src/lightning/progressStep/progressStep.js +40 -29
- package/src/lightning/progressStep/progressStep.js-meta.xml +3 -0
- package/src/lightning/progressStep/progressStep.lbc.native.css +3 -0
- package/src/lightning/prompt/form-element.slds.css +1 -1
- package/src/lightning/prompt/input-text.slds.css +6 -7
- package/src/lightning/radioGroup/form-element.slds.css +1 -1
- package/src/lightning/select/form-element.slds.css +1 -1
- package/src/lightning/select/select.slds.css +1 -1
- package/src/lightning/sldsCommon/sldsCommon.css +1 -1
- package/src/lightning/textarea/form-element.slds.css +1 -1
- package/src/lightning/tile/mediaTile.css +2 -0
- package/src/lightning/tile/standardTile.css +2 -1
- package/src/lightning/tile/tile.js +5 -2
- package/src/lightning/tile/tile.js-meta.xml +3 -0
- package/src/lightning/tile/tile.lbc.native.css +4 -0
- package/src/lightning/timepicker/form-element.slds.css +1 -1
- package/src/lightning/toast/button-icon.slds.css +5 -5
- package/src/lightning/primitiveIcon/primitiveIcon.lbc.synthetic.css +0 -9
- /package/src/lightning/tile/{standardTile.lbc.synthetic.css → tile.lbc.synthetic.css} +0 -0
|
@@ -156,10 +156,11 @@ export class ColumnWidthManager {
|
|
|
156
156
|
* Adjusts all the column sizes based on the supplied widths data.
|
|
157
157
|
*
|
|
158
158
|
* @param {Node} template The datatable template
|
|
159
|
+
* @param {Object} refs The datatable refs
|
|
159
160
|
* @param {Array} columns The column definitions
|
|
160
161
|
* @param {Object} widthsData The widths data object
|
|
161
162
|
*/
|
|
162
|
-
adjustColumnsSize(template, columns, widthsData) {
|
|
163
|
+
adjustColumnsSize(template, refs, columns, widthsData) {
|
|
163
164
|
const {
|
|
164
165
|
columnWidthStrategy,
|
|
165
166
|
isAutoResizingUpdateQueued,
|
|
@@ -170,9 +171,9 @@ export class ColumnWidthManager {
|
|
|
170
171
|
// If table is hidden when updating and `ResizeObserver` is not available,
|
|
171
172
|
// then updating sizes causes min widths to be set.
|
|
172
173
|
// Hence, the check if ok update from DOM.
|
|
173
|
-
if (this.shouldResizeWithUpdate(template, widthsData)) {
|
|
174
|
+
if (this.shouldResizeWithUpdate(template, refs, widthsData)) {
|
|
174
175
|
adjustedWidths = columnWidthStrategy.getAdjustedColumnWidths(
|
|
175
|
-
this.getDatatableInterface(template),
|
|
176
|
+
this.getDatatableInterface(template, refs),
|
|
176
177
|
columns,
|
|
177
178
|
isAutoResizingUpdateQueued
|
|
178
179
|
);
|
|
@@ -193,12 +194,13 @@ export class ColumnWidthManager {
|
|
|
193
194
|
* Adjusts all the column widths after a resize happens.
|
|
194
195
|
*
|
|
195
196
|
* @param {Node} template The datatable template
|
|
197
|
+
* @param {Object} refs The datatable refs
|
|
196
198
|
* @param {Array} columns The column definitions
|
|
197
199
|
* @param {Object} widthsData The widths data object
|
|
198
200
|
*/
|
|
199
|
-
adjustColumnsSizeAfterResize(
|
|
201
|
+
adjustColumnsSizeAfterResize(dt, columns, widthsData) {
|
|
200
202
|
const adjustedWidths = this.columnWidthStrategy.getAdjustedColumnWidths(
|
|
201
|
-
this.getDatatableInterface(template),
|
|
203
|
+
this.getDatatableInterface(dt.template, dt.refs),
|
|
202
204
|
columns
|
|
203
205
|
);
|
|
204
206
|
updateColumnWidths(columns, widthsData, adjustedWidths);
|
|
@@ -346,14 +348,15 @@ export class ColumnWidthManager {
|
|
|
346
348
|
* Determines if a column should resize with an update.
|
|
347
349
|
*
|
|
348
350
|
* @param {Node} template The datatable template
|
|
351
|
+
* @param {Object} refs The datatable refs
|
|
349
352
|
* @param {Object} widthsData The source widths data
|
|
350
353
|
* @returns {Boolean} Whether the column should resize with an update
|
|
351
354
|
*/
|
|
352
|
-
shouldResizeWithUpdate(template, widthsData) {
|
|
355
|
+
shouldResizeWithUpdate(template, refs, widthsData) {
|
|
353
356
|
if (widthsData.columnWidths.length > 0) {
|
|
354
357
|
// Can resize from DOM when table is visible.
|
|
355
358
|
// Otherwise, only when `ResizeObserver` is available in browser.
|
|
356
|
-
return isTableRenderedVisible(template);
|
|
359
|
+
return isTableRenderedVisible(template, refs);
|
|
357
360
|
}
|
|
358
361
|
return true;
|
|
359
362
|
}
|
|
@@ -362,12 +365,13 @@ export class ColumnWidthManager {
|
|
|
362
365
|
* Retrieves the datatable interface from the DOM
|
|
363
366
|
*
|
|
364
367
|
* @param {Node} template The datatable template
|
|
368
|
+
* @param {Object} refs The datatable refs
|
|
365
369
|
* @returns {Object} The datatable interface
|
|
366
370
|
*/
|
|
367
|
-
getDatatableInterface(template) {
|
|
371
|
+
getDatatableInterface(template, refs) {
|
|
368
372
|
return {
|
|
369
373
|
getAvailableWidthFromDom() {
|
|
370
|
-
const scrollerX = getScrollerX(template);
|
|
374
|
+
const scrollerX = getScrollerX(template, refs);
|
|
371
375
|
return scrollerX.offsetWidth;
|
|
372
376
|
},
|
|
373
377
|
getDataCellWidths() {
|
|
@@ -395,7 +399,9 @@ export class ColumnWidthManager {
|
|
|
395
399
|
return result;
|
|
396
400
|
},
|
|
397
401
|
getTableElementWidth() {
|
|
398
|
-
|
|
402
|
+
const elem =
|
|
403
|
+
refs?.tableElement || template.querySelector('.slds-table');
|
|
404
|
+
return elem.offsetWidth;
|
|
399
405
|
},
|
|
400
406
|
};
|
|
401
407
|
}
|
|
@@ -210,6 +210,8 @@ export default class LightningDatatable extends LightningElement {
|
|
|
210
210
|
_widthObserver; // Instance of LightningDatatableResizeObserver
|
|
211
211
|
_hasSetInitialCustomTypes = false;
|
|
212
212
|
_shouldResetCustomTypes = false;
|
|
213
|
+
_headerHeight = '';
|
|
214
|
+
_recalculateHeaderHeight = false;
|
|
213
215
|
|
|
214
216
|
/************************* PUBLIC PROPERTIES *************************/
|
|
215
217
|
|
|
@@ -466,9 +468,11 @@ export default class LightningDatatable extends LightningElement {
|
|
|
466
468
|
}
|
|
467
469
|
|
|
468
470
|
/**
|
|
469
|
-
*
|
|
470
|
-
*
|
|
471
|
-
*
|
|
471
|
+
* Specifies how the table header is wrapped. Set to 'all' to wrap all column headers.
|
|
472
|
+
* Set to 'none' to clip all column headers. Set to 'by-column' to wrap/clip column headers
|
|
473
|
+
* based on the wrap/clip setting for that individual column. The default is 'by-column'.
|
|
474
|
+
* @type {String}
|
|
475
|
+
* @default by-column
|
|
472
476
|
*/
|
|
473
477
|
@api
|
|
474
478
|
get wrapTableHeader() {
|
|
@@ -477,7 +481,16 @@ export default class LightningDatatable extends LightningElement {
|
|
|
477
481
|
|
|
478
482
|
set wrapTableHeader(value) {
|
|
479
483
|
// Untracked state change.
|
|
480
|
-
this.state.wrapTableHeader =
|
|
484
|
+
this.state.wrapTableHeader = normalizeString(value, {
|
|
485
|
+
fallbackValue: 'by-column',
|
|
486
|
+
validValues: ['all', 'by-column', 'none'],
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
if (this.state.wrapTableHeader !== 'none') {
|
|
490
|
+
this._recalculateHeaderHeight = true;
|
|
491
|
+
} else {
|
|
492
|
+
this._headerHeight = '';
|
|
493
|
+
}
|
|
481
494
|
}
|
|
482
495
|
|
|
483
496
|
/**
|
|
@@ -893,7 +906,9 @@ export default class LightningDatatable extends LightningElement {
|
|
|
893
906
|
/************************** PRIVATE GETTERS **************************/
|
|
894
907
|
|
|
895
908
|
get gridContainer() {
|
|
896
|
-
return getGridContainerFromScrollerY(
|
|
909
|
+
return getGridContainerFromScrollerY(
|
|
910
|
+
getScrollerY(this.template, this.refs)
|
|
911
|
+
);
|
|
897
912
|
}
|
|
898
913
|
|
|
899
914
|
get computedTableContainerClass() {
|
|
@@ -987,9 +1002,9 @@ export default class LightningDatatable extends LightningElement {
|
|
|
987
1002
|
if (this._columnWidthManager.isAutoResizingUpdateQueued) {
|
|
988
1003
|
style += 'overflow-x: auto;';
|
|
989
1004
|
}
|
|
990
|
-
if (this.state.wrapTableHeader) {
|
|
991
|
-
//
|
|
992
|
-
style +=
|
|
1005
|
+
if (this.state.wrapTableHeader !== 'none') {
|
|
1006
|
+
// update padding style for dynamic header height when header can wrap
|
|
1007
|
+
style += `padding-top: max(2rem, ${this._headerHeight})`;
|
|
993
1008
|
}
|
|
994
1009
|
return style;
|
|
995
1010
|
}
|
|
@@ -1102,7 +1117,12 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1102
1117
|
!!this._privateTypes.privateCustomTypes.size;
|
|
1103
1118
|
|
|
1104
1119
|
this._renderManager = new RenderManager();
|
|
1105
|
-
this.getWrapperHeight = () =>
|
|
1120
|
+
this.getWrapperHeight = () => {
|
|
1121
|
+
const scrollerX = getScrollerX(this.template, this.refs);
|
|
1122
|
+
const paddingTop =
|
|
1123
|
+
parseFloat(getComputedStyle(scrollerX).paddingTop) || 0;
|
|
1124
|
+
return scrollerX.offsetHeight - paddingTop;
|
|
1125
|
+
};
|
|
1106
1126
|
}
|
|
1107
1127
|
|
|
1108
1128
|
/**
|
|
@@ -1230,6 +1250,7 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1230
1250
|
const {
|
|
1231
1251
|
_columnWidthManager,
|
|
1232
1252
|
gridContainer,
|
|
1253
|
+
refs,
|
|
1233
1254
|
state,
|
|
1234
1255
|
template,
|
|
1235
1256
|
widthsData,
|
|
@@ -1268,6 +1289,7 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1268
1289
|
// Tracked state changes.
|
|
1269
1290
|
_columnWidthManager.adjustColumnsSize(
|
|
1270
1291
|
template,
|
|
1292
|
+
refs,
|
|
1271
1293
|
columns,
|
|
1272
1294
|
widthsData
|
|
1273
1295
|
);
|
|
@@ -1278,30 +1300,29 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1278
1300
|
if (fireResizeEvent) {
|
|
1279
1301
|
this.fireOnResize(false);
|
|
1280
1302
|
}
|
|
1303
|
+
this._recalculateHeaderHeight = true;
|
|
1281
1304
|
this.updateTableAndScrollerStyleOnRender();
|
|
1282
1305
|
}
|
|
1283
1306
|
|
|
1284
1307
|
let { _widthObserver } = this;
|
|
1285
1308
|
if (!_widthObserver) {
|
|
1286
1309
|
// Tracked state changes.
|
|
1287
|
-
_widthObserver = new LightningDatatableResizeObserver(
|
|
1288
|
-
|
|
1289
|
-
(
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
recomputeCellStyles(state);
|
|
1299
|
-
}
|
|
1310
|
+
_widthObserver = new LightningDatatableResizeObserver(this, () => {
|
|
1311
|
+
// Tracked state change.
|
|
1312
|
+
_columnWidthManager.adjustColumnsSizeAfterResize(
|
|
1313
|
+
this,
|
|
1314
|
+
state.columns,
|
|
1315
|
+
widthsData
|
|
1316
|
+
);
|
|
1317
|
+
this._recalculateHeaderHeight = true;
|
|
1318
|
+
// Managing cell widths is required for role-based render mode.
|
|
1319
|
+
if (state.renderModeRoleBased) {
|
|
1320
|
+
recomputeCellStyles(state);
|
|
1300
1321
|
}
|
|
1301
|
-
);
|
|
1322
|
+
});
|
|
1302
1323
|
this._widthObserver = _widthObserver;
|
|
1303
1324
|
} else if (!_widthObserver.isConnected()) {
|
|
1304
|
-
_widthObserver.observe(template);
|
|
1325
|
+
_widthObserver.observe(template, refs);
|
|
1305
1326
|
}
|
|
1306
1327
|
|
|
1307
1328
|
handlePrefetch.call(this);
|
|
@@ -1332,7 +1353,14 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1332
1353
|
!cellElementChild.classList.contains(FOCUS_CLASS)
|
|
1333
1354
|
) {
|
|
1334
1355
|
// Tracked state change.
|
|
1335
|
-
setFocusActiveCell(
|
|
1356
|
+
setFocusActiveCell(
|
|
1357
|
+
state,
|
|
1358
|
+
template,
|
|
1359
|
+
refs,
|
|
1360
|
+
null,
|
|
1361
|
+
null,
|
|
1362
|
+
false
|
|
1363
|
+
);
|
|
1336
1364
|
}
|
|
1337
1365
|
}
|
|
1338
1366
|
}
|
|
@@ -1354,9 +1382,10 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1354
1382
|
}
|
|
1355
1383
|
}
|
|
1356
1384
|
if (!hasRenderedFirstTime) {
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1385
|
+
const outerContainer =
|
|
1386
|
+
refs?.outerContainer ||
|
|
1387
|
+
template.querySelector('div.dt-outer-container');
|
|
1388
|
+
_renderManager.connectResizeObserver(outerContainer);
|
|
1360
1389
|
}
|
|
1361
1390
|
if (!_renderManager.hasWrapperHeight()) {
|
|
1362
1391
|
_renderManager.updateWrapperHeight(this.getWrapperHeight);
|
|
@@ -1381,10 +1410,38 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1381
1410
|
this.updateUrlCellsLinkInfo();
|
|
1382
1411
|
}
|
|
1383
1412
|
}
|
|
1413
|
+
|
|
1414
|
+
this.updateHeaderHeight();
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
updateHeaderHeight() {
|
|
1418
|
+
if (
|
|
1419
|
+
this.state.wrapTableHeader !== 'none' &&
|
|
1420
|
+
this._recalculateHeaderHeight
|
|
1421
|
+
) {
|
|
1422
|
+
// Need to wait a frame for width changes on last render to take effect
|
|
1423
|
+
// eslint-disable-next-line @lwc/lwc/no-async-operation
|
|
1424
|
+
requestAnimationFrame(() => {
|
|
1425
|
+
const headerElements = this.template.querySelectorAll(
|
|
1426
|
+
'[role="columnheader"] lightning-primitive-header-factory'
|
|
1427
|
+
);
|
|
1428
|
+
let headerHeight = 0;
|
|
1429
|
+
for (let i = 0; i < headerElements.length; i += 1) {
|
|
1430
|
+
const headerCellHeight = headerElements[i].getDomHeight();
|
|
1431
|
+
if (headerCellHeight > headerHeight) {
|
|
1432
|
+
headerHeight = headerCellHeight;
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
// Header height only accounts for the height of the text
|
|
1436
|
+
// Add 16 px for padding around the text
|
|
1437
|
+
this._headerHeight = `max(2rem, ${headerHeight + 16}px)`;
|
|
1438
|
+
this._recalculateHeaderHeight = false;
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1384
1441
|
}
|
|
1385
1442
|
|
|
1386
1443
|
updateTableAndScrollerStyleOnRender() {
|
|
1387
|
-
const scrollYEle = getScrollerY(this.template);
|
|
1444
|
+
const scrollYEle = getScrollerY(this.template, this.refs);
|
|
1388
1445
|
const tableElement = getGridContainerFromScrollerY(scrollYEle);
|
|
1389
1446
|
if (tableElement) {
|
|
1390
1447
|
tableElement.style = this.computedTableStyle;
|
|
@@ -1593,6 +1650,7 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1593
1650
|
}
|
|
1594
1651
|
this.fireOnResize(true);
|
|
1595
1652
|
this.fixHeaderForSafari();
|
|
1653
|
+
this._recalculateHeaderHeight = true;
|
|
1596
1654
|
}
|
|
1597
1655
|
}
|
|
1598
1656
|
|
|
@@ -1673,7 +1731,7 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1673
1731
|
this.setActiveCell(rowKeyValue, colKeyValue);
|
|
1674
1732
|
}
|
|
1675
1733
|
// Tracked state change.
|
|
1676
|
-
setFocusActiveCell(state, this.template);
|
|
1734
|
+
setFocusActiveCell(state, this.template, this.refs);
|
|
1677
1735
|
}
|
|
1678
1736
|
|
|
1679
1737
|
/**
|
|
@@ -1991,7 +2049,7 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1991
2049
|
// if there is previously focused cell which was deleted set focus from cellToFocusNext
|
|
1992
2050
|
if (state.activeCell && state.cellToFocusNext) {
|
|
1993
2051
|
// Tracked state change.
|
|
1994
|
-
setFocusActiveCell(state, this.template);
|
|
2052
|
+
setFocusActiveCell(state, this.template, this.refs);
|
|
1995
2053
|
}
|
|
1996
2054
|
}
|
|
1997
2055
|
|
|
@@ -2043,7 +2101,7 @@ export default class LightningDatatable extends LightningElement {
|
|
|
2043
2101
|
// If there is previously focused cell which was deleted set focus from cellToFocusNext.
|
|
2044
2102
|
if (state.activeCell && state.cellToFocusNext) {
|
|
2045
2103
|
// Tracked state change.
|
|
2046
|
-
setFocusActiveCell(state, this.template);
|
|
2104
|
+
setFocusActiveCell(state, this.template, this.refs);
|
|
2047
2105
|
}
|
|
2048
2106
|
}
|
|
2049
2107
|
|
|
@@ -2069,11 +2127,16 @@ export default class LightningDatatable extends LightningElement {
|
|
|
2069
2127
|
|
|
2070
2128
|
// no need to handle other virtualization/row height logic
|
|
2071
2129
|
// if heights need to be reset
|
|
2072
|
-
if (
|
|
2130
|
+
if (state.shouldResetHeights) {
|
|
2073
2131
|
resetRowHeights(state);
|
|
2074
|
-
|
|
2132
|
+
state.shouldResetHeights = false;
|
|
2075
2133
|
} else if (virtualizedRows) {
|
|
2076
|
-
handleVariableRowHeights(
|
|
2134
|
+
handleVariableRowHeights(
|
|
2135
|
+
this.template,
|
|
2136
|
+
state,
|
|
2137
|
+
this.renderedRows,
|
|
2138
|
+
this.refs
|
|
2139
|
+
);
|
|
2077
2140
|
}
|
|
2078
2141
|
}
|
|
2079
2142
|
|
|
@@ -2129,10 +2192,10 @@ export default class LightningDatatable extends LightningElement {
|
|
|
2129
2192
|
* @returns {Object} containing the visible dimensions of the table { left, right, top, bottom, }
|
|
2130
2193
|
*/
|
|
2131
2194
|
getViewableRect() {
|
|
2132
|
-
const { template } = this;
|
|
2133
|
-
const scrollerY = getScrollerY(template);
|
|
2195
|
+
const { refs, template } = this;
|
|
2196
|
+
const scrollerY = getScrollerY(template, refs);
|
|
2134
2197
|
const scrollerYRect = scrollerY.getBoundingClientRect();
|
|
2135
|
-
const scrollerX = getScrollerX(template);
|
|
2198
|
+
const scrollerX = getScrollerX(template, refs);
|
|
2136
2199
|
const scrollerXRect = scrollerX.getBoundingClientRect();
|
|
2137
2200
|
|
|
2138
2201
|
return {
|
|
@@ -90,20 +90,20 @@ export function handleLoadMoreCheck(event) {
|
|
|
90
90
|
* dispatches the `loadmore` event.
|
|
91
91
|
*/
|
|
92
92
|
export function handlePrefetch() {
|
|
93
|
-
const { state, template } = this;
|
|
93
|
+
const { state, template, refs } = this;
|
|
94
94
|
if (
|
|
95
95
|
state.isLoading ||
|
|
96
96
|
!state.enableInfiniteLoading ||
|
|
97
97
|
(state.enableViewportRendering &&
|
|
98
98
|
this._renderManager &&
|
|
99
99
|
!this._renderManager.hasWrapperHeight()) ||
|
|
100
|
-
!
|
|
100
|
+
!state.rows.length
|
|
101
101
|
) {
|
|
102
102
|
// Don't prefetch if already loading or data is not set yet.
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
const scrollerY = getScrollerY(template);
|
|
106
|
+
const scrollerY = getScrollerY(template, refs);
|
|
107
107
|
if (scrollerY && isScrollerVisible(scrollerY) && !isScrollable(scrollerY)) {
|
|
108
108
|
this.dispatchEvent(new CustomEvent('loadmore'));
|
|
109
109
|
}
|
|
@@ -124,28 +124,16 @@ function isScrollable(scroller) {
|
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
126
|
* Determines if a scroller element's scroll bars are visible.
|
|
127
|
+
* Check for values over 1 since div tables have a height of 1 on
|
|
128
|
+
* initial render but should not trigger loadmore.
|
|
127
129
|
*
|
|
128
130
|
* @param {Element} scroller The scroller element to check
|
|
129
131
|
* @returns {Boolean} Whether the scroller element's scroll bars are visible
|
|
130
132
|
*/
|
|
131
133
|
function isScrollerVisible(scroller) {
|
|
132
134
|
return !!(
|
|
133
|
-
scroller.offsetParent
|
|
134
|
-
scroller.offsetHeight
|
|
135
|
-
scroller.offsetWidth
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Determines if a template has data
|
|
141
|
-
*
|
|
142
|
-
* @param {Element} template The parent element to check
|
|
143
|
-
* @returns {Boolean} Whether or not the element contains any data
|
|
144
|
-
*/
|
|
145
|
-
function hasData(template) {
|
|
146
|
-
return (
|
|
147
|
-
template.querySelectorAll(
|
|
148
|
-
'tbody > tr, [role="rowgroup"] > [role="row"]'
|
|
149
|
-
).length > 0
|
|
135
|
+
scroller.offsetParent &&
|
|
136
|
+
scroller.offsetHeight > 1 &&
|
|
137
|
+
scroller.offsetWidth > 1
|
|
150
138
|
);
|
|
151
139
|
}
|
|
@@ -211,7 +211,7 @@ export function closeInlineEdit(dt) {
|
|
|
211
211
|
* @param {string} colKeyValue - column key of the edited cell
|
|
212
212
|
*/
|
|
213
213
|
function processInlineEditFinish(dt, reason, rowKeyValue, colKeyValue) {
|
|
214
|
-
const { state, template } = dt;
|
|
214
|
+
const { state, template, refs } = dt;
|
|
215
215
|
const { inlineEdit: inlineEditState } = state;
|
|
216
216
|
|
|
217
217
|
const shouldSaveData =
|
|
@@ -259,11 +259,16 @@ function processInlineEditFinish(dt, reason, rowKeyValue, colKeyValue) {
|
|
|
259
259
|
|
|
260
260
|
if (reason !== 'lost-focus') {
|
|
261
261
|
if (reason === 'tab-pressed-next') {
|
|
262
|
-
reactToTabForward(state, template);
|
|
262
|
+
reactToTabForward(state, template, refs);
|
|
263
263
|
} else if (reason === 'tab-pressed-prev') {
|
|
264
|
-
reactToTabBackward(state, template);
|
|
264
|
+
reactToTabBackward(state, template, refs);
|
|
265
265
|
} else {
|
|
266
|
-
setFocusActiveCell(
|
|
266
|
+
setFocusActiveCell(
|
|
267
|
+
state,
|
|
268
|
+
template,
|
|
269
|
+
refs,
|
|
270
|
+
NAVIGATION_DIR.USE_CURRENT
|
|
271
|
+
);
|
|
267
272
|
}
|
|
268
273
|
}
|
|
269
274
|
|
|
@@ -391,8 +396,8 @@ export function openInlineEditOnActiveCell(dt) {
|
|
|
391
396
|
*/
|
|
392
397
|
// eslint-disable-next-line @lwc/lwc/no-async-await
|
|
393
398
|
async function setFocusAndOpenInlineEdit(dt) {
|
|
394
|
-
const { state, template } = dt;
|
|
395
|
-
await setFocusActiveCell(state, template, NAVIGATION_DIR.USE_CURRENT);
|
|
399
|
+
const { state, template, refs } = dt;
|
|
400
|
+
await setFocusActiveCell(state, template, refs, NAVIGATION_DIR.USE_CURRENT);
|
|
396
401
|
const cellElement = getActiveCellElement(template, state);
|
|
397
402
|
openInlineEdit(dt, cellElement);
|
|
398
403
|
}
|