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,115 +1,34 @@
|
|
|
1
|
+
import labelRowNumber from '@salesforce/label/LightningDatatable.rowNumber';
|
|
2
|
+
import rowActionsDefaultAriaLabel from '@salesforce/label/LightningDatatable.rowActionsDefaultAriaLabel';
|
|
1
3
|
import { normalizeBoolean } from 'lightning/utilsPrivate';
|
|
2
4
|
import { isObjectLike } from './utils';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
hasRowNumberColumn,
|
|
6
|
-
setShowRowNumberColumn,
|
|
7
|
-
} from './rowNumber';
|
|
8
|
-
import { isTreeType, isValidTypeForTree } from './types';
|
|
9
|
-
import { updateColumnSortingState } from './sort';
|
|
10
|
-
import rowActionsDefaultAriaLabel from '@salesforce/label/LightningDatatable.rowActionsDefaultAriaLabel';
|
|
5
|
+
import { ROW_NUMBER_INITIAL_WIDTH } from './rowNumber';
|
|
6
|
+
import { SELECTABLE_HEADER_TYPE } from './rowSelectionShared';
|
|
11
7
|
|
|
12
8
|
const i18n = {
|
|
13
9
|
rowActionsDefaultAriaLabel,
|
|
10
|
+
rowNumber: labelRowNumber,
|
|
14
11
|
};
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
const ROW_NUMBER_COLUMN = {
|
|
14
|
+
type: 'rowNumber',
|
|
15
|
+
ariaLabel: i18n.rowNumber,
|
|
16
|
+
initialWidth: ROW_NUMBER_INITIAL_WIDTH,
|
|
17
|
+
internal: true,
|
|
18
|
+
minWidth: 52,
|
|
19
|
+
maxWidth: 1000,
|
|
20
|
+
resizable: false,
|
|
21
|
+
sortable: false,
|
|
22
|
+
tabIndex: -1,
|
|
23
|
+
};
|
|
17
24
|
|
|
18
25
|
const SELECTABLE_COLUMN = {
|
|
19
|
-
type:
|
|
26
|
+
type: SELECTABLE_HEADER_TYPE,
|
|
20
27
|
fixedWidth: 32,
|
|
21
|
-
tabIndex: -1,
|
|
22
28
|
internal: true,
|
|
29
|
+
tabIndex: -1,
|
|
23
30
|
};
|
|
24
31
|
|
|
25
|
-
/**
|
|
26
|
-
* Returns the columns default state.
|
|
27
|
-
*
|
|
28
|
-
* @returns {Object} The default column state.
|
|
29
|
-
*/
|
|
30
|
-
export function getColumnsDefaultState() {
|
|
31
|
-
return {
|
|
32
|
-
columns: [],
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Returns whether or not the datatable has columns.
|
|
38
|
-
*
|
|
39
|
-
* @param {Object} state The datatable's state.
|
|
40
|
-
* @returns {Boolean} Whether the datatable has columns.
|
|
41
|
-
*/
|
|
42
|
-
export function hasColumns(state) {
|
|
43
|
-
return getColumns(state).length > 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Returns whether or not the column has been specified by the customer.
|
|
48
|
-
*
|
|
49
|
-
* @param {Object} column The column definition object.
|
|
50
|
-
* @returns {Boolean} Whether the column is customer defined or not.
|
|
51
|
-
*/
|
|
52
|
-
export function isCustomerColumn(column) {
|
|
53
|
-
return column.internal !== true;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Returns the datatable's columns from state.
|
|
58
|
-
*
|
|
59
|
-
* @param {Object} state The datatable's state.
|
|
60
|
-
* @returns {Array} The datatable's columns definition.
|
|
61
|
-
*/
|
|
62
|
-
export function getColumns(state) {
|
|
63
|
-
return state.columns;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Returns whether any of the datatable's columns are editable.
|
|
68
|
-
*
|
|
69
|
-
* @param {Array} columns The datatable's column definition.
|
|
70
|
-
* @returns {Boolean} Whether any of the columns are editable.
|
|
71
|
-
*/
|
|
72
|
-
export function hasEditableColumn(columns) {
|
|
73
|
-
return columns.some((column) => column.editable);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Given an array of column definitions, returns a filtered array containing only those
|
|
78
|
-
* elements from the original array that are editable. For any two columns, C_1 and C_2,
|
|
79
|
-
* that are present in both the input and output array, the relative ordering between
|
|
80
|
-
* them that existed in the input array is maintained in the output array.
|
|
81
|
-
*
|
|
82
|
-
* @param {Array} columns The datatable's column definition. Must be truthy and must be
|
|
83
|
-
* filled with truthy column definition objects.
|
|
84
|
-
*/
|
|
85
|
-
export function getEditableColumns(columns) {
|
|
86
|
-
return columns.filter((column) => column.editable);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Normalizes the editable property of the column after checking whether the column type
|
|
91
|
-
* is a valid editable standard type or if it's a customType and uses standardCellLayout.
|
|
92
|
-
* If column.editable is associated with an object that also has a 'fieldName' key, then
|
|
93
|
-
* the invocation of this function results in a no-op because we instead rely on later
|
|
94
|
-
* row level checks to determine cell editability.
|
|
95
|
-
*
|
|
96
|
-
* @param {Object} column The column definition object.
|
|
97
|
-
* @param {Object} types The DatatableTypes object.
|
|
98
|
-
*/
|
|
99
|
-
export function normalizeEditable(column, types) {
|
|
100
|
-
if (types.isEditableType(column.type)) {
|
|
101
|
-
if (
|
|
102
|
-
!(typeof column.editable === 'object' && column.editable.fieldName)
|
|
103
|
-
) {
|
|
104
|
-
column.editable = normalizeBoolean(column.editable);
|
|
105
|
-
}
|
|
106
|
-
column.editTemplate = types.getCustomTypeEditTemplate(column.type);
|
|
107
|
-
} else {
|
|
108
|
-
column.editable = false;
|
|
109
|
-
column.editTemplate = undefined;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
32
|
/**
|
|
114
33
|
* Steps through and corrects column definitions inconsistencies.
|
|
115
34
|
*
|
|
@@ -120,90 +39,179 @@ export function normalizeEditable(column, types) {
|
|
|
120
39
|
* For tree-types, we verify all sub-type attributes are within our allowed
|
|
121
40
|
* parameters. See `getNormalizedSubTypeAttribute`.
|
|
122
41
|
*
|
|
123
|
-
* @param {Object} state The datatable state
|
|
124
|
-
* @param {Array}
|
|
125
|
-
* @param {Object} types
|
|
42
|
+
* @param {Object} state - The datatable state
|
|
43
|
+
* @param {Array} rawColumns - The user provided column definitions to normalize
|
|
44
|
+
* @param {Object} types - The type handling factory
|
|
126
45
|
*/
|
|
127
|
-
export function normalizeColumns(state,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
//
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
46
|
+
export function normalizeColumns(state, rawColumns, types) {
|
|
47
|
+
const { length: colCount } = rawColumns;
|
|
48
|
+
if (colCount === 0) {
|
|
49
|
+
// Tracked state change.
|
|
50
|
+
state.columns = [];
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
let normColCount = colCount;
|
|
54
|
+
let { showRowNumberColumn } = state;
|
|
55
|
+
const notHideCheckboxColumn = !state.hideCheckboxColumn;
|
|
56
|
+
|
|
57
|
+
if (!showRowNumberColumn) {
|
|
58
|
+
for (let colIndex = 0; colIndex < colCount; colIndex += 1) {
|
|
59
|
+
if (rawColumns[colIndex].editable) {
|
|
60
|
+
showRowNumberColumn = true;
|
|
61
|
+
// Untracked state change.
|
|
62
|
+
state.showRowNumberColumn = true;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
136
65
|
}
|
|
66
|
+
}
|
|
67
|
+
if (showRowNumberColumn) {
|
|
68
|
+
normColCount += 1;
|
|
69
|
+
}
|
|
70
|
+
if (notHideCheckboxColumn) {
|
|
71
|
+
normColCount += 1;
|
|
72
|
+
}
|
|
73
|
+
const normalizedColumns = Array(normColCount);
|
|
137
74
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
setShowRowNumberColumn(state, true);
|
|
141
|
-
normalizedColumns.unshift(getRowNumberColumnDef());
|
|
142
|
-
}
|
|
75
|
+
// Tracked state change.
|
|
76
|
+
state.columns = normalizedColumns;
|
|
143
77
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
78
|
+
let firstColumnForReaders = 0;
|
|
79
|
+
if (showRowNumberColumn) {
|
|
80
|
+
normalizedColumns[firstColumnForReaders] = Object.assign(
|
|
81
|
+
{},
|
|
82
|
+
ROW_NUMBER_COLUMN
|
|
83
|
+
);
|
|
84
|
+
firstColumnForReaders += 1;
|
|
85
|
+
}
|
|
86
|
+
if (notHideCheckboxColumn) {
|
|
87
|
+
normalizedColumns[firstColumnForReaders] = Object.assign(
|
|
88
|
+
{},
|
|
89
|
+
SELECTABLE_COLUMN
|
|
90
|
+
);
|
|
91
|
+
firstColumnForReaders += 1;
|
|
92
|
+
}
|
|
93
|
+
for (let colIndex = 0; colIndex < colCount; colIndex += 1) {
|
|
94
|
+
normalizedColumns[colIndex + firstColumnForReaders] =
|
|
95
|
+
rawColumns[colIndex];
|
|
96
|
+
}
|
|
154
97
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
98
|
+
const { defaultSortDirection, sortedBy, sortedDirection } = state;
|
|
99
|
+
const seenColumnKeys = new Set();
|
|
100
|
+
|
|
101
|
+
for (let colIndex = 0; colIndex < normColCount; colIndex += 1) {
|
|
102
|
+
const refCol = normalizedColumns[colIndex];
|
|
103
|
+
const { columnKey } = refCol;
|
|
104
|
+
|
|
105
|
+
// Verify `columnKey` is unique
|
|
106
|
+
if (columnKey && seenColumnKeys.has(columnKey)) {
|
|
107
|
+
console.error(
|
|
108
|
+
`The "columnKey" column property must be unique. Found a duplicate of columnKey "${columnKey}".`
|
|
158
109
|
);
|
|
159
|
-
|
|
160
|
-
|
|
110
|
+
}
|
|
111
|
+
seenColumnKeys.add(columnKey);
|
|
112
|
+
|
|
113
|
+
const { type: refColumnType } = refCol;
|
|
114
|
+
const colName = columnKey || refCol.fieldName;
|
|
115
|
+
|
|
116
|
+
// Normalize columns.
|
|
117
|
+
const normCol = {
|
|
118
|
+
ariaLabel: '',
|
|
119
|
+
cellAttributes: {},
|
|
120
|
+
resizable: true,
|
|
121
|
+
type: 'text',
|
|
122
|
+
typeAttributes: {},
|
|
123
|
+
subType: '',
|
|
124
|
+
};
|
|
125
|
+
if (refColumnType === 'action') {
|
|
126
|
+
normCol.ariaLabel = i18n.rowActionsDefaultAriaLabel;
|
|
127
|
+
normCol.fixedWidth = 50;
|
|
128
|
+
normCol.resizable = false;
|
|
129
|
+
} else if (refColumnType === 'tree') {
|
|
130
|
+
normCol.subType = 'text';
|
|
131
|
+
}
|
|
132
|
+
Object.assign(normCol, refCol);
|
|
161
133
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
134
|
+
// Store in caches early so data can be referenced by other methods
|
|
135
|
+
// during initialization.
|
|
136
|
+
normalizedColumns[colIndex] = normCol;
|
|
165
137
|
|
|
166
|
-
|
|
167
|
-
normalizeColumnDataType(normalizedColumn, types);
|
|
168
|
-
normalizeEditable(normalizedColumn, types);
|
|
169
|
-
updateColumnSortingState(normalizedColumn, state);
|
|
170
|
-
}
|
|
138
|
+
let { type: columnType } = normCol;
|
|
171
139
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
140
|
+
normCol.ariaLabel = normCol.label || normCol.ariaLabel || null;
|
|
141
|
+
// `customType` attribute is needed to render default inline edit component
|
|
142
|
+
normCol.editableCustomType =
|
|
143
|
+
types.isStandardCellLayoutForCustomType(columnType);
|
|
144
|
+
|
|
145
|
+
// normalize customer column
|
|
146
|
+
if (!normCol.internal) {
|
|
147
|
+
// normalize column dataType
|
|
148
|
+
if (!types.isValidType(columnType)) {
|
|
149
|
+
columnType = 'text';
|
|
150
|
+
normCol.type = columnType;
|
|
151
|
+
}
|
|
152
|
+
// normalize editable
|
|
153
|
+
if (types.isEditableType(columnType)) {
|
|
154
|
+
const { editable } = normCol;
|
|
155
|
+
if (!(editable && editable.fieldName)) {
|
|
156
|
+
normCol.editable = normalizeBoolean(editable);
|
|
157
|
+
}
|
|
158
|
+
normCol.editTemplate =
|
|
159
|
+
types.getCustomTypeEditTemplate(columnType);
|
|
160
|
+
} else {
|
|
161
|
+
normCol.editable = false;
|
|
162
|
+
normCol.editTemplate = undefined;
|
|
177
163
|
}
|
|
164
|
+
// update column sorting state
|
|
165
|
+
const { sortable } = normCol;
|
|
166
|
+
if (sortable && colName === sortedBy) {
|
|
167
|
+
normCol.sorted = true;
|
|
168
|
+
normCol.sortAriaLabel =
|
|
169
|
+
sortedDirection === 'desc' ? 'descending' : 'ascending';
|
|
170
|
+
normCol.sortedDirection = sortedDirection;
|
|
171
|
+
} else {
|
|
172
|
+
normCol.sorted = false;
|
|
173
|
+
normCol.sortAriaLabel = sortable ? 'other' : null;
|
|
174
|
+
normCol.sortedDirection = defaultSortDirection;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
178
177
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
178
|
+
// Generate colKeyValue after normalizing customer column.
|
|
179
|
+
normCol.colKeyValue = generateColKeyValue(normCol, colIndex);
|
|
180
|
+
normCol.isScopeCol = colIndex === firstColumnForReaders;
|
|
181
|
+
normCol.isLastCol = colIndex === normColCount - 1;
|
|
182
|
+
normCol.tabIndex = -1;
|
|
183
|
+
|
|
184
|
+
// normalize tree column
|
|
185
|
+
if (normCol.type === 'tree') {
|
|
186
|
+
// normalized subType attributes
|
|
187
|
+
const { typeAttributes } = normCol;
|
|
188
|
+
const typeAttributesOverrides = {};
|
|
189
|
+
if (!types.isValidTypeForTree(typeAttributes.subType)) {
|
|
190
|
+
typeAttributesOverrides.subType = 'text';
|
|
191
|
+
}
|
|
192
|
+
if (!typeAttributes.subTypeAttributes) {
|
|
193
|
+
typeAttributesOverrides.subTypeAttributes = {};
|
|
194
|
+
}
|
|
195
|
+
normCol.typeAttributes = Object.assign(
|
|
196
|
+
{},
|
|
197
|
+
typeAttributes,
|
|
198
|
+
typeAttributesOverrides
|
|
199
|
+
);
|
|
200
|
+
}
|
|
189
201
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
202
|
+
// partially inline updateHeaderInternalActions from datatable/headerActions
|
|
203
|
+
const { actions } = normCol;
|
|
204
|
+
const isLastColumn = colIndex === normColCount - 1;
|
|
205
|
+
normCol.actions = {
|
|
206
|
+
menuAlignment:
|
|
207
|
+
isLastColumn ||
|
|
208
|
+
normalizedColumns[colIndex + 1].type === 'action'
|
|
209
|
+
? 'auto-right'
|
|
210
|
+
: 'auto-left',
|
|
211
|
+
customerActions: Array.isArray(actions) ? actions : [],
|
|
212
|
+
internalActions: undefined,
|
|
213
|
+
};
|
|
201
214
|
}
|
|
202
|
-
if (!typeAttributes.subTypeAttributes) {
|
|
203
|
-
typeAttributesOverrides.subTypeAttributes = {};
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return Object.assign({}, typeAttributes, typeAttributesOverrides);
|
|
207
215
|
}
|
|
208
216
|
|
|
209
217
|
/**
|
|
@@ -213,10 +221,8 @@ export function getNormalizedSubTypeAttribute(type, typeAttributes) {
|
|
|
213
221
|
* @returns Type attributes for the given column, if they exist.
|
|
214
222
|
*/
|
|
215
223
|
export function getTypeAttributesValues(column) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
return {};
|
|
224
|
+
const { typeAttributes } = column;
|
|
225
|
+
return isObjectLike(typeAttributes) ? typeAttributes : {};
|
|
220
226
|
}
|
|
221
227
|
|
|
222
228
|
/**
|
|
@@ -226,10 +232,8 @@ export function getTypeAttributesValues(column) {
|
|
|
226
232
|
* @returns {Object} Sub-type attributes for the given column, if they exist.
|
|
227
233
|
*/
|
|
228
234
|
export function getSubTypeAttributesValues(column) {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
return {};
|
|
235
|
+
const { subTypeAttributes } = column.typeAttributes;
|
|
236
|
+
return isObjectLike(subTypeAttributes) ? subTypeAttributes : {};
|
|
233
237
|
}
|
|
234
238
|
|
|
235
239
|
/**
|
|
@@ -239,10 +243,8 @@ export function getSubTypeAttributesValues(column) {
|
|
|
239
243
|
* @returns {Object} Cell attributes for the given column, if they exist.
|
|
240
244
|
*/
|
|
241
245
|
export function getCellAttributesValues(column) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
return {};
|
|
246
|
+
const { cellAttributes } = column;
|
|
247
|
+
return isObjectLike(cellAttributes) ? cellAttributes : {};
|
|
246
248
|
}
|
|
247
249
|
|
|
248
250
|
/**
|
|
@@ -267,20 +269,19 @@ export function generateColKeyValue(columnMetadata, index) {
|
|
|
267
269
|
* @returns {Number} The index in `dt.columns`. -1 if not found or if its internal.
|
|
268
270
|
*/
|
|
269
271
|
export function getUserColumnIndex(state, colKeyValue) {
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
if (state.columns[stateColumnIndex].internal) {
|
|
272
|
+
const { columns } = state;
|
|
273
|
+
const colIndex = state.headerIndexes[colKeyValue];
|
|
274
|
+
if (columns[colIndex].internal) {
|
|
274
275
|
return -1;
|
|
275
276
|
}
|
|
276
|
-
|
|
277
|
-
for (let i = 0; i <
|
|
278
|
-
if (
|
|
279
|
-
internalColumns
|
|
277
|
+
let internalColumns = 0;
|
|
278
|
+
for (let i = 0; i < colIndex; i += 1) {
|
|
279
|
+
if (columns[i].internal) {
|
|
280
|
+
internalColumns += 1;
|
|
280
281
|
}
|
|
281
282
|
}
|
|
282
283
|
|
|
283
|
-
return
|
|
284
|
+
return colIndex - internalColumns;
|
|
284
285
|
}
|
|
285
286
|
|
|
286
287
|
/**
|
|
@@ -310,95 +311,3 @@ export const generateHeaderIndexes = function (columns) {
|
|
|
310
311
|
export function getStateColumnIndex(state, colKeyValue) {
|
|
311
312
|
return state.headerIndexes[colKeyValue];
|
|
312
313
|
}
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Retrieves a column index number by its key.
|
|
316
|
-
*
|
|
317
|
-
* @param {Object} state The datatable state
|
|
318
|
-
* @param {String} key The key of the column. Defaults to field name if 'columnKey' is not provided.
|
|
319
|
-
* @returns {Number} The index in state.columns, -1 if it does not exist
|
|
320
|
-
*/
|
|
321
|
-
export function getColumnIndexByColumnKey(state, key) {
|
|
322
|
-
let i = 0;
|
|
323
|
-
const columns = getColumns(state);
|
|
324
|
-
const existFieldName = columns.some((column, index) => {
|
|
325
|
-
i = index;
|
|
326
|
-
return (
|
|
327
|
-
column.columnKey === key ||
|
|
328
|
-
(!column.columnKey && column.fieldName === key)
|
|
329
|
-
);
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
return existFieldName ? i : -1;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/************************** PRIVATE METHODS ***************************/
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* If the specified column type is not supported, resets it to default.
|
|
339
|
-
*
|
|
340
|
-
* @param {Object} column The column definition object.
|
|
341
|
-
* @param {Object} types The type handling factory.
|
|
342
|
-
*/
|
|
343
|
-
function normalizeColumnDataType(column, types) {
|
|
344
|
-
if (!types.isValidType(column.type)) {
|
|
345
|
-
column.type = getRegularColumnDefaults().type;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Returns the column defaults based on its type.
|
|
351
|
-
*
|
|
352
|
-
* @param {Object} column The column definition object.
|
|
353
|
-
* @returns {Object} The column defaults.
|
|
354
|
-
*/
|
|
355
|
-
function getColumnDefaults(column) {
|
|
356
|
-
switch (column.type) {
|
|
357
|
-
case 'action':
|
|
358
|
-
return getActionColumnDefaults();
|
|
359
|
-
case 'tree':
|
|
360
|
-
return getTreeColumnDefaults();
|
|
361
|
-
default:
|
|
362
|
-
return getRegularColumnDefaults();
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* Retrieves the defaults for regular columns.
|
|
368
|
-
*
|
|
369
|
-
* @returns {Object} Regular column defaults
|
|
370
|
-
*/
|
|
371
|
-
function getRegularColumnDefaults() {
|
|
372
|
-
return {
|
|
373
|
-
type: 'text',
|
|
374
|
-
typeAttributes: {},
|
|
375
|
-
cellAttributes: {},
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* Retrieves the defaults for action columns.
|
|
381
|
-
*
|
|
382
|
-
* @returns {Object} Action column defaults
|
|
383
|
-
*/
|
|
384
|
-
function getActionColumnDefaults() {
|
|
385
|
-
return {
|
|
386
|
-
fixedWidth: 50,
|
|
387
|
-
resizable: false,
|
|
388
|
-
ariaLabel: i18n.rowActionsDefaultAriaLabel,
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* Retrieves the defaults for tree columns.
|
|
394
|
-
*
|
|
395
|
-
* @returns {Object} Tree column defaults
|
|
396
|
-
*/
|
|
397
|
-
function getTreeColumnDefaults() {
|
|
398
|
-
return {
|
|
399
|
-
type: 'tree',
|
|
400
|
-
subType: 'text',
|
|
401
|
-
typeAttributes: {},
|
|
402
|
-
cellAttributes: {},
|
|
403
|
-
};
|
|
404
|
-
}
|