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,36 +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
|
|
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.
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} state - The untracked datatable state
|
|
18
6
|
*/
|
|
19
7
|
export function setErrors(state, errors) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const { rows } = state.errors;
|
|
28
|
-
return (rows && rows[rowKey]) || {};
|
|
8
|
+
state.errors = Object.assign(
|
|
9
|
+
{
|
|
10
|
+
rows: {},
|
|
11
|
+
table: {},
|
|
12
|
+
},
|
|
13
|
+
errors
|
|
14
|
+
);
|
|
29
15
|
}
|
|
30
16
|
|
|
31
17
|
/**
|
|
32
|
-
*
|
|
18
|
+
* Resets row-level and table-level errors in datatable state object.
|
|
19
|
+
*
|
|
20
|
+
* @param {Object} _state - The untracked datatable state
|
|
33
21
|
*/
|
|
34
|
-
export function
|
|
35
|
-
|
|
22
|
+
export function resetErrors(state) {
|
|
23
|
+
state.errors = {
|
|
24
|
+
rows: {},
|
|
25
|
+
table: {},
|
|
26
|
+
};
|
|
36
27
|
}
|
|
@@ -1,61 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getTotalWidthsMetadata,
|
|
3
|
-
getColumnWidthFromDef,
|
|
4
|
-
} from './widthManagerShared';
|
|
1
|
+
import { getColumnWidth, getTotalWidthsData } from './widthManagerShared';
|
|
5
2
|
|
|
6
3
|
/**
|
|
7
4
|
* Determines the expected table width
|
|
8
5
|
*
|
|
9
6
|
* @param {Number} availableWidth The available width for the entire table
|
|
10
|
-
* @param {Object}
|
|
7
|
+
* @param {Object} widthsData The widths metadata object
|
|
11
8
|
* @returns {Number} The expected width of the table
|
|
12
9
|
*/
|
|
13
|
-
function getExpectedTableWidth(availableWidth,
|
|
14
|
-
const minExpectedTableWidth = getMinExpectedTableWidth(widthsMetadata);
|
|
15
|
-
return widthsMetadata.totalFlexibleColumns === 0
|
|
16
|
-
? minExpectedTableWidth
|
|
17
|
-
: Math.max(minExpectedTableWidth, availableWidth);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Determines the minimum expected table width
|
|
22
|
-
*
|
|
23
|
-
* @param {Object} widthsMetadata The widths metadata object
|
|
24
|
-
* @returns {Number} The minimum expected table width
|
|
25
|
-
*/
|
|
26
|
-
function getMinExpectedTableWidth(widthsMetadata) {
|
|
10
|
+
function getExpectedTableWidth(availableWidth, widthsData) {
|
|
27
11
|
const {
|
|
28
12
|
totalFixedWidth,
|
|
29
13
|
totalResizedWidth,
|
|
30
14
|
totalFlexibleColumns,
|
|
31
15
|
minColumnWidth,
|
|
32
|
-
} =
|
|
16
|
+
} = widthsData;
|
|
33
17
|
const minTotalFlexibleWidth = totalFlexibleColumns * minColumnWidth;
|
|
34
|
-
|
|
18
|
+
const minExpectedTableWidth =
|
|
19
|
+
minTotalFlexibleWidth + totalFixedWidth + totalResizedWidth;
|
|
20
|
+
return widthsData.totalFlexibleColumns === 0
|
|
21
|
+
? minExpectedTableWidth
|
|
22
|
+
: Math.max(minExpectedTableWidth, availableWidth);
|
|
35
23
|
}
|
|
36
24
|
|
|
37
25
|
/**
|
|
38
26
|
* Strategy for columns with defined fixed widths.
|
|
39
27
|
*/
|
|
40
28
|
export class FixedWidthStrategy {
|
|
41
|
-
|
|
42
|
-
_columnWidthMetaData = {};
|
|
43
|
-
|
|
44
|
-
/************************** LIFECYCLE HOOKS **************************/
|
|
29
|
+
widthsData = {};
|
|
45
30
|
|
|
46
31
|
constructor(minColumnWidth, maxColumnWidth) {
|
|
47
|
-
this.
|
|
32
|
+
this.widthsData = { minColumnWidth, maxColumnWidth };
|
|
48
33
|
}
|
|
49
34
|
|
|
50
|
-
/************************** PRIVATE SETTERS **************************/
|
|
51
|
-
|
|
52
35
|
/**
|
|
53
36
|
* Sets the minimum column width
|
|
54
37
|
*
|
|
55
38
|
* @param {Number} value The minimum width
|
|
56
39
|
*/
|
|
57
40
|
set minColumnWidth(value) {
|
|
58
|
-
this.
|
|
41
|
+
this.widthsData.minColumnWidth = value;
|
|
59
42
|
}
|
|
60
43
|
|
|
61
44
|
/**
|
|
@@ -64,7 +47,7 @@ export class FixedWidthStrategy {
|
|
|
64
47
|
* @param {Number} value The maximum width
|
|
65
48
|
*/
|
|
66
49
|
set maxColumnWidth(value) {
|
|
67
|
-
this.
|
|
50
|
+
this.widthsData.maxColumnWidth = value;
|
|
68
51
|
}
|
|
69
52
|
|
|
70
53
|
/**
|
|
@@ -72,50 +55,45 @@ export class FixedWidthStrategy {
|
|
|
72
55
|
* equally amongst the possible columns
|
|
73
56
|
*
|
|
74
57
|
* @param {Object} datatableInterface Interface to datatable with callbacks giving width information
|
|
75
|
-
* @param {Array}
|
|
58
|
+
* @param {Array} _columns The untracked column definitions
|
|
76
59
|
* @returns {Object} columnWidths: [], expectedTableWidth: (number)
|
|
77
60
|
*/
|
|
78
|
-
getAdjustedColumnWidths(datatableInterface,
|
|
79
|
-
const
|
|
80
|
-
this._columnWidthMetaData,
|
|
81
|
-
columnDefs
|
|
82
|
-
);
|
|
61
|
+
getAdjustedColumnWidths(datatableInterface, _columns) {
|
|
62
|
+
const totalWidthsData = getTotalWidthsData(this.widthsData, _columns);
|
|
83
63
|
const availableWidth = datatableInterface.getAvailableWidthFromDom();
|
|
84
64
|
const expectedTableWidth = getExpectedTableWidth(
|
|
85
65
|
availableWidth,
|
|
86
|
-
|
|
66
|
+
totalWidthsData
|
|
87
67
|
);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
widthsMetadata,
|
|
68
|
+
const expectedFlexibleColumnWidth = this.getFlexibleColumnWidth(
|
|
69
|
+
totalWidthsData,
|
|
91
70
|
expectedTableWidth
|
|
92
71
|
);
|
|
93
|
-
|
|
94
72
|
const columnWidths = [];
|
|
95
|
-
|
|
73
|
+
for (let colIndex = 0; colIndex < _columns.length; colIndex += 1) {
|
|
96
74
|
const width =
|
|
97
|
-
|
|
75
|
+
getColumnWidth(_columns[colIndex]) ||
|
|
76
|
+
expectedFlexibleColumnWidth;
|
|
98
77
|
columnWidths[colIndex] = width;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return { columnWidths, expectedTableWidth };
|
|
78
|
+
}
|
|
79
|
+
return { columnWidths };
|
|
102
80
|
}
|
|
103
81
|
|
|
104
82
|
/**
|
|
105
83
|
* Determines the expected flexible column width
|
|
106
84
|
*
|
|
107
|
-
* @param {Object}
|
|
85
|
+
* @param {Object} widthsData The widths metadata object
|
|
108
86
|
* @param {Number} totalTableWidth The total available width for the table
|
|
109
87
|
* @returns {Number} The column width
|
|
110
88
|
*/
|
|
111
|
-
|
|
89
|
+
getFlexibleColumnWidth(widthsData, totalTableWidth) {
|
|
112
90
|
const {
|
|
113
91
|
totalFixedWidth,
|
|
114
92
|
totalResizedWidth,
|
|
115
93
|
totalFlexibleColumns,
|
|
116
94
|
minColumnWidth,
|
|
117
95
|
maxColumnWidth,
|
|
118
|
-
} =
|
|
96
|
+
} = widthsData;
|
|
119
97
|
const totalFlexibleWidth =
|
|
120
98
|
totalTableWidth - totalFixedWidth - totalResizedWidth;
|
|
121
99
|
const avgFlexibleColumnWidth = Math.floor(
|
|
@@ -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,35 +10,18 @@ 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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
? column.actions
|
|
38
|
-
: [],
|
|
39
|
-
internalActions: getInternalActions(state, column),
|
|
40
|
-
};
|
|
41
|
-
});
|
|
18
|
+
export function updateHeaderInternalActions(state) {
|
|
19
|
+
const { columns } = state;
|
|
20
|
+
const { length: colCount } = columns;
|
|
21
|
+
for (let colIndex = 0; colIndex < colCount; colIndex += 1) {
|
|
22
|
+
const col = columns[colIndex];
|
|
23
|
+
col.actions.internalActions = getInternalActions(state, col);
|
|
24
|
+
}
|
|
42
25
|
}
|
|
43
26
|
|
|
44
27
|
/**
|
|
@@ -53,7 +36,7 @@ export function handleHeaderActionTriggered(event) {
|
|
|
53
36
|
const { action, actionType, colKeyValue } = event.detail;
|
|
54
37
|
|
|
55
38
|
if (actionType !== 'customer') {
|
|
56
|
-
handleTriggeredAction(this
|
|
39
|
+
handleTriggeredAction(this, action, colKeyValue);
|
|
57
40
|
}
|
|
58
41
|
|
|
59
42
|
dispatchHeaderActionEvent(this, action, colKeyValue);
|
|
@@ -107,18 +90,3 @@ function dispatchHeaderActionEvent(dt, action, colKeyValue) {
|
|
|
107
90
|
})
|
|
108
91
|
);
|
|
109
92
|
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Determines the menu alignment based on column placement.
|
|
113
|
-
*
|
|
114
|
-
* @param {Array} columns Array of all the columns
|
|
115
|
-
* @param {Integer} index The current column index to check
|
|
116
|
-
* @returns {String} The computed alignment
|
|
117
|
-
*/
|
|
118
|
-
function getMenuAlignment(columns, index) {
|
|
119
|
-
const isLastColumn = index === columns.length - 1;
|
|
120
|
-
|
|
121
|
-
return isLastColumn || columns[index + 1].type === 'action'
|
|
122
|
-
? 'auto-right'
|
|
123
|
-
: 'auto-left';
|
|
124
|
-
}
|
|
@@ -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,22 +21,12 @@ 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
|
|
44
28
|
*/
|
|
45
|
-
export function
|
|
29
|
+
export function setEnableInfiniteLoading(state, value) {
|
|
46
30
|
state.enableInfiniteLoading = normalizeBoolean(value);
|
|
47
31
|
}
|
|
48
32
|
|
|
@@ -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,26 +88,23 @@ 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
|
-
//
|
|
102
|
+
// Don't prefetch if already loading or data is not set yet.
|
|
121
103
|
return;
|
|
122
104
|
}
|
|
123
105
|
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
if (elem && isScrollerVisible(elem) && !isScrollable(elem)) {
|
|
106
|
+
const scrollerY = getScrollerY(template);
|
|
107
|
+
if (scrollerY && isScrollerVisible(scrollerY) && !isScrollable(scrollerY)) {
|
|
127
108
|
this.dispatchEvent(new CustomEvent('loadmore'));
|
|
128
109
|
}
|
|
129
110
|
}
|
|
@@ -131,27 +112,27 @@ export function handlePrefetch(root, state) {
|
|
|
131
112
|
/************************** PRIVATE METHODS ***************************/
|
|
132
113
|
|
|
133
114
|
/**
|
|
134
|
-
* Determines if a
|
|
115
|
+
* Determines if a scroller element is scrollable.
|
|
135
116
|
*
|
|
136
|
-
* @param {Element}
|
|
137
|
-
* @returns {Boolean} Whether
|
|
117
|
+
* @param {Element} scroller The scroller element to check
|
|
118
|
+
* @returns {Boolean} Whether the element is scrollable
|
|
138
119
|
*/
|
|
139
|
-
function isScrollable(
|
|
120
|
+
function isScrollable(scroller) {
|
|
140
121
|
// scrollHeight should be greater than clientHeight by some allowance
|
|
141
|
-
return
|
|
122
|
+
return scroller.scrollHeight > scroller.clientHeight + SCROLL_ALLOWANCE;
|
|
142
123
|
}
|
|
143
124
|
|
|
144
125
|
/**
|
|
145
|
-
* Determines if a
|
|
126
|
+
* Determines if a scroller element's scroll bars are visible.
|
|
146
127
|
*
|
|
147
|
-
* @param {Element}
|
|
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
|
-
function isScrollerVisible(
|
|
131
|
+
function isScrollerVisible(scroller) {
|
|
151
132
|
return !!(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
133
|
+
scroller.offsetParent ||
|
|
134
|
+
scroller.offsetHeight ||
|
|
135
|
+
scroller.offsetWidth
|
|
155
136
|
);
|
|
156
137
|
}
|
|
157
138
|
|