lightning-base-components 1.22.1-alpha → 1.22.3-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/README.md +2 -0
- package/metadata/raptor.json +38 -2
- package/package.json +12 -1
- package/scopedImports/@salesforce-label-LightningRecordPicker.actionIconAlternativeText.js +1 -0
- package/src/lightning/accordionSection/button.slds.css +8 -0
- package/src/lightning/ariaObserver/ariaObserver.js +1 -1
- package/src/lightning/baseCombobox/baseCombobox.html +1 -1
- package/src/lightning/baseCombobox/baseCombobox.js +1 -0
- package/src/lightning/baseCombobox/dropdown.slds.css +7 -7
- package/src/lightning/baseComboboxItem/card.lbc.native.css +1 -0
- package/src/lightning/baseComboboxItem/inline.lbc.native.css +1 -0
- package/src/lightning/button/button.slds.css +8 -0
- package/src/lightning/buttonIcon/button-icon.slds.css +8 -0
- package/src/lightning/buttonIcon/buttonIcon.js +29 -26
- package/src/lightning/buttonIconStateful/button-icon.slds.css +8 -0
- package/src/lightning/buttonIconStateful/button.slds.css +8 -0
- package/src/lightning/buttonMenu/button-icon.slds.css +8 -0
- package/src/lightning/buttonMenu/button.slds.css +8 -0
- package/src/lightning/buttonMenu/dropdown.slds.css +7 -7
- package/src/lightning/buttonStateful/button.slds.css +8 -0
- package/src/lightning/calendar/calendar.lbc.native.css +1 -0
- package/src/lightning/calendar/dropdown.slds.css +7 -7
- package/src/lightning/checkboxGroup/checkboxGroup.js +21 -10
- package/src/lightning/checkboxGroup/checkboxGroup.js-meta.xml +3 -0
- package/src/lightning/colorPickerPanel/colorPickerPanel.js +1 -11
- package/src/lightning/combobox/combobox.html +1 -1
- package/src/lightning/datatable/__docs__/datatable.md +10 -5
- package/src/lightning/datatable/autoWidthStrategy.js +32 -44
- package/src/lightning/datatable/columnResizer.js +3 -2
- package/src/lightning/datatable/columnWidthManager.js +16 -10
- package/src/lightning/datatable/columns.js +4 -1
- package/src/lightning/datatable/datatable.js +108 -46
- package/src/lightning/datatable/infiniteLoading.js +8 -20
- package/src/lightning/datatable/inlineEdit.js +11 -6
- package/src/lightning/datatable/keyboard.js +58 -55
- package/src/lightning/datatable/resizeObserver.js +10 -5
- package/src/lightning/datatable/rows.js +3 -3
- package/src/lightning/datatable/rowsInlining.js +5 -4
- package/src/lightning/datatable/state.js +1 -2
- package/src/lightning/datatable/templates/div/div.html +150 -43
- package/src/lightning/datatable/templates/div/div.lbc.synthetic.css +8 -7
- package/src/lightning/datatable/templates/table/table.html +153 -46
- package/src/lightning/datatable/utils.js +10 -4
- package/src/lightning/datatable/virtualization.js +6 -4
- package/src/lightning/datatable/wrapText.js +16 -15
- package/src/lightning/groupedCombobox/groupedCombobox.js +21 -28
- package/src/lightning/helptext/button-icon.slds.css +8 -0
- package/src/lightning/helptext/helptext.html +2 -1
- package/src/lightning/helptext/helptext.js +0 -12
- package/src/lightning/input/input.html +0 -1
- package/src/lightning/interactiveDialogBase/button.slds.css +8 -0
- package/src/lightning/modal/__docs__/modal.md +2 -0
- package/src/lightning/modalBase/modalBase.html +2 -0
- package/src/lightning/modalBase/modalBase.js +30 -31
- package/src/lightning/modalBody/modalBody.html +1 -0
- package/src/lightning/modalBody/modalBody.js +3 -0
- package/src/lightning/modalFooter/modalFooter.html +5 -1
- package/src/lightning/modalFooter/modalFooter.js +3 -0
- package/src/lightning/modalHeader/modalHeader.html +4 -1
- package/src/lightning/modalHeader/modalHeader.js +3 -0
- package/src/lightning/overlayManager/overlayManager.js +1 -1
- package/src/lightning/pillContainer/button.slds.css +8 -0
- package/src/lightning/positionLibrary/elementProxy.js +13 -6
- package/src/lightning/positionLibrary/util.js +20 -2
- package/src/lightning/primitiveBubble/primitiveBubble.js +9 -4
- package/src/lightning/primitiveCellActions/primitiveCellActions.html +1 -0
- package/src/lightning/primitiveCellActions/primitiveCellActions.js +3 -5
- package/src/lightning/primitiveCellButton/primitiveCellButton.html +2 -0
- package/src/lightning/primitiveCellButton/primitiveCellButton.js +3 -5
- package/src/lightning/primitiveCellCheckbox/checkbox.html +3 -2
- package/src/lightning/primitiveCellCheckbox/primitiveCellCheckbox.js +6 -3
- package/src/lightning/primitiveCellCheckbox/radio.html +5 -4
- package/src/lightning/primitiveCellEditableButton/primitiveCellEditableButton.html +1 -1
- package/src/lightning/primitiveCellEditableButton/primitiveCellEditableButton.js +1 -1
- package/src/lightning/primitiveCellFactory/bareCustomCell.html +1 -0
- package/src/lightning/primitiveCellFactory/cellWithStandardLayout.html +1 -0
- package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +4 -6
- package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.html +1 -0
- package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.js +1 -1
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.html +3 -1
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.js +3 -3
- package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.html +1 -0
- package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.js +1 -3
- package/src/lightning/primitiveDatatableTooltip/primitiveDatatableTooltip.html +1 -0
- package/src/lightning/primitiveDatatableTooltip/primitiveDatatableTooltip.js +1 -1
- package/src/lightning/primitiveDatatableTooltipBubble/primitiveDatatableTooltipBubble.html +1 -1
- package/src/lightning/primitiveDatatableTooltipBubble/primitiveDatatableTooltipBubble.js +1 -1
- package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.html +2 -0
- package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.js +2 -4
- package/src/lightning/primitiveHeaderFactory/nonsortableHeader.html +8 -3
- package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +43 -13
- package/src/lightning/primitiveHeaderFactory/selectableHeader.html +3 -2
- package/src/lightning/primitiveHeaderFactory/sortableHeader.html +8 -3
- package/src/lightning/primitiveHeaderFactory/sortingMenuHeader.html +1 -1
- package/src/lightning/primitiveIcon/primitiveIcon.css +0 -1
- package/src/lightning/primitiveInputFile/button.slds.css +8 -0
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.html +4 -2
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.js +2 -2
- package/src/lightning/primitiveTreegridCellToggle/primitiveTreegridCellToggle.html +1 -1
- package/src/lightning/primitiveTreegridCellToggle/primitiveTreegridCellToggle.js +1 -1
- package/src/lightning/progressIndicator/progressIndicator.css +1 -1
- package/src/lightning/progressIndicator/progressIndicator.js +14 -6
- package/src/lightning/progressIndicator/progressIndicator.js-meta.xml +3 -0
- package/src/lightning/progressIndicator/progressIndicator.lbc.native.css +2 -0
- package/src/lightning/progressStep/__examples__/basic/basic.html +11 -0
- package/src/lightning/progressStep/__examples__/basic/basic.js +3 -0
- package/src/lightning/progressStep/__examples__/shaded/shaded.html +11 -0
- package/src/lightning/progressStep/__examples__/shaded/shaded.js +3 -0
- package/src/lightning/progressStep/base.html +2 -1
- package/src/lightning/progressStep/progressStep.css +1 -0
- package/src/lightning/progressStep/progressStep.js +40 -29
- package/src/lightning/progressStep/progressStep.js-meta.xml +3 -0
- package/src/lightning/progressStep/progressStep.lbc.native.css +3 -0
- package/src/lightning/sldsCommon/sldsCommon.css +1 -1
- package/src/lightning/sldsUtilsThemes/sldsUtilsThemes.css +6 -4
- package/src/lightning/tabBar/tab-bar.slds.css +17 -3
- package/src/lightning/tile/mediaTile.css +2 -0
- package/src/lightning/tile/standardTile.css +2 -1
- package/src/lightning/tile/tile.js +5 -2
- package/src/lightning/tile/tile.js-meta.xml +3 -0
- package/src/lightning/tile/tile.lbc.native.css +4 -0
- package/src/lightning/toast/button-icon.slds.css +8 -0
- package/src/lightning/tooltipLibrary/tooltipLibrary.js +15 -4
- package/src/lightning/utilsPrivate/utilsPrivate.js +4 -4
- package/src/lightning/verticalNavigationOverflow/button.slds.css +8 -0
- package/src/lightning/primitiveIcon/primitiveIcon.lbc.synthetic.css +0 -9
- /package/src/lightning/tile/{standardTile.lbc.synthetic.css → tile.lbc.synthetic.css} +0 -0
|
@@ -107,29 +107,29 @@ export function handleKeydownOnTable(event) {
|
|
|
107
107
|
* @returns {Object} Mutated state
|
|
108
108
|
*/
|
|
109
109
|
function reactToKeyboardInActionMode(dt, event) {
|
|
110
|
-
const { state, template } = dt;
|
|
110
|
+
const { refs, state, template } = dt;
|
|
111
111
|
switch (event.detail.keyCode) {
|
|
112
112
|
case ARROW_LEFT:
|
|
113
|
-
reactToArrowLeft(state, template, event);
|
|
113
|
+
reactToArrowLeft(state, template, refs, event);
|
|
114
114
|
break;
|
|
115
115
|
case ARROW_RIGHT:
|
|
116
|
-
reactToArrowRight(state, template, event);
|
|
116
|
+
reactToArrowRight(state, template, refs, event);
|
|
117
117
|
break;
|
|
118
118
|
case ARROW_UP:
|
|
119
|
-
reactToArrowUp(state, template, event);
|
|
119
|
+
reactToArrowUp(state, template, refs, event);
|
|
120
120
|
break;
|
|
121
121
|
case ARROW_DOWN:
|
|
122
|
-
reactToArrowDown(state, template, event);
|
|
122
|
+
reactToArrowDown(state, template, refs, event);
|
|
123
123
|
break;
|
|
124
124
|
case ENTER:
|
|
125
125
|
case SPACE:
|
|
126
|
-
reactToEnter(state, template, event);
|
|
126
|
+
reactToEnter(state, template, refs, event);
|
|
127
127
|
break;
|
|
128
128
|
case ESCAPE:
|
|
129
|
-
reactToEscape(state, template, event);
|
|
129
|
+
reactToEscape(state, template, refs, event);
|
|
130
130
|
break;
|
|
131
131
|
case TAB:
|
|
132
|
-
reactToTab(state, template, event);
|
|
132
|
+
reactToTab(state, template, refs, event);
|
|
133
133
|
break;
|
|
134
134
|
default:
|
|
135
135
|
break;
|
|
@@ -137,7 +137,7 @@ function reactToKeyboardInActionMode(dt, event) {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
function reactToKeyboardInNavMode(dt, event) {
|
|
140
|
-
const { state, template } = dt;
|
|
140
|
+
const { refs, state, template } = dt;
|
|
141
141
|
const {
|
|
142
142
|
activeCell: { colKeyValue, rowKeyValue },
|
|
143
143
|
} = state;
|
|
@@ -157,41 +157,41 @@ function reactToKeyboardInNavMode(dt, event) {
|
|
|
157
157
|
switch (event.keyCode) {
|
|
158
158
|
case ARROW_LEFT:
|
|
159
159
|
event.preventDefault();
|
|
160
|
-
reactToArrowLeft(state, template, syntheticEvent);
|
|
160
|
+
reactToArrowLeft(state, template, refs, syntheticEvent);
|
|
161
161
|
break;
|
|
162
162
|
case ARROW_RIGHT:
|
|
163
163
|
event.preventDefault();
|
|
164
|
-
reactToArrowRight(state, template, syntheticEvent);
|
|
164
|
+
reactToArrowRight(state, template, refs, syntheticEvent);
|
|
165
165
|
break;
|
|
166
166
|
case ARROW_UP:
|
|
167
167
|
event.preventDefault();
|
|
168
|
-
reactToArrowUp(state, template, syntheticEvent);
|
|
168
|
+
reactToArrowUp(state, template, refs, syntheticEvent);
|
|
169
169
|
break;
|
|
170
170
|
case ARROW_DOWN:
|
|
171
171
|
event.preventDefault();
|
|
172
|
-
reactToArrowDown(state, template, syntheticEvent);
|
|
172
|
+
reactToArrowDown(state, template, refs, syntheticEvent);
|
|
173
173
|
break;
|
|
174
174
|
case ENTER:
|
|
175
175
|
case SPACE:
|
|
176
176
|
event.preventDefault();
|
|
177
|
-
reactToEnter(state, template, syntheticEvent);
|
|
177
|
+
reactToEnter(state, template, refs, syntheticEvent);
|
|
178
178
|
break;
|
|
179
179
|
case ESCAPE:
|
|
180
180
|
// td, th or div[role=gridcell/rowheader] is the active element in the
|
|
181
181
|
// action mode if cell doesn't have action elements; hence this can be
|
|
182
182
|
// reached and we should react to escape as exiting from action mode
|
|
183
183
|
syntheticEvent.detail.keyEvent = event;
|
|
184
|
-
reactToEscape(state, template, syntheticEvent);
|
|
184
|
+
reactToEscape(state, template, refs, syntheticEvent);
|
|
185
185
|
break;
|
|
186
186
|
case TAB:
|
|
187
|
-
reactToTab(state, template, syntheticEvent);
|
|
187
|
+
reactToTab(state, template, refs, syntheticEvent);
|
|
188
188
|
break;
|
|
189
189
|
default:
|
|
190
190
|
break;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
function reactToArrowLeft(state, template, event) {
|
|
194
|
+
function reactToArrowLeft(state, template, refs, event) {
|
|
195
195
|
const { rowKeyValue, colKeyValue } = event.detail;
|
|
196
196
|
const { colIndex } = getCellByKeys(state, rowKeyValue, colKeyValue);
|
|
197
197
|
// Move from navigation mode to row mode when user
|
|
@@ -203,7 +203,7 @@ function reactToArrowLeft(state, template, event) {
|
|
|
203
203
|
// Untracked state change.
|
|
204
204
|
setRowNavigationMode(state);
|
|
205
205
|
// Tracked state change.
|
|
206
|
-
setFocusActiveRow(state, template);
|
|
206
|
+
setFocusActiveRow(state, template, refs);
|
|
207
207
|
} else {
|
|
208
208
|
const nextColIndex = getNextIndexLeft(state, colIndex);
|
|
209
209
|
if (nextColIndex === undefined) {
|
|
@@ -218,11 +218,11 @@ function reactToArrowLeft(state, template, event) {
|
|
|
218
218
|
state.columns[nextColIndex].colKeyValue
|
|
219
219
|
);
|
|
220
220
|
// Tracked state change.
|
|
221
|
-
setFocusActiveCell(state, template, NAVIGATION_DIR.LEFT);
|
|
221
|
+
setFocusActiveCell(state, template, refs, NAVIGATION_DIR.LEFT);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
function reactToArrowRight(state, template, event) {
|
|
225
|
+
function reactToArrowRight(state, template, refs, event) {
|
|
226
226
|
const { rowKeyValue, colKeyValue } = event.detail;
|
|
227
227
|
const { colIndex } = getCellByKeys(state, rowKeyValue, colKeyValue);
|
|
228
228
|
const nextColIndex = getNextIndexRight(state, colIndex);
|
|
@@ -237,10 +237,10 @@ function reactToArrowRight(state, template, event) {
|
|
|
237
237
|
rowKeyValue,
|
|
238
238
|
state.columns[nextColIndex].colKeyValue
|
|
239
239
|
);
|
|
240
|
-
setFocusActiveCell(state, template, NAVIGATION_DIR.RIGHT);
|
|
240
|
+
setFocusActiveCell(state, template, refs, NAVIGATION_DIR.RIGHT);
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
function reactToArrowUp(state, template, event) {
|
|
243
|
+
function reactToArrowUp(state, template, refs, event) {
|
|
244
244
|
const { rowKeyValue, colKeyValue, keyEvent } = event.detail;
|
|
245
245
|
const { rowIndex } = getCellByKeys(state, rowKeyValue, colKeyValue);
|
|
246
246
|
const nextRowIndex = getNextIndexUp(state, rowIndex);
|
|
@@ -264,10 +264,10 @@ function reactToArrowUp(state, template, event) {
|
|
|
264
264
|
colKeyValue
|
|
265
265
|
);
|
|
266
266
|
// Tracked state change.
|
|
267
|
-
setFocusActiveCell(state, template, NAVIGATION_DIR.USE_CURRENT);
|
|
267
|
+
setFocusActiveCell(state, template, refs, NAVIGATION_DIR.USE_CURRENT);
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
function reactToArrowDown(state, template, event) {
|
|
270
|
+
function reactToArrowDown(state, template, refs, event) {
|
|
271
271
|
const { rowKeyValue, colKeyValue, keyEvent } = event.detail;
|
|
272
272
|
const { rowIndex } = getCellByKeys(state, rowKeyValue, colKeyValue);
|
|
273
273
|
const nextRowIndex = getNextIndexDown(state, rowIndex);
|
|
@@ -291,10 +291,10 @@ function reactToArrowDown(state, template, event) {
|
|
|
291
291
|
colKeyValue
|
|
292
292
|
);
|
|
293
293
|
// Tracked state change.
|
|
294
|
-
setFocusActiveCell(state, template, NAVIGATION_DIR.USE_CURRENT);
|
|
294
|
+
setFocusActiveCell(state, template, refs, NAVIGATION_DIR.USE_CURRENT);
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
-
function reactToEnter(state, template, event) {
|
|
297
|
+
function reactToEnter(state, template, refs, event) {
|
|
298
298
|
if (state.keyboardMode === KEYBOARD_NAVIGATION_MODE) {
|
|
299
299
|
// Untracked state change.
|
|
300
300
|
state.keyboardMode = KEYBOARD_ACTION_MODE;
|
|
@@ -315,7 +315,7 @@ function reactToEnter(state, template, event) {
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
function reactToEscape(state, template, event) {
|
|
318
|
+
function reactToEscape(state, template, refs, event) {
|
|
319
319
|
if (state.keyboardMode === KEYBOARD_ACTION_MODE) {
|
|
320
320
|
// When the table is in action mode this event shouldn't bubble
|
|
321
321
|
// because if the table in inside a modal it should prevent the modal closes
|
|
@@ -324,11 +324,11 @@ function reactToEscape(state, template, event) {
|
|
|
324
324
|
state.keyboardMode = KEYBOARD_NAVIGATION_MODE;
|
|
325
325
|
// Tracked state changes.
|
|
326
326
|
setModeActiveCell(state, template);
|
|
327
|
-
setFocusActiveCell(state, template, NAVIGATION_DIR.RESET);
|
|
327
|
+
setFocusActiveCell(state, template, refs, NAVIGATION_DIR.RESET);
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
-
function reactToTab(state, template, event) {
|
|
331
|
+
function reactToTab(state, template, refs, event) {
|
|
332
332
|
event.preventDefault();
|
|
333
333
|
event.stopPropagation();
|
|
334
334
|
|
|
@@ -347,9 +347,9 @@ function reactToTab(state, template, event) {
|
|
|
347
347
|
}
|
|
348
348
|
// Tab in proper direction based on shift key press.
|
|
349
349
|
if (direction === 'BACKWARD') {
|
|
350
|
-
reactToTabBackward(state, template);
|
|
350
|
+
reactToTabBackward(state, template, refs);
|
|
351
351
|
} else {
|
|
352
|
-
reactToTabForward(state, template);
|
|
352
|
+
reactToTabForward(state, template, refs);
|
|
353
353
|
}
|
|
354
354
|
} else {
|
|
355
355
|
// Untracked state change.
|
|
@@ -366,7 +366,7 @@ function reactToTab(state, template, event) {
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
-
export function reactToTabForward(state, template) {
|
|
369
|
+
export function reactToTabForward(state, template, refs) {
|
|
370
370
|
const { nextColIndex, nextRowIndex } = getNextIndexOnTab(state, 'FORWARD');
|
|
371
371
|
// Tracked state change.
|
|
372
372
|
setBlurActiveCell(state, template);
|
|
@@ -378,12 +378,12 @@ export function reactToTabForward(state, template) {
|
|
|
378
378
|
state.columns[nextColIndex].colKeyValue
|
|
379
379
|
);
|
|
380
380
|
// Tracked state change.
|
|
381
|
-
setFocusActiveCell(state, template, NAVIGATION_DIR.TAB_FORWARD, {
|
|
381
|
+
setFocusActiveCell(state, template, refs, NAVIGATION_DIR.TAB_FORWARD, {
|
|
382
382
|
action: 'tab',
|
|
383
383
|
});
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
export function reactToTabBackward(state, template) {
|
|
386
|
+
export function reactToTabBackward(state, template, refs) {
|
|
387
387
|
const { nextColIndex, nextRowIndex } = getNextIndexOnTab(state, 'BACKWARD');
|
|
388
388
|
// Tracked state change.
|
|
389
389
|
setBlurActiveCell(state, template);
|
|
@@ -395,7 +395,7 @@ export function reactToTabBackward(state, template) {
|
|
|
395
395
|
state.columns[nextColIndex].colKeyValue
|
|
396
396
|
);
|
|
397
397
|
// Tracked state change.
|
|
398
|
-
setFocusActiveCell(state, template, NAVIGATION_DIR.TAB_BACKWARD, {
|
|
398
|
+
setFocusActiveCell(state, template, refs, NAVIGATION_DIR.TAB_BACKWARD, {
|
|
399
399
|
action: 'tab',
|
|
400
400
|
});
|
|
401
401
|
}
|
|
@@ -465,7 +465,7 @@ function getNextIndexOnTabBackward(state, rowIndex, colIndex) {
|
|
|
465
465
|
* @returns Mutated state
|
|
466
466
|
*/
|
|
467
467
|
export function reactToKeyboardOnRow(dt, event) {
|
|
468
|
-
const { state, template } = dt;
|
|
468
|
+
const { refs, state, template } = dt;
|
|
469
469
|
// TODO: Adapt this selector to also work in a role-based table once tree-grid is also migrated
|
|
470
470
|
const { localName } = event.target;
|
|
471
471
|
if (
|
|
@@ -475,16 +475,16 @@ export function reactToKeyboardOnRow(dt, event) {
|
|
|
475
475
|
) {
|
|
476
476
|
switch (event.detail.keyCode) {
|
|
477
477
|
case ARROW_LEFT:
|
|
478
|
-
reactToArrowLeftOnRow(dt, state, template, event);
|
|
478
|
+
reactToArrowLeftOnRow(dt, state, template, refs, event);
|
|
479
479
|
break;
|
|
480
480
|
case ARROW_RIGHT:
|
|
481
|
-
reactToArrowRightOnRow(dt, state, template, event);
|
|
481
|
+
reactToArrowRightOnRow(dt, state, template, refs, event);
|
|
482
482
|
break;
|
|
483
483
|
case ARROW_UP:
|
|
484
|
-
reactToArrowUpOnRow(
|
|
484
|
+
reactToArrowUpOnRow(state, template, refs, event);
|
|
485
485
|
break;
|
|
486
486
|
case ARROW_DOWN:
|
|
487
|
-
reactToArrowDownOnRow(
|
|
487
|
+
reactToArrowDownOnRow(state, template, refs, event);
|
|
488
488
|
break;
|
|
489
489
|
default:
|
|
490
490
|
break;
|
|
@@ -492,7 +492,7 @@ export function reactToKeyboardOnRow(dt, event) {
|
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
-
function reactToArrowLeftOnRow(dt, state, template, event) {
|
|
495
|
+
function reactToArrowLeftOnRow(dt, state, template, refs, event) {
|
|
496
496
|
const { rowKeyValue, rowHasChildren, rowExpanded, rowLevel } = event.detail;
|
|
497
497
|
// Check if row needs to be collapsed.
|
|
498
498
|
// If not, go to parent and focus there.
|
|
@@ -515,13 +515,13 @@ function reactToArrowLeftOnRow(dt, state, template, event) {
|
|
|
515
515
|
colKeyValue
|
|
516
516
|
);
|
|
517
517
|
// Tracked state change.
|
|
518
|
-
setFocusActiveRow(state, template);
|
|
518
|
+
setFocusActiveRow(state, template, refs);
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
523
|
|
|
524
|
-
function reactToArrowRightOnRow(dt, state, template, event) {
|
|
524
|
+
function reactToArrowRightOnRow(dt, state, template, refs, event) {
|
|
525
525
|
const { rowKeyValue, rowHasChildren, rowExpanded } = event.detail;
|
|
526
526
|
// Check if row needs to be expanded.
|
|
527
527
|
// Expand row if has children and is collapsed.
|
|
@@ -536,11 +536,11 @@ function reactToArrowRightOnRow(dt, state, template, event) {
|
|
|
536
536
|
// Untracked state change.
|
|
537
537
|
unsetRowNavigationMode(state);
|
|
538
538
|
// Tracked state change.
|
|
539
|
-
setFocusActiveCell(state, template, NAVIGATION_DIR.USE_CURRENT);
|
|
539
|
+
setFocusActiveCell(state, template, refs, NAVIGATION_DIR.USE_CURRENT);
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
|
|
543
|
-
function reactToArrowUpOnRow(state, template, event) {
|
|
543
|
+
function reactToArrowUpOnRow(state, template, refs, event) {
|
|
544
544
|
// Move tabIndex 0 one row down.
|
|
545
545
|
const { rowKeyValue, keyEvent } = event.detail;
|
|
546
546
|
const { treeColumn } = state;
|
|
@@ -563,12 +563,12 @@ function reactToArrowUpOnRow(state, template, event) {
|
|
|
563
563
|
colKeyValue
|
|
564
564
|
);
|
|
565
565
|
// Tracked state change.
|
|
566
|
-
setFocusActiveRow(state, template);
|
|
566
|
+
setFocusActiveRow(state, template, refs);
|
|
567
567
|
}
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
570
|
|
|
571
|
-
function reactToArrowDownOnRow(state, template, event) {
|
|
571
|
+
function reactToArrowDownOnRow(state, template, refs, event) {
|
|
572
572
|
// Move tabIndex 0 one row down.
|
|
573
573
|
const { rowKeyValue, keyEvent } = event.detail;
|
|
574
574
|
const { treeColumn } = state;
|
|
@@ -591,7 +591,7 @@ function reactToArrowDownOnRow(state, template, event) {
|
|
|
591
591
|
colKeyValue
|
|
592
592
|
);
|
|
593
593
|
// Tracked state change.
|
|
594
|
-
setFocusActiveRow(state, template);
|
|
594
|
+
setFocusActiveRow(state, template, refs);
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
597
|
}
|
|
@@ -1175,6 +1175,7 @@ function setMode(cell, cellElementChild, keyboardMode, info) {
|
|
|
1175
1175
|
* - set the focus to the cell
|
|
1176
1176
|
* @param {Object} state - The datatable state
|
|
1177
1177
|
* @param {Node} template - The custom element template `this.template`
|
|
1178
|
+
* @param {Object} refs - The datatable refs
|
|
1178
1179
|
* @param {Integer} direction - The direction (-1 left, 1 right and 0 for no direction) its used to know which actionable element to activate.
|
|
1179
1180
|
* @param {Object} info - Extra information when setting the cell mode; currently only set when pressing tab
|
|
1180
1181
|
* @param {Boolean} [shouldScroll = true] - Whether scrollTop should be adjusted when setting focus
|
|
@@ -1182,6 +1183,7 @@ function setMode(cell, cellElementChild, keyboardMode, info) {
|
|
|
1182
1183
|
export function setFocusActiveCell(
|
|
1183
1184
|
state,
|
|
1184
1185
|
template,
|
|
1186
|
+
refs,
|
|
1185
1187
|
direction,
|
|
1186
1188
|
info,
|
|
1187
1189
|
shouldScroll = true
|
|
@@ -1196,7 +1198,7 @@ export function setFocusActiveCell(
|
|
|
1196
1198
|
|
|
1197
1199
|
// if the cell wasn't found, but does exist in the table, scroll to where it should be
|
|
1198
1200
|
if (shouldScroll && !cellElement && isActiveCellValid(state)) {
|
|
1199
|
-
scrollToCell(state, template, rowIndex);
|
|
1201
|
+
scrollToCell(state, template, refs, rowIndex);
|
|
1200
1202
|
}
|
|
1201
1203
|
|
|
1202
1204
|
const rowKeyValue =
|
|
@@ -1395,8 +1397,9 @@ export function addFocusStylesToActiveCell(state, template) {
|
|
|
1395
1397
|
*
|
|
1396
1398
|
* @param {Object} state - The datatable state
|
|
1397
1399
|
* @param {Node} template - the custom element root `this.template`
|
|
1400
|
+
* @param {Object} refs - The datatable refs
|
|
1398
1401
|
*/
|
|
1399
|
-
function setFocusActiveRow(state, template) {
|
|
1402
|
+
function setFocusActiveRow(state, template, refs) {
|
|
1400
1403
|
const { rowIndex } = state.activeCell;
|
|
1401
1404
|
const rowElement = getActiveCellRowElement(template, state);
|
|
1402
1405
|
|
|
@@ -1404,7 +1407,7 @@ function setFocusActiveRow(state, template) {
|
|
|
1404
1407
|
// eslint-disable-next-line @lwc/lwc/no-async-operation
|
|
1405
1408
|
setTimeout(() => {
|
|
1406
1409
|
rowElement.focus({ preventScroll: true });
|
|
1407
|
-
updateScrollTop(state, template, rowElement);
|
|
1410
|
+
updateScrollTop(state, template, refs, rowElement);
|
|
1408
1411
|
}, 0);
|
|
1409
1412
|
}
|
|
1410
1413
|
|
|
@@ -1727,8 +1730,8 @@ export function getRowParentIndex(state, rowLevel, rowIndex) {
|
|
|
1727
1730
|
return -1;
|
|
1728
1731
|
}
|
|
1729
1732
|
|
|
1730
|
-
function updateScrollTop(state, template, element) {
|
|
1731
|
-
const scrollableY = getScrollerY(template);
|
|
1733
|
+
function updateScrollTop(state, template, refs, element) {
|
|
1734
|
+
const scrollableY = getScrollerY(template, refs);
|
|
1732
1735
|
const scrollingParent = scrollableY.parentElement;
|
|
1733
1736
|
const parentRect = scrollingParent.getBoundingClientRect();
|
|
1734
1737
|
const findMeRect = element.getBoundingClientRect();
|
|
@@ -1740,7 +1743,7 @@ function updateScrollTop(state, template, element) {
|
|
|
1740
1743
|
findFirstVisibleIndex(state, scrollableY.scrollTop);
|
|
1741
1744
|
}
|
|
1742
1745
|
|
|
1743
|
-
function scrollToCell(state, template, rowIndex) {
|
|
1746
|
+
function scrollToCell(state, template, refs, rowIndex) {
|
|
1744
1747
|
const { firstVisibleIndex, bufferSize, renderedRowCount, rowHeight } =
|
|
1745
1748
|
state;
|
|
1746
1749
|
|
|
@@ -1750,7 +1753,7 @@ function scrollToCell(state, template, rowIndex) {
|
|
|
1750
1753
|
scrollTop = Math.max(scrollTop - rowsInViewport * rowHeight, 0);
|
|
1751
1754
|
}
|
|
1752
1755
|
|
|
1753
|
-
const scrollableY = getScrollerY(template);
|
|
1756
|
+
const scrollableY = getScrollerY(template, refs);
|
|
1754
1757
|
scrollableY.scrollTop = scrollTop;
|
|
1755
1758
|
findFirstVisibleIndex(state, scrollTop);
|
|
1756
1759
|
}
|
|
@@ -9,13 +9,16 @@ export class LightningDatatableResizeObserver {
|
|
|
9
9
|
/**
|
|
10
10
|
* Create either a standard ResizeObserver via LightningResizeObserver.
|
|
11
11
|
*/
|
|
12
|
-
constructor(
|
|
13
|
-
const resizeTarget =
|
|
12
|
+
constructor(dt, resizeCallback) {
|
|
13
|
+
const resizeTarget =
|
|
14
|
+
dt.refs?.widthObserver ||
|
|
15
|
+
dt.template.querySelector(WIDTH_OBSERVER_SELECTOR);
|
|
14
16
|
// Create ResizeObserver and begin observing for changes.
|
|
15
17
|
// Calculate and modify the column widths when there are changes to the dimensions
|
|
16
18
|
// and when the table is rendered and visible on screen.
|
|
17
19
|
this._resizeObserver = new LightningResizeObserver(() => {
|
|
18
|
-
|
|
20
|
+
const { refs, template } = dt;
|
|
21
|
+
if (this._connected && isTableRenderedVisible(template, refs)) {
|
|
19
22
|
resizeCallback();
|
|
20
23
|
}
|
|
21
24
|
});
|
|
@@ -24,8 +27,10 @@ export class LightningDatatableResizeObserver {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
// Begins observing the specified element for changes in dimension
|
|
27
|
-
observe(template) {
|
|
28
|
-
const targetElement =
|
|
30
|
+
observe(template, refs) {
|
|
31
|
+
const targetElement =
|
|
32
|
+
refs?.widthObserver ||
|
|
33
|
+
template.querySelector(WIDTH_OBSERVER_SELECTOR);
|
|
29
34
|
|
|
30
35
|
if (this._resizeObserver) {
|
|
31
36
|
this._resizeObserver.observe(targetElement);
|
|
@@ -385,14 +385,13 @@ export function updateCell(state, rowIndex, colIndex) {
|
|
|
385
385
|
const errorFieldNames = rowErrors && rowErrors.fieldNames;
|
|
386
386
|
const col = state.columns[colIndex];
|
|
387
387
|
const cell = row.cells[colIndex];
|
|
388
|
-
const { colKeyValue, columnKey, fieldName } = col;
|
|
388
|
+
const { colKeyValue, columnKey, fieldName, wrapText } = col;
|
|
389
389
|
const dirtyValue = dirtyRowData && dirtyRowData[colKeyValue];
|
|
390
390
|
const hasError = columnKey
|
|
391
391
|
? !!(cellErrors && cellErrors[columnKey])
|
|
392
392
|
: !!(errorFieldNames && errorFieldNames.includes(fieldName));
|
|
393
393
|
// value based on the fieldName
|
|
394
394
|
const value = dirtyValue === undefined ? rowData[fieldName] : dirtyValue;
|
|
395
|
-
const wrapText = state.wrapText[colKeyValue];
|
|
396
395
|
const wrapTextMaxLines = wrapText ? state.wrapTextMaxLines : undefined;
|
|
397
396
|
|
|
398
397
|
cell.hasError = hasError;
|
|
@@ -404,7 +403,8 @@ export function updateCell(state, rowIndex, colIndex) {
|
|
|
404
403
|
cell.typeAttribute0 = getRowNumberError(rowErrors, cell.scopeColValue);
|
|
405
404
|
}
|
|
406
405
|
|
|
407
|
-
|
|
406
|
+
const cellAttributes = getCellAttributesValues(col);
|
|
407
|
+
let cellClass = resolveAttributeValue(cellAttributes.class, rowData) || '';
|
|
408
408
|
if (cell.hasTreeData && !cellClass) {
|
|
409
409
|
cellClass += (cellClass.length ? ' ' : '') + TREE__ITEM_CLASS;
|
|
410
410
|
}
|
|
@@ -229,6 +229,7 @@ export function updateInlineCell(cell) {
|
|
|
229
229
|
cell.editIconAssistiveText = `${i18n.edit} ${cell.dataLabel}${
|
|
230
230
|
cell.hasError ? ` ${i18n.editHasError}` : ''
|
|
231
231
|
}`;
|
|
232
|
+
cell.editLabelId = `edit-${cell.cellKeyValue}`;
|
|
232
233
|
} else {
|
|
233
234
|
cell.shouldDisplayReadOnlyIcon = cell.displayReadOnlyIcon;
|
|
234
235
|
}
|
|
@@ -264,10 +265,10 @@ export function updateInlineClassAndStyle(cell, cellClass) {
|
|
|
264
265
|
cellClass += (cellClass.length ? ' ' : '') + CELL_WRAP;
|
|
265
266
|
computedCellDivClass += HYPHENATE_CLASS;
|
|
266
267
|
const { wrapTextMaxLines } = cell;
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
268
|
+
computedCellDivClass += ` ${LINE_CLAMP_CLASS}`;
|
|
269
|
+
computedCellDivStyle = `--lwc-lineClamp: ${
|
|
270
|
+
wrapTextMaxLines || 'none'
|
|
271
|
+
};`;
|
|
271
272
|
} else {
|
|
272
273
|
computedCellDivClass += TRUNCATE_CLASS;
|
|
273
274
|
}
|
|
@@ -30,7 +30,7 @@ export function getDefaultState() {
|
|
|
30
30
|
maxRowSelection: undefined,
|
|
31
31
|
|
|
32
32
|
hideTableHeader: false,
|
|
33
|
-
wrapTableHeader:
|
|
33
|
+
wrapTableHeader: 'by-column',
|
|
34
34
|
|
|
35
35
|
// indexes:
|
|
36
36
|
headerIndexes: [],
|
|
@@ -46,7 +46,6 @@ export function getDefaultState() {
|
|
|
46
46
|
normalized: false,
|
|
47
47
|
|
|
48
48
|
// header actions
|
|
49
|
-
wrapText: {},
|
|
50
49
|
wrapTextMaxLines: undefined,
|
|
51
50
|
|
|
52
51
|
// sort
|