lightning-base-components 1.14.6-alpha → 1.14.7-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 (115) hide show
  1. package/metadata/raptor.json +5 -3
  2. package/package.json +8 -1
  3. package/scopedImports/@salesforce-label-LightningProgressBar.progressBar.js +1 -0
  4. package/src/lightning/alert/__docs__/alert.md +101 -0
  5. package/src/lightning/alert/__examples__disabled/basic/basic.css +7 -0
  6. package/src/lightning/alert/__examples__disabled/basic/basic.html +8 -0
  7. package/src/lightning/alert/__examples__disabled/basic/basic.js +14 -0
  8. package/src/lightning/alert/alert.html +3 -0
  9. package/src/lightning/alert/alert.js +78 -0
  10. package/src/lightning/alert/alert.js-meta.xml +6 -0
  11. package/src/lightning/buttonMenu/buttonMenu.js +12 -0
  12. package/src/lightning/confirm/__docs__/confirm.md +100 -0
  13. package/src/lightning/confirm/__examples__disabled/basic/basic.css +7 -0
  14. package/src/lightning/confirm/__examples__disabled/basic/basic.html +8 -0
  15. package/src/lightning/confirm/__examples__disabled/basic/basic.js +14 -0
  16. package/src/lightning/confirm/confirm.html +3 -0
  17. package/src/lightning/confirm/confirm.js +80 -0
  18. package/src/lightning/confirm/confirm.js-meta.xml +6 -0
  19. package/src/lightning/datatable/columns.js +166 -71
  20. package/src/lightning/datatable/datatable.js +94 -20
  21. package/src/lightning/datatable/headerActions.js +2 -2
  22. package/src/lightning/datatable/keyboard.js +10 -10
  23. package/src/lightning/datatable/renderManager.js +45 -13
  24. package/src/lightning/datatable/resizeSensor.js +11 -3
  25. package/src/lightning/datatable/rowSelection.js +1 -1
  26. package/src/lightning/datatable/rowSelectionShared.js +33 -20
  27. package/src/lightning/datatable/rows.js +1 -2
  28. package/src/lightning/datatable/sort.js +8 -8
  29. package/src/lightning/datatable/state.js +8 -1
  30. package/src/lightning/datatable/tree.js +25 -0
  31. package/src/lightning/datatable/types.js +77 -9
  32. package/src/lightning/datatable/utils.js +51 -24
  33. package/src/lightning/datatable/virtualization.js +319 -0
  34. package/src/lightning/datatable/wrapText.js +53 -16
  35. package/src/lightning/iconSvgTemplates/buildTemplates/standard/dashboard_component.html +7 -0
  36. package/src/lightning/iconSvgTemplates/buildTemplates/standard/slack.html +7 -0
  37. package/src/lightning/iconSvgTemplates/buildTemplates/standard/tableau.html +7 -0
  38. package/src/lightning/iconSvgTemplates/buildTemplates/standard/travel_mode.html +2 -2
  39. package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +8 -1
  40. package/src/lightning/iconSvgTemplates/buildTemplates/utility/data_model.html +7 -0
  41. package/src/lightning/iconSvgTemplates/buildTemplates/utility/serialized_product.html +1 -1
  42. package/src/lightning/iconSvgTemplates/buildTemplates/utility/serialized_product_transaction.html +2 -1
  43. package/src/lightning/iconSvgTemplates/buildTemplates/utility/slack.html +7 -0
  44. package/src/lightning/iconSvgTemplates/buildTemplates/utility/tableau.html +7 -0
  45. package/src/lightning/iconSvgTemplates/buildTemplates/utility/video_off.html +7 -0
  46. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/dashboard_component.html +7 -0
  47. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/slack.html +7 -0
  48. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/tableau.html +7 -0
  49. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/travel_mode.html +2 -2
  50. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +8 -1
  51. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/data_model.html +7 -0
  52. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/serialized_product.html +1 -1
  53. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/serialized_product_transaction.html +2 -1
  54. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/slack.html +7 -0
  55. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/tableau.html +7 -0
  56. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/video_off.html +7 -0
  57. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/dashboard_component.html +7 -0
  58. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/slack.html +7 -0
  59. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/tableau.html +7 -0
  60. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/travel_mode.html +2 -2
  61. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/templates.js +4 -1
  62. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/dashboard_component.html +7 -0
  63. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/slack.html +7 -0
  64. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/tableau.html +7 -0
  65. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/travel_mode.html +2 -2
  66. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/templates.js +4 -1
  67. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +5 -1
  68. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/data_model.html +7 -0
  69. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/serialized_product.html +1 -1
  70. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/serialized_product_transaction.html +2 -1
  71. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/slack.html +7 -0
  72. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/tableau.html +7 -0
  73. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/video_off.html +7 -0
  74. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +5 -1
  75. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/data_model.html +7 -0
  76. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/serialized_product.html +1 -1
  77. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/serialized_product_transaction.html +2 -1
  78. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/slack.html +7 -0
  79. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/tableau.html +7 -0
  80. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/video_off.html +7 -0
  81. package/src/lightning/input/__docs__/input.md +2 -0
  82. package/src/lightning/interactiveDialogBase/interactiveDialogBase.css +494 -0
  83. package/src/lightning/interactiveDialogBase/interactiveDialogBase.html +63 -0
  84. package/src/lightning/interactiveDialogBase/interactiveDialogBase.js +200 -0
  85. package/src/lightning/menuItem/menuItem.js +4 -1
  86. package/src/lightning/modalBase/modalBase.css +20 -0
  87. package/src/lightning/modalBase/modalBase.html +54 -0
  88. package/src/lightning/modalBase/modalBase.js +1039 -0
  89. package/src/lightning/overlay/__docs__/overlay.md +90 -0
  90. package/src/lightning/overlay/__examples__/alert/alert.html +27 -0
  91. package/src/lightning/overlay/__examples__/alert/alert.js +33 -0
  92. package/src/lightning/overlay/__examples__/basic/basic.css +7 -0
  93. package/src/lightning/overlay/__examples__/basic/basic.html +18 -0
  94. package/src/lightning/overlay/__examples__/basic/basic.js +61 -0
  95. package/src/lightning/overlay/__examples__/demo/demo.html +29 -0
  96. package/src/lightning/overlay/__examples__/demo/demo.js +40 -0
  97. package/src/lightning/overlay/__examples__/panel/panel.html +17 -0
  98. package/src/lightning/overlay/__examples__/panel/panel.js +21 -0
  99. package/src/lightning/overlay/overlay.html +3 -0
  100. package/src/lightning/overlay/overlay.js +45 -0
  101. package/src/lightning/overlayContainer/__docs__/overlayContainer.md +0 -0
  102. package/src/lightning/overlayContainer/overlayContainer.html +3 -0
  103. package/src/lightning/overlayContainer/overlayContainer.js +138 -0
  104. package/src/lightning/overlayManager/overlayManager.js +54 -0
  105. package/src/lightning/overlayUtils/overlayUtils.js +17 -0
  106. package/src/lightning/progressBar/progressBar.html +2 -1
  107. package/src/lightning/progressBar/progressBar.js +18 -1
  108. package/src/lightning/prompt/__docs__/prompt.md +102 -0
  109. package/src/lightning/prompt/__examples__disabled/basic/basic.css +7 -0
  110. package/src/lightning/prompt/__examples__disabled/basic/basic.html +8 -0
  111. package/src/lightning/prompt/__examples__disabled/basic/basic.js +15 -0
  112. package/src/lightning/prompt/prompt.css +81 -0
  113. package/src/lightning/prompt/prompt.html +8 -0
  114. package/src/lightning/prompt/prompt.js +92 -0
  115. package/src/lightning/prompt/prompt.js-meta.xml +6 -0
