lightning-base-components 1.21.2-alpha → 1.21.4-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 +77 -1
- package/package.json +108 -15
- 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.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/scopedImports/@salesforce-label-LightningRichTextEditor.colorPicker.js +1 -0
- package/src/lightning/accordion/accordion-section.slds.css +3 -3
- package/src/lightning/accordion/accordion.slds.css +1 -2
- package/src/lightning/accordionSection/accordion-section.slds.css +3 -3
- package/src/lightning/accordionSection/accordionSection.js +3 -1
- package/src/lightning/accordionSection/button.slds.css +1 -1
- package/src/lightning/avatar/avatar.html +1 -0
- package/src/lightning/badge/badge.html +3 -3
- package/src/lightning/badge/badge.js +1 -0
- package/src/lightning/badge/badge.js-meta.xml +3 -0
- package/src/lightning/baseCombobox/base-combobox.slds.css +11 -6
- package/src/lightning/baseCombobox/baseCombobox.html +5 -2
- package/src/lightning/baseCombobox/baseCombobox.js +5 -18
- package/src/lightning/baseCombobox/baseCombobox.js-meta.xml +6 -0
- package/src/lightning/baseCombobox/input-text.slds.css +41 -68
- package/src/lightning/baseCombobox/keyboard.js +12 -4
- package/src/lightning/baseCombobox/listbox.slds.css +51 -99
- package/src/lightning/baseCombobox/spinner.slds.css +62 -62
- package/src/lightning/baseComboboxFormattedText/baseComboboxFormattedText.js-meta.xml +6 -0
- package/src/lightning/baseComboboxItem/baseComboboxItem.js +10 -6
- package/src/lightning/baseComboboxItem/baseComboboxItem.js-meta.xml +6 -0
- package/src/lightning/baseComboboxItem/listbox.slds.css +51 -99
- package/src/lightning/baseFormattedText/baseFormattedText.js +2 -2
- package/src/lightning/button/__docs__/button.md +2 -1
- package/src/lightning/button/button.js +5 -5
- package/src/lightning/button/button.slds.css +1 -1
- package/src/lightning/buttonIcon/__docs__/buttonIcon.md +1 -0
- package/src/lightning/buttonIcon/button-icon.slds.css +1 -1
- package/src/lightning/buttonIcon/buttonIcon.html +1 -1
- package/src/lightning/buttonIcon/buttonIcon.js +18 -17
- package/src/lightning/buttonIconStateful/button-icon-stateful.slds.css +4 -2
- package/src/lightning/buttonIconStateful/button-icon.slds.css +1 -1
- package/src/lightning/buttonIconStateful/button.slds.css +1 -1
- package/src/lightning/buttonMenu/button-icon.slds.css +1 -1
- package/src/lightning/buttonMenu/button-menu.slds.css +8 -2
- package/src/lightning/buttonMenu/button.slds.css +1 -1
- package/src/lightning/buttonMenu/buttonMenu.css +5 -0
- package/src/lightning/buttonMenu/buttonMenu.js +2 -0
- package/src/lightning/buttonStateful/button-stateful.slds.css +6 -2
- package/src/lightning/buttonStateful/button.slds.css +1 -1
- package/src/lightning/buttonStateful/buttonStateful.js +4 -1
- package/src/lightning/calendar/calendar.js-meta.xml +6 -0
- package/src/lightning/calendar/calendar.slds.css +9 -2
- package/src/lightning/colorPickerCustom/color-picker-custom.slds.css +22 -23
- package/src/lightning/colorPickerCustom/colorPickerCustom.js +12 -0
- package/src/lightning/colorPickerCustom/input-text.slds.css +41 -68
- package/src/lightning/colorPickerPanel/color-picker-panel.slds.css +9 -10
- package/src/lightning/colorPickerPanel/colorPickerPanel.js +11 -1
- package/src/lightning/colorPickerPanel/popover.slds.css +0 -2
- package/src/lightning/combobox/combobox.html +1 -0
- package/src/lightning/combobox/combobox.slds.css +1 -2
- package/src/lightning/combobox/form-element.slds.css +54 -54
- 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/customDatatableWrapper/customDatatableWrapper.js +89 -0
- package/src/lightning/datatable/__examples__disabled/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.html +6 -0
- package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.js +1 -16
- package/src/lightning/datatable/__examples__disabled/customDatatypeLink/customDatatypeLink.html +9 -0
- package/src/lightning/datatable/__examples__disabled/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.html +3 -0
- package/src/lightning/datatable/__examples__disabled/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.js +3 -0
- package/src/lightning/datatable/__examples__disabled/customDatatypeTable/customNumber.html +3 -0
- package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customNumberEdit.html +2 -0
- package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/deleteRow.html +3 -2
- package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/iconPill.html +1 -1
- package/src/lightning/datatable/{__examples__/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.html → __examples__disabled/customNestedComponent/customNestedComponent.html} +2 -2
- package/src/lightning/datatable/__examples__disabled/customNestedComponent/customNestedComponent.js +12 -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 +145 -217
- package/src/lightning/datatable/columnResizer.js +80 -190
- package/src/lightning/datatable/columnWidthManager.js +128 -243
- package/src/lightning/datatable/columns.js +192 -283
- package/src/lightning/datatable/datagrid.slds.css +187 -0
- package/src/lightning/datatable/datatable.js +647 -614
- package/src/lightning/datatable/errors.js +19 -28
- package/src/lightning/datatable/fixedWidthStrategy.js +27 -49
- package/src/lightning/datatable/headerActions.js +10 -42
- package/src/lightning/datatable/indexes.js +42 -0
- package/src/lightning/datatable/infiniteLoading.js +27 -46
- package/src/lightning/datatable/inlineEdit.js +311 -322
- package/src/lightning/datatable/keyboard.js +490 -510
- package/src/lightning/datatable/renderManager.js +10 -11
- package/src/lightning/datatable/resizeObserver.js +10 -67
- package/src/lightning/datatable/rowLevelActions.js +7 -6
- package/src/lightning/datatable/rowNumber.js +41 -79
- package/src/lightning/datatable/rowSelection.js +236 -291
- package/src/lightning/datatable/rowSelectionShared.js +26 -33
- package/src/lightning/datatable/rows.js +264 -476
- package/src/lightning/datatable/sort.js +27 -82
- package/src/lightning/datatable/templates/div/div.css +2 -57
- package/src/lightning/datatable/templates/div/div.html +25 -10
- package/src/lightning/datatable/templates/div/div.lbc.native.css +3 -0
- package/src/lightning/datatable/templates/div/div.lbc.synthetic.css +80 -0
- package/src/lightning/datatable/templates/table/table.html +16 -5
- package/src/lightning/datatable/tree.js +17 -35
- package/src/lightning/datatable/types.js +10 -31
- package/src/lightning/datatable/utils.js +54 -29
- package/src/lightning/datatable/virtualization.js +2 -5
- package/src/lightning/datatable/widthManagerShared.js +24 -41
- package/src/lightning/datatable/wrapText.js +45 -77
- package/src/lightning/datepicker/datepicker.js +32 -9
- package/src/lightning/datepicker/datepicker.js-meta.xml +6 -0
- package/src/lightning/datepicker/form-element.slds.css +54 -54
- package/src/lightning/datepicker/input-text.slds.css +41 -68
- package/src/lightning/datetimepicker/datetimepicker.js-meta.xml +6 -0
- package/src/lightning/datetimepicker/form-element.slds.css +54 -54
- package/src/lightning/datetimepicker/input-text.slds.css +41 -68
- package/src/lightning/dualListbox/dual-listbox.slds.css +7 -2
- package/src/lightning/dualListbox/dualListbox.js +7 -8
- package/src/lightning/dualListbox/form-element.slds.css +54 -54
- package/src/lightning/dualListbox/listbox.slds.css +51 -99
- package/src/lightning/dynamicIcon/dynamic-icon-strength.slds.css +1 -2
- package/src/lightning/dynamicIcon/dynamic-icon-trend.slds.css +1 -2
- package/src/lightning/formattedDateTime/formattedDateTime.js +7 -62
- package/src/lightning/formattedDateTime/formattedDateTime.js-meta.xml +3 -0
- package/src/lightning/formattedLocation/formattedLocation.html +1 -3
- package/src/lightning/formattedLocation/formattedLocation.js +3 -25
- package/src/lightning/formattedLookup/events.js +2 -4
- package/src/lightning/formattedName/formattedName.js +3 -2
- package/src/lightning/formattedName/formattedName.js-meta.xml +3 -0
- package/src/lightning/formattedNumber/formattedNumber.js +5 -51
- package/src/lightning/formattedNumber/formattedNumber.js-meta.xml +3 -0
- package/src/lightning/formattedRichText/formattedRichText.js +5 -5
- package/src/lightning/formattedRichText/linkTextNodes.js +58 -0
- package/src/lightning/formattedRichText/richTextConfig.js +1 -0
- package/src/lightning/groupedCombobox/form-element.slds.css +54 -54
- package/src/lightning/groupedCombobox/grouped-combobox.slds.css +0 -2
- package/src/lightning/groupedCombobox/groupedCombobox.js-meta.xml +1 -1
- package/src/lightning/groupedCombobox/input-text.slds.css +41 -68
- package/src/lightning/helptext/button-icon.slds.css +1 -1
- package/src/lightning/helptext/form-element.slds.css +54 -54
- package/src/lightning/helptext/helptext.css +7 -0
- package/src/lightning/helptext/helptext.js +3 -4
- package/src/lightning/icon/icon.html +1 -1
- package/src/lightning/icon/icon.slds.css +12 -25
- package/src/lightning/input/form-element.slds.css +54 -54
- 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/form-element.slds.css +54 -54
- package/src/lightning/inputAddress/input-address.slds.css +1 -2
- package/src/lightning/inputAddress/input-text.slds.css +41 -68
- package/src/lightning/inputAddress/inputAddress.html +19 -1
- package/src/lightning/inputAddress/inputAddress.js +75 -3
- package/src/lightning/inputAddress/inputAddress.js-meta.xml +3 -0
- package/src/lightning/inputLocation/form-element.slds.css +54 -54
- package/src/lightning/inputLocation/input-location.slds.css +1 -2
- package/src/lightning/inputLocation/input-text.slds.css +41 -68
- package/src/lightning/inputName/form-element.slds.css +54 -54
- package/src/lightning/inputName/input-text.slds.css +41 -68
- package/src/lightning/interactiveDialogBase/interactive-dialog-base.slds.css +0 -3
- package/src/lightning/interactiveDialogBase/interactiveDialogBase.js-meta.xml +6 -0
- package/src/lightning/internationalizationLibrary/address/AddressFormat.js +553 -610
- package/src/lightning/lookupAddress/form-element.slds.css +54 -54
- package/src/lightning/lookupAddress/listbox.slds.css +51 -99
- package/src/lightning/lookupAddress/location.js +2 -0
- package/src/lightning/lookupAddress/lookup-address.slds.css +0 -2
- package/src/lightning/lookupAddress/lookupAddress.html +6 -1
- package/src/lightning/lookupAddress/lookupAddress.js +40 -10
- package/src/lightning/menuDivider/menu-divider.slds.css +0 -2
- package/src/lightning/menuItem/menu-item.slds.css +8 -2
- package/src/lightning/menuSubheader/menu-subheader.slds.css +1 -2
- 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/modal-base.slds.css +3 -3
- package/src/lightning/modalBase/modalBase.html +15 -10
- package/src/lightning/modalBase/modalBase.js +131 -154
- package/src/lightning/modalBase/modalBase.js-meta.xml +6 -0
- package/src/lightning/modalBody/modal-body.slds.css +1 -2
- package/src/lightning/modalBody/modalBody.css +6 -0
- package/src/lightning/modalFooter/modal-footer.slds.css +2 -2
- package/src/lightning/modalFooter/modalFooter.js +0 -21
- package/src/lightning/modalHeader/modal-header.slds.css +1 -2
- package/src/lightning/modalHeader/modalHeader.html +16 -4
- package/src/lightning/modalHeader/modalHeader.js +61 -36
- package/src/lightning/overlay/overlay.js-meta.xml +6 -0
- package/src/lightning/pill/link.html +1 -0
- package/src/lightning/pill/pill.slds.css +32 -58
- package/src/lightning/pill/plain.html +1 -0
- package/src/lightning/pill/plainLink.html +1 -0
- package/src/lightning/pillContainer/button.slds.css +1 -1
- package/src/lightning/pillContainer/listbox.slds.css +51 -99
- package/src/lightning/pillContainer/pill-container.slds.css +6 -10
- package/src/lightning/pillContainer/pill.slds.css +32 -58
- package/src/lightning/popup/popover.slds.css +0 -2
- package/src/lightning/primitiveBubble/primitiveBubble.js +42 -0
- package/src/lightning/primitiveBubble/primitiveBubble.js-meta.xml +6 -0
- package/src/lightning/primitiveButton/primitiveButoon.js-meta.xml +6 -0
- package/src/lightning/primitiveCellCheckbox/checkbox.css +2 -0
- package/src/lightning/primitiveColorpickerButton/color-picker-button.slds.css +16 -38
- package/src/lightning/primitiveCustomCell/primitiveCustomCell.js +26 -1
- 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.css +1 -0
- package/src/lightning/primitiveHeaderFactory/nonsortableHeader.html +19 -6
- package/src/lightning/primitiveHeaderFactory/selectableHeader.css +2 -0
- package/src/lightning/primitiveHeaderFactory/sortableHeader.html +3 -1
- package/src/lightning/primitiveIcon/icon.slds.css +12 -25
- package/src/lightning/primitiveIcon/primitiveIcon.js-meta.xml +6 -0
- package/src/lightning/primitiveIframe/primitiveIframe.js +3 -1
- package/src/lightning/primitiveInputCheckbox/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.js +5 -2
- package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.js-meta.xml +6 -0
- package/src/lightning/primitiveInputCheckboxButton/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputCheckboxButton/input-checkbox-button.slds.css +6 -4
- package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.js +5 -2
- package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.js-meta.xml +6 -0
- package/src/lightning/primitiveInputColor/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputColor/input-color.slds.css +2 -3
- package/src/lightning/primitiveInputColor/input-text.slds.css +41 -68
- package/src/lightning/primitiveInputColor/primitiveInputColor.js +5 -2
- package/src/lightning/primitiveInputColor/primitiveInputColor.js-meta.xml +6 -0
- package/src/lightning/primitiveInputFile/button.slds.css +1 -1
- package/src/lightning/primitiveInputFile/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputFile/input-file.slds.css +1 -4
- package/src/lightning/primitiveInputFile/primitiveInputFile.js +4 -2
- package/src/lightning/primitiveInputFile/primitiveInputFile.js-meta.xml +6 -0
- package/src/lightning/primitiveInputRadio/primitiveInputRadio.js +4 -2
- package/src/lightning/primitiveInputSimple/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputSimple/input-text.slds.css +41 -68
- package/src/lightning/primitiveInputSimple/primitiveInputSimple.js-meta.xml +6 -0
- package/src/lightning/primitiveInputToggle/form-element.slds.css +54 -54
- package/src/lightning/primitiveInputToggle/input-toggle.slds.css +50 -27
- package/src/lightning/primitiveInputToggle/primitiveInputToggle.js +5 -2
- package/src/lightning/primitiveInputToggle/primitiveInputToggle.js-meta.xml +6 -0
- 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/progressBar/progress-bar.slds.css +8 -10
- package/src/lightning/progressRing/progress-ring.slds.css +0 -23
- package/src/lightning/progressStep/base.html +5 -6
- package/src/lightning/progressStep/progressStep.js +15 -23
- package/src/lightning/prompt/__docs__/prompt.md +1 -1
- package/src/lightning/radioGroup/form-element.slds.css +54 -54
- package/src/lightning/radioGroup/radioGroup.html +1 -2
- package/src/lightning/radioGroup/radioGroup.js +1 -0
- package/src/lightning/routingService/routingService.js +31 -5
- package/src/lightning/select/form-element.slds.css +54 -54
- package/src/lightning/select/select.slds.css +4 -2
- 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 +5 -1
- package/src/lightning/spinner/spinner.slds.css +62 -62
- package/src/lightning/staticMap/staticMap.js +3 -2
- package/src/lightning/tab/tab.js +10 -5
- package/src/lightning/tab/tab.js-meta.xml +3 -0
- package/src/lightning/tab/tab.slds.css +14 -7
- package/src/lightning/tabBar/tab-bar.slds.css +16 -6
- package/src/lightning/tabBar/tabBar.js +10 -5
- package/src/lightning/tabset/__docs__/tabset.md +24 -1
- package/src/lightning/tabset/tabset.html +2 -0
- package/src/lightning/tabset/tabset.js +25 -38
- package/src/lightning/tabset/tabset.js-meta.xml +3 -0
- package/src/lightning/tabset/tabset.slds.css +0 -2
- package/src/lightning/textarea/form-element.slds.css +54 -54
- package/src/lightning/textarea/textarea.js +11 -2
- package/src/lightning/textarea/textarea.slds.css +22 -9
- package/src/lightning/timepicker/form-element.slds.css +54 -54
- package/src/lightning/timepicker/timepicker.js-meta.xml +6 -0
- package/src/lightning/timepicker/timepicker.slds.css +2 -2
- package/src/lightning/toast/__docs__/toast.md +20 -22
- package/src/lightning/toast/button-icon.slds.css +1 -1
- package/src/lightning/toast/icon.slds.css +12 -25
- package/src/lightning/toast/toast.js +15 -12
- package/src/lightning/toast/toast.slds.css +6 -18
- package/src/lightning/toastContainer/__docs__/toastContainer.md +3 -2
- package/src/lightning/toastContainer/toast.slds.css +6 -18
- package/src/lightning/toastContainer/toastContainer.js +25 -17
- package/src/lightning/tooltipLibrary/tooltipLibrary.js +36 -24
- package/src/lightning/tree/tree.js +2 -0
- package/src/lightning/utils/classSet.js +9 -3
- package/src/lightning/utilsPrivate/formatUtils.js +158 -0
- package/src/lightning/utilsPrivate/textUtils.js +16 -0
- package/src/lightning/utilsPrivate/utilsPrivate.js +56 -15
- package/src/lightning/utilsPrivate/validationUtils.js +59 -0
- 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/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/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/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 +13 -15
- package/src/lightning/verticalNavigationSection/verticalNavigationSection.js-meta.xml +3 -0
- package/src/lightning/datatable/__examples__/customDatatableWrapper/customDatatableWrapper.js +0 -158
- package/src/lightning/datatable/__examples__/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.html +0 -6
- package/src/lightning/datatable/__examples__/customDatatypeLink/customDatatypeLink.html +0 -9
- package/src/lightning/datatable/__examples__/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.js +0 -40
- package/src/lightning/datatable/__examples__/customDatatypeTable/customNumber.html +0 -3
- package/src/lightning/datatable/inlineEditShared.js +0 -26
- package/src/lightning/datatable/resizeSensor.js +0 -244
- package/src/lightning/formattedRichText/linkify.js +0 -43
- package/src/lightning/utilsPrivate/smartSetAttribute.js +0 -19
- /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatableWrapper/customDatatableWrapper.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}/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/orderingButtons.html +0 -0
|
@@ -1,62 +1,38 @@
|
|
|
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 { getScrollerXFromScrollerY, getScrollerY } from './utils';
|
|
9
5
|
import {
|
|
10
6
|
getRowNumberColumnIndex,
|
|
11
7
|
getAdjustedRowNumberColumnWidth,
|
|
12
8
|
} from './rowNumber';
|
|
13
|
-
import {
|
|
14
|
-
getColumnWidthFromDef,
|
|
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
|
*
|
|
18
|
+
* @param {Array} columns The column definitions
|
|
19
|
+
* @param {Object} widthsData The widths data to update
|
|
41
20
|
* @param {Object} adjustedWidths The adjusted widths object
|
|
42
|
-
* @param {Array} columnDefs The column definitions array
|
|
43
|
-
* @param {Object} widthsData The source widths data to update
|
|
44
21
|
*/
|
|
45
|
-
export function
|
|
22
|
+
export function updateColumnWidths(columns, widthsData, adjustedWidths) {
|
|
46
23
|
const { columnWidths } = adjustedWidths;
|
|
47
|
-
const { length:
|
|
48
|
-
if (columnWidths.length !==
|
|
24
|
+
const { length: colCount } = columns;
|
|
25
|
+
if (columnWidths.length !== colCount) {
|
|
49
26
|
return;
|
|
50
27
|
}
|
|
51
28
|
let columnWidthsSum = 0;
|
|
52
29
|
const rtl = isRTL();
|
|
53
|
-
for (let
|
|
54
|
-
const col =
|
|
55
|
-
const newWidth = columnWidths[
|
|
56
|
-
widthsData.columnWidths[
|
|
30
|
+
for (let colIndex = 0; colIndex < colCount; colIndex += 1) {
|
|
31
|
+
const col = columns[colIndex];
|
|
32
|
+
const newWidth = columnWidths[colIndex];
|
|
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,27 +52,24 @@ export function computeColumnWidths(adjustedWidths, columnDefs, widthsData) {
|
|
|
76
52
|
* on `column-widths-mode`: "auto" or "fixed"
|
|
77
53
|
*/
|
|
78
54
|
export class ColumnWidthManager {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
_resizeObserverAvailable = typeof ResizeObserver === 'function';
|
|
55
|
+
columnWidthMode = FIXED_WIDTH_MODE;
|
|
56
|
+
resizeObserverAvailable = typeof ResizeObserver === 'function';
|
|
82
57
|
|
|
83
58
|
// Flag to indicate resetting column widths is needed.
|
|
84
59
|
// Could be with or without `autoResizingUpdate`.
|
|
85
|
-
|
|
60
|
+
isResizingUpdateQueued = false;
|
|
86
61
|
|
|
87
62
|
// Flag to indicate whether auto resizing computation update is needed,
|
|
88
63
|
// in which case table styles need to auto flow.
|
|
89
|
-
|
|
64
|
+
isAutoResizingUpdateQueued = false;
|
|
90
65
|
|
|
91
66
|
/************************** LIFECYCLE HOOKS **************************/
|
|
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
|
|
@@ -105,9 +78,10 @@ export class ColumnWidthManager {
|
|
|
105
78
|
minColumnWidth,
|
|
106
79
|
maxColumnWidth
|
|
107
80
|
);
|
|
108
|
-
this.
|
|
109
|
-
|
|
110
|
-
|
|
81
|
+
this.widthStrategies = {
|
|
82
|
+
[FIXED_WIDTH_MODE]: fixedWidthStrategy,
|
|
83
|
+
[AUTO_WIDTH_MODE]: autoWidthStrategy,
|
|
84
|
+
};
|
|
111
85
|
}
|
|
112
86
|
|
|
113
87
|
/************************** PRIVATE GETTERS **************************/
|
|
@@ -118,40 +92,22 @@ export class ColumnWidthManager {
|
|
|
118
92
|
* @returns {Object} The column width strategy
|
|
119
93
|
*/
|
|
120
94
|
get columnWidthStrategy() {
|
|
121
|
-
return this.
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Gets the configured column width mode.
|
|
126
|
-
*
|
|
127
|
-
* @returns {String} The column width mode
|
|
128
|
-
*/
|
|
129
|
-
get columnWidthMode() {
|
|
130
|
-
return this._columnWidthMode;
|
|
95
|
+
return this.widthStrategies[this.columnWidthMode];
|
|
131
96
|
}
|
|
132
97
|
|
|
133
98
|
/************************** PRIVATE SETTERS **************************/
|
|
134
99
|
|
|
135
|
-
/**
|
|
136
|
-
* Sets the column width mode.
|
|
137
|
-
*
|
|
138
|
-
* @param {String} value The new column width mode
|
|
139
|
-
*/
|
|
140
|
-
set columnWidthMode(value) {
|
|
141
|
-
this._columnWidthMode = value;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
100
|
/**
|
|
145
101
|
* Sets the minimum column width (in pixels).
|
|
146
102
|
*
|
|
147
103
|
* @param {Number} value The minimum column width
|
|
148
104
|
*/
|
|
149
105
|
set minColumnWidth(value) {
|
|
150
|
-
const {
|
|
151
|
-
const keys = Object.keys(
|
|
106
|
+
const { widthStrategies } = this;
|
|
107
|
+
const keys = Object.keys(widthStrategies);
|
|
152
108
|
for (let i = 0, { length } = keys; i < length; i += 1) {
|
|
153
109
|
const strategy = keys[i];
|
|
154
|
-
|
|
110
|
+
widthStrategies[strategy].minColumnWidth = value;
|
|
155
111
|
}
|
|
156
112
|
}
|
|
157
113
|
|
|
@@ -161,11 +117,11 @@ export class ColumnWidthManager {
|
|
|
161
117
|
* @param {Number} value The maximum column width
|
|
162
118
|
*/
|
|
163
119
|
set maxColumnWidth(value) {
|
|
164
|
-
const {
|
|
165
|
-
const keys = Object.keys(
|
|
120
|
+
const { widthStrategies } = this;
|
|
121
|
+
const keys = Object.keys(widthStrategies);
|
|
166
122
|
for (let i = 0, { length } = keys; i < length; i += 1) {
|
|
167
123
|
const strategy = keys[i];
|
|
168
|
-
|
|
124
|
+
widthStrategies[strategy].maxColumnWidth = value;
|
|
169
125
|
}
|
|
170
126
|
}
|
|
171
127
|
|
|
@@ -175,38 +131,11 @@ export class ColumnWidthManager {
|
|
|
175
131
|
* @param {Number} value The maximum number of lines text can be wrapped on
|
|
176
132
|
*/
|
|
177
133
|
set wrapTextMaxLines(value) {
|
|
178
|
-
this.
|
|
134
|
+
this.widthStrategies[AUTO_WIDTH_MODE].wrapTextMaxLines = value;
|
|
179
135
|
}
|
|
180
136
|
|
|
181
137
|
/************************* HELPER FUNCTIONS **************************/
|
|
182
138
|
|
|
183
|
-
/**
|
|
184
|
-
* Sets the datatable's configured render mode.
|
|
185
|
-
*
|
|
186
|
-
* @param {String} mode Either "table" or "role-based"
|
|
187
|
-
*/
|
|
188
|
-
setRenderMode(mode) {
|
|
189
|
-
this._renderMode = mode;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Returns whether a resizing update is queued.
|
|
194
|
-
*
|
|
195
|
-
* @returns {Boolean} Whether there is a resizing update queued
|
|
196
|
-
*/
|
|
197
|
-
isResizingUpdateQueued() {
|
|
198
|
-
return this._queueResizingUpdate;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Returns whether an auto-resizing update is queued.
|
|
203
|
-
*
|
|
204
|
-
* @returns {Boolean} Whether there is an auto-resizing update queued
|
|
205
|
-
*/
|
|
206
|
-
isAutoResizingUpdateQueued() {
|
|
207
|
-
return this._queueAutoResizingUpdate;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
139
|
/**
|
|
211
140
|
* Determines if we should fire the resize event based on the previous
|
|
212
141
|
* widths data and the column definition. The event is only fired when
|
|
@@ -214,71 +143,66 @@ export class ColumnWidthManager {
|
|
|
214
143
|
* nothing happens.
|
|
215
144
|
*
|
|
216
145
|
* @param {Object} previousWidthsData The previous widths data to evaluate
|
|
217
|
-
* @param {Array}
|
|
146
|
+
* @param {Array} columns The column definitions
|
|
218
147
|
* @returns {Boolean} Whether or not the resize event should be fired
|
|
219
148
|
*/
|
|
220
|
-
shouldFireResizeEvent(previousWidthsData,
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
return false;
|
|
149
|
+
shouldFireResizeEvent(previousWidthsData, columns) {
|
|
150
|
+
return (
|
|
151
|
+
this.columnWidthMode === FIXED_WIDTH_MODE &&
|
|
152
|
+
previousWidthsData.columnWidths.length !== columns.length
|
|
153
|
+
);
|
|
228
154
|
}
|
|
229
155
|
|
|
230
156
|
/**
|
|
231
157
|
* Adjusts all the column sizes based on the supplied widths data.
|
|
232
158
|
*
|
|
233
|
-
* @param {Node}
|
|
234
|
-
* @param {Array}
|
|
159
|
+
* @param {Node} template The datatable template
|
|
160
|
+
* @param {Array} columns The column definitions
|
|
235
161
|
* @param {Object} widthsData The widths data object
|
|
236
162
|
*/
|
|
237
|
-
adjustColumnsSize(
|
|
163
|
+
adjustColumnsSize(template, columns, widthsData) {
|
|
238
164
|
const {
|
|
239
|
-
_queueResizingUpdate,
|
|
240
|
-
_queueAutoResizingUpdate,
|
|
241
165
|
columnWidthStrategy,
|
|
166
|
+
isAutoResizingUpdateQueued,
|
|
167
|
+
isResizingUpdateQueued,
|
|
242
168
|
} = this;
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
if (_queueResizingUpdate) {
|
|
169
|
+
if (isResizingUpdateQueued) {
|
|
170
|
+
let adjustedWidths;
|
|
246
171
|
// If table is hidden when updating and `ResizeObserver` is not available,
|
|
247
172
|
// then updating sizes causes min widths to be set.
|
|
248
173
|
// Hence, the check if ok update from DOM.
|
|
249
|
-
if (this.
|
|
174
|
+
if (this.shouldResizeWithUpdate(template, widthsData)) {
|
|
250
175
|
adjustedWidths = columnWidthStrategy.getAdjustedColumnWidths(
|
|
251
|
-
this.
|
|
252
|
-
|
|
253
|
-
|
|
176
|
+
this.getDatatableInterface(template),
|
|
177
|
+
columns,
|
|
178
|
+
isAutoResizingUpdateQueued
|
|
254
179
|
);
|
|
255
180
|
} else {
|
|
256
181
|
// Otherwise update from previous widths
|
|
257
182
|
adjustedWidths = {
|
|
258
183
|
columnWidths: widthsData.columnWidths,
|
|
259
|
-
expectedTableWidth: widthsData.tableWidth,
|
|
260
184
|
};
|
|
261
185
|
}
|
|
262
|
-
|
|
186
|
+
updateColumnWidths(columns, widthsData, adjustedWidths);
|
|
263
187
|
}
|
|
264
188
|
|
|
265
|
-
this.
|
|
266
|
-
this.
|
|
189
|
+
this.isAutoResizingUpdateQueued = false;
|
|
190
|
+
this.isResizingUpdateQueued = false;
|
|
267
191
|
}
|
|
268
192
|
|
|
269
193
|
/**
|
|
270
194
|
* Adjusts all the column widths after a resize happens.
|
|
271
195
|
*
|
|
272
|
-
* @param {Node}
|
|
273
|
-
* @param {Array}
|
|
196
|
+
* @param {Node} template The datatable template
|
|
197
|
+
* @param {Array} columns The column definitions
|
|
274
198
|
* @param {Object} widthsData The widths data object
|
|
275
199
|
*/
|
|
276
|
-
adjustColumnsSizeAfterResize(
|
|
200
|
+
adjustColumnsSizeAfterResize(template, columns, widthsData) {
|
|
277
201
|
const adjustedWidths = this.columnWidthStrategy.getAdjustedColumnWidths(
|
|
278
|
-
this.
|
|
279
|
-
|
|
202
|
+
this.getDatatableInterface(template),
|
|
203
|
+
columns
|
|
280
204
|
);
|
|
281
|
-
|
|
205
|
+
updateColumnWidths(columns, widthsData, adjustedWidths);
|
|
282
206
|
}
|
|
283
207
|
|
|
284
208
|
/**
|
|
@@ -286,17 +210,17 @@ export class ColumnWidthManager {
|
|
|
286
210
|
*
|
|
287
211
|
* @param {Object} previousData The previous data
|
|
288
212
|
* @param {Object} newData The new data
|
|
289
|
-
* @param {Array}
|
|
213
|
+
* @param {Array} columns The column definitions
|
|
290
214
|
*/
|
|
291
|
-
handleDataChange(previousData, newData,
|
|
292
|
-
if (
|
|
215
|
+
handleDataChange(previousData, newData, columns) {
|
|
216
|
+
if (columns.length > 0) {
|
|
293
217
|
// Resize columns with auto-resizing update only if...
|
|
294
218
|
// The mode is auto and new data length is equal to previous data
|
|
295
219
|
// length (change in data) or previously there was no data at all.
|
|
296
220
|
if (this.columnWidthMode === AUTO_WIDTH_MODE) {
|
|
297
|
-
if (this.
|
|
298
|
-
this.
|
|
299
|
-
this.
|
|
221
|
+
if (this.hasDataChanged(previousData, newData)) {
|
|
222
|
+
this.isResizingUpdateQueued = true;
|
|
223
|
+
this.setAutoResizingUpdate(columns);
|
|
300
224
|
}
|
|
301
225
|
}
|
|
302
226
|
}
|
|
@@ -305,24 +229,24 @@ export class ColumnWidthManager {
|
|
|
305
229
|
/**
|
|
306
230
|
* React to change in column definitions
|
|
307
231
|
*
|
|
308
|
-
* @param {Array}
|
|
232
|
+
* @param {Array} columns The column definitions
|
|
309
233
|
*/
|
|
310
|
-
handleColumnsChange(
|
|
311
|
-
if (
|
|
312
|
-
this.
|
|
313
|
-
this.
|
|
234
|
+
handleColumnsChange(columns) {
|
|
235
|
+
if (columns.length > 0) {
|
|
236
|
+
this.isResizingUpdateQueued = true;
|
|
237
|
+
this.setAutoResizingUpdate(columns);
|
|
314
238
|
}
|
|
315
239
|
}
|
|
316
240
|
|
|
317
241
|
/**
|
|
318
242
|
* React to change in column widths mode
|
|
319
243
|
*
|
|
320
|
-
* @param {Array}
|
|
244
|
+
* @param {Array} columns The column definitions
|
|
321
245
|
*/
|
|
322
|
-
handleWidthModeChange(
|
|
323
|
-
if (
|
|
324
|
-
this.
|
|
325
|
-
this.
|
|
246
|
+
handleWidthModeChange(columns) {
|
|
247
|
+
if (columns.length > 0) {
|
|
248
|
+
this.isResizingUpdateQueued = true;
|
|
249
|
+
this.setAutoResizingUpdate(columns);
|
|
326
250
|
}
|
|
327
251
|
}
|
|
328
252
|
|
|
@@ -330,23 +254,21 @@ export class ColumnWidthManager {
|
|
|
330
254
|
* React to change in row number offset
|
|
331
255
|
*
|
|
332
256
|
* @param {Object} state The datatable state
|
|
333
|
-
* @param {Object} widthsData The
|
|
257
|
+
* @param {Object} widthsData The widths data
|
|
334
258
|
*/
|
|
335
259
|
handleRowNumberOffsetChange(state, widthsData) {
|
|
336
260
|
const colIndex = getRowNumberColumnIndex(state);
|
|
337
|
-
if (colIndex
|
|
338
|
-
const
|
|
261
|
+
if (colIndex !== -1) {
|
|
262
|
+
const { columns } = state;
|
|
263
|
+
const col = columns[colIndex];
|
|
339
264
|
const newWidth = getAdjustedRowNumberColumnWidth(state);
|
|
340
|
-
if (
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
rowNumberCol.minWidth
|
|
344
|
-
);
|
|
345
|
-
if (hasDefinedColumnsWidths(widthsData)) {
|
|
265
|
+
if (col.initialWidth !== newWidth) {
|
|
266
|
+
col.initialWidth = Math.max(newWidth, col.minWidth);
|
|
267
|
+
if (widthsData.columnWidths.length > 0) {
|
|
346
268
|
// When columns are resized with the resizer, a horizontal scroller appears.
|
|
347
269
|
// Adjusting the columns size will respect widths already set and try to fit this column.
|
|
348
|
-
this.
|
|
349
|
-
this.
|
|
270
|
+
this.isResizingUpdateQueued = true;
|
|
271
|
+
this.setAutoResizingUpdate(columns);
|
|
350
272
|
}
|
|
351
273
|
}
|
|
352
274
|
}
|
|
@@ -357,11 +279,11 @@ export class ColumnWidthManager {
|
|
|
357
279
|
*
|
|
358
280
|
* @param {Any} previousValue The previous column value
|
|
359
281
|
* @param {Any} newValue The new column value
|
|
360
|
-
* @param {Array}
|
|
282
|
+
* @param {Array} columns The column definitions
|
|
361
283
|
*/
|
|
362
|
-
handleCheckboxColumnChange(previousValue, newValue,
|
|
363
|
-
if (
|
|
364
|
-
this.
|
|
284
|
+
handleCheckboxColumnChange(previousValue, newValue, columns) {
|
|
285
|
+
if (columns.length > 0 && previousValue !== newValue) {
|
|
286
|
+
this.isResizingUpdateQueued = true;
|
|
365
287
|
}
|
|
366
288
|
}
|
|
367
289
|
|
|
@@ -370,29 +292,28 @@ export class ColumnWidthManager {
|
|
|
370
292
|
*
|
|
371
293
|
* @param {Any} previousValue The previous column value
|
|
372
294
|
* @param {Any} newValue The new column value
|
|
373
|
-
* @param {Array}
|
|
295
|
+
* @param {Array} columns The column definitions
|
|
374
296
|
*/
|
|
375
|
-
handleRowNumberColumnChange(previousValue, newValue,
|
|
376
|
-
if (
|
|
377
|
-
this.
|
|
378
|
-
this.
|
|
297
|
+
handleRowNumberColumnChange(previousValue, newValue, columns) {
|
|
298
|
+
if (columns.length > 0 && previousValue !== newValue) {
|
|
299
|
+
this.isResizingUpdateQueued = true;
|
|
300
|
+
this.setAutoResizingUpdate(columns);
|
|
379
301
|
}
|
|
380
302
|
}
|
|
381
303
|
|
|
382
304
|
/**
|
|
383
|
-
* @private
|
|
384
305
|
* Queues up an auto resizing update. If a column width isn't defined,
|
|
385
306
|
* reset the width so it can be recalculated.
|
|
386
307
|
*
|
|
387
|
-
* @param {Array}
|
|
308
|
+
* @param {Array} columns The column definitions
|
|
388
309
|
*/
|
|
389
|
-
|
|
310
|
+
setAutoResizingUpdate(columns) {
|
|
390
311
|
if (this.columnWidthMode === AUTO_WIDTH_MODE) {
|
|
391
|
-
this.
|
|
312
|
+
this.isAutoResizingUpdateQueued = true;
|
|
392
313
|
}
|
|
393
|
-
for (let
|
|
394
|
-
const col =
|
|
395
|
-
if (!
|
|
314
|
+
for (let colIndex = 0; colIndex < columns.length; colIndex += 1) {
|
|
315
|
+
const col = columns[colIndex];
|
|
316
|
+
if (!getColumnWidth(col)) {
|
|
396
317
|
col.columnWidth = null;
|
|
397
318
|
col.style = '';
|
|
398
319
|
}
|
|
@@ -400,26 +321,18 @@ export class ColumnWidthManager {
|
|
|
400
321
|
}
|
|
401
322
|
|
|
402
323
|
/**
|
|
403
|
-
*
|
|
404
|
-
* Resets the auto resizing update queue.
|
|
405
|
-
*/
|
|
406
|
-
_resetAutoResizingUpdate() {
|
|
407
|
-
this._queueAutoResizingUpdate = false;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* @private
|
|
412
|
-
* Evalutes if there is a change between two sets of data.
|
|
324
|
+
* Evaluates if there is a change between two sets of data.
|
|
413
325
|
*
|
|
414
326
|
* @param {Array} previousData An array of previous data
|
|
415
327
|
* @param {Array} newData An array of new data
|
|
416
328
|
* @returns {Boolean} Whether or not the is a difference between the two data sets
|
|
417
329
|
*/
|
|
418
|
-
|
|
330
|
+
hasDataChanged(previousData, newData) {
|
|
331
|
+
const { length: previousDataLength } = previousData;
|
|
332
|
+
const { length: newDataLength } = newData;
|
|
419
333
|
return (
|
|
420
|
-
|
|
421
|
-
(
|
|
422
|
-
previousData.length !== newData.length)
|
|
334
|
+
newDataLength > 0 &&
|
|
335
|
+
(previousDataLength === 0 || previousDataLength !== newDataLength)
|
|
423
336
|
);
|
|
424
337
|
}
|
|
425
338
|
|
|
@@ -427,87 +340,59 @@ export class ColumnWidthManager {
|
|
|
427
340
|
* @private
|
|
428
341
|
* Determines if a column should resize with an update.
|
|
429
342
|
*
|
|
430
|
-
* @param {Node}
|
|
343
|
+
* @param {Node} template The datatable template
|
|
431
344
|
* @param {Object} widthsData The source widths data
|
|
432
345
|
* @returns {Boolean} Whether the column should resize with an update
|
|
433
346
|
*/
|
|
434
|
-
|
|
435
|
-
if (
|
|
347
|
+
shouldResizeWithUpdate(template, widthsData) {
|
|
348
|
+
if (widthsData.columnWidths.length > 0) {
|
|
436
349
|
// Can resize from DOM when table is visible.
|
|
437
350
|
// Otherwise, only when `ResizeObserver` is available in browser.
|
|
438
351
|
return (
|
|
439
|
-
this.
|
|
352
|
+
this.resizeObserverAvailable || isTableRenderedVisible(template)
|
|
440
353
|
);
|
|
441
354
|
}
|
|
442
355
|
return true;
|
|
443
356
|
}
|
|
444
357
|
|
|
445
358
|
/**
|
|
446
|
-
* @private
|
|
447
|
-
* Determines the appropriate selectors to use based on the datatable render mode.
|
|
448
|
-
*
|
|
449
|
-
* @returns {Object} Selectors based on datatable render mode
|
|
450
|
-
*/
|
|
451
|
-
_getTableSelectors() {
|
|
452
|
-
if (this._renderMode === 'role-based') {
|
|
453
|
-
return tableTypes.roleBased;
|
|
454
|
-
}
|
|
455
|
-
return tableTypes.default;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
/**
|
|
459
|
-
* @private
|
|
460
359
|
* Retrieves the datatable interface from the DOM
|
|
461
360
|
*
|
|
462
|
-
* @param {Node}
|
|
361
|
+
* @param {Node} template The datatable template
|
|
463
362
|
* @returns {Object} The datatable interface
|
|
464
363
|
*/
|
|
465
|
-
|
|
466
|
-
const datatableSelectors = this._getTableSelectors();
|
|
364
|
+
getDatatableInterface(template) {
|
|
467
365
|
return {
|
|
468
366
|
getAvailableWidthFromDom() {
|
|
469
|
-
const
|
|
470
|
-
|
|
471
|
-
);
|
|
472
|
-
return getDomWidth(container);
|
|
367
|
+
const scrollerY = getScrollerY(template);
|
|
368
|
+
return getScrollerXFromScrollerY(scrollerY).offsetWidth;
|
|
473
369
|
},
|
|
474
370
|
getDataCellWidths() {
|
|
475
|
-
const
|
|
476
|
-
|
|
371
|
+
const cellElements = template.querySelectorAll(
|
|
372
|
+
'[data-rowgroup-body] [role="row"]:first-child > *'
|
|
477
373
|
);
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
result.push(cell.offsetWidth);
|
|
483
|
-
return result;
|
|
484
|
-
}, []);
|
|
374
|
+
const { length } = cellElements;
|
|
375
|
+
const result = Array(length);
|
|
376
|
+
for (let i = 0; i < length; i += 1) {
|
|
377
|
+
result[i] = cellElements[i].offsetWidth;
|
|
485
378
|
}
|
|
486
|
-
return
|
|
379
|
+
return result;
|
|
487
380
|
},
|
|
488
381
|
getHeaderCellWidths() {
|
|
489
|
-
const
|
|
490
|
-
|
|
382
|
+
const headerElements = template.querySelectorAll(
|
|
383
|
+
'[role="columnheader"] lightning-primitive-header-factory'
|
|
491
384
|
);
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
result.push(headerDomWidth);
|
|
499
|
-
}
|
|
500
|
-
return result;
|
|
501
|
-
}, []);
|
|
385
|
+
const result = [];
|
|
386
|
+
for (let i = 0; i < headerElements.length; i += 1) {
|
|
387
|
+
const headerDomWidth = headerElements[i].getDomWidth();
|
|
388
|
+
if (headerDomWidth) {
|
|
389
|
+
result.push(headerDomWidth);
|
|
390
|
+
}
|
|
502
391
|
}
|
|
503
|
-
return
|
|
392
|
+
return result;
|
|
504
393
|
},
|
|
505
394
|
getTableElementWidth() {
|
|
506
|
-
|
|
507
|
-
root.querySelector(datatableSelectors.BASE) ||
|
|
508
|
-
root.querySelector('[role="grid"]') ||
|
|
509
|
-
root.querySelector('[role="treegrid"]');
|
|
510
|
-
return getDomWidth(tableElement);
|
|
395
|
+
return template.querySelector('.slds-table').offsetWidth;
|
|
511
396
|
},
|
|
512
397
|
};
|
|
513
398
|
}
|