lightning-base-components 1.14.2-alpha → 1.14.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.
Files changed (82) hide show
  1. package/metadata/raptor.json +33 -1
  2. package/package.json +20 -4
  3. package/scopedImports/@salesforce-label-LightningDualListbox.movedOptionsPlural.js +1 -0
  4. package/scopedImports/@salesforce-label-LightningDualListbox.movedOptionsSingular.js +1 -0
  5. package/scopedImports/@salesforce-label-LightningErrorMessage.validitySelectAtleastOne.js +1 -0
  6. package/scopedImports/@salesforce-label-LightningMap.titleWithAddress.js +1 -0
  7. package/scopedImports/@salesforce-label-LightningModalBase.cancelandclose.js +1 -0
  8. package/src/lightning/ariaObserver/__component__/ariaObserver.spec.js +9 -0
  9. package/src/lightning/ariaObserver/__docs__/ariaObserver.md +142 -0
  10. package/src/lightning/ariaObserver/ariaObserver.js +24 -35
  11. package/src/lightning/baseFormattedText/baseFormattedText.html +6 -1
  12. package/src/lightning/baseFormattedText/baseFormattedText.js +5 -0
  13. package/src/lightning/buttonMenu/keyboard.js +0 -10
  14. package/src/lightning/card/card.html +6 -0
  15. package/src/lightning/checkboxGroup/checkboxGroup.html +2 -2
  16. package/src/lightning/checkboxGroup/checkboxGroup.js +6 -1
  17. package/src/lightning/colorPickerCustom/colorPickerCustom.js +20 -1
  18. package/src/lightning/datatable/__docs__/datatable.md +55 -0
  19. package/src/lightning/datatable/__examples__/basic/basic.html +1 -1
  20. package/src/lightning/datatable/__examples__/withInfiniteLoading/fetchDataHelper.js +21 -0
  21. package/src/lightning/datatable/__examples__/withInfiniteLoading/withInfiniteLoading.html +13 -0
  22. package/src/lightning/datatable/__examples__/withInfiniteLoading/withInfiniteLoading.js +42 -0
  23. package/src/lightning/datatable/autoWidthStrategy.js +170 -61
  24. package/src/lightning/datatable/{resizer.js → columnResizer.js} +0 -0
  25. package/src/lightning/datatable/columnWidthManager.js +226 -44
  26. package/src/lightning/datatable/columns-shared.js +1 -1
  27. package/src/lightning/datatable/datatable.js +104 -33
  28. package/src/lightning/datatable/errors.js +20 -9
  29. package/src/lightning/datatable/fixedWidthStrategy.js +43 -8
  30. package/src/lightning/datatable/headerActions.js +77 -49
  31. package/src/lightning/datatable/infiniteLoading.js +100 -28
  32. package/src/lightning/datatable/inlineEdit.js +505 -379
  33. package/src/lightning/datatable/inlineEditShared.js +24 -0
  34. package/src/lightning/datatable/keyboard.js +162 -127
  35. package/src/lightning/datatable/renderManager.js +208 -133
  36. package/src/lightning/datatable/{datatableResizeObserver.js → resizeObserver.js} +46 -29
  37. package/src/lightning/datatable/resizeSensor.js +8 -0
  38. package/src/lightning/datatable/rowLevelActions.js +17 -13
  39. package/src/lightning/datatable/rowNumber.js +54 -20
  40. package/src/lightning/datatable/rowSelection.js +760 -0
  41. package/src/lightning/datatable/rowSelectionShared.js +79 -0
  42. package/src/lightning/datatable/rows.js +17 -6
  43. package/src/lightning/datatable/state.js +16 -2
  44. package/src/lightning/datatable/templates/div/div.css +4 -0
  45. package/src/lightning/datatable/templates/div/div.html +128 -117
  46. package/src/lightning/datatable/templates/table/table.html +5 -0
  47. package/src/lightning/datatable/utils.js +14 -0
  48. package/src/lightning/datatable/widthManagerShared.js +27 -3
  49. package/src/lightning/datatable/wrapText.js +77 -47
  50. package/src/lightning/dualListbox/dualListbox.html +1 -1
  51. package/src/lightning/dualListbox/dualListbox.js +42 -0
  52. package/src/lightning/formattedDateTime/__docs__/formattedDateTime.md +36 -3
  53. package/src/lightning/formattedDateTime/__examples__/datetime/datetime.html +2 -2
  54. package/src/lightning/formattedDateTime/__examples__/datetime/datetime.js +3 -1
  55. package/src/lightning/formattedDateTime/__examples__/time/time.html +1 -1
  56. package/src/lightning/formattedDateTime/__examples__/time/time.js +3 -1
  57. package/src/lightning/formattedDateTime/formattedDateTime.js +1 -0
  58. package/src/lightning/input/input.html +2 -5
  59. package/src/lightning/inputUtils/validity.js +12 -1
  60. package/src/lightning/pillContainer/__docs__/pillContainer.md +45 -1
  61. package/src/lightning/positionLibrary/positionLibrary.js +31 -43
  62. package/src/lightning/primitiveCellActions/primitiveCellActions.js +69 -12
  63. package/src/lightning/primitiveCellFactory/cellWithStandardLayout.html +13 -11
  64. package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +13 -8
  65. package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.html +17 -14
  66. package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.js +167 -98
  67. package/src/lightning/primitiveDatatableIeditTypeFactory/primitiveDatatableIeditTypeFactory.js +94 -69
  68. package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.html +4 -4
  69. package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.js +4 -4
  70. package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.js +99 -37
  71. package/src/lightning/progressIndicator/progressIndicator.js +1 -1
  72. package/src/lightning/progressStep/progressStep.js +1 -1
  73. package/src/lightning/spinner/spinner.html +1 -1
  74. package/src/lightning/spinner/spinner.js +12 -0
  75. package/src/lightning/staticMap/staticMap.html +1 -0
  76. package/src/lightning/staticMap/staticMap.js +39 -2
  77. package/src/lightning/utils/classSet.js +4 -1
  78. package/src/lightning/utilsPrivate/phonify.js +1 -1
  79. package/scopedImports/@salesforce-label-LightningModalBase.close.js +0 -1
  80. package/src/lightning/datatable/inlineEdit-shared.js +0 -14
  81. package/src/lightning/datatable/selector-shared.js +0 -38
  82. 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 TOOLTIP_ALLOWANCE = 20;
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
- export function isRowNumberColumn(column) {
17
- return column.type === COLUMN_TYPE;
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: COLUMN_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
- getRowNumberState().rowNumberOffset
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 === 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: COLUMN_TYPE,
142
+ type: ROW_NUMBER_COLUMN_TYPE,
109
143
  typeAttributes: {
110
144
  error: { title, messages, alternativeText },
111
145
  },