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
|
@@ -1,25 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
},
|
|
7
|
-
};
|
|
8
|
-
}
|
|
1
|
+
// Default empty error state
|
|
2
|
+
const DEFAULT_ERROR_STATE = {
|
|
3
|
+
rows: {},
|
|
4
|
+
table: {},
|
|
5
|
+
};
|
|
9
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves the errors object from datatable's state object
|
|
9
|
+
* Returns the set of row-level errors and table-level errors
|
|
10
|
+
*/
|
|
10
11
|
export function getErrors(state) {
|
|
11
12
|
return state.errors;
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Sets the row-level errors and table-level errors in datatable's state object
|
|
17
|
+
* Errors being set here overwrite the previous error object in the state
|
|
18
|
+
*/
|
|
14
19
|
export function setErrors(state, errors) {
|
|
15
|
-
return (state.errors = Object.assign({},
|
|
20
|
+
return (state.errors = Object.assign({}, DEFAULT_ERROR_STATE, errors));
|
|
16
21
|
}
|
|
17
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves the row-level errors of a particular row from datatable's state object
|
|
25
|
+
*/
|
|
18
26
|
export function getRowError(state, rowKey) {
|
|
19
27
|
const rows = getErrors(state).rows;
|
|
20
28
|
return (rows && rows[rowKey]) || {};
|
|
21
29
|
}
|
|
22
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves the table-level errors from the datatable's state object
|
|
33
|
+
*/
|
|
23
34
|
export function getTableError(state) {
|
|
24
35
|
return getErrors(state).table || {};
|
|
25
36
|
}
|
|
@@ -1,49 +1,31 @@
|
|
|
1
1
|
import { unwrap } from 'lwc';
|
|
2
2
|
import { getUserColumnIndex, getColumns } from './columns';
|
|
3
|
-
import
|
|
3
|
+
import { getActions, handleTriggeredAction } from './wrapText';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
66
|
-
|
|
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
|
-
|
|
74
|
-
return Object.assign({}, wraptext.getDefaultState());
|
|
59
|
+
dispatchHeaderActionEvent(this, action, colKeyValue);
|
|
75
60
|
}
|
|
76
61
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
86
|
-
const
|
|
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
|
+
}
|