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,106 +1,36 @@
|
|
|
1
1
|
import { assert } from 'lightning/utilsPrivate';
|
|
2
|
-
import { classSet, isObjectLike
|
|
3
|
-
import {
|
|
2
|
+
import { classSet, isObjectLike } from './utils';
|
|
3
|
+
import { getAttributesNames } from './types';
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
getRowSelectionInputType,
|
|
5
|
+
getCurrentSelectionLength,
|
|
6
|
+
SELECTABLE_HEADER_TYPE,
|
|
8
7
|
} from './rowSelectionShared';
|
|
9
|
-
import { getTreeStateIndicatorFieldNames, getStateTreeColumn } from './tree';
|
|
10
8
|
import {
|
|
11
|
-
getColumns,
|
|
12
9
|
getTypeAttributesValues,
|
|
13
10
|
getSubTypeAttributesValues,
|
|
14
11
|
getCellAttributesValues,
|
|
15
|
-
isCustomerColumn,
|
|
16
12
|
generateColKeyValue,
|
|
17
13
|
} from './columns';
|
|
18
|
-
import {
|
|
19
|
-
import { getRowError } from './errors';
|
|
20
|
-
import { getDirtyValueFromCell } from './inlineEditShared';
|
|
14
|
+
import { getRowNumberError } from './rowNumber';
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (Array.isArray(data)) {
|
|
28
|
-
state.data = data;
|
|
29
|
-
} else {
|
|
30
|
-
state.data = [];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function getRows(state) {
|
|
35
|
-
return state.rows;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function getKeyField(state) {
|
|
39
|
-
return state.keyField;
|
|
40
|
-
}
|
|
16
|
+
const CELL_EDIT_CLASS = 'slds-cell-edit';
|
|
17
|
+
const HAS_ERROR_CLASS = 'slds-has-error';
|
|
18
|
+
const IS_EDITED_CLASS = 'slds-is-edited';
|
|
19
|
+
const ROLE_BASED_CELL_CLASS = 'cell';
|
|
20
|
+
const TREE__ITEM_CLASS = 'slds-tree__item';
|
|
41
21
|
|
|
42
22
|
export function setKeyField(state, value) {
|
|
43
|
-
assert(
|
|
44
|
-
typeof value === 'string',
|
|
45
|
-
`The "keyField" value expected in lightning:datatable must be type String.`
|
|
46
|
-
);
|
|
47
23
|
if (typeof value === 'string') {
|
|
48
24
|
state.keyField = value;
|
|
49
25
|
} else {
|
|
26
|
+
assert(
|
|
27
|
+
false,
|
|
28
|
+
`The "keyField" value expected in lightning:datatable must be type String.`
|
|
29
|
+
);
|
|
50
30
|
state.keyField = undefined;
|
|
51
31
|
}
|
|
52
32
|
}
|
|
53
33
|
|
|
54
|
-
export function hasValidKeyField(state) {
|
|
55
|
-
const keyField = getKeyField(state);
|
|
56
|
-
return typeof keyField === 'string';
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Resolves the CSS classes for a row based on the row.isSelected state
|
|
61
|
-
*
|
|
62
|
-
* @param {object} row - a row object in state.rows collection
|
|
63
|
-
* @returns {string} the classSet string
|
|
64
|
-
*/
|
|
65
|
-
export function resolveRowClassNames(row) {
|
|
66
|
-
const classes = classSet('slds-hint-parent');
|
|
67
|
-
if (row.isSelected) {
|
|
68
|
-
classes.add('slds-is-selected');
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return classes.toString();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
*
|
|
76
|
-
* @param {object} state - data table state
|
|
77
|
-
* @param {string} rowKeyValue - computed id for the row
|
|
78
|
-
* @param {string} colKeyValue - computed id for the column
|
|
79
|
-
* @returns {object} The user row that its related to the action.
|
|
80
|
-
*/
|
|
81
|
-
export function getUserRowByCellKeys(state, rowKeyValue, colKeyValue) {
|
|
82
|
-
const rowIndex = state.indexes[rowKeyValue][colKeyValue][0];
|
|
83
|
-
return getData(state)[rowIndex];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* It creates a row key generator based on the keyField passed in by the consumer.
|
|
88
|
-
* If the keyField passed in through the generator does not point to a value in the row object,
|
|
89
|
-
* it falls back to a generated key using indexes. Ex. row-0/row-1
|
|
90
|
-
*
|
|
91
|
-
* @param {String} keyField - keyField provided by the consumer
|
|
92
|
-
* @returns {Function} - function with the unique row key generator
|
|
93
|
-
*/
|
|
94
|
-
export function uniqueRowKeyGenerator(keyField) {
|
|
95
|
-
let index = 0;
|
|
96
|
-
return function (row) {
|
|
97
|
-
if (row[keyField]) {
|
|
98
|
-
return row[keyField];
|
|
99
|
-
}
|
|
100
|
-
return `row-${index++}`;
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
34
|
/**
|
|
105
35
|
* It compute the state.rows collection based on the current normalized (data, columns)
|
|
106
36
|
* and generate cells indexes map(state.indexes)
|
|
@@ -110,107 +40,234 @@ export function uniqueRowKeyGenerator(keyField) {
|
|
|
110
40
|
* attaching the 'cell' class, calling this from connectedCallback of datatable would
|
|
111
41
|
* eliminate the need for updateCellClassForRoleBasedMode.
|
|
112
42
|
*
|
|
113
|
-
* @param {
|
|
43
|
+
* @param {Object} state - The datatable state
|
|
44
|
+
* @param {Object} types - The type handling factory
|
|
114
45
|
*/
|
|
115
|
-
export function updateRowsAndCellIndexes() {
|
|
116
|
-
const {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
46
|
+
export function updateRowsAndCellIndexes(state, types) {
|
|
47
|
+
const {
|
|
48
|
+
columns,
|
|
49
|
+
data,
|
|
50
|
+
keyField,
|
|
51
|
+
maxRowSelection,
|
|
52
|
+
renderModeRoleBased,
|
|
53
|
+
virtualize,
|
|
54
|
+
rowHeight,
|
|
55
|
+
} = state;
|
|
56
|
+
const { length: rowCount } = data;
|
|
57
|
+
const { dirtyValues } = state.inlineEdit;
|
|
58
|
+
const { length: colCount } = columns;
|
|
59
|
+
const currentSelectionLength =
|
|
60
|
+
maxRowSelection === 1 ? 1 : getCurrentSelectionLength(state);
|
|
61
|
+
const inputType = maxRowSelection === 1 ? 'radio' : 'checkbox';
|
|
62
|
+
|
|
63
|
+
let scopeCol;
|
|
64
|
+
let treeColTypeAttrs;
|
|
65
|
+
for (let colIndex = 0; colIndex < colCount; colIndex += 1) {
|
|
66
|
+
const col = columns[colIndex];
|
|
67
|
+
const { type: columnType } = col;
|
|
68
|
+
if (!scopeCol && col.isScopeCol && types.isValidType(columnType)) {
|
|
69
|
+
scopeCol = col;
|
|
70
|
+
}
|
|
71
|
+
if (columnType === 'tree' && treeColTypeAttrs === undefined) {
|
|
72
|
+
treeColTypeAttrs = getTypeAttributesValues(col);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
124
76
|
// initializing indexes
|
|
125
77
|
state.indexes = {};
|
|
126
78
|
|
|
127
|
-
|
|
79
|
+
const { rows: errorsRows } = state.errors;
|
|
80
|
+
const rows = Array(rowCount);
|
|
81
|
+
// Tracked state changes.
|
|
82
|
+
state.rows = rows;
|
|
83
|
+
|
|
84
|
+
for (let rowIndex = 0; rowIndex < rowCount; rowIndex += 1) {
|
|
85
|
+
const rowData = data[rowIndex];
|
|
86
|
+
const rowDataKeyField = rowData[keyField];
|
|
87
|
+
const rowKeyValue = rowDataKeyField
|
|
88
|
+
? `${rowDataKeyField}`
|
|
89
|
+
: `row-${rowIndex}`;
|
|
90
|
+
const dirtyRowData = dirtyValues[rowKeyValue];
|
|
91
|
+
const rowErrors = errorsRows && errorsRows[rowKeyValue];
|
|
92
|
+
const cellErrors = rowErrors && rowErrors.cells;
|
|
93
|
+
const errorFieldNames = rowErrors && rowErrors.fieldNames;
|
|
94
|
+
|
|
95
|
+
state.indexes[rowKeyValue] = { rowIndex };
|
|
96
|
+
|
|
97
|
+
const isRowSelected = !!state.selectedRowsKeys[rowKeyValue];
|
|
98
|
+
const rowNumber = rowIndex + 1;
|
|
99
|
+
const cells = Array(colCount);
|
|
100
|
+
|
|
128
101
|
const row = {
|
|
129
|
-
key:
|
|
130
|
-
cells
|
|
102
|
+
key: rowKeyValue,
|
|
103
|
+
cells,
|
|
104
|
+
rowIndex,
|
|
105
|
+
rowNumber, // for UTAM since methods are base-1
|
|
106
|
+
ariaRowIndex: rowIndex + 2, // aria attrs are base-1 and also count header as a row
|
|
107
|
+
inputType,
|
|
108
|
+
isSelected: isRowSelected,
|
|
109
|
+
ariaSelected: isRowSelected ? 'true' : false,
|
|
110
|
+
isDisabled:
|
|
111
|
+
!isRowSelected &&
|
|
112
|
+
maxRowSelection !== 1 &&
|
|
113
|
+
currentSelectionLength === maxRowSelection,
|
|
114
|
+
classnames: `slds-hint-parent${
|
|
115
|
+
isRowSelected ? ' slds-is-selected' : ''
|
|
116
|
+
}`,
|
|
117
|
+
tabIndex: -1,
|
|
118
|
+
style: virtualize
|
|
119
|
+
? `position:absolute;top:${rowIndex * rowHeight}px;`
|
|
120
|
+
: '',
|
|
121
|
+
level: undefined,
|
|
122
|
+
posInSet: undefined,
|
|
123
|
+
setSize: undefined,
|
|
124
|
+
isExpanded: undefined,
|
|
125
|
+
hasChildren: undefined,
|
|
131
126
|
};
|
|
132
|
-
const rowErrors = getRowError(state, row.key);
|
|
133
|
-
|
|
134
|
-
state.indexes[row.key] = { rowIndex };
|
|
135
127
|
|
|
136
|
-
row.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
128
|
+
// Add tree specific row properties.
|
|
129
|
+
if (treeColTypeAttrs) {
|
|
130
|
+
const hasChildren = !!resolveAttributeValue(
|
|
131
|
+
treeColTypeAttrs.hasChildren,
|
|
132
|
+
rowData
|
|
133
|
+
);
|
|
134
|
+
row.hasChildren = hasChildren;
|
|
135
|
+
row.isExpanded = hasChildren
|
|
136
|
+
? `${!!resolveAttributeValue(
|
|
137
|
+
treeColTypeAttrs.isExpanded,
|
|
138
|
+
rowData
|
|
139
|
+
)}`
|
|
140
|
+
: undefined;
|
|
141
|
+
row.level =
|
|
142
|
+
resolveAttributeValue(treeColTypeAttrs.level, rowData) || 1;
|
|
143
|
+
row.posInSet =
|
|
144
|
+
resolveAttributeValue(treeColTypeAttrs.posInSet, rowData) || 1;
|
|
145
|
+
row.setSize =
|
|
146
|
+
resolveAttributeValue(treeColTypeAttrs.setSize, rowData) || 1;
|
|
151
147
|
}
|
|
152
148
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
|
|
149
|
+
rows[rowIndex] = row;
|
|
150
|
+
|
|
151
|
+
// Add cell indexes.
|
|
152
|
+
for (let colIndex = 0; colIndex < colCount; colIndex += 1) {
|
|
153
|
+
const col = columns[colIndex];
|
|
154
|
+
const {
|
|
155
|
+
columnKey,
|
|
156
|
+
fieldName,
|
|
157
|
+
isScopeCol,
|
|
158
|
+
label: dataLabel,
|
|
159
|
+
type: columnType,
|
|
160
|
+
typeAttributes,
|
|
161
|
+
} = col;
|
|
162
|
+
const colKeyValue = generateColKeyValue(col, colIndex);
|
|
163
|
+
const columnSubType = typeAttributes
|
|
164
|
+
? typeAttributes.subType
|
|
165
|
+
: undefined;
|
|
166
|
+
const dirtyValue = dirtyRowData && dirtyRowData[colKeyValue];
|
|
167
|
+
const hasError = columnKey
|
|
168
|
+
? !!(cellErrors && cellErrors[columnKey])
|
|
169
|
+
: !!(errorFieldNames && errorFieldNames.includes(fieldName));
|
|
170
|
+
const hasTreeData = columnType === 'tree';
|
|
171
|
+
// value based on the fieldName
|
|
172
|
+
const value =
|
|
173
|
+
dirtyValue === undefined ? rowData[fieldName] : dirtyValue;
|
|
174
|
+
const displayReadOnlyIcon = !!col.displayReadOnlyIcon;
|
|
175
|
+
const editable = isCellEditable(rowData, col);
|
|
176
|
+
const isValidType = types.isValidType(columnType);
|
|
177
|
+
const isCheckbox = columnType === SELECTABLE_HEADER_TYPE;
|
|
178
|
+
const isDataType = isValidType && !isScopeCol;
|
|
179
|
+
const isDataTypeScope = isValidType && isScopeCol;
|
|
180
|
+
|
|
168
181
|
// cell object creation
|
|
169
182
|
const cell = {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
? colData.typeAttributes.subType
|
|
173
|
-
: undefined,
|
|
174
|
-
dataLabel: colData.label,
|
|
175
|
-
value: computedCellValue, // value based on the fieldName
|
|
176
|
-
displayValue: rowData.displayValue ? rowData.displayValue : '',
|
|
177
|
-
rowKeyValue: row.key, // unique row key value
|
|
183
|
+
ariaReadOnly: !editable,
|
|
184
|
+
class: '',
|
|
178
185
|
colKeyValue, // unique column key value
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
186
|
+
columnSubType,
|
|
187
|
+
columnType,
|
|
188
|
+
dataLabel,
|
|
189
|
+
describedBy: dirtyValue ? 'unsaved-cell-notification' : null,
|
|
190
|
+
displayReadOnlyIcon,
|
|
191
|
+
displayValue: rowData.displayValue || '',
|
|
192
|
+
editable,
|
|
193
|
+
hasError,
|
|
194
|
+
isCheckbox,
|
|
195
|
+
isDataType,
|
|
196
|
+
isDataTypeScope,
|
|
197
|
+
rowKeyValue: row.key, // unique row key value
|
|
198
|
+
style: computeCellStyles(types, col, renderModeRoleBased),
|
|
199
|
+
tabIndex: -1,
|
|
200
|
+
value,
|
|
193
201
|
wrapText: state.wrapText[colKeyValue], // wrapText state
|
|
194
202
|
wrapTextMaxLines: state.wrapText[colKeyValue]
|
|
195
203
|
? state.wrapTextMaxLines
|
|
196
204
|
: undefined,
|
|
197
|
-
style: computeCellStyles(types, colData, renderModeRoleBased),
|
|
198
205
|
};
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
206
|
+
|
|
207
|
+
cell.class = computeCellClassNames(
|
|
208
|
+
cell,
|
|
209
|
+
hasTreeData,
|
|
210
|
+
dirtyValue,
|
|
211
|
+
renderModeRoleBased
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
if (!col.internal) {
|
|
215
|
+
// Assign cell type or cell subType attributes.
|
|
216
|
+
let attributeNames;
|
|
217
|
+
let attributeValues;
|
|
218
|
+
if (columnSubType) {
|
|
219
|
+
attributeNames = getAttributesNames(columnSubType);
|
|
220
|
+
attributeValues = getSubTypeAttributesValues(col);
|
|
221
|
+
} else {
|
|
222
|
+
attributeNames = types.getType(columnType).typeAttributes;
|
|
223
|
+
attributeValues = getTypeAttributesValues(col);
|
|
224
|
+
}
|
|
225
|
+
const attributeNamesLength = attributeNames
|
|
226
|
+
? attributeNames.length
|
|
227
|
+
: 0;
|
|
228
|
+
for (let i = 0; i < attributeNamesLength; i += 1) {
|
|
229
|
+
const attrName = attributeNames[i];
|
|
230
|
+
const attrValue = attributeValues[attrName];
|
|
231
|
+
cell[`typeAttribute${i}`] = resolveAttributeValue(
|
|
232
|
+
attrValue,
|
|
233
|
+
rowData
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Extract the `cellAttributes` and their values that are specified in the
|
|
238
|
+
// column definition.
|
|
239
|
+
// If a cell attribute points to a fieldName in a row, that value is resolved here.
|
|
240
|
+
// This object that contains the resolved mapping is then set in the `cell`
|
|
241
|
+
// object in each row.
|
|
242
|
+
const cellAttributes = getCellAttributesValues(col);
|
|
243
|
+
const keys = Object.keys(cellAttributes);
|
|
244
|
+
for (let i = 0, { length } = keys; i < length; i += 1) {
|
|
245
|
+
const attrName = keys[i];
|
|
246
|
+
const attrValue = cellAttributes[attrName];
|
|
247
|
+
cell[attrName] = resolveAttributeValue(attrValue, rowData);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// If this is tree grid, this maps and sets into the cell object
|
|
251
|
+
// the tree specific attributes:
|
|
252
|
+
// 1) row.hasChildren to typeAttribute21 and
|
|
253
|
+
// 2) row.isExpanded to and typeAttribute22
|
|
254
|
+
if (hasTreeData) {
|
|
255
|
+
// Attaches if the row containing this cell hasChildren or
|
|
256
|
+
// not and isExpanded or not attributes to typeAttribute21
|
|
257
|
+
// and typeAttribute22 respectively typeAttribute0-typeAttribute20
|
|
258
|
+
// are reserved for types supported by tree
|
|
259
|
+
cell.typeAttribute21 = row.hasChildren;
|
|
260
|
+
cell.typeAttribute22 = row.isExpanded === 'true';
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
// Populate row number attributes.
|
|
264
|
+
else if (columnType === 'rowNumber') {
|
|
265
|
+
const scopeColValue = rowData[scopeCol.fieldName];
|
|
266
|
+
// computes and sets the resolved typeAttribute for the row
|
|
267
|
+
// number column error state
|
|
268
|
+
cell.typeAttribute0 = getRowNumberError(
|
|
212
269
|
rowErrors,
|
|
213
|
-
|
|
270
|
+
scopeColValue
|
|
214
271
|
);
|
|
215
272
|
}
|
|
216
273
|
|
|
@@ -218,178 +275,9 @@ export function updateRowsAndCellIndexes() {
|
|
|
218
275
|
// Keeping the hash for backward compatibility, but we need to have 2 indexes, 1 for columns and one for rows,
|
|
219
276
|
// because of memory usage and also at certain point we might have the data but not the columns
|
|
220
277
|
state.indexes[row.key][colKeyValue] = [rowIndex, colIndex];
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return currentRow;
|
|
224
|
-
}, row.cells);
|
|
225
|
-
|
|
226
|
-
prev.push(row);
|
|
227
|
-
return prev;
|
|
228
|
-
}, []);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Checks whether there are errors for the specified column
|
|
233
|
-
* When a columnKey exists for a column, we will look for its errors inside the
|
|
234
|
-
* cells property of rowErrors. Only when it doesn't exist will we look for a
|
|
235
|
-
* reference to the column's fieldName.
|
|
236
|
-
*
|
|
237
|
-
* This maintains backwards compatibility with those continuing to use fieldName
|
|
238
|
-
* as column identifiers.
|
|
239
|
-
*/
|
|
240
|
-
function hasCellErrors(rowErrors, fieldName, columnKey) {
|
|
241
|
-
const rowErrorsHasColumnKey = rowErrors.cells && rowErrors.cells[columnKey];
|
|
242
|
-
const rowErrorsHasFieldName =
|
|
243
|
-
rowErrors.fieldNames && rowErrors.fieldNames.includes(fieldName);
|
|
244
|
-
|
|
245
|
-
return rowErrorsHasColumnKey || (!columnKey && rowErrorsHasFieldName);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Computes and sets the following resolved values in the cell object:
|
|
250
|
-
* 1. `typeAttributes` specified in the column definition
|
|
251
|
-
* 2. `cellAttributes` specified in the column definition
|
|
252
|
-
* 3. Editability of the cell and subsequently the ariaReadOnly property
|
|
253
|
-
* 4. Visibility of read only icon
|
|
254
|
-
*
|
|
255
|
-
* Computes and sets the following tree specific attributes
|
|
256
|
-
* into typeAttributes21/22 in the cell object:
|
|
257
|
-
* 1. row.hasChildren
|
|
258
|
-
* 2. row.isExpanded
|
|
259
|
-
*
|
|
260
|
-
* @param {Object} cell - cell metadata
|
|
261
|
-
* @param {Object} row - row metadata
|
|
262
|
-
* @param {Object} rowData - data to be rendered in the cells of that row
|
|
263
|
-
* @param {Object} colData - column definition
|
|
264
|
-
* @param {Object} types - instance of DatatableTypes from `./types.js`
|
|
265
|
-
*/
|
|
266
|
-
function assignCustomerColumnAttributes(cell, row, rowData, colData, types) {
|
|
267
|
-
Object.assign(
|
|
268
|
-
cell,
|
|
269
|
-
computeCellTypeAttributes(rowData, colData, types),
|
|
270
|
-
computeCellAttributes(rowData, colData),
|
|
271
|
-
computeCellEditable(rowData, colData),
|
|
272
|
-
computeCellDisplayReadOnlyIcon(colData)
|
|
273
|
-
);
|
|
274
|
-
if (!cell.editable) {
|
|
275
|
-
cell.ariaReadOnly = true;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// If this is tree grid, this maps and sets into the cell object the tree specific attributes:
|
|
279
|
-
// 1) row.hasChildren to typeAttribute21 and
|
|
280
|
-
// 2) row.isExpanded to and typeAttribute22
|
|
281
|
-
if (isTreeType(colData.type)) {
|
|
282
|
-
Object.assign(cell, computeCellStateTypeAttributes(row));
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Computes and sets the resolved typeAttribute for the row number column error state
|
|
288
|
-
*
|
|
289
|
-
* @param {Object} cell - cell metadata
|
|
290
|
-
* @param {Object} rowData - data to be rendered in the cells of that row
|
|
291
|
-
* @param {Object} types - instance of DatatableTypes from `./types.js`
|
|
292
|
-
* @param {Object} rowErrors - contains the errors present in that row
|
|
293
|
-
* @param {Object} scopeCol - column with scope=row
|
|
294
|
-
*/
|
|
295
|
-
function assignRowNumberColumnAttributes(
|
|
296
|
-
cell,
|
|
297
|
-
rowData,
|
|
298
|
-
types,
|
|
299
|
-
rowErrors,
|
|
300
|
-
scopeCol
|
|
301
|
-
) {
|
|
302
|
-
const scopeColValue = rowData[scopeCol.fieldName];
|
|
303
|
-
const errorColumnDef = getRowNumberErrorColumnDef(rowErrors, scopeColValue);
|
|
304
|
-
Object.assign(
|
|
305
|
-
cell,
|
|
306
|
-
computeCellTypeAttributes(rowData, errorColumnDef, types)
|
|
307
|
-
);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* This function extracts the `cellAttributes` and their values that are specified
|
|
312
|
-
* in the column definition.
|
|
313
|
-
* If a cell attribute points to a fieldName in a row, that value is resolved here.
|
|
314
|
-
*
|
|
315
|
-
* This object that contains the resolved mapping is then set in the `cell` object
|
|
316
|
-
* in each row.
|
|
317
|
-
*
|
|
318
|
-
* @param {Object} row - current row data. Required for cases cellAttributes refers to a fieldName in a row
|
|
319
|
-
* @param {Object} column - column definition
|
|
320
|
-
* @returns {Object} - contains the resolved mapping of cellAttributes and their values
|
|
321
|
-
*/
|
|
322
|
-
export function computeCellAttributes(row, column) {
|
|
323
|
-
const cellAttributesValues = getCellAttributesValues(column);
|
|
324
|
-
return Object.keys(cellAttributesValues).reduce((attrs, attrName) => {
|
|
325
|
-
const attrValue = cellAttributesValues[attrName];
|
|
326
|
-
attrs[attrName] = resolveAttributeValue(attrValue, row);
|
|
327
|
-
|
|
328
|
-
return attrs;
|
|
329
|
-
}, {});
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* This function retrieves the allowlisted type attributes for a particular type and
|
|
334
|
-
* maps the value set in the column definition to `typeAttribute{index}`.
|
|
335
|
-
*
|
|
336
|
-
* The types and their corresponding allowlisted attributes can be seen in types.js
|
|
337
|
-
*
|
|
338
|
-
* Ex. For the type 'url', there are 3 type attributes allowlisted: label, target, tooltip
|
|
339
|
-
* If you pass typeAttributes: {label: 'My Label', target: '_blank', myattr: false}
|
|
340
|
-
* in the column definition, this function would map ->
|
|
341
|
-
* typeAttribute0: 'My Label', typeAttribute1: '_blank' and typeAttribute2: undefined
|
|
342
|
-
* `myattr` is not allowlisted so it is discarded
|
|
343
|
-
*
|
|
344
|
-
* This mapping is later set into the `cell` object for each row and
|
|
345
|
-
* will be passed in to primitive-cell-factory as
|
|
346
|
-
* type-attribute-0={cell.typeAttribute0}
|
|
347
|
-
* type-attribute-1={cell.typeAttribute1}
|
|
348
|
-
* ...
|
|
349
|
-
*
|
|
350
|
-
* @param {Object} row - current row data. Required for cases typeAttributes refers to a fieldName in a row
|
|
351
|
-
* @param {Object} column - column definition
|
|
352
|
-
* @param {Object} types - instance of DatatableTypes from `./types.js`
|
|
353
|
-
* @returns {Object} - object containing all the typeAttributes{index} and their mapped values
|
|
354
|
-
*/
|
|
355
|
-
export function computeCellTypeAttributes(row, column, types) {
|
|
356
|
-
if (column.typeAttributes && column.typeAttributes.subType) {
|
|
357
|
-
return computeCellSubTypeAttributes(row, column);
|
|
278
|
+
cells[colIndex] = cell;
|
|
279
|
+
}
|
|
358
280
|
}
|
|
359
|
-
const attributesNames = types.getType(column.type).typeAttributes;
|
|
360
|
-
const typeAttributesValues = getTypeAttributesValues(column);
|
|
361
|
-
|
|
362
|
-
return attributesNames.reduce((attrs, attrName, index) => {
|
|
363
|
-
const typeAttributeName = `typeAttribute${index}`;
|
|
364
|
-
|
|
365
|
-
attrs[typeAttributeName] = resolveAttributeValue(
|
|
366
|
-
typeAttributesValues[attrName],
|
|
367
|
-
row
|
|
368
|
-
);
|
|
369
|
-
|
|
370
|
-
return attrs;
|
|
371
|
-
}, {});
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
export function computeCellSubTypeAttributes(row, column) {
|
|
375
|
-
const attributesNames = getAttributesNames(column.typeAttributes.subType);
|
|
376
|
-
const typeAttributesValues = getSubTypeAttributesValues(column);
|
|
377
|
-
|
|
378
|
-
return attributesNames.reduce((attrs, attrName, index) => {
|
|
379
|
-
const typeAttributeName = `typeAttribute${index}`;
|
|
380
|
-
attrs[typeAttributeName] = resolveAttributeValue(
|
|
381
|
-
typeAttributesValues[attrName],
|
|
382
|
-
row
|
|
383
|
-
);
|
|
384
|
-
|
|
385
|
-
return attrs;
|
|
386
|
-
}, {});
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
function computeCellEditable(row, column) {
|
|
390
|
-
return {
|
|
391
|
-
editable: isCellEditable(row, column),
|
|
392
|
-
};
|
|
393
281
|
}
|
|
394
282
|
|
|
395
283
|
/**
|
|
@@ -401,17 +289,11 @@ function computeCellEditable(row, column) {
|
|
|
401
289
|
*
|
|
402
290
|
* Returns false in all other cases.
|
|
403
291
|
*
|
|
404
|
-
* @param {object}
|
|
405
|
-
* @param {object}
|
|
292
|
+
* @param {object} rowData - a row data object stored in datatable state. Must be truthy.
|
|
293
|
+
* @param {object} col - a column data object stored in datatable state. Must be truthy.
|
|
406
294
|
*/
|
|
407
|
-
export function isCellEditable(
|
|
408
|
-
return !!resolveAttributeValue(
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
function computeCellDisplayReadOnlyIcon(column) {
|
|
412
|
-
return {
|
|
413
|
-
displayReadOnlyIcon: !!column.displayReadOnlyIcon,
|
|
414
|
-
};
|
|
295
|
+
export function isCellEditable(rowData, col) {
|
|
296
|
+
return !!resolveAttributeValue(col.editable, rowData);
|
|
415
297
|
}
|
|
416
298
|
|
|
417
299
|
/**
|
|
@@ -422,167 +304,73 @@ function computeCellDisplayReadOnlyIcon(column) {
|
|
|
422
304
|
* managed by ourselves unlike the <table> version.
|
|
423
305
|
*
|
|
424
306
|
* @param {Object} types - instance of DatatableTypes from `./types.js`
|
|
425
|
-
* @param {Object}
|
|
307
|
+
* @param {Object} col - column definition
|
|
426
308
|
* @param {Boolean} renderModeRoleBased - render mode of datatable (div || table)
|
|
427
309
|
* @returns {String} - styles to be set on the cell
|
|
428
310
|
*/
|
|
429
|
-
function computeCellStyles(types,
|
|
430
|
-
|
|
431
|
-
const columnType = colData.type;
|
|
311
|
+
function computeCellStyles(types, col, renderModeRoleBased) {
|
|
312
|
+
const columnType = col.type;
|
|
432
313
|
|
|
433
|
-
|
|
434
|
-
// remove the padding that comes with the standard layout
|
|
314
|
+
let cellStyle = '';
|
|
435
315
|
if (
|
|
436
316
|
types.isCustomType(columnType) &&
|
|
437
317
|
!types.isStandardCellLayoutForCustomType(columnType)
|
|
438
318
|
) {
|
|
439
|
-
|
|
319
|
+
// When a custom type is not using the standard layout,
|
|
320
|
+
// remove the padding that comes with the standard layout
|
|
321
|
+
cellStyle = 'padding: 0;';
|
|
440
322
|
}
|
|
441
323
|
|
|
442
324
|
// Width needs to be managed when rendering as divs
|
|
443
325
|
if (renderModeRoleBased) {
|
|
444
|
-
const columnWidth =
|
|
445
|
-
|
|
326
|
+
const { columnWidth } = col;
|
|
327
|
+
if (columnWidth > 0) {
|
|
328
|
+
cellStyle += `width:${columnWidth}px;`;
|
|
329
|
+
}
|
|
446
330
|
}
|
|
447
331
|
|
|
448
|
-
return
|
|
332
|
+
return cellStyle;
|
|
449
333
|
}
|
|
450
334
|
|
|
451
335
|
function computeCellClassNames(
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
cellHasErrors,
|
|
336
|
+
cell,
|
|
337
|
+
hasTreeData,
|
|
455
338
|
dirtyValue,
|
|
456
339
|
renderModeRoleBased
|
|
457
340
|
) {
|
|
458
|
-
const classNames = classSet('');
|
|
459
341
|
// TODO: With the current SLDS design, the 'slds-cell-edit' class is required on a cell in cases
|
|
460
342
|
// where the read only icon is to be displayed. This is an issue with their design that will need to
|
|
461
343
|
// be addressed on their end, so once they do that we can modify this code accordingly.
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
'slds-tree__item': isTreeType(column.type),
|
|
466
|
-
'slds-has-error': cellHasErrors,
|
|
467
|
-
'slds-is-edited': dirtyValue !== undefined,
|
|
468
|
-
cell: renderModeRoleBased,
|
|
469
|
-
});
|
|
470
|
-
return classNames.toString();
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
/**
|
|
474
|
-
* Attaches if the row containing this cell hasChildren or not and isExpanded or not
|
|
475
|
-
* attributes to typeAttribute21 and typeAttribute22 respectively
|
|
476
|
-
* typeAttribute0-typeAttribute20 are reserved for types supported by tree
|
|
477
|
-
* @param {object}row - current row which is stored in state.rows
|
|
478
|
-
* @returns {{typeAttribute21, typeAttribute22: boolean}} typeAttributes
|
|
479
|
-
* describing state of the row associated
|
|
480
|
-
*/
|
|
481
|
-
function computeCellStateTypeAttributes(row) {
|
|
482
|
-
return {
|
|
483
|
-
typeAttribute21: row.hasChildren,
|
|
484
|
-
typeAttribute22: row.isExpanded === 'true',
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
export function getRowIndexByKey(state, key) {
|
|
489
|
-
if (!state.indexes[key]) {
|
|
490
|
-
return undefined;
|
|
344
|
+
let cellClass = '';
|
|
345
|
+
if (cell.displayReadOnlyIcon || cell.editable) {
|
|
346
|
+
cellClass += CELL_EDIT_CLASS;
|
|
491
347
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
export function getRowsTotal(state) {
|
|
506
|
-
return getRows(state).length;
|
|
348
|
+
if (hasTreeData) {
|
|
349
|
+
cellClass += (cellClass.length ? ' ' : '') + TREE__ITEM_CLASS;
|
|
350
|
+
}
|
|
351
|
+
if (cell.hasError) {
|
|
352
|
+
cellClass += (cellClass.length ? ' ' : '') + HAS_ERROR_CLASS;
|
|
353
|
+
}
|
|
354
|
+
if (dirtyValue !== undefined) {
|
|
355
|
+
cellClass += (cellClass.length ? ' ' : '') + IS_EDITED_CLASS;
|
|
356
|
+
}
|
|
357
|
+
if (renderModeRoleBased) {
|
|
358
|
+
cellClass += (cellClass.length ? ' ' : '') + ROLE_BASED_CELL_CLASS;
|
|
359
|
+
}
|
|
360
|
+
return cellClass;
|
|
507
361
|
}
|
|
508
362
|
|
|
509
|
-
function resolveAttributeValue(attrValue,
|
|
363
|
+
function resolveAttributeValue(attrValue, rowData) {
|
|
510
364
|
if (isObjectLike(attrValue)) {
|
|
511
|
-
const fieldName = attrValue
|
|
365
|
+
const { fieldName } = attrValue;
|
|
512
366
|
if (fieldName) {
|
|
513
|
-
return
|
|
367
|
+
return rowData[fieldName];
|
|
514
368
|
}
|
|
515
369
|
}
|
|
516
370
|
|
|
517
371
|
return attrValue;
|
|
518
372
|
}
|
|
519
373
|
|
|
520
|
-
function getRowStateForTree(row, state) {
|
|
521
|
-
const column = getStateTreeColumn(state);
|
|
522
|
-
if (column) {
|
|
523
|
-
return {
|
|
524
|
-
level: getRowLevel(column, row),
|
|
525
|
-
posInSet: getRowPosInSet(column, row),
|
|
526
|
-
setSize: getRowSetSize(column, row),
|
|
527
|
-
isExpanded: isRowExpanded(column, row),
|
|
528
|
-
hasChildren: getRowHasChildren(column, row),
|
|
529
|
-
};
|
|
530
|
-
}
|
|
531
|
-
return {};
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
export function getRowLevel(column, row) {
|
|
535
|
-
const typeAttributesValues = getTypeAttributesValues(column);
|
|
536
|
-
const attrValue = resolveAttributeValue(
|
|
537
|
-
typeAttributesValues[getTreeStateIndicatorFieldNames().level],
|
|
538
|
-
row
|
|
539
|
-
);
|
|
540
|
-
return attrValue ? attrValue : 1;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
function getRowPosInSet(column, row) {
|
|
544
|
-
const typeAttributesValues = getTypeAttributesValues(column);
|
|
545
|
-
const attrValue = resolveAttributeValue(
|
|
546
|
-
typeAttributesValues[getTreeStateIndicatorFieldNames().position],
|
|
547
|
-
row
|
|
548
|
-
);
|
|
549
|
-
return attrValue ? attrValue : 1;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
function getRowSetSize(column, row) {
|
|
553
|
-
const typeAttributesValues = getTypeAttributesValues(column);
|
|
554
|
-
const attrValue = resolveAttributeValue(
|
|
555
|
-
typeAttributesValues[getTreeStateIndicatorFieldNames().setsize],
|
|
556
|
-
row
|
|
557
|
-
);
|
|
558
|
-
return attrValue ? attrValue : 1;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
export function isRowExpanded(column, row) {
|
|
562
|
-
const typeAttributesValues = getTypeAttributesValues(column);
|
|
563
|
-
const hasChildren = resolveAttributeValue(
|
|
564
|
-
typeAttributesValues[getTreeStateIndicatorFieldNames().children],
|
|
565
|
-
row
|
|
566
|
-
);
|
|
567
|
-
if (hasChildren) {
|
|
568
|
-
const attrValue = resolveAttributeValue(
|
|
569
|
-
typeAttributesValues[getTreeStateIndicatorFieldNames().expanded],
|
|
570
|
-
row
|
|
571
|
-
);
|
|
572
|
-
return !!attrValue + '';
|
|
573
|
-
}
|
|
574
|
-
return undefined;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
export function getRowHasChildren(column, row) {
|
|
578
|
-
const typeAttributesValues = getTypeAttributesValues(column);
|
|
579
|
-
const hasChildren = resolveAttributeValue(
|
|
580
|
-
typeAttributesValues[getTreeStateIndicatorFieldNames().children],
|
|
581
|
-
row
|
|
582
|
-
);
|
|
583
|
-
return !!hasChildren;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
374
|
/**
|
|
587
375
|
* For the role-based table, we need to manage the width of each cell separately.
|
|
588
376
|
* Re-compute the cell styles so that the width of the cell is set
|
|
@@ -591,7 +379,7 @@ export function getRowHasChildren(column, row) {
|
|
|
591
379
|
* @param {Object} state - Datatable's state object
|
|
592
380
|
*/
|
|
593
381
|
export function recomputeCellStyles(types, state) {
|
|
594
|
-
const columns =
|
|
382
|
+
const { columns } = state;
|
|
595
383
|
state.rows.forEach((row) => {
|
|
596
384
|
row.cells.forEach((cell, colIndex) => {
|
|
597
385
|
const colData = columns[colIndex];
|