lightning-base-components 1.13.9-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.
Files changed (83) hide show
  1. package/metadata/raptor.json +1 -0
  2. package/package.json +21 -1
  3. package/scopedImports/@salesforce-internal-core.appVersion.js +1 -1
  4. package/scopedImports/@salesforce-label-LightningDualListbox.movedOptionsPlural.js +1 -0
  5. package/scopedImports/@salesforce-label-LightningDualListbox.movedOptionsSingular.js +1 -0
  6. package/scopedImports/@salesforce-label-LightningErrorMessage.validitySelectAtleastOne.js +1 -0
  7. package/scopedImports/@salesforce-label-LightningLookup.recentItems.js +1 -0
  8. package/scopedImports/@salesforce-label-LightningMap.titleWithAddress.js +1 -0
  9. package/src/lightning/ariaObserver/__component__/ariaObserver.spec.js +103 -0
  10. package/src/lightning/ariaObserver/__docs__/ariaObserver.md +142 -0
  11. package/src/lightning/{utilsPrivate/contentMutation.js → ariaObserver/ariaObserver.js} +51 -78
  12. package/src/lightning/baseCombobox/baseCombobox.html +1 -0
  13. package/src/lightning/baseCombobox/baseCombobox.js +14 -1
  14. package/src/lightning/buttonMenu/keyboard.js +0 -10
  15. package/src/lightning/card/card.html +6 -0
  16. package/src/lightning/checkboxGroup/checkboxGroup.html +2 -2
  17. package/src/lightning/checkboxGroup/checkboxGroup.js +6 -1
  18. package/src/lightning/colorPickerCustom/colorPickerCustom.js +20 -1
  19. package/src/lightning/combobox/combobox.css +12 -0
  20. package/src/lightning/combobox/combobox.html +1 -0
  21. package/src/lightning/datatable/__docs__/datatable.md +55 -0
  22. package/src/lightning/datatable/__examples__/basic/basic.html +1 -1
  23. package/src/lightning/datatable/columnWidthManager.js +7 -3
  24. package/src/lightning/datatable/columns-shared.js +1 -1
  25. package/src/lightning/datatable/datatable.js +122 -40
  26. package/src/lightning/datatable/errors.js +20 -9
  27. package/src/lightning/datatable/headerActions.js +77 -49
  28. package/src/lightning/datatable/inlineEdit.js +520 -373
  29. package/src/lightning/datatable/inlineEditShared.js +24 -0
  30. package/src/lightning/datatable/keyboard.js +1077 -933
  31. package/src/lightning/datatable/renderManager.js +241 -129
  32. package/src/lightning/datatable/resizer.js +91 -108
  33. package/src/lightning/datatable/rowLevelActions.js +17 -13
  34. package/src/lightning/datatable/rowNumber.js +54 -20
  35. package/src/lightning/datatable/rowSelection.js +760 -0
  36. package/src/lightning/datatable/rowSelectionShared.js +79 -0
  37. package/src/lightning/datatable/rows.js +16 -5
  38. package/src/lightning/datatable/state.js +10 -10
  39. package/src/lightning/datatable/templates/div/div.css +23 -0
  40. package/src/lightning/datatable/templates/div/div.html +6 -5
  41. package/src/lightning/datatable/templates/table/table.html +4 -4
  42. package/src/lightning/datatable/utils.js +14 -0
  43. package/src/lightning/datatable/widthManagerShared.js +1 -1
  44. package/src/lightning/dualListbox/dualListbox.html +1 -1
  45. package/src/lightning/dualListbox/dualListbox.js +42 -0
  46. package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +2 -1
  47. package/src/lightning/iconSvgTemplates/buildTemplates/utility/contract_alt.html +1 -2
  48. package/src/lightning/iconSvgTemplates/buildTemplates/utility/contract_doc.html +8 -0
  49. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +2 -1
  50. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/contract_alt.html +1 -2
  51. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/contract_doc.html +8 -0
  52. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +2 -1
  53. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/contract_alt.html +1 -2
  54. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/contract_doc.html +8 -0
  55. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +2 -1
  56. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/contract_alt.html +1 -2
  57. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/contract_doc.html +8 -0
  58. package/src/lightning/input/input.html +0 -1
  59. package/src/lightning/input/input.js +69 -48
  60. package/src/lightning/inputUtils/validity.js +12 -1
  61. package/src/lightning/pillContainer/__docs__/pillContainer.md +45 -1
  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 +169 -80
  67. package/src/lightning/primitiveDatatableIeditTypeFactory/primitiveDatatableIeditTypeFactory.js +97 -62
  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/primitiveHeaderFactory/nonsortableHeader.html +5 -4
  72. package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +46 -46
  73. package/src/lightning/primitiveHeaderFactory/selectableHeader.html +25 -23
  74. package/src/lightning/primitiveHeaderFactory/sortableHeader.html +13 -9
  75. package/src/lightning/progressIndicator/progressIndicator.js +4 -6
  76. package/src/lightning/progressStep/progressStep.js +31 -22
  77. package/src/lightning/staticMap/staticMap.html +1 -0
  78. package/src/lightning/staticMap/staticMap.js +39 -2
  79. package/src/lightning/utils/classSet.js +4 -1
  80. package/src/lightning/utilsPrivate/utilsPrivate.js +12 -1
  81. package/src/lightning/datatable/inlineEdit-shared.js +0 -14
  82. package/src/lightning/datatable/selector-shared.js +0 -38
  83. package/src/lightning/datatable/selector.js +0 -527