@@ -0,0 +1,319 @@
1
+ import { styleToString } from './utils';
2
+
3
+ /**
4
+ * sets an initial table height in the datatable state
5
+ *
6
+ * @param {Object} state - datatable state
7
+ */
8
+ export function resetTableHeight(state) {
9
+ state.tableHeight = state.rowHeight * state.rows.length;
10
+ }
11
+
12
+ /**
13
+ * resets state properties relevant to virtualization
14
+ * rowHeights when fixedHeight is false
15
+ *
16
+ * @param {Object} state - datatable state
17
+ */
18
+ export function resetRowHeights(state) {
19
+ state.heightCache = {};
20
+ state.offsets = [0];
21
+ state.offsetRanges = [];
22
+ if (state.virtualize && state.rows.length) {
23
+ resetTableHeight(state);
24
+ }
25
+ }
26
+
27
+ /**
28
+ * updates state properties relevant to virtualization
29
+ * rowHeights when fixedHeight is false
30
+ *
31
+ * @param {Node} template - the custom element root `this.template` from datatable.js
32
+ * @param {Object} state - datatable state
33
+ * @param {Array} renderedRows - array of rows currently being rendered
34
+ */
35
+ export function handleVariableRowHeights(template, state, renderedRows) {
36
+ const currentRange = {
37
+ start: renderedRows[0].rowIndex,
38
+ end: renderedRows[renderedRows.length - 1].rowIndex + 1,
39
+ };
40
+ let adjustFromIndex;
41
+ let adjustmentValue = 0;
42
+ let offsetRangeIndex = findOffsetRangeIndex(
43
+ state.offsetRanges,
44
+ currentRange.start
45
+ );
46
+
47
+ renderedRows.forEach((row) => {
48
+ if (!state.heightCache[row.key]) {
49
+ // need to get row actual element so we can find its height
50
+ const rowElement = template.querySelector(
51
+ `[data-row-key-value="${row.key}"]`
52
+ );
53
+ if (rowElement) {
54
+ // first rendered row needs height increased by 1 to account for missing border
55
+ let height = rowElement.getBoundingClientRect().height;
56
+ if (row.rowIndex === currentRange.start) {
57
+ height++;
58
+ }
59
+ state.heightCache[row.key] = height;
60
+
61
+ // calculate estimate of row offset
62
+ setOffset(state, row, offsetRangeIndex, height);
63
+
64
+ // update variables used to adjust later row offsets
65
+ adjustmentValue += height - state.rowHeight;
66
+ adjustFromIndex = row.rowIndex + 2;
67
+ }
68
+ }
69
+ });
70
+ state.tableHeight += adjustmentValue;
71
+ updateOffsetRanges(
72
+ state,
73
+ offsetRangeIndex,
74
+ currentRange,
75
+ adjustFromIndex,
76
+ adjustmentValue
77
+ );
78
+ updateVirtualizeStyles(template, state, renderedRows);
79
+ }
80
+
81
+ /**
82
+ * uses binary search with offsets and offsetRange
83
+ * to determine what the first visible index should be
84
+ * for a given scrollTop value
85
+ */
86
+ export function findFirstVisibleIndex(state, scrollTop) {
87
+ const { offsetRanges, offsets, rowHeight, fixedHeight, virtualize } = state;
88
+ if (virtualize && fixedHeight) {
89
+ return scrollTop / rowHeight;
90
+ }
91
+ let start = 0;
92
+ let end = offsetRanges.length - 1;
93
+
94
+ while (start <= end) {
95
+ let mid = Math.floor((start + end) / 2);
96
+ const prevRange = offsetRanges[mid];
97
+ const nextRange = offsetRanges[mid + 1];
98
+ const startOffset = offsets[prevRange.start];
99
+ const endOffset = offsets[prevRange.end];
100
+
101
+ const scrollTopAfterPrevStart = startOffset <= scrollTop;
102
+ const scrollTopInPrevRange =
103
+ scrollTopAfterPrevStart && scrollTop <= endOffset;
104
+ const scrollTopBeforeNextRange =
105
+ !nextRange || scrollTop < offsets[nextRange.start];
106
+ const scrollTopBetweenRanges =
107
+ scrollTopAfterPrevStart && scrollTopBeforeNextRange;
108
+
109
+ // check if scrollTop is in prevAdj offset values
110
+ // or between prevAdj and nextAdj offsetValues
111
+ if (scrollTopInPrevRange) {
112
+ // find offset in prevRange to use for firstVisibleIndex
113
+ return searchForOffset(state, prevRange, scrollTop);
114
+ } else if (scrollTopBetweenRanges) {
115
+ // use scrollTop and rowHeight to calculate firstVisibleIndex
116
+ const diff = scrollTop - endOffset;
117
+ const extraRows = Math.floor(diff / rowHeight);
118
+ state._firstRowOffset = diff % rowHeight;
119
+ return prevRange.end + extraRows;
120
+ }
121
+ // update start or end for next round of binary search
122
+ if (scrollTop < startOffset) {
123
+ end = mid - 1;
124
+ } else {
125
+ start = mid + 1;
126
+ }
127
+ }
128
+ return -1;
129
+ }
130
+
131
+ /**
132
+ * determines the rowIndex for given scrollTop
133
+ * within a provided offset range using binary search
134
+ * also sets firstRowOffset to correct value
135
+ *
136
+ * @param {object} range - object with start and end index for binary search
137
+ * @param {number} scrollTop - value to find offset rowIndex for
138
+ * @returns {number} representing firstVisibleIndex for given scrollTop
139
+ */
140
+ function searchForOffset(state, range, scrollTop) {
141
+ let { start, end } = range;
142
+ const offsets = state.offsets;
143
+
144
+ while (start <= end) {
145
+ const mid = Math.floor((start + end) / 2);
146
+ const currentOffsetUnderScrollTop = offsets[mid] <= scrollTop;
147
+ const nextOffsetUnderScrollTop =
148
+ offsets[mid + 1] && offsets[mid + 1] <= scrollTop;
149
+
150
+ if (currentOffsetUnderScrollTop && !nextOffsetUnderScrollTop) {
151
+ // store how many pixels scrollTop is from top of row
152
+ state.firstRowOffset = scrollTop - offsets[mid];
153
+ return mid;
154
+ } else if (currentOffsetUnderScrollTop) {
155
+ start = mid + 1;
156
+ } else {
157
+ end = mid - 1;
158
+ }
159
+ }
160
+ return -1;
161
+ }
162
+
163
+ /**
164
+ * uses a binary search to find the offsetRange index that
165
+ * encompasses the provided row index, or the one immediately
166
+ * before if no offsetRange encompasses the provided rowIndex
167
+ */
168
+ function findOffsetRangeIndex(offsetRanges, rowIndex) {
169
+ let start = 0;
170
+ let end = offsetRanges.length - 1;
171
+ while (start <= end) {
172
+ let mid = Math.floor((start + end) / 2);
173
+ const currentRangeStartsBeforeRowIndex =
174
+ offsetRanges[mid].start <= rowIndex;
175
+ const nextRangeStartsBeforeRowIndex =
176
+ offsetRanges[mid + 1] && offsetRanges[mid + 1].start <= rowIndex;
177
+
178
+ // check if rowIndex is between start of range at "mid"
179
+ // and start of range at "mid + 1" (or if there is no "mid + 1")
180
+ if (
181
+ currentRangeStartsBeforeRowIndex &&
182
+ !nextRangeStartsBeforeRowIndex
183
+ ) {
184
+ return mid;
185
+ } else if (currentRangeStartsBeforeRowIndex) {
186
+ // look for earlier offsetRanges
187
+ start = mid + 1;
188
+ } else {
189
+ // look for later offsetRanges
190
+ end = mid - 1;
191
+ }
192
+ }
193
+ return -1;
194
+ }
195
+
196
+ /**
197
+ * sets the offset value for a given row and the next
198
+ * based on the closest set offset value, the default
199
+ * row height and the height of the current row
200
+ *
201
+ * @param {object} state - datatable state
202
+ * @param {object} row - specific row object from state
203
+ * @param {number} offsetRangeIndex - index of offset range to use for row
204
+ * @param {number} height - height of row's node
205
+ */
206
+ function setOffset(state, row, offsetRangeIndex, height) {
207
+ let currentRange = state.offsetRanges[offsetRangeIndex];
208
+ let currentOffset = state.offsets[row.rowIndex];
209
+ // if no offset is set for current row, estimate it
210
+ // based on most recent offset and default rowHeight
211
+ if (!currentOffset) {
212
+ currentOffset = 0;
213
+ if (currentRange) {
214
+ const baseOffset = state.offsets[currentRange.end];
215
+ const estimatedRowOffsets =
216
+ (row.rowIndex - currentRange.end) * state.rowHeight;
217
+ currentOffset = baseOffset + estimatedRowOffsets;
218
+ state.offsets[row.rowIndex] = currentOffset;
219
+ }
220
+ }
221
+ // set next offset based on current offset and height
222
+ state.offsets[row.rowIndex + 1] = currentOffset + height;
223
+ }
224
+
225
+ /**
226
+ * merges or adds new offset range and
227
+ * updates offsets and range values as needed
228
+ *
229
+ * @param {number} offsetRangeIndex
230
+ * @param {*} state - datatable state
231
+ * @param {object} currentRange - range for current rendered rows
232
+ * @param {number} adjustFromIndex - first index to increase by rangeValue
233
+ * @param {number} rangeValue - amount to increase offsets after adjustFromIndex
234
+ */
235
+ function updateOffsetRanges(
236
+ state,
237
+ offsetRangeIndex,
238
+ currentRange,
239
+ adjustFromIndex,
240
+ adjustmentValue
241
+ ) {
242
+ const { offsets, offsetRanges } = state;
243
+ let prevRange = offsetRanges[offsetRangeIndex];
244
+ let nextRange = offsetRanges[offsetRangeIndex + 1];
245
+ const overlapsWithPrevRange =
246
+ prevRange && checkOverlap(prevRange, currentRange);
247
+ const overlapsWithNextRange =
248
+ nextRange && checkOverlap(currentRange, nextRange);
249
+
250
+ // update remaining values in next range by
251
+ // adjustment value if we're overlapping it
252
+ if (overlapsWithNextRange && adjustmentValue) {
253
+ for (let i = adjustFromIndex; i <= nextRange.end; i++) {
254
+ offsets[i] = offsets[i] + adjustmentValue;
255
+ }
256
+ }
257
+
258
+ // update state.offsetRanges
259
+ if (overlapsWithPrevRange && overlapsWithNextRange) {
260
+ nextRange.start = prevRange.start;
261
+ nextRange.end = Math.max(currentRange.end, nextRange.end);
262
+ state.offsetRanges.splice(offsetRangeIndex, 1); // removes prevRange
263
+ } else if (overlapsWithPrevRange) {
264
+ prevRange.end = Math.max(prevRange.end, currentRange.end);
265
+ } else if (overlapsWithNextRange) {
266
+ nextRange.start = currentRange.start;
267
+ nextRange.end = Math.max(currentRange.end, nextRange.end);
268
+ // increase offsetRangeIndex; since it's values have already been updated
269
+ // we want to skip it when adjusting offsets in later ranges
270
+ offsetRangeIndex = offsetRangeIndex + 1;
271
+ } else {
272
+ state.offsetRanges.splice(offsetRangeIndex + 1, 0, currentRange);
273
+ // need to increase offsetRangeIndex so we don't
274
+ // unnecessarily add adjustmentValue to currentRange
275
+ offsetRangeIndex = offsetRangeIndex + 1;
276
+ }
277
+
278
+ // loop through every offset range after the current one
279
+ // and increase the offset for each index by adjustmentValue
280
+ if (offsetRangeIndex >= 0) {
281
+ for (let i = offsetRangeIndex + 1; i < offsetRanges.length; i++) {
282
+ const { start: rangeStart, end: rangeEnd } = offsetRanges[i];
283
+ for (let j = rangeStart; j <= rangeEnd; j++) {
284
+ offsets[j] = offsets[j] + adjustmentValue;
285
+ }
286
+ }
287
+ }
288
+ }
289
+
290
+ /**
291
+ * compares start/end of two ranges to see if the values overlap
292
+ * used to determine if renderedRows are part of an existent offsetRange
293
+ * or if a new offsetRange will need to be added
294
+ */
295
+ function checkOverlap(range1, range2) {
296
+ return (
297
+ (range1.start <= range2.start && range2.start <= range1.end) ||
298
+ (range1.start <= range2.end && range2.end <= range1.end)
299
+ );
300
+ }
301
+
302
+ /**
303
+ * updates scrollTop and top values for rows when
304
+ * using virtualization with fixedHeight of false
305
+ */
306
+ function updateVirtualizeStyles(template, state, renderedRows) {
307
+ // update scrollTop so firstVisibleIndex is correctly placed in viewport
308
+ const scrollerY = template.querySelector('.slds-scrollable_y');
309
+ scrollerY.scrollTop =
310
+ state.offsets[state.firstVisibleIndex] + state.firstRowOffset;
311
+
312
+ // update top of rendered rows based on offsets
313
+ renderedRows.forEach((row) => {
314
+ row.style = styleToString({
315
+ position: 'absolute',
316
+ top: `${state.offsets[row.rowIndex]}px`,
317
+ });
318
+ });
319
+ }
@@ -1,7 +1,7 @@
1
1
  import labelClipText from '@salesforce/label/LightningDatatable.clipText';
