lightning-base-components 1.19.7-alpha → 1.19.8-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 +78 -0
- package/package.json +5 -1
- package/scopedImports/@salesforce-label-LightningProgressRing.progressRing.js +1 -0
- package/src/lightning/baseCombobox/baseCombobox.css +8 -0
- package/src/lightning/baseCombobox/baseCombobox.js +1 -0
- package/src/lightning/datatable/README.md +2 -1
- package/src/lightning/datatable/columnResizer.js +22 -18
- package/src/lightning/datatable/columnWidthManager.js +30 -22
- package/src/lightning/datatable/errors.js +2 -2
- package/src/lightning/datatable/infiniteLoading.js +13 -14
- package/src/lightning/datatable/sort.js +15 -16
- package/src/lightning/datatable/tree.js +10 -6
- package/src/lightning/datatable/types.js +158 -129
- package/src/lightning/datatable/utils.js +26 -24
- package/src/lightning/datatable/wrapText.js +15 -8
- package/src/lightning/input/input.html +23 -2
- package/src/lightning/input/input.js +54 -2
- package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +74 -69
- package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.js +8 -2
- package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +62 -87
- package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.html +3 -0
- package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.js +3 -0
- package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.html +3 -0
- package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.js +3 -0
- package/src/lightning/primitiveInputFile/primitiveInputFile.html +3 -0
- package/src/lightning/primitiveInputFile/primitiveInputFile.js +3 -0
- package/src/lightning/primitiveInputRadio/primitiveInputRadio.html +3 -0
- package/src/lightning/primitiveInputRadio/primitiveInputRadio.js +3 -0
- package/src/lightning/primitiveInputSimple/primitiveInputSimple.html +6 -0
- package/src/lightning/primitiveInputSimple/primitiveInputSimple.js +7 -19
- package/src/lightning/primitiveInputToggle/primitiveInputToggle.html +4 -1
- package/src/lightning/primitiveInputToggle/primitiveInputToggle.js +3 -0
- package/src/lightning/progressRing/progressRing.html +9 -7
- package/src/lightning/progressRing/progressRing.js +15 -0
- package/src/lightning/tabBar/tabBar.html +5 -1
- package/src/lightning/tabBar/tabBar.js +25 -9
- package/src/lightning/utils/classSet.js +19 -19
- package/src/lightning/utilsPrivate/aria.js +11 -8
- package/src/lightning/utilsPrivate/classListMutation.js +5 -3
- package/src/lightning/utilsPrivate/classSet.js +11 -0
- package/src/lightning/utilsPrivate/eventEmitter.js +4 -4
- package/src/lightning/utilsPrivate/inert.js +6 -4
- package/src/lightning/utilsPrivate/utilsPrivate.js +40 -8
package/metadata/raptor.json
CHANGED
|
@@ -187,6 +187,11 @@
|
|
|
187
187
|
{
|
|
188
188
|
"name": "focus"
|
|
189
189
|
}
|
|
190
|
+
],
|
|
191
|
+
"staticProperties": [
|
|
192
|
+
{
|
|
193
|
+
"name": "validationOptOut"
|
|
194
|
+
}
|
|
190
195
|
]
|
|
191
196
|
},
|
|
192
197
|
"breadcrumbs": {
|
|
@@ -629,11 +634,18 @@
|
|
|
629
634
|
{
|
|
630
635
|
"name": "showHelpMessageIfInvalid"
|
|
631
636
|
}
|
|
637
|
+
],
|
|
638
|
+
"staticProperties": [
|
|
639
|
+
{
|
|
640
|
+
"name": "validationOptOut"
|
|
641
|
+
}
|
|
632
642
|
]
|
|
633
643
|
},
|
|
634
644
|
"commerceApi": {},
|
|
645
|
+
"commerceConfigurationApi": {},
|
|
635
646
|
"commerceEsfApi": {},
|
|
636
647
|
"commerceExtensionApi": {},
|
|
648
|
+
"commerceManagementApi": {},
|
|
637
649
|
"commerceStoreManagementApi": {},
|
|
638
650
|
"communityInfoApi": {},
|
|
639
651
|
"communityMicrobatchingApi": {},
|
|
@@ -663,6 +675,16 @@
|
|
|
663
675
|
"context": {
|
|
664
676
|
"slotNames": [
|
|
665
677
|
""
|
|
678
|
+
],
|
|
679
|
+
"statics": [
|
|
680
|
+
{
|
|
681
|
+
"name": "getDefaultContext"
|
|
682
|
+
}
|
|
683
|
+
],
|
|
684
|
+
"staticProperties": [
|
|
685
|
+
{
|
|
686
|
+
"name": "Provider"
|
|
687
|
+
}
|
|
666
688
|
]
|
|
667
689
|
},
|
|
668
690
|
"dataProviderApi": {},
|
|
@@ -898,6 +920,7 @@
|
|
|
898
920
|
}
|
|
899
921
|
]
|
|
900
922
|
},
|
|
923
|
+
"einsteinllmApi": {},
|
|
901
924
|
"empApi": {
|
|
902
925
|
"minVersion": "44.0"
|
|
903
926
|
},
|
|
@@ -1350,6 +1373,11 @@
|
|
|
1350
1373
|
{
|
|
1351
1374
|
"name": "value"
|
|
1352
1375
|
}
|
|
1376
|
+
],
|
|
1377
|
+
"staticProperties": [
|
|
1378
|
+
{
|
|
1379
|
+
"name": "validationOptOut"
|
|
1380
|
+
}
|
|
1353
1381
|
]
|
|
1354
1382
|
},
|
|
1355
1383
|
"formattedText": {
|
|
@@ -1559,6 +1587,11 @@
|
|
|
1559
1587
|
{
|
|
1560
1588
|
"name": "variant"
|
|
1561
1589
|
}
|
|
1590
|
+
],
|
|
1591
|
+
"staticProperties": [
|
|
1592
|
+
{
|
|
1593
|
+
"name": "validationOptOut"
|
|
1594
|
+
}
|
|
1562
1595
|
]
|
|
1563
1596
|
},
|
|
1564
1597
|
"iconSvgTemplates": {
|
|
@@ -1610,16 +1643,19 @@
|
|
|
1610
1643
|
"industriesCriteriaBasedSearchFilterApi": {},
|
|
1611
1644
|
"industriesDataloadingApi": {},
|
|
1612
1645
|
"industriesDecisionMatrixDesignerApi": {},
|
|
1646
|
+
"industriesDecisiontableApi": {},
|
|
1613
1647
|
"industriesDocgenApi": {},
|
|
1614
1648
|
"industriesDocumentmatrixApi": {},
|
|
1615
1649
|
"industriesEducationApi": {},
|
|
1616
1650
|
"industriesEinsteinAIAcceleratorApi": {},
|
|
1651
|
+
"industriesEnergyUtilitiesApi": {},
|
|
1617
1652
|
"industriesEpcApi": {},
|
|
1618
1653
|
"industriesEriApi": {},
|
|
1619
1654
|
"industriesExplainabilityApi": {},
|
|
1620
1655
|
"industriesExternalDocumentApi": {},
|
|
1621
1656
|
"industriesFeatureValidationApi": {},
|
|
1622
1657
|
"industriesFieldsetApi": {},
|
|
1658
|
+
"industriesFilebasedDataimportApi": {},
|
|
1623
1659
|
"industriesFundraisingApi": {},
|
|
1624
1660
|
"industriesGroupApi": {},
|
|
1625
1661
|
"industriesHealthcloudApi": {},
|
|
@@ -1762,6 +1798,9 @@
|
|
|
1762
1798
|
{
|
|
1763
1799
|
"name": "required"
|
|
1764
1800
|
},
|
|
1801
|
+
{
|
|
1802
|
+
"name": "role"
|
|
1803
|
+
},
|
|
1765
1804
|
{
|
|
1766
1805
|
"name": "selectionEnd"
|
|
1767
1806
|
},
|
|
@@ -2224,6 +2263,11 @@
|
|
|
2224
2263
|
{
|
|
2225
2264
|
"name": "verticalAlign"
|
|
2226
2265
|
}
|
|
2266
|
+
],
|
|
2267
|
+
"staticProperties": [
|
|
2268
|
+
{
|
|
2269
|
+
"name": "validationOptOut"
|
|
2270
|
+
}
|
|
2227
2271
|
]
|
|
2228
2272
|
},
|
|
2229
2273
|
"layoutItem": {
|
|
@@ -2253,6 +2297,11 @@
|
|
|
2253
2297
|
{
|
|
2254
2298
|
"name": "smallDeviceSize"
|
|
2255
2299
|
}
|
|
2300
|
+
],
|
|
2301
|
+
"staticProperties": [
|
|
2302
|
+
{
|
|
2303
|
+
"name": "validationOptOut"
|
|
2304
|
+
}
|
|
2256
2305
|
]
|
|
2257
2306
|
},
|
|
2258
2307
|
"logger": {
|
|
@@ -2881,6 +2930,7 @@
|
|
|
2881
2930
|
},
|
|
2882
2931
|
"placeOrderApi": {},
|
|
2883
2932
|
"placeQuoteApi": {},
|
|
2933
|
+
"platformContentTaxonomyApi": {},
|
|
2884
2934
|
"platformExternalServicesApi": {},
|
|
2885
2935
|
"platformGlobalizationApi": {},
|
|
2886
2936
|
"platformNamedCredentialApi": {},
|
|
@@ -3320,6 +3370,11 @@
|
|
|
3320
3370
|
{
|
|
3321
3371
|
"name": "value"
|
|
3322
3372
|
}
|
|
3373
|
+
],
|
|
3374
|
+
"methods": [
|
|
3375
|
+
{
|
|
3376
|
+
"name": "focus"
|
|
3377
|
+
}
|
|
3323
3378
|
]
|
|
3324
3379
|
},
|
|
3325
3380
|
"primitiveInputText": {
|
|
@@ -4139,6 +4194,9 @@
|
|
|
4139
4194
|
{
|
|
4140
4195
|
"name": "displayInfo"
|
|
4141
4196
|
},
|
|
4197
|
+
{
|
|
4198
|
+
"name": "fieldLevelHelp"
|
|
4199
|
+
},
|
|
4142
4200
|
{
|
|
4143
4201
|
"name": "filter"
|
|
4144
4202
|
},
|
|
@@ -4358,6 +4416,11 @@
|
|
|
4358
4416
|
{
|
|
4359
4417
|
"name": "showHelpMessageIfInvalid"
|
|
4360
4418
|
}
|
|
4419
|
+
],
|
|
4420
|
+
"staticProperties": [
|
|
4421
|
+
{
|
|
4422
|
+
"name": "validationOptOut"
|
|
4423
|
+
}
|
|
4361
4424
|
]
|
|
4362
4425
|
},
|
|
4363
4426
|
"serviceAutomationServiceCatalogApi": {},
|
|
@@ -4511,6 +4574,11 @@
|
|
|
4511
4574
|
{
|
|
4512
4575
|
"name": "variant"
|
|
4513
4576
|
}
|
|
4577
|
+
],
|
|
4578
|
+
"staticProperties": [
|
|
4579
|
+
{
|
|
4580
|
+
"name": "validationOptOut"
|
|
4581
|
+
}
|
|
4514
4582
|
]
|
|
4515
4583
|
},
|
|
4516
4584
|
"stackedTab": {
|
|
@@ -4723,6 +4791,11 @@
|
|
|
4723
4791
|
{
|
|
4724
4792
|
"name": "focus"
|
|
4725
4793
|
}
|
|
4794
|
+
],
|
|
4795
|
+
"statics": [
|
|
4796
|
+
{
|
|
4797
|
+
"name": "show"
|
|
4798
|
+
}
|
|
4726
4799
|
]
|
|
4727
4800
|
},
|
|
4728
4801
|
"toastContainer": {
|
|
@@ -4743,6 +4816,11 @@
|
|
|
4743
4816
|
{
|
|
4744
4817
|
"name": "close"
|
|
4745
4818
|
}
|
|
4819
|
+
],
|
|
4820
|
+
"statics": [
|
|
4821
|
+
{
|
|
4822
|
+
"name": "instance"
|
|
4823
|
+
}
|
|
4746
4824
|
]
|
|
4747
4825
|
},
|
|
4748
4826
|
"tree": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lightning-base-components",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.8-alpha",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"external",
|
|
@@ -366,6 +366,10 @@
|
|
|
366
366
|
"name": "@salesforce/label/LightningProgressBar.progressBar",
|
|
367
367
|
"path": "scopedImports/@salesforce-label-LightningProgressBar.progressBar.js"
|
|
368
368
|
},
|
|
369
|
+
{
|
|
370
|
+
"name": "@salesforce/label/LightningProgressRing.progressRing",
|
|
371
|
+
"path": "scopedImports/@salesforce-label-LightningProgressRing.progressRing.js"
|
|
372
|
+
},
|
|
369
373
|
{
|
|
370
374
|
"name": "@salesforce/label/LightningProgressRing.warning",
|
|
371
375
|
"path": "scopedImports/@salesforce-label-LightningProgressRing.warning.js"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default 'Progress Ring';
|
|
@@ -17,3 +17,11 @@ button:disabled,
|
|
|
17
17
|
[type='button']:disabled {
|
|
18
18
|
cursor: not-allowed;
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
/* W-14210059 - the input height automatically increases with font size
|
|
22
|
+
* to about 1.2em, but not the button. However, changing the line-height
|
|
23
|
+
* of the button will increase the height accordingly
|
|
24
|
+
*/
|
|
25
|
+
.fix-slds-input_faux {
|
|
26
|
+
line-height: max(1.875rem, calc(1.2em - 2px));
|
|
27
|
+
}
|
|
@@ -669,6 +669,7 @@ export default class LightningBaseCombobox extends LightningElement {
|
|
|
669
669
|
const classes = classSet('slds-combobox__input');
|
|
670
670
|
classes.add({
|
|
671
671
|
'slds-input_faux': this.isUserInputDisabled, //rendering button
|
|
672
|
+
'fix-slds-input_faux': this.isUserInputDisabled, // W-14210059
|
|
672
673
|
'slds-input': !this.isUserInputDisabled, //rendering input
|
|
673
674
|
'slds-is-disabled': this.disabled,
|
|
674
675
|
'slds-combobox__input-value': this.computedInputValue,
|
|
@@ -49,4 +49,5 @@ However, Locker permits these features in internal implementations.
|
|
|
49
49
|
- Dispatching custom events on custom data types
|
|
50
50
|
- Accessibility and keyboard navigation on custom data types
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
|
|
53
|
+
For more information, see [Extend lightning-datatable with Custom Data](https://gus.lightning.force.com/lightning/r/0D5EE00001TA1uZ0AT/view).
|
|
@@ -139,17 +139,19 @@ export function getCSSWidthStyleOfTable(widthsData) {
|
|
|
139
139
|
export function adjustColumnsSizeFromState(state) {
|
|
140
140
|
const columnsWidths = getColumnsWidths(state);
|
|
141
141
|
let columnsWidthSum = 0;
|
|
142
|
-
getColumns(state)
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
const columns = getColumns(state);
|
|
143
|
+
for (let i = 0, { length } = columns; i < length; i += 1) {
|
|
144
|
+
const width = columnsWidths[i];
|
|
145
|
+
if (width !== undefined) {
|
|
146
|
+
const col = columns[i];
|
|
145
147
|
if (isRTL()) {
|
|
146
|
-
|
|
148
|
+
col.offset = columnsWidthSum;
|
|
147
149
|
}
|
|
148
150
|
columnsWidthSum += width;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
+
col.columnWidth = width;
|
|
152
|
+
col.style = buildCSSWidthStyle(width);
|
|
151
153
|
}
|
|
152
|
-
}
|
|
154
|
+
}
|
|
153
155
|
setTableWidth(state, columnsWidthSum);
|
|
154
156
|
}
|
|
155
157
|
|
|
@@ -204,7 +206,8 @@ function updateColumnWidth(columns, widthsData, colIndex, newWidth) {
|
|
|
204
206
|
}
|
|
205
207
|
|
|
206
208
|
export function updateColumnWidthsMetadata(columns, widthsData) {
|
|
207
|
-
|
|
209
|
+
for (let i = 0, { length } = columns; i < length; i += 1) {
|
|
210
|
+
const col = columns[i];
|
|
208
211
|
if (!col.internal) {
|
|
209
212
|
col.minWidth = getMinColumnWidth(widthsData);
|
|
210
213
|
col.maxWidth = getMaxColumnWidth(widthsData);
|
|
@@ -217,7 +220,7 @@ export function updateColumnWidthsMetadata(columns, widthsData) {
|
|
|
217
220
|
col.maxWidth
|
|
218
221
|
);
|
|
219
222
|
}
|
|
220
|
-
}
|
|
223
|
+
}
|
|
221
224
|
}
|
|
222
225
|
|
|
223
226
|
/**
|
|
@@ -230,10 +233,9 @@ export function updateColumnWidthsMetadata(columns, widthsData) {
|
|
|
230
233
|
*/
|
|
231
234
|
function updateColumnOffsets(columns, colIndex, newDelta) {
|
|
232
235
|
if (isRTL()) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
});
|
|
236
|
+
for (let i = colIndex, { length } = columns; i < length; i += 1) {
|
|
237
|
+
columns[i].offset += newDelta;
|
|
238
|
+
}
|
|
237
239
|
}
|
|
238
240
|
}
|
|
239
241
|
|
|
@@ -245,12 +247,14 @@ function updateColumnOffsets(columns, colIndex, newDelta) {
|
|
|
245
247
|
* belong to a column with the same index in column prop
|
|
246
248
|
*/
|
|
247
249
|
export function getCustomerColumnWidths(columns, widthsData) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
250
|
+
const widths = [];
|
|
251
|
+
const { columnWidths } = widthsData;
|
|
252
|
+
for (let i = 0, { length } = columns; i < length; i += 1) {
|
|
253
|
+
if (isCustomerColumn(columns[i])) {
|
|
254
|
+
widths.push(columnWidths[i]);
|
|
251
255
|
}
|
|
252
|
-
|
|
253
|
-
|
|
256
|
+
}
|
|
257
|
+
return widths;
|
|
254
258
|
}
|
|
255
259
|
|
|
256
260
|
/**
|
|
@@ -44,24 +44,27 @@ const tableTypes = {
|
|
|
44
44
|
*/
|
|
45
45
|
export function computeColumnWidths(adjustedWidths, columnDefs, widthsData) {
|
|
46
46
|
const { columnWidths } = adjustedWidths;
|
|
47
|
-
|
|
47
|
+
const { length: columnDefsLength } = columnDefs;
|
|
48
|
+
if (columnWidths.length !== columnDefsLength) {
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
51
|
let columnWidthsSum = 0;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
const rtl = isRTL();
|
|
53
|
+
for (let i = 0; i < columnDefsLength; i += 1) {
|
|
54
|
+
const col = columnDefs[i];
|
|
55
|
+
const newWidth = columnWidths[i];
|
|
56
|
+
widthsData.columnWidths[i] = newWidth;
|
|
57
|
+
col.columnWidth = newWidth;
|
|
58
|
+
col.style = buildCSSWidthStyle(newWidth);
|
|
56
59
|
|
|
57
60
|
// In RTL, we need to explicitly position the column headers.
|
|
58
61
|
// We do this by providing the offset (in pixels) from the start of the table.
|
|
59
|
-
if (
|
|
60
|
-
|
|
62
|
+
if (rtl) {
|
|
63
|
+
col.offset = columnWidthsSum;
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
columnWidthsSum += newWidth;
|
|
64
|
-
}
|
|
67
|
+
}
|
|
65
68
|
|
|
66
69
|
// TODO: W-7679487 - `tableWidth` should match `columnWidthsSum`
|
|
67
70
|
widthsData.tableWidth = columnWidthsSum;
|
|
@@ -144,9 +147,12 @@ export class ColumnWidthManager {
|
|
|
144
147
|
* @param {Number} value The minimum column width
|
|
145
148
|
*/
|
|
146
149
|
set minColumnWidth(value) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
})
|
|
150
|
+
const { _widthStrategies } = this;
|
|
151
|
+
const keys = Object.keys(_widthStrategies);
|
|
152
|
+
for (let i = 0, { length } = keys; i < length; i += 1) {
|
|
153
|
+
const strategy = keys[i];
|
|
154
|
+
_widthStrategies[strategy].minColumnWidth = value;
|
|
155
|
+
}
|
|
150
156
|
}
|
|
151
157
|
|
|
152
158
|
/**
|
|
@@ -155,9 +161,12 @@ export class ColumnWidthManager {
|
|
|
155
161
|
* @param {Number} value The maximum column width
|
|
156
162
|
*/
|
|
157
163
|
set maxColumnWidth(value) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
})
|
|
164
|
+
const { _widthStrategies } = this;
|
|
165
|
+
const keys = Object.keys(_widthStrategies);
|
|
166
|
+
for (let i = 0, { length } = keys; i < length; i += 1) {
|
|
167
|
+
const strategy = keys[i];
|
|
168
|
+
_widthStrategies[strategy].maxColumnWidth = value;
|
|
169
|
+
}
|
|
161
170
|
}
|
|
162
171
|
|
|
163
172
|
/**
|
|
@@ -381,13 +390,12 @@ export class ColumnWidthManager {
|
|
|
381
390
|
if (this.columnWidthMode === AUTO_WIDTH_MODE) {
|
|
382
391
|
this._queueAutoResizingUpdate = true;
|
|
383
392
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
});
|
|
393
|
+
for (let i = 0, { length } = columnDefs; i < length; i += 1) {
|
|
394
|
+
const col = columnDefs[i];
|
|
395
|
+
if (!getColumnWidthFromDef(col)) {
|
|
396
|
+
col.columnWidth = null;
|
|
397
|
+
col.style = '';
|
|
398
|
+
}
|
|
391
399
|
}
|
|
392
400
|
}
|
|
393
401
|
|
|
@@ -24,7 +24,7 @@ export function setErrors(state, errors) {
|
|
|
24
24
|
* Retrieves the row-level errors of a particular row from datatable's state object
|
|
25
25
|
*/
|
|
26
26
|
export function getRowError(state, rowKey) {
|
|
27
|
-
const rows =
|
|
27
|
+
const { rows } = state.errors;
|
|
28
28
|
return (rows && rows[rowKey]) || {};
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -32,5 +32,5 @@ export function getRowError(state, rowKey) {
|
|
|
32
32
|
* Retrieves the table-level errors from the datatable's state object
|
|
33
33
|
*/
|
|
34
34
|
export function getTableError(state) {
|
|
35
|
-
return
|
|
35
|
+
return state.errors.table || {};
|
|
36
36
|
}
|
|
@@ -84,7 +84,8 @@ export function setLoadMoreOffset(state, value) {
|
|
|
84
84
|
* @param {Event} event
|
|
85
85
|
*/
|
|
86
86
|
export function handleLoadMoreCheck(event) {
|
|
87
|
-
|
|
87
|
+
const { state } = this;
|
|
88
|
+
if (state.isLoading) {
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
91
|
|
|
@@ -94,7 +95,7 @@ export function handleLoadMoreCheck(event) {
|
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
const offset = getScrollOffsetFromTableEnd(contentContainer);
|
|
97
|
-
const threshold = getLoadMoreOffset(
|
|
98
|
+
const threshold = getLoadMoreOffset(state);
|
|
98
99
|
if (offset < threshold) {
|
|
99
100
|
this.dispatchEvent(new CustomEvent('loadmore'));
|
|
100
101
|
}
|
|
@@ -109,12 +110,12 @@ export function handleLoadMoreCheck(event) {
|
|
|
109
110
|
*/
|
|
110
111
|
export function handlePrefetch(root, state) {
|
|
111
112
|
if (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
!hasData(root) ||
|
|
113
|
+
state.isLoading ||
|
|
114
|
+
!state.enableInfiniteLoading ||
|
|
115
115
|
(this.viewportRendering &&
|
|
116
116
|
this._renderManager &&
|
|
117
|
-
!this._renderManager.hasWrapperHeight())
|
|
117
|
+
!this._renderManager.hasWrapperHeight()) ||
|
|
118
|
+
!hasData(root)
|
|
118
119
|
) {
|
|
119
120
|
// dont prefetch if already loading or data is not set yet
|
|
120
121
|
return;
|
|
@@ -122,7 +123,7 @@ export function handlePrefetch(root, state) {
|
|
|
122
123
|
|
|
123
124
|
const elem = root.querySelector('.slds-scrollable_y');
|
|
124
125
|
|
|
125
|
-
if (isScrollerVisible(elem) && !isScrollable(elem)) {
|
|
126
|
+
if (elem && isScrollerVisible(elem) && !isScrollable(elem)) {
|
|
126
127
|
this.dispatchEvent(new CustomEvent('loadmore'));
|
|
127
128
|
}
|
|
128
129
|
}
|
|
@@ -137,10 +138,7 @@ export function handlePrefetch(root, state) {
|
|
|
137
138
|
*/
|
|
138
139
|
function isScrollable(element) {
|
|
139
140
|
// scrollHeight should be greater than clientHeight by some allowance
|
|
140
|
-
return
|
|
141
|
-
element &&
|
|
142
|
-
element.scrollHeight > element.clientHeight + SCROLL_ALLOWANCE
|
|
143
|
-
);
|
|
141
|
+
return element.scrollHeight > element.clientHeight + SCROLL_ALLOWANCE;
|
|
144
142
|
}
|
|
145
143
|
|
|
146
144
|
/**
|
|
@@ -150,9 +148,10 @@ function isScrollable(element) {
|
|
|
150
148
|
* @returns {Boolean} Whether or not the element's scroll bars are visible
|
|
151
149
|
*/
|
|
152
150
|
function isScrollerVisible(element) {
|
|
153
|
-
return (
|
|
154
|
-
element
|
|
155
|
-
|
|
151
|
+
return !!(
|
|
152
|
+
element.offsetParent ||
|
|
153
|
+
element.offsetHeight ||
|
|
154
|
+
element.offsetWidth
|
|
156
155
|
);
|
|
157
156
|
}
|
|
158
157
|
|
|
@@ -67,13 +67,14 @@ export function getSortedDirection(state) {
|
|
|
67
67
|
* @param {String} value The value to update the sort direction to
|
|
68
68
|
*/
|
|
69
69
|
export function setSortedDirection(state, value) {
|
|
70
|
+
const isValid = isValidSortDirection(value);
|
|
70
71
|
assert(
|
|
71
|
-
|
|
72
|
+
isValid,
|
|
72
73
|
`The "sortedDirection" value passed into lightning:datatable
|
|
73
74
|
is incorrect, "sortedDirection" value should be one of
|
|
74
75
|
${Object.keys(VALID_SORT_DIRECTIONS).join()}.`
|
|
75
76
|
);
|
|
76
|
-
state.sortedDirection =
|
|
77
|
+
state.sortedDirection = isValid ? value : undefined;
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
/**
|
|
@@ -110,8 +111,10 @@ export function setSortedBy(state, value) {
|
|
|
110
111
|
* @param {Object} state The current datatable state
|
|
111
112
|
*/
|
|
112
113
|
export function updateSorting(state) {
|
|
113
|
-
const columns = state
|
|
114
|
-
|
|
114
|
+
const { columns } = state;
|
|
115
|
+
for (let i = 0, { length } = columns; i < length; i += 1) {
|
|
116
|
+
updateColumnSortingState(columns[i], state);
|
|
117
|
+
}
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
/**
|
|
@@ -123,18 +126,14 @@ export function updateSorting(state) {
|
|
|
123
126
|
export function updateColumnSortingState(column, state) {
|
|
124
127
|
const { sortedBy, sortedDirection, defaultSortDirection } = state;
|
|
125
128
|
|
|
126
|
-
if (getColumnName(column) === sortedBy
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
sortedDirection,
|
|
132
|
-
});
|
|
129
|
+
if (column.sortable && getColumnName(column) === sortedBy) {
|
|
130
|
+
column.sorted = true;
|
|
131
|
+
column.sortAriaLabel =
|
|
132
|
+
sortedDirection === 'desc' ? 'descending' : 'ascending';
|
|
133
|
+
column.sortedDirection = sortedDirection;
|
|
133
134
|
} else {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
sortedDirection: defaultSortDirection,
|
|
138
|
-
});
|
|
135
|
+
column.sorted = false;
|
|
136
|
+
column.sortAriaLabel = column.sortable ? 'other' : null;
|
|
137
|
+
column.sortedDirection = defaultSortDirection;
|
|
139
138
|
}
|
|
140
139
|
}
|
|
@@ -26,9 +26,12 @@ export function getTreeStateIndicatorFieldNames() {
|
|
|
26
26
|
*/
|
|
27
27
|
export function hasTreeDataType(state) {
|
|
28
28
|
const columns = getColumns(state);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
for (let i = 0, { length } = columns; i < length; i += 1) {
|
|
30
|
+
if (isTreeType(columns[i].type)) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
/**
|
|
@@ -39,9 +42,10 @@ export function hasTreeDataType(state) {
|
|
|
39
42
|
*/
|
|
40
43
|
export function getStateTreeColumn(state) {
|
|
41
44
|
const columns = getColumns(state);
|
|
42
|
-
for (let i = 0; i <
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
for (let i = 0, { length } = columns; i < length; i += 1) {
|
|
46
|
+
const col = columns[i];
|
|
47
|
+
if (isTreeType(col.type)) {
|
|
48
|
+
return col;
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
return null;
|