lightning-base-components 1.13.10-alpha → 1.14.4-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 +24 -0
- package/package.json +20 -4
- package/scopedImports/@salesforce-internal-core.appVersion.js +1 -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/scopedImports/@salesforce-label-LightningModalBase.cancelandclose.js +1 -0
- package/src/lightning/ariaObserver/__component__/ariaObserver.spec.js +112 -0
- package/src/lightning/ariaObserver/__docs__/ariaObserver.md +142 -0
- package/src/lightning/{utilsPrivate/contentMutation.js → ariaObserver/ariaObserver.js} +60 -98
- 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 +98 -30
- package/src/lightning/datatable/errors.js +20 -9
- package/src/lightning/datatable/headerActions.js +77 -49
- package/src/lightning/datatable/infiniteLoading.js +100 -28
- package/src/lightning/datatable/inlineEdit.js +505 -379
- package/src/lightning/datatable/inlineEditShared.js +24 -0
- package/src/lightning/datatable/keyboard.js +162 -127
- package/src/lightning/datatable/renderManager.js +201 -133
- 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 +17 -6
- package/src/lightning/datatable/state.js +16 -2
- package/src/lightning/datatable/templates/div/div.css +4 -0
- package/src/lightning/datatable/templates/div/div.html +6 -0
- package/src/lightning/datatable/templates/table/table.html +5 -0
- package/src/lightning/datatable/utils.js +14 -0
- package/src/lightning/datatable/wrapText.js +77 -47
- package/src/lightning/dualListbox/dualListbox.html +1 -1
- package/src/lightning/dualListbox/dualListbox.js +42 -0
- package/src/lightning/formattedDateTime/__docs__/formattedDateTime.md +36 -3
- package/src/lightning/formattedDateTime/__examples__/datetime/datetime.html +2 -2
- package/src/lightning/formattedDateTime/__examples__/datetime/datetime.js +3 -1
- package/src/lightning/formattedDateTime/__examples__/time/time.html +1 -1
- package/src/lightning/formattedDateTime/__examples__/time/time.js +3 -1
- package/src/lightning/formattedDateTime/formattedDateTime.js +1 -0
- package/src/lightning/input/input.html +1 -5
- package/src/lightning/input/input.js +69 -48
- package/src/lightning/inputUtils/validity.js +12 -1
- package/src/lightning/pillContainer/__docs__/pillContainer.md +45 -1
- 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 +30 -22
- 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/utilsPrivate/utilsPrivate.js +12 -1
- package/scopedImports/@salesforce-label-LightningModalBase.close.js +0 -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,34 +1,67 @@
|
|
|
1
1
|
import { normalizeBoolean } from 'lightning/utilsPrivate';
|
|
2
2
|
import { getScrollOffsetFromTableEnd, isNonNegativeInteger } from './utils';
|
|
3
3
|
|
|
4
|
-
const SCROLLABLE_CONTAINER_SEL = '.slds-scrollable_y';
|
|
5
4
|
const SCROLL_ALLOWANCE = 2;
|
|
5
|
+
export const DEFAULT_LOAD_MORE_OFFSET = 20;
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
enableInfiniteLoading: false,
|
|
10
|
-
loadMoreOffset: 20,
|
|
11
|
-
isLoading: false,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
7
|
+
/*********************** STATE MANAGEMENT ************************/
|
|
14
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Returns whether the datatable is in a loading state
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} state The datatable state object
|
|
13
|
+
* @returns {Boolean} The loading state
|
|
14
|
+
*/
|
|
15
15
|
export function isLoading(state) {
|
|
16
16
|
return state.isLoading;
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Sets the loading state of the datatable
|
|
21
|
+
*
|
|
22
|
+
* @param {Object} state The datatable state object
|
|
23
|
+
* @param {Boolean} value The loading state to set
|
|
24
|
+
*/
|
|
18
25
|
export function setLoading(state, value) {
|
|
19
26
|
state.isLoading = normalizeBoolean(value);
|
|
20
27
|
}
|
|
21
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Returns whether infinite loading is enabled on the datatable
|
|
31
|
+
*
|
|
32
|
+
* @param {Object} state The datatable state object
|
|
33
|
+
* @returns {Boolean} The infinite loading state
|
|
34
|
+
*/
|
|
22
35
|
export function isInfiniteLoadingEnabled(state) {
|
|
23
36
|
return state.enableInfiniteLoading;
|
|
24
37
|
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Sets the infinite loading option on the datatable
|
|
41
|
+
*
|
|
42
|
+
* @param {Object} state The datatable state object
|
|
43
|
+
* @param {Boolean} value The infinite loading state to set
|
|
44
|
+
*/
|
|
25
45
|
export function setInfiniteLoading(state, value) {
|
|
26
46
|
state.enableInfiniteLoading = normalizeBoolean(value);
|
|
27
47
|
}
|
|
28
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Returns the load more offset
|
|
51
|
+
*
|
|
52
|
+
* @param {Object} state The datatable state object
|
|
53
|
+
* @returns {Number} The currently configured load more offset value
|
|
54
|
+
*/
|
|
29
55
|
export function getLoadMoreOffset(state) {
|
|
30
56
|
return state.loadMoreOffset;
|
|
31
57
|
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Sets the load more offset value. Must be a number >= 0.
|
|
61
|
+
*
|
|
62
|
+
* @param {Object} state The datatable state object
|
|
63
|
+
* @param {Boolean} value The load more offset value to set
|
|
64
|
+
*/
|
|
32
65
|
export function setLoadMoreOffset(state, value) {
|
|
33
66
|
if (!isNonNegativeInteger(value)) {
|
|
34
67
|
// eslint-disable-next-line no-console
|
|
@@ -40,9 +73,17 @@ export function setLoadMoreOffset(state, value) {
|
|
|
40
73
|
|
|
41
74
|
state.loadMoreOffset = isNonNegativeInteger(value)
|
|
42
75
|
? parseInt(value, 10)
|
|
43
|
-
:
|
|
76
|
+
: DEFAULT_LOAD_MORE_OFFSET;
|
|
44
77
|
}
|
|
45
78
|
|
|
79
|
+
/************************** PUBLIC METHODS ***************************/
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Checks whether the datatable should begin loading more content
|
|
83
|
+
* and then dispatches the `loadmore` event indicating that directive.
|
|
84
|
+
*
|
|
85
|
+
* @param {Event} event
|
|
86
|
+
*/
|
|
46
87
|
export function handleLoadMoreCheck(event) {
|
|
47
88
|
if (isLoading(this.state)) {
|
|
48
89
|
return;
|
|
@@ -60,24 +101,13 @@ export function handleLoadMoreCheck(event) {
|
|
|
60
101
|
}
|
|
61
102
|
}
|
|
62
103
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
function isScrollerVisible(elem) {
|
|
72
|
-
return (
|
|
73
|
-
elem && !!(elem.offsetParent || elem.offsetHeight || elem.offsetWidth)
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function hasData(root) {
|
|
78
|
-
return root.querySelectorAll('tbody > tr').length > 0;
|
|
79
|
-
}
|
|
80
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Determines whether or not to prefetch data. If so,
|
|
106
|
+
* dispatches the `loadmore` event.
|
|
107
|
+
*
|
|
108
|
+
* @param {Object} root The datatable
|
|
109
|
+
* @param {Object} state The datatable state object
|
|
110
|
+
*/
|
|
81
111
|
export function handlePrefetch(root, state) {
|
|
82
112
|
if (
|
|
83
113
|
!isInfiniteLoadingEnabled(state) ||
|
|
@@ -91,9 +121,51 @@ export function handlePrefetch(root, state) {
|
|
|
91
121
|
return;
|
|
92
122
|
}
|
|
93
123
|
|
|
94
|
-
const elem = root.querySelector(
|
|
124
|
+
const elem = root.querySelector('.slds-scrollable_y');
|
|
95
125
|
|
|
96
126
|
if (isScrollerVisible(elem) && !isScrollable(elem)) {
|
|
97
127
|
this.dispatchEvent(new CustomEvent('loadmore'));
|
|
98
128
|
}
|
|
99
129
|
}
|
|
130
|
+
|
|
131
|
+
/************************** PRIVATE METHODS ***************************/
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Determines if a DOM element is scrollable
|
|
135
|
+
*
|
|
136
|
+
* @param {Element} element The DOM element to check
|
|
137
|
+
* @returns {Boolean} Whether or not the element is scrollable
|
|
138
|
+
*/
|
|
139
|
+
function isScrollable(element) {
|
|
140
|
+
// scrollHeight should be greater than clientHeight by some allowance
|
|
141
|
+
return (
|
|
142
|
+
element &&
|
|
143
|
+
element.scrollHeight > element.clientHeight + SCROLL_ALLOWANCE
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Determines if a DOM element's scroll bars are visible
|
|
149
|
+
*
|
|
150
|
+
* @param {Element} element The DOM element to check
|
|
151
|
+
* @returns {Boolean} Whether or not the element's scroll bars are visible
|
|
152
|
+
*/
|
|
153
|
+
function isScrollerVisible(element) {
|
|
154
|
+
return (
|
|
155
|
+
element &&
|
|
156
|
+
!!(element.offsetParent || element.offsetHeight || element.offsetWidth)
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Determines if a root element has data
|
|
162
|
+
*
|
|
163
|
+
* @param {Element} root The parent element to check
|
|
164
|
+
* @returns {Boolean} Whether or not the element contains any data
|
|
165
|
+
*/
|
|
166
|
+
function hasData(root) {
|
|
167
|
+
return (
|
|
168
|
+
root.querySelectorAll('tbody > tr, [role="rowgroup"] > [role="row"]')
|
|
169
|
+
.length > 0
|
|
170
|
+
);
|
|
171
|
+
}
|