@vonage/vivid 5.16.0 → 5.17.0

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 (317) hide show
  1. package/accordion/index.cjs +1 -1
  2. package/accordion/index.js +1 -1
  3. package/accordion-item/index.cjs +1 -1
  4. package/accordion-item/index.js +1 -1
  5. package/action-group/index.cjs +3 -3
  6. package/action-group/index.js +5 -5
  7. package/alert/index.cjs +3 -3
  8. package/alert/index.js +17 -17
  9. package/audio-player/index.cjs +16 -16
  10. package/audio-player/index.js +27 -27
  11. package/avatar/index.cjs +2 -2
  12. package/avatar/index.js +6 -6
  13. package/badge/index.cjs +2 -2
  14. package/badge/index.js +6 -6
  15. package/banner/index.cjs +3 -3
  16. package/banner/index.js +15 -15
  17. package/bundled/base-color-picker.cjs +2 -2
  18. package/bundled/base-color-picker.js +5 -5
  19. package/bundled/button.cjs +1 -1
  20. package/bundled/button.js +2 -2
  21. package/bundled/calendar-picker.template.cjs +2 -2
  22. package/bundled/calendar-picker.template.js +498 -498
  23. package/bundled/definition10.cjs +18 -30
  24. package/bundled/definition10.js +53 -155
  25. package/bundled/definition11.cjs +10 -19
  26. package/bundled/definition11.js +25 -74
  27. package/bundled/definition12.cjs +72 -18
  28. package/bundled/definition12.js +171 -107
  29. package/bundled/definition13.cjs +18 -17
  30. package/bundled/definition13.js +45 -65
  31. package/bundled/definition14.cjs +5 -10
  32. package/bundled/definition14.js +9 -27
  33. package/bundled/definition15.cjs +17 -71
  34. package/bundled/definition15.js +64 -181
  35. package/bundled/definition16.cjs +12 -4
  36. package/bundled/definition16.js +79 -14
  37. package/bundled/definition17.cjs +19 -13
  38. package/bundled/definition17.js +119 -70
  39. package/bundled/definition18.cjs +87 -12
  40. package/bundled/definition18.js +409 -52
  41. package/bundled/definition19.cjs +5 -87
  42. package/bundled/definition19.js +14 -422
  43. package/bundled/definition2.cjs +3 -3
  44. package/bundled/definition2.js +27 -27
  45. package/bundled/definition20.cjs +30 -5
  46. package/bundled/definition20.js +159 -9
  47. package/bundled/definition21.cjs +28 -19
  48. package/bundled/definition21.js +164 -47
  49. package/bundled/definition22.cjs +38 -23
  50. package/bundled/definition22.js +64 -82
  51. package/bundled/definition3.cjs +1 -1
  52. package/bundled/definition3.js +15 -15
  53. package/bundled/definition4.cjs +23 -38
  54. package/bundled/definition4.js +82 -64
  55. package/bundled/definition5.cjs +2 -2
  56. package/bundled/definition5.js +5 -5
  57. package/bundled/definition6.cjs +2 -2
  58. package/bundled/definition6.js +24 -24
  59. package/bundled/definition9.cjs +12 -30
  60. package/bundled/definition9.js +55 -148
  61. package/bundled/divider.cjs +1 -1
  62. package/bundled/divider.js +5 -5
  63. package/bundled/listbox.cjs +1 -1
  64. package/bundled/listbox.js +1 -1
  65. package/bundled/mixins.cjs +4 -4
  66. package/bundled/mixins.js +43 -43
  67. package/bundled/picker-field.template.cjs +7 -7
  68. package/bundled/picker-field.template.js +14 -14
  69. package/bundled/slider.template.cjs +7 -7
  70. package/bundled/slider.template.js +12 -12
  71. package/bundled/slottable-request.cjs +1 -1
  72. package/bundled/slottable-request.js +8 -38
  73. package/bundled/time-selection-picker.template.cjs +4 -4
  74. package/bundled/time-selection-picker.template.js +35 -35
  75. package/bundled/vivid-element.cjs +1 -1
  76. package/bundled/vivid-element.js +1 -1
  77. package/calendar/index.cjs +11 -11
  78. package/calendar/index.js +30 -237
  79. package/calendar-event/index.cjs +3 -3
  80. package/calendar-event/index.js +4 -4
  81. package/card/index.cjs +14 -11
  82. package/card/index.js +16 -13
  83. package/checkbox/index.cjs +1 -1
  84. package/checkbox/index.js +1 -1
  85. package/color-picker/definition.cjs +1 -1
  86. package/color-picker/definition.js +1 -1
  87. package/color-picker/index.cjs +6 -6
  88. package/color-picker/index.js +24 -24
  89. package/combobox/definition.cjs +1 -1
  90. package/combobox/definition.js +1 -1
  91. package/combobox/index.cjs +9 -8
  92. package/combobox/index.js +32 -28
  93. package/contextual-help/definition.cjs +1 -1
  94. package/contextual-help/definition.js +1 -1
  95. package/contextual-help/index.cjs +1 -1
  96. package/contextual-help/index.js +1 -1
  97. package/custom-elements.json +1027 -615
  98. package/data-grid/definition.js +1 -1
  99. package/data-grid/index.cjs +17 -17
  100. package/data-grid/index.js +261 -264
  101. package/date-picker/index.cjs +1 -1
  102. package/date-picker/index.js +12 -12
  103. package/date-range-picker/index.cjs +1 -1
  104. package/date-range-picker/index.js +7 -7
  105. package/date-time-picker/index.cjs +4 -4
  106. package/date-time-picker/index.js +24 -24
  107. package/dial-pad/index.cjs +3 -2
  108. package/dial-pad/index.js +6 -5
  109. package/dialog/index.cjs +4 -4
  110. package/dialog/index.js +5 -5
  111. package/divider/index.cjs +1 -1
  112. package/divider/index.js +1 -1
  113. package/fab/index.cjs +3 -3
  114. package/fab/index.js +8 -8
  115. package/file-picker/index.cjs +16 -13
  116. package/file-picker/index.js +31 -28
  117. package/header/index.cjs +4 -4
  118. package/header/index.js +5 -5
  119. package/index.cjs +24 -21
  120. package/index.js +11 -11
  121. package/lib/combobox/combobox.d.ts +0 -3
  122. package/lib/date-time-picker/date-time-picker.d.ts +0 -4
  123. package/lib/dial-pad/dial-pad.d.ts +6 -2
  124. package/lib/dialog/dialog.d.ts +0 -1
  125. package/lib/menu/menu.d.ts +0 -1
  126. package/lib/option/option.d.ts +0 -1
  127. package/lib/rich-text-editor/rte/exports.d.ts +1 -0
  128. package/lib/rich-text-editor/rte/features/alignment.d.ts +1 -1
  129. package/lib/rich-text-editor/rte/features/character-count.d.ts +21 -0
  130. package/lib/rich-text-editor/rte/features/font-size-picker.d.ts +1 -1
  131. package/lib/rich-text-editor/rte/features/internal/basic-text-blocks.d.ts +1 -1
  132. package/lib/rich-text-editor/rte/features/keyboard-shortcuts.d.ts +1 -1
  133. package/lib/rich-text-editor/rte/features/text-color-picker.d.ts +1 -1
  134. package/lib/rich-text-editor/rte/public-interface.d.ts +6 -0
  135. package/lib/searchable-select/option-tag.d.ts +0 -1
  136. package/lib/table/definition.d.ts +2 -1
  137. package/lib/table/table-header-cell.d.ts +3 -0
  138. package/lib/table/table-sorting-button.d.ts +415 -0
  139. package/lib/table/table-sorting-button.template.d.ts +3 -0
  140. package/locales/de-DE.cjs +4 -178
  141. package/locales/de-DE.js +2 -179
  142. package/locales/en-GB.cjs +4 -9
  143. package/locales/en-GB.js +2 -10
  144. package/locales/en-US.cjs +268 -2
  145. package/locales/en-US.js +265 -1
  146. package/locales/ja-JP.cjs +4 -171
  147. package/locales/ja-JP.js +2 -172
  148. package/locales/zh-CN.cjs +4 -172
  149. package/locales/zh-CN.js +2 -173
  150. package/menu/index.cjs +1 -1
  151. package/menu/index.js +1 -1
  152. package/menu-item/index.cjs +1 -1
  153. package/menu-item/index.js +1 -1
  154. package/nav-disclosure/index.cjs +3 -3
  155. package/nav-disclosure/index.js +8 -8
  156. package/nav-item/index.cjs +1 -1
  157. package/nav-item/index.js +7 -7
  158. package/note/index.cjs +2 -2
  159. package/note/index.js +6 -6
  160. package/number-field/index.cjs +4 -4
  161. package/number-field/index.js +31 -31
  162. package/option/definition.cjs +1 -1
  163. package/option/definition.js +1 -1
  164. package/option/index.cjs +1 -1
  165. package/option/index.js +1 -1
  166. package/package.json +7 -8
  167. package/pagination/index.cjs +3 -3
  168. package/pagination/index.js +15 -15
  169. package/popover/index.cjs +4 -4
  170. package/popover/index.js +5 -5
  171. package/progress/index.cjs +2 -2
  172. package/progress/index.js +5 -5
  173. package/radio/index.cjs +1 -1
  174. package/radio/index.js +1 -1
  175. package/radio-group/index.cjs +4 -4
  176. package/radio-group/index.js +10 -10
  177. package/range-slider/index.cjs +4 -4
  178. package/range-slider/index.js +17 -17
  179. package/rich-text-editor/definition.cjs +1 -0
  180. package/rich-text-editor/definition.js +2 -2
  181. package/rich-text-editor/index.cjs +13 -13
  182. package/rich-text-editor/index.js +1886 -1829
  183. package/rich-text-view/index.cjs +1 -1
  184. package/rich-text-view/index.js +8 -8
  185. package/searchable-select/index.cjs +12 -12
  186. package/searchable-select/index.js +25 -25
  187. package/select/index.cjs +1 -1
  188. package/select/index.js +1 -1
  189. package/selectable-box/index.cjs +7 -7
  190. package/selectable-box/index.js +11 -11
  191. package/shared/foundation/test-utilities/fixture.d.ts +1 -1
  192. package/shared/patterns/linkable.d.ts +1 -1
  193. package/simple-color-picker/index.cjs +3 -3
  194. package/simple-color-picker/index.js +10 -10
  195. package/split-button/index.cjs +5 -5
  196. package/split-button/index.js +10 -10
  197. package/status/index.cjs +2 -2
  198. package/status/index.js +12 -12
  199. package/switch/index.cjs +3 -3
  200. package/switch/index.js +5 -5
  201. package/tab/index.cjs +1 -1
  202. package/tab/index.js +1 -1
  203. package/tab-panel/index.cjs +1 -1
  204. package/tab-panel/index.js +1 -1
  205. package/table/definition.cjs +17 -14
  206. package/table/definition.js +3 -2
  207. package/table/index.cjs +19 -10
  208. package/table/index.js +69 -21
  209. package/tabs/index.cjs +2 -2
  210. package/tabs/index.js +4 -4
  211. package/tag/index.cjs +7 -7
  212. package/tag/index.js +9 -9
  213. package/tag-group/index.cjs +3 -3
  214. package/tag-group/index.js +5 -5
  215. package/text-area/index.cjs +2 -2
  216. package/text-area/index.js +12 -12
  217. package/text-field/definition.cjs +1 -1
  218. package/text-field/definition.js +1 -1
  219. package/text-field/index.cjs +1 -1
  220. package/text-field/index.js +1 -1
  221. package/time-picker/index.cjs +1 -1
  222. package/time-picker/index.js +1 -1
  223. package/toggletip/definition.cjs +1 -1
  224. package/toggletip/definition.js +1 -1
  225. package/toggletip/index.cjs +1 -1
  226. package/toggletip/index.js +1 -1
  227. package/tooltip/definition.cjs +1 -1
  228. package/tooltip/definition.js +1 -1
  229. package/tooltip/index.cjs +1 -1
  230. package/tooltip/index.js +1 -1
  231. package/tree-item/index.cjs +1 -1
  232. package/tree-item/index.js +1 -1
  233. package/tree-view/index.cjs +3 -3
  234. package/tree-view/index.js +17 -17
  235. package/unbundled/button.cjs +2 -2
  236. package/unbundled/button.js +2 -2
  237. package/unbundled/calendar-picker.template.cjs +4347 -9
  238. package/unbundled/calendar-picker.template.js +4345 -7
  239. package/unbundled/chunk.cjs +0 -22
  240. package/unbundled/definition13.cjs +1 -8
  241. package/unbundled/definition13.js +1 -8
  242. package/unbundled/definition14.cjs +2 -2
  243. package/unbundled/definition14.js +2 -2
  244. package/unbundled/definition2.cjs +1 -1
  245. package/unbundled/definition2.js +1 -1
  246. package/unbundled/definition21.cjs +1 -2
  247. package/unbundled/definition21.js +1 -2
  248. package/unbundled/definition22.cjs +7 -2
  249. package/unbundled/definition22.js +7 -2
  250. package/unbundled/definition24.cjs +98 -979
  251. package/unbundled/definition24.js +93 -974
  252. package/unbundled/definition25.cjs +37 -322
  253. package/unbundled/definition25.js +33 -318
  254. package/unbundled/definition26.cjs +317 -91
  255. package/unbundled/definition26.js +313 -87
  256. package/unbundled/definition27.cjs +94 -192
  257. package/unbundled/definition27.js +91 -183
  258. package/unbundled/definition28.cjs +387 -395
  259. package/unbundled/definition28.js +387 -395
  260. package/unbundled/definition29.cjs +189 -110
  261. package/unbundled/definition29.js +180 -107
  262. package/unbundled/definition30.cjs +520 -36
  263. package/unbundled/definition30.js +519 -35
  264. package/unbundled/definition32.cjs +477 -477
  265. package/unbundled/definition32.js +475 -475
  266. package/unbundled/definition33.cjs +87 -2
  267. package/unbundled/definition33.js +77 -4
  268. package/unbundled/definition35.cjs +2 -2
  269. package/unbundled/definition35.js +2 -2
  270. package/unbundled/definition36.cjs +1 -1
  271. package/unbundled/definition36.js +1 -1
  272. package/unbundled/definition37.cjs +6 -2
  273. package/unbundled/definition37.js +6 -2
  274. package/unbundled/definition38.cjs +7 -5
  275. package/unbundled/definition38.js +7 -5
  276. package/unbundled/definition39.cjs +1 -0
  277. package/unbundled/definition39.js +1 -0
  278. package/unbundled/definition42.cjs +22 -11
  279. package/unbundled/definition42.js +22 -11
  280. package/unbundled/definition49.cjs +3 -3
  281. package/unbundled/definition49.js +3 -3
  282. package/unbundled/definition56.cjs +437 -9506
  283. package/unbundled/definition56.js +340 -9415
  284. package/unbundled/definition57.cjs +5 -5
  285. package/unbundled/definition57.js +5 -5
  286. package/unbundled/definition58.cjs +4 -3
  287. package/unbundled/definition58.js +2 -1
  288. package/unbundled/definition59.cjs +4 -3
  289. package/unbundled/definition59.js +4 -3
  290. package/unbundled/definition62.cjs +2 -2
  291. package/unbundled/definition62.js +2 -2
  292. package/unbundled/definition64.cjs +1 -1
  293. package/unbundled/definition64.js +1 -1
  294. package/unbundled/definition71.cjs +2 -2
  295. package/unbundled/definition71.js +2 -2
  296. package/unbundled/definition72.cjs +1 -2
  297. package/unbundled/definition72.js +1 -2
  298. package/unbundled/definition75.cjs +3 -51711
  299. package/unbundled/definition75.js +1 -51711
  300. package/unbundled/listbox.cjs +1 -1
  301. package/unbundled/listbox.js +1 -1
  302. package/unbundled/localized.cjs +2 -2
  303. package/unbundled/localized.js +1 -1
  304. package/unbundled/picker-field.template.cjs +1 -1
  305. package/unbundled/picker-field.template.js +1 -1
  306. package/unbundled/slottable-request.cjs +2 -3168
  307. package/unbundled/slottable-request.js +3 -3097
  308. package/unbundled/time-selection-picker.template.cjs +1 -1
  309. package/unbundled/time-selection-picker.template.js +1 -1
  310. package/unbundled/vivid-element.cjs +1 -1
  311. package/unbundled/vivid-element.js +1 -1
  312. package/video-player/index.cjs +3 -3
  313. package/video-player/index.js +9 -9
  314. package/vivid.api.json +220 -282
  315. package/unbundled/chunk.js +0 -33
  316. package/unbundled/en-US.cjs +0 -447
  317. package/unbundled/en-US.js +0 -443
