lightning-base-components 1.14.2-alpha → 1.14.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/metadata/raptor.json +1 -0
- package/package.json +17 -1
- package/scopedImports/@salesforce-label-LightningDualListbox.movedOptionsPlural.js +1 -0
- package/scopedImports/@salesforce-label-LightningDualListbox.movedOptionsSingular.js +1 -0
- package/scopedImports/@salesforce-label-LightningErrorMessage.validitySelectAtleastOne.js +1 -0
- package/scopedImports/@salesforce-label-LightningMap.titleWithAddress.js +1 -0
- package/src/lightning/ariaObserver/__docs__/ariaObserver.md +142 -0
- package/src/lightning/buttonMenu/keyboard.js +0 -10
- package/src/lightning/card/card.html +6 -0
- package/src/lightning/checkboxGroup/checkboxGroup.html +2 -2
- package/src/lightning/checkboxGroup/checkboxGroup.js +6 -1
- package/src/lightning/colorPickerCustom/colorPickerCustom.js +20 -1
- package/src/lightning/datatable/__docs__/datatable.md +55 -0
- package/src/lightning/datatable/__examples__/basic/basic.html +1 -1
- package/src/lightning/datatable/columns-shared.js +1 -1
- package/src/lightning/datatable/datatable.js +97 -24
- package/src/lightning/datatable/errors.js +20 -9
- package/src/lightning/datatable/headerActions.js +77 -49
- package/src/lightning/datatable/inlineEdit.js +505 -370
- package/src/lightning/datatable/inlineEditShared.js +24 -0
- package/src/lightning/datatable/keyboard.js +1 -1
- package/src/lightning/datatable/renderManager.js +241 -129
- package/src/lightning/datatable/rowLevelActions.js +17 -13
- package/src/lightning/datatable/rowNumber.js +54 -20
- package/src/lightning/datatable/rowSelection.js +760 -0
- package/src/lightning/datatable/rowSelectionShared.js +79 -0
- package/src/lightning/datatable/rows.js +16 -5
- package/src/lightning/datatable/state.js +10 -1
- package/src/lightning/datatable/templates/div/div.css +4 -0
- package/src/lightning/datatable/templates/div/div.html +1 -0
- package/src/lightning/datatable/utils.js +14 -0
- package/src/lightning/dualListbox/dualListbox.html +1 -1
- package/src/lightning/dualListbox/dualListbox.js +42 -0
- package/src/lightning/inputUtils/validity.js +12 -1
- package/src/lightning/pillContainer/__docs__/pillContainer.md +45 -1
- package/src/lightning/positionLibrary/positionLibrary.js +31 -43
- package/src/lightning/primitiveCellActions/primitiveCellActions.js +69 -12
- package/src/lightning/primitiveCellFactory/cellWithStandardLayout.html +13 -11
- package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +13 -8
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.html +17 -14
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.js +167 -98
- package/src/lightning/primitiveDatatableIeditTypeFactory/primitiveDatatableIeditTypeFactory.js +94 -69
- package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.html +4 -4
- package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.js +4 -4
- package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.js +99 -37
- package/src/lightning/progressIndicator/progressIndicator.js +1 -1
- package/src/lightning/progressStep/progressStep.js +1 -1
- package/src/lightning/staticMap/staticMap.html +1 -0
- package/src/lightning/staticMap/staticMap.js +39 -2
- package/src/lightning/utils/classSet.js +4 -1
- package/src/lightning/datatable/inlineEdit-shared.js +0 -14
- package/src/lightning/datatable/selector-shared.js +0 -38
- package/src/lightning/datatable/selector.js +0 -527
|
@@ -4,22 +4,22 @@ import labelRowNumber from '@salesforce/label/LightningDatatable.rowNumber';
|
|
|
4
4
|
import { formatLabel } from 'lightning/utils';
|
|
5
5
|
import { normalizeBoolean } from 'lightning/utilsPrivate';
|
|
6
6
|
|
|
7
|
+
export const TOOLTIP_ALLOWANCE = 20;
|
|
7
8
|
const CHAR_WIDTH = 10;
|
|
8
9
|
const ROWNUMBER_PADDING = 12;
|
|
9
|
-
const
|
|
10
|
-
const COLUMN_TYPE = 'rowNumber';
|
|
10
|
+
const ROW_NUMBER_COLUMN_TYPE = 'rowNumber';
|
|
11
11
|
const i18n = {
|
|
12
12
|
rowLevelErrorAssistiveText: labelRowLevelErrorAssistiveText,
|
|
13
13
|
rowNumber: labelRowNumber,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Returns the initial default column definition
|
|
18
|
+
* for the row number column
|
|
19
|
+
*/
|
|
20
20
|
export function getRowNumberColumnDef() {
|
|
21
21
|
return {
|
|
22
|
-
type:
|
|
22
|
+
type: ROW_NUMBER_COLUMN_TYPE,
|
|
23
23
|
ariaLabel: i18n.rowNumber,
|
|
24
24
|
sortable: false,
|
|
25
25
|
initialWidth: 52,
|
|
@@ -31,39 +31,57 @@ export function getRowNumberColumnDef() {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export function getRowNumberState() {
|
|
35
|
-
return {
|
|
36
|
-
showRowNumberColumn: false,
|
|
37
|
-
rowNumberOffset: 0,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
34
|
/**
|
|
42
|
-
* showRowNumberColumn
|
|
35
|
+
* Retrieves showRowNumberColumn from the state
|
|
36
|
+
* Can be used to determine if the datatable should
|
|
37
|
+
* show the row number column or not
|
|
43
38
|
*/
|
|
44
39
|
export function hasRowNumberColumn(state) {
|
|
45
40
|
return state.showRowNumberColumn;
|
|
46
41
|
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Normalizes the passed in `value` to a boolean and
|
|
45
|
+
* sets it to showRowNumberColumn in the state
|
|
46
|
+
*/
|
|
47
47
|
export function setShowRowNumberColumn(state, value) {
|
|
48
48
|
state.showRowNumberColumn = normalizeBoolean(value);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
* rowNumberOffset
|
|
52
|
+
* Retrieves rowNumberOffset from the state
|
|
53
53
|
*/
|
|
54
|
-
|
|
55
54
|
export function getRowNumberOffset(state) {
|
|
56
55
|
return state.rowNumberOffset;
|
|
57
56
|
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Normalizes the passed in value to a non-negative number
|
|
60
|
+
* and sets it to the rowNumberOffset in the state.
|
|
61
|
+
* If the value is invalid, it falls back to 0.
|
|
62
|
+
*/
|
|
58
63
|
export function setRowNumberOffset(state, value) {
|
|
59
64
|
state.rowNumberOffset = normalizeNumberAttribute(
|
|
60
65
|
'rowNumberOffset',
|
|
61
66
|
value,
|
|
62
67
|
'non-negative',
|
|
63
|
-
|
|
68
|
+
0 // default rowNumberOffset value
|
|
64
69
|
);
|
|
65
70
|
}
|
|
66
71
|
|
|
72
|
+
export function isRowNumberColumn(column) {
|
|
73
|
+
return column.type === ROW_NUMBER_COLUMN_TYPE;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Calculates the width of the row number column
|
|
78
|
+
* This takes into account the number of digits in the row number
|
|
79
|
+
* (ex. 3 for 100 rows), padding in the cell and
|
|
80
|
+
* space allowance for the error tooltip which is rendered in this cell
|
|
81
|
+
*
|
|
82
|
+
* @param {Object} state - datatable's state object
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
67
85
|
export function getAdjustedRowNumberColumnWidth(state) {
|
|
68
86
|
const numOfRows = state.rows.length;
|
|
69
87
|
const offset = state.rowNumberOffset;
|
|
@@ -76,12 +94,19 @@ export function getAdjustedRowNumberColumnWidth(state) {
|
|
|
76
94
|
);
|
|
77
95
|
}
|
|
78
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Retrieves the column index of the row number column
|
|
99
|
+
* Returns -1 if the row number column is not present
|
|
100
|
+
*
|
|
101
|
+
* @param {Object} state - datatable's state object
|
|
102
|
+
* @returns {Number} index of row number column. Returns -1 if not present
|
|
103
|
+
*/
|
|
79
104
|
export function getRowNumberColumnIndex(state) {
|
|
80
105
|
if (hasRowNumberColumn(state) && state.columns.length > 0) {
|
|
81
106
|
const columns = state.columns;
|
|
82
107
|
for (let i = 0; i < columns.length; i++) {
|
|
83
108
|
const column = columns[i];
|
|
84
|
-
if (column.type ===
|
|
109
|
+
if (column.type === ROW_NUMBER_COLUMN_TYPE) {
|
|
85
110
|
return i;
|
|
86
111
|
}
|
|
87
112
|
}
|
|
@@ -89,6 +114,15 @@ export function getRowNumberColumnIndex(state) {
|
|
|
89
114
|
return -1;
|
|
90
115
|
}
|
|
91
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Constructs and returns the column definition for the row number column
|
|
119
|
+
* Column definition contains the row number column's row type and
|
|
120
|
+
* the error object containing the title, error messages and alt text
|
|
121
|
+
*
|
|
122
|
+
* @param {Object} rowErrors - object containing metadata of errors in the row
|
|
123
|
+
* @param {String} rowTitle - value of the cell which has the scope of the row/rowheader
|
|
124
|
+
* @returns
|
|
125
|
+
*/
|
|
92
126
|
export function getRowNumberErrorColumnDef(rowErrors, rowTitle) {
|
|
93
127
|
const { title, messages } = rowErrors;
|
|
94
128
|
|
|
@@ -105,7 +139,7 @@ export function getRowNumberErrorColumnDef(rowErrors, rowTitle) {
|
|
|
105
139
|
);
|
|
106
140
|
|
|
107
141
|
return {
|
|
108
|
-
type:
|
|
142
|
+
type: ROW_NUMBER_COLUMN_TYPE,
|
|
109
143
|
typeAttributes: {
|
|
110
144
|
error: { title, messages, alternativeText },
|
|
111
145
|
},
|