lightning-base-components 1.21.3-alpha → 1.21.5-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/metadata/raptor.json +49 -0
- package/package.json +96 -21
- package/scopedImports/@salesforce-label-LightningDatatable.showActions.js +1 -1
- package/scopedImports/@salesforce-label-LightningForm.controllerFieldsMessage.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.dependentFieldsHeader.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.dependentFieldsListHeading.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.generalDependentFieldsMessage.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.learnMore.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.okButton.js +1 -0
- package/scopedImports/@salesforce-label-LightningLookup.messageWhenSearchTermTooShort.js +1 -0
- package/scopedImports/@salesforce-label-LightningLookup.modalCancel.js +1 -0
- package/scopedImports/@salesforce-label-LightningLookup.modalSelect.js +1 -0
- package/scopedImports/@salesforce-label-LightningProgressIndicator.currentStage.js +1 -1
- package/scopedImports/@salesforce-label-LightningProgressIndicator.errorStage.js +1 -0
- package/scopedImports/@salesforce-label-LightningProgressIndicator.stageComplete.js +1 -1
- package/scopedImports/@salesforce-label-LightningProgressIndicator.stageNotStarted.js +1 -1
- package/src/lightning/accordion/__docs__/accordion.md +0 -4
- package/src/lightning/accordionSection/__docs__/accordionSection.md +0 -4
- package/src/lightning/avatar/__docs__/avatar.md +0 -4
- package/src/lightning/avatar/avatar.html +1 -0
- package/src/lightning/badge/__docs__/badge.md +0 -4
- package/src/lightning/badge/badge.html +3 -3
- package/src/lightning/barcodeScanner/__docs__/barcodeScanner.md +0 -4
- package/src/lightning/baseCombobox/baseCombobox.html +4 -1
- package/src/lightning/baseCombobox/baseCombobox.js +5 -18
- package/src/lightning/baseComboboxItem/baseComboboxItem.js +6 -10
- package/src/lightning/button/__docs__/button.md +5 -8
- package/src/lightning/button/button.js +3 -4
- package/src/lightning/buttonGroup/__docs__/buttonGroup.md +0 -4
- package/src/lightning/buttonIcon/__docs__/buttonIcon.md +1 -4
- package/src/lightning/buttonIcon/buttonIcon.html +1 -1
- package/src/lightning/buttonIcon/buttonIcon.js +18 -17
- package/src/lightning/buttonIconStateful/__docs__/buttonIconStateful.md +0 -4
- package/src/lightning/buttonMenu/__docs__/buttonMenu.md +0 -4
- package/src/lightning/buttonMenu/buttonMenu.css +5 -0
- package/src/lightning/buttonMenu/buttonMenu.js +2 -0
- package/src/lightning/buttonStateful/__docs__/buttonStateful.md +0 -4
- package/src/lightning/buttonStateful/buttonStateful.html +5 -3
- package/src/lightning/buttonStateful/buttonStateful.js +4 -0
- package/src/lightning/card/__docs__/card.md +0 -4
- package/src/lightning/card/card.js-meta.xml +3 -0
- package/src/lightning/carousel/__docs__/carousel.md +0 -4
- package/src/lightning/checkboxGroup/__docs__/checkboxGroup.md +0 -4
- package/src/lightning/colorPickerCustom/colorPickerCustom.js +12 -0
- package/src/lightning/colorPickerPanel/colorPickerPanel.js +11 -1
- package/src/lightning/combobox/__docs__/combobox.md +0 -4
- package/src/lightning/combobox/combobox.html +1 -0
- package/src/lightning/datatable/__examples__disabled/customComponentWrapper/customComponentWrapper.html +11 -0
- package/src/lightning/datatable/__examples__disabled/customComponentWrapper/customComponentWrapper.js +25 -0
- package/src/lightning/datatable/__examples__disabled/customComponentWrapper/generateData.js +15 -0
- package/src/lightning/datatable/__examples__disabled/myCustomTypeDatatable/customInput.html +4 -0
- package/src/lightning/datatable/__examples__disabled/myCustomTypeDatatable/myCustomTypeDatatable.js +17 -0
- package/src/lightning/datatable/__examples__disabled/myCustomTypeDatatable/nestedSimpleComponentParent.html +7 -0
- package/src/lightning/datatable/__examples__disabled/simpleComponentNested/simpleComponentNested.html +9 -0
- package/src/lightning/datatable/__examples__disabled/simpleComponentNested/simpleComponentNested.js +6 -0
- package/src/lightning/datatable/autoWidthStrategy.js +8 -36
- package/src/lightning/datatable/columnResizer.js +51 -161
- package/src/lightning/datatable/columnWidthManager.js +25 -81
- package/src/lightning/datatable/columns.js +180 -302
- package/src/lightning/datatable/datatable.js +454 -441
- package/src/lightning/datatable/errors.js +17 -29
- package/src/lightning/datatable/fixedWidthStrategy.js +7 -22
- package/src/lightning/datatable/headerActions.js +8 -38
- package/src/lightning/datatable/indexes.js +42 -0
- package/src/lightning/datatable/infiniteLoading.js +16 -35
- package/src/lightning/datatable/inlineEdit.js +126 -156
- package/src/lightning/datatable/keyboard.js +226 -282
- package/src/lightning/datatable/renderManager.js +0 -4
- package/src/lightning/datatable/resizeObserver.js +4 -13
- package/src/lightning/datatable/rowLevelActions.js +2 -2
- package/src/lightning/datatable/rowNumber.js +21 -59
- package/src/lightning/datatable/rowSelection.js +95 -178
- package/src/lightning/datatable/rowSelectionShared.js +13 -27
- package/src/lightning/datatable/rows.js +171 -418
- package/src/lightning/datatable/sort.js +16 -75
- package/src/lightning/datatable/templates/div/div.html +12 -4
- package/src/lightning/datatable/templates/div/div.lbc.synthetic.css +10 -16
- package/src/lightning/datatable/templates/table/table.html +15 -5
- package/src/lightning/datatable/tree.js +17 -35
- package/src/lightning/datatable/types.js +10 -31
- package/src/lightning/datatable/utils.js +48 -24
- package/src/lightning/datatable/virtualization.js +2 -5
- package/src/lightning/datatable/widthManagerShared.js +0 -20
- package/src/lightning/datatable/wrapText.js +29 -60
- package/src/lightning/dualListbox/__docs__/dualListbox.md +0 -4
- package/src/lightning/dualListbox/dualListbox.js +7 -8
- package/src/lightning/dynamicIcon/__docs__/dynamicIcon.md +0 -4
- package/src/lightning/formattedDateTime/__docs__/formattedDateTime.md +0 -4
- package/src/lightning/formattedLocation/__docs__/formattedLocation.md +0 -4
- package/src/lightning/formattedName/__docs__/formattedName.md +0 -4
- package/src/lightning/formattedName/formattedName.js +3 -2
- package/src/lightning/formattedName/formattedName.js-meta.xml +3 -0
- package/src/lightning/formattedNumber/__docs__/formattedNumber.md +0 -4
- package/src/lightning/formattedNumber/formattedNumber.js +3 -2
- package/src/lightning/formattedNumber/formattedNumber.js-meta.xml +3 -0
- package/src/lightning/formattedPhone/__docs__/formattedPhone.md +0 -4
- package/src/lightning/formattedRichText/richTextConfig.js +1 -0
- package/src/lightning/formattedText/__docs__/formattedText.md +0 -4
- package/src/lightning/formattedTime/__docs__/formattedTime.md +0 -4
- package/src/lightning/formattedUrl/__docs__/formattedUrl.md +0 -4
- package/src/lightning/helptext/helptext.css +7 -0
- package/src/lightning/helptext/helptext.js +3 -4
- package/src/lightning/icon/__docs__/icon.md +0 -4
- package/src/lightning/icon/icon.html +1 -1
- package/src/lightning/input/input.html +5 -0
- package/src/lightning/inputAddress/addressFormat.js +31 -4
- package/src/lightning/inputAddress/fieldsLayout.js +6 -0
- package/src/lightning/inputAddress/inputAddress.html +19 -1
- package/src/lightning/inputAddress/inputAddress.js +80 -3
- package/src/lightning/inputLocation/__docs__/inputLocation.md +0 -4
- package/src/lightning/internationalizationLibrary/address/AddressFormat.js +553 -610
- package/src/lightning/layout/__docs__/layout.md +0 -4
- package/src/lightning/layoutItem/__docs__/layoutItem.md +0 -4
- package/src/lightning/lookupAddress/lookupAddress.html +6 -1
- package/src/lightning/lookupAddress/lookupAddress.js +25 -0
- package/src/lightning/menuItem/__docs__/menuItem.md +0 -4
- package/src/lightning/menuSubheader/menu-subheader.slds.css +1 -1
- package/src/lightning/modal/__docs__/modal.md +10 -1
- package/src/lightning/modal/__modalUtils__/modalContainerTestConstants.js +3 -7
- package/src/lightning/modal/__modalUtils__/modalContainerTestMethods.js +39 -133
- package/src/lightning/modal/__modalUtils__/modalContainerTestMockData.js +1 -1
- package/src/lightning/modal/modal.js +1 -1
- package/src/lightning/modalBase/modalBase.html +15 -10
- package/src/lightning/modalBase/modalBase.js +132 -147
- package/src/lightning/modalBody/modalBody.css +6 -0
- package/src/lightning/modalHeader/modalHeader.html +16 -4
- package/src/lightning/modalHeader/modalHeader.js +61 -14
- package/src/lightning/pill/__docs__/pill.md +0 -4
- package/src/lightning/pill/link.html +1 -0
- package/src/lightning/pill/plain.html +1 -0
- package/src/lightning/pill/plainLink.html +1 -0
- package/src/lightning/pillContainer/__docs__/pillContainer.md +0 -4
- package/src/lightning/primitiveBubble/primitiveBubble.js +42 -0
- package/src/lightning/primitiveDatatableCell/primitiveDatatableCell.js +1 -1
- package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.html +1 -1
- package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.js +13 -0
- package/src/lightning/primitiveHeaderFactory/nonsortableHeader.html +19 -6
- package/src/lightning/primitiveHeaderFactory/sortableHeader.html +3 -1
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.css +11 -0
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.html +2 -1
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.js +1 -0
- package/src/lightning/progressStep/base.html +5 -6
- package/src/lightning/progressStep/progressStep.js +14 -9
- package/src/lightning/prompt/__docs__/prompt.md +1 -1
- package/src/lightning/radioGroup/__docs__/radioGroup.md +0 -4
- package/src/lightning/relativeDateTime/__docs__/relativeDateTime.md +0 -4
- package/src/lightning/shadowBaseClassPrivate/shadowBaseClassPrivate.js +0 -2
- package/src/lightning/sldsCommon/sldsCommon.css +134 -98
- package/src/lightning/sldsUtilsAlignment/sldsUtilsAlignment.css +1 -1
- package/src/lightning/sldsUtilsBox/sldsUtilsBox.css +14 -13
- package/src/lightning/sldsUtilsGrid/sldsUtilsGrid.css +95 -92
- package/src/lightning/sldsUtilsHyphenation/sldsUtilsHyphenation.css +1 -1
- package/src/lightning/sldsUtilsMargin/sldsUtilsMargin.css +77 -75
- package/src/lightning/sldsUtilsPadding/sldsUtilsPadding.css +73 -73
- package/src/lightning/sldsUtilsSizing/sldsUtilsSizing.css +552 -558
- package/src/lightning/sldsUtilsVisibility/sldsUtilsVisibility.css +2 -2
- package/src/lightning/slider/__docs__/slider.md +0 -4
- package/src/lightning/spinner/__docs__/spinner.md +0 -4
- package/src/lightning/staticMap/staticMap.js +3 -2
- package/src/lightning/tab/__docs__/tab.md +0 -4
- package/src/lightning/tab/tab.js +6 -3
- package/src/lightning/tab/tab.js-meta.xml +3 -0
- package/src/lightning/tabBar/tabBar.js +10 -5
- package/src/lightning/tabset/__docs__/tabset.md +0 -4
- package/src/lightning/tabset/tabset.html +2 -0
- package/src/lightning/tabset/tabset.js-meta.xml +3 -0
- package/src/lightning/textarea/__docs__/textarea.md +0 -4
- package/src/lightning/textarea/textarea.js +6 -1
- package/src/lightning/tile/__docs__/tile.md +0 -4
- package/src/lightning/toastContainer/__docs__/toastContainer.md +3 -2
- package/src/lightning/tooltipLibrary/tooltipLibrary.js +24 -15
- package/src/lightning/tree/__docs__/tree.md +0 -4
- package/src/lightning/tree/tree.js +5 -1
- package/src/lightning/verticalNavigation/__docs__/verticalNavigation.md +0 -4
- package/src/lightning/verticalNavigation/vertical-navigation.slds.css +14 -0
- package/src/lightning/verticalNavigation/verticalNavigation.css +1 -1
- package/src/lightning/verticalNavigation/verticalNavigation.html +1 -1
- package/src/lightning/verticalNavigation/verticalNavigation.js +66 -28
- package/src/lightning/verticalNavigation/verticalNavigation.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationItem/__docs__/verticalNavigationItem.md +0 -4
- package/src/lightning/verticalNavigationItem/vertical-navigation-item.slds.css +63 -0
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.css +2 -3
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.js +29 -15
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.lbc.native.css +2 -0
- package/src/lightning/verticalNavigationItem/verticalNavigationItem.lbc.synthetic.css +3 -0
- package/src/lightning/verticalNavigationItemBadge/__docs__/verticalNavigationItemBadge.md +0 -4
- package/src/lightning/verticalNavigationItemBadge/badge.slds.css +76 -0
- package/src/lightning/verticalNavigationItemBadge/vertical-navigation-item.slds.css +63 -0
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.css +2 -3
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.html +1 -1
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.js +28 -15
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.lbc.native.css +5 -0
- package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.lbc.synthetic.css +3 -0
- package/src/lightning/verticalNavigationItemIcon/__docs__/verticalNavigationItemIcon.md +0 -4
- package/src/lightning/verticalNavigationItemIcon/vertical-navigation-item.slds.css +63 -0
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.css +2 -3
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.js +29 -15
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.lbc.native.css +3 -0
- package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.lbc.synthetic.css +3 -0
- package/src/lightning/verticalNavigationOverflow/button.slds.css +503 -0
- package/src/lightning/verticalNavigationOverflow/vertical-navigation-item.slds.css +63 -0
- package/src/lightning/verticalNavigationOverflow/vertical-navigation-section.slds.css +17 -0
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.css +2 -1
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.html +2 -0
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.js +18 -13
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.js-meta.xml +3 -0
- package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.lbc.native.css +5 -0
- package/src/lightning/verticalNavigationSection/vertical-navigation-section.slds.css +14 -14
- package/src/lightning/verticalNavigationSection/verticalNavigationSection.js-meta.xml +3 -0
- package/src/lightning/datatable/inlineEditShared.js +0 -26
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatableWrapper/customDatatableWrapper.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatableWrapper/customDatatableWrapper.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeLink/customDatatypeLink.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeLink/customDatatypeLink.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeNumber/customDatatypeNumber.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeNumber/customDatatypeNumber.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customDatatypeTable.js +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customLink.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customName.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customNumber.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customNumberEdit.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/deleteRow.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/iconPill.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/orderingButtons.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customNestedComponent/customNestedComponent.html +0 -0
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customNestedComponent/customNestedComponent.js +0 -0
|
@@ -1,119 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { clamp, normalizeNumberAttribute } from './utils';
|
|
4
|
-
import { buildCSSWidthStyle } from './widthManagerShared';
|
|
1
|
+
import { isRTL, normalizeBoolean } from 'lightning/utilsPrivate';
|
|
2
|
+
import { clamp, getScrollerY, normalizeNumberAttribute } from './utils';
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
|
-
* Returns the default state/values of the resizer metadata
|
|
5
|
+
* Returns the default state/values of the resizer metadata.
|
|
6
|
+
*
|
|
8
7
|
* @returns {Object} - resizer default state
|
|
9
8
|
*/
|
|
10
9
|
export function getResizerDefaultState() {
|
|
11
10
|
return {
|
|
11
|
+
columnWidths: [],
|
|
12
|
+
columnWidthsMode: 'fixed',
|
|
13
|
+
maxColumnWidth: 1000,
|
|
14
|
+
minColumnWidth: 50,
|
|
12
15
|
resizeColumnDisabled: false,
|
|
13
16
|
resizeStep: 10,
|
|
14
|
-
columnWidths: [],
|
|
15
17
|
tableWidth: 0,
|
|
16
|
-
minColumnWidth: 50,
|
|
17
|
-
maxColumnWidth: 1000,
|
|
18
|
-
columnWidthsMode: 'fixed',
|
|
19
18
|
};
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
export const RESIZER_DEFAULT_STATE = getResizerDefaultState();
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
/***************** GETTERS / SETTERS *****************/
|
|
25
24
|
|
|
26
|
-
export function isResizeColumnDisabled(widthsData) {
|
|
27
|
-
return widthsData.resizeColumnDisabled;
|
|
28
|
-
}
|
|
29
25
|
export function setResizeColumnDisabled(widthsData, value) {
|
|
26
|
+
// Untracked state change.
|
|
30
27
|
widthsData.resizeColumnDisabled = normalizeBoolean(value);
|
|
31
28
|
}
|
|
32
29
|
|
|
33
|
-
/************* resizeStep *************/
|
|
34
|
-
|
|
35
|
-
export function getResizeStep(widthsData) {
|
|
36
|
-
return widthsData.resizeStep;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
30
|
export function setResizeStep(widthsData, value) {
|
|
31
|
+
// Tracked state change.
|
|
40
32
|
widthsData.resizeStep = normalizeNumberAttribute(
|
|
41
33
|
'resizeStep',
|
|
42
34
|
value,
|
|
43
35
|
'non-negative',
|
|
44
|
-
|
|
36
|
+
RESIZER_DEFAULT_STATE.resizeStep
|
|
45
37
|
);
|
|
46
38
|
}
|
|
47
39
|
|
|
48
|
-
/************* columnWidths *************/
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Returns the columnsWidths saved in the state
|
|
52
|
-
* @param {object} widthsData - data regarding column and table widths
|
|
53
|
-
* @returns {Array|*} - list of column widths
|
|
54
|
-
*/
|
|
55
|
-
export function getColumnsWidths(widthsData) {
|
|
56
|
-
return widthsData.columnWidths;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Sets columnWidths to empty array
|
|
60
|
-
* @param {object} widthsData - data regarding column and table widths
|
|
61
|
-
*/
|
|
62
|
-
export function resetColumnWidths(widthsData) {
|
|
63
|
-
widthsData.columnWidths = [];
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Returns true if there are widths stored in the state
|
|
67
|
-
* @param {object} widthsData - data regarding column and table widths
|
|
68
|
-
* @returns {boolean} - true if there are widths store in the state
|
|
69
|
-
*/
|
|
70
|
-
export function hasDefinedColumnsWidths(widthsData) {
|
|
71
|
-
return widthsData.columnWidths.length > 0;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/************* tableWidth *************/
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Get the full width of table
|
|
78
|
-
* @param {object} widthsData - data regarding column and table widths
|
|
79
|
-
* @returns {number} - table's width
|
|
80
|
-
*/
|
|
81
|
-
function getTableWidth(widthsData) {
|
|
82
|
-
return widthsData.tableWidth;
|
|
83
|
-
}
|
|
84
|
-
function setTableWidth(widthsData, tableWidth) {
|
|
85
|
-
widthsData.tableWidth = tableWidth;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/************* minColumnWidth *************/
|
|
89
|
-
|
|
90
|
-
export function getMinColumnWidth(widthsData) {
|
|
91
|
-
return widthsData.minColumnWidth;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
40
|
export function setMinColumnWidth(columns, widthsData, value) {
|
|
41
|
+
// Untracked state changes.
|
|
95
42
|
widthsData.minColumnWidth = normalizeNumberAttribute(
|
|
96
43
|
'minColumnWidth',
|
|
97
44
|
value,
|
|
98
45
|
'non-negative',
|
|
99
|
-
|
|
46
|
+
RESIZER_DEFAULT_STATE.minColumnWidth
|
|
100
47
|
);
|
|
101
48
|
// Tracked state change.
|
|
102
49
|
updateColumnWidthsMetadata(columns, widthsData);
|
|
103
50
|
}
|
|
104
51
|
|
|
105
|
-
/************* maxColumnWidth *************/
|
|
106
|
-
|
|
107
|
-
export function getMaxColumnWidth(widthsData) {
|
|
108
|
-
return widthsData.maxColumnWidth;
|
|
109
|
-
}
|
|
110
52
|
export function setMaxColumnWidth(columns, widthsData, value) {
|
|
111
53
|
// Untracked state change.
|
|
112
54
|
widthsData.maxColumnWidth = normalizeNumberAttribute(
|
|
113
55
|
'maxColumnWidth',
|
|
114
56
|
value,
|
|
115
57
|
'non-negative',
|
|
116
|
-
|
|
58
|
+
RESIZER_DEFAULT_STATE.maxColumnWidth
|
|
117
59
|
);
|
|
118
60
|
// Tracked state change.
|
|
119
61
|
updateColumnWidthsMetadata(columns, widthsData);
|
|
@@ -122,93 +64,61 @@ export function setMaxColumnWidth(columns, widthsData, value) {
|
|
|
122
64
|
/***************************** RESIZE LOGIC *****************************/
|
|
123
65
|
|
|
124
66
|
/**
|
|
125
|
-
*
|
|
126
|
-
* @param {object} widthsData - data regarding column and table widths
|
|
127
|
-
* @returns {string} - style string
|
|
128
|
-
*/
|
|
129
|
-
export function getCSSWidthStyleOfTable(widthsData) {
|
|
130
|
-
return buildCSSWidthStyle(getTableWidth(widthsData));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* - It adjusts the columns widths from the state
|
|
135
|
-
* - It is used when there are columnwidths in state but the table is hidden with offsetwidth 0
|
|
136
|
-
* - In this case we reset the columns to the width in state
|
|
67
|
+
* Resizes a column width.
|
|
137
68
|
*
|
|
138
|
-
* @param {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
let columnsWidthSum = 0;
|
|
143
|
-
const columns = getColumns(state);
|
|
144
|
-
for (let i = 0, { length } = columns; i < length; i += 1) {
|
|
145
|
-
const width = columnsWidths[i];
|
|
146
|
-
if (width !== undefined) {
|
|
147
|
-
const col = columns[i];
|
|
148
|
-
if (isRTL()) {
|
|
149
|
-
col.offset = columnsWidthSum;
|
|
150
|
-
}
|
|
151
|
-
columnsWidthSum += width;
|
|
152
|
-
col.columnWidth = width;
|
|
153
|
-
col.style = buildCSSWidthStyle(width);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
setTableWidth(state, columnsWidthSum);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Resizes a column width
|
|
161
|
-
* @param {object} columns - all columns on the table
|
|
162
|
-
* @param {object} widthsData - object containing the resizer metadata
|
|
163
|
-
* @param {number} colIndex - the index of the column based on state.columns
|
|
164
|
-
* @param {number} width - the new width is gonna be applied
|
|
69
|
+
* @param {Object} columns - The column definitions
|
|
70
|
+
* @param {Object} widthsData - The widths data
|
|
71
|
+
* @param {number} colIndex - The index of the column based on state.columns
|
|
72
|
+
* @param {number} width - The new width is gonna be applied
|
|
165
73
|
*/
|
|
166
74
|
export function resizeColumn(columns, widthsData, colIndex, width) {
|
|
167
75
|
const col = columns[colIndex];
|
|
168
|
-
const columnWidths =
|
|
76
|
+
const { columnWidths } = widthsData;
|
|
169
77
|
const currentWidth = columnWidths[colIndex];
|
|
170
78
|
const { minWidth, maxWidth } = col;
|
|
171
79
|
const newWidth = clamp(width, minWidth, maxWidth);
|
|
172
80
|
if (currentWidth !== newWidth) {
|
|
173
81
|
const newDelta = newWidth - currentWidth;
|
|
174
|
-
|
|
175
|
-
|
|
82
|
+
// Untracked state changes.
|
|
83
|
+
columnWidths[colIndex] = newWidth;
|
|
84
|
+
widthsData.tableWidth += newDelta;
|
|
85
|
+
// Tracked state changes.
|
|
86
|
+
col.columnWidth = newWidth;
|
|
87
|
+
col.style = newWidth ? `width: ${newWidth}px;` : '';
|
|
176
88
|
// Workaround for header positioning issues in RTL
|
|
177
|
-
|
|
89
|
+
if (isRTL()) {
|
|
90
|
+
// update column offsets
|
|
91
|
+
for (let i = colIndex + 1; i < columns.length; i += 1) {
|
|
92
|
+
// Tracked state change.
|
|
93
|
+
columns[i].offset += newDelta;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
178
96
|
// Tracked state change.
|
|
179
97
|
col.isResized = true;
|
|
180
98
|
}
|
|
181
99
|
}
|
|
182
100
|
|
|
183
101
|
/**
|
|
184
|
-
* Resize a column width with an additional delta
|
|
102
|
+
* Resize a column width with an additional delta.
|
|
103
|
+
*
|
|
185
104
|
* @param {object} columns - The column definitions
|
|
186
105
|
* @param {object} widthsData - The widths data
|
|
187
106
|
* @param {number} colIndex - The index of the column based on state.columns
|
|
188
107
|
* @param {number} delta - The delta that creates the new width
|
|
189
108
|
*/
|
|
190
109
|
export function resizeColumnWithDelta(columns, widthsData, colIndex, delta) {
|
|
191
|
-
const currentWidth =
|
|
110
|
+
const currentWidth = widthsData.columnWidths[colIndex];
|
|
192
111
|
resizeColumn(columns, widthsData, colIndex, currentWidth + delta);
|
|
193
112
|
}
|
|
194
113
|
|
|
195
|
-
function updateColumnWidth(columns, widthsData, colIndex, newWidth) {
|
|
196
|
-
const columnsWidths = getColumnsWidths(widthsData);
|
|
197
|
-
columnsWidths[colIndex] = newWidth;
|
|
198
|
-
|
|
199
|
-
const column = columns[colIndex];
|
|
200
|
-
column.columnWidth = newWidth;
|
|
201
|
-
column.style = buildCSSWidthStyle(newWidth);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
114
|
export function updateColumnWidthsMetadata(columns, widthsData) {
|
|
115
|
+
const { maxColumnWidth, minColumnWidth } = widthsData;
|
|
205
116
|
for (let colIndex = 0; colIndex < columns.length; colIndex += 1) {
|
|
206
117
|
const col = columns[colIndex];
|
|
207
118
|
if (!col.internal) {
|
|
208
|
-
col.
|
|
209
|
-
col.
|
|
119
|
+
col.maxWidth = maxColumnWidth;
|
|
120
|
+
col.minWidth = minColumnWidth;
|
|
210
121
|
}
|
|
211
|
-
|
|
212
122
|
const { initialWidth } = col;
|
|
213
123
|
if (initialWidth) {
|
|
214
124
|
const { minWidth: min, maxWidth: max } = col;
|
|
@@ -218,26 +128,10 @@ export function updateColumnWidthsMetadata(columns, widthsData) {
|
|
|
218
128
|
}
|
|
219
129
|
|
|
220
130
|
/**
|
|
221
|
-
*
|
|
222
|
-
* This is used to position the column headers properly in RTL.
|
|
131
|
+
* Returns the current widths for customer columns.
|
|
223
132
|
*
|
|
224
|
-
* @param {
|
|
225
|
-
* @param {
|
|
226
|
-
* @param {number} newDelta - The change in column width to apply to
|
|
227
|
-
*/
|
|
228
|
-
function updateColumnOffsets(columns, colIndex, newDelta) {
|
|
229
|
-
if (isRTL()) {
|
|
230
|
-
for (let i = colIndex, { length } = columns; i < length; i += 1) {
|
|
231
|
-
// Tracked state change.
|
|
232
|
-
columns[i].offset += newDelta;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Returns the current widths for customer columns
|
|
239
|
-
* @param {object} columns - The columns of the table
|
|
240
|
-
* @param {object} widthsData - The data regarding column and table widths
|
|
133
|
+
* @param {Object} columns - The columns of the table
|
|
134
|
+
* @param {Object} widthsData - The data regarding column and table widths
|
|
241
135
|
* @returns {Array} - The widths collection, every element
|
|
242
136
|
* belong to a column with the same index in column prop
|
|
243
137
|
*/
|
|
@@ -245,7 +139,7 @@ export function getCustomerColumnWidths(columns, widthsData) {
|
|
|
245
139
|
const widths = [];
|
|
246
140
|
const { columnWidths } = widthsData;
|
|
247
141
|
for (let colIndex = 0; colIndex < columns.length; colIndex += 1) {
|
|
248
|
-
if (
|
|
142
|
+
if (columns[colIndex].internal !== true) {
|
|
249
143
|
widths.push(columnWidths[colIndex]);
|
|
250
144
|
}
|
|
251
145
|
}
|
|
@@ -253,13 +147,13 @@ export function getCustomerColumnWidths(columns, widthsData) {
|
|
|
253
147
|
}
|
|
254
148
|
|
|
255
149
|
/**
|
|
256
|
-
* It returns if table is rendered and not hidden
|
|
257
|
-
*
|
|
258
|
-
* @
|
|
150
|
+
* It returns if table is rendered and not hidden.
|
|
151
|
+
*
|
|
152
|
+
* @param {Node} template - The datatable template
|
|
153
|
+
* @returns {boolean} - Whether the datatable is rendered and not hidden on the page
|
|
259
154
|
*/
|
|
260
|
-
export function isTableRenderedVisible(
|
|
261
|
-
const
|
|
262
|
-
const scrollerY = root.querySelector(CONTAINER_SEL);
|
|
155
|
+
export function isTableRenderedVisible(template) {
|
|
156
|
+
const scrollerY = getScrollerY(template);
|
|
263
157
|
return (
|
|
264
158
|
scrollerY &&
|
|
265
159
|
!!(
|
|
@@ -269,7 +163,3 @@ export function isTableRenderedVisible(root) {
|
|
|
269
163
|
)
|
|
270
164
|
);
|
|
271
165
|
}
|
|
272
|
-
|
|
273
|
-
function getColumns(state) {
|
|
274
|
-
return state.columns;
|
|
275
|
-
}
|
|
@@ -1,48 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getColumnsWidths,
|
|
3
|
-
getResizerDefaultState,
|
|
4
|
-
hasDefinedColumnsWidths,
|
|
5
|
-
isTableRenderedVisible,
|
|
6
|
-
} from './columnResizer';
|
|
1
|
+
import { RESIZER_DEFAULT_STATE, isTableRenderedVisible } from './columnResizer';
|
|
7
2
|
import { AutoWidthStrategy } from './autoWidthStrategy';
|
|
8
3
|
import { FixedWidthStrategy } from './fixedWidthStrategy';
|
|
4
|
+
import { getScrollerX } from './utils';
|
|
9
5
|
import {
|
|
10
6
|
getRowNumberColumnIndex,
|
|
11
7
|
getAdjustedRowNumberColumnWidth,
|
|
12
8
|
} from './rowNumber';
|
|
13
|
-
import {
|
|
14
|
-
getColumnWidth,
|
|
15
|
-
getDomWidth,
|
|
16
|
-
buildCSSWidthStyle,
|
|
17
|
-
} from './widthManagerShared';
|
|
9
|
+
import { getColumnWidth } from './widthManagerShared';
|
|
18
10
|
import { isRTL } from 'lightning/utilsPrivate';
|
|
19
11
|
|
|
20
12
|
const AUTO_WIDTH_MODE = 'auto';
|
|
21
13
|
const FIXED_WIDTH_MODE = 'fixed';
|
|
22
14
|
|
|
23
|
-
const tableTypes = {
|
|
24
|
-
default: {
|
|
25
|
-
BASE: '.slds-table',
|
|
26
|
-
CONTAINER: '.slds-scrollable_x',
|
|
27
|
-
DATA_CELL: 'tbody tr:first-child td,tbody tr:first-child th',
|
|
28
|
-
HEADER_CELL: 'thead tr th lightning-primitive-header-factory',
|
|
29
|
-
},
|
|
30
|
-
roleBased: {
|
|
31
|
-
BASE: '.slds-table',
|
|
32
|
-
CONTAINER: '.slds-scrollable_x',
|
|
33
|
-
DATA_CELL: 'div[data-rowgroup-body] div[role="row"]:first-child div',
|
|
34
|
-
HEADER_CELL: 'div.table-header lightning-primitive-header-factory',
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
|
|
38
15
|
/**
|
|
39
16
|
* Computes and updates the `widthsData` for a datatable.
|
|
40
17
|
*
|
|
41
|
-
* @param {Object} adjustedWidths The adjusted widths object
|
|
42
18
|
* @param {Array} columns The column definitions
|
|
43
19
|
* @param {Object} widthsData The widths data to update
|
|
20
|
+
* @param {Object} adjustedWidths The adjusted widths object
|
|
44
21
|
*/
|
|
45
|
-
export function updateColumnWidths(
|
|
22
|
+
export function updateColumnWidths(columns, widthsData, adjustedWidths) {
|
|
46
23
|
const { columnWidths } = adjustedWidths;
|
|
47
24
|
const { length: colCount } = columns;
|
|
48
25
|
if (columnWidths.length !== colCount) {
|
|
@@ -55,8 +32,7 @@ export function updateColumnWidths(adjustedWidths, columns, widthsData) {
|
|
|
55
32
|
const newWidth = columnWidths[colIndex];
|
|
56
33
|
widthsData.columnWidths[colIndex] = newWidth;
|
|
57
34
|
col.columnWidth = newWidth;
|
|
58
|
-
col.style =
|
|
59
|
-
|
|
35
|
+
col.style = newWidth ? `width: ${newWidth}px;` : '';
|
|
60
36
|
// In RTL, we need to explicitly position the column headers.
|
|
61
37
|
// We do this by providing the offset (in pixels) from the start of the table.
|
|
62
38
|
if (rtl) {
|
|
@@ -76,7 +52,6 @@ export function updateColumnWidths(adjustedWidths, columns, widthsData) {
|
|
|
76
52
|
* on `column-widths-mode`: "auto" or "fixed"
|
|
77
53
|
*/
|
|
78
54
|
export class ColumnWidthManager {
|
|
79
|
-
// Private variables
|
|
80
55
|
columnWidthMode = FIXED_WIDTH_MODE;
|
|
81
56
|
resizeObserverAvailable = typeof ResizeObserver === 'function';
|
|
82
57
|
|
|
@@ -92,11 +67,9 @@ export class ColumnWidthManager {
|
|
|
92
67
|
|
|
93
68
|
constructor(widthsData) {
|
|
94
69
|
const minColumnWidth =
|
|
95
|
-
widthsData.minColumnWidth ||
|
|
96
|
-
getResizerDefaultState().minColumnWidth;
|
|
70
|
+
widthsData.minColumnWidth || RESIZER_DEFAULT_STATE.minColumnWidth;
|
|
97
71
|
const maxColumnWidth =
|
|
98
|
-
widthsData.maxColumnWidth ||
|
|
99
|
-
getResizerDefaultState().maxColumnWidth;
|
|
72
|
+
widthsData.maxColumnWidth || RESIZER_DEFAULT_STATE.maxColumnWidth;
|
|
100
73
|
const fixedWidthStrategy = new FixedWidthStrategy(
|
|
101
74
|
minColumnWidth,
|
|
102
75
|
maxColumnWidth
|
|
@@ -163,15 +136,6 @@ export class ColumnWidthManager {
|
|
|
163
136
|
|
|
164
137
|
/************************* HELPER FUNCTIONS **************************/
|
|
165
138
|
|
|
166
|
-
/**
|
|
167
|
-
* Sets the datatable's configured render mode.
|
|
168
|
-
*
|
|
169
|
-
* @param {String} mode Either "table" or "role-based"
|
|
170
|
-
*/
|
|
171
|
-
setRenderMode(mode) {
|
|
172
|
-
this._renderMode = mode;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
139
|
/**
|
|
176
140
|
* Determines if we should fire the resize event based on the previous
|
|
177
141
|
* widths data and the column definition. The event is only fired when
|
|
@@ -184,8 +148,8 @@ export class ColumnWidthManager {
|
|
|
184
148
|
*/
|
|
185
149
|
shouldFireResizeEvent(previousWidthsData, columns) {
|
|
186
150
|
return (
|
|
187
|
-
this.
|
|
188
|
-
|
|
151
|
+
this.columnWidthMode === FIXED_WIDTH_MODE &&
|
|
152
|
+
previousWidthsData.columnWidths.length !== columns.length
|
|
189
153
|
);
|
|
190
154
|
}
|
|
191
155
|
|
|
@@ -193,14 +157,14 @@ export class ColumnWidthManager {
|
|
|
193
157
|
* Adjusts all the column sizes based on the supplied widths data.
|
|
194
158
|
*
|
|
195
159
|
* @param {Node} template The datatable template
|
|
196
|
-
* @param {Array}
|
|
160
|
+
* @param {Array} columns The column definitions
|
|
197
161
|
* @param {Object} widthsData The widths data object
|
|
198
162
|
*/
|
|
199
163
|
adjustColumnsSize(template, columns, widthsData) {
|
|
200
164
|
const {
|
|
201
|
-
isResizingUpdateQueued,
|
|
202
|
-
isAutoResizingUpdateQueued,
|
|
203
165
|
columnWidthStrategy,
|
|
166
|
+
isAutoResizingUpdateQueued,
|
|
167
|
+
isResizingUpdateQueued,
|
|
204
168
|
} = this;
|
|
205
169
|
if (isResizingUpdateQueued) {
|
|
206
170
|
let adjustedWidths;
|
|
@@ -217,11 +181,11 @@ export class ColumnWidthManager {
|
|
|
217
181
|
// Otherwise update from previous widths
|
|
218
182
|
adjustedWidths = {
|
|
219
183
|
columnWidths: widthsData.columnWidths,
|
|
220
|
-
expectedTableWidth: widthsData.tableWidth,
|
|
221
184
|
};
|
|
222
185
|
}
|
|
223
|
-
updateColumnWidths(
|
|
186
|
+
updateColumnWidths(columns, widthsData, adjustedWidths);
|
|
224
187
|
}
|
|
188
|
+
|
|
225
189
|
this.isAutoResizingUpdateQueued = false;
|
|
226
190
|
this.isResizingUpdateQueued = false;
|
|
227
191
|
}
|
|
@@ -238,7 +202,7 @@ export class ColumnWidthManager {
|
|
|
238
202
|
this.getDatatableInterface(template),
|
|
239
203
|
columns
|
|
240
204
|
);
|
|
241
|
-
updateColumnWidths(
|
|
205
|
+
updateColumnWidths(columns, widthsData, adjustedWidths);
|
|
242
206
|
}
|
|
243
207
|
|
|
244
208
|
/**
|
|
@@ -294,13 +258,13 @@ export class ColumnWidthManager {
|
|
|
294
258
|
*/
|
|
295
259
|
handleRowNumberOffsetChange(state, widthsData) {
|
|
296
260
|
const colIndex = getRowNumberColumnIndex(state);
|
|
297
|
-
if (colIndex
|
|
261
|
+
if (colIndex !== -1) {
|
|
298
262
|
const { columns } = state;
|
|
299
263
|
const col = columns[colIndex];
|
|
300
264
|
const newWidth = getAdjustedRowNumberColumnWidth(state);
|
|
301
265
|
if (col.initialWidth !== newWidth) {
|
|
302
266
|
col.initialWidth = Math.max(newWidth, col.minWidth);
|
|
303
|
-
if (
|
|
267
|
+
if (widthsData.columnWidths.length > 0) {
|
|
304
268
|
// When columns are resized with the resizer, a horizontal scroller appears.
|
|
305
269
|
// Adjusting the columns size will respect widths already set and try to fit this column.
|
|
306
270
|
this.isResizingUpdateQueued = true;
|
|
@@ -357,7 +321,7 @@ export class ColumnWidthManager {
|
|
|
357
321
|
}
|
|
358
322
|
|
|
359
323
|
/**
|
|
360
|
-
*
|
|
324
|
+
* Evaluates if there is a change between two sets of data.
|
|
361
325
|
*
|
|
362
326
|
* @param {Array} previousData An array of previous data
|
|
363
327
|
* @param {Array} newData An array of new data
|
|
@@ -381,7 +345,7 @@ export class ColumnWidthManager {
|
|
|
381
345
|
* @returns {Boolean} Whether the column should resize with an update
|
|
382
346
|
*/
|
|
383
347
|
shouldResizeWithUpdate(template, widthsData) {
|
|
384
|
-
if (
|
|
348
|
+
if (widthsData.columnWidths.length > 0) {
|
|
385
349
|
// Can resize from DOM when table is visible.
|
|
386
350
|
// Otherwise, only when `ResizeObserver` is available in browser.
|
|
387
351
|
return (
|
|
@@ -391,19 +355,6 @@ export class ColumnWidthManager {
|
|
|
391
355
|
return true;
|
|
392
356
|
}
|
|
393
357
|
|
|
394
|
-
/**
|
|
395
|
-
* @private
|
|
396
|
-
* Determines the appropriate selectors to use based on the datatable render mode.
|
|
397
|
-
*
|
|
398
|
-
* @returns {Object} Selectors based on datatable render mode
|
|
399
|
-
*/
|
|
400
|
-
_getTableSelectors() {
|
|
401
|
-
if (this._renderMode === 'role-based') {
|
|
402
|
-
return tableTypes.roleBased;
|
|
403
|
-
}
|
|
404
|
-
return tableTypes.default;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
358
|
/**
|
|
408
359
|
* Retrieves the datatable interface from the DOM
|
|
409
360
|
*
|
|
@@ -411,17 +362,14 @@ export class ColumnWidthManager {
|
|
|
411
362
|
* @returns {Object} The datatable interface
|
|
412
363
|
*/
|
|
413
364
|
getDatatableInterface(template) {
|
|
414
|
-
const datatableSelectors = this._getTableSelectors();
|
|
415
365
|
return {
|
|
416
366
|
getAvailableWidthFromDom() {
|
|
417
|
-
const
|
|
418
|
-
|
|
419
|
-
);
|
|
420
|
-
return getDomWidth(container);
|
|
367
|
+
const scrollerX = getScrollerX(template);
|
|
368
|
+
return scrollerX.offsetWidth;
|
|
421
369
|
},
|
|
422
370
|
getDataCellWidths() {
|
|
423
371
|
const cellElements = template.querySelectorAll(
|
|
424
|
-
|
|
372
|
+
'[data-rowgroup-body] [role="row"]:first-child > *'
|
|
425
373
|
);
|
|
426
374
|
const { length } = cellElements;
|
|
427
375
|
const result = Array(length);
|
|
@@ -432,7 +380,7 @@ export class ColumnWidthManager {
|
|
|
432
380
|
},
|
|
433
381
|
getHeaderCellWidths() {
|
|
434
382
|
const headerElements = template.querySelectorAll(
|
|
435
|
-
|
|
383
|
+
'[role="columnheader"] lightning-primitive-header-factory'
|
|
436
384
|
);
|
|
437
385
|
const result = [];
|
|
438
386
|
for (let i = 0; i < headerElements.length; i += 1) {
|
|
@@ -444,11 +392,7 @@ export class ColumnWidthManager {
|
|
|
444
392
|
return result;
|
|
445
393
|
},
|
|
446
394
|
getTableElementWidth() {
|
|
447
|
-
|
|
448
|
-
template.querySelector(datatableSelectors.BASE) ||
|
|
449
|
-
template.querySelector('[role="grid"]') ||
|
|
450
|
-
template.querySelector('[role="treegrid"]');
|
|
451
|
-
return getDomWidth(tableElement);
|
|
395
|
+
return template.querySelector('.slds-table').offsetWidth;
|
|
452
396
|
},
|
|
453
397
|
};
|
|
454
398
|
}
|