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,39 +1,27 @@
|
|
|
1
|
-
// Default empty error state
|
|
2
|
-
const DEFAULT_ERROR_STATE = {
|
|
3
|
-
rows: {},
|
|
4
|
-
table: {},
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Retrieves the errors object from datatable's state object
|
|
9
|
-
* Returns the set of row-level errors and table-level errors
|
|
10
|
-
*/
|
|
11
|
-
export function getErrors(state) {
|
|
12
|
-
return state.errors;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
1
|
/**
|
|
16
|
-
* Sets
|
|
17
|
-
* Errors being set here overwrite the previous error object in the state
|
|
18
|
-
*
|
|
2
|
+
* Sets row-level and table-level errors in datatable state object.
|
|
3
|
+
* Errors being set here overwrite the previous error object in the state.
|
|
19
4
|
*
|
|
20
5
|
* @param {Object} state - The untracked datatable state
|
|
21
6
|
*/
|
|
22
7
|
export function setErrors(state, errors) {
|
|
23
|
-
|
|
8
|
+
state.errors = Object.assign(
|
|
9
|
+
{
|
|
10
|
+
rows: {},
|
|
11
|
+
table: {},
|
|
12
|
+
},
|
|
13
|
+
errors
|
|
14
|
+
);
|
|
24
15
|
}
|
|
25
16
|
|
|
26
17
|
/**
|
|
27
|
-
*
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const { rows } = state.errors;
|
|
31
|
-
return (rows && rows[rowKey]) || {};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves the table-level errors from the datatable's state object
|
|
18
|
+
* Resets row-level and table-level errors in datatable state object.
|
|
19
|
+
*
|
|
20
|
+
* @param {Object} _state - The untracked datatable state
|
|
36
21
|
*/
|
|
37
|
-
export function
|
|
38
|
-
|
|
22
|
+
export function resetErrors(state) {
|
|
23
|
+
state.errors = {
|
|
24
|
+
rows: {},
|
|
25
|
+
table: {},
|
|
26
|
+
};
|
|
39
27
|
}
|
|
@@ -8,27 +8,18 @@ import { getColumnWidth, getTotalWidthsData } from './widthManagerShared';
|
|
|
8
8
|
* @returns {Number} The expected width of the table
|
|
9
9
|
*/
|
|
10
10
|
function getExpectedTableWidth(availableWidth, widthsData) {
|
|
11
|
-
const minExpectedTableWidth = getMinExpectedTableWidth(widthsData);
|
|
12
|
-
return widthsData.totalFlexibleColumns === 0
|
|
13
|
-
? minExpectedTableWidth
|
|
14
|
-
: Math.max(minExpectedTableWidth, availableWidth);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Determines the minimum expected table width
|
|
19
|
-
*
|
|
20
|
-
* @param {Object} widthsMetadata The widths metadata object
|
|
21
|
-
* @returns {Number} The minimum expected table width
|
|
22
|
-
*/
|
|
23
|
-
function getMinExpectedTableWidth(widthsMetadata) {
|
|
24
11
|
const {
|
|
25
12
|
totalFixedWidth,
|
|
26
13
|
totalResizedWidth,
|
|
27
14
|
totalFlexibleColumns,
|
|
28
15
|
minColumnWidth,
|
|
29
|
-
} =
|
|
16
|
+
} = widthsData;
|
|
30
17
|
const minTotalFlexibleWidth = totalFlexibleColumns * minColumnWidth;
|
|
31
|
-
|
|
18
|
+
const minExpectedTableWidth =
|
|
19
|
+
minTotalFlexibleWidth + totalFixedWidth + totalResizedWidth;
|
|
20
|
+
return widthsData.totalFlexibleColumns === 0
|
|
21
|
+
? minExpectedTableWidth
|
|
22
|
+
: Math.max(minExpectedTableWidth, availableWidth);
|
|
32
23
|
}
|
|
33
24
|
|
|
34
25
|
/**
|
|
@@ -37,14 +28,10 @@ function getMinExpectedTableWidth(widthsMetadata) {
|
|
|
37
28
|
export class FixedWidthStrategy {
|
|
38
29
|
widthsData = {};
|
|
39
30
|
|
|
40
|
-
/************************** LIFECYCLE HOOKS **************************/
|
|
41
|
-
|
|
42
31
|
constructor(minColumnWidth, maxColumnWidth) {
|
|
43
32
|
this.widthsData = { minColumnWidth, maxColumnWidth };
|
|
44
33
|
}
|
|
45
34
|
|
|
46
|
-
/************************** PRIVATE SETTERS **************************/
|
|
47
|
-
|
|
48
35
|
/**
|
|
49
36
|
* Sets the minimum column width
|
|
50
37
|
*
|
|
@@ -82,7 +69,6 @@ export class FixedWidthStrategy {
|
|
|
82
69
|
totalWidthsData,
|
|
83
70
|
expectedTableWidth
|
|
84
71
|
);
|
|
85
|
-
|
|
86
72
|
const columnWidths = [];
|
|
87
73
|
for (let colIndex = 0; colIndex < _columns.length; colIndex += 1) {
|
|
88
74
|
const width =
|
|
@@ -90,8 +76,7 @@ export class FixedWidthStrategy {
|
|
|
90
76
|
expectedFlexibleColumnWidth;
|
|
91
77
|
columnWidths[colIndex] = width;
|
|
92
78
|
}
|
|
93
|
-
|
|
94
|
-
return { columnWidths, expectedTableWidth };
|
|
79
|
+
return { columnWidths };
|
|
95
80
|
}
|
|
96
81
|
|
|
97
82
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { unwrap } from 'lwc';
|
|
2
|
-
import { getUserColumnIndex
|
|
3
|
-
import {
|
|
2
|
+
import { getUserColumnIndex } from './columns';
|
|
3
|
+
import { getInternalActions, handleTriggeredAction } from './wrapText';
|
|
4
4
|
|
|
5
5
|
// Height of a clickable menu item
|
|
6
6
|
const ACTION_REM_HEIGHT = 2.125;
|
|
@@ -10,32 +10,17 @@ const DIVIDER_REM_HEIGHT = 1.0625;
|
|
|
10
10
|
|
|
11
11
|
/************************** PUBLIC METHODS ***************************/
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* Merges wrapText internal actions.
|
|
15
|
-
* If there are new internal actions in the future, they may be added here.
|
|
16
|
-
*
|
|
17
|
-
* @param {Object} state The state of the datatable
|
|
18
|
-
* @param {Object} columnDefinition The column definition to extract internal actions from
|
|
19
|
-
* @returns {Array} All wrapText internal actions
|
|
20
|
-
*/
|
|
21
|
-
export function getInternalActions(state, columnDefinition) {
|
|
22
|
-
return [...getActions(state, columnDefinition)];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
13
|
/**
|
|
26
14
|
* Overrides the actions with the internal ones, plus the customer ones.
|
|
27
15
|
*
|
|
28
16
|
* @param {Object} state The state of the datatable
|
|
29
17
|
*/
|
|
30
|
-
export function
|
|
31
|
-
const columns =
|
|
32
|
-
|
|
18
|
+
export function updateHeaderInternalActions(state) {
|
|
19
|
+
const { columns } = state;
|
|
20
|
+
const { length: colCount } = columns;
|
|
21
|
+
for (let colIndex = 0; colIndex < colCount; colIndex += 1) {
|
|
33
22
|
const col = columns[colIndex];
|
|
34
|
-
col.actions =
|
|
35
|
-
menuAlignment: getMenuAlignment(columns, colIndex),
|
|
36
|
-
customerActions: Array.isArray(col.actions) ? col.actions : [],
|
|
37
|
-
internalActions: getInternalActions(state, col),
|
|
38
|
-
};
|
|
23
|
+
col.actions.internalActions = getInternalActions(state, col);
|
|
39
24
|
}
|
|
40
25
|
}
|
|
41
26
|
|
|
@@ -51,7 +36,7 @@ export function handleHeaderActionTriggered(event) {
|
|
|
51
36
|
const { action, actionType, colKeyValue } = event.detail;
|
|
52
37
|
|
|
53
38
|
if (actionType !== 'customer') {
|
|
54
|
-
handleTriggeredAction(this
|
|
39
|
+
handleTriggeredAction(this, action, colKeyValue);
|
|
55
40
|
}
|
|
56
41
|
|
|
57
42
|
dispatchHeaderActionEvent(this, action, colKeyValue);
|
|
@@ -105,18 +90,3 @@ function dispatchHeaderActionEvent(dt, action, colKeyValue) {
|
|
|
105
90
|
})
|
|
106
91
|
);
|
|
107
92
|
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Determines the menu alignment based on column placement.
|
|
111
|
-
*
|
|
112
|
-
* @param {Array} columns Array of all the columns
|
|
113
|
-
* @param {Integer} index The current column index to check
|
|
114
|
-
* @returns {String} The computed alignment
|
|
115
|
-
*/
|
|
116
|
-
function getMenuAlignment(columns, index) {
|
|
117
|
-
const isLastColumn = index === columns.length - 1;
|
|
118
|
-
|
|
119
|
-
return isLastColumn || columns[index + 1].type === 'action'
|
|
120
|
-
? 'auto-right'
|
|
121
|
-
: 'auto-left';
|
|
122
|
-
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { generateColKeyValue } from './columns';
|
|
2
|
+
|
|
3
|
+
export const HEADER_ROW_INDEX = -1;
|
|
4
|
+
export const HEADER_ROW_KEY = 'HEADER';
|
|
5
|
+
|
|
6
|
+
export function getCellFromIndexes(state, rowIndex, colIndex) {
|
|
7
|
+
const { columns, rows } = state;
|
|
8
|
+
if (columns.length > 0) {
|
|
9
|
+
return {
|
|
10
|
+
rowKeyValue:
|
|
11
|
+
rowIndex === HEADER_ROW_INDEX
|
|
12
|
+
? HEADER_ROW_KEY
|
|
13
|
+
: rows[rowIndex].key,
|
|
14
|
+
colKeyValue: generateColKeyValue(columns[colIndex], colIndex),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function getRowIndexByKey(state, rowKeyValue) {
|
|
21
|
+
const row = state.indexes[rowKeyValue];
|
|
22
|
+
return row ? row.rowIndex : undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function getRowByKey(state, key) {
|
|
26
|
+
return state.rows[getRowIndexByKey(state, key)];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function getUserRowByCellKeys(state, rowKeyValue, colKeyValue) {
|
|
30
|
+
const rowIndex = state.indexes[rowKeyValue][colKeyValue][0];
|
|
31
|
+
return state.data[rowIndex];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function isValidCell(state, rowKeyValue, colKeyValue) {
|
|
35
|
+
if (rowKeyValue === HEADER_ROW_KEY) {
|
|
36
|
+
return state.headerIndexes[colKeyValue] !== undefined;
|
|
37
|
+
}
|
|
38
|
+
const row = getRowByKey(state, rowKeyValue);
|
|
39
|
+
const colIndex = state.headerIndexes[colKeyValue];
|
|
40
|
+
|
|
41
|
+
return row && row.cells[colIndex];
|
|
42
|
+
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { normalizeBoolean } from 'lightning/utilsPrivate';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getScrollOffsetFromTableEnd,
|
|
4
|
+
getScrollerY,
|
|
5
|
+
isNonNegativeInteger,
|
|
6
|
+
} from './utils';
|
|
3
7
|
|
|
4
8
|
const SCROLL_ALLOWANCE = 2;
|
|
5
9
|
export const DEFAULT_LOAD_MORE_OFFSET = 20;
|
|
@@ -7,17 +11,7 @@ export const DEFAULT_LOAD_MORE_OFFSET = 20;
|
|
|
7
11
|
/*********************** STATE MANAGEMENT ************************/
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @param {Object} state The datatable state object
|
|
13
|
-
* @returns {Boolean} The loading state
|
|
14
|
-
*/
|
|
15
|
-
export function isLoading(state) {
|
|
16
|
-
return state.isLoading;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Sets the loading state of the datatable
|
|
14
|
+
* Sets the loading state of the datatable.
|
|
21
15
|
*
|
|
22
16
|
* @param {Object} state The datatable state object
|
|
23
17
|
* @param {Boolean} value The loading state to set
|
|
@@ -27,17 +21,7 @@ export function setLoading(state, value) {
|
|
|
27
21
|
}
|
|
28
22
|
|
|
29
23
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @param {Object} state The datatable state object
|
|
33
|
-
* @returns {Boolean} The infinite loading state
|
|
34
|
-
*/
|
|
35
|
-
export function isInfiniteLoadingEnabled(state) {
|
|
36
|
-
return state.enableInfiniteLoading;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Sets the infinite loading option on the datatable
|
|
24
|
+
* Sets the infinite loading option on the datatable.
|
|
41
25
|
*
|
|
42
26
|
* @param {Object} state The datatable state object
|
|
43
27
|
* @param {Boolean} value The infinite loading state to set
|
|
@@ -79,7 +63,7 @@ export function setLoadMoreOffset(state, value) {
|
|
|
79
63
|
|
|
80
64
|
/**
|
|
81
65
|
* Checks whether the datatable should begin loading more content
|
|
82
|
-
* and then dispatches the
|
|
66
|
+
* and then dispatches the 'loadmore' event indicating that directive.
|
|
83
67
|
*
|
|
84
68
|
* @param {Event} event
|
|
85
69
|
*/
|
|
@@ -104,25 +88,22 @@ export function handleLoadMoreCheck(event) {
|
|
|
104
88
|
/**
|
|
105
89
|
* Determines whether or not to prefetch data. If so,
|
|
106
90
|
* dispatches the `loadmore` event.
|
|
107
|
-
*
|
|
108
|
-
* @param {Object} root The datatable
|
|
109
|
-
* @param {Object} state The datatable state object
|
|
110
91
|
*/
|
|
111
|
-
export function handlePrefetch(
|
|
92
|
+
export function handlePrefetch() {
|
|
93
|
+
const { state, template } = this;
|
|
112
94
|
if (
|
|
113
95
|
state.isLoading ||
|
|
114
96
|
!state.enableInfiniteLoading ||
|
|
115
97
|
(this.viewportRendering &&
|
|
116
98
|
this._renderManager &&
|
|
117
99
|
!this._renderManager.hasWrapperHeight()) ||
|
|
118
|
-
!hasData(
|
|
100
|
+
!hasData(template)
|
|
119
101
|
) {
|
|
120
|
-
// Don't prefetch if already loading or data is not set yet
|
|
102
|
+
// Don't prefetch if already loading or data is not set yet.
|
|
121
103
|
return;
|
|
122
104
|
}
|
|
123
105
|
|
|
124
|
-
const scrollerY =
|
|
125
|
-
|
|
106
|
+
const scrollerY = getScrollerY(template);
|
|
126
107
|
if (scrollerY && isScrollerVisible(scrollerY) && !isScrollable(scrollerY)) {
|
|
127
108
|
this.dispatchEvent(new CustomEvent('loadmore'));
|
|
128
109
|
}
|
|
@@ -134,7 +115,7 @@ export function handlePrefetch(root, state) {
|
|
|
134
115
|
* Determines if a scroller element is scrollable.
|
|
135
116
|
*
|
|
136
117
|
* @param {Element} scroller The scroller element to check
|
|
137
|
-
* @returns {Boolean} Whether
|
|
118
|
+
* @returns {Boolean} Whether the element is scrollable
|
|
138
119
|
*/
|
|
139
120
|
function isScrollable(scroller) {
|
|
140
121
|
// scrollHeight should be greater than clientHeight by some allowance
|
|
@@ -144,8 +125,8 @@ function isScrollable(scroller) {
|
|
|
144
125
|
/**
|
|
145
126
|
* Determines if a scroller element's scroll bars are visible.
|
|
146
127
|
*
|
|
147
|
-
* @param {Element} scroller The
|
|
148
|
-
* @returns {Boolean} Whether
|
|
128
|
+
* @param {Element} scroller The scroller element to check
|
|
129
|
+
* @returns {Boolean} Whether the scroller element's scroll bars are visible
|
|
149
130
|
*/
|
|
150
131
|
function isScrollerVisible(scroller) {
|
|
151
132
|
return !!(
|