lightning-base-components 1.22.1-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 +38 -2
- package/package.json +12 -1
- package/scopedImports/@salesforce-label-LightningRecordPicker.actionIconAlternativeText.js +1 -0
- package/src/lightning/accordionSection/button.slds.css +8 -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/dropdown.slds.css +7 -7
- package/src/lightning/baseComboboxItem/card.lbc.native.css +1 -0
- package/src/lightning/baseComboboxItem/inline.lbc.native.css +1 -0
- package/src/lightning/button/button.slds.css +8 -0
- package/src/lightning/buttonIcon/button-icon.slds.css +8 -0
- package/src/lightning/buttonIcon/buttonIcon.js +29 -26
- package/src/lightning/buttonIconStateful/button-icon.slds.css +8 -0
- package/src/lightning/buttonIconStateful/button.slds.css +8 -0
- package/src/lightning/buttonMenu/button-icon.slds.css +8 -0
- package/src/lightning/buttonMenu/button.slds.css +8 -0
- package/src/lightning/buttonMenu/dropdown.slds.css +7 -7
- package/src/lightning/buttonStateful/button.slds.css +8 -0
- package/src/lightning/calendar/calendar.lbc.native.css +1 -0
- package/src/lightning/calendar/dropdown.slds.css +7 -7
- package/src/lightning/checkboxGroup/checkboxGroup.js +21 -10
- package/src/lightning/checkboxGroup/checkboxGroup.js-meta.xml +3 -0
- package/src/lightning/colorPickerPanel/colorPickerPanel.js +1 -11
- package/src/lightning/combobox/combobox.html +1 -1
- package/src/lightning/datatable/__docs__/datatable.md +10 -5
- package/src/lightning/datatable/autoWidthStrategy.js +32 -44
- package/src/lightning/datatable/columnResizer.js +3 -2
- package/src/lightning/datatable/columnWidthManager.js +16 -10
- package/src/lightning/datatable/columns.js +4 -1
- package/src/lightning/datatable/datatable.js +108 -46
- 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 +3 -3
- 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/groupedCombobox/groupedCombobox.js +21 -28
- package/src/lightning/helptext/button-icon.slds.css +8 -0
- package/src/lightning/helptext/helptext.html +2 -1
- package/src/lightning/helptext/helptext.js +0 -12
- package/src/lightning/input/input.html +0 -1
- package/src/lightning/interactiveDialogBase/button.slds.css +8 -0
- 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/pillContainer/button.slds.css +8 -0
- package/src/lightning/positionLibrary/elementProxy.js +13 -6
- package/src/lightning/positionLibrary/util.js +20 -2
- package/src/lightning/primitiveBubble/primitiveBubble.js +9 -4
- 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/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 +2 -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/primitiveInputFile/button.slds.css +8 -0
- 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/sldsCommon/sldsCommon.css +1 -1
- package/src/lightning/sldsUtilsThemes/sldsUtilsThemes.css +6 -4
- package/src/lightning/tabBar/tab-bar.slds.css +17 -3
- 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/toast/button-icon.slds.css +8 -0
- package/src/lightning/tooltipLibrary/tooltipLibrary.js +15 -4
- package/src/lightning/utilsPrivate/utilsPrivate.js +4 -4
- package/src/lightning/verticalNavigationOverflow/button.slds.css +8 -0
- package/src/lightning/primitiveIcon/primitiveIcon.lbc.synthetic.css +0 -9
- /package/src/lightning/tile/{standardTile.lbc.synthetic.css → tile.lbc.synthetic.css} +0 -0
|
@@ -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
|
/**
|
|
@@ -622,14 +635,11 @@ export default class LightningDatatable extends LightningElement {
|
|
|
622
635
|
this.getWrapperHeight,
|
|
623
636
|
value
|
|
624
637
|
);
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
this.
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
true
|
|
631
|
-
);
|
|
632
|
-
}
|
|
638
|
+
this._renderManager.updateViewportRendering(
|
|
639
|
+
this.state,
|
|
640
|
+
this.gridContainer,
|
|
641
|
+
true
|
|
642
|
+
);
|
|
633
643
|
this._renderConfig = value;
|
|
634
644
|
}
|
|
635
645
|
}
|
|
@@ -896,7 +906,9 @@ export default class LightningDatatable extends LightningElement {
|
|
|
896
906
|
/************************** PRIVATE GETTERS **************************/
|
|
897
907
|
|
|
898
908
|
get gridContainer() {
|
|
899
|
-
return getGridContainerFromScrollerY(
|
|
909
|
+
return getGridContainerFromScrollerY(
|
|
910
|
+
getScrollerY(this.template, this.refs)
|
|
911
|
+
);
|
|
900
912
|
}
|
|
901
913
|
|
|
902
914
|
get computedTableContainerClass() {
|
|
@@ -990,9 +1002,9 @@ export default class LightningDatatable extends LightningElement {
|
|
|
990
1002
|
if (this._columnWidthManager.isAutoResizingUpdateQueued) {
|
|
991
1003
|
style += 'overflow-x: auto;';
|
|
992
1004
|
}
|
|
993
|
-
if (this.state.wrapTableHeader) {
|
|
994
|
-
//
|
|
995
|
-
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})`;
|
|
996
1008
|
}
|
|
997
1009
|
return style;
|
|
998
1010
|
}
|
|
@@ -1101,9 +1113,16 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1101
1113
|
|
|
1102
1114
|
this._columnWidthManager = new ColumnWidthManager(this.widthsData);
|
|
1103
1115
|
this._privateTypes = new DatatableTypes(this.constructor.customTypes);
|
|
1116
|
+
this._hasSetInitialCustomTypes =
|
|
1117
|
+
!!this._privateTypes.privateCustomTypes.size;
|
|
1104
1118
|
|
|
1105
1119
|
this._renderManager = new RenderManager();
|
|
1106
|
-
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
|
+
};
|
|
1107
1126
|
}
|
|
1108
1127
|
|
|
1109
1128
|
/**
|
|
@@ -1231,6 +1250,7 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1231
1250
|
const {
|
|
1232
1251
|
_columnWidthManager,
|
|
1233
1252
|
gridContainer,
|
|
1253
|
+
refs,
|
|
1234
1254
|
state,
|
|
1235
1255
|
template,
|
|
1236
1256
|
widthsData,
|
|
@@ -1269,6 +1289,7 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1269
1289
|
// Tracked state changes.
|
|
1270
1290
|
_columnWidthManager.adjustColumnsSize(
|
|
1271
1291
|
template,
|
|
1292
|
+
refs,
|
|
1272
1293
|
columns,
|
|
1273
1294
|
widthsData
|
|
1274
1295
|
);
|
|
@@ -1279,30 +1300,29 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1279
1300
|
if (fireResizeEvent) {
|
|
1280
1301
|
this.fireOnResize(false);
|
|
1281
1302
|
}
|
|
1303
|
+
this._recalculateHeaderHeight = true;
|
|
1282
1304
|
this.updateTableAndScrollerStyleOnRender();
|
|
1283
1305
|
}
|
|
1284
1306
|
|
|
1285
1307
|
let { _widthObserver } = this;
|
|
1286
1308
|
if (!_widthObserver) {
|
|
1287
1309
|
// Tracked state changes.
|
|
1288
|
-
_widthObserver = new LightningDatatableResizeObserver(
|
|
1289
|
-
|
|
1290
|
-
(
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
recomputeCellStyles(state);
|
|
1300
|
-
}
|
|
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);
|
|
1301
1321
|
}
|
|
1302
|
-
);
|
|
1322
|
+
});
|
|
1303
1323
|
this._widthObserver = _widthObserver;
|
|
1304
1324
|
} else if (!_widthObserver.isConnected()) {
|
|
1305
|
-
_widthObserver.observe(template);
|
|
1325
|
+
_widthObserver.observe(template, refs);
|
|
1306
1326
|
}
|
|
1307
1327
|
|
|
1308
1328
|
handlePrefetch.call(this);
|
|
@@ -1333,7 +1353,14 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1333
1353
|
!cellElementChild.classList.contains(FOCUS_CLASS)
|
|
1334
1354
|
) {
|
|
1335
1355
|
// Tracked state change.
|
|
1336
|
-
setFocusActiveCell(
|
|
1356
|
+
setFocusActiveCell(
|
|
1357
|
+
state,
|
|
1358
|
+
template,
|
|
1359
|
+
refs,
|
|
1360
|
+
null,
|
|
1361
|
+
null,
|
|
1362
|
+
false
|
|
1363
|
+
);
|
|
1337
1364
|
}
|
|
1338
1365
|
}
|
|
1339
1366
|
}
|
|
@@ -1355,9 +1382,10 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1355
1382
|
}
|
|
1356
1383
|
}
|
|
1357
1384
|
if (!hasRenderedFirstTime) {
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1385
|
+
const outerContainer =
|
|
1386
|
+
refs?.outerContainer ||
|
|
1387
|
+
template.querySelector('div.dt-outer-container');
|
|
1388
|
+
_renderManager.connectResizeObserver(outerContainer);
|
|
1361
1389
|
}
|
|
1362
1390
|
if (!_renderManager.hasWrapperHeight()) {
|
|
1363
1391
|
_renderManager.updateWrapperHeight(this.getWrapperHeight);
|
|
@@ -1382,10 +1410,38 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1382
1410
|
this.updateUrlCellsLinkInfo();
|
|
1383
1411
|
}
|
|
1384
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
|
+
}
|
|
1385
1441
|
}
|
|
1386
1442
|
|
|
1387
1443
|
updateTableAndScrollerStyleOnRender() {
|
|
1388
|
-
const scrollYEle = getScrollerY(this.template);
|
|
1444
|
+
const scrollYEle = getScrollerY(this.template, this.refs);
|
|
1389
1445
|
const tableElement = getGridContainerFromScrollerY(scrollYEle);
|
|
1390
1446
|
if (tableElement) {
|
|
1391
1447
|
tableElement.style = this.computedTableStyle;
|
|
@@ -1594,6 +1650,7 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1594
1650
|
}
|
|
1595
1651
|
this.fireOnResize(true);
|
|
1596
1652
|
this.fixHeaderForSafari();
|
|
1653
|
+
this._recalculateHeaderHeight = true;
|
|
1597
1654
|
}
|
|
1598
1655
|
}
|
|
1599
1656
|
|
|
@@ -1674,7 +1731,7 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1674
1731
|
this.setActiveCell(rowKeyValue, colKeyValue);
|
|
1675
1732
|
}
|
|
1676
1733
|
// Tracked state change.
|
|
1677
|
-
setFocusActiveCell(state, this.template);
|
|
1734
|
+
setFocusActiveCell(state, this.template, this.refs);
|
|
1678
1735
|
}
|
|
1679
1736
|
|
|
1680
1737
|
/**
|
|
@@ -1992,7 +2049,7 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1992
2049
|
// if there is previously focused cell which was deleted set focus from cellToFocusNext
|
|
1993
2050
|
if (state.activeCell && state.cellToFocusNext) {
|
|
1994
2051
|
// Tracked state change.
|
|
1995
|
-
setFocusActiveCell(state, this.template);
|
|
2052
|
+
setFocusActiveCell(state, this.template, this.refs);
|
|
1996
2053
|
}
|
|
1997
2054
|
}
|
|
1998
2055
|
|
|
@@ -2044,7 +2101,7 @@ export default class LightningDatatable extends LightningElement {
|
|
|
2044
2101
|
// If there is previously focused cell which was deleted set focus from cellToFocusNext.
|
|
2045
2102
|
if (state.activeCell && state.cellToFocusNext) {
|
|
2046
2103
|
// Tracked state change.
|
|
2047
|
-
setFocusActiveCell(state, this.template);
|
|
2104
|
+
setFocusActiveCell(state, this.template, this.refs);
|
|
2048
2105
|
}
|
|
2049
2106
|
}
|
|
2050
2107
|
|
|
@@ -2070,11 +2127,16 @@ export default class LightningDatatable extends LightningElement {
|
|
|
2070
2127
|
|
|
2071
2128
|
// no need to handle other virtualization/row height logic
|
|
2072
2129
|
// if heights need to be reset
|
|
2073
|
-
if (
|
|
2130
|
+
if (state.shouldResetHeights) {
|
|
2074
2131
|
resetRowHeights(state);
|
|
2075
|
-
|
|
2132
|
+
state.shouldResetHeights = false;
|
|
2076
2133
|
} else if (virtualizedRows) {
|
|
2077
|
-
handleVariableRowHeights(
|
|
2134
|
+
handleVariableRowHeights(
|
|
2135
|
+
this.template,
|
|
2136
|
+
state,
|
|
2137
|
+
this.renderedRows,
|
|
2138
|
+
this.refs
|
|
2139
|
+
);
|
|
2078
2140
|
}
|
|
2079
2141
|
}
|
|
2080
2142
|
|
|
@@ -2130,10 +2192,10 @@ export default class LightningDatatable extends LightningElement {
|
|
|
2130
2192
|
* @returns {Object} containing the visible dimensions of the table { left, right, top, bottom, }
|
|
2131
2193
|
*/
|
|
2132
2194
|
getViewableRect() {
|
|
2133
|
-
const { template } = this;
|
|
2134
|
-
const scrollerY = getScrollerY(template);
|
|
2195
|
+
const { refs, template } = this;
|
|
2196
|
+
const scrollerY = getScrollerY(template, refs);
|
|
2135
2197
|
const scrollerYRect = scrollerY.getBoundingClientRect();
|
|
2136
|
-
const scrollerX = getScrollerX(template);
|
|
2198
|
+
const scrollerX = getScrollerX(template, refs);
|
|
2137
2199
|
const scrollerXRect = scrollerX.getBoundingClientRect();
|
|
2138
2200
|
|
|
2139
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
|
}
|