@@ -699,534 +699,148 @@ var ViewBehaviorOrchestrator = Object.freeze({ create(source) {
699
699
  };
700
700
  } });
701
701
  //#endregion
702
- //#region src/lib/data-grid/data-grid-cell.ts
703
- var defaultCellContentsTemplate = html`
704
- <template>
705
- ${(x) => x.rowData === null || x.columnDefinition === null || x.columnDefinition.columnDataKey === null ? null : x.rowData[x.columnDefinition.columnDataKey]}
706
- </template>
707
- `;
708
- var defaultHeaderCellContentsTemplate = html`
709
- <template>
710
- ${(x) => x.columnDefinition.title === void 0 ? x.columnDefinition.columnDataKey : x.columnDefinition.title}
711
- </template>
712
- `;
702
+ //#region src/lib/data-grid/data-grid.ts
703
+ var DataGridSelectionMode = {
704
+ none: "none",
705
+ singleRow: "single-row",
706
+ multiRow: "multi-row",
707
+ singleCell: "single-cell",
708
+ multiCell: "multi-cell"
709
+ };
713
710
  /**
714
711
  * @public
715
- * @component data-grid-cell
712
+ * @component data-grid
716
713
  * @slot - Default slot.
717
- * @slot action-items - Add action items to the cell using this slot.
718
- * @event {CustomEvent<{columnDataKey: string, ariaSort: string | null, sortDirection: string | null}>} sort - Event that fires when a sortable column header is clicked
719
714
  * @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
720
- * @event {CustomEvent<HTMLElement>} cell-focused - Fires a custom 'cell-focused' event when focus is on the cell or its contents
721
715
  */
