lightning-base-components 1.21.5-alpha → 1.21.7-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 +46 -4
- package/package.json +125 -3
- package/scopedImports/@salesforce-label-LightningColorPicker.a11yDefaultText.js +1 -0
- package/scopedImports/@salesforce-label-LightningDatatable.multiColumnSortingToast.js +1 -0
- package/scopedImports/@salesforce-label-LightningDatatable.sortingMenuColumns.js +1 -0
- package/scopedImports/@salesforce-label-LightningDatatable.sortingMenuMultiColumnSort.js +1 -0
- package/scopedImports/@salesforce-label-LightningDatatable.sortingMenuRows.js +1 -0
- package/scopedImports/@salesforce-label-LightningDatatable.sortingMenuTooltip.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.dependentFieldsListHeading.js +1 -1
- package/scopedImports/@salesforce-label-LightningLookup.advancedSearchMobile.js +1 -1
- package/scopedImports/@salesforce-label-LightningLookup.modalTitle.js +1 -0
- package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.addRule.js +1 -0
- package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.applyButton.js +1 -0
- package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.cancelButton.js +1 -0
- package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.clearButton.js +1 -0
- package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.duplicateValueValidation.js +1 -0
- package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.firstRuleHeading.js +1 -0
- package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.modalTitle.js +1 -0
- package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.otherRuleHeading.js +1 -0
- package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.ruleLimit.js +1 -0
- package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.ruleLimitReached.js +1 -0
- package/scopedImports/@salesforce-label-LightningPrimitiveColumnSorter.ascending.js +1 -0
- package/scopedImports/@salesforce-label-LightningPrimitiveColumnSorter.descending.js +1 -0
- package/scopedImports/@salesforce-label-LightningPrimitiveColumnSorter.dropdownPlaceholder.js +1 -0
- package/scopedImports/@salesforce-label-LightningPrimitiveColumnSorter.missingValueValidation.js +1 -0
- package/scopedImports/@salesforce-label-LightningPrimitiveColumnSorter.moveDownTooltip.js +1 -0
- package/scopedImports/@salesforce-label-LightningPrimitiveColumnSorter.moveUpTooltip.js +1 -0
- package/scopedImports/@salesforce-label-LightningProgressIndicator.pathCurrentStage.js +1 -0
- package/scopedImports/@salesforce-label-LightningRecordPicker.emptyStateNoResultText.js +1 -0
- package/scopedImports/@salesforce-label-LightningRecordPicker.messageWhenSearchTermTooShort.js +1 -0
- package/scopedImports/@salesforce-label-LightningRecordPicker.resultCountDescriptionForMoreThanOneHundredRecords.js +1 -0
- package/scopedImports/@salesforce-label-LightningRecordPicker.resultCountDescriptionForMultipleRecords.js +1 -0
- package/scopedImports/@salesforce-label-LightningRecordPicker.resultCountDescriptionForOneRecord.js +1 -0
- package/scopedImports/@salesforce-label-LightningRecordPicker.resultsLoading.js +1 -0
- package/scopedImports/@salesforce-label-LightningRecordPicker.searchInputHelp.js +1 -0
- package/src/lightning/accordion/accordion.js +21 -14
- package/src/lightning/accordionSection/button.slds.css +16 -15
- package/src/lightning/alert/alert.js +10 -8
- package/src/lightning/ariaObserver/ariaObserver.js +19 -5
- package/src/lightning/badge/badge.slds.css +1 -1
- package/src/lightning/baseCombobox/base-combobox.slds.css +1 -1
- package/src/lightning/baseCombobox/baseCombobox.html +2 -1
- package/src/lightning/baseCombobox/baseCombobox.js +21 -0
- package/src/lightning/baseCombobox/input-text.slds.css +5 -5
- package/src/lightning/button/button.js +5 -0
- package/src/lightning/button/button.slds.css +16 -15
- package/src/lightning/buttonIcon/__docs__/buttonIcon.md +4 -0
- package/src/lightning/buttonIcon/__examples__/basic/basic.html +17 -1
- package/src/lightning/buttonIcon/button-icon.slds.css +41 -25
- package/src/lightning/buttonIconStateful/button-icon-stateful.slds.css +33 -229
- package/src/lightning/buttonIconStateful/button-icon.slds.css +41 -25
- package/src/lightning/buttonIconStateful/button.slds.css +16 -15
- package/src/lightning/buttonMenu/button-icon.slds.css +41 -25
- package/src/lightning/buttonMenu/button-menu.slds.css +41 -15
- package/src/lightning/buttonMenu/button.slds.css +16 -15
- package/src/lightning/buttonMenu/buttonMenu.css +1 -1
- package/src/lightning/buttonMenu/buttonMenu.html +1 -1
- package/src/lightning/buttonMenu/buttonMenu.js +44 -4
- package/src/lightning/buttonStateful/button-stateful.slds.css +1 -4
- package/src/lightning/buttonStateful/button.slds.css +16 -15
- package/src/lightning/calendar/calendar.html +3 -4
- package/src/lightning/card/card.html +1 -1
- package/src/lightning/colorPickerCustom/colorPickerCustom.html +1 -1
- package/src/lightning/colorPickerCustom/colorPickerCustom.js +0 -9
- package/src/lightning/colorPickerCustom/input-text.slds.css +5 -5
- package/src/lightning/combobox/form-element.slds.css +5 -1
- package/src/lightning/confirm/confirm.js +10 -8
- package/src/lightning/datatable/__docs__/datatable.md +0 -3
- package/src/lightning/datatable/__examples__disabled/customComponentPopupTableWrapper/README.md +17 -0
- package/src/lightning/datatable/__examples__disabled/customComponentPopupTableWrapper/customComponentPopupTableWrapper.html +11 -0
- package/src/lightning/datatable/__examples__disabled/customComponentPopupTableWrapper/customComponentPopupTableWrapper.js +25 -0
- package/src/lightning/datatable/__examples__disabled/customComponentPopupTableWrapper/generateData.js +15 -0
- package/src/lightning/datatable/__examples__disabled/myCustomTypePopupTable/customInput.html +4 -0
- package/src/lightning/datatable/__examples__disabled/myCustomTypePopupTable/myCustomTypePopupTable.js +17 -0
- package/src/lightning/datatable/__examples__disabled/myCustomTypePopupTable/nestedSimpleComponentParent.html +7 -0
- package/src/lightning/datatable/__examples__disabled/simpleComponentPopupNested/simpleComponentPopupNested.html +31 -0
- package/src/lightning/datatable/__examples__disabled/simpleComponentPopupNested/simpleComponentPopupNested.js +36 -0
- package/src/lightning/datatable/columnWidthManager.js +19 -16
- package/src/lightning/datatable/columns.js +90 -42
- package/src/lightning/datatable/datatable.js +571 -148
- package/src/lightning/datatable/errors.js +1 -1
- package/src/lightning/datatable/indexes.js +32 -21
- package/src/lightning/datatable/infiniteLoading.js +7 -6
- package/src/lightning/datatable/inlineEdit.js +52 -64
- package/src/lightning/datatable/keyboard.js +583 -195
- package/src/lightning/datatable/renderManager.js +21 -27
- package/src/lightning/datatable/rowLevelActions.js +5 -14
- package/src/lightning/datatable/rowSelection.js +36 -17
- package/src/lightning/datatable/rowSelectionShared.js +1 -0
- package/src/lightning/datatable/rows.js +224 -132
- package/src/lightning/datatable/rowsInlining.js +473 -0
- package/src/lightning/datatable/sort.js +40 -15
- package/src/lightning/datatable/state.js +17 -4
- package/src/lightning/datatable/templates/div/div.html +807 -91
- package/src/lightning/datatable/templates/div/div.lbc.synthetic.css +29 -3
- package/src/lightning/datatable/templates/table/table.css +29 -1
- package/src/lightning/datatable/templates/table/table.html +786 -87
- package/src/lightning/datatable/tree.js +0 -33
- package/src/lightning/datatable/utils.js +50 -0
- package/src/lightning/datatable/virtualization.js +44 -19
- package/src/lightning/datatable/wrapText.js +7 -10
- package/src/lightning/datepicker/datepicker.html +3 -1
- package/src/lightning/datepicker/datepicker.js +43 -4
- package/src/lightning/datepicker/form-element.slds.css +5 -1
- package/src/lightning/datepicker/input-text.slds.css +5 -5
- package/src/lightning/datetimepicker/datetimepicker.html +7 -1
- package/src/lightning/datetimepicker/datetimepicker.js +30 -2
- package/src/lightning/datetimepicker/form-element.slds.css +5 -1
- package/src/lightning/datetimepicker/input-text.slds.css +5 -5
- package/src/lightning/dualListbox/form-element.slds.css +5 -1
- package/src/lightning/focusTrap/focusTrap.css +7 -0
- package/src/lightning/groupedCombobox/form-element.slds.css +5 -1
- package/src/lightning/groupedCombobox/input-text.slds.css +5 -5
- package/src/lightning/helptext/button-icon.slds.css +41 -25
- package/src/lightning/helptext/form-element.slds.css +5 -1
- package/src/lightning/icon/__docs__/icon.md +0 -2
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/account_score.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/aggregate.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/app_form_participant.html +11 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/app_form_product_participant.html +12 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/cost_model.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/labels.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/list_fee.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/list_rate.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/party_profile.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/path_experiment.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/people_score.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/price_adjustment_schedule.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/price_adjustment_tier.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/program_cohort.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/program_cohort_member.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/rate_adjustment.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/record_consent.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/whatsapp.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +40 -1
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/aggregate.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/array.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/bottom_group_alignment.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/cant_sync.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/center_group_alignment.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/columns.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/fully_synced.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/inner_join.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/join.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/left_join.html +14 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/macros.html +2 -2
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/not_in_sync.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/not_saved.html +9 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/outer_join.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/path_experiment.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/program_cohort.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/program_cohort_member.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/record_consent.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/right_join.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/skill.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/sync_in_progress.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/top_group_alignment.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/account_score.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/aggregate.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/app_form_participant.html +11 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/app_form_product_participant.html +12 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/cost_model.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/labels.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/list_fee.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/list_rate.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/party_profile.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/path_experiment.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/people_score.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/price_adjustment_schedule.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/price_adjustment_tier.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/program_cohort.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/program_cohort_member.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/rate_adjustment.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/record_consent.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/whatsapp.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +40 -1
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/aggregate.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/array.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/bottom_group_alignment.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/cant_sync.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/center_group_alignment.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/columns.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/fully_synced.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/inner_join.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/join.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/left_join.html +14 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/macros.html +2 -2
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/not_in_sync.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/not_saved.html +9 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/outer_join.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/path_experiment.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/program_cohort.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/program_cohort_member.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/record_consent.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/right_join.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/skill.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/sync_in_progress.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/top_group_alignment.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/account_score.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/aggregate.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/app_form_participant.html +11 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/app_form_product_participant.html +12 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/cost_model.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/labels.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/list_fee.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/list_rate.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/party_profile.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/path_experiment.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/people_score.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/price_adjustment_schedule.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/price_adjustment_tier.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/program_cohort.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/program_cohort_member.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/rate_adjustment.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/record_consent.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/whatsapp.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/templates.js +19 -1
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/account_score.html +8 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/aggregate.html +8 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/app_form_participant.html +11 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/app_form_product_participant.html +12 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/cost_model.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/labels.html +8 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/list_fee.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/list_rate.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/party_profile.html +8 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/path_experiment.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/people_score.html +8 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/price_adjustment_schedule.html +8 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/price_adjustment_tier.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/program_cohort.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/program_cohort_member.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/rate_adjustment.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/record_consent.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/whatsapp.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/templates.js +19 -1
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +22 -1
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/aggregate.html +8 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/array.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/bottom_group_alignment.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/cant_sync.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/center_group_alignment.html +8 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/columns.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/fully_synced.html +8 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/inner_join.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/join.html +8 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/left_join.html +14 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/macros.html +2 -2
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/not_in_sync.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/not_saved.html +9 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/outer_join.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/path_experiment.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/program_cohort.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/program_cohort_member.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/record_consent.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/right_join.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/skill.html +8 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/sync_in_progress.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/top_group_alignment.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +22 -1
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/aggregate.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/array.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/bottom_group_alignment.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/cant_sync.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/center_group_alignment.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/columns.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/fully_synced.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/inner_join.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/join.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/left_join.html +14 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/macros.html +2 -2
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/not_in_sync.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/not_saved.html +9 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/outer_join.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/path_experiment.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/program_cohort.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/program_cohort_member.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/record_consent.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/right_join.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/skill.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/sync_in_progress.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/top_group_alignment.html +7 -0
- package/src/lightning/iconUtils/iconColors.js +1 -1
- package/src/lightning/input/form-element.slds.css +5 -1
- package/src/lightning/input/input.html +16 -2
- package/src/lightning/input/input.js +91 -3
- package/src/lightning/input/input.js-meta.xml +3 -0
- package/src/lightning/inputAddress/addressFormat.js +25 -11
- package/src/lightning/inputAddress/fieldsLayout.js +3 -0
- package/src/lightning/inputAddress/form-element.slds.css +5 -1
- package/src/lightning/inputAddress/input-text.slds.css +5 -5
- package/src/lightning/inputAddress/inputAddress.html +1 -1
- package/src/lightning/inputAddress/inputAddress.js +27 -11
- package/src/lightning/inputLocation/form-element.slds.css +5 -1
- package/src/lightning/inputLocation/input-text.slds.css +5 -5
- package/src/lightning/inputName/form-element.slds.css +5 -1
- package/src/lightning/inputName/input-text.slds.css +5 -5
- package/src/lightning/internationalizationLibrary/address/AddressFormat.js +2 -0
- package/src/lightning/layout/__docs__/layout.md +0 -2
- package/src/lightning/lookupAddress/form-element.slds.css +5 -1
- package/src/lightning/menuItem/menu-item.slds.css +3 -1
- package/src/lightning/modal/__modalUtils__/modalContainerTestConstants.js +7 -3
- package/src/lightning/modal/__modalUtils__/modalContainerTestMethods.js +18 -11
- package/src/lightning/modal/__modalUtils__/modalContainerTestMockData.js +1 -1
- package/src/lightning/modalBase/modalBase.css +4 -0
- package/src/lightning/modalBase/modalBase.html +16 -21
- package/src/lightning/modalBase/modalBase.js +51 -87
- package/src/lightning/modalHeader/modalHeader.html +3 -15
- package/src/lightning/modalHeader/modalHeader.js +14 -61
- package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.css +14 -0
- package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.html +55 -0
- package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.js +430 -0
- package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.js-meta.xml +4 -0
- package/src/lightning/overlayManager/overlayManager.js +16 -0
- package/src/lightning/pill/pill.js +19 -13
- package/src/lightning/pillContainer/button.slds.css +16 -15
- package/src/lightning/pillContainer/pillContainer.js +2 -1
- package/src/lightning/pillContainer/standardPillContainer.html +6 -2
- package/src/lightning/positionLibrary/direction.js +19 -0
- package/src/lightning/primitiveBubble/primitiveBubble.js +33 -11
- package/src/lightning/primitiveColorpickerButton/primitiveColorpickerButton.html +2 -2
- package/src/lightning/primitiveColorpickerButton/primitiveColorpickerButton.js +8 -0
- package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.css +34 -0
- package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.html +60 -0
- package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.js +107 -0
- package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +37 -4
- package/src/lightning/primitiveHeaderFactory/sortingMenuHeader.css +5 -0
- package/src/lightning/primitiveHeaderFactory/sortingMenuHeader.html +9 -0
- package/src/lightning/primitiveInputCheckbox/form-element.slds.css +5 -1
- package/src/lightning/primitiveInputCheckbox/input-checkbox.slds.css +3 -3
- package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.html +1 -1
- package/src/lightning/primitiveInputCheckboxButton/form-element.slds.css +5 -1
- package/src/lightning/primitiveInputCheckboxButton/input-checkbox-button.slds.css +6 -5
- package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.html +1 -1
- package/src/lightning/primitiveInputColor/form-element.slds.css +5 -1
- package/src/lightning/primitiveInputColor/input-text.slds.css +5 -5
- package/src/lightning/primitiveInputColor/primitiveInputColor.html +5 -2
- package/src/lightning/primitiveInputColor/primitiveInputColor.js +2 -0
- package/src/lightning/primitiveInputFile/button.slds.css +16 -15
- package/src/lightning/primitiveInputFile/form-element.slds.css +5 -1
- package/src/lightning/primitiveInputFile/primitiveInputFile.html +1 -1
- package/src/lightning/primitiveInputRadio/primitiveInputRadio.html +1 -1
- package/src/lightning/primitiveInputSimple/form-element.slds.css +5 -1
- package/src/lightning/primitiveInputSimple/input-text.slds.css +5 -5
- package/src/lightning/primitiveInputSimple/primitiveInputSimple.html +3 -2
- package/src/lightning/primitiveInputSimple/primitiveInputSimple.js +15 -0
- package/src/lightning/primitiveInputToggle/form-element.slds.css +5 -1
- package/src/lightning/primitiveInputToggle/input-toggle.slds.css +16 -14
- package/src/lightning/primitiveInputToggle/primitiveInputToggle.html +1 -1
- package/src/lightning/progressBar/progress-bar.slds.css +1 -1
- package/src/lightning/progressIndicator/path.html +8 -2
- package/src/lightning/progressIndicator/progressIndicator.js +26 -2
- package/src/lightning/progressRing/progress-ring.slds.css +1 -1
- package/src/lightning/progressStep/progressStep.js +2 -1
- package/src/lightning/prompt/prompt.js +11 -9
- package/src/lightning/radioGroup/form-element.slds.css +5 -1
- package/src/lightning/radioGroup/input-radio-group.slds.css +4 -10
- package/src/lightning/select/form-element.slds.css +5 -1
- package/src/lightning/select/select.js +89 -7
- package/src/lightning/tabBar/tab-bar.slds.css +11 -0
- package/src/lightning/tabset/tabset.slds.css +1 -1
- package/src/lightning/textarea/__examples__/various/various.html +18 -1
- package/src/lightning/textarea/form-element.slds.css +5 -1
- package/src/lightning/textarea/textarea.html +1 -0
- package/src/lightning/textarea/textarea.js +25 -0
- package/src/lightning/textarea/textarea.slds.css +2 -2
- package/src/lightning/timepicker/form-element.slds.css +5 -1
- package/src/lightning/timepicker/timepicker.html +4 -1
- package/src/lightning/timepicker/timepicker.js +3 -0
- package/src/lightning/toast/button-icon.slds.css +41 -25
- package/src/lightning/tooltipLibrary/tooltipLibrary.js +4 -15
- package/src/lightning/verticalNavigationItem/vertical-navigation-item.slds.css +1 -1
- package/src/lightning/verticalNavigationItemBadge/badge.slds.css +1 -1
- package/src/lightning/verticalNavigationItemBadge/vertical-navigation-item.slds.css +1 -1
- package/src/lightning/verticalNavigationItemIcon/vertical-navigation-item.slds.css +1 -1
- package/src/lightning/verticalNavigationOverflow/button.slds.css +16 -15
- package/src/lightning/verticalNavigationOverflow/vertical-navigation-item.slds.css +1 -1
- package/scopedImports/@salesforce-label-LightningLookup.messageWhenSearchTermTooShort.js +0 -1
- package/src/lightning/datatable/columns-shared.js +0 -12
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { getShadowActiveElements, isRTL } from 'lightning/utilsPrivate';
|
|
2
|
-
import { getCellFromIndexes, HEADER_ROW_KEY, getRowByKey } from './indexes';
|
|
3
1
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '
|
|
8
|
-
import {
|
|
9
|
-
|
|
2
|
+
getShadowActiveElements,
|
|
3
|
+
isRTL,
|
|
4
|
+
keyCodes,
|
|
5
|
+
} from 'lightning/utilsPrivate';
|
|
6
|
+
import {
|
|
7
|
+
getCellByKeys,
|
|
8
|
+
getCellFromIndexes,
|
|
9
|
+
HEADER_ROW_KEY,
|
|
10
|
+
isValidCell,
|
|
11
|
+
} from './indexes';
|
|
12
|
+
import { fireRowToggleEvent } from './tree';
|
|
10
13
|
import { findFirstVisibleIndex } from './virtualization';
|
|
11
14
|
import { getColDataSelector, getRowDataSelector, getScrollerY } from './utils';
|
|
12
15
|
|
|
@@ -190,7 +193,7 @@ function reactToKeyboardInNavMode(dt, event) {
|
|
|
190
193
|
|
|
191
194
|
function reactToArrowLeft(state, template, event) {
|
|
192
195
|
const { rowKeyValue, colKeyValue } = event.detail;
|
|
193
|
-
const { colIndex } =
|
|
196
|
+
const { colIndex } = getCellByKeys(state, rowKeyValue, colKeyValue);
|
|
194
197
|
// Move from navigation mode to row mode when user
|
|
195
198
|
// arrows left when in nav mode and on the first column
|
|
196
199
|
if (colIndex === 0 && canBeRowNavigationMode(state)) {
|
|
@@ -209,13 +212,11 @@ function reactToArrowLeft(state, template, event) {
|
|
|
209
212
|
setBlurActiveCell(state, template);
|
|
210
213
|
// Untracked state change.
|
|
211
214
|
// Update activeCell.
|
|
212
|
-
state.activeCell =
|
|
215
|
+
state.activeCell = getCellByKeys(
|
|
216
|
+
state,
|
|
213
217
|
rowKeyValue,
|
|
214
|
-
colKeyValue
|
|
215
|
-
|
|
216
|
-
nextColIndex
|
|
217
|
-
),
|
|
218
|
-
};
|
|
218
|
+
state.columns[nextColIndex].colKeyValue
|
|
219
|
+
);
|
|
219
220
|
// Tracked state change.
|
|
220
221
|
setFocusActiveCell(state, template, NAVIGATION_DIR.LEFT);
|
|
221
222
|
}
|
|
@@ -223,7 +224,7 @@ function reactToArrowLeft(state, template, event) {
|
|
|
223
224
|
|
|
224
225
|
function reactToArrowRight(state, template, event) {
|
|
225
226
|
const { rowKeyValue, colKeyValue } = event.detail;
|
|
226
|
-
const { colIndex } =
|
|
227
|
+
const { colIndex } = getCellByKeys(state, rowKeyValue, colKeyValue);
|
|
227
228
|
const nextColIndex = getNextIndexRight(state, colIndex);
|
|
228
229
|
if (nextColIndex === undefined) {
|
|
229
230
|
return;
|
|
@@ -231,19 +232,17 @@ function reactToArrowRight(state, template, event) {
|
|
|
231
232
|
setBlurActiveCell(state, template);
|
|
232
233
|
// Untracked state change.
|
|
233
234
|
// Update activeCell.
|
|
234
|
-
state.activeCell =
|
|
235
|
+
state.activeCell = getCellByKeys(
|
|
236
|
+
state,
|
|
235
237
|
rowKeyValue,
|
|
236
|
-
colKeyValue
|
|
237
|
-
|
|
238
|
-
nextColIndex
|
|
239
|
-
),
|
|
240
|
-
};
|
|
238
|
+
state.columns[nextColIndex].colKeyValue
|
|
239
|
+
);
|
|
241
240
|
setFocusActiveCell(state, template, NAVIGATION_DIR.RIGHT);
|
|
242
241
|
}
|
|
243
242
|
|
|
244
243
|
function reactToArrowUp(state, template, event) {
|
|
245
244
|
const { rowKeyValue, colKeyValue, keyEvent } = event.detail;
|
|
246
|
-
const { rowIndex } =
|
|
245
|
+
const { rowIndex } = getCellByKeys(state, rowKeyValue, colKeyValue);
|
|
247
246
|
const nextRowIndex = getNextIndexUp(state, rowIndex);
|
|
248
247
|
if (
|
|
249
248
|
nextRowIndex === undefined ||
|
|
@@ -259,18 +258,18 @@ function reactToArrowUp(state, template, event) {
|
|
|
259
258
|
setBlurActiveCell(state, template);
|
|
260
259
|
// Untracked state change.
|
|
261
260
|
// Update activeCell.
|
|
262
|
-
state.activeCell =
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
colKeyValue
|
|
266
|
-
|
|
261
|
+
state.activeCell = getCellByKeys(
|
|
262
|
+
state,
|
|
263
|
+
nextRowIndex === -1 ? HEADER_ROW_KEY : state.rows[nextRowIndex].key,
|
|
264
|
+
colKeyValue
|
|
265
|
+
);
|
|
267
266
|
// Tracked state change.
|
|
268
267
|
setFocusActiveCell(state, template, NAVIGATION_DIR.USE_CURRENT);
|
|
269
268
|
}
|
|
270
269
|
|
|
271
270
|
function reactToArrowDown(state, template, event) {
|
|
272
271
|
const { rowKeyValue, colKeyValue, keyEvent } = event.detail;
|
|
273
|
-
const { rowIndex } =
|
|
272
|
+
const { rowIndex } = getCellByKeys(state, rowKeyValue, colKeyValue);
|
|
274
273
|
const nextRowIndex = getNextIndexDown(state, rowIndex);
|
|
275
274
|
if (
|
|
276
275
|
nextRowIndex === undefined ||
|
|
@@ -286,11 +285,12 @@ function reactToArrowDown(state, template, event) {
|
|
|
286
285
|
setBlurActiveCell(state, template);
|
|
287
286
|
// Untracked state change.
|
|
288
287
|
// Update activeCell.
|
|
289
|
-
state.activeCell =
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
colKeyValue
|
|
293
|
-
|
|
288
|
+
state.activeCell = getCellByKeys(
|
|
289
|
+
state,
|
|
290
|
+
nextRowIndex === -1 ? HEADER_ROW_KEY : state.rows[nextRowIndex].key,
|
|
291
|
+
colKeyValue
|
|
292
|
+
);
|
|
293
|
+
// Tracked state change.
|
|
294
294
|
setFocusActiveCell(state, template, NAVIGATION_DIR.USE_CURRENT);
|
|
295
295
|
}
|
|
296
296
|
|
|
@@ -299,7 +299,7 @@ function reactToEnter(state, template, event) {
|
|
|
299
299
|
// Untracked state change.
|
|
300
300
|
state.keyboardMode = KEYBOARD_ACTION_MODE;
|
|
301
301
|
const { keyCode, keyEvent } = event.detail;
|
|
302
|
-
const { rowIndex, colIndex } =
|
|
302
|
+
const { rowIndex, colIndex } = state.activeCell;
|
|
303
303
|
if (keyEvent) {
|
|
304
304
|
keyEvent.preventDefault();
|
|
305
305
|
}
|
|
@@ -372,14 +372,11 @@ export function reactToTabForward(state, template) {
|
|
|
372
372
|
setBlurActiveCell(state, template);
|
|
373
373
|
// Untracked state change.
|
|
374
374
|
// Update activeCell.
|
|
375
|
-
state.activeCell =
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
colKeyValue
|
|
379
|
-
|
|
380
|
-
nextColIndex
|
|
381
|
-
),
|
|
382
|
-
};
|
|
375
|
+
state.activeCell = getCellByKeys(
|
|
376
|
+
state,
|
|
377
|
+
nextRowIndex === -1 ? HEADER_ROW_KEY : state.rows[nextRowIndex].key,
|
|
378
|
+
state.columns[nextColIndex].colKeyValue
|
|
379
|
+
);
|
|
383
380
|
// Tracked state change.
|
|
384
381
|
setFocusActiveCell(state, template, NAVIGATION_DIR.TAB_FORWARD, {
|
|
385
382
|
action: 'tab',
|
|
@@ -392,14 +389,11 @@ export function reactToTabBackward(state, template) {
|
|
|
392
389
|
setBlurActiveCell(state, template);
|
|
393
390
|
// Untracked state change.
|
|
394
391
|
// Update activeCell.
|
|
395
|
-
state.activeCell =
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
colKeyValue
|
|
399
|
-
|
|
400
|
-
nextColIndex
|
|
401
|
-
),
|
|
402
|
-
};
|
|
392
|
+
state.activeCell = getCellByKeys(
|
|
393
|
+
state,
|
|
394
|
+
nextRowIndex === -1 ? HEADER_ROW_KEY : state.rows[nextRowIndex].key,
|
|
395
|
+
state.columns[nextColIndex].colKeyValue
|
|
396
|
+
);
|
|
403
397
|
// Tracked state change.
|
|
404
398
|
setFocusActiveCell(state, template, NAVIGATION_DIR.TAB_BACKWARD, {
|
|
405
399
|
action: 'tab',
|
|
@@ -417,7 +411,7 @@ function getTabDirection(shiftKey) {
|
|
|
417
411
|
* @returns {Object} - nextRowIndex, nextColIndex values, isExitCell boolean
|
|
418
412
|
*/
|
|
419
413
|
function getNextIndexOnTab(state, direction = 'FORWARD') {
|
|
420
|
-
const { rowIndex, colIndex } =
|
|
414
|
+
const { rowIndex, colIndex } = state.activeCell;
|
|
421
415
|
// decide which function to use based on the value of direction
|
|
422
416
|
return direction === 'BACKWARD'
|
|
423
417
|
? getNextIndexOnTabBackward(state, rowIndex, colIndex)
|
|
@@ -505,24 +499,21 @@ function reactToArrowLeftOnRow(dt, state, template, event) {
|
|
|
505
499
|
if (rowHasChildren && rowExpanded) {
|
|
506
500
|
fireRowToggleEvent(dt, rowKeyValue, rowExpanded);
|
|
507
501
|
} else if (rowLevel > 1) {
|
|
508
|
-
const treeColumn =
|
|
502
|
+
const { treeColumn } = state;
|
|
509
503
|
if (treeColumn) {
|
|
510
504
|
const { colKeyValue } = treeColumn;
|
|
511
|
-
const { rowIndex } =
|
|
512
|
-
state,
|
|
513
|
-
rowKeyValue,
|
|
514
|
-
colKeyValue
|
|
515
|
-
);
|
|
505
|
+
const { rowIndex } = getCellByKeys(state, rowKeyValue, colKeyValue);
|
|
516
506
|
const parentIndex = getRowParentIndex(state, rowLevel, rowIndex);
|
|
517
507
|
if (parentIndex !== -1) {
|
|
518
508
|
// Tracked state change.
|
|
519
509
|
setBlurActiveRow(state, template);
|
|
520
510
|
// Untracked state change.
|
|
521
511
|
// Update activeCell for the row.
|
|
522
|
-
state.activeCell =
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
512
|
+
state.activeCell = getCellByKeys(
|
|
513
|
+
state,
|
|
514
|
+
state.rows[parentIndex].key,
|
|
515
|
+
colKeyValue
|
|
516
|
+
);
|
|
526
517
|
// Tracked state change.
|
|
527
518
|
setFocusActiveRow(state, template);
|
|
528
519
|
}
|
|
@@ -552,24 +543,25 @@ function reactToArrowRightOnRow(dt, state, template, event) {
|
|
|
552
543
|
function reactToArrowUpOnRow(state, template, event) {
|
|
553
544
|
// Move tabIndex 0 one row down.
|
|
554
545
|
const { rowKeyValue, keyEvent } = event.detail;
|
|
555
|
-
const treeColumn =
|
|
546
|
+
const { treeColumn } = state;
|
|
556
547
|
|
|
557
548
|
keyEvent.stopPropagation();
|
|
558
549
|
keyEvent.preventDefault();
|
|
559
550
|
|
|
560
551
|
if (treeColumn) {
|
|
561
552
|
const { colKeyValue } = treeColumn;
|
|
562
|
-
const { rowIndex } =
|
|
553
|
+
const { rowIndex } = getCellByKeys(state, rowKeyValue, colKeyValue);
|
|
563
554
|
const prevRowIndex = getNextIndexUpWrapped(state, rowIndex);
|
|
564
555
|
if (prevRowIndex !== -1) {
|
|
565
556
|
// Tracked state change.
|
|
566
557
|
setBlurActiveRow(state, template);
|
|
567
558
|
// Untracked state change.
|
|
568
559
|
// Update activeCell for the row.
|
|
569
|
-
state.activeCell =
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
560
|
+
state.activeCell = getCellByKeys(
|
|
561
|
+
state,
|
|
562
|
+
state.rows[prevRowIndex].key,
|
|
563
|
+
colKeyValue
|
|
564
|
+
);
|
|
573
565
|
// Tracked state change.
|
|
574
566
|
setFocusActiveRow(state, template);
|
|
575
567
|
}
|
|
@@ -579,24 +571,25 @@ function reactToArrowUpOnRow(state, template, event) {
|
|
|
579
571
|
function reactToArrowDownOnRow(state, template, event) {
|
|
580
572
|
// Move tabIndex 0 one row down.
|
|
581
573
|
const { rowKeyValue, keyEvent } = event.detail;
|
|
582
|
-
const treeColumn =
|
|
574
|
+
const { treeColumn } = state;
|
|
583
575
|
|
|
584
576
|
keyEvent.stopPropagation();
|
|
585
577
|
keyEvent.preventDefault();
|
|
586
578
|
|
|
587
579
|
if (treeColumn) {
|
|
588
580
|
const { colKeyValue } = treeColumn;
|
|
589
|
-
const { rowIndex } =
|
|
581
|
+
const { rowIndex } = getCellByKeys(state, rowKeyValue, colKeyValue);
|
|
590
582
|
const nextRowIndex = getNextIndexDownWrapped(state, rowIndex);
|
|
591
583
|
if (nextRowIndex !== -1) {
|
|
592
584
|
// Tracked state change.
|
|
593
585
|
setBlurActiveRow(state, template);
|
|
594
586
|
// Untracked state change.
|
|
595
587
|
// Update activeCell for the row.
|
|
596
|
-
state.activeCell =
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
588
|
+
state.activeCell = getCellByKeys(
|
|
589
|
+
state,
|
|
590
|
+
state.rows[nextRowIndex].key,
|
|
591
|
+
colKeyValue
|
|
592
|
+
);
|
|
600
593
|
// Tracked state change.
|
|
601
594
|
setFocusActiveRow(state, template);
|
|
602
595
|
}
|
|
@@ -622,10 +615,11 @@ function getDefaultActiveCell(state) {
|
|
|
622
615
|
colIndex = 0;
|
|
623
616
|
}
|
|
624
617
|
const { rows } = state;
|
|
625
|
-
return
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
618
|
+
return getCellByKeys(
|
|
619
|
+
state,
|
|
620
|
+
rows.length > 0 ? rows[0].key : HEADER_ROW_KEY,
|
|
621
|
+
columns[colIndex].colKeyValue
|
|
622
|
+
);
|
|
629
623
|
}
|
|
630
624
|
|
|
631
625
|
return undefined;
|
|
@@ -645,12 +639,12 @@ function setDefaultActiveCell(state) {
|
|
|
645
639
|
export function getActiveCellElement(template, state) {
|
|
646
640
|
const { activeCell } = state;
|
|
647
641
|
return activeCell
|
|
648
|
-
?
|
|
642
|
+
? getCellElement(
|
|
649
643
|
template,
|
|
650
644
|
activeCell.rowKeyValue,
|
|
651
645
|
activeCell.colKeyValue
|
|
652
646
|
)
|
|
653
|
-
:
|
|
647
|
+
: undefined;
|
|
654
648
|
}
|
|
655
649
|
|
|
656
650
|
/**
|
|
@@ -744,7 +738,7 @@ function setNextActiveCellFromPrev(state) {
|
|
|
744
738
|
*/
|
|
745
739
|
export function isActiveCellAnExitCell(state, direction) {
|
|
746
740
|
// get next tab index values
|
|
747
|
-
const { rowIndex, colIndex } =
|
|
741
|
+
const { rowIndex, colIndex } = state.activeCell;
|
|
748
742
|
const { nextRowIndex, nextColIndex } = getNextIndexOnTab(state, direction);
|
|
749
743
|
// is it an exit cell?
|
|
750
744
|
if (
|
|
@@ -762,25 +756,24 @@ export function isActiveCellAnExitCell(state, direction) {
|
|
|
762
756
|
return false;
|
|
763
757
|
}
|
|
764
758
|
|
|
765
|
-
export function getIndexesActiveCell(state) {
|
|
766
|
-
const {
|
|
767
|
-
activeCell: { rowKeyValue, colKeyValue },
|
|
768
|
-
} = state;
|
|
769
|
-
return getIndexesByKeys(state, rowKeyValue, colKeyValue);
|
|
770
|
-
}
|
|
771
|
-
|
|
772
759
|
function setModeActiveCell(state, template, info) {
|
|
773
760
|
const cellElement = getActiveCellElement(template, state);
|
|
774
|
-
|
|
775
|
-
|
|
761
|
+
const cellElementChild = getCellElementChild(cellElement);
|
|
762
|
+
if (cellElementChild) {
|
|
763
|
+
const { keyboardMode } = state;
|
|
764
|
+
if (typeof cellElementChild.setMode === 'function') {
|
|
765
|
+
cellElementChild.setMode(keyboardMode, info);
|
|
766
|
+
} else {
|
|
767
|
+
// Tracked state change.
|
|
768
|
+
setMode(state.activeCell, cellElementChild, keyboardMode, info);
|
|
769
|
+
}
|
|
776
770
|
}
|
|
777
771
|
}
|
|
778
772
|
|
|
779
773
|
function stillValidActiveCell(state) {
|
|
780
774
|
const { activeCell, indexes } = state;
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
if (state.rows.length) {
|
|
775
|
+
if (activeCell) {
|
|
776
|
+
if (activeCell.rowKeyValue === HEADER_ROW_KEY && state.rows.length) {
|
|
784
777
|
const { columns } = state;
|
|
785
778
|
let sortable = false;
|
|
786
779
|
for (let colIndex = 0; colIndex < columns.length; colIndex += 1) {
|
|
@@ -793,9 +786,383 @@ function stillValidActiveCell(state) {
|
|
|
793
786
|
return false;
|
|
794
787
|
}
|
|
795
788
|
}
|
|
796
|
-
|
|
789
|
+
const indexedCell = indexes[activeCell.cellKeyValue];
|
|
790
|
+
// reset activeCell in case the rowIndex changed
|
|
791
|
+
// changed but not the cellKeyValue
|
|
792
|
+
if (indexedCell) {
|
|
793
|
+
state.activeCell = indexedCell;
|
|
794
|
+
}
|
|
795
|
+
return indexedCell !== undefined;
|
|
796
|
+
}
|
|
797
|
+
return false;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
/***************************** CELL ELEMENT *****************************/
|
|
801
|
+
|
|
802
|
+
export function getCellElement(template, rowKeyValue, colKeyValue) {
|
|
803
|
+
const cellElement = template.querySelector(
|
|
804
|
+
`${getRowDataSelector(rowKeyValue)} ${getColDataSelector(colKeyValue)}`
|
|
805
|
+
);
|
|
806
|
+
return cellElement || undefined;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
export function getCellElementChild(cellElement) {
|
|
810
|
+
const firstElementChild = cellElement
|
|
811
|
+
? cellElement.firstElementChild
|
|
812
|
+
: undefined;
|
|
813
|
+
/*const localName = firstElementChild ? firstElementChild.localName : '';
|
|
814
|
+
if (localName === 'span') {
|
|
815
|
+
// span wrapper
|
|
816
|
+
const cellDiv = firstElementChild.firstElementChild;
|
|
817
|
+
if (cellDiv && cellDiv.localName === 'div') {
|
|
818
|
+
// cell div
|
|
819
|
+
return cellDiv;
|
|
820
|
+
}
|
|
821
|
+
} else if (localName === 'div') {
|
|
822
|
+
// lightning-primitive-custom-cell
|
|
823
|
+
return firstElementChild.firstElementChild;
|
|
824
|
+
}*/
|
|
825
|
+
// lightning-primitive-cell-factory or checkbox cell span
|
|
826
|
+
return firstElementChild;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
export function getCellElementFromEventTarget(target) {
|
|
830
|
+
const cellElement = target.closest(
|
|
831
|
+
'[role="gridcell"],[role="columnheader"],[role="rowheader"]'
|
|
832
|
+
);
|
|
833
|
+
return cellElement || undefined;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
/***************************** PRIMITIVE CELL METHODS *****************************/
|
|
837
|
+
|
|
838
|
+
function canMoveBackward(cell) {
|
|
839
|
+
return cell.currentInputIndex > 0;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
function canMoveForward(cell) {
|
|
843
|
+
const { actionableElementsCount } = cell;
|
|
844
|
+
return (
|
|
845
|
+
actionableElementsCount > 1 &&
|
|
846
|
+
cell.currentInputIndex < actionableElementsCount - 1
|
|
847
|
+
);
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
function canMoveLeft(cell) {
|
|
851
|
+
return isRTL() ? canMoveForward(cell) : canMoveBackward(cell);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
function canMoveRight(cell) {
|
|
855
|
+
return isRTL() ? canMoveBackward(cell) : canMoveForward(cell);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
function fireCellKeydown(cell, cellElementChild, keyEvent) {
|
|
859
|
+
const { rowKeyValue, colKeyValue } = cell;
|
|
860
|
+
const { keyCode, shiftKey } = keyEvent;
|
|
861
|
+
|
|
862
|
+
cellElementChild.dispatchEvent(
|
|
863
|
+
new CustomEvent('privatecellkeydown', {
|
|
864
|
+
bubbles: true,
|
|
865
|
+
composed: true,
|
|
866
|
+
cancelable: true,
|
|
867
|
+
detail: {
|
|
868
|
+
rowKeyValue,
|
|
869
|
+
colKeyValue,
|
|
870
|
+
keyCode,
|
|
871
|
+
shiftKey,
|
|
872
|
+
keyEvent,
|
|
873
|
+
},
|
|
874
|
+
})
|
|
875
|
+
);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
function fireCellFocusByClickEvent(cell, cellElementChild) {
|
|
879
|
+
const { rowKeyValue, colKeyValue } = cell;
|
|
880
|
+
|
|
881
|
+
cellElementChild.dispatchEvent(
|
|
882
|
+
new CustomEvent('privatecellfocusedbyclick', {
|
|
883
|
+
bubbles: true,
|
|
884
|
+
composed: true,
|
|
885
|
+
detail: {
|
|
886
|
+
rowKeyValue,
|
|
887
|
+
colKeyValue,
|
|
888
|
+
},
|
|
889
|
+
})
|
|
890
|
+
);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
export function handlePrimitiveDatatableCellClick(event) {
|
|
894
|
+
const { state } = this;
|
|
895
|
+
const cellElement = state.renderModeInline
|
|
896
|
+
? getCellElementFromEventTarget(event.target)
|
|
897
|
+
: undefined;
|
|
898
|
+
|
|
899
|
+
if (cellElement) {
|
|
900
|
+
const cellElementChild = getCellElementChild(cellElement);
|
|
901
|
+
const cell = getCellByKeys(
|
|
902
|
+
state,
|
|
903
|
+
cellElement.parentElement.dataset.rowKeyValue,
|
|
904
|
+
cellElement.dataset.colKeyValue
|
|
905
|
+
);
|
|
906
|
+
fireCellFocusByClickEvent(cell, cellElementChild);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
export function handlePrimitiveDatatableCellFocus(event) {
|
|
911
|
+
const { state } = this;
|
|
912
|
+
const cellElement = state.renderModeInline
|
|
913
|
+
? getCellElementFromEventTarget(event.target)
|
|
914
|
+
: undefined;
|
|
915
|
+
|
|
916
|
+
if (cellElement) {
|
|
917
|
+
const cellElementChild = getCellElementChild(cellElement);
|
|
918
|
+
const cell = getCellByKeys(
|
|
919
|
+
this.state,
|
|
920
|
+
cellElement.parentElement.dataset.rowKeyValue,
|
|
921
|
+
cellElement.dataset.colKeyValue
|
|
922
|
+
);
|
|
923
|
+
if (cell.mode === KEYBOARD_ACTION_MODE) {
|
|
924
|
+
// Tracked state change.
|
|
925
|
+
setFocusToActionableElement(
|
|
926
|
+
cell,
|
|
927
|
+
cellElementChild,
|
|
928
|
+
cell.currentInputIndex
|
|
929
|
+
);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
export function handlePrimitiveDatatableCellKeydown(event) {
|
|
935
|
+
const { state } = this;
|
|
936
|
+
// Don't continue if clicking on a "lightning" element
|
|
937
|
+
// Or the outer td/th element and div equivalent
|
|
938
|
+
const cellElement =
|
|
939
|
+
state.renderModeInline &&
|
|
940
|
+
!event.target.shadowRoot &&
|
|
941
|
+
!event.target.getAttribute('role')
|
|
942
|
+
? getCellElementFromEventTarget(event.target)
|
|
943
|
+
: undefined;
|
|
944
|
+
|
|
945
|
+
if (cellElement === undefined) {
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
const cellElementChild = getCellElementChild(cellElement);
|
|
950
|
+
const cell = getCellByKeys(
|
|
951
|
+
this.state,
|
|
952
|
+
cellElement.parentElement.dataset.rowKeyValue,
|
|
953
|
+
cellElement.dataset.colKeyValue
|
|
954
|
+
);
|
|
955
|
+
const { mode } = cell;
|
|
956
|
+
const { keyCode, shiftKey } = event;
|
|
957
|
+
|
|
958
|
+
// if it is in Action mode, then traverse to the next or previous
|
|
959
|
+
// focusable element.
|
|
960
|
+
// if there is no focusable element, or reach outside of the range, then move to
|
|
961
|
+
// previous or next cell.
|
|
962
|
+
if (mode === KEYBOARD_ACTION_MODE) {
|
|
963
|
+
let passThroughEvent = keyCode !== keyCodes.shift;
|
|
964
|
+
if (keyCode === keyCodes.left) {
|
|
965
|
+
if (canMoveLeft(cell)) {
|
|
966
|
+
// There are still actionable element before the current one
|
|
967
|
+
// move to the previous actionable element.
|
|
968
|
+
event.preventDefault();
|
|
969
|
+
// Tracked state changes.
|
|
970
|
+
if (isRTL()) {
|
|
971
|
+
moveToNextActionableElement(cell, cellElementChild);
|
|
972
|
+
} else {
|
|
973
|
+
moveToPrevActionableElement(cell, cellElementChild);
|
|
974
|
+
}
|
|
975
|
+
passThroughEvent = false;
|
|
976
|
+
}
|
|
977
|
+
} else if (keyCode === keyCodes.right) {
|
|
978
|
+
if (canMoveRight(cell)) {
|
|
979
|
+
// There are still actionable element before the current one
|
|
980
|
+
// move to the previous actionable element.
|
|
981
|
+
event.preventDefault();
|
|
982
|
+
// Tracked state changes.
|
|
983
|
+
if (isRTL()) {
|
|
984
|
+
moveToPrevActionableElement(cell, cellElementChild);
|
|
985
|
+
} else {
|
|
986
|
+
moveToNextActionableElement(cell, cellElementChild);
|
|
987
|
+
}
|
|
988
|
+
passThroughEvent = false;
|
|
989
|
+
}
|
|
990
|
+
} else if (keyCode === keyCodes.tab) {
|
|
991
|
+
// If in action mode, try to navigate through the element inside.
|
|
992
|
+
// Always prevent the default tab behavior so that the tab will
|
|
993
|
+
// not focus outside of the table.
|
|
994
|
+
if (shiftKey) {
|
|
995
|
+
// Moving backward.
|
|
996
|
+
if (canMoveBackward(cell)) {
|
|
997
|
+
event.preventDefault();
|
|
998
|
+
// Tracked state change.
|
|
999
|
+
moveToPrevActionableElement(cell, cellElementChild);
|
|
1000
|
+
passThroughEvent = false;
|
|
1001
|
+
}
|
|
1002
|
+
} else {
|
|
1003
|
+
// Moving forward.
|
|
1004
|
+
// eslint-disable-next-line no-lonely-if
|
|
1005
|
+
if (canMoveForward(cell)) {
|
|
1006
|
+
event.preventDefault();
|
|
1007
|
+
// Tracked state change.
|
|
1008
|
+
moveToNextActionableElement(cell, cellElementChild);
|
|
1009
|
+
passThroughEvent = false;
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
if (passThroughEvent) {
|
|
1014
|
+
fireCellKeydown(cell, cellElementChild, event);
|
|
1015
|
+
}
|
|
1016
|
+
} else if (mode === KEYBOARD_NAVIGATION_MODE) {
|
|
1017
|
+
// click the header, press enter, it does not go to action mode without this code.
|
|
1018
|
+
if (
|
|
1019
|
+
keyCode === keyCodes.left ||
|
|
1020
|
+
keyCode === keyCodes.right ||
|
|
1021
|
+
keyCode === keyCodes.up ||
|
|
1022
|
+
keyCode === keyCodes.down ||
|
|
1023
|
+
keyCode === keyCodes.enter
|
|
1024
|
+
) {
|
|
1025
|
+
fireCellKeydown(cell, cellElementChild, event);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
function getActionableElements(cellElementChild) {
|
|
1031
|
+
const result = Array.from(
|
|
1032
|
+
cellElementChild.querySelectorAll('[data-navigation="enable"]')
|
|
1033
|
+
);
|
|
1034
|
+
|
|
1035
|
+
const customType = cellElementChild.querySelector(
|
|
1036
|
+
'lightning-primitive-custom-cell'
|
|
1037
|
+
);
|
|
1038
|
+
|
|
1039
|
+
if (customType) {
|
|
1040
|
+
const wrapperActionableElements = customType.getActionableElements();
|
|
1041
|
+
wrapperActionableElements.forEach((elem) => result.push(elem));
|
|
1042
|
+
}
|
|
1043
|
+
return result;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
function moveToNextActionableElement(cell, cellElementChild) {
|
|
1047
|
+
// Tracked state change.
|
|
1048
|
+
setFocusToActionableElement(
|
|
1049
|
+
cell,
|
|
1050
|
+
cellElementChild,
|
|
1051
|
+
cell.currentInputIndex + 1
|
|
1052
|
+
);
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
function moveToPrevActionableElement(cell, cellElementChild) {
|
|
1056
|
+
// Tracked state change.
|
|
1057
|
+
setFocusToActionableElement(
|
|
1058
|
+
cell,
|
|
1059
|
+
cellElementChild,
|
|
1060
|
+
cell.currentInputIndex - 1
|
|
1061
|
+
);
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* method to resetCurrentInputIndex when navigating from cell-to-cell
|
|
1066
|
+
* called in navigation or action mode
|
|
1067
|
+
*
|
|
1068
|
+
* @param {Object} cell - The tracked datatable cell
|
|
1069
|
+
* @param {Object} cellElementChild - The cell element child
|
|
1070
|
+
* @param {number} direction -1, 1, 2
|
|
1071
|
+
* @param {string} incomingMode is the new mode, needed because a cell can be in action mode but new mode being
|
|
1072
|
+
* set can be navigation mode
|
|
1073
|
+
*/
|
|
1074
|
+
function resetCurrentInputIndex(
|
|
1075
|
+
cell,
|
|
1076
|
+
cellElementChild,
|
|
1077
|
+
direction,
|
|
1078
|
+
incomingMode
|
|
1079
|
+
) {
|
|
1080
|
+
// Tracked state changes.
|
|
1081
|
+
if (direction === -1) {
|
|
1082
|
+
const { length } = getActionableElements(cellElementChild);
|
|
1083
|
+
cell.currentInputIndex = length ? length - 1 : 0;
|
|
1084
|
+
} else if (direction === 1 || direction === 2) {
|
|
1085
|
+
cell.currentInputIndex = 0;
|
|
1086
|
+
}
|
|
1087
|
+
// when esc is pressed on a cell to enter navigation mode, other cells are still
|
|
1088
|
+
// in action mode till we call setMode above. So need to check new incoming mode too if action mode
|
|
1089
|
+
// otherwise we try to focus on an inner element with delegatesFocus and tabIndex -1 and
|
|
1090
|
+
// it moves focus out of table
|
|
1091
|
+
if (
|
|
1092
|
+
incomingMode === KEYBOARD_ACTION_MODE &&
|
|
1093
|
+
cell.mode === KEYBOARD_ACTION_MODE
|
|
1094
|
+
) {
|
|
1095
|
+
// Tracked state change.
|
|
1096
|
+
setFocusToActionableElement(
|
|
1097
|
+
cell,
|
|
1098
|
+
cellElementChild,
|
|
1099
|
+
cell.currentInputIndex
|
|
1100
|
+
);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
function setFocusToActionableElement(cell, cellElementChild, activeInputIndex) {
|
|
1105
|
+
const actionableElements = getActionableElements(cellElementChild);
|
|
1106
|
+
const { length: actionableElementsLength } = actionableElements;
|
|
1107
|
+
// Tracked state changes.
|
|
1108
|
+
cell.actionableElementsCount = actionableElementsLength;
|
|
1109
|
+
if (actionableElementsLength) {
|
|
1110
|
+
if (
|
|
1111
|
+
activeInputIndex > 0 &&
|
|
1112
|
+
activeInputIndex < actionableElementsLength
|
|
1113
|
+
) {
|
|
1114
|
+
// try to locate to the previous active index of previous row.
|
|
1115
|
+
actionableElements[activeInputIndex].focus();
|
|
1116
|
+
cell.currentInputIndex = activeInputIndex;
|
|
1117
|
+
} else {
|
|
1118
|
+
actionableElements[0].focus();
|
|
1119
|
+
cell.currentInputIndex = 0;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
// TODO: Fire event back to the datatable, so that the activeInputIndex can be
|
|
1123
|
+
// stored in the datatable level state. So that when user use up and down arrow to
|
|
1124
|
+
// navigate through the datatable in ACTION mode, we can remember the active input position
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
function setMode(cell, cellElementChild, keyboardMode, info) {
|
|
1128
|
+
const normalizedInfo = info || { action: 'none' };
|
|
1129
|
+
// Tracked state changes.
|
|
1130
|
+
cell.mode = keyboardMode;
|
|
1131
|
+
if (keyboardMode === KEYBOARD_ACTION_MODE) {
|
|
1132
|
+
cell.internalTabIndex = 0;
|
|
1133
|
+
// focus without changing tabIndex doesn't work W-6185168
|
|
1134
|
+
// eslint-disable-next-line @lwc/lwc/no-async-operation
|
|
1135
|
+
setTimeout(() => {
|
|
1136
|
+
setFocusToActionableElement(
|
|
1137
|
+
cell,
|
|
1138
|
+
cellElementChild,
|
|
1139
|
+
cell.currentInputIndex
|
|
1140
|
+
);
|
|
1141
|
+
}, 0);
|
|
1142
|
+
|
|
1143
|
+
const actionableElements = getActionableElements(cellElementChild);
|
|
1144
|
+
const { length: actionableElementsLength } = actionableElements;
|
|
1145
|
+
|
|
1146
|
+
// check if we have an edit button first (tab should open the inline edit)
|
|
1147
|
+
if (normalizedInfo.action === 'tab') {
|
|
1148
|
+
for (let i = 0; i < actionableElementsLength; i += 1) {
|
|
1149
|
+
const elem = actionableElements[i];
|
|
1150
|
+
if (elem.getAttribute('data-action-edit')) {
|
|
1151
|
+
elem.click();
|
|
1152
|
+
break;
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
} else if (actionableElementsLength === 1) {
|
|
1156
|
+
const elem = actionableElements[0];
|
|
1157
|
+
const defaultActions =
|
|
1158
|
+
elem.getAttribute('data-action-triggers') || '';
|
|
1159
|
+
if (defaultActions.indexOf(normalizedInfo.action) !== -1) {
|
|
1160
|
+
elem.click();
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
} else {
|
|
1164
|
+
cell.internalTabIndex = -1;
|
|
797
1165
|
}
|
|
798
|
-
return !!(indexes[rowKeyValue] && indexes[rowKeyValue][colKeyValue]);
|
|
799
1166
|
}
|
|
800
1167
|
|
|
801
1168
|
/***************************** FOCUS MANAGEMENT *****************************/
|
|
@@ -819,10 +1186,10 @@ export function setFocusActiveCell(
|
|
|
819
1186
|
shouldScroll = true
|
|
820
1187
|
) {
|
|
821
1188
|
const { keyboardMode } = state;
|
|
822
|
-
const { rowIndex, colIndex } =
|
|
1189
|
+
const { rowIndex, colIndex } = state.activeCell;
|
|
823
1190
|
let cellElement = getActiveCellElement(template, state);
|
|
824
1191
|
|
|
825
|
-
state.activeCell.
|
|
1192
|
+
state.activeCell.hasFocus = !(info && isActiveCellValid(state));
|
|
826
1193
|
|
|
827
1194
|
updateCellTabIndex(state, rowIndex, colIndex);
|
|
828
1195
|
|
|
@@ -831,6 +1198,9 @@ export function setFocusActiveCell(
|
|
|
831
1198
|
scrollToCell(state, template, rowIndex);
|
|
832
1199
|
}
|
|
833
1200
|
|
|
1201
|
+
const rowKeyValue =
|
|
1202
|
+
cellElement && cellElement.parentElement.dataset.rowKeyValue;
|
|
1203
|
+
|
|
834
1204
|
return new Promise((resolve) => {
|
|
835
1205
|
// eslint-disable-next-line @lwc/lwc/no-async-operation
|
|
836
1206
|
setTimeout(() => {
|
|
@@ -839,24 +1209,59 @@ export function setFocusActiveCell(
|
|
|
839
1209
|
!cellElement ||
|
|
840
1210
|
!isValidCell(
|
|
841
1211
|
state,
|
|
842
|
-
|
|
843
|
-
cellElement.colKeyValue
|
|
1212
|
+
rowKeyValue,
|
|
1213
|
+
cellElement.dataset.colKeyValue
|
|
844
1214
|
)
|
|
845
1215
|
) {
|
|
846
1216
|
cellElement = getActiveCellElement(template, state);
|
|
847
1217
|
}
|
|
848
1218
|
if (cellElement) {
|
|
849
|
-
|
|
850
|
-
|
|
1219
|
+
const cellElementChild = getCellElementChild(cellElement);
|
|
1220
|
+
const { activeCell } = state;
|
|
1221
|
+
if (cellElementChild) {
|
|
1222
|
+
if (direction) {
|
|
1223
|
+
if (
|
|
1224
|
+
typeof cellElementChild.resetCurrentInputIndex ===
|
|
1225
|
+
'function'
|
|
1226
|
+
) {
|
|
1227
|
+
cellElementChild.resetCurrentInputIndex(
|
|
1228
|
+
direction,
|
|
1229
|
+
keyboardMode
|
|
1230
|
+
);
|
|
1231
|
+
} else {
|
|
1232
|
+
resetCurrentInputIndex(
|
|
1233
|
+
activeCell,
|
|
1234
|
+
cellElement,
|
|
1235
|
+
direction,
|
|
1236
|
+
keyboardMode
|
|
1237
|
+
);
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
if (typeof cellElementChild.addFocusStyles === 'function') {
|
|
1241
|
+
cellElementChild.addFocusStyles();
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
cellElement.classList.add(FOCUS_CLASS);
|
|
1245
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#parameters
|
|
1246
|
+
cellElement.focus({ preventScroll: !shouldScroll });
|
|
1247
|
+
if (cellElementChild) {
|
|
1248
|
+
if (typeof cellElementChild.setMode === 'function') {
|
|
1249
|
+
cellElementChild.setMode(keyboardMode, info);
|
|
1250
|
+
} else {
|
|
1251
|
+
setMode(
|
|
1252
|
+
activeCell,
|
|
1253
|
+
cellElementChild,
|
|
1254
|
+
keyboardMode,
|
|
1255
|
+
info
|
|
1256
|
+
);
|
|
1257
|
+
}
|
|
851
1258
|
}
|
|
852
|
-
cellElement.addFocusStyles();
|
|
853
|
-
cellElement.parentElement.classList.add(FOCUS_CLASS);
|
|
854
|
-
cellElement.parentElement.focus({
|
|
855
|
-
preventScroll: !shouldScroll,
|
|
856
|
-
});
|
|
857
|
-
cellElement.setMode(keyboardMode, info);
|
|
858
1259
|
if (shouldScroll) {
|
|
859
|
-
|
|
1260
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView#parameters
|
|
1261
|
+
cellElement.scrollIntoView({
|
|
1262
|
+
block: 'nearest',
|
|
1263
|
+
inline: 'nearest',
|
|
1264
|
+
});
|
|
860
1265
|
}
|
|
861
1266
|
}
|
|
862
1267
|
resolve();
|
|
@@ -872,10 +1277,13 @@ export function setFocusActiveCell(
|
|
|
872
1277
|
* @param {Node} template - The custom element root `this.template`
|
|
873
1278
|
*/
|
|
874
1279
|
export function setBlurActiveCell(state, template) {
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
1280
|
+
const { activeCell } = state;
|
|
1281
|
+
if (activeCell) {
|
|
1282
|
+
const { rowIndex, colIndex } = activeCell;
|
|
1283
|
+
state.activeCell.hasFocus = false;
|
|
878
1284
|
let cellElement = getActiveCellElement(template, state);
|
|
1285
|
+
const rowKeyValue =
|
|
1286
|
+
cellElement && cellElement.parentElement.dataset.rowKeyValue;
|
|
879
1287
|
// eslint-disable-next-line @lwc/lwc/no-async-operation
|
|
880
1288
|
setTimeout(() => {
|
|
881
1289
|
// check cellElement; value may have changed
|
|
@@ -883,18 +1291,31 @@ export function setBlurActiveCell(state, template) {
|
|
|
883
1291
|
!cellElement ||
|
|
884
1292
|
!isValidCell(
|
|
885
1293
|
state,
|
|
886
|
-
|
|
887
|
-
cellElement.colKeyValue
|
|
1294
|
+
rowKeyValue,
|
|
1295
|
+
cellElement.dataset.colKeyValue
|
|
888
1296
|
)
|
|
889
1297
|
) {
|
|
890
1298
|
cellElement = getActiveCellElement(template, state);
|
|
891
1299
|
}
|
|
892
1300
|
if (cellElement) {
|
|
893
|
-
|
|
894
|
-
|
|
1301
|
+
const { activeElement } = document;
|
|
1302
|
+
const cellElementChild = getCellElementChild(cellElement);
|
|
1303
|
+
if (cellElementChild) {
|
|
1304
|
+
if (
|
|
1305
|
+
typeof cellElementChild.removeFocusStyles === 'function'
|
|
1306
|
+
) {
|
|
1307
|
+
if (activeElement === cellElementChild) {
|
|
1308
|
+
cellElementChild.blur();
|
|
1309
|
+
}
|
|
1310
|
+
cellElementChild.removeFocusStyles(true);
|
|
1311
|
+
} else {
|
|
1312
|
+
state.activeCell.internalTabIndex = -1;
|
|
1313
|
+
if (cellElement.contains(activeElement)) {
|
|
1314
|
+
cellElement.blur();
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
895
1317
|
}
|
|
896
|
-
cellElement.
|
|
897
|
-
cellElement.parentElement.classList.remove(FOCUS_CLASS);
|
|
1318
|
+
cellElement.classList.remove(FOCUS_CLASS);
|
|
898
1319
|
}
|
|
899
1320
|
}, 0);
|
|
900
1321
|
updateCellTabIndex(state, rowIndex, colIndex, -1);
|
|
@@ -912,15 +1333,16 @@ export function setBlurActiveCell(state, template) {
|
|
|
912
1333
|
* @param {Object} template - The datatable element
|
|
913
1334
|
*/
|
|
914
1335
|
export function setCellToFocusFromPrev(state, template) {
|
|
1336
|
+
const { activeCell } = state;
|
|
915
1337
|
if (
|
|
916
|
-
|
|
1338
|
+
activeCell &&
|
|
917
1339
|
!state.cellToFocusNext &&
|
|
918
1340
|
datatableHasFocus(state, template)
|
|
919
1341
|
) {
|
|
920
1342
|
const { length: rowCount } = state.rows;
|
|
921
1343
|
const lastIndex = rowCount - 1;
|
|
922
1344
|
const { length: colCount } = state.columns;
|
|
923
|
-
let { rowIndex, colIndex } =
|
|
1345
|
+
let { rowIndex, colIndex } = activeCell;
|
|
924
1346
|
colIndex = 0; // default point to the first column
|
|
925
1347
|
if (rowIndex === lastIndex) {
|
|
926
1348
|
// if it is last row, make it point to its previous row
|
|
@@ -957,10 +1379,10 @@ export function updateCellToFocusFromPrev(state) {
|
|
|
957
1379
|
* @param {Node} template - The custom element template `this.template`
|
|
958
1380
|
*/
|
|
959
1381
|
export function addFocusStylesToActiveCell(state, template) {
|
|
960
|
-
state.activeCell.
|
|
1382
|
+
state.activeCell.hasFocus = true;
|
|
961
1383
|
const cellElement = getActiveCellElement(template, state);
|
|
962
1384
|
if (cellElement) {
|
|
963
|
-
cellElement.
|
|
1385
|
+
cellElement.classList.add(FOCUS_CLASS);
|
|
964
1386
|
}
|
|
965
1387
|
}
|
|
966
1388
|
|
|
@@ -974,7 +1396,7 @@ export function addFocusStylesToActiveCell(state, template) {
|
|
|
974
1396
|
* @param {Node} template - the custom element root `this.template`
|
|
975
1397
|
*/
|
|
976
1398
|
function setFocusActiveRow(state, template) {
|
|
977
|
-
const { rowIndex } =
|
|
1399
|
+
const { rowIndex } = state.activeCell;
|
|
978
1400
|
const rowElement = getActiveCellRowElement(template, state);
|
|
979
1401
|
|
|
980
1402
|
updateRowTabIndex(state, rowIndex);
|
|
@@ -993,8 +1415,8 @@ function setFocusActiveRow(state, template) {
|
|
|
993
1415
|
* @param {Node} template - The custom element root `this.template`
|
|
994
1416
|
*/
|
|
995
1417
|
function setBlurActiveRow(state, template) {
|
|
996
|
-
|
|
997
|
-
|
|
1418
|
+
const { activeCell } = state;
|
|
1419
|
+
if (activeCell) {
|
|
998
1420
|
// eslint-disable-next-line @lwc/lwc/no-async-operation
|
|
999
1421
|
setTimeout(() => {
|
|
1000
1422
|
const rowElement = getActiveCellRowElement(template, state);
|
|
@@ -1002,7 +1424,7 @@ function setBlurActiveRow(state, template) {
|
|
|
1002
1424
|
rowElement.blur();
|
|
1003
1425
|
}
|
|
1004
1426
|
}, 0);
|
|
1005
|
-
updateRowTabIndex(state, rowIndex, -1);
|
|
1427
|
+
updateRowTabIndex(state, activeCell.rowIndex, -1);
|
|
1006
1428
|
}
|
|
1007
1429
|
}
|
|
1008
1430
|
|
|
@@ -1017,7 +1439,7 @@ export function refocusCellElement(state, template, needsRefocusOnCellElement) {
|
|
|
1017
1439
|
if (needsRefocusOnCellElement) {
|
|
1018
1440
|
const cellElement = getActiveCellElement(template, state);
|
|
1019
1441
|
if (cellElement) {
|
|
1020
|
-
cellElement.
|
|
1442
|
+
cellElement.focus();
|
|
1021
1443
|
}
|
|
1022
1444
|
|
|
1023
1445
|
// setTimeout so that focusin happens and then we set state.cellClicked to true
|
|
@@ -1053,14 +1475,19 @@ export function handleDatatableFocusIn(event) {
|
|
|
1053
1475
|
// workaround for delegatesFocus issue that focusin is called when not supposed to W-6220418
|
|
1054
1476
|
if (isFocusInside(event.currentTarget)) {
|
|
1055
1477
|
if (state.activeCell && !state.rowMode) {
|
|
1056
|
-
state.activeCell.
|
|
1478
|
+
state.activeCell.hasFocus = true;
|
|
1057
1479
|
const cellElement = getActiveCellElement(this.template, state);
|
|
1058
1480
|
// we need to check because of the tree,
|
|
1059
1481
|
// at this point it may remove/change the rows/keys because opening or closing a row.
|
|
1060
1482
|
if (cellElement) {
|
|
1061
|
-
cellElement
|
|
1062
|
-
|
|
1063
|
-
|
|
1483
|
+
const cellElementChild = getCellElementChild(cellElement);
|
|
1484
|
+
if (cellElementChild) {
|
|
1485
|
+
if (typeof cellElementChild.addFocusStyles === 'function') {
|
|
1486
|
+
cellElementChild.addFocusStyles();
|
|
1487
|
+
}
|
|
1488
|
+
cellElement.tabIndex = 0;
|
|
1489
|
+
}
|
|
1490
|
+
cellElement.classList.add(FOCUS_CLASS);
|
|
1064
1491
|
}
|
|
1065
1492
|
}
|
|
1066
1493
|
resetCellClickedForFocus(state);
|
|
@@ -1086,8 +1513,14 @@ export function handleDatatableFocusOut(event) {
|
|
|
1086
1513
|
// we need to check because of the tree,
|
|
1087
1514
|
// at this point it may remove/change the rows/keys because opening or closing a row.
|
|
1088
1515
|
if (cellElement) {
|
|
1089
|
-
cellElement
|
|
1090
|
-
|
|
1516
|
+
const cellElementChild = getCellElementChild(cellElement);
|
|
1517
|
+
if (
|
|
1518
|
+
cellElementChild &&
|
|
1519
|
+
typeof cellElementChild.removeFocusStyles === 'function'
|
|
1520
|
+
) {
|
|
1521
|
+
cellElementChild.removeFocusStyles();
|
|
1522
|
+
}
|
|
1523
|
+
cellElement.classList.remove(FOCUS_CLASS);
|
|
1091
1524
|
}
|
|
1092
1525
|
}
|
|
1093
1526
|
}
|
|
@@ -1136,7 +1569,7 @@ export function updateCellTabIndex(state, rowIndex, colIndex, tabIndex = 0) {
|
|
|
1136
1569
|
*
|
|
1137
1570
|
* @param {Object} state - The datatable state
|
|
1138
1571
|
* @param {number} rowIndex - the row index
|
|
1139
|
-
* @param {number} [
|
|
1572
|
+
* @param {number} [tabIndex = 0] - the value for the tabindex
|
|
1140
1573
|
*/
|
|
1141
1574
|
export function updateRowTabIndex(state, rowIndex, tabIndex = 0) {
|
|
1142
1575
|
if (!isHeaderRow(rowIndex)) {
|
|
@@ -1179,28 +1612,6 @@ export function updateTabIndexActiveRow(state, index = 0) {
|
|
|
1179
1612
|
|
|
1180
1613
|
/***************************** INDEX COMPUTATIONS *****************************/
|
|
1181
1614
|
|
|
1182
|
-
/**
|
|
1183
|
-
* It return the indexes { rowIndex, colIndex } of a cell based of the unique cell values
|
|
1184
|
-
* rowKeyValue, colKeyValue
|
|
1185
|
-
* @param {object} state - datatable state
|
|
1186
|
-
* @param {string} rowKeyValue - the row key value
|
|
1187
|
-
* @param {string} colKeyValue - the column key value
|
|
1188
|
-
* @returns {object} - {rowIndex, colIndex}
|
|
1189
|
-
*/
|
|
1190
|
-
export function getIndexesByKeys(state, rowKeyValue, colKeyValue) {
|
|
1191
|
-
if (rowKeyValue === HEADER_ROW_KEY) {
|
|
1192
|
-
return {
|
|
1193
|
-
rowIndex: -1,
|
|
1194
|
-
colIndex: state.headerIndexes[colKeyValue],
|
|
1195
|
-
};
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
return {
|
|
1199
|
-
rowIndex: state.indexes[rowKeyValue][colKeyValue][0],
|
|
1200
|
-
colIndex: state.indexes[rowKeyValue][colKeyValue][1],
|
|
1201
|
-
};
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
1615
|
function getNextIndexUp(state, rowIndex) {
|
|
1205
1616
|
return rowIndex === -1 ? undefined : rowIndex - 1;
|
|
1206
1617
|
}
|
|
@@ -1243,10 +1654,7 @@ function getNextIndexDownWrapped(state, rowIndex) {
|
|
|
1243
1654
|
/***************************** ROW NAVIGATION MODE *****************************/
|
|
1244
1655
|
|
|
1245
1656
|
function canBeRowNavigationMode(state) {
|
|
1246
|
-
return
|
|
1247
|
-
state.keyboardMode === KEYBOARD_NAVIGATION_MODE &&
|
|
1248
|
-
hasTreeDataType(state)
|
|
1249
|
-
);
|
|
1657
|
+
return state.keyboardMode === KEYBOARD_NAVIGATION_MODE && state.treeColumn;
|
|
1250
1658
|
}
|
|
1251
1659
|
|
|
1252
1660
|
function isRowNavigationMode(state) {
|
|
@@ -1257,10 +1665,7 @@ function isRowNavigationMode(state) {
|
|
|
1257
1665
|
}
|
|
1258
1666
|
|
|
1259
1667
|
function setRowNavigationMode(state) {
|
|
1260
|
-
if (
|
|
1261
|
-
hasTreeDataType(state) &&
|
|
1262
|
-
state.keyboardMode === KEYBOARD_NAVIGATION_MODE
|
|
1263
|
-
) {
|
|
1668
|
+
if (state.treeColumn && state.keyboardMode === KEYBOARD_NAVIGATION_MODE) {
|
|
1264
1669
|
state.rowMode = true;
|
|
1265
1670
|
}
|
|
1266
1671
|
}
|
|
@@ -1276,13 +1681,12 @@ export function unsetRowNavigationMode(state) {
|
|
|
1276
1681
|
* Earlier it didn't have tree data, set rowMode to true to start
|
|
1277
1682
|
* if rowMode is false and earlier it has tree data, keep it false
|
|
1278
1683
|
* if rowMode is true and it has tree data, keep it true
|
|
1279
|
-
* @param {Boolean} hadTreeDataTypePreviously - state object
|
|
1280
1684
|
* @param {Object} state - The state object
|
|
1281
1685
|
*/
|
|
1282
|
-
export function updateRowNavigationMode(
|
|
1283
|
-
if (!
|
|
1686
|
+
export function updateRowNavigationMode(state) {
|
|
1687
|
+
if (!state.treeColumn) {
|
|
1284
1688
|
state.rowMode = false;
|
|
1285
|
-
} else if (state.rowMode === false && !hadTreeDataTypePreviously) {
|
|
1689
|
+
} else if (state.rowMode === false && !state.hadTreeDataTypePreviously) {
|
|
1286
1690
|
state.rowMode = true;
|
|
1287
1691
|
}
|
|
1288
1692
|
}
|
|
@@ -1300,13 +1704,6 @@ function isHeaderRow(rowIndex) {
|
|
|
1300
1704
|
return rowIndex === -1;
|
|
1301
1705
|
}
|
|
1302
1706
|
|
|
1303
|
-
function getCellElementByKeys(template, rowKeyValue, colKeyValue) {
|
|
1304
|
-
const selector = `${getRowDataSelector(rowKeyValue)} ${getColDataSelector(
|
|
1305
|
-
colKeyValue
|
|
1306
|
-
)} > :first-child`;
|
|
1307
|
-
return template.querySelector(selector);
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
1707
|
function getActiveCellRowElement(template, state) {
|
|
1311
1708
|
let result;
|
|
1312
1709
|
const { activeCell } = state;
|
|
@@ -1315,7 +1712,7 @@ function getActiveCellRowElement(template, state) {
|
|
|
1315
1712
|
getRowDataSelector(activeCell.rowKeyValue)
|
|
1316
1713
|
);
|
|
1317
1714
|
}
|
|
1318
|
-
return result ||
|
|
1715
|
+
return result || undefined;
|
|
1319
1716
|
}
|
|
1320
1717
|
|
|
1321
1718
|
export function getRowParentIndex(state, rowLevel, rowIndex) {
|
|
@@ -1358,21 +1755,8 @@ function scrollToCell(state, template, rowIndex) {
|
|
|
1358
1755
|
}
|
|
1359
1756
|
|
|
1360
1757
|
export function isActiveCellEditable(state) {
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
return isCellEditable(state.rows[rowIndex], state.columns[colIndex]);
|
|
1364
|
-
}
|
|
1365
|
-
return false;
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
export function isValidCell(state, rowKeyValue, colKeyValue) {
|
|
1369
|
-
if (rowKeyValue === HEADER_ROW_KEY) {
|
|
1370
|
-
return state.headerIndexes[colKeyValue] !== undefined;
|
|
1371
|
-
}
|
|
1372
|
-
const row = getRowByKey(state, rowKeyValue);
|
|
1373
|
-
const colIndex = getStateColumnIndex(state, colKeyValue);
|
|
1374
|
-
|
|
1375
|
-
return row && row.cells[colIndex];
|
|
1758
|
+
const { activeCell } = state;
|
|
1759
|
+
return activeCell ? activeCell.editable : false;
|
|
1376
1760
|
}
|
|
1377
1761
|
|
|
1378
1762
|
function isActiveCellValid(state) {
|
|
@@ -1388,16 +1772,20 @@ function isActiveCellValid(state) {
|
|
|
1388
1772
|
}
|
|
1389
1773
|
|
|
1390
1774
|
export function updateActiveCellTabIndexAfterSync(state, tabIndex = 0) {
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
updateCellTabIndex(
|
|
1775
|
+
const { activeCell } = state;
|
|
1776
|
+
if (activeCell && !isRowNavigationMode(state)) {
|
|
1777
|
+
updateCellTabIndex(
|
|
1778
|
+
state,
|
|
1779
|
+
activeCell.rowIndex,
|
|
1780
|
+
activeCell.colIndex,
|
|
1781
|
+
tabIndex
|
|
1782
|
+
);
|
|
1394
1783
|
}
|
|
1395
1784
|
}
|
|
1396
1785
|
|
|
1397
1786
|
export function updateActiveRowTabIndexAfterSync(state, tabIndex = 0) {
|
|
1398
1787
|
const { activeCell } = state;
|
|
1399
1788
|
if (activeCell && isRowNavigationMode(state)) {
|
|
1400
|
-
|
|
1401
|
-
updateRowTabIndex(state, rowIndex, tabIndex);
|
|
1789
|
+
updateRowTabIndex(state, activeCell.rowIndex, tabIndex);
|
|
1402
1790
|
}
|
|
1403
1791
|
}
|