lightning-base-components 1.14.3-alpha → 1.15.1-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 +37 -4
- package/package.json +11 -4
- package/scopedImports/@salesforce-internal-core.appVersion.js +1 -1
- package/scopedImports/@salesforce-label-LightningModalBase.cancelandclose.js +1 -0
- package/scopedImports/@salesforce-label-LightningProgressBar.progressBar.js +1 -0
- package/src/lightning/alert/__docs__/alert.md +101 -0
- package/src/lightning/alert/__examples__disabled/basic/basic.css +7 -0
- package/src/lightning/alert/__examples__disabled/basic/basic.html +8 -0
- package/src/lightning/alert/__examples__disabled/basic/basic.js +14 -0
- package/src/lightning/alert/alert.html +3 -0
- package/src/lightning/alert/alert.js +78 -0
- package/src/lightning/alert/alert.js-meta.xml +6 -0
- package/src/lightning/ariaObserver/__component__/ariaObserver.spec.js +9 -0
- package/src/lightning/ariaObserver/ariaObserver.js +24 -35
- package/src/lightning/baseFormattedText/baseFormattedText.html +6 -1
- package/src/lightning/baseFormattedText/baseFormattedText.js +5 -0
- package/src/lightning/button/__wdio__/utam/utam.html +3 -0
- package/src/lightning/button/__wdio__/utam/utam.js +3 -0
- package/src/lightning/button/__wdio__/utam/utam.spec.js +20 -0
- package/src/lightning/buttonMenu/buttonMenu.js +12 -0
- package/src/lightning/confirm/__docs__/confirm.md +100 -0
- package/src/lightning/confirm/__examples__disabled/basic/basic.css +7 -0
- package/src/lightning/confirm/__examples__disabled/basic/basic.html +8 -0
- package/src/lightning/confirm/__examples__disabled/basic/basic.js +14 -0
- package/src/lightning/confirm/confirm.html +3 -0
- package/src/lightning/confirm/confirm.js +80 -0
- package/src/lightning/confirm/confirm.js-meta.xml +6 -0
- package/src/lightning/datatable/__examples__/withInfiniteLoading/fetchDataHelper.js +21 -0
- package/src/lightning/datatable/__examples__/withInfiniteLoading/withInfiniteLoading.html +13 -0
- package/src/lightning/datatable/__examples__/withInfiniteLoading/withInfiniteLoading.js +42 -0
- package/src/lightning/datatable/__wdio__/utam/utam.html +17 -0
- package/src/lightning/datatable/__wdio__/utam/utam.js +91 -0
- package/src/lightning/datatable/__wdio__/utam/utam.spec.js +189 -0
- package/src/lightning/datatable/autoWidthStrategy.js +170 -61
- package/src/lightning/datatable/{resizer.js → columnResizer.js} +0 -0
- package/src/lightning/datatable/columnWidthManager.js +226 -44
- package/src/lightning/datatable/columns.js +166 -71
- package/src/lightning/datatable/datatable.js +136 -60
- package/src/lightning/datatable/fixedWidthStrategy.js +43 -8
- package/src/lightning/datatable/headerActions.js +2 -2
- package/src/lightning/datatable/infiniteLoading.js +100 -28
- package/src/lightning/datatable/inlineEdit.js +21 -30
- package/src/lightning/datatable/keyboard.js +166 -131
- package/src/lightning/datatable/renderManager.js +117 -122
- package/src/lightning/datatable/{datatableResizeObserver.js → resizeObserver.js} +46 -29
- package/src/lightning/datatable/resizeSensor.js +19 -3
- package/src/lightning/datatable/rowSelection.js +1 -1
- package/src/lightning/datatable/rowSelectionShared.js +33 -20
- package/src/lightning/datatable/rows.js +9 -8
- package/src/lightning/datatable/sort.js +8 -8
- package/src/lightning/datatable/state.js +14 -2
- package/src/lightning/datatable/templates/div/div.html +133 -119
- package/src/lightning/datatable/templates/table/table.html +10 -2
- package/src/lightning/datatable/tree.js +25 -0
- package/src/lightning/datatable/types.js +77 -9
- package/src/lightning/datatable/utils.js +51 -24
- package/src/lightning/datatable/virtualization.js +319 -0
- package/src/lightning/datatable/widthManagerShared.js +27 -3
- package/src/lightning/datatable/wrapText.js +115 -48
- package/src/lightning/datepicker/__perf__DISABLED/datepickerWithCalendarOpen.perf.js +55 -0
- package/src/lightning/formattedDateTime/__docs__/formattedDateTime.md +36 -3
- package/src/lightning/formattedDateTime/__examples__/datetime/datetime.html +2 -2
- package/src/lightning/formattedDateTime/__examples__/datetime/datetime.js +3 -1
- package/src/lightning/formattedDateTime/__examples__/time/time.html +1 -1
- package/src/lightning/formattedDateTime/__examples__/time/time.js +3 -1
- package/src/lightning/formattedDateTime/formattedDateTime.js +1 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/dashboard_component.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/slack.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/tableau.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/travel_mode.html +2 -2
- package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +8 -1
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/data_model.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/serialized_product.html +1 -1
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/serialized_product_transaction.html +2 -1
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/slack.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/tableau.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/video_off.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/dashboard_component.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/slack.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/tableau.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/travel_mode.html +2 -2
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +8 -1
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/data_model.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/serialized_product.html +1 -1
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/serialized_product_transaction.html +2 -1
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/slack.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/tableau.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/video_off.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/dashboard_component.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/slack.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/tableau.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/travel_mode.html +2 -2
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/templates.js +4 -1
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/dashboard_component.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/slack.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/tableau.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/travel_mode.html +2 -2
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/templates.js +4 -1
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +5 -1
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/data_model.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/serialized_product.html +1 -1
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/serialized_product_transaction.html +2 -1
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/slack.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/tableau.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/video_off.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +5 -1
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/data_model.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/serialized_product.html +1 -1
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/serialized_product_transaction.html +2 -1
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/slack.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/tableau.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/video_off.html +7 -0
- package/src/lightning/input/__docs__/input.md +2 -0
- package/src/lightning/input/input.html +2 -5
- package/src/lightning/interactiveDialogBase/interactiveDialogBase.css +494 -0
- package/src/lightning/interactiveDialogBase/interactiveDialogBase.html +63 -0
- package/src/lightning/interactiveDialogBase/interactiveDialogBase.js +200 -0
- package/src/lightning/menuItem/menuItem.js +4 -1
- package/src/lightning/modalBase/modalBase.css +20 -0
- package/src/lightning/modalBase/modalBase.html +54 -0
- package/src/lightning/modalBase/modalBase.js +1039 -0
- package/src/lightning/overlay/__docs__/overlay.md +90 -0
- package/src/lightning/overlay/__examples__/alert/alert.html +27 -0
- package/src/lightning/overlay/__examples__/alert/alert.js +33 -0
- package/src/lightning/overlay/__examples__/basic/basic.css +7 -0
- package/src/lightning/overlay/__examples__/basic/basic.html +18 -0
- package/src/lightning/overlay/__examples__/basic/basic.js +61 -0
- package/src/lightning/overlay/__examples__/demo/demo.html +29 -0
- package/src/lightning/overlay/__examples__/demo/demo.js +40 -0
- package/src/lightning/overlay/__examples__/panel/panel.html +17 -0
- package/src/lightning/overlay/__examples__/panel/panel.js +21 -0
- package/src/lightning/overlay/overlay.html +3 -0
- package/src/lightning/overlay/overlay.js +45 -0
- package/src/lightning/overlayContainer/__docs__/overlayContainer.md +0 -0
- package/src/lightning/overlayContainer/overlayContainer.html +3 -0
- package/src/lightning/overlayContainer/overlayContainer.js +138 -0
- package/src/lightning/overlayManager/overlayManager.js +54 -0
- package/src/lightning/overlayUtils/overlayUtils.js +17 -0
- package/src/lightning/progressBar/progressBar.html +2 -1
- package/src/lightning/progressBar/progressBar.js +18 -1
- package/src/lightning/prompt/__docs__/prompt.md +102 -0
- package/src/lightning/prompt/__examples__disabled/basic/basic.css +7 -0
- package/src/lightning/prompt/__examples__disabled/basic/basic.html +8 -0
- package/src/lightning/prompt/__examples__disabled/basic/basic.js +15 -0
- package/src/lightning/prompt/prompt.css +81 -0
- package/src/lightning/prompt/prompt.html +8 -0
- package/src/lightning/prompt/prompt.js +92 -0
- package/src/lightning/prompt/prompt.js-meta.xml +6 -0
- package/src/lightning/spinner/spinner.html +1 -1
- package/src/lightning/spinner/spinner.js +12 -0
- package/src/lightning/utilsPrivate/phonify.js +1 -1
- package/scopedImports/@salesforce-label-LightningModalBase.close.js +0 -1
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
import { isRowNumberColumn, getRowNumberErrorColumnDef } from './rowNumber';
|
|
19
19
|
import { getRowError } from './errors';
|
|
20
20
|
import { getDirtyValueFromCell } from './inlineEditShared';
|
|
21
|
-
import { DEFAULT_ROW_HEIGHT } from './renderManager';
|
|
22
21
|
|
|
23
22
|
export function getData(state) {
|
|
24
23
|
return state.data;
|
|
@@ -77,8 +76,7 @@ export function resolveRowClassNames(row) {
|
|
|
77
76
|
* @param {object} state - data table state
|
|
78
77
|
* @param {string} rowKeyValue - computed id for the row
|
|
79
78
|
* @param {string} colKeyValue - computed id for the column
|
|
80
|
-
*
|
|
81
|
-
* @return {object} The user row that its related to the action.
|
|
79
|
+
* @returns {object} The user row that its related to the action.
|
|
82
80
|
*/
|
|
83
81
|
export function getUserRowByCellKeys(state, rowKeyValue, colKeyValue) {
|
|
84
82
|
const rowIndex = state.indexes[rowKeyValue][colKeyValue][0];
|
|
@@ -115,8 +113,8 @@ export function uniqueRowKeyGenerator(keyField) {
|
|
|
115
113
|
* @param {object} state - the current datatable state
|
|
116
114
|
*/
|
|
117
115
|
export function updateRowsAndCellIndexes() {
|
|
118
|
-
const { state, privateTypes: types
|
|
119
|
-
const { keyField, renderModeRoleBased } = state;
|
|
116
|
+
const { state, privateTypes: types } = this;
|
|
117
|
+
const { keyField, renderModeRoleBased, virtualize, rowHeight } = state;
|
|
120
118
|
const data = getData(state);
|
|
121
119
|
const columns = getColumns(state);
|
|
122
120
|
const computeUniqueRowKey = uniqueRowKeyGenerator(keyField);
|
|
@@ -135,6 +133,9 @@ export function updateRowsAndCellIndexes() {
|
|
|
135
133
|
|
|
136
134
|
state.indexes[row.key] = { rowIndex };
|
|
137
135
|
|
|
136
|
+
row.rowIndex = rowIndex;
|
|
137
|
+
row.rowNumber = rowIndex + 1; // for UTAM since methods are base-1
|
|
138
|
+
row.ariaRowIndex = rowIndex + 2; // aria attrs are base-1 and also count header as a row
|
|
138
139
|
row.inputType = getRowSelectionInputType(state);
|
|
139
140
|
row.isSelected = isSelectedRow(state, row.key);
|
|
140
141
|
row.ariaSelected = row.isSelected ? 'true' : false;
|
|
@@ -142,10 +143,10 @@ export function updateRowsAndCellIndexes() {
|
|
|
142
143
|
row.classnames = resolveRowClassNames(row);
|
|
143
144
|
Object.assign(row, getRowStateForTree(rowData, state));
|
|
144
145
|
row.tabIndex = -1;
|
|
145
|
-
if (
|
|
146
|
+
if (virtualize) {
|
|
146
147
|
row.style = styleToString({
|
|
147
148
|
position: 'absolute',
|
|
148
|
-
top: `${rowIndex *
|
|
149
|
+
top: `${rowIndex * rowHeight}px`,
|
|
149
150
|
});
|
|
150
151
|
}
|
|
151
152
|
|
|
@@ -402,7 +403,7 @@ function computeCellEditable(row, column) {
|
|
|
402
403
|
* @param {object} row - a row data object stored in datatable state. Must be truthy.
|
|
403
404
|
* @param {object} column - a column data object stored in datatable state. Must be truthy.
|
|
404
405
|
*/
|
|
405
|
-
function isCellEditable(row, column) {
|
|
406
|
+
export function isCellEditable(row, column) {
|
|
406
407
|
return !!resolveAttributeValue(column.editable, row);
|
|
407
408
|
}
|
|
408
409
|
|
|
@@ -10,8 +10,8 @@ const VALID_SORT_DIRECTIONS = {
|
|
|
10
10
|
* Determines if the supplied sort direction is valid.
|
|
11
11
|
* Refer to `VALID_SORT_DIRECTIONS` for valid solid directions.
|
|
12
12
|
*
|
|
13
|
-
* @param {
|
|
14
|
-
* @
|
|
13
|
+
* @param {String} value The sort direction to validate
|
|
14
|
+
* @returns {Boolean} Whether the supplied sort direction is valid
|
|
15
15
|
*/
|
|
16
16
|
export function isValidSortDirection(value) {
|
|
17
17
|
return !!VALID_SORT_DIRECTIONS[value];
|
|
@@ -22,7 +22,7 @@ export function isValidSortDirection(value) {
|
|
|
22
22
|
* the default sort direction is applied first. Clicking again reverses it
|
|
23
23
|
*
|
|
24
24
|
* @param {Object} state The current datatable state
|
|
25
|
-
* @
|
|
25
|
+
* @returns {String} The default sort direction
|
|
26
26
|
*/
|
|
27
27
|
export function getDefaultSortDirection(state) {
|
|
28
28
|
return state.defaultSortDirection;
|
|
@@ -33,7 +33,7 @@ export function getDefaultSortDirection(state) {
|
|
|
33
33
|
* the default sort direction is applied first. Clicking again reverses it
|
|
34
34
|
*
|
|
35
35
|
* @param {Object} state The current datatable state
|
|
36
|
-
* @param {
|
|
36
|
+
* @param {String} value The value to update the default sort direction to
|
|
37
37
|
*/
|
|
38
38
|
export function setDefaultSortDirection(state, value) {
|
|
39
39
|
assert(
|
|
@@ -51,7 +51,7 @@ export function setDefaultSortDirection(state, value) {
|
|
|
51
51
|
* Gets the current sort direction
|
|
52
52
|
*
|
|
53
53
|
* @param {Object} state The current datatable state
|
|
54
|
-
* @
|
|
54
|
+
* @returns {String} The current sort direction
|
|
55
55
|
*/
|
|
56
56
|
export function getSortedDirection(state) {
|
|
57
57
|
return state.sortedDirection;
|
|
@@ -64,7 +64,7 @@ export function getSortedDirection(state) {
|
|
|
64
64
|
* `sortedDirection` will be `undefined`
|
|
65
65
|
*
|
|
66
66
|
* @param {Object} state The current datatable state
|
|
67
|
-
* @param {
|
|
67
|
+
* @param {String} value The value to update the sort direction to
|
|
68
68
|
*/
|
|
69
69
|
export function setSortedDirection(state, value) {
|
|
70
70
|
assert(
|
|
@@ -81,7 +81,7 @@ export function setSortedDirection(state, value) {
|
|
|
81
81
|
* of a given column in the datatable
|
|
82
82
|
*
|
|
83
83
|
* @param {Object} state The current datatable state
|
|
84
|
-
* @
|
|
84
|
+
* @returns {String} The current sort value
|
|
85
85
|
*/
|
|
86
86
|
export function getSortedBy(state) {
|
|
87
87
|
return state.sortedBy;
|
|
@@ -94,7 +94,7 @@ export function getSortedBy(state) {
|
|
|
94
94
|
* to `undefined`
|
|
95
95
|
*
|
|
96
96
|
* @param {Object} state The current datatable state
|
|
97
|
-
* @param {
|
|
97
|
+
* @param {String} value The value to update the sort state to
|
|
98
98
|
*/
|
|
99
99
|
export function setSortedBy(state, value) {
|
|
100
100
|
if (typeof value === 'string') {
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* The state object is further manipulated while it is passed around by datatable
|
|
4
4
|
*
|
|
5
5
|
* TODO: Check to see if there are other items that need to be added to the default state
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
|
+
* @returns {Object} Intial state of the datatable
|
|
7
8
|
*/
|
|
8
9
|
export const getDefaultState = function () {
|
|
9
10
|
return {
|
|
@@ -55,8 +56,19 @@ export const getDefaultState = function () {
|
|
|
55
56
|
// table render mode
|
|
56
57
|
renderModeRoleBased: false,
|
|
57
58
|
|
|
58
|
-
// viewport rendering
|
|
59
|
+
// viewport rendering and virtualization
|
|
59
60
|
enableViewportRendering: undefined,
|
|
61
|
+
virtualize: '',
|
|
62
|
+
bufferSize: 5, // number of extra rows rendered on each side outside of viewport
|
|
63
|
+
rowHeight: 30.5,
|
|
64
|
+
renderedRowCount: 0,
|
|
65
|
+
firstVisibleIndex: 0, // first row that should be visible in viewport
|
|
66
|
+
fixedHeight: false, // by default, assume that not all rows are same height
|
|
67
|
+
heightCache: {}, // cache of row heights
|
|
68
|
+
offsets: [0],
|
|
69
|
+
offsetRanges: [],
|
|
70
|
+
firstRowOffset: 0, // how many pixels scrollTop is from top of first visible row
|
|
71
|
+
tableHeight: 0,
|
|
60
72
|
|
|
61
73
|
// inline edit
|
|
62
74
|
inlineEdit: {
|
|
@@ -35,19 +35,25 @@
|
|
|
35
35
|
aria-label={ariaLabel}
|
|
36
36
|
aria-labelledby={ariaLabelledBy}
|
|
37
37
|
aria-rowcount={ariaRowCount}
|
|
38
|
-
aria-colcount={ariaColCount}
|
|
38
|
+
aria-colcount={ariaColCount}
|
|
39
|
+
data-num-rows={data.length}
|
|
40
|
+
data-num-selected-rows={selectedRows.length}
|
|
41
|
+
data-last-rendered-row={_lastRenderedRow}>
|
|
39
42
|
<template if:false={hasValidKeyField}>
|
|
40
43
|
<!-- empty since keyField wasn't provided -->
|
|
41
44
|
</template>
|
|
42
45
|
<template if:true={hasValidKeyField}>
|
|
43
46
|
<!-- Corresponds to <thead> -->
|
|
44
|
-
<div
|
|
47
|
+
<div
|
|
48
|
+
data-rowgroup-header
|
|
49
|
+
role="rowgroup">
|
|
45
50
|
<!-- TODO: Fix aria-rowindex to not be hardcoded -->
|
|
46
51
|
<!-- TODO: might need to move the table-header class out or rename -->
|
|
47
52
|
<!-- Column Header Row -->
|
|
48
53
|
<div class="slds-line-height_reset table-header"
|
|
49
54
|
role="row"
|
|
50
55
|
aria-rowindex="1"
|
|
56
|
+
data-row-key-value="HEADER"
|
|
51
57
|
onprivateresizestart={handleResizeStart}
|
|
52
58
|
onprivateresizeend={handleResizeEnd}>
|
|
53
59
|
<template for:each={state.columns} for:item="def" for:index="colIndex">
|
|
@@ -58,6 +64,7 @@
|
|
|
58
64
|
tabindex={def.tabIndex}
|
|
59
65
|
aria-label={def.ariaLabel}
|
|
60
66
|
aria-sort={def.sortAriaLabel}
|
|
67
|
+
data-col-key-value={def.colKeyValue}
|
|
61
68
|
key={def.colKeyValue}>
|
|
62
69
|
|
|
63
70
|
<template if:true={def.fixedWidth}>
|
|
@@ -106,8 +113,11 @@
|
|
|
106
113
|
</div>
|
|
107
114
|
</div>
|
|
108
115
|
<!-- Corresponds to <tbody> -->
|
|
109
|
-
<div
|
|
110
|
-
|
|
116
|
+
<div
|
|
117
|
+
data-rowgroup-body
|
|
118
|
+
role="rowgroup"
|
|
119
|
+
style={computedTbodyStyle}>
|
|
120
|
+
<template for:each={renderedRows} for:item="row">
|
|
111
121
|
<!-- Data Rows -->
|
|
112
122
|
<div class={row.classnames}
|
|
113
123
|
role="row"
|
|
@@ -121,126 +131,130 @@
|
|
|
121
131
|
aria-posinset={row.posInSet}
|
|
122
132
|
aria-rowindex={row.ariaRowIndex}
|
|
123
133
|
style={row.style}
|
|
124
|
-
tabindex={row.tabIndex}
|
|
125
|
-
|
|
126
|
-
<template
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
key={cell.colKeyValue}>
|
|
134
|
-
<lightning-primitive-cell-checkbox
|
|
135
|
-
dt-context-id={_datatableId}
|
|
136
|
-
has-focus={cell.hasFocus}
|
|
134
|
+
tabindex={row.tabIndex}
|
|
135
|
+
data-row-number={row.rowNumber}>
|
|
136
|
+
<template for:each={row.cells} for:item="cell">
|
|
137
|
+
<template if:true={cell.isCheckbox}>
|
|
138
|
+
<!-- Checkbox Cell -->
|
|
139
|
+
<div class={cell.class}
|
|
140
|
+
style={cell.style}
|
|
141
|
+
role="gridcell"
|
|
142
|
+
tabindex={cell.tabIndex}
|
|
137
143
|
data-label={cell.dataLabel}
|
|
138
|
-
key={cell.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
types={privateTypes}
|
|
144
|
+
data-col-key-value={cell.colKeyValue}
|
|
145
|
+
key={cell.colKeyValue}>
|
|
146
|
+
<lightning-primitive-cell-checkbox
|
|
147
|
+
dt-context-id={_datatableId}
|
|
148
|
+
has-focus={cell.hasFocus}
|
|
149
|
+
data-label={cell.dataLabel}
|
|
150
|
+
key={cell.key}
|
|
151
|
+
row-key-value={row.key}
|
|
152
|
+
col-key-value={cell.colKeyValue}
|
|
153
|
+
row-index={row.rowIndex}
|
|
154
|
+
type={row.inputType}
|
|
155
|
+
is-selected={row.isSelected}
|
|
156
|
+
is-disabled={row.isDisabled}
|
|
157
|
+
column-header-id={computedCheckboxColumnHeaderId}>
|
|
158
|
+
</lightning-primitive-cell-checkbox>
|
|
159
|
+
</div>
|
|
160
|
+
</template>
|
|
161
|
+
<template if:true={cell.isDataTypeScope}>
|
|
162
|
+
<!-- Row Header Cell -->
|
|
163
|
+
<div class={cell.class}
|
|
164
|
+
role="rowheader"
|
|
165
|
+
style={cell.style}
|
|
161
166
|
aria-selected={cell.ariaSelected}
|
|
167
|
+
aria-readonly={cell.ariaReadOnly}
|
|
168
|
+
tabindex={cell.tabIndex}
|
|
162
169
|
data-label={cell.dataLabel}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
types={privateTypes}
|
|
170
|
+
data-col-key-value={cell.colKeyValue}
|
|
171
|
+
key={cell.colKeyValue}>
|
|
172
|
+
<lightning-primitive-cell-factory
|
|
173
|
+
types={privateTypes}
|
|
174
|
+
aria-selected={cell.ariaSelected}
|
|
175
|
+
data-label={cell.dataLabel}
|
|
176
|
+
alignment={cell.alignment}
|
|
177
|
+
has-error={cell.hasError}
|
|
178
|
+
has-focus={cell.hasFocus}
|
|
179
|
+
column-label={cell.dataLabel}
|
|
180
|
+
column-type={cell.columnType}
|
|
181
|
+
column-sub-type={cell.columnSubType}
|
|
182
|
+
wrap-text={cell.wrapText}
|
|
183
|
+
wrap-text-max-lines={cell.wrapTextMaxLines}
|
|
184
|
+
key={cell.columnType}
|
|
185
|
+
row-key-value={row.key}
|
|
186
|
+
col-key-value={cell.colKeyValue}
|
|
187
|
+
value={cell.value}
|
|
188
|
+
icon-name={cell.iconName}
|
|
189
|
+
icon-label={cell.iconLabel}
|
|
190
|
+
icon-position={cell.iconPosition}
|
|
191
|
+
icon-alternative-text={cell.iconAlternativeText}
|
|
192
|
+
editable={cell.editable}
|
|
193
|
+
display-read-only-icon={cell.displayReadOnlyIcon}
|
|
194
|
+
type-attribute-0={cell.typeAttribute0}
|
|
195
|
+
type-attribute-1={cell.typeAttribute1}
|
|
196
|
+
type-attribute-2={cell.typeAttribute2}
|
|
197
|
+
type-attribute-3={cell.typeAttribute3}
|
|
198
|
+
type-attribute-4={cell.typeAttribute4}
|
|
199
|
+
type-attribute-5={cell.typeAttribute5}
|
|
200
|
+
type-attribute-6={cell.typeAttribute6}
|
|
201
|
+
type-attribute-7={cell.typeAttribute7}
|
|
202
|
+
type-attribute-8={cell.typeAttribute8}
|
|
203
|
+
type-attribute-9={cell.typeAttribute9}
|
|
204
|
+
type-attribute-10={cell.typeAttribute10}
|
|
205
|
+
type-attribute-21={cell.typeAttribute21}
|
|
206
|
+
type-attribute-22={cell.typeAttribute22}>
|
|
207
|
+
</lightning-primitive-cell-factory>
|
|
208
|
+
</div>
|
|
209
|
+
</template>
|
|
210
|
+
<template if:true={cell.isDataType}>
|
|
211
|
+
<!-- Non-Header Cells (Regular Data Cells) -->
|
|
212
|
+
<div class={cell.class}
|
|
213
|
+
role="gridcell"
|
|
214
|
+
style={cell.style}
|
|
209
215
|
aria-selected={cell.ariaSelected}
|
|
216
|
+
aria-readonly={cell.ariaReadOnly}
|
|
217
|
+
tabindex={cell.tabIndex}
|
|
210
218
|
data-label={cell.dataLabel}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
219
|
+
data-col-key-value={cell.colKeyValue}
|
|
220
|
+
key={cell.colKeyValue}>
|
|
221
|
+
<lightning-primitive-cell-factory
|
|
222
|
+
types={privateTypes}
|
|
223
|
+
aria-selected={cell.ariaSelected}
|
|
224
|
+
data-label={cell.dataLabel}
|
|
225
|
+
alignment={cell.alignment}
|
|
226
|
+
has-focus={cell.hasFocus}
|
|
227
|
+
has-error={cell.hasError}
|
|
228
|
+
column-label={cell.dataLabel}
|
|
229
|
+
column-type={cell.columnType}
|
|
230
|
+
column-sub-type={cell.columnSubType}
|
|
231
|
+
wrap-text={cell.wrapText}
|
|
232
|
+
wrap-text-max-lines={cell.wrapTextMaxLines}
|
|
233
|
+
key={cell.columnType}
|
|
234
|
+
row-key-value={row.key}
|
|
235
|
+
col-key-value={cell.colKeyValue}
|
|
236
|
+
value={cell.value}
|
|
237
|
+
icon-name={cell.iconName}
|
|
238
|
+
icon-label={cell.iconLabel}
|
|
239
|
+
icon-position={cell.iconPosition}
|
|
240
|
+
icon-alternative-text={cell.iconAlternativeText}
|
|
241
|
+
editable={cell.editable}
|
|
242
|
+
display-read-only-icon={cell.displayReadOnlyIcon}
|
|
243
|
+
type-attribute-0={cell.typeAttribute0}
|
|
244
|
+
type-attribute-1={cell.typeAttribute1}
|
|
245
|
+
type-attribute-2={cell.typeAttribute2}
|
|
246
|
+
type-attribute-3={cell.typeAttribute3}
|
|
247
|
+
type-attribute-4={cell.typeAttribute4}
|
|
248
|
+
type-attribute-5={cell.typeAttribute5}
|
|
249
|
+
type-attribute-6={cell.typeAttribute6}
|
|
250
|
+
type-attribute-7={cell.typeAttribute7}
|
|
251
|
+
type-attribute-8={cell.typeAttribute8}
|
|
252
|
+
type-attribute-9={cell.typeAttribute9}
|
|
253
|
+
type-attribute-10={cell.typeAttribute10}
|
|
254
|
+
type-attribute-21={cell.typeAttribute21}
|
|
255
|
+
type-attribute-22={cell.typeAttribute22}>
|
|
256
|
+
</lightning-primitive-cell-factory>
|
|
257
|
+
</div>
|
|
244
258
|
</template>
|
|
245
259
|
</template>
|
|
246
260
|
</div>
|
|
@@ -33,7 +33,9 @@
|
|
|
33
33
|
onfocusout={handleTableFocusOut}
|
|
34
34
|
aria-label={ariaLabel}
|
|
35
35
|
aria-labelledby={ariaLabelledBy}
|
|
36
|
-
|
|
36
|
+
data-num-rows={data.length}
|
|
37
|
+
data-num-selected-rows={selectedRows.length}
|
|
38
|
+
data-last-rendered-row={_lastRenderedRow}>
|
|
37
39
|
<template if:false={hasValidKeyField}>
|
|
38
40
|
<!-- empty since keyField wasn't provided TODO: Why is this here? Test and remove! -->
|
|
39
41
|
</template>
|
|
@@ -41,6 +43,7 @@
|
|
|
41
43
|
<thead>
|
|
42
44
|
<!-- Column Header Row -->
|
|
43
45
|
<tr class="slds-line-height_reset"
|
|
46
|
+
data-row-key-value="HEADER"
|
|
44
47
|
onprivateresizestart={handleResizeStart}
|
|
45
48
|
onprivateresizeend={handleResizeEnd}>
|
|
46
49
|
<template for:each={state.columns} for:item="def" for:index="colIndex">
|
|
@@ -50,6 +53,7 @@
|
|
|
50
53
|
tabindex={def.tabIndex}
|
|
51
54
|
aria-label={def.ariaLabel}
|
|
52
55
|
aria-sort={def.sortAriaLabel}
|
|
56
|
+
data-col-key-value={def.colKeyValue}
|
|
53
57
|
key={def.colKeyValue}>
|
|
54
58
|
|
|
55
59
|
<template if:true={def.fixedWidth}>
|
|
@@ -109,7 +113,8 @@
|
|
|
109
113
|
aria-expanded={row.isExpanded}
|
|
110
114
|
aria-setsize={row.setSize}
|
|
111
115
|
aria-posinset={row.posInSet}
|
|
112
|
-
tabindex={row.tabIndex}
|
|
116
|
+
tabindex={row.tabIndex}
|
|
117
|
+
data-row-number={row.rowNumber}>
|
|
113
118
|
<template for:each={row.cells} for:item="cell">
|
|
114
119
|
<template if:true={cell.isCheckbox}>
|
|
115
120
|
<!-- Checkbox Cell -->
|
|
@@ -117,6 +122,7 @@
|
|
|
117
122
|
role="gridcell"
|
|
118
123
|
tabindex={cell.tabIndex}
|
|
119
124
|
data-label={cell.dataLabel}
|
|
125
|
+
data-col-key-value={cell.colKeyValue}
|
|
120
126
|
key={cell.colKeyValue}>
|
|
121
127
|
<lightning-primitive-cell-checkbox
|
|
122
128
|
dt-context-id={_datatableId}
|
|
@@ -142,6 +148,7 @@
|
|
|
142
148
|
scope="row"
|
|
143
149
|
tabindex={cell.tabIndex}
|
|
144
150
|
data-label={cell.dataLabel}
|
|
151
|
+
data-col-key-value={cell.colKeyValue}
|
|
145
152
|
key={cell.colKeyValue}>
|
|
146
153
|
<lightning-primitive-cell-factory
|
|
147
154
|
types={privateTypes}
|
|
@@ -190,6 +197,7 @@
|
|
|
190
197
|
aria-readonly={cell.ariaReadOnly}
|
|
191
198
|
tabindex={cell.tabIndex}
|
|
192
199
|
data-label={cell.dataLabel}
|
|
200
|
+
data-col-key-value={cell.colKeyValue}
|
|
193
201
|
key={cell.colKeyValue}>
|
|
194
202
|
<lightning-primitive-cell-factory
|
|
195
203
|
types={privateTypes}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { getColumns } from './columns';
|
|
2
2
|
import { isTreeType } from './types';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Retrieves the default values for the tree state indicator field names.
|
|
6
|
+
* These values are used to make logic decisions later and may be updated
|
|
7
|
+
* during normal operation.
|
|
8
|
+
*
|
|
9
|
+
* @returns {Object} The default tree state indicator field names
|
|
10
|
+
*/
|
|
4
11
|
export function getTreeStateIndicatorFieldNames() {
|
|
5
12
|
return {
|
|
6
13
|
children: 'hasChildren',
|
|
@@ -11,6 +18,12 @@ export function getTreeStateIndicatorFieldNames() {
|
|
|
11
18
|
};
|
|
12
19
|
}
|
|
13
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Determines if any of the columns in the datatable are of a tree-type.
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} state The datatable state
|
|
25
|
+
* @returns {Boolean} Whether any of the columns are of a tree-type
|
|
26
|
+
*/
|
|
14
27
|
export function hasTreeDataType(state) {
|
|
15
28
|
const columns = getColumns(state);
|
|
16
29
|
return columns.some((column) => {
|
|
@@ -18,6 +31,12 @@ export function hasTreeDataType(state) {
|
|
|
18
31
|
});
|
|
19
32
|
}
|
|
20
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves the first tree-type column from the state.
|
|
36
|
+
*
|
|
37
|
+
* @param {Object} state The datatable state
|
|
38
|
+
* @returns {Object} The first tree-type column, else `null`
|
|
39
|
+
*/
|
|
21
40
|
export function getStateTreeColumn(state) {
|
|
22
41
|
const columns = getColumns(state);
|
|
23
42
|
for (let i = 0; i < columns.length; i++) {
|
|
@@ -28,6 +47,12 @@ export function getStateTreeColumn(state) {
|
|
|
28
47
|
return null;
|
|
29
48
|
}
|
|
30
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Dispatches an event when a row is toggled to be expanded or collapsed.
|
|
52
|
+
*
|
|
53
|
+
* @param {String} rowKeyValue The row key being acted upon
|
|
54
|
+
* @param {Boolean} expanded The current expand/collapse state of the row
|
|
55
|
+
*/
|
|
31
56
|
export function fireRowToggleEvent(rowKeyValue, expanded) {
|
|
32
57
|
const customEvent = new CustomEvent('privatetogglecell', {
|
|
33
58
|
bubbles: true,
|