lightning-base-components 1.13.6-alpha → 1.14.1-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 (191) hide show
  1. package/metadata/raptor.json +104 -2
  2. package/package.json +37 -1
  3. package/scopedImports/@salesforce-internal-core.appVersion.js +1 -1
  4. package/scopedImports/@salesforce-label-LightningAlert.defaultLabel.js +1 -0
  5. package/scopedImports/@salesforce-label-LightningConfirm.defaultLabel.js +1 -0
  6. package/scopedImports/@salesforce-label-LightningDateTimePicker.selectDateFor.js +1 -0
  7. package/scopedImports/@salesforce-label-LightningInteractiveDialogBase.cancel.js +1 -0
  8. package/scopedImports/@salesforce-label-LightningInteractiveDialogBase.ok.js +1 -0
  9. package/scopedImports/@salesforce-label-LightningLookup.recentItems.js +1 -0
  10. package/scopedImports/@salesforce-label-LightningModalBase.close.js +1 -0
  11. package/scopedImports/@salesforce-label-LightningModalBase.waitstate.js +1 -0
  12. package/scopedImports/@salesforce-label-LightningPrompt.defaultLabel.js +1 -0
  13. package/src/lightning/baseCombobox/baseCombobox.html +50 -24
  14. package/src/lightning/baseCombobox/baseCombobox.js +53 -28
  15. package/src/lightning/card/card.html +7 -1
  16. package/src/lightning/card/card.js +30 -2
  17. package/src/lightning/card/utils.js +14 -0
  18. package/src/lightning/combobox/combobox.css +12 -0
  19. package/src/lightning/combobox/combobox.html +1 -0
  20. package/src/lightning/datatable/__docs__/datatable.md +40 -13
  21. package/src/lightning/datatable/columnWidthManager.js +8 -4
  22. package/src/lightning/datatable/columns-shared.js +8 -7
  23. package/src/lightning/datatable/columns.js +38 -4
  24. package/src/lightning/datatable/datatable.js +932 -727
  25. package/src/lightning/datatable/datatableResizeObserver.js +1 -1
  26. package/src/lightning/datatable/inlineEdit.js +15 -3
  27. package/src/lightning/datatable/keyboard.js +1078 -935
  28. package/src/lightning/datatable/resizer.js +92 -109
  29. package/src/lightning/datatable/rows.js +245 -59
  30. package/src/lightning/datatable/sort.js +83 -28
  31. package/src/lightning/datatable/{normalizer.js → state.js} +16 -28
  32. package/src/lightning/datatable/templates/div/div.css +53 -0
  33. package/src/lightning/datatable/templates/div/div.html +272 -0
  34. package/src/lightning/datatable/{datatable.css → templates/table/table.css} +0 -0
  35. package/src/lightning/datatable/templates/table/table.html +260 -0
  36. package/src/lightning/datatable/widthManagerShared.js +1 -1
  37. package/src/lightning/datepicker/datepicker.html +3 -3
  38. package/src/lightning/datepicker/datepicker.js +6 -2
  39. package/src/lightning/datetimepicker/datetimepicker.html +3 -4
  40. package/src/lightning/datetimepicker/datetimepicker.js +0 -2
  41. package/src/lightning/formattedRichText/__docs__/formattedRichText.md +1 -0
  42. package/src/lightning/helptext/helptext.js +8 -0
  43. package/src/lightning/iconSvgTemplates/buildTemplates/standard/asset_audit.html +7 -0
  44. package/src/lightning/iconSvgTemplates/buildTemplates/standard/attach.html +7 -0
  45. package/src/lightning/iconSvgTemplates/buildTemplates/standard/contract_payment.html +10 -0
  46. package/src/lightning/iconSvgTemplates/buildTemplates/standard/field_sales.html +8 -0
  47. package/src/lightning/iconSvgTemplates/buildTemplates/standard/historical_adherence.html +9 -0
  48. package/src/lightning/iconSvgTemplates/buildTemplates/standard/med_rec_recommendation.html +8 -0
  49. package/src/lightning/iconSvgTemplates/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
  50. package/src/lightning/iconSvgTemplates/buildTemplates/standard/medication_dispense.html +11 -0
  51. package/src/lightning/iconSvgTemplates/buildTemplates/standard/medication_reconciliation.html +7 -0
  52. package/src/lightning/iconSvgTemplates/buildTemplates/standard/report_type.html +9 -0
  53. package/src/lightning/iconSvgTemplates/buildTemplates/standard/story.html +2 -4
  54. package/src/lightning/iconSvgTemplates/buildTemplates/standard/tour.html +9 -0
  55. package/src/lightning/iconSvgTemplates/buildTemplates/standard/tour_check.html +8 -0
  56. package/src/lightning/iconSvgTemplates/buildTemplates/standard/travel_mode.html +2 -2
  57. package/src/lightning/iconSvgTemplates/buildTemplates/standard/unified_health_score.html +7 -0
  58. package/src/lightning/iconSvgTemplates/buildTemplates/standard/workforce_engagement.html +8 -0
  59. package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +26 -1
  60. package/src/lightning/iconSvgTemplates/buildTemplates/utility/asset_audit.html +9 -0
  61. package/src/lightning/iconSvgTemplates/buildTemplates/utility/collection_alt.html +8 -0
  62. package/src/lightning/iconSvgTemplates/buildTemplates/utility/contract_doc.html +8 -0
  63. package/src/lightning/iconSvgTemplates/buildTemplates/utility/contract_payment.html +10 -0
  64. package/src/lightning/iconSvgTemplates/buildTemplates/utility/einstein.html +2 -1
  65. package/src/lightning/iconSvgTemplates/buildTemplates/utility/entitlement.html +7 -0
  66. package/src/lightning/iconSvgTemplates/buildTemplates/utility/field_sales.html +8 -0
  67. package/src/lightning/iconSvgTemplates/buildTemplates/utility/signature.html +9 -0
  68. package/src/lightning/iconSvgTemplates/buildTemplates/utility/tour.html +9 -0
  69. package/src/lightning/iconSvgTemplates/buildTemplates/utility/tour_check.html +8 -0
  70. package/src/lightning/iconSvgTemplates/buildTemplates/utility/truck.html +10 -0
  71. package/src/lightning/iconSvgTemplates/buildTemplates/utility/workforce_engagement.html +8 -0
  72. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/asset_audit.html +7 -0
  73. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/attach.html +7 -0
  74. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/contract_payment.html +10 -0
  75. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/field_sales.html +8 -0
  76. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/historical_adherence.html +9 -0
  77. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/med_rec_recommendation.html +8 -0
  78. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
  79. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/medication_dispense.html +11 -0
  80. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/medication_reconciliation.html +7 -0
  81. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/report_type.html +9 -0
  82. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/story.html +2 -4
  83. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/tour.html +9 -0
  84. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/tour_check.html +8 -0
  85. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/travel_mode.html +2 -2
  86. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/unified_health_score.html +7 -0
  87. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/workforce_engagement.html +8 -0
  88. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +26 -1
  89. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/asset_audit.html +9 -0
  90. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/collection_alt.html +8 -0
  91. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/contract_doc.html +8 -0
  92. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/contract_payment.html +10 -0
  93. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/einstein.html +2 -1
  94. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/entitlement.html +7 -0
  95. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/field_sales.html +8 -0
  96. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/signature.html +9 -0
  97. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/tour.html +9 -0
  98. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/tour_check.html +8 -0
  99. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/truck.html +10 -0
  100. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/workforce_engagement.html +8 -0
  101. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/asset_audit.html +7 -0
  102. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/attach.html +7 -0
  103. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/contract_payment.html +10 -0
  104. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/field_sales.html +8 -0
  105. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/historical_adherence.html +9 -0
  106. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/med_rec_recommendation.html +8 -0
  107. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
  108. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/medication_dispense.html +11 -0
  109. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/medication_reconciliation.html +7 -0
  110. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/report_type.html +9 -0
  111. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/story.html +2 -4
  112. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/tour.html +9 -0
  113. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/tour_check.html +8 -0
  114. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/travel_mode.html +2 -2
  115. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/unified_health_score.html +7 -0
  116. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/workforce_engagement.html +8 -0
  117. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/templates.js +15 -1
  118. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/asset_audit.html +7 -0
  119. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/attach.html +7 -0
  120. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/contract_payment.html +10 -0
  121. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/field_sales.html +8 -0
  122. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/historical_adherence.html +9 -0
  123. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/med_rec_recommendation.html +8 -0
  124. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
  125. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/medication_dispense.html +11 -0
  126. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/medication_reconciliation.html +7 -0
  127. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/report_type.html +9 -0
  128. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/story.html +2 -4
  129. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/tour.html +9 -0
  130. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/tour_check.html +8 -0
  131. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/travel_mode.html +2 -2
  132. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/unified_health_score.html +7 -0
  133. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/workforce_engagement.html +8 -0
  134. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/templates.js +15 -1
  135. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +12 -1
  136. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/asset_audit.html +9 -0
  137. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/collection_alt.html +8 -0
  138. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/contract_doc.html +8 -0
  139. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/contract_payment.html +10 -0
  140. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/einstein.html +2 -1
  141. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/entitlement.html +7 -0
  142. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/field_sales.html +8 -0
  143. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/signature.html +9 -0
  144. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/tour.html +9 -0
  145. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/tour_check.html +8 -0
  146. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/truck.html +10 -0
  147. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/workforce_engagement.html +8 -0
  148. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +12 -1
  149. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/asset_audit.html +9 -0
  150. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/collection_alt.html +8 -0
  151. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/contract_doc.html +8 -0
  152. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/contract_payment.html +10 -0
  153. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/einstein.html +2 -1
  154. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/entitlement.html +7 -0
  155. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/field_sales.html +8 -0
  156. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/signature.html +9 -0
  157. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/tour.html +9 -0
  158. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/tour_check.html +8 -0
  159. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/truck.html +10 -0
  160. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/workforce_engagement.html +8 -0
  161. package/src/lightning/input/__docs__/input.md +4 -0
  162. package/src/lightning/input/input.html +0 -1
  163. package/src/lightning/input/input.js +31 -30
  164. package/src/lightning/pill/link.html +1 -1
  165. package/src/lightning/pill/pill.js +18 -0
  166. package/src/lightning/pill/plainLink.html +2 -0
  167. package/src/lightning/pillContainer/barePillContainer.html +5 -5
  168. package/src/lightning/pillContainer/pillContainer.js +5 -4
  169. package/src/lightning/pillContainer/standardPillContainer.html +5 -5
  170. package/src/lightning/positionLibrary/__component__/positionLibraryBounding.spec.js +8 -6
  171. package/src/lightning/positionLibrary/__component__/x/bounding/bounding.html +1 -1
  172. package/src/lightning/positionLibrary/__component__/x/bounding/bounding.js +6 -9
  173. package/src/lightning/positionLibrary/direction.js +17 -5
  174. package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.js +20 -0
  175. package/src/lightning/primitiveDatatableIeditTypeFactory/primitiveDatatableIeditTypeFactory.js +10 -0
  176. package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.js +17 -3
  177. package/src/lightning/primitiveDatatableTooltip/primitiveDatatableTooltip.js +1 -0
  178. package/src/lightning/primitiveHeaderFactory/nonsortableHeader.html +5 -4
  179. package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +255 -94
  180. package/src/lightning/primitiveHeaderFactory/selectableHeader.html +25 -23
  181. package/src/lightning/primitiveHeaderFactory/sortableHeader.html +13 -9
  182. package/src/lightning/progressIndicator/progressIndicator.js +30 -9
  183. package/src/lightning/progressRing/progressRing.html +6 -0
  184. package/src/lightning/progressRing/progressRing.js +98 -3
  185. package/src/lightning/progressStep/progressStep.js +6 -3
  186. package/src/lightning/timepicker/timepicker.html +1 -0
  187. package/src/lightning/utilsPrivate/aria.js +30 -0
  188. package/src/lightning/utilsPrivate/utilsPrivate.js +12 -2
  189. package/src/lightning/datatable/datatable.html +0 -237
  190. package/src/lightning/datatable/keys.js +0 -32
  191. package/src/lightning/utilsPrivate/contentMutation.js +0 -273
