@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
@@ -592,12 +592,12 @@ var contextEvent = FAST.getById(KernelServiceId.contextEvent, () => {
592
592
  * Provides additional contextual information available to behaviors and expressions.
593
593
  * @public
594
594
  */
595
- var ExecutionContext$1 = Object.freeze({
595
+ var ExecutionContext = Object.freeze({
596
596
  default: {
597
597
  index: 0,
598
598
  length: 0,
599
599
  get event() {
600
- return ExecutionContext$1.getEvent();
600
+ return ExecutionContext.getEvent();
601
601
  },
602
602
  eventDetail() {
603
603
  return this.event.detail;
@@ -659,7 +659,7 @@ var ViewBehaviorOrchestrator = Object.freeze({ create(source) {
659
659
  let isConnected = false;
660
660
  return {
661
661
  source,
662
- context: ExecutionContext$1.default,
662
+ context: ExecutionContext.default,
663
663
  targets,
664
664
  get isBound() {
665
665
  return isConnected;
@@ -700,534 +700,148 @@ var ViewBehaviorOrchestrator = Object.freeze({ create(source) {
700
700
  };
701
701
  } });
702
702
  //#endregion
703
- //#region src/lib/data-grid/data-grid-cell.ts
704
- var defaultCellContentsTemplate = _microsoft_fast_element.html`
705
- <template>
706
- ${(x) => x.rowData === null || x.columnDefinition === null || x.columnDefinition.columnDataKey === null ? null : x.rowData[x.columnDefinition.columnDataKey]}
707
- </template>
708
- `;
709
- var defaultHeaderCellContentsTemplate = _microsoft_fast_element.html`
710
- <template>
711
- ${(x) => x.columnDefinition.title === void 0 ? x.columnDefinition.columnDataKey : x.columnDefinition.title}
712
- </template>
713
- `;
703
+ //#region src/lib/data-grid/data-grid.ts
704
+ var DataGridSelectionMode = {
705
+ none: "none",
706
+ singleRow: "single-row",
707
+ multiRow: "multi-row",
708
+ singleCell: "single-cell",
709
+ multiCell: "multi-cell"
710
+ };
714
711
  /**
715
712
  * @public
716
- * @component data-grid-cell
713
+ * @component data-grid
717
714
  * @slot - Default slot.
718
- * @slot action-items - Add action items to the cell using this slot.
719
- * @event {CustomEvent<{columnDataKey: string, ariaSort: string | null, sortDirection: string | null}>} sort - Event that fires when a sortable column header is clicked
720
715
  * @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
721
- * @event {CustomEvent<HTMLElement>} cell-focused - Fires a custom 'cell-focused' event when focus is on the cell or its contents
722
716
  */
723
- var DataGridCell = class extends require_localized.Localized(require_host_semantics.HostSemantics(require_vivid_element.VividElement)) {
724
- constructor(..._args) {
725
- super(..._args);
726
- this.cellType = require_data_grid_options.DataGridCellTypes.default;
727
- this.rowData = null;
728
- this.columnDefinition = null;
729
- this.isActiveCell = false;
730
- this.customCellView = null;
731
- this.updateCellStyle = () => {
732
- if (this.gridColumn && !this.gridColumn.includes("undefined")) this.style.gridColumn = this.gridColumn;
733
- else this.style.removeProperty("grid-column");
734
- };
735
- this._selectable = false;
736
- this.selected = false;
737
- this.ariaSelected = null;
738
- this.ariaSort = null;
739
- }
717
+ var DataGrid = class DataGrid extends require_vivid_element.VividElement {
740
718
  /**
741
- * @internal
719
+ * generates a gridTemplateColumns based on columndata array
742
720
  */
743
- cellTypeChanged() {
744
- if (this.$fastController.isConnected) this.updateCellView();
721
+ static generateTemplateColumns(columnDefinitions) {
722
+ let templateColumns = "";
723
+ columnDefinitions.forEach((_) => {
724
+ templateColumns = `${templateColumns}${templateColumns === "" ? "" : " "}1fr`;
725
+ });
726
+ return templateColumns;
745
727
  }
746
728
  /**
747
729
  * @internal
748
730
  */
749
- gridColumnChanged() {
750
- if (this.$fastController.isConnected) this.updateCellStyle();
731
+ noTabbingChanged() {
732
+ if (this.$fastController.isConnected) this.#setTabIndex();
733
+ }
734
+ #setTabIndex() {
735
+ this.setAttribute("tabIndex", this.noTabbing || this.contains(document.activeElement) ? "-1" : "0");
751
736
  }
752
737
  /**
753
738
  * @internal
754
739
  */
755
- columnDefinitionChanged(_oldValue, _newValue) {
756
- if (this.$fastController.isConnected) this.updateCellView();
740
+ generateHeaderChanged() {
741
+ if (this.$fastController.isConnected) this.toggleGeneratedHeader();
757
742
  }
758
743
  /**
759
- * Updates the fixed column style
760
744
  * @internal
761
745
  */
762
- updateFixedStyle() {
763
- if (this.fixedPosition !== void 0) {
764
- this.setAttribute("data-fixed", "");
765
- this.style.left = this.fixedPosition;
766
- } else {
767
- this.removeAttribute("data-fixed");
768
- this.style.removeProperty("left");
746
+ gridTemplateColumnsChanged() {
747
+ /* v8 ignore if -- @preserve */
748
+ if (this.$fastController.isConnected) {
749
+ this.updateRowIndexes();
750
+ if (this.fixedColumns && this.fixedColumns > 0) this.applyFixedColumns();
769
751
  }
770
752
  }
771
753
  /**
772
- * Sets the fixed state and position for this cell
773
754
  * @internal
774
755
  */
775
- setFixedPosition(position) {
776
- this.fixedPosition = position;
777
- this.updateFixedStyle();
756
+ rowsDataChanged() {
757
+ if (this.columnDefinitions === null && this.rowsData.length > 0) this.columnDefinitions = DataGrid.generateColumns(this.rowsData[0]);
758
+ if (this.$fastController.isConnected) this.toggleGeneratedHeader();
778
759
  }
779
760
  /**
780
761
  * @internal
781
762
  */
782
- connectedCallback() {
783
- super.connectedCallback();
784
- this.addEventListener(_microsoft_fast_web_utilities.eventFocusIn, this.handleFocusin);
785
- this.addEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusout);
786
- this.addEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
787
- this.style.gridColumn = `${this.columnDefinition?.gridColumn === void 0 ? 0 : this.columnDefinition.gridColumn}`;
788
- this.updateCellView();
789
- this.updateCellStyle();
790
- this.updateFixedStyle();
763
+ columnDefinitionsChanged() {
764
+ if (this.columnDefinitions === null) {
765
+ this.generatedGridTemplateColumns = "";
766
+ return;
767
+ }
768
+ this.generatedGridTemplateColumns = DataGrid.generateTemplateColumns(this.columnDefinitions);
769
+ /* v8 ignore if -- @preserve */
770
+ if (this.$fastController.isConnected) {
771
+ this.columnDefinitionsStale = true;
772
+ this.queueRowIndexUpdate();
773
+ }
791
774
  }
792
775
  /**
793
776
  * @internal
794
777
  */
795
- disconnectedCallback() {
796
- super.disconnectedCallback();
797
- this.removeEventListener(_microsoft_fast_web_utilities.eventFocusIn, this.handleFocusin);
798
- this.removeEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusout);
799
- this.removeEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
800
- this.disconnectCellView();
778
+ headerCellItemTemplateChanged() {
779
+ /* v8 ignore if -- @preserve */
780
+ if (this.$fastController.isConnected) {
781
+ if (this.generatedHeader !== null) this.generatedHeader.headerCellItemTemplate = this.headerCellItemTemplate;
782
+ }
801
783
  }
802
784
  /**
803
785
  * @internal
804
786
  */
805
- handleFocusin(_) {
806
- this.shadowRoot.querySelector(".base").classList.add("active");
807
- if (this.isActiveCell) return;
808
- this.isActiveCell = true;
809
- switch (this.cellType) {
810
- case require_data_grid_options.DataGridCellTypes.columnHeader:
811
- if (this.columnDefinition !== null && this.columnDefinition.headerCellInternalFocusQueue !== true && typeof this.columnDefinition.headerCellFocusTargetCallback === "function") {
812
- const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
813
- /* v8 ignore else -- @preserve */
814
- if (focusTarget !== null) focusTarget.focus();
815
- }
816
- break;
817
- default:
818
- if (this.columnDefinition !== null && this.columnDefinition.cellInternalFocusQueue !== true && typeof this.columnDefinition.cellFocusTargetCallback === "function") {
819
- const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
820
- /* v8 ignore else -- @preserve */
821
- if (focusTarget !== null) focusTarget.focus();
822
- }
823
- break;
824
- }
825
- this.$emit("cell-focused", this);
787
+ focusRowIndexChanged() {
788
+ if (this.$fastController.isConnected) this.queueFocusUpdate();
826
789
  }
827
790
  /**
828
791
  * @internal
829
792
  */
830
- handleFocusout(_) {
831
- this.shadowRoot.querySelector(".base").classList.remove("active");
832
- /* v8 ignore else -- @preserve */
833
- if (this !== document.activeElement && !this.contains(document.activeElement)) this.isActiveCell = false;
793
+ focusColumnIndexChanged() {
794
+ if (this.$fastController.isConnected) this.queueFocusUpdate();
834
795
  }
835
796
  /**
836
797
  * @internal
837
798
  */
838
- handleKeydown(e) {
839
- if (e.defaultPrevented || this.columnDefinition === null || this.cellType === require_data_grid_options.DataGridCellTypes.default && this.columnDefinition.cellInternalFocusQueue !== true || this.cellType === require_data_grid_options.DataGridCellTypes.columnHeader && this.columnDefinition.headerCellInternalFocusQueue !== true) return;
840
- switch (e.key) {
841
- case _microsoft_fast_web_utilities.keyEnter:
842
- case _microsoft_fast_web_utilities.keyFunction2:
843
- if (this.contains(document.activeElement) && document.activeElement !== this) return;
844
- switch (this.cellType) {
845
- case require_data_grid_options.DataGridCellTypes.columnHeader:
846
- if (this.columnDefinition.headerCellFocusTargetCallback !== void 0) {
847
- const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
848
- /* v8 ignore else -- @preserve */
849
- if (focusTarget !== null) focusTarget.focus();
850
- e.preventDefault();
851
- }
852
- break;
853
- default:
854
- if (this.columnDefinition.cellFocusTargetCallback !== void 0) {
855
- const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
856
- /* v8 ignore else -- @preserve */
857
- if (focusTarget !== null) focusTarget.focus();
858
- e.preventDefault();
859
- }
860
- break;
861
- }
862
- break;
863
- case _microsoft_fast_web_utilities.keyEscape:
864
- /* v8 ignore else -- @preserve */
865
- if (this.contains(document.activeElement) && document.activeElement !== this) {
866
- this.focus();
867
- e.preventDefault();
868
- }
869
- break;
870
- }
871
- }
872
- updateCellView() {
873
- this.disconnectCellView();
874
- if (this.columnDefinition === null) return;
875
- switch (this.cellType) {
876
- case require_data_grid_options.DataGridCellTypes.columnHeader:
877
- if (this.columnDefinition.headerCellTemplate !== void 0) this.customCellView = this.columnDefinition.headerCellTemplate.render(this, this);
878
- else this.customCellView = defaultHeaderCellContentsTemplate.render(this, this);
879
- break;
880
- case require_data_grid_options.DataGridCellTypes.rowHeader:
881
- case require_data_grid_options.DataGridCellTypes.default:
882
- if (this.columnDefinition.cellTemplate !== void 0) this.customCellView = this.columnDefinition.cellTemplate.render(this, this);
883
- else this.customCellView = defaultCellContentsTemplate.render(this, this);
884
- break;
885
- }
886
- if (!this.columnDefinition?.sortable) this.sortDirection = void 0;
887
- else if (this.columnDefinition.sortDirection) this.sortDirection = this.columnDefinition.sortDirection;
888
- else this.sortDirection = require_data_grid_options.DataGridCellSortStates.none;
889
- }
890
- disconnectCellView() {
891
- if (this.customCellView !== null) {
892
- this.customCellView.dispose();
893
- this.customCellView = null;
799
+ fixedColumnsChanged() {
800
+ /* v8 ignore if -- @preserve */
801
+ if (this.$fastController.isConnected) {
802
+ this.applyFixedColumns();
803
+ this.setupResizeObserver();
894
804
  }
895
805
  }
896
806
  /**
897
807
  * @internal
898
808
  */
899
- ariaSelectedChanged(prevValue, newValue) {
900
- super.ariaSelectedChanged(prevValue, newValue);
901
- this._selectable = newValue !== null;
902
- this.selected = newValue === "true";
809
+ setupResizeObserver() {
810
+ if (this.resizeObserver) {
811
+ this.resizeObserver.disconnect();
812
+ this.resizeObserver = void 0;
813
+ }
814
+ if (typeof ResizeObserver !== "undefined" && this.fixedColumns && this.fixedColumns > 0) {
815
+ this.resizeObserver = new ResizeObserver(() => {
816
+ this.applyFixedColumns();
817
+ });
818
+ this.resizeObserver.observe(this);
819
+ }
903
820
  }
904
821
  /**
905
822
  * @internal
906
823
  */
907
- ariaSortChanged(oldValue, newValue) {
908
- super.ariaSortChanged(oldValue, newValue);
909
- if (newValue === null) {
910
- this.sortDirection = void 0;
911
- return;
824
+ connectedCallback() {
825
+ super.connectedCallback();
826
+ /* v8 ignore else -- @preserve */
827
+ if (this.rowItemTemplate === void 0) this.rowItemTemplate = this.defaultRowItemTemplate;
828
+ /* v8 ignore else -- @preserve */
829
+ if (this.behaviorOrchestrator === null) {
830
+ this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
831
+ this.$fastController.addBehavior(this.behaviorOrchestrator);
832
+ this.behaviorOrchestrator.addBehaviorFactory(new _microsoft_fast_element.RepeatDirective((0, _microsoft_fast_element.normalizeBinding)((x) => x.rowsData), (0, _microsoft_fast_element.normalizeBinding)((x) => x.rowItemTemplate), { positioning: true }), this.appendChild(document.createComment("")));
912
833
  }
913
- this.sortDirection = newValue;
914
- }
915
- #getColumnDataKey() {
916
- return this.columnDefinition && this.columnDefinition.columnDataKey ? this.columnDefinition.columnDataKey : this.textContent.trim();
917
- }
918
- /**
919
- * @internal
920
- */
921
- _handleInteraction() {
922
- const isHeaderCell = this.cellType === "columnheader";
923
- if (isHeaderCell && this.sortDirection !== void 0) this.$emit("sort", {
924
- columnDataKey: this.#getColumnDataKey(),
925
- sortDirection: this.sortDirection
926
- });
927
- if (!(isHeaderCell ? this.columnDefinition?.headerCellInternalFocusQueue : this.columnDefinition?.cellInternalFocusQueue)) this.$emit("cell-click", {
928
- cell: this,
929
- row: this.parentElement,
930
- isHeaderCell,
931
- columnDataKey: this.#getColumnDataKey()
932
- });
933
- return true;
934
- }
935
- };
936
- require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "cell-type" })], DataGridCell.prototype, "cellType", void 0);
937
- require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "grid-column" })], DataGridCell.prototype, "gridColumn", void 0);
938
- require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "rowData", void 0);
939
- require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "columnDefinition", void 0);
940
- require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "_selectable", void 0);
941
- require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], DataGridCell.prototype, "selected", void 0);
942
- require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "sort-direction" })], DataGridCell.prototype, "sortDirection", void 0);
943
- require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "_actionItemsSlottedContent", void 0);
944
- //#endregion
945
- //#region src/lib/data-grid/data-grid-row.ts
946
- /**
947
- * @public
948
- * @component data-grid-row
949
- * @slot - Default slot.
950
- * @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
951
- * @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
952
- */
953
- var DataGridRow = class extends require_host_semantics.HostSemantics(require_vivid_element.VividElement) {
954
- constructor(..._args) {
955
- super(..._args);
956
- this.rowType = require_data_grid_options.DataGridRowTypes.default;
957
- this.rowData = null;
958
- this.columnDefinitions = null;
959
- this.behaviorOrchestrator = null;
960
- this.focusColumnIndex = 0;
961
- this.updateRowStyle = () => {
962
- this.style.gridTemplateColumns = this.gridTemplateColumns;
963
- };
964
- this.ariaSelected = null;
965
- this._selectable = false;
966
- this.selected = false;
967
- }
968
- /**
969
- * @internal
970
- */
971
- gridTemplateColumnsChanged() {
972
- if (this.$fastController.isConnected) this.updateRowStyle();
973
- }
974
- /**
975
- * @internal
976
- */
977
- rowTypeChanged() {
978
- if (this.$fastController.isConnected) this.updateItemTemplate();
979
- }
980
- /**
981
- * @internal
982
- */
983
- cellItemTemplateChanged() {
984
- this.updateItemTemplate();
985
- }
986
- /**
987
- * @internal
988
- */
989
- headerCellItemTemplateChanged() {
990
- this.updateItemTemplate();
991
- }
992
- /**
993
- * @internal
994
- */
995
- connectedCallback() {
996
- super.connectedCallback();
997
- /* v8 ignore else -- @preserve */
998
- if (this.behaviorOrchestrator === null) {
999
- this.updateItemTemplate();
1000
- this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
1001
- this.$fastController.addBehavior(this.behaviorOrchestrator);
1002
- this.behaviorOrchestrator.addBehaviorFactory(new _microsoft_fast_element.RepeatDirective((0, _microsoft_fast_element.normalizeBinding)((x) => x.columnDefinitions), (0, _microsoft_fast_element.normalizeBinding)((x) => x.activeCellItemTemplate), { positioning: true }), this.appendChild(document.createComment("")));
1003
- }
1004
- this.addEventListener("cell-focused", this.handleCellFocus);
1005
- this.addEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusout);
1006
- this.addEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
1007
- this.updateRowStyle();
1008
- }
1009
- /**
1010
- * @internal
1011
- */
1012
- disconnectedCallback() {
1013
- super.disconnectedCallback();
1014
- this.removeEventListener("cell-focused", this.handleCellFocus);
1015
- this.removeEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusout);
1016
- this.removeEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
1017
- }
1018
- /**
1019
- * @internal
1020
- */
1021
- handleFocusout(_) {
1022
- /* v8 ignore else -- @preserve */
1023
- if (!this.contains(document.activeElement)) this.focusColumnIndex = 0;
1024
- }
1025
- /**
1026
- * @internal
1027
- */
1028
- handleCellFocus(e) {
1029
- this.focusColumnIndex = this.cellElements.indexOf(e.target);
1030
- this.$emit("row-focused", this);
1031
- }
1032
- /**
1033
- * @internal
1034
- */
1035
- handleKeydown(e) {
1036
- if (e.defaultPrevented) return;
1037
- let newFocusColumnIndex = 0;
1038
- switch (e.key) {
1039
- case require_key_codes.keyArrowLeft:
1040
- newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
1041
- this.cellElements[newFocusColumnIndex].focus();
1042
- e.preventDefault();
1043
- break;
1044
- case require_key_codes.keyArrowRight:
1045
- newFocusColumnIndex = Math.min(this.cellElements.length - 1, this.focusColumnIndex + 1);
1046
- this.cellElements[newFocusColumnIndex].focus();
1047
- e.preventDefault();
1048
- break;
1049
- case _microsoft_fast_web_utilities.keyHome:
1050
- if (!e.ctrlKey) {
1051
- this.cellElements[0].focus();
1052
- e.preventDefault();
1053
- }
1054
- break;
1055
- case _microsoft_fast_web_utilities.keyEnd:
1056
- if (!e.ctrlKey) {
1057
- this.cellElements[this.cellElements.length - 1].focus();
1058
- e.preventDefault();
1059
- }
1060
- break;
1061
- }
1062
- }
1063
- updateItemTemplate() {
1064
- this.activeCellItemTemplate = this.rowType === require_data_grid_options.DataGridRowTypes.default && this.cellItemTemplate !== void 0 ? this.cellItemTemplate : this.rowType === require_data_grid_options.DataGridRowTypes.default && this.cellItemTemplate === void 0 ? this.defaultCellItemTemplate : this.headerCellItemTemplate !== void 0 ? this.headerCellItemTemplate : this.defaultHeaderCellItemTemplate;
1065
- }
1066
- /**
1067
- * @internal
1068
- */
1069
- ariaSelectedChanged(oldValue, newValue) {
1070
- super.ariaSelectedChanged(oldValue, newValue);
1071
- this._selectable = newValue !== null;
1072
- this.selected = newValue === "true";
1073
- }
1074
- };
1075
- require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "grid-template-columns" })], DataGridRow.prototype, "gridTemplateColumns", void 0);
1076
- require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "row-type" })], DataGridRow.prototype, "rowType", void 0);
1077
- require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "rowData", void 0);
1078
- require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "columnDefinitions", void 0);
1079
- require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "cellItemTemplate", void 0);
1080
- require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "headerCellItemTemplate", void 0);
1081
- require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "rowIndex", void 0);
1082
- require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "activeCellItemTemplate", void 0);
1083
- require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "defaultCellItemTemplate", void 0);
1084
- require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "defaultHeaderCellItemTemplate", void 0);
1085
- require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "cellElements", void 0);
1086
- require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "_selectable", void 0);
1087
- require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], DataGridRow.prototype, "selected", void 0);
1088
- //#endregion
1089
- //#region src/lib/data-grid/data-grid.ts
1090
- var DataGridSelectionMode = {
1091
- none: "none",
1092
- singleRow: "single-row",
1093
- multiRow: "multi-row",
1094
- singleCell: "single-cell",
1095
- multiCell: "multi-cell"
1096
- };
1097
- /**
1098
- * @public
1099
- * @component data-grid
1100
- * @slot - Default slot.
1101
- * @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
1102
- */
1103
- var DataGrid = class DataGrid extends require_vivid_element.VividElement {
1104
- /**
1105
- * generates a gridTemplateColumns based on columndata array
1106
- */
1107
- static generateTemplateColumns(columnDefinitions) {
1108
- let templateColumns = "";
1109
- columnDefinitions.forEach((_) => {
1110
- templateColumns = `${templateColumns}${templateColumns === "" ? "" : " "}1fr`;
1111
- });
1112
- return templateColumns;
1113
- }
1114
- /**
1115
- * @internal
1116
- */
1117
- noTabbingChanged() {
1118
- if (this.$fastController.isConnected) this.#setTabIndex();
1119
- }
1120
- #setTabIndex() {
1121
- this.setAttribute("tabIndex", this.noTabbing || this.contains(document.activeElement) ? "-1" : "0");
1122
- }
1123
- /**
1124
- * @internal
1125
- */
1126
- generateHeaderChanged() {
1127
- if (this.$fastController.isConnected) this.toggleGeneratedHeader();
1128
- }
1129
- /**
1130
- * @internal
1131
- */
1132
- gridTemplateColumnsChanged() {
1133
- /* v8 ignore if -- @preserve */
1134
- if (this.$fastController.isConnected) {
1135
- this.updateRowIndexes();
1136
- if (this.fixedColumns && this.fixedColumns > 0) this.applyFixedColumns();
1137
- }
1138
- }
1139
- /**
1140
- * @internal
1141
- */
1142
- rowsDataChanged() {
1143
- if (this.columnDefinitions === null && this.rowsData.length > 0) this.columnDefinitions = DataGrid.generateColumns(this.rowsData[0]);
1144
- if (this.$fastController.isConnected) this.toggleGeneratedHeader();
1145
- }
1146
- /**
1147
- * @internal
1148
- */
1149
- columnDefinitionsChanged() {
1150
- if (this.columnDefinitions === null) {
1151
- this.generatedGridTemplateColumns = "";
1152
- return;
1153
- }
1154
- this.generatedGridTemplateColumns = DataGrid.generateTemplateColumns(this.columnDefinitions);
1155
- /* v8 ignore if -- @preserve */
1156
- if (this.$fastController.isConnected) {
1157
- this.columnDefinitionsStale = true;
1158
- this.queueRowIndexUpdate();
1159
- }
1160
- }
1161
- /**
1162
- * @internal
1163
- */
1164
- headerCellItemTemplateChanged() {
1165
- /* v8 ignore if -- @preserve */
1166
- if (this.$fastController.isConnected) {
1167
- if (this.generatedHeader !== null) this.generatedHeader.headerCellItemTemplate = this.headerCellItemTemplate;
1168
- }
1169
- }
1170
- /**
1171
- * @internal
1172
- */
1173
- focusRowIndexChanged() {
1174
- if (this.$fastController.isConnected) this.queueFocusUpdate();
1175
- }
1176
- /**
1177
- * @internal
1178
- */
1179
- focusColumnIndexChanged() {
1180
- if (this.$fastController.isConnected) this.queueFocusUpdate();
1181
- }
1182
- /**
1183
- * @internal
1184
- */
1185
- fixedColumnsChanged() {
1186
- /* v8 ignore if -- @preserve */
1187
- if (this.$fastController.isConnected) {
1188
- this.applyFixedColumns();
1189
- this.setupResizeObserver();
1190
- }
1191
- }
1192
- /**
1193
- * @internal
1194
- */
1195
- setupResizeObserver() {
1196
- if (this.resizeObserver) {
1197
- this.resizeObserver.disconnect();
1198
- this.resizeObserver = void 0;
1199
- }
1200
- if (typeof ResizeObserver !== "undefined" && this.fixedColumns && this.fixedColumns > 0) {
1201
- this.resizeObserver = new ResizeObserver(() => {
1202
- this.applyFixedColumns();
1203
- });
1204
- this.resizeObserver.observe(this);
1205
- }
1206
- }
1207
- /**
1208
- * @internal
1209
- */
1210
- connectedCallback() {
1211
- super.connectedCallback();
1212
- /* v8 ignore else -- @preserve */
1213
- if (this.rowItemTemplate === void 0) this.rowItemTemplate = this.defaultRowItemTemplate;
1214
- /* v8 ignore else -- @preserve */
1215
- if (this.behaviorOrchestrator === null) {
1216
- this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
1217
- this.$fastController.addBehavior(this.behaviorOrchestrator);
1218
- this.behaviorOrchestrator.addBehaviorFactory(new _microsoft_fast_element.RepeatDirective((0, _microsoft_fast_element.normalizeBinding)((x) => x.rowsData), (0, _microsoft_fast_element.normalizeBinding)((x) => x.rowItemTemplate), { positioning: true }), this.appendChild(document.createComment("")));
1219
- }
1220
- this.toggleGeneratedHeader();
1221
- this.addEventListener("row-focused", this.handleRowFocus);
1222
- this.addEventListener(_microsoft_fast_web_utilities.eventFocus, this.handleFocus);
1223
- this.addEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
1224
- this.addEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusOut);
1225
- this.observer = new MutationObserver(this.onChildListChange);
1226
- this.observer.observe(this, { childList: true });
1227
- this.setupResizeObserver();
1228
- _microsoft_fast_element.Updates.enqueue(this.queueRowIndexUpdate);
1229
- this.#setTabIndex();
1230
- _microsoft_fast_element.Observable.getNotifier(this).subscribe(this.#changeHandler, "columnDefinitions");
834
+ this.toggleGeneratedHeader();
835
+ this.addEventListener("row-focused", this.handleRowFocus);
836
+ this.addEventListener(_microsoft_fast_web_utilities.eventFocus, this.handleFocus);
837
+ this.addEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
838
+ this.addEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusOut);
839
+ this.observer = new MutationObserver(this.onChildListChange);
840
+ this.observer.observe(this, { childList: true });
841
+ this.setupResizeObserver();
842
+ _microsoft_fast_element.Updates.enqueue(this.queueRowIndexUpdate);
843
+ this.#setTabIndex();
844
+ _microsoft_fast_element.Observable.getNotifier(this).subscribe(this.#changeHandler, "columnDefinitions");
1231
845
  }
