lightning-base-components 1.21.5-alpha → 1.21.6-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 +1 -0
- package/package.json +1 -1
- package/src/lightning/badge/badge.slds.css +1 -1
- package/src/lightning/combobox/form-element.slds.css +4 -1
- package/src/lightning/datatable/columns.js +17 -18
- package/src/lightning/datatable/datatable.js +143 -80
- package/src/lightning/datatable/indexes.js +1 -3
- package/src/lightning/datatable/infiniteLoading.js +1 -1
- package/src/lightning/datatable/inlineEdit.js +9 -7
- package/src/lightning/datatable/keyboard.js +21 -44
- package/src/lightning/datatable/renderManager.js +9 -18
- package/src/lightning/datatable/rows.js +112 -128
- package/src/lightning/datatable/sort.js +35 -14
- package/src/lightning/datatable/state.js +5 -0
- package/src/lightning/datatable/tree.js +0 -33
- package/src/lightning/datatable/utils.js +11 -0
- package/src/lightning/datepicker/datepicker.js +12 -3
- package/src/lightning/datepicker/form-element.slds.css +4 -1
- package/src/lightning/datetimepicker/form-element.slds.css +4 -1
- package/src/lightning/dualListbox/form-element.slds.css +4 -1
- package/src/lightning/groupedCombobox/form-element.slds.css +4 -1
- package/src/lightning/helptext/form-element.slds.css +4 -1
- package/src/lightning/input/form-element.slds.css +4 -1
- package/src/lightning/inputAddress/form-element.slds.css +4 -1
- package/src/lightning/inputLocation/form-element.slds.css +4 -1
- package/src/lightning/inputName/form-element.slds.css +4 -1
- package/src/lightning/lookupAddress/form-element.slds.css +4 -1
- package/src/lightning/modalBase/modalBase.js +12 -29
- package/src/lightning/primitiveBubble/primitiveBubble.js +26 -11
- package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +1 -1
- package/src/lightning/primitiveInputCheckbox/form-element.slds.css +4 -1
- package/src/lightning/primitiveInputCheckboxButton/form-element.slds.css +4 -1
- package/src/lightning/primitiveInputColor/form-element.slds.css +4 -1
- package/src/lightning/primitiveInputFile/form-element.slds.css +4 -1
- package/src/lightning/primitiveInputSimple/form-element.slds.css +4 -1
- package/src/lightning/primitiveInputToggle/form-element.slds.css +4 -1
- package/src/lightning/progressBar/progress-bar.slds.css +1 -1
- package/src/lightning/radioGroup/form-element.slds.css +4 -1
- package/src/lightning/select/form-element.slds.css +4 -1
- package/src/lightning/textarea/__examples__/various/various.html +18 -1
- package/src/lightning/textarea/form-element.slds.css +4 -1
- package/src/lightning/textarea/textarea.js +25 -0
- package/src/lightning/timepicker/form-element.slds.css +4 -1
- 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/vertical-navigation-item.slds.css +1 -1
- package/src/lightning/datatable/columns-shared.js +0 -12
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
NAVIGATION_DIR,
|
|
13
13
|
isValidCell,
|
|
14
14
|
} from './keyboard';
|
|
15
|
-
import {
|
|
15
|
+
import { updateRowsAndCells } from './rows';
|
|
16
16
|
import { getStateColumnIndex } from './columns';
|
|
17
17
|
import { resetErrors } from './errors';
|
|
18
18
|
import { setAriaSelectedOnCell, unsetAriaSelectedOnCell } from './rowSelection';
|
|
@@ -161,7 +161,7 @@ export function cancelInlineEdit(dt) {
|
|
|
161
161
|
resetErrors(state);
|
|
162
162
|
state.inlineEdit.dirtyValues = {};
|
|
163
163
|
dt._draftValues = [];
|
|
164
|
-
|
|
164
|
+
updateRowsAndCells(state, _privateTypes);
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
export function closeInlineEdit(dt) {
|
|
@@ -247,7 +247,7 @@ function processInlineEditFinish(dt, reason, rowKeyValue, colKeyValue) {
|
|
|
247
247
|
dispatchCellChangeEvent(dt, changes);
|
|
248
248
|
|
|
249
249
|
// TODO: do we need to update all rows in the dt or just the one that was modified?
|
|
250
|
-
|
|
250
|
+
updateRowsAndCells(state, dt._privateTypes);
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
|
|
@@ -572,8 +572,7 @@ function getResolvedCellChanges(state, rowChanges) {
|
|
|
572
572
|
const colIndex = getStateColumnIndex(state, colKeyValue);
|
|
573
573
|
if (colIndex !== -1) {
|
|
574
574
|
const col = columns[colIndex];
|
|
575
|
-
cellChanges[col.
|
|
576
|
-
colChanges[colKeyValue];
|
|
575
|
+
cellChanges[col.name] = colChanges[colKeyValue];
|
|
577
576
|
}
|
|
578
577
|
}
|
|
579
578
|
result.push(cellChanges);
|
|
@@ -710,13 +709,16 @@ function getFirstEditableCell(dt) {
|
|
|
710
709
|
if (editableColumnsLength > 0) {
|
|
711
710
|
const { rows } = state;
|
|
712
711
|
for (let rowIndex = 0; rowIndex < rows.length; rowIndex += 1) {
|
|
713
|
-
const
|
|
712
|
+
const row = rows[rowIndex];
|
|
713
|
+
const { key: rowKeyValue } = row;
|
|
714
714
|
for (let i = 0; i < editableColumnsLength; i += 1) {
|
|
715
715
|
// Loop through the editable columns in order and examine the
|
|
716
716
|
// corresponding cells in the current row for editability,
|
|
717
717
|
// returning the first such cell that is editable.
|
|
718
718
|
const editableColumn = editableColumns[i];
|
|
719
|
-
|
|
719
|
+
const { colKeyValue } = editableColumns[i];
|
|
720
|
+
const cell = row.cells[getStateColumnIndex(state, colKeyValue)];
|
|
721
|
+
if (cell && cell.editable) {
|
|
720
722
|
return {
|
|
721
723
|
rowKeyValue,
|
|
722
724
|
colKeyValue: editableColumn.colKeyValue,
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { getShadowActiveElements, isRTL } from 'lightning/utilsPrivate';
|
|
2
2
|
import { getCellFromIndexes, HEADER_ROW_KEY, getRowByKey } from './indexes';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
getStateTreeColumn,
|
|
6
|
-
fireRowToggleEvent,
|
|
7
|
-
} from './tree';
|
|
8
|
-
import { generateColKeyValue, getStateColumnIndex } from './columns';
|
|
9
|
-
import { isCellEditable } from './rows';
|
|
3
|
+
import { fireRowToggleEvent } from './tree';
|
|
4
|
+
import { getStateColumnIndex } from './columns';
|
|
10
5
|
import { findFirstVisibleIndex } from './virtualization';
|
|
11
6
|
import { getColDataSelector, getRowDataSelector, getScrollerY } from './utils';
|
|
12
7
|
|
|
@@ -211,10 +206,7 @@ function reactToArrowLeft(state, template, event) {
|
|
|
211
206
|
// Update activeCell.
|
|
212
207
|
state.activeCell = {
|
|
213
208
|
rowKeyValue,
|
|
214
|
-
colKeyValue:
|
|
215
|
-
state.columns[nextColIndex],
|
|
216
|
-
nextColIndex
|
|
217
|
-
),
|
|
209
|
+
colKeyValue: state.columns[nextColIndex].colKeyValue,
|
|
218
210
|
};
|
|
219
211
|
// Tracked state change.
|
|
220
212
|
setFocusActiveCell(state, template, NAVIGATION_DIR.LEFT);
|
|
@@ -233,10 +225,7 @@ function reactToArrowRight(state, template, event) {
|
|
|
233
225
|
// Update activeCell.
|
|
234
226
|
state.activeCell = {
|
|
235
227
|
rowKeyValue,
|
|
236
|
-
colKeyValue:
|
|
237
|
-
state.columns[nextColIndex],
|
|
238
|
-
nextColIndex
|
|
239
|
-
),
|
|
228
|
+
colKeyValue: state.columns[nextColIndex].colKeyValue,
|
|
240
229
|
};
|
|
241
230
|
setFocusActiveCell(state, template, NAVIGATION_DIR.RIGHT);
|
|
242
231
|
}
|
|
@@ -375,10 +364,7 @@ export function reactToTabForward(state, template) {
|
|
|
375
364
|
state.activeCell = {
|
|
376
365
|
rowKeyValue:
|
|
377
366
|
nextRowIndex === -1 ? HEADER_ROW_KEY : state.rows[nextRowIndex].key,
|
|
378
|
-
colKeyValue:
|
|
379
|
-
state.columns[nextColIndex],
|
|
380
|
-
nextColIndex
|
|
381
|
-
),
|
|
367
|
+
colKeyValue: state.columns[nextColIndex].colKeyValue,
|
|
382
368
|
};
|
|
383
369
|
// Tracked state change.
|
|
384
370
|
setFocusActiveCell(state, template, NAVIGATION_DIR.TAB_FORWARD, {
|
|
@@ -395,10 +381,7 @@ export function reactToTabBackward(state, template) {
|
|
|
395
381
|
state.activeCell = {
|
|
396
382
|
rowKeyValue:
|
|
397
383
|
nextRowIndex === -1 ? HEADER_ROW_KEY : state.rows[nextRowIndex].key,
|
|
398
|
-
colKeyValue:
|
|
399
|
-
state.columns[nextColIndex],
|
|
400
|
-
nextColIndex
|
|
401
|
-
),
|
|
384
|
+
colKeyValue: state.columns[nextColIndex].colKeyValue,
|
|
402
385
|
};
|
|
403
386
|
// Tracked state change.
|
|
404
387
|
setFocusActiveCell(state, template, NAVIGATION_DIR.TAB_BACKWARD, {
|
|
@@ -505,7 +488,7 @@ function reactToArrowLeftOnRow(dt, state, template, event) {
|
|
|
505
488
|
if (rowHasChildren && rowExpanded) {
|
|
506
489
|
fireRowToggleEvent(dt, rowKeyValue, rowExpanded);
|
|
507
490
|
} else if (rowLevel > 1) {
|
|
508
|
-
const treeColumn =
|
|
491
|
+
const { treeColumn } = state;
|
|
509
492
|
if (treeColumn) {
|
|
510
493
|
const { colKeyValue } = treeColumn;
|
|
511
494
|
const { rowIndex } = getIndexesByKeys(
|
|
@@ -552,7 +535,7 @@ function reactToArrowRightOnRow(dt, state, template, event) {
|
|
|
552
535
|
function reactToArrowUpOnRow(state, template, event) {
|
|
553
536
|
// Move tabIndex 0 one row down.
|
|
554
537
|
const { rowKeyValue, keyEvent } = event.detail;
|
|
555
|
-
const treeColumn =
|
|
538
|
+
const { treeColumn } = state;
|
|
556
539
|
|
|
557
540
|
keyEvent.stopPropagation();
|
|
558
541
|
keyEvent.preventDefault();
|
|
@@ -579,7 +562,7 @@ function reactToArrowUpOnRow(state, template, event) {
|
|
|
579
562
|
function reactToArrowDownOnRow(state, template, event) {
|
|
580
563
|
// Move tabIndex 0 one row down.
|
|
581
564
|
const { rowKeyValue, keyEvent } = event.detail;
|
|
582
|
-
const treeColumn =
|
|
565
|
+
const { treeColumn } = state;
|
|
583
566
|
|
|
584
567
|
keyEvent.stopPropagation();
|
|
585
568
|
keyEvent.preventDefault();
|
|
@@ -624,7 +607,7 @@ function getDefaultActiveCell(state) {
|
|
|
624
607
|
const { rows } = state;
|
|
625
608
|
return {
|
|
626
609
|
rowKeyValue: rows.length > 0 ? rows[0].key : HEADER_ROW_KEY,
|
|
627
|
-
colKeyValue:
|
|
610
|
+
colKeyValue: columns[colIndex].colKeyValue,
|
|
628
611
|
};
|
|
629
612
|
}
|
|
630
613
|
|
|
@@ -822,7 +805,7 @@ export function setFocusActiveCell(
|
|
|
822
805
|
const { rowIndex, colIndex } = getIndexesActiveCell(state);
|
|
823
806
|
let cellElement = getActiveCellElement(template, state);
|
|
824
807
|
|
|
825
|
-
state.activeCell.
|
|
808
|
+
state.activeCell.hasFocus = !(info && isActiveCellValid(state));
|
|
826
809
|
|
|
827
810
|
updateCellTabIndex(state, rowIndex, colIndex);
|
|
828
811
|
|
|
@@ -874,7 +857,7 @@ export function setFocusActiveCell(
|
|
|
874
857
|
export function setBlurActiveCell(state, template) {
|
|
875
858
|
if (state.activeCell) {
|
|
876
859
|
const { rowIndex, colIndex } = getIndexesActiveCell(state);
|
|
877
|
-
state.activeCell.
|
|
860
|
+
state.activeCell.hasFocus = false;
|
|
878
861
|
let cellElement = getActiveCellElement(template, state);
|
|
879
862
|
// eslint-disable-next-line @lwc/lwc/no-async-operation
|
|
880
863
|
setTimeout(() => {
|
|
@@ -957,7 +940,7 @@ export function updateCellToFocusFromPrev(state) {
|
|
|
957
940
|
* @param {Node} template - The custom element template `this.template`
|
|
958
941
|
*/
|
|
959
942
|
export function addFocusStylesToActiveCell(state, template) {
|
|
960
|
-
state.activeCell.
|
|
943
|
+
state.activeCell.hasFocus = true;
|
|
961
944
|
const cellElement = getActiveCellElement(template, state);
|
|
962
945
|
if (cellElement) {
|
|
963
946
|
cellElement.parentElement.classList.add(FOCUS_CLASS);
|
|
@@ -1053,7 +1036,7 @@ export function handleDatatableFocusIn(event) {
|
|
|
1053
1036
|
// workaround for delegatesFocus issue that focusin is called when not supposed to W-6220418
|
|
1054
1037
|
if (isFocusInside(event.currentTarget)) {
|
|
1055
1038
|
if (state.activeCell && !state.rowMode) {
|
|
1056
|
-
state.activeCell.
|
|
1039
|
+
state.activeCell.hasFocus = true;
|
|
1057
1040
|
const cellElement = getActiveCellElement(this.template, state);
|
|
1058
1041
|
// we need to check because of the tree,
|
|
1059
1042
|
// at this point it may remove/change the rows/keys because opening or closing a row.
|
|
@@ -1243,10 +1226,7 @@ function getNextIndexDownWrapped(state, rowIndex) {
|
|
|
1243
1226
|
/***************************** ROW NAVIGATION MODE *****************************/
|
|
1244
1227
|
|
|
1245
1228
|
function canBeRowNavigationMode(state) {
|
|
1246
|
-
return
|
|
1247
|
-
state.keyboardMode === KEYBOARD_NAVIGATION_MODE &&
|
|
1248
|
-
hasTreeDataType(state)
|
|
1249
|
-
);
|
|
1229
|
+
return state.keyboardMode === KEYBOARD_NAVIGATION_MODE && state.treeColumn;
|
|
1250
1230
|
}
|
|
1251
1231
|
|
|
1252
1232
|
function isRowNavigationMode(state) {
|
|
@@ -1257,10 +1237,7 @@ function isRowNavigationMode(state) {
|
|
|
1257
1237
|
}
|
|
1258
1238
|
|
|
1259
1239
|
function setRowNavigationMode(state) {
|
|
1260
|
-
if (
|
|
1261
|
-
hasTreeDataType(state) &&
|
|
1262
|
-
state.keyboardMode === KEYBOARD_NAVIGATION_MODE
|
|
1263
|
-
) {
|
|
1240
|
+
if (state.treeColumn && state.keyboardMode === KEYBOARD_NAVIGATION_MODE) {
|
|
1264
1241
|
state.rowMode = true;
|
|
1265
1242
|
}
|
|
1266
1243
|
}
|
|
@@ -1276,13 +1253,12 @@ export function unsetRowNavigationMode(state) {
|
|
|
1276
1253
|
* Earlier it didn't have tree data, set rowMode to true to start
|
|
1277
1254
|
* if rowMode is false and earlier it has tree data, keep it false
|
|
1278
1255
|
* if rowMode is true and it has tree data, keep it true
|
|
1279
|
-
* @param {Boolean} hadTreeDataTypePreviously - state object
|
|
1280
1256
|
* @param {Object} state - The state object
|
|
1281
1257
|
*/
|
|
1282
|
-
export function updateRowNavigationMode(
|
|
1283
|
-
if (!
|
|
1258
|
+
export function updateRowNavigationMode(state) {
|
|
1259
|
+
if (!state.treeColumn) {
|
|
1284
1260
|
state.rowMode = false;
|
|
1285
|
-
} else if (state.rowMode === false && !hadTreeDataTypePreviously) {
|
|
1261
|
+
} else if (state.rowMode === false && !state.hadTreeDataTypePreviously) {
|
|
1286
1262
|
state.rowMode = true;
|
|
1287
1263
|
}
|
|
1288
1264
|
}
|
|
@@ -1360,7 +1336,8 @@ function scrollToCell(state, template, rowIndex) {
|
|
|
1360
1336
|
export function isActiveCellEditable(state) {
|
|
1361
1337
|
if (state.activeCell) {
|
|
1362
1338
|
const { rowIndex, colIndex } = getIndexesActiveCell(state);
|
|
1363
|
-
|
|
1339
|
+
const activeCell = state.rows[rowIndex].cells[colIndex];
|
|
1340
|
+
return activeCell ? activeCell.editable : false;
|
|
1364
1341
|
}
|
|
1365
1342
|
return false;
|
|
1366
1343
|
}
|
|
@@ -13,10 +13,6 @@ export function setViewportRendering(state, value) {
|
|
|
13
13
|
state.enableViewportRendering = normalizeBoolean(value);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export function isViewportRenderingEnabled(state) {
|
|
17
|
-
return state.enableViewportRendering;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
16
|
export function setVirtualize(state, value) {
|
|
21
17
|
if (state.renderModeRoleBased) {
|
|
22
18
|
state.virtualize = normalizeString(value, {
|
|
@@ -68,16 +64,11 @@ export class RenderManager {
|
|
|
68
64
|
* @param {RenderManagerConfig} config - The render management config
|
|
69
65
|
*/
|
|
70
66
|
configure(state, getWrapperHeight, config) {
|
|
71
|
-
const {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
fixedHeight,
|
|
77
|
-
} = config;
|
|
78
|
-
setVirtualize(state, virtualize);
|
|
79
|
-
|
|
80
|
-
if (normalizeBoolean(viewportRendering) || state.virtualize) {
|
|
67
|
+
const { rowHeight, bufferSize } = config;
|
|
68
|
+
// Untracked state changes.
|
|
69
|
+
setVirtualize(state, config.virtualize);
|
|
70
|
+
setViewportRendering(state, config.viewportRendering);
|
|
71
|
+
if (state.virtualize || state.enableViewportRendering) {
|
|
81
72
|
this.initializeResizeObserver(state, getWrapperHeight);
|
|
82
73
|
}
|
|
83
74
|
let computedBufferSize =
|
|
@@ -88,10 +79,10 @@ export class RenderManager {
|
|
|
88
79
|
'non-negative',
|
|
89
80
|
DEFAULT_BUFFER_SIZE
|
|
90
81
|
);
|
|
91
|
-
state.fixedHeight = normalizeBoolean(fixedHeight);
|
|
82
|
+
state.fixedHeight = normalizeBoolean(config.fixedHeight);
|
|
92
83
|
if (typeof rowHeight === 'number') {
|
|
93
84
|
state.rowHeight = rowHeight;
|
|
94
|
-
this.threshold = ROW_THRESHOLD *
|
|
85
|
+
this.threshold = ROW_THRESHOLD * rowHeight;
|
|
95
86
|
}
|
|
96
87
|
}
|
|
97
88
|
|
|
@@ -212,7 +203,7 @@ export class RenderManager {
|
|
|
212
203
|
const normalizedRowCount = rowCount
|
|
213
204
|
? Math.min(rowCount, totalRows)
|
|
214
205
|
: totalRows;
|
|
215
|
-
if (
|
|
206
|
+
if (state.enableViewportRendering) {
|
|
216
207
|
if (state.renderedRowCount < normalizedRowCount) {
|
|
217
208
|
state.renderedRowCount = normalizedRowCount;
|
|
218
209
|
// Update our internal cache
|
|
@@ -247,7 +238,7 @@ export class RenderManager {
|
|
|
247
238
|
* when the datatable component's height changes
|
|
248
239
|
*
|
|
249
240
|
* @param {Object} state - datatable state
|
|
250
|
-
* @param {Function} getWrapperHeight - function to get height of datatable wrapper
|
|
241
|
+
* @param {Function} getWrapperHeight - A function to get the height of datatable wrapper
|
|
251
242
|
*/
|
|
252
243
|
initializeResizeObserver(state, getWrapperHeight) {
|
|
253
244
|
if (!this._heightResizeObserver) {
|