@@ -1,237 +0,0 @@
1
- <template>
2
- <span aria-live="polite">
3
- <span class={computedAriaLiveClassForNavMode}>{ariaLiveNavigationModeText}</span>
4
- <span class={computedAriaLiveClassForActionMode}>{ariaLiveActionModeText}</span>
5
- </span>
6
- <div lwc:dom="manual" class="dt-width-observer" style="width: 100%; height: 0px;"></div>
7
- <div class="dt-outer-container" style="height: 100%; position: relative;">
8
- <lightning-primitive-datatable-iedit-panel
9
- data-iedit-panel="true"
10
- visible={state.inlineEdit.isPanelVisible}
11
- row-key-value={state.inlineEdit.rowKeyValue}
12
- col-key-value={state.inlineEdit.colKeyValue}
13
- edited-value={state.inlineEdit.editedValue}
14
- column-def={state.inlineEdit.columnDef}
15
- is-mass-edit-enabled={state.inlineEdit.massEditEnabled}
16
- number-of-selected-rows={state.inlineEdit.massEditSelectedRows}
17
- resolved-type-attributes={state.inlineEdit.resolvedTypeAttributes}
18
- onieditfinished={handleInlineEditFinish}
19
- onmasscheckboxchange={handleMassCheckboxChange}
20
- ></lightning-primitive-datatable-iedit-panel>
21
- <div class={computedTableContainerClass} onscroll={handleHorizontalScroll} style={scrollerXStyles}>
22
- <div class="slds-scrollable_y" onscroll={handleVerticalScroll} style={computedScrollerStyle}>
23
- <table class={computedTableClass} role={computedTableRole} style={computedTableStyle}
24
- onkeydown={handleTableKeydown}
25
- onclick={handleCellClick}
26
- onfocusin={handleTableFocusIn}
27
- onfocusout={handleTableFocusOut}
28
- aria-label={ariaLabel}
29
- aria-labelledby={ariaLabelledBy}
30
- aria-rowcount={ariaRowCount}>
31
- <template if:false={hasValidKeyField}>
32
- <!-- empty since keyField wasn't provided -->
33
- </template>
34
- <template if:true={hasValidKeyField}>
35
- <thead class={computedTableHeaderClass}>
36
- <tr class="slds-line-height_reset"
37
- onprivateresizestart={handleResizeStart}
38
- onprivateresizeend={handleResizeEnd}>
39
- <template for:each={state.columns} for:item="def" for:index="colIndex">
40
- <th style={def.style}
41
- scope="col"
42
- tabindex={def.tabIndex}
43
- aria-label={def.ariaLabel}
44
- aria-sort={def.sortAriaLabel}
45
- key={def.colKeyValue}>
46
-
47
- <template if:true={def.fixedWidth}>
48
- <lightning-primitive-header-factory
49
- style={def.style}
50
- def={def}
51
- dt-context-id={privateDatatableId}
52
- key={def.colKeyValue}
53
- row-key-value="HEADER"
54
- col-key-value={def.colKeyValue}
55
- has-focus={def.hasFocus}
56
- column-width={def.columnWidth}
57
- col-index={colIndex}
58
- sortable={def.sortable}
59
- sorted={def.sorted}
60
- sorted-direction={def.sortedDirection}
61
- show-checkbox={showSelectAllCheckbox}
62
- actions={def.actions}>
63
- </lightning-primitive-header-factory>
64
- </template>
65
- <template if:false={def.fixedWidth}>
66
- <lightning-primitive-header-factory
67
- style={def.style}
68
- def={def}
69
- dt-context-id={privateDatatableId}
70
- key={def.colKeyValue}
71
- row-key-value="HEADER"
72
- col-key-value={def.colKeyValue}
73
- col-index={colIndex}
74
- resizable={hasResizebleColumns}
75
- sortable={def.sortable}
76
- sorted={def.sorted}
77
- sorted-direction={def.sortedDirection}
78
- has-focus={def.hasFocus}
79
- column-width={def.columnWidth}
80
- resizestep={state.resizeStep}
81
- actions={def.actions}>
82
- </lightning-primitive-header-factory>
83
- </template>
84
- </th>
85
- </template>
86
- </tr>
87
- </thead>
88
- <tbody style={computedTbodyStyle}>
89
- <template for:each={renderedRows} for:item="row" for:index="rowIndex">
90
- <tr class={row.classnames}
91
- onkeydown={handleTrRowKeyDown}
92
- key={row.key}
93
- data-row-key-value={row.key}
94
- aria-selected={row.ariaSelected}
95
- aria-level={row.level}
96
- aria-expanded={row.isExpanded}
97
- aria-setsize={row.setSize}
98
- aria-posinset={row.posInSet}
99
- tabindex={row.tabIndex}>
100
- <template for:each={row.cells} for:item="cell">
101
- <template if:true={cell.isCheckbox}>
102
- <td class={cell.class} role="gridcell" tabindex={cell.tabIndex} data-label={cell.dataLabel} key={cell.colKeyValue}>
103
- <lightning-primitive-cell-checkbox
104
- dt-context-id={privateDatatableId}
105
- has-focus={cell.hasFocus}
106
- data-label={cell.dataLabel}
107
- key={cell.key}
108
- row-key-value={row.key}
109
- col-key-value={cell.colKeyValue}
110
- row-index={rowIndex}
111
- type={row.inputType}
112
- is-selected={row.isSelected}
113
- is-disabled={row.isDisabled}
114
- column-header-id={computedCheckboxColumnHeaderId}>
115
- </lightning-primitive-cell-checkbox>
116
- </td>
117
- </template>
118
- <template if:true={cell.isDataTypeScope}>
119
- <th class={cell.class}
120
- style={cell.paddingStyle}
121
- aria-selected={cell.ariaSelected}
122
- aria-readonly={cell.ariaReadOnly}
123
- scope="row"
124
- tabindex={cell.tabIndex}
125
- data-label={cell.dataLabel}
126
- key={cell.colKeyValue}>
127
- <lightning-primitive-cell-factory
128
- types={privateTypes}
129
- aria-selected={cell.ariaSelected}
130
- data-label={cell.dataLabel}
131
- alignment={cell.alignment}
132
- has-error={cell.hasError}
133
- has-focus={cell.hasFocus}
134
- column-label={cell.dataLabel}
135
- column-type={cell.columnType}
136
- column-sub-type={cell.columnSubType}
137
- wrap-text={cell.wrapText}
138
- wrap-text-max-lines={cell.wrapTextMaxLines}
139
- key={cell.columnType}
140
- row-key-value={row.key}
141
- col-key-value={cell.colKeyValue}
142
- value={cell.value}
143
- icon-name={cell.iconName}
144
- icon-label={cell.iconLabel}
145
- icon-position={cell.iconPosition}
146
- icon-alternative-text={cell.iconAlternativeText}
147
- editable={cell.editable}
148
- display-read-only-icon={cell.displayReadOnlyIcon}
149
- type-attribute-0={cell.typeAttribute0}
150
- type-attribute-1={cell.typeAttribute1}
151
- type-attribute-2={cell.typeAttribute2}
152
- type-attribute-3={cell.typeAttribute3}
153
- type-attribute-4={cell.typeAttribute4}
154
- type-attribute-5={cell.typeAttribute5}
155
- type-attribute-6={cell.typeAttribute6}
156
- type-attribute-7={cell.typeAttribute7}
157
- type-attribute-8={cell.typeAttribute8}
158
- type-attribute-9={cell.typeAttribute9}
159
- type-attribute-10={cell.typeAttribute10}
160
- type-attribute-21={cell.typeAttribute21}
161
- type-attribute-22={cell.typeAttribute22}>
162
- </lightning-primitive-cell-factory>
163
- </th>
164
- </template>
165
- <template if:true={cell.isDataType}>
166
- <td
167
- class={cell.class}
168
- style={cell.paddingStyle}
169
- aria-selected={cell.ariaSelected}
170
- aria-readonly={cell.ariaReadOnly}
171
- role="gridcell"
172
- tabindex={cell.tabIndex}
173
- data-label={cell.dataLabel}
174
- key={cell.colKeyValue}>
175
- <lightning-primitive-cell-factory
176
- types={privateTypes}
177
- aria-selected={cell.ariaSelected}
178
- role="gridcell"
179
- data-label={cell.dataLabel}
180
- alignment={cell.alignment}
181
- has-focus={cell.hasFocus}
182
- has-error={cell.hasError}
183
- column-label={cell.dataLabel}
184
- column-type={cell.columnType}
185
- column-sub-type={cell.columnSubType}
186
- wrap-text={cell.wrapText}
187
- wrap-text-max-lines={cell.wrapTextMaxLines}
188
- key={cell.columnType}
189
- row-key-value={row.key}
190
- col-key-value={cell.colKeyValue}
191
- value={cell.value}
192
- icon-name={cell.iconName}
193
- icon-label={cell.iconLabel}
194
- icon-position={cell.iconPosition}
195
- icon-alternative-text={cell.iconAlternativeText}
196
- editable={cell.editable}
197
- display-read-only-icon={cell.displayReadOnlyIcon}
198
- type-attribute-0={cell.typeAttribute0}
199
- type-attribute-1={cell.typeAttribute1}
200
- type-attribute-2={cell.typeAttribute2}
201
- type-attribute-3={cell.typeAttribute3}
202
- type-attribute-4={cell.typeAttribute4}
203
- type-attribute-5={cell.typeAttribute5}
204
- type-attribute-6={cell.typeAttribute6}
205
- type-attribute-7={cell.typeAttribute7}
206
- type-attribute-8={cell.typeAttribute8}
207
- type-attribute-9={cell.typeAttribute9}
208
- type-attribute-10={cell.typeAttribute10}
209
- type-attribute-21={cell.typeAttribute21}
210
- type-attribute-22={cell.typeAttribute22}>
211
- </lightning-primitive-cell-factory>
212
- </td>
213
- </template>
214
- </template>
215
- </tr>
216
- </template>
217
- <template if:true={isLoading}>
218
- <tr>
219
- <td colspan={numberOfColumns} class="slds-is-relative">
220
- <lightning-primitive-datatable-loading-indicator></lightning-primitive-datatable-loading-indicator>
221
- </td>
222
- </tr>
223
- </template>
224
- </tbody>
225
- </template>
226
- </table>
227
- </div>
228
- </div>
229
- <template if:true={showStatusBar}>
230
- <lightning-primitive-datatable-status-bar
231
- error={tableError}
232
- onprivatesave={handleInlineEditSave}
233
- onprivatecancel={handleInlineEditCancel}
234
- ></lightning-primitive-datatable-status-bar>
235
- </template>
236
- </div>
237
- </template>
@@ -1,32 +0,0 @@
1
- /**
2
- * It creates a row key generator based on the keyField passed by the consumer
3
- * if the keyField does not point to a value row object passed in computeUniqueRowKey
4
- * it fallback to a generated key using indexes
5
- *
6
- * @param {String} keyField - keyField provided by the consumer
7
- * @returns {*} - Object with a computeUniqueRowKey method
8
- */
9
- export const createRowKeysGenerator = function (keyField) {
10
- let index = 0;
11
- return {
12
- computeUniqueRowKey(row) {
13
- if (row[keyField]) {
14
- return row[keyField];
15
- }
16
- return `row-${index++}`;
17
- },
18
- };
19
- };
20
-
21
- /**
22
- * It generate a unique column key value.
23
- *
24
- * @param {object} columnMetadata - the object for an specific column metadata
25
- * @param {int} index - optionally, the index of the column.
26
- * @returns {string} It generate the column key value based on the column field name and type.
27
- */
28
- export const generateColKeyValue = function (columnMetadata, index) {
29
- const prefix =
30
- columnMetadata.columnKey || columnMetadata.fieldName || index;
31
- return `${prefix}-${columnMetadata.type}-${index}`;
32
- };
@@ -1,273 +0,0 @@
1
- import { guid } from './guid';
2
- import { smartSetAttribute } from './smartSetAttribute';
3
-
4
- const CONTENT_SEPARATOR = '\n';
5
-
6
- /**
7
- <template>
8
- <span lwc:dom="manual" class="visually-hidden"></span>
9
- <input>
10
- </template>
11
-
12
- class Foo extends LightningElement {
13
- constructor() {
14
- super();
15
- this.ariaObserver = new ContentMutation(this);
16
- }
17
-
18
- @track ariaLabeledbyValue = '';
19
-
20
- @api
21
- get ariaLabeledby() {
22
- return this.ariaLabeledbyValue; // whatever they set, is what they get back.
23
- }
24
- set ariaLabeledby(refs) {
25
- this.ariaLabeledbyValue = refs;
26
- this.ariaObserver.link('input', 'aria-labeledby', refs, 'span.visually-hidden');
27
- }
28
-
29
- renderedCallback() {
30
- this.ariaObserver.sync();
31
- }
32
- }
33
- **/
34
-
35
- function getAttr(elm, attr) {
36
- if (elm.tagName.match(/lightning/i)) {
37
- return elm[attr];
38
- }
39
- return elm.getAttribute(attr);
40
- }
41
-
42
- function extractElements(root, selector) {
43
- if (typeof selector !== 'string' || selector === '') {
44
- return [];
45
- }
46
- return [].slice.call(root.querySelectorAll(selector));
47
- }
48
-
49
- function extractContent(elements) {
50
- return elements
51
- .map((element) => element.textContent)
52
- .filter((text) => text.length)
53
- .join(CONTENT_SEPARATOR);
54
- }
55
-
56
- function splitIds(ids) {
57
- return (ids + '').trim().split(/\s+/);
58
- }
59
-
60
- function hashIds(ids) {
61
- return (ids + '')
62
- .trim()
63
- .split(/\s+/)
64
- .reduce((r, v) => {
65
- r[v] = 1;
66
- return r;
67
- }, {});
68
- }
69
-
70
- // this method should check each individual id from computedIds
71
- // against the existing value of the attrName on elm, and dupe
72
- // them, and add the new ones.
73
- function addAriaRefWhenNeeded(elm, attrName, computedIds) {
74
- const newIds = splitIds(computedIds);
75
- const oldIds = getAttr(elm, attrName) || '';
76
- const oldIdsHash = hashIds(oldIds);
77
- const suffix = [];
78
- for (let i = 0; i < newIds.length; i += 1) {
79
- if (!oldIdsHash[newIds[i]]) {
80
- suffix.push(newIds[i]);
81
- }
82
- }
83
-
84
- if (suffix.length !== 0) {
85
- smartSetAttribute(
86
- elm,
87
- attrName,
88
- oldIds + (oldIds.length === 0 ? '' : ' ') + suffix.join(' ')
89
- );
90
- }
91
- }
92
-
93
- // this method should check each individual id from computedIds
94
- // against the existing value of the attrName on elm, and remove
95
- // them when possible in preparation for some new values.
96
- function removeAriaRefWhenPossible(elm, attrName, computedIds) {
97
- const newIds = splitIds(computedIds);
98
- const oldIds = getAttr(elm, attrName) || '';
99
- const oldIdsHash = hashIds(oldIds);
100
- const newValues = [];
101
- for (let i = 0; i < newIds.length; i += 1) {
102
- if (!oldIdsHash[newIds[i]]) {
103
- newValues.push(newIds[i]);
104
- }
105
- }
106
- smartSetAttribute(elm, attrName, newValues.join(' '));
107
- }
108
-
109
- export class ContentMutation {
110
- constructor(component) {
111
- this.component = component;
112
- this.template = component.template;
113
- this.isNative = this.template.constructor
114
- .toString()
115
- .match(/\[native code\]/);
116
- this.state = {};
117
- this.liveIds = {};
118
- this.guid = guid();
119
- }
120
-
121
- connectLiveIdRef(refs, callback) {
122
- const selector = (refs + '')
123
- .trim()
124
- .split(/\s+/)
125
- .map((ref) => `[id*="${ref}"]`)
126
- .join(',');
127
- const liveId = { selector, callback };
128
- this.liveIds[refs] = liveId;
129
- }
130
-
131
- link(innerSelector, attrName, ids, placeholderContainerSelector) {
132
- let attrState = this.state[attrName];
133
- if (attrState) {
134
- // note: we don't support linking to a different innerSelector,
135
- // attrName, or placeholderContainerSelector
136
- if (!this.isNative) {
137
- const elm = this.template.querySelector(innerSelector);
138
- if (elm) {
139
- // removing the old ids if possible before setting the new ones
140
- removeAriaRefWhenPossible(elm, attrName, attrState.ids);
141
- }
142
- attrState.ids = ids;
143
- }
144
- } else {
145
- attrState = this.state[attrName] = {
146
- ids,
147
- innerSelector,
148
- placeholderContainerSelector,
149
- };
150
- }
151
- if (this.isNative) {
152
- attrState.outerSelector = (ids + '')
153
- .trim()
154
- .split(/\s+/)
155
- .map((ref) => `#${ref}`)
156
- .join(',');
157
- attrState.placeholder = document.createElement('span');
158
- attrState.placeholder.id = `auto-link-${attrName}-${this.guid}`;
159
- }
160
- if (this.component.isConnected) {
161
- this.privateUpdate(attrName);
162
- }
163
- }
164
-
165
- sync() {
166
- if (!this.component.isConnected) {
167
- throw new Error(
168
- `Invalid sync invocation. It can only be invoked during renderedCallback().`
169
- );
170
- }
171
- if (this.isNative && !this.mo) {
172
- this.privateConnect();
173
- }
174
- for (const attrName in this.state) {
175
- if (Object.prototype.hasOwnProperty.call(this.state, attrName)) {
176
- this.privateUpdate(attrName);
177
- }
178
- }
179
-
180
- // live idRef feature is a no-op in native
181
- if (!this.isNative) {
182
- this.privateUpdateLiveIds();
183
- }
184
- }
185
-
186
- privateExtractIds(elements) {
187
- return elements
188
- .map((el) => {
189
- return el.getAttribute('id');
190
- })
191
- .join(' ');
192
- }
193
-
194
- privateUpdateLiveIds() {
195
- const root = this.template.host.getRootNode();
196
-
197
- // if not connected do nothing
198
- if (!root) {
199
- return;
200
- }
201
- for (const liveId in this.liveIds) {
202
- if (Object.prototype.hasOwnProperty.call(this.liveIds, liveId)) {
203
- const thisId = this.liveIds[liveId];
204
- if (!thisId.elements) {
205
- // element refs are cached
206
- thisId.elements = Array.prototype.slice.call(
207
- root.querySelectorAll(thisId.selector)
208
- );
209
- }
210
- const newIds = this.privateExtractIds(thisId.elements);
211
- // only fire calback if the value changed
212
- if (newIds !== thisId.ids) {
213
- thisId.callback(newIds);
214
- thisId.ids = newIds;
215
- }
216
- }
217
- }
218
- }
219
-
220
- privateUpdate(attrName) {
221
- const { innerSelector } = this.state[attrName];
222
- const elm = this.template.querySelector(innerSelector);
223
- if (!elm) {
224
- return; // nothing to update
225
- }
226
- let computedIds;
227
- if (this.isNative) {
228
- const {
229
- outerSelector,
230
- content,
231
- placeholder,
232
- placeholderContainerSelector,
233
- } = this.state[attrName];
234
- const newContent = extractContent(
235
- extractElements(this.root, outerSelector)
236
- );
237
- if (content !== newContent) {
238
- this.state[attrName].content = placeholder.textContent =
239
- newContent;
240
- }
241
- if (!placeholder.parentNode) {
242
- // inserting the placeholder once
243
- const container = this.template.querySelector(
244
- placeholderContainerSelector
245
- );
246
- if (container) {
247
- container.appendChild(placeholder);
248
- }
249
- }
250
- computedIds = placeholder.id;
251
- } else {
252
- computedIds = this.state[attrName].ids;
253
- }
254
- addAriaRefWhenNeeded(elm, attrName, computedIds);
255
- }
256
-
257
- privateConnect() {
258
- // caching root ref
259
- this.root = this.template.host.getRootNode();
260
- // creating the observer once
261
- const mo = new MutationObserver(() => {
262
- if (!this.component.isConnected) {
263
- return; // do nothing when the template is not connected
264
- }
265
- this.sync();
266
- });
267
- mo.observe(this.root, {
268
- characterData: true,
269
- childList: true,
270
- subtree: true,
271
- });
272
- }
273
- }