@@ -1,49 +1,31 @@
1
1
  import { unwrap } from 'lwc';
2
2
  import { getUserColumnIndex, getColumns } from './columns';
3
- import * as wraptext from './wrapText';
3
+ import { getActions, handleTriggeredAction } from './wrapText';
4
4
 
5
- function handleTriggeredInternalAction(dt, action, colKeyValue) {
6
- wraptext.handleTriggeredAction(dt.state, action, colKeyValue);
7
- dispatchHeaderActionEvent(dt, action, colKeyValue);
8
- }
9
-
10
- function handleTriggeredCustomerAction(dt, action, colKeyValue) {
11
- dispatchHeaderActionEvent(dt, action, colKeyValue);
12
- }
5
+ // Height of a clickable menu item
6
+ const ACTION_REM_HEIGHT = 2.125;
13
7
 
14
- function dispatchHeaderActionEvent(dt, action, colKeyValue) {
15
- const userColumnIndex = getUserColumnIndex(dt.state, colKeyValue);
16
- const customerColumnDefinition = dt.columns[userColumnIndex];
17
-
18
- dt.dispatchEvent(
19
- new CustomEvent('headeraction', {
20
- detail: {
21
- action: unwrap(action),
22
- columnDefinition: unwrap(customerColumnDefinition),
23
- },
24
- })
25
- );
26
- }
8
+ // Height of the menu divider, 1 rem + 1px (1/16px)
9
+ const DIVIDER_REM_HEIGHT = 1.0625;
27
10
 
28
- function getMenuAlignment(columns, index) {
29
- const isLastColumn = index === columns.length - 1;
30
-
31
- return isLastColumn || columns[index + 1].type === 'action'
32
- ? 'auto-right'
33
- : 'auto-left';
34
- }
11
+ /************************** PUBLIC METHODS ***************************/
35
12
 
13
+ /**
14
+ * Merges wrapText internal actions.
15
+ * If there are new internal actions in the future, they may be added here.
16
+ *
17
+ * @param {Object} state The state of the datatable
18
+ * @param {Object} columnDefinition The column definition to extract internal actions from
19
+ * @return {Array} All wrapText internal actions
20
+ */
36
21
  export function getInternalActions(state, columnDefinition) {
37
- // merge all internal actions here
38
- // currently, only wrapText internal actions
39
- // there may be new internal actions in the future
40
- return [...wraptext.getActions(state, columnDefinition)];
22
+ return [...getActions(state, columnDefinition)];
41
23
  }
42
24
 
43
25
  /**
44
26
  * Overrides the actions with the internal ones, plus the customer ones.
45
27
  *
46
- * @param {Object} state The state of the datatable.
28
+ * @param {Object} state The state of the datatable
47
29
  */