1232
846
  /**
1233
847
  * @internal
@@ -1638,6 +1252,150 @@ require_decorate.__decorate([_microsoft_fast_element.observable], DataGrid.proto
1638
1252
  require_decorate.__decorate([_microsoft_fast_element.observable], DataGrid.prototype, "slottedRowElements", void 0);
1639
1253
  require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "selection-mode" })], DataGrid.prototype, "selectionMode", void 0);
1640
1254
  //#endregion
1255
+ //#region src/lib/data-grid/data-grid-row.ts
1256
+ /**
1257
+ * @public
1258
+ * @component data-grid-row
1259
+ * @slot - Default slot.
1260
+ * @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
1261
+ * @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
1262
+ */
1263
+ var DataGridRow = class extends require_host_semantics.HostSemantics(require_vivid_element.VividElement) {
1264
+ constructor(..._args) {
1265
+ super(..._args);
1266
+ this.rowType = require_data_grid_options.DataGridRowTypes.default;
1267
+ this.rowData = null;
1268
+ this.columnDefinitions = null;
1269
+ this.behaviorOrchestrator = null;
1270
+ this.focusColumnIndex = 0;
1271
+ this.updateRowStyle = () => {
1272
+ this.style.gridTemplateColumns = this.gridTemplateColumns;
1273
+ };
1274
+ this.ariaSelected = null;
1275
+ this._selectable = false;
1276
+ this.selected = false;
1277
+ }
1278
+ /**
1279
+ * @internal
1280
+ */
1281
+ gridTemplateColumnsChanged() {
1282
+ if (this.$fastController.isConnected) this.updateRowStyle();
1283
+ }
1284
+ /**
1285
+ * @internal
1286
+ */
1287
+ rowTypeChanged() {
1288
+ if (this.$fastController.isConnected) this.updateItemTemplate();
1289
+ }
1290
+ /**
1291
+ * @internal
1292
+ */
1293
+ cellItemTemplateChanged() {
1294
+ this.updateItemTemplate();
1295
+ }
1296
+ /**
1297
+ * @internal
1298
+ */
1299
+ headerCellItemTemplateChanged() {
1300
+ this.updateItemTemplate();
1301
+ }
1302
+ /**
1303
+ * @internal
1304
+ */
1305
+ connectedCallback() {
1306
+ super.connectedCallback();
1307
+ /* v8 ignore else -- @preserve */
1308
+ if (this.behaviorOrchestrator === null) {
1309
+ this.updateItemTemplate();
1310
+ this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
1311
+ this.$fastController.addBehavior(this.behaviorOrchestrator);
1312
+ this.behaviorOrchestrator.addBehaviorFactory(new _microsoft_fast_element.RepeatDirective((0, _microsoft_fast_element.normalizeBinding)((x) => x.columnDefinitions), (0, _microsoft_fast_element.normalizeBinding)((x) => x.activeCellItemTemplate), { positioning: true }), this.appendChild(document.createComment("")));
1313
+ }
1314
+ this.addEventListener("cell-focused", this.handleCellFocus);
1315
+ this.addEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusout);
1316
+ this.addEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
1317
+ this.updateRowStyle();
1318
+ }
1319
+ /**
1320
+ * @internal
1321
+ */
1322
+ disconnectedCallback() {
1323
+ super.disconnectedCallback();
1324
+ this.removeEventListener("cell-focused", this.handleCellFocus);
1325
+ this.removeEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusout);
1326
+ this.removeEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
1327
+ }
1328
+ /**
1329
+ * @internal
1330
+ */
1331
+ handleFocusout(_) {
1332
+ /* v8 ignore else -- @preserve */
1333
+ if (!this.contains(document.activeElement)) this.focusColumnIndex = 0;
1334
+ }
1335
+ /**
1336
+ * @internal
1337
+ */
1338
+ handleCellFocus(e) {
1339
+ this.focusColumnIndex = this.cellElements.indexOf(e.target);
1340
+ this.$emit("row-focused", this);
1341
+ }
1342
+ /**
1343
+ * @internal
1344
+ */
1345
+ handleKeydown(e) {
1346
+ if (e.defaultPrevented) return;
1347
+ let newFocusColumnIndex = 0;
1348
+ switch (e.key) {
1349
+ case require_key_codes.keyArrowLeft:
1350
+ newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
1351
+ this.cellElements[newFocusColumnIndex].focus();
1352
+ e.preventDefault();
1353
+ break;
1354
+ case require_key_codes.keyArrowRight:
1355
+ newFocusColumnIndex = Math.min(this.cellElements.length - 1, this.focusColumnIndex + 1);
1356
+ this.cellElements[newFocusColumnIndex].focus();
1357
+ e.preventDefault();
1358
+ break;
1359
+ case _microsoft_fast_web_utilities.keyHome:
1360
+ if (!e.ctrlKey) {
1361
+ this.cellElements[0].focus();
1362
+ e.preventDefault();
1363
+ }
1364
+ break;
1365
+ case _microsoft_fast_web_utilities.keyEnd:
1366
+ if (!e.ctrlKey) {
1367
+ this.cellElements[this.cellElements.length - 1].focus();
1368
+ e.preventDefault();
1369
+ }
1370
+ break;
1371
+ }
1372
+ }
1373
+ updateItemTemplate() {
1374
+ this.activeCellItemTemplate = this.rowType === require_data_grid_options.DataGridRowTypes.default && this.cellItemTemplate !== void 0 ? this.cellItemTemplate : this.rowType === require_data_grid_options.DataGridRowTypes.default && this.cellItemTemplate === void 0 ? this.defaultCellItemTemplate : this.headerCellItemTemplate !== void 0 ? this.headerCellItemTemplate : this.defaultHeaderCellItemTemplate;
1375
+ }
1376
+ /**
1377
+ * @internal
1378
+ */
1379
+ ariaSelectedChanged(oldValue, newValue) {
1380
+ super.ariaSelectedChanged(oldValue, newValue);
1381
+ this._selectable = newValue !== null;
1382
+ this.selected = newValue === "true";
1383
+ }
1384
+ };
1385
+ require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "grid-template-columns" })], DataGridRow.prototype, "gridTemplateColumns", void 0);
1386
+ require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "row-type" })], DataGridRow.prototype, "rowType", void 0);
1387
+ require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "rowData", void 0);
1388
+ require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "columnDefinitions", void 0);
1389
+ require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "cellItemTemplate", void 0);
1390
+ require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "headerCellItemTemplate", void 0);
1391
+ require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "rowIndex", void 0);
1392
+ require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "activeCellItemTemplate", void 0);
1393
+ require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "defaultCellItemTemplate", void 0);
1394
+ require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "defaultHeaderCellItemTemplate", void 0);
1395
+ require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "cellElements", void 0);
1396
+ require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "_selectable", void 0);
1397
+ require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], DataGridRow.prototype, "selected", void 0);
1398
+ //#endregion
1641
1399
  //#region src/lib/data-grid/data-grid.template.ts