722
- var DataGridCell = class extends Localized(HostSemantics(VividElement)) {
723
- constructor(..._args) {
724
- super(..._args);
725
- this.cellType = DataGridCellTypes.default;
726
- this.rowData = null;
727
- this.columnDefinition = null;
728
- this.isActiveCell = false;
729
- this.customCellView = null;
730
- this.updateCellStyle = () => {
731
- if (this.gridColumn && !this.gridColumn.includes("undefined")) this.style.gridColumn = this.gridColumn;
732
- else this.style.removeProperty("grid-column");
733
- };
734
- this._selectable = false;
735
- this.selected = false;
736
- this.ariaSelected = null;
737
- this.ariaSort = null;
738
- }
716
+ var DataGrid = class DataGrid extends VividElement {
739
717
  /**
740
- * @internal
718
+ * generates a gridTemplateColumns based on columndata array
741
719
  */
742
- cellTypeChanged() {
743
- if (this.$fastController.isConnected) this.updateCellView();
720
+ static generateTemplateColumns(columnDefinitions) {
721
+ let templateColumns = "";
722
+ columnDefinitions.forEach((_) => {
723
+ templateColumns = `${templateColumns}${templateColumns === "" ? "" : " "}1fr`;
724
+ });
725
+ return templateColumns;
744
726
  }
745
727
  /**
746
728
  * @internal
747
729
  */
748
- gridColumnChanged() {
749
- if (this.$fastController.isConnected) this.updateCellStyle();
730
+ noTabbingChanged() {
731
+ if (this.$fastController.isConnected) this.#setTabIndex();
732
+ }
733
+ #setTabIndex() {
734
+ this.setAttribute("tabIndex", this.noTabbing || this.contains(document.activeElement) ? "-1" : "0");
750
735
  }
751
736
  /**
752
737
  * @internal
753
738
  */
754
- columnDefinitionChanged(_oldValue, _newValue) {
755
- if (this.$fastController.isConnected) this.updateCellView();
739
+ generateHeaderChanged() {
740
+ if (this.$fastController.isConnected) this.toggleGeneratedHeader();
756
741
  }
757
742
  /**
758
- * Updates the fixed column style
759
743
  * @internal
760
744
  */
761
- updateFixedStyle() {
762
- if (this.fixedPosition !== void 0) {
763
- this.setAttribute("data-fixed", "");
764
- this.style.left = this.fixedPosition;
765
- } else {
766
- this.removeAttribute("data-fixed");
767
- this.style.removeProperty("left");
745
+ gridTemplateColumnsChanged() {
746
+ /* v8 ignore if -- @preserve */
747
+ if (this.$fastController.isConnected) {
748
+ this.updateRowIndexes();
749
+ if (this.fixedColumns && this.fixedColumns > 0) this.applyFixedColumns();
768
750
  }
769
751
  }
770
752
  /**
771
- * Sets the fixed state and position for this cell
772
753
  * @internal
773
754
  */
774
- setFixedPosition(position) {
775
- this.fixedPosition = position;
776
- this.updateFixedStyle();
755
+ rowsDataChanged() {
756
+ if (this.columnDefinitions === null && this.rowsData.length > 0) this.columnDefinitions = DataGrid.generateColumns(this.rowsData[0]);
757
+ if (this.$fastController.isConnected) this.toggleGeneratedHeader();
777
758
  }
778
759
  /**
779
760
  * @internal
780
761
  */
781
- connectedCallback() {
782
- super.connectedCallback();
783
- this.addEventListener(eventFocusIn, this.handleFocusin);
784
- this.addEventListener(eventFocusOut, this.handleFocusout);
785
- this.addEventListener(eventKeyDown, this.handleKeydown);
786
- this.style.gridColumn = `${this.columnDefinition?.gridColumn === void 0 ? 0 : this.columnDefinition.gridColumn}`;
787
- this.updateCellView();
788
- this.updateCellStyle();
789
- this.updateFixedStyle();
762
+ columnDefinitionsChanged() {
763
+ if (this.columnDefinitions === null) {
764
+ this.generatedGridTemplateColumns = "";
765
+ return;
766
+ }
767
+ this.generatedGridTemplateColumns = DataGrid.generateTemplateColumns(this.columnDefinitions);
768
+ /* v8 ignore if -- @preserve */
769
+ if (this.$fastController.isConnected) {
770
+ this.columnDefinitionsStale = true;
771
+ this.queueRowIndexUpdate();
772
+ }
790
773
  }
791
774
  /**
792
775
  * @internal
793
776
  */
794
- disconnectedCallback() {
795
- super.disconnectedCallback();
796
- this.removeEventListener(eventFocusIn, this.handleFocusin);
797
- this.removeEventListener(eventFocusOut, this.handleFocusout);
798
- this.removeEventListener(eventKeyDown, this.handleKeydown);
799
- this.disconnectCellView();
777
+ headerCellItemTemplateChanged() {
778
+ /* v8 ignore if -- @preserve */
779
+ if (this.$fastController.isConnected) {
780
+ if (this.generatedHeader !== null) this.generatedHeader.headerCellItemTemplate = this.headerCellItemTemplate;
781
+ }
800
782
  }
801
783
  /**
802
784
  * @internal
803
785
  */
804
- handleFocusin(_) {
805
- this.shadowRoot.querySelector(".base").classList.add("active");
806
- if (this.isActiveCell) return;
807
- this.isActiveCell = true;
808
- switch (this.cellType) {
809
- case DataGridCellTypes.columnHeader:
810
- if (this.columnDefinition !== null && this.columnDefinition.headerCellInternalFocusQueue !== true && typeof this.columnDefinition.headerCellFocusTargetCallback === "function") {
811
- const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
812
- /* v8 ignore else -- @preserve */
813
- if (focusTarget !== null) focusTarget.focus();
814
- }
815
- break;
816
- default:
817
- if (this.columnDefinition !== null && this.columnDefinition.cellInternalFocusQueue !== true && typeof this.columnDefinition.cellFocusTargetCallback === "function") {
818
- const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
819
- /* v8 ignore else -- @preserve */
820
- if (focusTarget !== null) focusTarget.focus();
821
- }
822
- break;
823
- }
824
- this.$emit("cell-focused", this);
786
+ focusRowIndexChanged() {
787
+ if (this.$fastController.isConnected) this.queueFocusUpdate();
825
788
  }
826
789
  /**
827
790
  * @internal
828
791
  */
829
- handleFocusout(_) {
830
- this.shadowRoot.querySelector(".base").classList.remove("active");
831
- /* v8 ignore else -- @preserve */
832
- if (this !== document.activeElement && !this.contains(document.activeElement)) this.isActiveCell = false;
792
+ focusColumnIndexChanged() {
793
+ if (this.$fastController.isConnected) this.queueFocusUpdate();
833
794
  }
834
795
  /**
835
796
  * @internal
836
797
  */
837
- handleKeydown(e) {
838
- if (e.defaultPrevented || this.columnDefinition === null || this.cellType === DataGridCellTypes.default && this.columnDefinition.cellInternalFocusQueue !== true || this.cellType === DataGridCellTypes.columnHeader && this.columnDefinition.headerCellInternalFocusQueue !== true) return;
839
- switch (e.key) {
840
- case keyEnter:
841
- case keyFunction2:
842
- if (this.contains(document.activeElement) && document.activeElement !== this) return;
843
- switch (this.cellType) {
844
- case DataGridCellTypes.columnHeader:
845
- if (this.columnDefinition.headerCellFocusTargetCallback !== void 0) {
846
- const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
847
- /* v8 ignore else -- @preserve */
848
- if (focusTarget !== null) focusTarget.focus();
849
- e.preventDefault();
850
- }
851
- break;
852
- default:
853
- if (this.columnDefinition.cellFocusTargetCallback !== void 0) {
854
- const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
855
- /* v8 ignore else -- @preserve */
856
- if (focusTarget !== null) focusTarget.focus();
857
- e.preventDefault();
858
- }
859
- break;
860
- }
861
- break;
862
- case keyEscape:
863
- /* v8 ignore else -- @preserve */
864
- if (this.contains(document.activeElement) && document.activeElement !== this) {
865
- this.focus();
866
- e.preventDefault();
867
- }
868
- break;
869
- }
870
- }
871
- updateCellView() {
872
- this.disconnectCellView();
873
- if (this.columnDefinition === null) return;
874
- switch (this.cellType) {
875
- case DataGridCellTypes.columnHeader:
876
- if (this.columnDefinition.headerCellTemplate !== void 0) this.customCellView = this.columnDefinition.headerCellTemplate.render(this, this);
877
- else this.customCellView = defaultHeaderCellContentsTemplate.render(this, this);
878
- break;
879
- case DataGridCellTypes.rowHeader:
880
- case DataGridCellTypes.default:
881
- if (this.columnDefinition.cellTemplate !== void 0) this.customCellView = this.columnDefinition.cellTemplate.render(this, this);
882
- else this.customCellView = defaultCellContentsTemplate.render(this, this);
883
- break;
884
- }
885
- if (!this.columnDefinition?.sortable) this.sortDirection = void 0;
886
- else if (this.columnDefinition.sortDirection) this.sortDirection = this.columnDefinition.sortDirection;
887
- else this.sortDirection = DataGridCellSortStates.none;
888
- }
889
- disconnectCellView() {
890
- if (this.customCellView !== null) {
891
- this.customCellView.dispose();
892
- this.customCellView = null;
798
+ fixedColumnsChanged() {
799
+ /* v8 ignore if -- @preserve */
800
+ if (this.$fastController.isConnected) {
801
+ this.applyFixedColumns();
802
+ this.setupResizeObserver();
893
803
  }
894
804
  }
895
805
  /**
896
806
  * @internal
897
807
  */
898
- ariaSelectedChanged(prevValue, newValue) {
899
- super.ariaSelectedChanged(prevValue, newValue);
900
- this._selectable = newValue !== null;
901
- this.selected = newValue === "true";
808
+ setupResizeObserver() {
809
+ if (this.resizeObserver) {
810
+ this.resizeObserver.disconnect();
811
+ this.resizeObserver = void 0;
812
+ }
813
+ if (typeof ResizeObserver !== "undefined" && this.fixedColumns && this.fixedColumns > 0) {
814
+ this.resizeObserver = new ResizeObserver(() => {
815
+ this.applyFixedColumns();
816
+ });
817
+ this.resizeObserver.observe(this);
818
+ }
902
819
  }
903
820
  /**
904
821
  * @internal
905
822
  */
906
- ariaSortChanged(oldValue, newValue) {
907
- super.ariaSortChanged(oldValue, newValue);
908
- if (newValue === null) {
909
- this.sortDirection = void 0;
910
- return;
823
+ connectedCallback() {
824
+ super.connectedCallback();
825
+ /* v8 ignore else -- @preserve */
826
+ if (this.rowItemTemplate === void 0) this.rowItemTemplate = this.defaultRowItemTemplate;
827
+ /* v8 ignore else -- @preserve */
828
+ if (this.behaviorOrchestrator === null) {
829
+ this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
830
+ this.$fastController.addBehavior(this.behaviorOrchestrator);
831
+ this.behaviorOrchestrator.addBehaviorFactory(new RepeatDirective(normalizeBinding((x) => x.rowsData), normalizeBinding((x) => x.rowItemTemplate), { positioning: true }), this.appendChild(document.createComment("")));
911
832
  }
912
- this.sortDirection = newValue;
913
- }
914
- #getColumnDataKey() {
915
- return this.columnDefinition && this.columnDefinition.columnDataKey ? this.columnDefinition.columnDataKey : this.textContent.trim();
916
- }
917
- /**
918
- * @internal
919
- */
920
- _handleInteraction() {
921
- const isHeaderCell = this.cellType === "columnheader";
922
- if (isHeaderCell && this.sortDirection !== void 0) this.$emit("sort", {
923
- columnDataKey: this.#getColumnDataKey(),
924
- sortDirection: this.sortDirection
925
- });
926
- if (!(isHeaderCell ? this.columnDefinition?.headerCellInternalFocusQueue : this.columnDefinition?.cellInternalFocusQueue)) this.$emit("cell-click", {
927
- cell: this,
928
- row: this.parentElement,
929
- isHeaderCell,
930
- columnDataKey: this.#getColumnDataKey()
931
- });
932
- return true;
933
- }
934
- };
935
- __decorate([attr({ attribute: "cell-type" })], DataGridCell.prototype, "cellType", void 0);
936
- __decorate([attr({ attribute: "grid-column" })], DataGridCell.prototype, "gridColumn", void 0);
937
- __decorate([observable], DataGridCell.prototype, "rowData", void 0);
938
- __decorate([observable], DataGridCell.prototype, "columnDefinition", void 0);
939
- __decorate([observable], DataGridCell.prototype, "_selectable", void 0);
940
- __decorate([attr({ mode: "boolean" })], DataGridCell.prototype, "selected", void 0);
941
- __decorate([attr({ attribute: "sort-direction" })], DataGridCell.prototype, "sortDirection", void 0);
942
- __decorate([observable], DataGridCell.prototype, "_actionItemsSlottedContent", void 0);
943
- //#endregion
944
- //#region src/lib/data-grid/data-grid-row.ts
945
- /**
946
- * @public
947
- * @component data-grid-row
948
- * @slot - Default slot.
949
- * @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
950
- * @event {CustomEvent<HTMLElement>} row-focused - Fires a custom 'row-focused' event when focus is on an element (usually a cell or its contents) in the row
951
- */
952
- var DataGridRow = class extends HostSemantics(VividElement) {
953
- constructor(..._args) {
954
- super(..._args);
955
- this.rowType = DataGridRowTypes.default;
956
- this.rowData = null;
957
- this.columnDefinitions = null;
958
- this.behaviorOrchestrator = null;
959
- this.focusColumnIndex = 0;
960
- this.updateRowStyle = () => {
961
- this.style.gridTemplateColumns = this.gridTemplateColumns;
962
- };
963
- this.ariaSelected = null;
964
- this._selectable = false;
965
- this.selected = false;
966
- }
967
- /**
968
- * @internal
969
- */
970
- gridTemplateColumnsChanged() {
971
- if (this.$fastController.isConnected) this.updateRowStyle();
972
- }
973
- /**
974
- * @internal
975
- */
976
- rowTypeChanged() {
977
- if (this.$fastController.isConnected) this.updateItemTemplate();
978
- }
979
- /**
980
- * @internal
981
- */
982
- cellItemTemplateChanged() {
983
- this.updateItemTemplate();
984
- }
985
- /**
986
- * @internal
987
- */
988
- headerCellItemTemplateChanged() {
989
- this.updateItemTemplate();
990
- }
991
- /**
992
- * @internal
993
- */
994
- connectedCallback() {
995
- super.connectedCallback();
996
- /* v8 ignore else -- @preserve */
997
- if (this.behaviorOrchestrator === null) {
998
- this.updateItemTemplate();
999
- this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
1000
- this.$fastController.addBehavior(this.behaviorOrchestrator);
1001
- this.behaviorOrchestrator.addBehaviorFactory(new RepeatDirective(normalizeBinding((x) => x.columnDefinitions), normalizeBinding((x) => x.activeCellItemTemplate), { positioning: true }), this.appendChild(document.createComment("")));
1002
- }
1003
- this.addEventListener("cell-focused", this.handleCellFocus);
1004
- this.addEventListener(eventFocusOut, this.handleFocusout);
1005
- this.addEventListener(eventKeyDown, this.handleKeydown);
1006
- this.updateRowStyle();
1007
- }
1008
- /**
1009
- * @internal
1010
- */
1011
- disconnectedCallback() {
1012
- super.disconnectedCallback();
1013
- this.removeEventListener("cell-focused", this.handleCellFocus);
1014
- this.removeEventListener(eventFocusOut, this.handleFocusout);
1015
- this.removeEventListener(eventKeyDown, this.handleKeydown);
1016
- }
1017
- /**
1018
- * @internal
1019
- */
1020
- handleFocusout(_) {
1021
- /* v8 ignore else -- @preserve */
1022
- if (!this.contains(document.activeElement)) this.focusColumnIndex = 0;
1023
- }
1024
- /**
1025
- * @internal
1026
- */
1027
- handleCellFocus(e) {
1028
- this.focusColumnIndex = this.cellElements.indexOf(e.target);
1029
- this.$emit("row-focused", this);
1030
- }
1031
- /**
1032
- * @internal
1033
- */
1034
- handleKeydown(e) {
1035
- if (e.defaultPrevented) return;
1036
- let newFocusColumnIndex = 0;
1037
- switch (e.key) {
1038
- case keyArrowLeft$1:
1039
- newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
1040
- this.cellElements[newFocusColumnIndex].focus();
1041
- e.preventDefault();
1042
- break;
1043
- case keyArrowRight$1:
1044
- newFocusColumnIndex = Math.min(this.cellElements.length - 1, this.focusColumnIndex + 1);
1045
- this.cellElements[newFocusColumnIndex].focus();
1046
- e.preventDefault();
1047
- break;
1048
- case keyHome:
1049
- if (!e.ctrlKey) {
1050
- this.cellElements[0].focus();
1051
- e.preventDefault();
1052
- }
1053
- break;
1054
- case keyEnd:
1055
- if (!e.ctrlKey) {
1056
- this.cellElements[this.cellElements.length - 1].focus();
1057
- e.preventDefault();
1058
- }
1059
- break;
1060
- }
1061
- }
1062
- updateItemTemplate() {
1063
- this.activeCellItemTemplate = this.rowType === DataGridRowTypes.default && this.cellItemTemplate !== void 0 ? this.cellItemTemplate : this.rowType === DataGridRowTypes.default && this.cellItemTemplate === void 0 ? this.defaultCellItemTemplate : this.headerCellItemTemplate !== void 0 ? this.headerCellItemTemplate : this.defaultHeaderCellItemTemplate;
1064
- }
1065
- /**
1066
- * @internal
1067
- */
1068
- ariaSelectedChanged(oldValue, newValue) {
1069
- super.ariaSelectedChanged(oldValue, newValue);
1070
- this._selectable = newValue !== null;
1071
- this.selected = newValue === "true";
1072
- }
1073
- };
1074
- __decorate([attr({ attribute: "grid-template-columns" })], DataGridRow.prototype, "gridTemplateColumns", void 0);
1075
- __decorate([attr({ attribute: "row-type" })], DataGridRow.prototype, "rowType", void 0);
1076
- __decorate([observable], DataGridRow.prototype, "rowData", void 0);
1077
- __decorate([observable], DataGridRow.prototype, "columnDefinitions", void 0);
1078
- __decorate([observable], DataGridRow.prototype, "cellItemTemplate", void 0);
1079
- __decorate([observable], DataGridRow.prototype, "headerCellItemTemplate", void 0);
1080
- __decorate([observable], DataGridRow.prototype, "rowIndex", void 0);
1081
- __decorate([observable], DataGridRow.prototype, "activeCellItemTemplate", void 0);
1082
- __decorate([observable], DataGridRow.prototype, "defaultCellItemTemplate", void 0);
1083
- __decorate([observable], DataGridRow.prototype, "defaultHeaderCellItemTemplate", void 0);
1084
- __decorate([observable], DataGridRow.prototype, "cellElements", void 0);
1085
- __decorate([observable], DataGridRow.prototype, "_selectable", void 0);
1086
- __decorate([attr({ mode: "boolean" })], DataGridRow.prototype, "selected", void 0);
1087
- //#endregion
1088
- //#region src/lib/data-grid/data-grid.ts
1089
- var DataGridSelectionMode = {
1090
- none: "none",
1091
- singleRow: "single-row",
1092
- multiRow: "multi-row",
1093
- singleCell: "single-cell",
1094
- multiCell: "multi-cell"
1095
- };
1096
- /**
1097
- * @public
1098
- * @component data-grid
1099
- * @slot - Default slot.
1100
- * @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
1101
- */
1102
- var DataGrid = class DataGrid extends VividElement {
1103
- /**
1104
- * generates a gridTemplateColumns based on columndata array
1105
- */
1106
- static generateTemplateColumns(columnDefinitions) {
1107
- let templateColumns = "";
1108
- columnDefinitions.forEach((_) => {
1109
- templateColumns = `${templateColumns}${templateColumns === "" ? "" : " "}1fr`;
1110
- });
1111
- return templateColumns;
1112
- }
1113
- /**
1114
- * @internal
1115
- */
1116
- noTabbingChanged() {
1117
- if (this.$fastController.isConnected) this.#setTabIndex();
1118
- }
1119
- #setTabIndex() {
1120
- this.setAttribute("tabIndex", this.noTabbing || this.contains(document.activeElement) ? "-1" : "0");
1121
- }
1122
- /**
1123
- * @internal
1124
- */
1125
- generateHeaderChanged() {
1126
- if (this.$fastController.isConnected) this.toggleGeneratedHeader();
1127
- }
1128
- /**
1129
- * @internal
1130
- */
1131
- gridTemplateColumnsChanged() {
1132
- /* v8 ignore if -- @preserve */
1133
- if (this.$fastController.isConnected) {
1134
- this.updateRowIndexes();
1135
- if (this.fixedColumns && this.fixedColumns > 0) this.applyFixedColumns();
1136
- }
1137
- }
1138
- /**
1139
- * @internal
1140
- */
1141
- rowsDataChanged() {
1142
- if (this.columnDefinitions === null && this.rowsData.length > 0) this.columnDefinitions = DataGrid.generateColumns(this.rowsData[0]);
1143
- if (this.$fastController.isConnected) this.toggleGeneratedHeader();
1144
- }
1145
- /**
1146
- * @internal
1147
- */
1148
- columnDefinitionsChanged() {
1149
- if (this.columnDefinitions === null) {
1150
- this.generatedGridTemplateColumns = "";
1151
- return;
1152
- }
1153
- this.generatedGridTemplateColumns = DataGrid.generateTemplateColumns(this.columnDefinitions);
1154
- /* v8 ignore if -- @preserve */
1155
- if (this.$fastController.isConnected) {
1156
- this.columnDefinitionsStale = true;
1157
- this.queueRowIndexUpdate();
1158
- }
1159
- }
1160
- /**
1161
- * @internal
1162
- */
1163
- headerCellItemTemplateChanged() {
1164
- /* v8 ignore if -- @preserve */
1165
- if (this.$fastController.isConnected) {
1166
- if (this.generatedHeader !== null) this.generatedHeader.headerCellItemTemplate = this.headerCellItemTemplate;
1167
- }
1168
- }
1169
- /**
1170
- * @internal
1171
- */
1172
- focusRowIndexChanged() {
1173
- if (this.$fastController.isConnected) this.queueFocusUpdate();
1174
- }
1175
- /**
1176
- * @internal
1177
- */
1178
- focusColumnIndexChanged() {
1179
- if (this.$fastController.isConnected) this.queueFocusUpdate();
1180
- }
1181
- /**
1182
- * @internal
1183
- */
1184
- fixedColumnsChanged() {
1185
- /* v8 ignore if -- @preserve */
1186
- if (this.$fastController.isConnected) {
1187
- this.applyFixedColumns();
1188
- this.setupResizeObserver();
1189
- }
1190
- }
1191
- /**
1192
- * @internal
1193
- */
1194
- setupResizeObserver() {
1195
- if (this.resizeObserver) {
1196
- this.resizeObserver.disconnect();
1197
- this.resizeObserver = void 0;
1198
- }
1199
- if (typeof ResizeObserver !== "undefined" && this.fixedColumns && this.fixedColumns > 0) {
1200
- this.resizeObserver = new ResizeObserver(() => {
1201
- this.applyFixedColumns();
1202
- });
1203
- this.resizeObserver.observe(this);
1204
- }
1205
- }
1206
- /**
1207
- * @internal
1208
- */
1209
- connectedCallback() {
1210
- super.connectedCallback();
1211
- /* v8 ignore else -- @preserve */
1212
- if (this.rowItemTemplate === void 0) this.rowItemTemplate = this.defaultRowItemTemplate;
1213
- /* v8 ignore else -- @preserve */
1214
- if (this.behaviorOrchestrator === null) {
1215
- this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
1216
- this.$fastController.addBehavior(this.behaviorOrchestrator);
1217
- this.behaviorOrchestrator.addBehaviorFactory(new RepeatDirective(normalizeBinding((x) => x.rowsData), normalizeBinding((x) => x.rowItemTemplate), { positioning: true }), this.appendChild(document.createComment("")));
1218
- }
1219
- this.toggleGeneratedHeader();
1220
- this.addEventListener("row-focused", this.handleRowFocus);
1221
- this.addEventListener(eventFocus, this.handleFocus);
1222
- this.addEventListener(eventKeyDown, this.handleKeydown);
1223
- this.addEventListener(eventFocusOut, this.handleFocusOut);
1224
- this.observer = new MutationObserver(this.onChildListChange);
1225
- this.observer.observe(this, { childList: true });
1226
- this.setupResizeObserver();
1227
- Updates.enqueue(this.queueRowIndexUpdate);
1228
- this.#setTabIndex();
1229
- Observable.getNotifier(this).subscribe(this.#changeHandler, "columnDefinitions");
833
+ this.toggleGeneratedHeader();
834
+ this.addEventListener("row-focused", this.handleRowFocus);
835
+ this.addEventListener(eventFocus, this.handleFocus);
836
+ this.addEventListener(eventKeyDown, this.handleKeydown);
837
+ this.addEventListener(eventFocusOut, this.handleFocusOut);
838
+ this.observer = new MutationObserver(this.onChildListChange);
839
+ this.observer.observe(this, { childList: true });
840
+ this.setupResizeObserver();
841
+ Updates.enqueue(this.queueRowIndexUpdate);
842
+ this.#setTabIndex();
843
+ Observable.getNotifier(this).subscribe(this.#changeHandler, "columnDefinitions");
1230
844
  }
1231
845
  /**
1232
846
  * @internal
@@ -1637,6 +1251,150 @@ __decorate([observable], DataGrid.prototype, "rowElements", void 0);
1637
1251
  __decorate([observable], DataGrid.prototype, "slottedRowElements", void 0);
1638
1252
  __decorate([attr({ attribute: "selection-mode" })], DataGrid.prototype, "selectionMode", void 0);
1639
1253
  //#endregion
1254
+ //#region src/lib/data-grid/data-grid-row.ts
1255
+ /**
1256
+ * @public
1257
+ * @component data-grid-row
1258
+ * @slot - Default slot.
1259
+ * @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
1260
+ * @event {CustomEvent<HTMLElement>} row-focused - Fires a custom 'row-focused' event when focus is on an element (usually a cell or its contents) in the row
1261
+ */
1262
+ var DataGridRow = class extends HostSemantics(VividElement) {
1263
+ constructor(..._args) {
1264
+ super(..._args);
1265
+ this.rowType = DataGridRowTypes.default;
1266
+ this.rowData = null;
1267
+ this.columnDefinitions = null;
1268
+ this.behaviorOrchestrator = null;
1269
+ this.focusColumnIndex = 0;
1270
+ this.updateRowStyle = () => {
1271
+ this.style.gridTemplateColumns = this.gridTemplateColumns;
1272
+ };
1273
+ this.ariaSelected = null;
1274
+ this._selectable = false;
1275
+ this.selected = false;
1276
+ }
1277
+ /**
1278
+ * @internal
1279
+ */
1280
+ gridTemplateColumnsChanged() {
1281
+ if (this.$fastController.isConnected) this.updateRowStyle();
1282
+ }
1283
+ /**
1284
+ * @internal
1285
+ */
1286
+ rowTypeChanged() {
1287
+ if (this.$fastController.isConnected) this.updateItemTemplate();
1288
+ }
1289
+ /**
1290
+ * @internal
1291
+ */
1292
+ cellItemTemplateChanged() {
1293
+ this.updateItemTemplate();
1294
+ }
1295
+ /**
1296
+ * @internal
1297
+ */
1298
+ headerCellItemTemplateChanged() {
1299
+ this.updateItemTemplate();
1300
+ }
1301
+ /**
1302
+ * @internal
1303
+ */
1304
+ connectedCallback() {
1305
+ super.connectedCallback();
1306
+ /* v8 ignore else -- @preserve */
1307
+ if (this.behaviorOrchestrator === null) {
1308
+ this.updateItemTemplate();
1309
+ this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
1310
+ this.$fastController.addBehavior(this.behaviorOrchestrator);
1311
+ this.behaviorOrchestrator.addBehaviorFactory(new RepeatDirective(normalizeBinding((x) => x.columnDefinitions), normalizeBinding((x) => x.activeCellItemTemplate), { positioning: true }), this.appendChild(document.createComment("")));
1312
+ }
1313
+ this.addEventListener("cell-focused", this.handleCellFocus);
1314
+ this.addEventListener(eventFocusOut, this.handleFocusout);
1315
+ this.addEventListener(eventKeyDown, this.handleKeydown);
1316
+ this.updateRowStyle();
1317
+ }
1318
+ /**
1319
+ * @internal
1320
+ */
1321
+ disconnectedCallback() {
1322
+ super.disconnectedCallback();
1323
+ this.removeEventListener("cell-focused", this.handleCellFocus);
1324
+ this.removeEventListener(eventFocusOut, this.handleFocusout);
1325
+ this.removeEventListener(eventKeyDown, this.handleKeydown);
1326
+ }
1327
+ /**
1328
+ * @internal
1329
+ */
1330
+ handleFocusout(_) {
1331
+ /* v8 ignore else -- @preserve */
1332
+ if (!this.contains(document.activeElement)) this.focusColumnIndex = 0;
1333
+ }
1334
+ /**
1335
+ * @internal
1336
+ */
1337
+ handleCellFocus(e) {
1338
+ this.focusColumnIndex = this.cellElements.indexOf(e.target);
1339
+ this.$emit("row-focused", this);
1340
+ }
1341
+ /**
1342
+ * @internal
1343
+ */
1344
+ handleKeydown(e) {
1345
+ if (e.defaultPrevented) return;
1346
+ let newFocusColumnIndex = 0;
1347
+ switch (e.key) {
1348
+ case keyArrowLeft$1:
1349
+ newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
1350
+ this.cellElements[newFocusColumnIndex].focus();
1351
+ e.preventDefault();
1352
+ break;
1353
+ case keyArrowRight$1:
1354
+ newFocusColumnIndex = Math.min(this.cellElements.length - 1, this.focusColumnIndex + 1);
1355
+ this.cellElements[newFocusColumnIndex].focus();
1356
+ e.preventDefault();
1357
+ break;
1358
+ case keyHome:
1359
+ if (!e.ctrlKey) {
1360
+ this.cellElements[0].focus();
1361
+ e.preventDefault();
1362
+ }
1363
+ break;
1364
+ case keyEnd:
1365
+ if (!e.ctrlKey) {
1366
+ this.cellElements[this.cellElements.length - 1].focus();
1367
+ e.preventDefault();
1368
+ }
1369
+ break;
1370
+ }
1371
+ }
1372
+ updateItemTemplate() {
1373
+ this.activeCellItemTemplate = this.rowType === DataGridRowTypes.default && this.cellItemTemplate !== void 0 ? this.cellItemTemplate : this.rowType === DataGridRowTypes.default && this.cellItemTemplate === void 0 ? this.defaultCellItemTemplate : this.headerCellItemTemplate !== void 0 ? this.headerCellItemTemplate : this.defaultHeaderCellItemTemplate;
1374
+ }
1375
+ /**
1376
+ * @internal
1377
+ */
1378
+ ariaSelectedChanged(oldValue, newValue) {
1379
+ super.ariaSelectedChanged(oldValue, newValue);
1380
+ this._selectable = newValue !== null;
1381
+ this.selected = newValue === "true";
1382
+ }
1383
+ };
1384
+ __decorate([attr({ attribute: "grid-template-columns" })], DataGridRow.prototype, "gridTemplateColumns", void 0);
1385
+ __decorate([attr({ attribute: "row-type" })], DataGridRow.prototype, "rowType", void 0);
1386
+ __decorate([observable], DataGridRow.prototype, "rowData", void 0);
1387
+ __decorate([observable], DataGridRow.prototype, "columnDefinitions", void 0);
1388
+ __decorate([observable], DataGridRow.prototype, "cellItemTemplate", void 0);
1389
+ __decorate([observable], DataGridRow.prototype, "headerCellItemTemplate", void 0);
1390
+ __decorate([observable], DataGridRow.prototype, "rowIndex", void 0);
1391
+ __decorate([observable], DataGridRow.prototype, "activeCellItemTemplate", void 0);
1392
+ __decorate([observable], DataGridRow.prototype, "defaultCellItemTemplate", void 0);
1393
+ __decorate([observable], DataGridRow.prototype, "defaultHeaderCellItemTemplate", void 0);
1394
+ __decorate([observable], DataGridRow.prototype, "cellElements", void 0);
1395
+ __decorate([observable], DataGridRow.prototype, "_selectable", void 0);
1396
+ __decorate([attr({ mode: "boolean" })], DataGridRow.prototype, "selected", void 0);
1397
+ //#endregion
1640
1398
  //#region src/lib/data-grid/data-grid.template.ts
1641
1399
  function createRowItemTemplate(context) {
1642
1400
  const rowTag = context.tagFor(DataGridRow);
@@ -1688,6 +1446,248 @@ var DataGridTemplate = (context) => {
1688
1446
  `;
1689
1447
  };
1690
1448
  //#endregion
1449
+ //#region src/lib/data-grid/data-grid-cell.ts
1450
+ var defaultCellContentsTemplate = html`
1451
+ <template>
1452
+ ${(x) => x.rowData === null || x.columnDefinition === null || x.columnDefinition.columnDataKey === null ? null : x.rowData[x.columnDefinition.columnDataKey]}
1453
+ </template>
1454
+ `;
1455
+ var defaultHeaderCellContentsTemplate = html`
1456
+ <template>
1457
+ ${(x) => x.columnDefinition.title === void 0 ? x.columnDefinition.columnDataKey : x.columnDefinition.title}
1458
+ </template>
1459
+ `;
1460
+ /**
1461
+ * @public
1462
+ * @component data-grid-cell
1463
+ * @slot - Default slot.
1464
+ * @slot action-items - Add action items to the cell using this slot.
1465
+ * @event {CustomEvent<{columnDataKey: string, ariaSort: string | null, sortDirection: string | null}>} sort - Event that fires when a sortable column header is clicked
1466
+ * @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
1467
+ * @event {CustomEvent<HTMLElement>} cell-focused - Fires a custom 'cell-focused' event when focus is on the cell or its contents
1468
+ */
1469
+ var DataGridCell = class extends Localized(HostSemantics(VividElement)) {
1470
+ constructor(..._args) {
1471
+ super(..._args);
1472
+ this.cellType = DataGridCellTypes.default;
1473
+ this.rowData = null;
1474
+ this.columnDefinition = null;
1475
+ this.isActiveCell = false;
1476
+ this.customCellView = null;
1477
+ this.updateCellStyle = () => {
1478
+ if (this.gridColumn && !this.gridColumn.includes("undefined")) this.style.gridColumn = this.gridColumn;
1479
+ else this.style.removeProperty("grid-column");
1480
+ };
1481
+ this._selectable = false;
1482
+ this.selected = false;
1483
+ this.ariaSelected = null;
1484
+ this.ariaSort = null;
1485
+ }
1486
+ /**
1487
+ * @internal
1488
+ */
1489
+ cellTypeChanged() {
1490
+ if (this.$fastController.isConnected) this.updateCellView();
1491
+ }
1492
+ /**
1493
+ * @internal
1494
+ */
1495
+ gridColumnChanged() {
1496
+ if (this.$fastController.isConnected) this.updateCellStyle();
1497
+ }
1498
+ /**
1499
+ * @internal
1500
+ */
1501
+ columnDefinitionChanged(_oldValue, _newValue) {
1502
+ if (this.$fastController.isConnected) this.updateCellView();
1503
+ }
1504
+ /**
1505
+ * Updates the fixed column style
1506
+ * @internal
1507
+ */
1508
+ updateFixedStyle() {
1509
+ if (this.fixedPosition !== void 0) {
1510
+ this.setAttribute("data-fixed", "");
1511
+ this.style.left = this.fixedPosition;
1512
+ } else {
1513
+ this.removeAttribute("data-fixed");
1514
+ this.style.removeProperty("left");
1515
+ }
1516
+ }
1517
+ /**
1518
+ * Sets the fixed state and position for this cell
1519
+ * @internal
1520
+ */
1521
+ setFixedPosition(position) {
1522
+ this.fixedPosition = position;
1523
+ this.updateFixedStyle();
1524
+ }
1525
+ /**
1526
+ * @internal
1527
+ */
1528
+ connectedCallback() {
1529
+ super.connectedCallback();
1530
+ this.addEventListener(eventFocusIn, this.handleFocusin);
1531
+ this.addEventListener(eventFocusOut, this.handleFocusout);
1532
+ this.addEventListener(eventKeyDown, this.handleKeydown);
1533
+ this.style.gridColumn = `${this.columnDefinition?.gridColumn === void 0 ? 0 : this.columnDefinition.gridColumn}`;
1534
+ this.updateCellView();
1535
+ this.updateCellStyle();
1536
+ this.updateFixedStyle();
1537
+ }
1538
+ /**
1539
+ * @internal
1540
+ */
1541
+ disconnectedCallback() {
1542
+ super.disconnectedCallback();
1543
+ this.removeEventListener(eventFocusIn, this.handleFocusin);
1544
+ this.removeEventListener(eventFocusOut, this.handleFocusout);
1545
+ this.removeEventListener(eventKeyDown, this.handleKeydown);
1546
+ this.disconnectCellView();
1547
+ }
1548
+ /**
1549
+ * @internal
1550
+ */
1551
+ handleFocusin(_) {
1552
+ this.shadowRoot.querySelector(".base").classList.add("active");
1553
+ if (this.isActiveCell) return;
1554
+ this.isActiveCell = true;
1555
+ switch (this.cellType) {
1556
+ case DataGridCellTypes.columnHeader:
1557
+ if (this.columnDefinition !== null && this.columnDefinition.headerCellInternalFocusQueue !== true && typeof this.columnDefinition.headerCellFocusTargetCallback === "function") {
1558
+ const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
1559
+ /* v8 ignore else -- @preserve */
1560
+ if (focusTarget !== null) focusTarget.focus();
1561
+ }
1562
+ break;
1563
+ default:
1564
+ if (this.columnDefinition !== null && this.columnDefinition.cellInternalFocusQueue !== true && typeof this.columnDefinition.cellFocusTargetCallback === "function") {
1565
+ const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
1566
+ /* v8 ignore else -- @preserve */
1567
+ if (focusTarget !== null) focusTarget.focus();
1568
+ }
1569
+ break;
1570
+ }
1571
+ this.$emit("cell-focused", this);
1572
+ }
1573
+ /**
1574
+ * @internal
1575
+ */
1576
+ handleFocusout(_) {
1577
+ this.shadowRoot.querySelector(".base").classList.remove("active");
1578
+ /* v8 ignore else -- @preserve */
1579
+ if (this !== document.activeElement && !this.contains(document.activeElement)) this.isActiveCell = false;
1580
+ }
1581
+ /**
1582
+ * @internal
1583
+ */
1584
+ handleKeydown(e) {
1585
+ if (e.defaultPrevented || this.columnDefinition === null || this.cellType === DataGridCellTypes.default && this.columnDefinition.cellInternalFocusQueue !== true || this.cellType === DataGridCellTypes.columnHeader && this.columnDefinition.headerCellInternalFocusQueue !== true) return;
1586
+ switch (e.key) {
1587
+ case keyEnter:
1588
+ case keyFunction2:
1589
+ if (this.contains(document.activeElement) && document.activeElement !== this) return;
1590
+ switch (this.cellType) {
1591
+ case DataGridCellTypes.columnHeader:
1592
+ if (this.columnDefinition.headerCellFocusTargetCallback !== void 0) {
1593
+ const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
1594
+ /* v8 ignore else -- @preserve */
1595
+ if (focusTarget !== null) focusTarget.focus();
1596
+ e.preventDefault();
1597
+ }
1598
+ break;
1599
+ default:
1600
+ if (this.columnDefinition.cellFocusTargetCallback !== void 0) {
1601
+ const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
1602
+ /* v8 ignore else -- @preserve */
1603
+ if (focusTarget !== null) focusTarget.focus();
1604
+ e.preventDefault();
1605
+ }
1606
+ break;
1607
+ }
1608
+ break;
1609
+ case keyEscape:
1610
+ /* v8 ignore else -- @preserve */
1611
+ if (this.contains(document.activeElement) && document.activeElement !== this) {
1612
+ this.focus();
1613
+ e.preventDefault();
1614
+ }
1615
+ break;
1616
+ }
1617
+ }
1618
+ updateCellView() {
1619
+ this.disconnectCellView();
1620
+ if (this.columnDefinition === null) return;
1621
+ switch (this.cellType) {
1622
+ case DataGridCellTypes.columnHeader:
1623
+ if (this.columnDefinition.headerCellTemplate !== void 0) this.customCellView = this.columnDefinition.headerCellTemplate.render(this, this);
1624
+ else this.customCellView = defaultHeaderCellContentsTemplate.render(this, this);
1625
+ break;
1626
+ case DataGridCellTypes.rowHeader:
1627
+ case DataGridCellTypes.default:
1628
+ if (this.columnDefinition.cellTemplate !== void 0) this.customCellView = this.columnDefinition.cellTemplate.render(this, this);
1629
+ else this.customCellView = defaultCellContentsTemplate.render(this, this);
1630
+ break;
1631
+ }
1632
+ if (!this.columnDefinition?.sortable) this.sortDirection = void 0;
1633
+ else if (this.columnDefinition.sortDirection) this.sortDirection = this.columnDefinition.sortDirection;
1634
+ else this.sortDirection = DataGridCellSortStates.none;
1635
+ }
1636
+ disconnectCellView() {
1637
+ if (this.customCellView !== null) {
1638
+ this.customCellView.dispose();
1639
+ this.customCellView = null;
1640
+ }
1641
+ }
1642
+ /**
1643
+ * @internal
1644
+ */
1645
+ ariaSelectedChanged(prevValue, newValue) {
1646
+ super.ariaSelectedChanged(prevValue, newValue);
1647
+ this._selectable = newValue !== null;
1648
+ this.selected = newValue === "true";
1649
+ }
1650
+ /**
1651
+ * @internal
1652
+ */
1653
+ ariaSortChanged(oldValue, newValue) {
1654
+ super.ariaSortChanged(oldValue, newValue);
1655
+ if (newValue === null) {
1656
+ this.sortDirection = void 0;
1657
+ return;
1658
+ }
1659
+ this.sortDirection = newValue;
1660
+ }
1661
+ #getColumnDataKey() {
1662
+ return this.columnDefinition && this.columnDefinition.columnDataKey ? this.columnDefinition.columnDataKey : this.textContent.trim();
1663
+ }
1664
+ /**
1665
+ * @internal
1666
+ */
1667
+ _handleInteraction() {
1668
+ const isHeaderCell = this.cellType === "columnheader";
1669
+ if (isHeaderCell && this.sortDirection !== void 0) this.$emit("sort", {
1670
+ columnDataKey: this.#getColumnDataKey(),
1671
+ sortDirection: this.sortDirection
1672
+ });
1673
+ if (!(isHeaderCell ? this.columnDefinition?.headerCellInternalFocusQueue : this.columnDefinition?.cellInternalFocusQueue)) this.$emit("cell-click", {
1674
+ cell: this,
1675
+ row: this.parentElement,
1676
+ isHeaderCell,
1677
+ columnDataKey: this.#getColumnDataKey()
1678
+ });
1679
+ return true;
1680
+ }
1681
+ };
1682
+ __decorate([attr({ attribute: "cell-type" })], DataGridCell.prototype, "cellType", void 0);
1683
+ __decorate([attr({ attribute: "grid-column" })], DataGridCell.prototype, "gridColumn", void 0);
1684
+ __decorate([observable], DataGridCell.prototype, "rowData", void 0);
1685
+ __decorate([observable], DataGridCell.prototype, "columnDefinition", void 0);
1686
+ __decorate([observable], DataGridCell.prototype, "_selectable", void 0);
1687
+ __decorate([attr({ mode: "boolean" })], DataGridCell.prototype, "selected", void 0);
1688
+ __decorate([attr({ attribute: "sort-direction" })], DataGridCell.prototype, "sortDirection", void 0);
1689
+ __decorate([observable], DataGridCell.prototype, "_actionItemsSlottedContent", void 0);
1690
+ //#endregion
1691
1691
  //#region src/lib/data-grid/data-grid-row.template.ts
1692
1692
  function calculateAriaSelectedValue$1(x) {
1693
1693
  if (x._selectable && x.selected) return "true";
@@ -1863,4 +1863,4 @@ var dataGridDefinition = defineVividComponent("data-grid", DataGrid, DataGridTem
1863
1863
  */
1864
1864
  var registerDataGrid = createRegisterFunction(dataGridDefinition);
1865
1865
  //#endregion
1866
- export { DataGrid as a, registerDataGrid as i, dataGridDefinition as n, DataGridRow as o, dataGridRowDefinition as r, DataGridCell as s, dataGridCellDefinition as t };
1866
+ export { DataGridCell as a, registerDataGrid as i, dataGridDefinition as n, DataGridRow as o, dataGridRowDefinition as r, DataGrid as s, dataGridCellDefinition as t };