2
2
  import labelWrapText from '@salesforce/label/LightningDatatable.wrapText';
3
- import { getStateColumnIndex, getColumns } from './columns';
4
3
  import { normalizeBoolean } from 'lightning/utilsPrivate';
4
+ import { getStateColumnIndex, getColumns } from './columns';
5
5
  import { normalizeNumberAttribute } from './utils';
6
6
  import { getDefaultState } from './state';
7
7
 
@@ -22,13 +22,28 @@ const i18n = {
22
22
 
23
23
  /************************** WRAP TEXT STATE **************************/
24
24
 
25
- // Returns a boolean representing whether or not the column should be text wrapped
25
+ /**
26
+ * Returns a boolean representing whether or not the column should be text wrapped
27
+ *
28
+ * NOTE: Wrap text is not supported in IE, so default parameters are fine here.
29
+ *
30
+ * @param {Object} state Datatable's state object
31
+ * @param {String} colKeyValue The column key value to look up wrap text configuration
32
+ * @returns {Boolean} Whether the text is currently wrapped
33
+ */
26
34
  export function getWrapTextState(state = getDefaultState(), colKeyValue) {
27
35
  return state.wrapText[colKeyValue] || WRAP_TEXT_DEFAULT;
28
36
  }
29
37
 
30
- // Sets a boolean value in state's wrapText object against the column key value
31
- // representing whether or not the column is text wrapped
38
+ /**
39
+ * Sets a boolean value in state's wrapText object against the column key value
40
+ * representing whether or not the column is text wrapped.
41
+ *
42
+ * NOTE: Wrap text is not supported in IE, so default parameters are fine here.
43
+ *
44
+ * @param {Object} state Datatable's state object
45
+ * @param {Object} columnDefinition Datatable's column definitions
46
+ */
32
47
  export function setWrapTextState(state = getDefaultState(), columnDefinition) {
33
48
  const { colKeyValue, type, wrapText } = columnDefinition;
34
49
 
@@ -40,8 +55,13 @@ export function setWrapTextState(state = getDefaultState(), columnDefinition) {
40
55
 
41
56
  /************************** WRAP TEXT MAX LINES **************************/
42
57
 
43
- // Normalizes and sets wrapTextMaxLines in datatable's state object
44
- // The normalized value should be a positive integer or it'll fall back to undefined
58
+ /**
59
+ * Normalizes and sets wrapTextMaxLines in datatable's state object.
60
+ * The normalized value should be a positive integer or it'll fall back to undefined.
61
+ *
62
+ * @param {Object} state Datatable's state object
63
+ * @param {Integer} value The maximum lines allowed
64
+ */
45
65
  export function setWrapTextMaxLines(state, value) {
46
66
  state.wrapTextMaxLines = normalizeNumberAttribute(
47
67
  'wrapTextMaxLines',
@@ -51,8 +71,14 @@ export function setWrapTextMaxLines(state, value) {
51
71
  );
52
72
  }
53
73
 
54
- // Sets the `wrapText` and `wrapTextMaxLines` values in the cell object for all cells in a column
55
- // These values are used by primitiveCellFactory to set the required classes on the cell for wrapping
74
+ /**
75
+ * Sets the `wrapText` and `wrapTextMaxLines` values in the cell object for all cells in a column.
76
+ * These values are used by primitiveCellFactory to set the required classes on the cell for wrapping
77
+ *
78
+ * @param {Object} state Datatable's state object
79
+ * @param {Number} colIndex The column index to update
80
+ * @param {String} colKeyValue The column key value to look up wrap text configuration
81
+ */
56
82
  function updateWrapTextAndMaxLinesValuesInCells(state, colIndex, colKeyValue) {
57
83
  state.rows.forEach((row) => {
58
84
  const cell = row.cells[colIndex];
@@ -70,9 +96,9 @@ function updateWrapTextAndMaxLinesValuesInCells(state, colIndex, colKeyValue) {
70
96
  * provides - Wrap Text and Clip Text.
71
97
  * Each header action contains a label, title, action name and its selected value (checked)
72
98
  *
73
- * @param {Object} state - datatable's state object
74
- * @param {Object} columnDefinition - datatable's column definitions
75
- * @returns
99
+ * @param {Object} state Datatable's state object
100
+ * @param {Object} columnDefinition Datatable's column definitions
101
+ * @returns {Array} An array of wrap text actions
76
102
  */
77
103
  export function getActions(state, columnDefinition) {
78
104
  const wrapTextActions = [];
@@ -108,9 +134,9 @@ export function getActions(state, columnDefinition) {
108
134
  * needs to be changed in the state, change it to the new value and update
109
135
  * the check mark to represent the currently selected action
110
136
  *
111
- * @param {Object} state - datatable's state object
112
- * @param {String} action - action that was selected/triggered
113
- * @param {String} colKeyValue - column key value
137
+ * @param {Object} state Datatable's state object
138
+ * @param {String} action Action that was selected/triggered
139
+ * @param {String} colKeyValue Column key value
114
140
  */
115
141
  export function handleTriggeredAction(state, action, colKeyValue) {
116
142
  const actionName = action.name;
@@ -124,8 +150,13 @@ export function handleTriggeredAction(state, action, colKeyValue) {
124
150
  }
125
151
  }
126
152
 
127
- // Update the 'checked' value of the each action to show which action is selected
128
- // and which action is not selected
153
+ /**
154
+ * Update the 'checked' value of the each action to show which action is selected
155
+ * and which action is not selected.
156
+ *
157
+ * @param {Object} state The datatable state.
158
+ * @param {String} colKeyValue The column key.
159
+ */
129
160
  function updateSelectedOptionInHeaderActions(state, colKeyValue) {
130
161
  const columns = getColumns(state);
131
162
  const colIndex = getStateColumnIndex(state, colKeyValue);
@@ -148,6 +179,12 @@ function updateSelectedOptionInHeaderActions(state, colKeyValue) {
148
179
 
149
180
  /************************** HELPER FUNCTIONS **************************/
150
181
 
182
+ /**
183
+ * Determines if a given column type is wrappable.
184
+ *
185
+ * @param {String} type The type to check.
186
+ * @returns {Boolean} Whether the given type is wrappable.
187
+ */
151
188
  function isWrappableType(type) {
152
189
  return NON_WRAPPABLE_TYPES.indexOf(type) < 0;
153
190
  }
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <svg class={computedClass} focusable="false" data-key={name} aria-hidden="true" viewBox="0 0 100 100">
3
+ <g>
4
+ <path d="M43.66 20H23.94A4 4 0 0020 23.94v19.72a4 4 0 003.94 3.94h19.72a4 4 0 003.94-3.94V23.94A4 4 0 0043.66 20zM76.06 20H56.34a4 4 0 00-3.94 3.94v19.72a4 4 0 003.94 3.94h19.72A4 4 0 0080 43.66V23.94A4 4 0 0076.06 20zM43.66 52.4H23.94A4 4 0 0020 56.34v19.72A4 4 0 0023.94 80h19.72a4 4 0 003.94-3.94V56.34a4 4 0 00-3.94-3.94zM76.06 52.4H56.34a4 4 0 00-3.94 3.94v19.72A4 4 0 0056.34 80h19.72A4 4 0 0080 76.06V56.34a4 4 0 00-3.94-3.94z"></path>
5
+ </g>
6
+ </svg>
7
+ </template>
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <svg class={computedClass} focusable="false" data-key={name} aria-hidden="true" viewBox="0 0 100 100">
3
+ <g>
4
+ <path d="M32.6 57.9a6.3 6.3 0 11-6.3-6.3h6.3zM35.8 57.9a6.43 6.43 0 016.1-6.6 6.36 6.36 0 016.6 6.1v16.3a6.35 6.35 0 01-12.7 0zM42.1 32.6a6.3 6.3 0 116.3-6.3v6.3zM42.1 35.8a6.43 6.43 0 016.6 6.1 6.36 6.36 0 01-6.1 6.6H26.3a6.35 6.35 0 010-12.7zM67.4 42.1a6.3 6.3 0 116.3 6.3h-6.3zM64.2 42.1a6.43 6.43 0 01-6.1 6.6 6.36 6.36 0 01-6.6-6.1V26.3a6.35 6.35 0 0112.7 0zM57.9 67.4a6.3 6.3 0 11-6.3 6.3v-6.3zM57.9 64.2a6.43 6.43 0 01-6.6-6.1 6.36 6.36 0 016.1-6.6h16.3a6.35 6.35 0 010 12.7z"></path>
5
+ </g>
6
+ </svg>
7
+ </template>
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <svg class={computedClass} focusable="false" data-key={name} aria-hidden="true" viewBox="0 0 100 100">
3
+ <g>
4
+ <path d="M60 51.6h-8.3V61h-3.3v-9.4H40v-3.3h8.3V39h3.3v9.4H60zM43 63.3h-7.1V55h-2.7v8.3H26v2.5h7.2V74h2.7v-8.2H43zM74 34.2h-7.2V26h-2.7v8.2H57v2.6h7.2V45h2.7v-8.2H74zM56 71.8h-4.8V66h-2.3v5.8H44v2.3h4.9V80h2.3v-5.9H56zM43 34.2h-7.2V26h-2.6v8.2H26v2.5h7.2V45h2.6v-8.3H43zM80 48.8h-4.8V43h-2.3v5.8H68v2.3h4.9V57h2.3v-5.8H80zM74 63.3h-7.2V55h-2.7v8.3H57v2.5h7.2V74h2.7v-8.2H74zM56 25.7h-5.1V20H49v5.7h-5v1.7h5.1V33H51v-5.6h5zM32 49.2h-5.1V44H25v5.2h-5v1.6h5.1V56H27v-5.2h5z"></path>
5
+ </g>
6
+ </svg>
7
+ </template>
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <svg class={computedClass} focusable="false" data-key={name} aria-hidden="true" viewBox="0 0 100 100">
3
3
  <g>
4
- <mask id="pwa" height="60" maskUnits="userSpaceOnUse" width="60" x="20" y="20">
4
+ <mask id="pza" height="60" maskUnits="userSpaceOnUse" width="60" x="20" y="20">
5
5
  <path d="M20 20h60v60H20z" fill-rule="evenodd"></path>
6
6
  </mask>
7
- <g mask="url(#pwa)">
7
+ <g mask="url(#pza)">
8
8
  <path d="M53.77 72.12C54 59.88 62.25 50 72.49 50a22.49 22.49 0 01-18.66 22.12M27.49 50C37.75 50 46 59.88 46.16 72.12A22.5 22.5 0 0127.49 50M50 27.51a22.44 22.44 0 0121.12 15H28.88a22.44 22.44 0 0121.12-15M50 20a30 30 0 1030 30 30 30 0 00-30-30" fill-rule="evenodd"></path>
9
9
  </g>
10
10
  </g>