1642
1400
  function createRowItemTemplate(context) {
1643
1401
  const rowTag = context.tagFor(DataGridRow);
@@ -1689,6 +1447,248 @@ var DataGridTemplate = (context) => {
1689
1447
  `;
1690
1448
  };
1691
1449
  //#endregion
1450
+ //#region src/lib/data-grid/data-grid-cell.ts
1451
+ var defaultCellContentsTemplate = _microsoft_fast_element.html`
1452
+ <template>
1453
+ ${(x) => x.rowData === null || x.columnDefinition === null || x.columnDefinition.columnDataKey === null ? null : x.rowData[x.columnDefinition.columnDataKey]}
1454
+ </template>
1455
+ `;
1456
+ var defaultHeaderCellContentsTemplate = _microsoft_fast_element.html`
1457
+ <template>
1458
+ ${(x) => x.columnDefinition.title === void 0 ? x.columnDefinition.columnDataKey : x.columnDefinition.title}
1459
+ </template>
1460
+ `;
1461
+ /**
1462
+ * @public
1463
+ * @component data-grid-cell
1464
+ * @slot - Default slot.
1465
+ * @slot action-items - Add action items to the cell using this slot.
1466
+ * @event {CustomEvent<{columnDataKey: string, ariaSort: string | null, sortDirection: string | null}>} sort - Event that fires when a sortable column header is clicked
1467
+ * @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
1468
+ * @event {CustomEvent<HTMLElement>} cell-focused - Fires a custom 'cell-focused' event when focus is on the cell or its contents
1469
+ */
1470
+ var DataGridCell = class extends require_localized.Localized(require_host_semantics.HostSemantics(require_vivid_element.VividElement)) {
1471
+ constructor(..._args) {
1472
+ super(..._args);
1473
+ this.cellType = require_data_grid_options.DataGridCellTypes.default;
1474
+ this.rowData = null;
1475
+ this.columnDefinition = null;
1476
+ this.isActiveCell = false;
1477
+ this.customCellView = null;
1478
+ this.updateCellStyle = () => {
1479
+ if (this.gridColumn && !this.gridColumn.includes("undefined")) this.style.gridColumn = this.gridColumn;
1480
+ else this.style.removeProperty("grid-column");
1481
+ };
1482
+ this._selectable = false;
1483
+ this.selected = false;
1484
+ this.ariaSelected = null;
1485
+ this.ariaSort = null;
1486
+ }
1487
+ /**
1488
+ * @internal
1489
+ */
1490
+ cellTypeChanged() {
1491
+ if (this.$fastController.isConnected) this.updateCellView();
1492
+ }
1493
+ /**
1494
+ * @internal
1495
+ */
1496
+ gridColumnChanged() {
1497
+ if (this.$fastController.isConnected) this.updateCellStyle();
1498
+ }
1499
+ /**
1500
+ * @internal
1501
+ */
1502
+ columnDefinitionChanged(_oldValue, _newValue) {
1503
+ if (this.$fastController.isConnected) this.updateCellView();
1504
+ }
1505
+ /**
1506
+ * Updates the fixed column style
1507
+ * @internal
1508
+ */
1509
+ updateFixedStyle() {
1510
+ if (this.fixedPosition !== void 0) {
1511
+ this.setAttribute("data-fixed", "");
1512
+ this.style.left = this.fixedPosition;
1513
+ } else {
1514
+ this.removeAttribute("data-fixed");
1515
+ this.style.removeProperty("left");
1516
+ }
1517
+ }
1518
+ /**
1519
+ * Sets the fixed state and position for this cell
1520
+ * @internal
1521
+ */
1522
+ setFixedPosition(position) {
1523
+ this.fixedPosition = position;
1524
+ this.updateFixedStyle();
1525
+ }
1526
+ /**
1527
+ * @internal
1528
+ */
1529
+ connectedCallback() {
1530
+ super.connectedCallback();
1531
+ this.addEventListener(_microsoft_fast_web_utilities.eventFocusIn, this.handleFocusin);
1532
+ this.addEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusout);
1533
+ this.addEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
1534
+ this.style.gridColumn = `${this.columnDefinition?.gridColumn === void 0 ? 0 : this.columnDefinition.gridColumn}`;
1535
+ this.updateCellView();
1536
+ this.updateCellStyle();
1537
+ this.updateFixedStyle();
1538
+ }
1539
+ /**
1540
+ * @internal
1541
+ */
1542
+ disconnectedCallback() {
1543
+ super.disconnectedCallback();
1544
+ this.removeEventListener(_microsoft_fast_web_utilities.eventFocusIn, this.handleFocusin);
1545
+ this.removeEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusout);
1546
+ this.removeEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
1547
+ this.disconnectCellView();
1548
+ }
1549
+ /**
1550
+ * @internal
1551
+ */
1552
+ handleFocusin(_) {
1553
+ this.shadowRoot.querySelector(".base").classList.add("active");
1554
+ if (this.isActiveCell) return;
1555
+ this.isActiveCell = true;
1556
+ switch (this.cellType) {
1557
+ case require_data_grid_options.DataGridCellTypes.columnHeader:
1558
+ if (this.columnDefinition !== null && this.columnDefinition.headerCellInternalFocusQueue !== true && typeof this.columnDefinition.headerCellFocusTargetCallback === "function") {
1559
+ const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
1560
+ /* v8 ignore else -- @preserve */
1561
+ if (focusTarget !== null) focusTarget.focus();
1562
+ }
1563
+ break;
1564
+ default:
1565
+ if (this.columnDefinition !== null && this.columnDefinition.cellInternalFocusQueue !== true && typeof this.columnDefinition.cellFocusTargetCallback === "function") {
1566
+ const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
1567
+ /* v8 ignore else -- @preserve */
1568
+ if (focusTarget !== null) focusTarget.focus();
1569
+ }
1570
+ break;
1571
+ }
1572
+ this.$emit("cell-focused", this);
1573
+ }
1574
+ /**
1575
+ * @internal
1576
+ */
1577
+ handleFocusout(_) {
1578
+ this.shadowRoot.querySelector(".base").classList.remove("active");
1579
+ /* v8 ignore else -- @preserve */
1580
+ if (this !== document.activeElement && !this.contains(document.activeElement)) this.isActiveCell = false;
1581
+ }
1582
+ /**
1583
+ * @internal
1584
+ */
1585
+ handleKeydown(e) {
1586
+ if (e.defaultPrevented || this.columnDefinition === null || this.cellType === require_data_grid_options.DataGridCellTypes.default && this.columnDefinition.cellInternalFocusQueue !== true || this.cellType === require_data_grid_options.DataGridCellTypes.columnHeader && this.columnDefinition.headerCellInternalFocusQueue !== true) return;
1587
+ switch (e.key) {
1588
+ case _microsoft_fast_web_utilities.keyEnter:
1589
+ case _microsoft_fast_web_utilities.keyFunction2:
1590
+ if (this.contains(document.activeElement) && document.activeElement !== this) return;
1591
+ switch (this.cellType) {
1592
+ case require_data_grid_options.DataGridCellTypes.columnHeader:
1593
+ if (this.columnDefinition.headerCellFocusTargetCallback !== void 0) {
1594
+ const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
1595
+ /* v8 ignore else -- @preserve */
1596
+ if (focusTarget !== null) focusTarget.focus();
1597
+ e.preventDefault();
1598
+ }
1599
+ break;
1600
+ default:
1601
+ if (this.columnDefinition.cellFocusTargetCallback !== void 0) {
1602
+ const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
1603
+ /* v8 ignore else -- @preserve */
1604
+ if (focusTarget !== null) focusTarget.focus();
1605
+ e.preventDefault();
1606
+ }
1607
+ break;
1608
+ }
1609
+ break;
1610
+ case _microsoft_fast_web_utilities.keyEscape:
1611
+ /* v8 ignore else -- @preserve */
1612
+ if (this.contains(document.activeElement) && document.activeElement !== this) {
1613
+ this.focus();
1614
+ e.preventDefault();
1615
+ }
1616
+ break;
1617
+ }
1618
+ }
1619
+ updateCellView() {
1620
+ this.disconnectCellView();
1621
+ if (this.columnDefinition === null) return;
1622
+ switch (this.cellType) {
1623
+ case require_data_grid_options.DataGridCellTypes.columnHeader:
1624
+ if (this.columnDefinition.headerCellTemplate !== void 0) this.customCellView = this.columnDefinition.headerCellTemplate.render(this, this);
1625
+ else this.customCellView = defaultHeaderCellContentsTemplate.render(this, this);
1626
+ break;
1627
+ case require_data_grid_options.DataGridCellTypes.rowHeader:
1628
+ case require_data_grid_options.DataGridCellTypes.default:
1629
+ if (this.columnDefinition.cellTemplate !== void 0) this.customCellView = this.columnDefinition.cellTemplate.render(this, this);
1630
+ else this.customCellView = defaultCellContentsTemplate.render(this, this);
1631
+ break;
1632
+ }
1633
+ if (!this.columnDefinition?.sortable) this.sortDirection = void 0;
1634
+ else if (this.columnDefinition.sortDirection) this.sortDirection = this.columnDefinition.sortDirection;
1635
+ else this.sortDirection = require_data_grid_options.DataGridCellSortStates.none;
1636
+ }
1637
+ disconnectCellView() {
1638
+ if (this.customCellView !== null) {
1639
+ this.customCellView.dispose();
1640
+ this.customCellView = null;
1641
+ }
1642
+ }
1643
+ /**
1644
+ * @internal
1645
+ */
1646
+ ariaSelectedChanged(prevValue, newValue) {
1647
+ super.ariaSelectedChanged(prevValue, newValue);
1648
+ this._selectable = newValue !== null;
1649
+ this.selected = newValue === "true";
1650
+ }
1651
+ /**
1652
+ * @internal
1653
+ */
1654
+ ariaSortChanged(oldValue, newValue) {
1655
+ super.ariaSortChanged(oldValue, newValue);
1656
+ if (newValue === null) {
1657
+ this.sortDirection = void 0;
1658
+ return;
1659
+ }
1660
+ this.sortDirection = newValue;
1661
+ }
1662
+ #getColumnDataKey() {
1663
+ return this.columnDefinition && this.columnDefinition.columnDataKey ? this.columnDefinition.columnDataKey : this.textContent.trim();
1664
+ }
1665
+ /**
1666
+ * @internal
1667
+ */
1668
+ _handleInteraction() {
1669
+ const isHeaderCell = this.cellType === "columnheader";
1670
+ if (isHeaderCell && this.sortDirection !== void 0) this.$emit("sort", {
1671
+ columnDataKey: this.#getColumnDataKey(),
1672
+ sortDirection: this.sortDirection
1673
+ });
1674
+ if (!(isHeaderCell ? this.columnDefinition?.headerCellInternalFocusQueue : this.columnDefinition?.cellInternalFocusQueue)) this.$emit("cell-click", {
1675
+ cell: this,
1676
+ row: this.parentElement,
1677
+ isHeaderCell,
1678
+ columnDataKey: this.#getColumnDataKey()
1679
+ });
1680
+ return true;
1681
+ }
1682
+ };
1683
+ require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "cell-type" })], DataGridCell.prototype, "cellType", void 0);
1684
+ require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "grid-column" })], DataGridCell.prototype, "gridColumn", void 0);
1685
+ require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "rowData", void 0);
1686
+ require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "columnDefinition", void 0);
1687
+ require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "_selectable", void 0);
1688
+ require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], DataGridCell.prototype, "selected", void 0);
1689
+ require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "sort-direction" })], DataGridCell.prototype, "sortDirection", void 0);
1690
+ require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "_actionItemsSlottedContent", void 0);
1691
+ //#endregion
1692
1692
  //#region src/lib/data-grid/data-grid-row.template.ts
1693
1693
  function calculateAriaSelectedValue$1(x) {
1694
1694
  if (x._selectable && x.selected) return "true";