48
30
  export function updateHeaderActions(state) {
49
31
  const columns = getColumns(state);
@@ -59,31 +41,36 @@ export function updateHeaderActions(state) {
59
41
  });
60
42
  }
61
43
 
44
+ /**
45
+ * For internal actions, handles triggering the action.
46
+ * Then dispatches the header action event.
47
+ *
48
+ * @param {Event} event
49
+ */
62
50
  export function handleHeaderActionTriggered(event) {
51
+ event.stopPropagation();
52
+
63
53
  const { action, actionType, colKeyValue } = event.detail;
64
54
 
65
- event.stopPropagation();
66
- if (actionType === 'customer') {
67
- handleTriggeredCustomerAction(this, action, colKeyValue);
68
- } else {
69
- handleTriggeredInternalAction(this, action, colKeyValue);
55
+ if (actionType !== 'customer') {
56
+ handleTriggeredAction(this.state, action, colKeyValue);
70
57
  }
71
- }
72
58
 
73
- export function getColumnActionsDefaultState() {
74
- return Object.assign({}, wraptext.getDefaultState());
59
+ dispatchHeaderActionEvent(this, action, colKeyValue);
75
60
  }
76
61
 
77
- // in rem, the height of a clickable menu item
78
- const ACTION_HEIGHT = 2.125;
79
- // 1 rem + 1px (1/16px), height of the menu divider
80
- const DIVIDER_HEIGHT = 1.0625;
81
-
62
+ /**
63
+ * Calculates the size and positioning of the header action
64
+ * menu when it is opened.
65
+ *
66
+ * @param {Event} event
67
+ */
82
68
  export function handleHeaderActionMenuOpening(event) {
83
69
  event.stopPropagation();
84
70
  event.preventDefault();
85
- const actionsHeight = event.detail.actionsCount * ACTION_HEIGHT;
86
- const dividersHeight = event.detail.dividersCount * DIVIDER_HEIGHT;
71
+
72
+ const actionsHeight = event.detail.actionsCount * ACTION_REM_HEIGHT;
73
+ const dividersHeight = event.detail.dividersCount * DIVIDER_REM_HEIGHT;
87
74
  const wrapperHeight = 1;
88
75
  this._actionsMinHeightStyle = `min-height:${
89
76
  actionsHeight + dividersHeight + wrapperHeight
@@ -91,6 +78,47 @@ export function handleHeaderActionMenuOpening(event) {
91
78
  event.detail.saveContainerPosition(this.getViewableRect());
92
79
  }
93
80
 
81
+ /**
82
+ * Resets header action menu height when closed.
83
+ */
94
84
  export function handleHeaderActionMenuClosed() {
95
85
  this._actionsMinHeightStyle = '';
96
86
  }
87
+
88
+ /************************** PRIVATE METHODS ***************************/
89
+
90
+ /**
91
+ * Dispatches the `headeraction` event.
92
+ *
93
+ * @param {Object} dt The datatable
94
+ * @param {Object} action The action to dispatch
95
+ * @param {String} colKeyValue The column to dispatch the action on
96
+ */
97
+ function dispatchHeaderActionEvent(dt, action, colKeyValue) {
98
+ const userColumnIndex = getUserColumnIndex(dt.state, colKeyValue);
99
+ const customerColumnDefinition = dt.columns[userColumnIndex];
100
+
101
+ dt.dispatchEvent(
102
+ new CustomEvent('headeraction', {
103
+ detail: {
104
+ action: unwrap(action),
105
+ columnDefinition: unwrap(customerColumnDefinition),
106
+ },
107
+ })
108
+ );
109
+ }
110
+
111
+ /**
112
+ * Determines the menu alignment based on column placement.
113
+ *
114
+ * @param {Array} columns Array of all the columns
115
+ * @param {Integer} index The current column index to check
116
+ * @return {String} The computed alignment
117
+ */
118
+ function getMenuAlignment(columns, index) {
119
+ const isLastColumn = index === columns.length - 1;
120
+
121
+ return isLastColumn || columns[index + 1].type === 'action'
122
+ ? 'auto-right'
123
+ : 'auto-left';
124
+ }