@vonage/vivid 5.15.1 → 5.16.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 (715) hide show
  1. package/accordion/definition.cjs +7 -207
  2. package/accordion/definition.js +2 -199
  3. package/accordion/index.cjs +4 -4
  4. package/accordion/index.js +93 -127
  5. package/accordion-item/definition.cjs +6 -146
  6. package/accordion-item/definition.js +2 -139
  7. package/accordion-item/index.cjs +1 -1
  8. package/accordion-item/index.js +6 -2
  9. package/action-group/definition.cjs +5 -69
  10. package/action-group/definition.js +1 -62
  11. package/action-group/index.cjs +4 -4
  12. package/action-group/index.js +16 -46
  13. package/alert/definition.cjs +6 -201
  14. package/alert/definition.js +2 -194
  15. package/alert/index.cjs +15 -15
  16. package/alert/index.js +90 -136
  17. package/audio-player/definition.cjs +6 -459
  18. package/audio-player/definition.js +2 -452
  19. package/audio-player/index.cjs +49 -49
  20. package/audio-player/index.js +234 -302
  21. package/avatar/definition.cjs +6 -117
  22. package/avatar/definition.js +2 -110
  23. package/avatar/index.cjs +14 -14
  24. package/avatar/index.js +44 -84
  25. package/badge/definition.cjs +6 -85
  26. package/badge/definition.js +2 -78
  27. package/badge/index.cjs +4 -4
  28. package/badge/index.js +21 -65
  29. package/banner/definition.cjs +6 -160
  30. package/banner/definition.js +2 -153
  31. package/banner/index.cjs +13 -13
  32. package/banner/index.js +76 -109
  33. package/breadcrumb/definition.cjs +5 -97
  34. package/breadcrumb/definition.js +1 -90
  35. package/breadcrumb/index.cjs +4 -4
  36. package/breadcrumb/index.js +33 -59
  37. package/breadcrumb-item/definition.cjs +7 -47
  38. package/breadcrumb-item/definition.js +3 -40
  39. package/breadcrumb-item/index.cjs +5 -5
  40. package/breadcrumb-item/index.js +20 -32
  41. package/bundled/affix.cjs +10 -10
  42. package/bundled/affix.js +44 -57
  43. package/bundled/anchored.cjs +3 -3
  44. package/bundled/anchored.js +47 -65
  45. package/bundled/aria.cjs +1 -1
  46. package/bundled/aria.js +6 -6
  47. package/bundled/attribute-binding-behaviour.cjs +1 -1
  48. package/bundled/attribute-binding-behaviour.js +17 -28
  49. package/bundled/base-color-picker.cjs +10 -10
  50. package/bundled/base-color-picker.js +115 -197
  51. package/bundled/base-progress.cjs +1 -1
  52. package/bundled/base-progress.js +29 -56
  53. package/bundled/breadcrumb-item.cjs +1 -1
  54. package/bundled/breadcrumb-item.js +11 -20
  55. package/bundled/button.cjs +1 -1
  56. package/bundled/button.js +65 -100
  57. package/bundled/calendar-event.cjs +1 -1
  58. package/bundled/calendar-event.js +11 -34
  59. package/bundled/calendar-picker.template.cjs +77 -77
  60. package/bundled/calendar-picker.template.js +2881 -3345
  61. package/bundled/char-count.cjs +7 -7
  62. package/bundled/char-count.js +31 -46
  63. package/bundled/children.cjs +1 -1
  64. package/bundled/children.js +27 -45
  65. package/bundled/class-names.cjs +1 -1
  66. package/bundled/class-names.js +8 -8
  67. package/bundled/data-grid.options.cjs +1 -1
  68. package/bundled/data-grid.options.js +22 -26
  69. package/bundled/decorate.cjs +1 -0
  70. package/bundled/decorate.js +9 -0
  71. package/bundled/definition.cjs +1 -39
  72. package/bundled/definition.js +5 -122
  73. package/bundled/definition10.cjs +27 -69
  74. package/bundled/definition10.js +173 -352
  75. package/bundled/definition11.cjs +19 -12
  76. package/bundled/definition11.js +77 -92
  77. package/bundled/definition12.cjs +11 -11
  78. package/bundled/definition12.js +122 -216
  79. package/bundled/definition13.cjs +18 -9
  80. package/bundled/definition13.js +76 -42
  81. package/bundled/definition14.cjs +10 -1
  82. package/bundled/definition14.js +28 -19
  83. package/bundled/definition15.cjs +73 -5
  84. package/bundled/definition15.js +194 -28
  85. package/bundled/definition16.cjs +5 -30
  86. package/bundled/definition16.js +16 -79
  87. package/bundled/definition17.cjs +13 -19
  88. package/bundled/definition17.js +81 -102
  89. package/bundled/definition18.cjs +12 -13
  90. package/bundled/definition18.js +67 -135
  91. package/bundled/definition19.cjs +48 -48
  92. package/bundled/definition19.js +365 -683
  93. package/bundled/definition2.cjs +8 -8
  94. package/bundled/definition2.js +79 -122
  95. package/bundled/definition20.cjs +5 -20
  96. package/bundled/definition20.js +11 -106
  97. package/bundled/definition21.cjs +20 -5
  98. package/bundled/definition21.js +57 -18
  99. package/bundled/definition22.cjs +16 -16
  100. package/bundled/definition22.js +79 -140
  101. package/bundled/definition3.cjs +1 -29
  102. package/bundled/definition3.js +183 -194
  103. package/bundled/definition4.cjs +39 -6
  104. package/bundled/definition4.js +71 -41
  105. package/bundled/definition5.cjs +30 -1
  106. package/bundled/definition5.js +48 -346
  107. package/bundled/definition6.cjs +28 -30
  108. package/bundled/definition6.js +110 -264
  109. package/bundled/definition7.cjs +6 -30
  110. package/bundled/definition7.js +22 -288
  111. package/bundled/definition8.cjs +13 -18
  112. package/bundled/definition8.js +150 -132
  113. package/bundled/definition9.cjs +29 -13
  114. package/bundled/definition9.js +157 -232
  115. package/bundled/delegates-aria.cjs +1 -1
  116. package/bundled/delegates-aria.js +56 -88
  117. package/bundled/dialog.cjs +1 -0
  118. package/bundled/dialog.js +6 -0
  119. package/bundled/divider.cjs +1 -1
  120. package/bundled/divider.js +16 -33
  121. package/bundled/dom.cjs +1 -1
  122. package/bundled/dom.js +5 -5
  123. package/bundled/enums.cjs +1 -1
  124. package/bundled/enums.js +16 -9
  125. package/bundled/floating-ui.dom.cjs +1 -1
  126. package/bundled/floating-ui.dom.js +953 -1238
  127. package/bundled/form-associated.cjs +1 -1
  128. package/bundled/form-associated.js +165 -318
  129. package/bundled/form-element.cjs +1 -1
  130. package/bundled/form-element.js +33 -55
  131. package/bundled/host-semantics.cjs +1 -1
  132. package/bundled/host-semantics.js +46 -69
  133. package/bundled/key-codes.cjs +1 -1
  134. package/bundled/key-codes.js +4 -16
  135. package/bundled/linkable.cjs +6 -6
  136. package/bundled/linkable.js +25 -45
  137. package/bundled/listbox.cjs +1 -1
  138. package/bundled/listbox.js +176 -351
  139. package/bundled/localized.cjs +1 -1
  140. package/bundled/localized.js +451 -564
  141. package/bundled/mixins.cjs +20 -20
  142. package/bundled/mixins.js +162 -210
  143. package/bundled/normalize.cjs +1 -1
  144. package/bundled/normalize.js +6 -6
  145. package/bundled/numbers.cjs +1 -1
  146. package/bundled/numbers.js +9 -11
  147. package/bundled/picker-field.template.cjs +23 -23
  148. package/bundled/picker-field.template.js +108 -171
  149. package/bundled/playbackRates.cjs +1 -1
  150. package/bundled/playbackRates.js +10 -10
  151. package/bundled/ref.cjs +1 -1
  152. package/bundled/ref.js +10 -14
  153. package/bundled/repeat.cjs +1 -1
  154. package/bundled/repeat.js +421 -552
  155. package/bundled/scrollIntoView.cjs +1 -1
  156. package/bundled/scrollIntoView.js +26 -29
  157. package/bundled/single-date-picker.cjs +1 -1
  158. package/bundled/single-date-picker.js +23 -38
  159. package/bundled/single-value-picker.cjs +1 -1
  160. package/bundled/single-value-picker.js +58 -86
  161. package/bundled/slider.template.cjs +13 -13
  162. package/bundled/slider.template.js +67 -78
  163. package/bundled/slottable-request.cjs +4 -4
  164. package/bundled/slottable-request.js +1937 -2904
  165. package/bundled/slotted.cjs +1 -1
  166. package/bundled/slotted.js +47 -97
  167. package/bundled/strings.cjs +1 -1
  168. package/bundled/strings.js +6 -6
  169. package/bundled/text-field.cjs +1 -1
  170. package/bundled/text-field.js +4 -4
  171. package/bundled/time-selection-picker.template.cjs +26 -26
  172. package/bundled/time-selection-picker.template.js +355 -552
  173. package/bundled/trapped-focus.cjs +1 -1
  174. package/bundled/trapped-focus.js +18 -25
  175. package/bundled/vivid-element.cjs +4 -5
  176. package/bundled/vivid-element.js +1781 -2806
  177. package/bundled/when.cjs +1 -1
  178. package/bundled/when.js +10 -10
  179. package/bundled/with-contextual-help.cjs +1 -1
  180. package/bundled/with-contextual-help.js +15 -31
  181. package/bundled/with-error-text.cjs +1 -1
  182. package/bundled/with-error-text.js +25 -38
  183. package/bundled/with-success-text.cjs +1 -1
  184. package/bundled/with-success-text.js +8 -15
  185. package/button/definition.cjs +6 -14
  186. package/button/definition.js +3 -4
  187. package/button/index.cjs +1 -1
  188. package/button/index.js +6 -2
  189. package/calendar/definition.cjs +5 -358
  190. package/calendar/definition.js +1 -351
  191. package/calendar/index.cjs +20 -20
  192. package/calendar/index.js +346 -401
  193. package/calendar-event/definition.cjs +6 -58
  194. package/calendar-event/definition.js +2 -51
  195. package/calendar-event/index.cjs +7 -7
  196. package/calendar-event/index.js +25 -41
  197. package/card/definition.cjs +6 -194
  198. package/card/definition.js +2 -187
  199. package/card/index.cjs +34 -34
  200. package/card/index.js +80 -133
  201. package/checkbox/definition.cjs +6 -209
  202. package/checkbox/definition.js +2 -202
  203. package/checkbox/index.cjs +1 -1
  204. package/checkbox/index.js +6 -2
  205. package/color-picker/definition.cjs +6 -1175
  206. package/color-picker/definition.js +2 -1168
  207. package/color-picker/index.cjs +94 -94
  208. package/color-picker/index.js +605 -737
  209. package/combobox/definition.cjs +6 -647
  210. package/combobox/definition.js +2 -640
  211. package/combobox/index.cjs +37 -37
  212. package/combobox/index.js +254 -458
  213. package/contextual-help/definition.cjs +6 -63
  214. package/contextual-help/definition.js +2 -56
  215. package/contextual-help/index.cjs +1 -1
  216. package/contextual-help/index.js +6 -2
  217. package/country/definition.cjs +6 -340
  218. package/country/definition.js +2 -333
  219. package/country/index.cjs +6 -6
  220. package/country/index.js +1209 -308
  221. package/custom-elements.json +513 -851
  222. package/data-grid/definition.cjs +10 -2350
  223. package/data-grid/definition.js +2 -2339
  224. package/data-grid/index.cjs +61 -61
  225. package/data-grid/index.js +642 -992
  226. package/date-picker/definition.cjs +6 -152
  227. package/date-picker/definition.js +2 -145
  228. package/date-picker/index.cjs +1 -1
  229. package/date-picker/index.js +66 -114
  230. package/date-range-picker/definition.cjs +6 -467
  231. package/date-range-picker/definition.js +2 -460
  232. package/date-range-picker/index.cjs +1 -1
  233. package/date-range-picker/index.js +218 -334
  234. package/date-time-picker/definition.cjs +6 -285
  235. package/date-time-picker/definition.js +2 -278
  236. package/date-time-picker/index.cjs +4 -4
  237. package/date-time-picker/index.js +116 -211
  238. package/dial-pad/definition.cjs +6 -460
  239. package/dial-pad/definition.js +2 -453
  240. package/dial-pad/index.cjs +42 -42
  241. package/dial-pad/index.js +195 -287
  242. package/dialog/definition.cjs +6 -349
  243. package/dialog/definition.js +2 -342
  244. package/dialog/index.cjs +28 -28
  245. package/dialog/index.js +148 -229
  246. package/divider/definition.cjs +6 -42
  247. package/divider/definition.js +2 -35
  248. package/divider/index.cjs +1 -1
  249. package/divider/index.js +5 -2
  250. package/elevation/definition.cjs +4 -11
  251. package/elevation/definition.js +2 -2
  252. package/elevation/index.cjs +1 -1
  253. package/elevation/index.js +5 -2
  254. package/empty-state/definition.cjs +6 -86
  255. package/empty-state/definition.js +2 -79
  256. package/empty-state/index.cjs +9 -9
  257. package/empty-state/index.js +28 -60
  258. package/fab/definition.cjs +6 -105
  259. package/fab/definition.js +2 -98
  260. package/fab/index.cjs +17 -17
  261. package/fab/index.js +46 -81
  262. package/file-picker/definition.cjs +6 -523
  263. package/file-picker/definition.js +2 -516
  264. package/file-picker/index.cjs +25 -25
  265. package/file-picker/index.js +246 -351
  266. package/header/definition.cjs +5 -78
  267. package/header/definition.js +1 -71
  268. package/header/index.cjs +5 -5
  269. package/header/index.js +28 -42
  270. package/icon/definition.cjs +5 -202
  271. package/icon/definition.js +1 -195
  272. package/icon/index.cjs +1 -1
  273. package/icon/index.js +5 -2
  274. package/index.cjs +350 -356
  275. package/index.js +79 -78
  276. package/layout/definition.cjs +5 -72
  277. package/layout/definition.js +1 -65
  278. package/layout/index.cjs +2 -2
  279. package/layout/index.js +10 -51
  280. package/lib/alert/alert.d.ts +0 -1
  281. package/lib/audio-player/audio-player.d.ts +0 -1
  282. package/lib/banner/banner.d.ts +0 -2
  283. package/lib/button/button.d.ts +0 -1
  284. package/lib/calendar/calendar.d.ts +0 -1
  285. package/lib/data-grid/data-grid-cell.d.ts +0 -3
  286. package/lib/data-grid/data-grid-row.d.ts +0 -3
  287. package/lib/data-grid/data-grid.d.ts +0 -1
  288. package/lib/fab/fab.d.ts +0 -1
  289. package/lib/file-picker/file-picker.d.ts +1 -1
  290. package/lib/icon/icon.d.ts +0 -1
  291. package/lib/option/option.d.ts +4 -0
  292. package/lib/pagination/pagination.d.ts +0 -4
  293. package/lib/popover/popover.d.ts +0 -5
  294. package/lib/split-button/split-button.d.ts +0 -2
  295. package/lib/tab/tab.d.ts +0 -2
  296. package/lib/tag/tag.d.ts +0 -2
  297. package/lib/toggletip/toggletip.d.ts +0 -1
  298. package/lib/tree-item/tree-item.d.ts +0 -2
  299. package/lib/tree-view/tree-view.d.ts +0 -1
  300. package/locales/de-DE.cjs +439 -549
  301. package/locales/de-DE.js +440 -547
  302. package/locales/en-GB.cjs +271 -382
  303. package/locales/en-GB.js +272 -380
  304. package/locales/en-US.cjs +2 -552
  305. package/locales/en-US.js +1 -549
  306. package/locales/ja-JP.cjs +432 -548
  307. package/locales/ja-JP.js +433 -546
  308. package/locales/zh-CN.cjs +433 -550
  309. package/locales/zh-CN.js +434 -548
  310. package/menu/definition.cjs +6 -393
  311. package/menu/definition.js +2 -386
  312. package/menu/index.cjs +1 -1
  313. package/menu/index.js +6 -2
  314. package/menu-item/definition.cjs +7 -14
  315. package/menu-item/definition.js +3 -3
  316. package/menu-item/index.cjs +1 -1
  317. package/menu-item/index.js +6 -2
  318. package/nav/definition.cjs +5 -27
  319. package/nav/definition.js +1 -20
  320. package/nav/index.cjs +3 -3
  321. package/nav/index.js +7 -10
  322. package/nav-disclosure/definition.cjs +6 -122
  323. package/nav-disclosure/definition.js +2 -115
  324. package/nav-disclosure/index.cjs +8 -8
  325. package/nav-disclosure/index.js +49 -86
  326. package/nav-item/definition.cjs +6 -79
  327. package/nav-item/definition.js +2 -72
  328. package/nav-item/index.cjs +2 -2
  329. package/nav-item/index.js +33 -58
  330. package/note/definition.cjs +6 -61
  331. package/note/definition.js +2 -54
  332. package/note/index.cjs +5 -5
  333. package/note/index.js +24 -38
  334. package/number-field/definition.cjs +6 -440
  335. package/number-field/definition.js +2 -433
  336. package/number-field/index.cjs +31 -31
  337. package/number-field/index.js +160 -328
  338. package/option/definition.cjs +6 -13
  339. package/option/definition.js +3 -3
  340. package/option/index.cjs +1 -1
  341. package/option/index.js +6 -2
  342. package/package.json +15 -16
  343. package/pagination/definition.cjs +6 -254
  344. package/pagination/definition.js +2 -247
  345. package/pagination/index.cjs +37 -37
  346. package/pagination/index.js +148 -186
  347. package/popover/definition.cjs +6 -356
  348. package/popover/definition.js +2 -349
  349. package/popover/index.cjs +16 -16
  350. package/popover/index.js +161 -239
  351. package/popup/definition.cjs +5 -13
  352. package/popup/definition.js +3 -4
  353. package/popup/index.cjs +1 -1
  354. package/popup/index.js +6 -2
  355. package/progress/definition.cjs +5 -87
  356. package/progress/definition.js +1 -80
  357. package/progress/index.cjs +9 -9
  358. package/progress/index.js +33 -55
  359. package/progress-ring/definition.cjs +5 -95
  360. package/progress-ring/definition.js +1 -88
  361. package/progress-ring/index.cjs +1 -1
  362. package/progress-ring/index.js +5 -2
  363. package/radio/definition.cjs +5 -227
  364. package/radio/definition.js +1 -220
  365. package/radio/index.cjs +1 -1
  366. package/radio/index.js +5 -2
  367. package/radio-group/definition.cjs +6 -361
  368. package/radio-group/definition.js +2 -354
  369. package/radio-group/index.cjs +10 -10
  370. package/radio-group/index.js +160 -242
  371. package/range-slider/definition.cjs +6 -632
  372. package/range-slider/definition.js +2 -625
  373. package/range-slider/index.cjs +41 -41
  374. package/range-slider/index.js +259 -429
  375. package/rich-text-editor/definition.cjs +32 -15694
  376. package/rich-text-editor/definition.js +2 -15661
  377. package/rich-text-editor/index.cjs +17 -17
  378. package/rich-text-editor/index.js +9061 -11464
  379. package/rich-text-view/definition.cjs +5 -171
  380. package/rich-text-view/definition.js +1 -164
  381. package/rich-text-view/index.cjs +1 -1
  382. package/rich-text-view/index.js +68 -102
  383. package/searchable-select/definition.cjs +5 -1401
  384. package/searchable-select/definition.js +2 -1395
  385. package/searchable-select/index.cjs +94 -94
  386. package/searchable-select/index.js +600 -1015
  387. package/select/definition.cjs +6 -1002
  388. package/select/definition.js +2 -995
  389. package/select/index.cjs +1 -1
  390. package/select/index.js +6 -2
  391. package/selectable-box/definition.cjs +6 -174
  392. package/selectable-box/definition.js +2 -167
  393. package/selectable-box/index.cjs +18 -18
  394. package/selectable-box/index.js +66 -127
  395. package/side-drawer/definition.cjs +5 -130
  396. package/side-drawer/definition.js +1 -123
  397. package/side-drawer/index.cjs +7 -7
  398. package/side-drawer/index.js +47 -89
  399. package/simple-color-picker/definition.cjs +6 -225
  400. package/simple-color-picker/definition.js +2 -218
  401. package/simple-color-picker/index.cjs +15 -15
  402. package/simple-color-picker/index.js +98 -135
  403. package/slider/definition.cjs +6 -499
  404. package/slider/definition.js +2 -492
  405. package/slider/index.cjs +1 -1
  406. package/slider/index.js +6 -2
  407. package/split-button/definition.cjs +6 -176
  408. package/split-button/definition.js +2 -169
  409. package/split-button/index.cjs +15 -15
  410. package/split-button/index.js +74 -135
  411. package/status/definition.cjs +6 -82
  412. package/status/definition.js +2 -75
  413. package/status/index.cjs +7 -7
  414. package/status/index.js +35 -52
  415. package/switch/definition.cjs +6 -148
  416. package/switch/definition.js +2 -141
  417. package/switch/index.cjs +8 -8
  418. package/switch/index.js +48 -92
  419. package/tab/definition.cjs +6 -127
  420. package/tab/definition.js +2 -120
  421. package/tab/index.cjs +1 -1
  422. package/tab/index.js +6 -2
  423. package/tab-panel/definition.cjs +5 -29
  424. package/tab-panel/definition.js +1 -22
  425. package/tab-panel/index.cjs +1 -1
  426. package/tab-panel/index.js +5 -2
  427. package/table/definition.cjs +15 -174
  428. package/table/definition.js +1 -157
  429. package/table/index.cjs +10 -10
  430. package/table/index.js +26 -82
  431. package/tabs/definition.cjs +7 -467
  432. package/tabs/definition.js +2 -459
  433. package/tabs/index.cjs +11 -11
  434. package/tabs/index.js +169 -296
  435. package/tag/definition.cjs +6 -176
  436. package/tag/definition.js +2 -169
  437. package/tag/index.cjs +26 -26
  438. package/tag/index.js +65 -126
  439. package/tag-group/definition.cjs +5 -40
  440. package/tag-group/definition.js +1 -33
  441. package/tag-group/index.cjs +4 -4
  442. package/tag-group/index.js +10 -21
  443. package/text-area/definition.cjs +6 -355
  444. package/text-area/definition.js +2 -348
  445. package/text-area/index.cjs +11 -11
  446. package/text-area/index.js +153 -260
  447. package/text-field/definition.cjs +6 -423
  448. package/text-field/definition.js +2 -416
  449. package/text-field/index.cjs +1 -1
  450. package/text-field/index.js +6 -2
  451. package/time-picker/definition.cjs +7 -43
  452. package/time-picker/definition.js +3 -36
  453. package/time-picker/index.cjs +1 -1
  454. package/time-picker/index.js +24 -29
  455. package/toggletip/definition.cjs +6 -159
  456. package/toggletip/definition.js +2 -152
  457. package/toggletip/index.cjs +1 -1
  458. package/toggletip/index.js +6 -2
  459. package/tooltip/definition.cjs +6 -139
  460. package/tooltip/definition.js +2 -132
  461. package/tooltip/index.cjs +1 -1
  462. package/tooltip/index.js +6 -2
  463. package/tree-item/definition.cjs +6 -13
  464. package/tree-item/definition.js +3 -3
  465. package/tree-item/index.cjs +1 -1
  466. package/tree-item/index.js +6 -2
  467. package/tree-view/definition.cjs +6 -302
  468. package/tree-view/definition.js +2 -295
  469. package/tree-view/index.cjs +11 -11
  470. package/tree-view/index.js +145 -174
  471. package/unbundled/affix.cjs +89 -62
  472. package/unbundled/affix.js +58 -55
  473. package/unbundled/anchored.cjs +87 -94
  474. package/unbundled/anchored.js +74 -90
  475. package/unbundled/attribute-binding-behaviour.cjs +37 -42
  476. package/unbundled/attribute-binding-behaviour.js +31 -40
  477. package/unbundled/base-color-picker.cjs +226 -275
  478. package/unbundled/base-color-picker.js +214 -272
  479. package/unbundled/base-progress.cjs +63 -78
  480. package/unbundled/base-progress.js +57 -76
  481. package/unbundled/breadcrumb-item.cjs +24 -28
  482. package/unbundled/breadcrumb-item.js +18 -26
  483. package/unbundled/button.cjs +115 -166
  484. package/unbundled/button.js +109 -164
  485. package/unbundled/calendar-event.cjs +28 -41
  486. package/unbundled/calendar-event.js +22 -39
  487. package/unbundled/calendar-picker.template.cjs +620 -783
  488. package/unbundled/calendar-picker.template.js +560 -772
  489. package/unbundled/char-count.cjs +50 -80
  490. package/unbundled/char-count.js +44 -78
  491. package/unbundled/chunk.cjs +50 -0
  492. package/unbundled/chunk.js +33 -0
  493. package/unbundled/data-grid.options.cjs +80 -29
  494. package/unbundled/data-grid.options.js +51 -23
  495. package/unbundled/decorate.cjs +14 -0
  496. package/unbundled/decorate.js +9 -0
  497. package/unbundled/definition.cjs +42 -405
  498. package/unbundled/definition.js +24 -399
  499. package/unbundled/definition10.cjs +253 -0
  500. package/unbundled/definition10.js +229 -0
  501. package/unbundled/definition11.cjs +397 -0
  502. package/unbundled/definition11.js +379 -0
  503. package/unbundled/definition12.cjs +317 -0
  504. package/unbundled/definition12.js +287 -0
  505. package/unbundled/definition13.cjs +328 -0
  506. package/unbundled/definition13.js +310 -0
  507. package/unbundled/definition14.cjs +406 -0
  508. package/unbundled/definition14.js +388 -0
  509. package/unbundled/definition15.cjs +107 -0
  510. package/unbundled/definition15.js +89 -0
  511. package/unbundled/definition16.cjs +63 -0
  512. package/unbundled/definition16.js +45 -0
  513. package/unbundled/definition17.cjs +151 -0
  514. package/unbundled/definition17.js +133 -0
  515. package/unbundled/definition18.cjs +47 -0
  516. package/unbundled/definition18.js +35 -0
  517. package/unbundled/definition19.cjs +98 -0
  518. package/unbundled/definition19.js +80 -0
  519. package/unbundled/definition2.cjs +180 -220
  520. package/unbundled/definition2.js +162 -215
  521. package/unbundled/definition20.cjs +56 -0
  522. package/unbundled/definition20.js +43 -0
  523. package/unbundled/definition21.cjs +305 -0
  524. package/unbundled/definition21.js +286 -0
  525. package/unbundled/definition22.cjs +174 -0
  526. package/unbundled/definition22.js +156 -0
  527. package/unbundled/definition23.cjs +161 -0
  528. package/unbundled/definition23.js +143 -0
  529. package/unbundled/definition24.cjs +1038 -0
  530. package/unbundled/definition24.js +1020 -0
  531. package/unbundled/definition25.cjs +360 -0
  532. package/unbundled/definition25.js +342 -0
  533. package/unbundled/definition26.cjs +137 -0
  534. package/unbundled/definition26.js +119 -0
  535. package/unbundled/definition27.cjs +235 -0
  536. package/unbundled/definition27.js +211 -0
  537. package/unbundled/definition28.cjs +546 -0
  538. package/unbundled/definition28.js +528 -0
  539. package/unbundled/definition29.cjs +157 -0
  540. package/unbundled/definition29.js +139 -0
  541. package/unbundled/definition3.cjs +131 -284
  542. package/unbundled/definition3.js +113 -279
  543. package/unbundled/definition30.cjs +75 -0
  544. package/unbundled/definition30.js +57 -0
  545. package/unbundled/definition31.cjs +1265 -0
  546. package/unbundled/definition31.js +1247 -0
  547. package/unbundled/definition32.cjs +1908 -0
  548. package/unbundled/definition32.js +1866 -0
  549. package/unbundled/definition33.cjs +261 -0
  550. package/unbundled/definition33.js +183 -0
  551. package/unbundled/definition34.cjs +46 -0
  552. package/unbundled/definition34.js +33 -0
  553. package/unbundled/definition35.cjs +152 -0
  554. package/unbundled/definition35.js +134 -0
  555. package/unbundled/definition36.cjs +426 -0
  556. package/unbundled/definition36.js +408 -0
  557. package/unbundled/definition37.cjs +243 -0
  558. package/unbundled/definition37.js +225 -0
  559. package/unbundled/definition38.cjs +409 -0
  560. package/unbundled/definition38.js +391 -0
  561. package/unbundled/definition39.cjs +298 -0
  562. package/unbundled/definition39.js +280 -0
  563. package/unbundled/definition4.cjs +186 -205
  564. package/unbundled/definition4.js +162 -200
  565. package/unbundled/definition40.cjs +81 -0
  566. package/unbundled/definition40.js +63 -0
  567. package/unbundled/definition41.cjs +100 -0
  568. package/unbundled/definition41.js +82 -0
  569. package/unbundled/definition42.cjs +457 -0
  570. package/unbundled/definition42.js +439 -0
  571. package/unbundled/definition43.cjs +86 -0
  572. package/unbundled/definition43.js +68 -0
  573. package/unbundled/definition44.cjs +60 -0
  574. package/unbundled/definition44.js +41 -0
  575. package/unbundled/definition45.cjs +124 -0
  576. package/unbundled/definition45.js +106 -0
  577. package/unbundled/definition46.cjs +85 -0
  578. package/unbundled/definition46.js +67 -0
  579. package/unbundled/definition47.cjs +52 -0
  580. package/unbundled/definition47.js +31 -0
  581. package/unbundled/definition48.cjs +69 -0
  582. package/unbundled/definition48.js +51 -0
  583. package/unbundled/definition49.cjs +377 -0
  584. package/unbundled/definition49.js +359 -0
  585. package/unbundled/definition5.cjs +69 -298
  586. package/unbundled/definition5.js +44 -293
  587. package/unbundled/definition50.cjs +246 -0
  588. package/unbundled/definition50.js +228 -0
  589. package/unbundled/definition51.cjs +337 -0
  590. package/unbundled/definition51.js +319 -0
  591. package/unbundled/definition52.cjs +86 -0
  592. package/unbundled/definition52.js +67 -0
  593. package/unbundled/definition53.cjs +193 -0
  594. package/unbundled/definition53.js +174 -0
  595. package/unbundled/definition54.cjs +297 -0
  596. package/unbundled/definition54.js +279 -0
  597. package/unbundled/definition55.cjs +510 -0
  598. package/unbundled/definition55.js +492 -0
  599. package/unbundled/definition56.cjs +12728 -0
  600. package/unbundled/definition56.js +12553 -0
  601. package/unbundled/definition57.cjs +837 -0
  602. package/unbundled/definition57.js +819 -0
  603. package/unbundled/definition58.cjs +146 -0
  604. package/unbundled/definition58.js +128 -0
  605. package/unbundled/definition59.cjs +1080 -0
  606. package/unbundled/definition59.js +1062 -0
  607. package/unbundled/definition6.cjs +88 -56
  608. package/unbundled/definition6.js +69 -52
  609. package/unbundled/definition60.cjs +149 -0
  610. package/unbundled/definition60.js +131 -0
  611. package/unbundled/definition61.cjs +116 -0
  612. package/unbundled/definition61.js +97 -0
  613. package/unbundled/definition62.cjs +213 -0
  614. package/unbundled/definition62.js +195 -0
  615. package/unbundled/definition63.cjs +159 -0
  616. package/unbundled/definition63.js +141 -0
  617. package/unbundled/definition64.cjs +86 -0
  618. package/unbundled/definition64.js +68 -0
  619. package/unbundled/definition65.cjs +126 -0
  620. package/unbundled/definition65.js +107 -0
  621. package/unbundled/definition66.cjs +49 -0
  622. package/unbundled/definition66.js +28 -0
  623. package/unbundled/definition67.cjs +119 -0
  624. package/unbundled/definition67.js +101 -0
  625. package/unbundled/definition68.cjs +374 -0
  626. package/unbundled/definition68.js +349 -0
  627. package/unbundled/definition69.cjs +57 -0
  628. package/unbundled/definition69.js +38 -0
  629. package/unbundled/definition7.cjs +190 -0
  630. package/unbundled/definition7.js +166 -0
  631. package/unbundled/definition70.cjs +155 -0
  632. package/unbundled/definition70.js +137 -0
  633. package/unbundled/definition71.cjs +302 -0
  634. package/unbundled/definition71.js +284 -0
  635. package/unbundled/definition72.cjs +49 -0
  636. package/unbundled/definition72.js +38 -0
  637. package/unbundled/definition73.cjs +171 -0
  638. package/unbundled/definition73.js +147 -0
  639. package/unbundled/definition74.cjs +232 -0
  640. package/unbundled/definition74.js +213 -0
  641. package/unbundled/definition75.cjs +52241 -0
  642. package/unbundled/definition75.js +52223 -0
  643. package/unbundled/definition8.cjs +63 -0
  644. package/unbundled/definition8.js +44 -0
  645. package/unbundled/definition9.cjs +183 -0
  646. package/unbundled/definition9.js +165 -0
  647. package/unbundled/delegates-aria.cjs +90 -131
  648. package/unbundled/delegates-aria.js +77 -127
  649. package/unbundled/dialog.cjs +15 -0
  650. package/unbundled/dialog.js +10 -0
  651. package/unbundled/divider.cjs +42 -50
  652. package/unbundled/divider.js +30 -47
  653. package/unbundled/en-US.cjs +447 -0
  654. package/unbundled/en-US.js +443 -0
  655. package/unbundled/enums.cjs +166 -107
  656. package/unbundled/enums.js +95 -94
  657. package/unbundled/form-associated.cjs +408 -463
  658. package/unbundled/form-associated.js +396 -460
  659. package/unbundled/form-element.cjs +74 -83
  660. package/unbundled/form-element.js +68 -81
  661. package/unbundled/host-semantics.cjs +70 -89
  662. package/unbundled/host-semantics.js +57 -85
  663. package/unbundled/key-codes.cjs +16 -10
  664. package/unbundled/key-codes.js +5 -7
  665. package/unbundled/linkable.cjs +35 -56
  666. package/unbundled/linkable.js +27 -52
  667. package/unbundled/listbox.cjs +363 -465
  668. package/unbundled/listbox.js +357 -463
  669. package/unbundled/localized.cjs +79 -74
  670. package/unbundled/localized.js +61 -70
  671. package/unbundled/mixins.cjs +222 -223
  672. package/unbundled/mixins.js +186 -211
  673. package/unbundled/picker-field.template.cjs +188 -217
  674. package/unbundled/picker-field.template.js +165 -208
  675. package/unbundled/playbackRates.cjs +18 -11
  676. package/unbundled/playbackRates.js +13 -9
  677. package/unbundled/scrollIntoView.cjs +38 -43
  678. package/unbundled/scrollIntoView.js +33 -41
  679. package/unbundled/single-date-picker.cjs +48 -45
  680. package/unbundled/single-date-picker.js +43 -43
  681. package/unbundled/single-value-picker.cjs +106 -114
  682. package/unbundled/single-value-picker.js +101 -112
  683. package/unbundled/slider.template.cjs +107 -73
  684. package/unbundled/slider.template.js +67 -62
  685. package/unbundled/slottable-request.cjs +3114 -3503
  686. package/unbundled/slottable-request.js +2995 -3484
  687. package/unbundled/text-field.cjs +9 -5
  688. package/unbundled/text-field.js +4 -3
  689. package/unbundled/time-selection-picker.template.cjs +611 -755
  690. package/unbundled/time-selection-picker.template.js +554 -742
  691. package/unbundled/trapped-focus.cjs +45 -35
  692. package/unbundled/trapped-focus.js +34 -32
  693. package/unbundled/vivid-element.cjs +281 -274
  694. package/unbundled/vivid-element.js +239 -266
  695. package/unbundled/with-contextual-help.cjs +35 -39
  696. package/unbundled/with-contextual-help.js +29 -37
  697. package/unbundled/with-error-text.cjs +45 -55
  698. package/unbundled/with-error-text.js +39 -53
  699. package/unbundled/with-success-text.cjs +18 -22
  700. package/unbundled/with-success-text.js +12 -20
  701. package/video-player/definition.cjs +5 -69835
  702. package/video-player/definition.js +1 -69828
  703. package/video-player/index.cjs +44 -39
  704. package/video-player/index.js +23517 -35507
  705. package/visually-hidden/definition.cjs +5 -30
  706. package/visually-hidden/definition.js +1 -23
  707. package/visually-hidden/index.cjs +1 -1
  708. package/visually-hidden/index.js +5 -2
  709. package/vivid.api.json +150 -1631
  710. package/bundled/index.cjs +0 -1
  711. package/bundled/index.js +0 -6
  712. package/unbundled/_commonjsHelpers.cjs +0 -40
  713. package/unbundled/_commonjsHelpers.js +0 -36
  714. package/unbundled/index.cjs +0 -11
  715. package/unbundled/index.js +0 -9
@@ -1,2350 +1,10 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const icon_definition = require('../icon/definition.cjs');
6
- const vividElement = require('../unbundled/vivid-element.cjs');
7
- const visuallyHidden_definition = require('../visually-hidden/definition.cjs');
8
- const fastElement = require('@microsoft/fast-element');
9
- const _commonjsHelpers = require('../unbundled/_commonjsHelpers.cjs');
10
- const fastWebUtilities = require('@microsoft/fast-web-utilities');
11
- const dataGrid_options = require('../unbundled/data-grid.options.cjs');
12
- const keyCodes = require('../unbundled/key-codes.cjs');
13
- const hostSemantics = require('../unbundled/host-semantics.cjs');
14
- const localized = require('../unbundled/localized.cjs');
15
-
16
- const dataGridStyles = ":host{display:block}:host([generate-header=sticky]){max-block-size:400px}.base{--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.base{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.base ::-webkit-scrollbar{width:4px}.base ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.base ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-fallback-track-color, var(--scrollbar-thumb-color))}.base{position:relative;overflow:auto;block-size:inherit;inline-size:100%;max-block-size:inherit}";
17
-
18
- const dataGridRowStyles = ".base.connotation-cta{--_connotation-color-primary: var(--vvd-data-grid-row-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-data-grid-row-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-row-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-data-grid-row-cta-firm, var(--vvd-color-cta-600));--_connotation-color-faint: var(--vvd-data-grid-row-cta-faint, var(--vvd-color-cta-50));--_connotation-color-soft: var(--vvd-data-grid-row-cta-soft, var(--vvd-color-cta-100));--_connotation-color-pale: var(--vvd-data-grid-row-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-data-grid-row-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-data-grid-row-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-data-grid-row-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-row-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-data-grid-row-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-faint: var(--vvd-data-grid-row-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-data-grid-row-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-pale: var(--vvd-data-grid-row-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-data-grid-row-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}@media(hover:hover){.base:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}}.base.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base.selected:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}@media(hover:hover){.base.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}}.base.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base{display:grid;width:100%;box-sizing:border-box;color:var(--vvd-color-canvas-text)}:host([row-type=sticky-header]) .base{position:sticky;z-index:9;top:0;background:var(--data-grid-row-background, var(--vvd-color-canvas))}:host([row-type=hidden-header]) .base{display:none}:host(:is([selected]):not([row-type*=header])) .base{background-color:var(--_appearance-color-fill)}";
19
-
20
- const dataGridCellStyles = ":host{block-size:100%;min-inline-size:80px}:host(:focus-visible){outline:none}:host([data-fixed]){position:sticky;z-index:5;background:var(--data-grid-cell-background, var(--vvd-color-surface-2dp))}:host([data-fixed]):before{position:absolute;z-index:1;top:0;right:0;width:1px;block-size:100%;box-shadow:4px 0 4px #0000001a,2px 0 2px #0000000d,1px 0 1px #0000000d;content:\"\";pointer-events:none}.base.connotation-cta{--_connotation-color-primary: var(--vvd-data-grid-cell-cta-primary, var(--vvd-color-cta-500));--_connotation-color-primary-text: var(--vvd-data-grid-cell-cta-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-cell-cta-primary-increment, var(--vvd-color-cta-600));--_connotation-color-firm: var(--vvd-data-grid-cell-cta-firm, var(--vvd-color-cta-600));--_connotation-color-soft: var(--vvd-data-grid-cell-cta-soft, var(--vvd-color-cta-100));--_connotation-color-faint: var(--vvd-data-grid-cell-cta-faint, var(--vvd-color-cta-50));--_connotation-color-pale: var(--vvd-data-grid-cell-cta-pale, var(--vvd-color-cta-300));--_connotation-color-dim: var(--vvd-data-grid-cell-cta-dim, var(--vvd-color-cta-200))}.base:not(.connotation-cta){--_connotation-color-primary: var(--vvd-data-grid-cell-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-data-grid-cell-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-data-grid-cell-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-firm: var(--vvd-data-grid-cell-accent-firm, var(--vvd-color-canvas-text));--_connotation-color-soft: var(--vvd-data-grid-cell-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-faint: var(--vvd-data-grid-cell-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-pale: var(--vvd-data-grid-cell-accent-pale, var(--vvd-color-neutral-300));--_connotation-color-dim: var(--vvd-data-grid-cell-accent-dim, var(--vvd-color-neutral-200))}.base{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}@media(hover:hover){.base:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}}.base.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.base.selected:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}@media(hover:hover){.base.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}}.base.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-dim);--_appearance-color-outline: transparent}.base{display:flex;box-sizing:border-box;align-items:center;border-bottom:1px solid var(--vvd-color-neutral-300);block-size:var(--data-grid-cell-block-size, var(--_data-grid-cell-default-block-size));color:var(--_appearance-color-text);font:var(--vvd-typography-base);min-block-size:calc(1px*(48 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-block:13px 14px;padding-inline:12px}:host(:focus-visible) .base{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--focus-stroke-color, var(--vvd-color-cta-500)),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}:host([cell-type=columnheader]) .base{border-color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);--_data-grid-cell-default-block-size: calc(1px*(48 + 4*clamp(-1, var(--vvd-size-density, 0), 2))) ;--_data-grid-cell-default-white-space: nowrap}:host(:not([cell-type=columnheader])) .base{--_data-grid-cell-default-block-size: 100%;--_data-grid-cell-default-white-space: normal}:host(:is([selected]):not([cell-type=columnheader])) .base{background-color:var(--_appearance-color-fill)}.content{display:flex;overflow:hidden;align-items:center}.content[role=button]{cursor:pointer}slot:not([name]){display:block;overflow:hidden;text-overflow:ellipsis;white-space:var(--data-grid-cell-white-space, var(--_data-grid-cell-default-white-space))}:host(:not([cell-type=columnheader][aria-sort])) slot:not([name]){inline-size:100%}.header-icon{flex-shrink:0;margin-inline-start:16px}slot[name=action-items]{display:flex;flex-shrink:0;align-items:center}.base.has-action-items slot[name=action-items]{margin-inline-start:16px}";
21
-
22
- let kernelMode;
23
- const kernelAttr = "fast-kernel";
24
- try {
25
- if (document.currentScript) {
26
- kernelMode = document.currentScript.getAttribute(kernelAttr);
27
- }
28
- else {
29
- const scripts = document.getElementsByTagName("script");
30
- const currentScript = scripts[scripts.length - 1];
31
- kernelMode = currentScript.getAttribute(kernelAttr);
32
- }
33
- }
34
- catch (e) {
35
- kernelMode = "isolate";
36
- }
37
- let KernelServiceId;
38
- switch (kernelMode) {
39
- case "share": // share the kernel across major versions
40
- KernelServiceId = Object.freeze({
41
- updateQueue: 1,
42
- observable: 2,
43
- contextEvent: 3,
44
- elementRegistry: 4,
45
- });
46
- break;
47
- case "share-v2": // only share the kernel with other v2 instances
48
- KernelServiceId = Object.freeze({
49
- updateQueue: 1.2,
50
- observable: 2.2,
51
- contextEvent: 3.2,
52
- elementRegistry: 4.2,
53
- });
54
- break;
55
- default:
56
- // fully isolate the kernel from all other FAST instances
57
- const postfix = `-${Math.random().toString(36).substring(2, 8)}`;
58
- KernelServiceId = Object.freeze({
59
- updateQueue: `1.2${postfix}`,
60
- observable: `2.2${postfix}`,
61
- contextEvent: `3.2${postfix}`,
62
- elementRegistry: `4.2${postfix}`,
63
- });
64
- break;
65
- }
66
- /**
67
- * Determines whether or not an object is a function.
68
- * @public
69
- */
70
- const isFunction = (object) => typeof object === "function";
71
- /**
72
- * Determines whether or not an object is a string.
73
- * @public
74
- */
75
- const isString = (object) => typeof object === "string";
76
- /**
77
- * A function which does nothing.
78
- * @public
79
- */
80
- const noop = () => void 0;
81
-
82
- var polyfills = {};
83
-
84
- /* eslint-disable @typescript-eslint/ban-ts-comment */
85
-
86
- var hasRequiredPolyfills;
87
-
88
- function requirePolyfills () {
89
- if (hasRequiredPolyfills) return polyfills;
90
- hasRequiredPolyfills = 1;
91
- (function ensureGlobalThis() {
92
- if (typeof globalThis !== "undefined") {
93
- // We're running in a modern environment.
94
- return;
95
- }
96
- // @ts-ignore
97
- if (typeof _commonjsHelpers.commonjsGlobal !== "undefined") {
98
- // We're running in NodeJS
99
- // @ts-ignore
100
- _commonjsHelpers.commonjsGlobal.globalThis = _commonjsHelpers.commonjsGlobal;
101
- }
102
- else if (typeof self !== "undefined") {
103
- self.globalThis = self;
104
- }
105
- else if (typeof window !== "undefined") {
106
- // We're running in the browser's main thread.
107
- window.globalThis = window;
108
- }
109
- else {
110
- // Hopefully we never get here...
111
- // Not all environments allow eval and Function. Use only as a last resort:
112
- // eslint-disable-next-line no-new-func
113
- const result = new Function("return this")();
114
- result.globalThis = result;
115
- }
116
- })();
117
- (function requestIdleCallbackPolyfill() {
118
- if ("requestIdleCallback" in globalThis) {
119
- return;
120
- }
121
- /**
122
- * A polyfill for requestIdleCallback that falls back to setTimeout.
123
- *
124
- * @param callback - The function to call when the browser is idle.
125
- * @param options - Options object that may contain a timeout property.
126
- * @returns An ID that can be used to cancel the callback.
127
- * @public
128
- */
129
- globalThis.requestIdleCallback = function requestIdleCallback(callback, options) {
130
- const start = Date.now();
131
- return setTimeout(() => {
132
- callback({
133
- didTimeout: (options === null || options === void 0 ? void 0 : options.timeout)
134
- ? Date.now() - start >= options.timeout
135
- : false,
136
- timeRemaining: () => 0,
137
- });
138
- }, 1);
139
- };
140
- /**
141
- * A polyfill for cancelIdleCallback that falls back to clearTimeout.
142
- *
143
- * @param id - The ID of the callback to cancel.
144
- * @public
145
- */
146
- globalThis.cancelIdleCallback = function cancelIdleCallback(id) {
147
- clearTimeout(id);
148
- };
149
- })();
150
- return polyfills;
151
- }
152
-
153
- requirePolyfills();
154
-
155
- // ensure FAST global - duplicated debug.ts
156
- const propConfig = {
157
- configurable: false,
158
- enumerable: false,
159
- writable: false,
160
- };
161
- if (globalThis.FAST === void 0) {
162
- Reflect.defineProperty(globalThis, "FAST", Object.assign({ value: Object.create(null) }, propConfig));
163
- }
164
- /**
165
- * The FAST global.
166
- * @public
167
- */
168
- const FAST = globalThis.FAST;
169
- if (FAST.getById === void 0) {
170
- const storage = Object.create(null);
171
- Reflect.defineProperty(FAST, "getById", Object.assign({ value(id, initialize) {
172
- let found = storage[id];
173
- if (found === void 0) {
174
- found = initialize ? (storage[id] = initialize()) : null;
175
- }
176
- return found;
177
- } }, propConfig));
178
- }
179
- if (FAST.error === void 0) {
180
- Object.assign(FAST, {
181
- warn() { },
182
- error(code) {
183
- return new Error(`Error ${code}`);
184
- },
185
- addMessages() { },
186
- });
187
- }
188
- /**
189
- * Creates a function capable of locating metadata associated with a type.
190
- * @returns A metadata locator function.
191
- * @internal
192
- */
193
- function createMetadataLocator() {
194
- const metadataLookup = new WeakMap();
195
- return function (target) {
196
- let metadata = metadataLookup.get(target);
197
- if (metadata === void 0) {
198
- let currentTarget = Reflect.getPrototypeOf(target);
199
- while (metadata === void 0 && currentTarget !== null) {
200
- metadata = metadataLookup.get(currentTarget);
201
- currentTarget = Reflect.getPrototypeOf(currentTarget);
202
- }
203
- metadata = metadata === void 0 ? [] : metadata.slice(0);
204
- metadataLookup.set(target, metadata);
205
- }
206
- return metadata;
207
- };
208
- }
209
- /**
210
- * Makes a type noop for JSON serialization.
211
- * @param type - The type to make noop for JSON serialization.
212
- * @internal
213
- */
214
- function makeSerializationNoop(type) {
215
- type.prototype.toJSON = noop;
216
- }
217
-
218
- const createHTML = html => html;
219
- const fastTrustedType = globalThis.trustedTypes
220
- ? globalThis.trustedTypes.createPolicy("fast-html", { createHTML })
221
- : { createHTML };
222
- let defaultPolicy = Object.freeze({
223
- createHTML(value) {
224
- return fastTrustedType.createHTML(value);
225
- },
226
- protect(tagName, aspect, aspectName, sink) {
227
- return sink;
228
- },
229
- });
230
- const fastPolicy = defaultPolicy;
231
- /**
232
- * Common DOM APIs.
233
- * @public
234
- */
235
- const DOM = Object.freeze({
236
- /**
237
- * Gets the dom policy used by the templating system.
238
- */
239
- get policy() {
240
- return defaultPolicy;
241
- },
242
- /**
243
- * Sets the dom policy used by the templating system.
244
- * @param policy - The policy to set.
245
- * @remarks
246
- * This API can only be called once, for security reasons. It should be
247
- * called by the application developer at the start of their program.
248
- */
249
- setPolicy(value) {
250
- if (defaultPolicy !== fastPolicy) {
251
- throw FAST.error(1201 /* Message.onlySetDOMPolicyOnce */);
252
- }
253
- defaultPolicy = value;
254
- },
255
- /**
256
- * Sets an attribute value on an element.
257
- * @param element - The element to set the attribute value on.
258
- * @param attributeName - The attribute name to set.
259
- * @param value - The value of the attribute to set.
260
- * @remarks
261
- * If the value is `null` or `undefined`, the attribute is removed, otherwise
262
- * it is set to the provided value using the standard `setAttribute` API.
263
- */
264
- setAttribute(element, attributeName, value) {
265
- value === null || value === undefined
266
- ? element.removeAttribute(attributeName)
267
- : element.setAttribute(attributeName, value);
268
- },
269
- /**
270
- * Sets a boolean attribute value.
271
- * @param element - The element to set the boolean attribute value on.
272
- * @param attributeName - The attribute name to set.
273
- * @param value - The value of the attribute to set.
274
- * @remarks
275
- * If the value is true, the attribute is added; otherwise it is removed.
276
- */
277
- setBooleanAttribute(element, attributeName, value) {
278
- value
279
- ? element.setAttribute(attributeName, "")
280
- : element.removeAttribute(attributeName);
281
- },
282
- });
283
-
284
- /**
285
- * The default UpdateQueue.
286
- * @public
287
- */
288
- const Updates = FAST.getById(KernelServiceId.updateQueue, () => {
289
- const tasks = [];
290
- const pendingErrors = [];
291
- const rAF = globalThis.requestAnimationFrame;
292
- let updateAsync = true;
293
- function throwFirstError() {
294
- if (pendingErrors.length) {
295
- throw pendingErrors.shift();
296
- }
297
- }
298
- function tryRunTask(task) {
299
- try {
300
- task.call();
301
- }
302
- catch (error) {
303
- if (updateAsync) {
304
- pendingErrors.push(error);
305
- setTimeout(throwFirstError, 0);
306
- }
307
- else {
308
- tasks.length = 0;
309
- throw error;
310
- }
311
- }
312
- }
313
- function process() {
314
- const capacity = 1024;
315
- let index = 0;
316
- while (index < tasks.length) {
317
- tryRunTask(tasks[index]);
318
- index++;
319
- // Prevent leaking memory for long chains of recursive calls to `enqueue`.
320
- // If we call `enqueue` within a task scheduled by `enqueue`, the queue will
321
- // grow, but to avoid an O(n) walk for every task we execute, we don't
322
- // shift tasks off the queue after they have been executed.
323
- // Instead, we periodically shift 1024 tasks off the queue.
324
- if (index > capacity) {
325
- // Manually shift all values starting at the index back to the
326
- // beginning of the queue.
327
- for (let scan = 0, newLength = tasks.length - index; scan < newLength; scan++) {
328
- tasks[scan] = tasks[scan + index];
329
- }
330
- tasks.length -= index;
331
- index = 0;
332
- }
333
- }
334
- tasks.length = 0;
335
- }
336
- function enqueue(callable) {
337
- tasks.push(callable);
338
- if (tasks.length < 2) {
339
- updateAsync ? rAF(process) : process();
340
- }
341
- }
342
- return Object.freeze({
343
- enqueue,
344
- next: () => new Promise(enqueue),
345
- process,
346
- setMode: (isAsync) => (updateAsync = isAsync),
347
- });
348
- });
349
-
350
- /**
351
- * An implementation of {@link Notifier} that efficiently keeps track of
352
- * subscribers interested in a specific change notification on an
353
- * observable subject.
354
- *
355
- * @remarks
356
- * This set is optimized for the most common scenario of 1 or 2 subscribers.
357
- * With this in mind, it can store a subscriber in an internal field, allowing it to avoid Array#push operations.
358
- * If the set ever exceeds two subscribers, it upgrades to an array automatically.
359
- * @public
360
- */
361
- class SubscriberSet {
362
- /**
363
- * Creates an instance of SubscriberSet for the specified subject.
364
- * @param subject - The subject that subscribers will receive notifications from.
365
- * @param initialSubscriber - An initial subscriber to changes.
366
- */
367
- constructor(subject, initialSubscriber) {
368
- this.sub1 = void 0;
369
- this.sub2 = void 0;
370
- this.spillover = void 0;
371
- this.subject = subject;
372
- this.sub1 = initialSubscriber;
373
- }
374
- /**
375
- * Checks whether the provided subscriber has been added to this set.
376
- * @param subscriber - The subscriber to test for inclusion in this set.
377
- */
378
- has(subscriber) {
379
- return this.spillover === void 0
380
- ? this.sub1 === subscriber || this.sub2 === subscriber
381
- : this.spillover.indexOf(subscriber) !== -1;
382
- }
383
- /**
384
- * Subscribes to notification of changes in an object's state.
385
- * @param subscriber - The object that is subscribing for change notification.
386
- */
387
- subscribe(subscriber) {
388
- const spillover = this.spillover;
389
- if (spillover === void 0) {
390
- if (this.has(subscriber)) {
391
- return;
392
- }
393
- if (this.sub1 === void 0) {
394
- this.sub1 = subscriber;
395
- return;
396
- }
397
- if (this.sub2 === void 0) {
398
- this.sub2 = subscriber;
399
- return;
400
- }
401
- this.spillover = [this.sub1, this.sub2, subscriber];
402
- this.sub1 = void 0;
403
- this.sub2 = void 0;
404
- }
405
- else {
406
- const index = spillover.indexOf(subscriber);
407
- if (index === -1) {
408
- spillover.push(subscriber);
409
- }
410
- }
411
- }
412
- /**
413
- * Unsubscribes from notification of changes in an object's state.
414
- * @param subscriber - The object that is unsubscribing from change notification.
415
- */
416
- unsubscribe(subscriber) {
417
- const spillover = this.spillover;
418
- if (spillover === void 0) {
419
- if (this.sub1 === subscriber) {
420
- this.sub1 = void 0;
421
- }
422
- else if (this.sub2 === subscriber) {
423
- this.sub2 = void 0;
424
- }
425
- }
426
- else {
427
- const index = spillover.indexOf(subscriber);
428
- if (index !== -1) {
429
- spillover.splice(index, 1);
430
- }
431
- }
432
- }
433
- /**
434
- * Notifies all subscribers.
435
- * @param args - Data passed along to subscribers during notification.
436
- */
437
- notify(args) {
438
- const spillover = this.spillover;
439
- const subject = this.subject;
440
- if (spillover === void 0) {
441
- const sub1 = this.sub1;
442
- const sub2 = this.sub2;
443
- if (sub1 !== void 0) {
444
- sub1.handleChange(subject, args);
445
- }
446
- if (sub2 !== void 0) {
447
- sub2.handleChange(subject, args);
448
- }
449
- }
450
- else {
451
- for (let i = 0, ii = spillover.length; i < ii; ++i) {
452
- spillover[i].handleChange(subject, args);
453
- }
454
- }
455
- }
456
- }
457
- /**
458
- * An implementation of Notifier that allows subscribers to be notified
459
- * of individual property changes on an object.
460
- * @public
461
- */
462
- class PropertyChangeNotifier {
463
- /**
464
- * Creates an instance of PropertyChangeNotifier for the specified subject.
465
- * @param subject - The object that subscribers will receive notifications for.
466
- */
467
- constructor(subject) {
468
- this.subscribers = {};
469
- this.subjectSubscribers = null;
470
- this.subject = subject;
471
- }
472
- /**
473
- * Notifies all subscribers, based on the specified property.
474
- * @param propertyName - The property name, passed along to subscribers during notification.
475
- */
476
- notify(propertyName) {
477
- var _a, _b;
478
- (_a = this.subscribers[propertyName]) === null || _a === void 0 ? void 0 : _a.notify(propertyName);
479
- (_b = this.subjectSubscribers) === null || _b === void 0 ? void 0 : _b.notify(propertyName);
480
- }
481
- /**
482
- * Subscribes to notification of changes in an object's state.
483
- * @param subscriber - The object that is subscribing for change notification.
484
- * @param propertyToWatch - The name of the property that the subscriber is interested in watching for changes.
485
- */
486
- subscribe(subscriber, propertyToWatch) {
487
- var _a, _b;
488
- let subscribers;
489
- if (propertyToWatch) {
490
- subscribers =
491
- (_a = this.subscribers[propertyToWatch]) !== null && _a !== void 0 ? _a : (this.subscribers[propertyToWatch] = new SubscriberSet(this.subject));
492
- }
493
- else {
494
- subscribers =
495
- (_b = this.subjectSubscribers) !== null && _b !== void 0 ? _b : (this.subjectSubscribers = new SubscriberSet(this.subject));
496
- }
497
- subscribers.subscribe(subscriber);
498
- }
499
- /**
500
- * Unsubscribes from notification of changes in an object's state.
501
- * @param subscriber - The object that is unsubscribing from change notification.
502
- * @param propertyToUnwatch - The name of the property that the subscriber is no longer interested in watching.
503
- */
504
- unsubscribe(subscriber, propertyToUnwatch) {
505
- var _a, _b;
506
- if (propertyToUnwatch) {
507
- (_a = this.subscribers[propertyToUnwatch]) === null || _a === void 0 ? void 0 : _a.unsubscribe(subscriber);
508
- }
509
- else {
510
- (_b = this.subjectSubscribers) === null || _b === void 0 ? void 0 : _b.unsubscribe(subscriber);
511
- }
512
- }
513
- }
514
-
515
- /**
516
- * Describes how the source's lifetime relates to its controller's lifetime.
517
- * @public
518
- */
519
- const SourceLifetime = Object.freeze({
520
- /**
521
- * The source to controller lifetime relationship is unknown.
522
- */
523
- unknown: void 0,
524
- /**
525
- * The source and controller lifetimes are coupled to one another.
526
- * They can/will be GC'd together.
527
- */
528
- coupled: 1,
529
- });
530
- /**
531
- * Common Observable APIs.
532
- * @public
533
- */
534
- FAST.getById(KernelServiceId.observable, () => {
535
- const queueUpdate = Updates.enqueue;
536
- const volatileRegex = /(:|&&|\|\||if|\?\.)/;
537
- const notifierLookup = new WeakMap();
538
- let watcher = void 0;
539
- let createArrayObserver = (array) => {
540
- throw FAST.error(1101 /* Message.needsArrayObservation */);
541
- };
542
- function getNotifier(source) {
543
- var _a;
544
- let found = (_a = source.$fastController) !== null && _a !== void 0 ? _a : notifierLookup.get(source);
545
- if (found === void 0) {
546
- Array.isArray(source)
547
- ? (found = createArrayObserver(source))
548
- : notifierLookup.set(source, (found = new PropertyChangeNotifier(source)));
549
- }
550
- return found;
551
- }
552
- const getAccessors = createMetadataLocator();
553
- class DefaultObservableAccessor {
554
- constructor(name) {
555
- this.name = name;
556
- this.field = `_${name}`;
557
- this.callback = `${name}Changed`;
558
- }
559
- getValue(source) {
560
- if (watcher !== void 0) {
561
- watcher.watch(source, this.name);
562
- }
563
- return source[this.field];
564
- }
565
- setValue(source, newValue) {
566
- const field = this.field;
567
- const oldValue = source[field];
568
- if (oldValue !== newValue) {
569
- source[field] = newValue;
570
- const callback = source[this.callback];
571
- if (isFunction(callback)) {
572
- callback.call(source, oldValue, newValue);
573
- }
574
- getNotifier(source).notify(this.name);
575
- }
576
- }
577
- }
578
- class ExpressionNotifierImplementation extends SubscriberSet {
579
- constructor(expression, initialSubscriber, isVolatileBinding = false) {
580
- super(expression, initialSubscriber);
581
- this.expression = expression;
582
- this.isVolatileBinding = isVolatileBinding;
583
- this.needsRefresh = true;
584
- this.needsQueue = true;
585
- this.isAsync = true;
586
- this.first = this;
587
- this.last = null;
588
- this.propertySource = void 0;
589
- this.propertyName = void 0;
590
- this.notifier = void 0;
591
- this.next = void 0;
592
- }
593
- setMode(isAsync) {
594
- this.isAsync = this.needsQueue = isAsync;
595
- }
596
- bind(controller) {
597
- this.controller = controller;
598
- const value = this.observe(controller.source, controller.context);
599
- if (!controller.isBound && this.requiresUnbind(controller)) {
600
- controller.onUnbind(this);
601
- }
602
- return value;
603
- }
604
- requiresUnbind(controller) {
605
- return (controller.sourceLifetime !== SourceLifetime.coupled ||
606
- this.first !== this.last ||
607
- this.first.propertySource !== controller.source);
608
- }
609
- unbind(controller) {
610
- this.dispose();
611
- }
612
- observe(source, context) {
613
- if (this.needsRefresh && this.last !== null) {
614
- this.dispose();
615
- }
616
- const previousWatcher = watcher;
617
- watcher = this.needsRefresh ? this : void 0;
618
- this.needsRefresh = this.isVolatileBinding;
619
- let result;
620
- try {
621
- result = this.expression(source, context);
622
- }
623
- finally {
624
- watcher = previousWatcher;
625
- }
626
- return result;
627
- }
628
- // backwards compat with v1 kernel
629
- disconnect() {
630
- this.dispose();
631
- }
632
- dispose() {
633
- if (this.last !== null) {
634
- let current = this.first;
635
- while (current !== void 0) {
636
- current.notifier.unsubscribe(this, current.propertyName);
637
- current = current.next;
638
- }
639
- this.last = null;
640
- this.needsRefresh = this.needsQueue = this.isAsync;
641
- }
642
- }
643
- watch(propertySource, propertyName) {
644
- const prev = this.last;
645
- const notifier = getNotifier(propertySource);
646
- const current = prev === null ? this.first : {};
647
- current.propertySource = propertySource;
648
- current.propertyName = propertyName;
649
- current.notifier = notifier;
650
- notifier.subscribe(this, propertyName);
651
- if (prev !== null) {
652
- if (!this.needsRefresh) {
653
- // Declaring the variable prior to assignment below circumvents
654
- // a bug in Angular's optimization process causing infinite recursion
655
- // of this watch() method. Details https://github.com/microsoft/fast/issues/4969
656
- let prevValue;
657
- watcher = void 0;
658
- /* eslint-disable-next-line */
659
- prevValue = prev.propertySource[prev.propertyName];
660
- /* eslint-disable-next-line */
661
- watcher = this;
662
- if (propertySource === prevValue) {
663
- this.needsRefresh = true;
664
- }
665
- }
666
- prev.next = current;
667
- }
668
- this.last = current;
669
- }
670
- handleChange() {
671
- if (this.needsQueue) {
672
- this.needsQueue = false;
673
- queueUpdate(this);
674
- }
675
- else if (!this.isAsync) {
676
- this.call();
677
- }
678
- }
679
- call() {
680
- if (this.last !== null) {
681
- this.needsQueue = this.isAsync;
682
- this.notify(this);
683
- }
684
- }
685
- *records() {
686
- let next = this.first;
687
- while (next !== void 0) {
688
- yield next;
689
- next = next.next;
690
- }
691
- }
692
- }
693
- makeSerializationNoop(ExpressionNotifierImplementation);
694
- return Object.freeze({
695
- /**
696
- * @internal
697
- * @param factory - The factory used to create array observers.
698
- */
699
- setArrayObserverFactory(factory) {
700
- createArrayObserver = factory;
701
- },
702
- /**
703
- * Gets a notifier for an object or Array.
704
- * @param source - The object or Array to get the notifier for.
705
- */
706
- getNotifier,
707
- /**
708
- * Records a property change for a source object.
709
- * @param source - The object to record the change against.
710
- * @param propertyName - The property to track as changed.
711
- */
712
- track(source, propertyName) {
713
- watcher && watcher.watch(source, propertyName);
714
- },
715
- /**
716
- * Notifies watchers that the currently executing property getter or function is volatile
717
- * with respect to its observable dependencies.
718
- */
719
- trackVolatile() {
720
- watcher && (watcher.needsRefresh = true);
721
- },
722
- /**
723
- * Notifies subscribers of a source object of changes.
724
- * @param source - the object to notify of changes.
725
- * @param args - The change args to pass to subscribers.
726
- */
727
- notify(source, args) {
728
- /* eslint-disable-next-line @typescript-eslint/no-use-before-define */
729
- getNotifier(source).notify(args);
730
- },
731
- /**
732
- * Defines an observable property on an object or prototype.
733
- * @param target - The target object to define the observable on.
734
- * @param nameOrAccessor - The name of the property to define as observable;
735
- * or a custom accessor that specifies the property name and accessor implementation.
736
- */
737
- defineProperty(target, nameOrAccessor) {
738
- if (isString(nameOrAccessor)) {
739
- nameOrAccessor = new DefaultObservableAccessor(nameOrAccessor);
740
- }
741
- getAccessors(target).push(nameOrAccessor);
742
- Reflect.defineProperty(target, nameOrAccessor.name, {
743
- enumerable: true,
744
- get() {
745
- return nameOrAccessor.getValue(this);
746
- },
747
- set(newValue) {
748
- nameOrAccessor.setValue(this, newValue);
749
- },
750
- });
751
- },
752
- /**
753
- * Finds all the observable accessors defined on the target,
754
- * including its prototype chain.
755
- * @param target - The target object to search for accessor on.
756
- */
757
- getAccessors,
758
- /**
759
- * Creates a {@link ExpressionNotifier} that can watch the
760
- * provided {@link Expression} for changes.
761
- * @param expression - The binding to observe.
762
- * @param initialSubscriber - An initial subscriber to changes in the binding value.
763
- * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
764
- */
765
- binding(expression, initialSubscriber, isVolatileBinding = this.isVolatileBinding(expression)) {
766
- return new ExpressionNotifierImplementation(expression, initialSubscriber, isVolatileBinding);
767
- },
768
- /**
769
- * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
770
- * on every evaluation of the value.
771
- * @param expression - The binding to inspect.
772
- */
773
- isVolatileBinding(expression) {
774
- return volatileRegex.test(expression.toString());
775
- },
776
- });
777
- });
778
- const contextEvent = FAST.getById(KernelServiceId.contextEvent, () => {
779
- let current = null;
780
- return {
781
- get() {
782
- return current;
783
- },
784
- set(event) {
785
- current = event;
786
- },
787
- };
788
- });
789
- /**
790
- * Provides additional contextual information available to behaviors and expressions.
791
- * @public
792
- */
793
- const ExecutionContext = Object.freeze({
794
- /**
795
- * A default execution context.
796
- */
797
- default: {
798
- index: 0,
799
- length: 0,
800
- get event() {
801
- return ExecutionContext.getEvent();
802
- },
803
- eventDetail() {
804
- return this.event.detail;
805
- },
806
- eventTarget() {
807
- return this.event.target;
808
- },
809
- },
810
- /**
811
- * Gets the current event.
812
- * @returns An event object.
813
- */
814
- getEvent() {
815
- return contextEvent.get();
816
- },
817
- /**
818
- * Sets the current event.
819
- * @param event - An event object.
820
- */
821
- setEvent(event) {
822
- contextEvent.set(event);
823
- },
824
- });
825
-
826
- const marker = `fast-${Math.random().toString(36).substring(2, 8)}`;
827
- let id = 0;
828
- /** @internal */
829
- const nextId = () => `${marker}-${++id}`;
830
-
831
- /**
832
- * Bridges between ViewBehaviors and HostBehaviors, enabling a host to
833
- * control ViewBehaviors.
834
- * @public
835
- */
836
- const ViewBehaviorOrchestrator = Object.freeze({
837
- /**
838
- * Creates a ViewBehaviorOrchestrator.
839
- * @param source - The source to to associate behaviors with.
840
- * @returns A ViewBehaviorOrchestrator.
841
- */
842
- create(source) {
843
- const behaviors = [];
844
- const targets = {};
845
- let unbindables = null;
846
- let isConnected = false;
847
- return {
848
- source,
849
- context: ExecutionContext.default,
850
- targets,
851
- get isBound() {
852
- return isConnected;
853
- },
854
- addBehaviorFactory(factory, target) {
855
- var _a, _b, _c, _d;
856
- const compiled = factory;
857
- compiled.id = (_a = compiled.id) !== null && _a !== void 0 ? _a : nextId();
858
- compiled.targetNodeId = (_b = compiled.targetNodeId) !== null && _b !== void 0 ? _b : nextId();
859
- compiled.targetTagName = (_c = target.tagName) !== null && _c !== void 0 ? _c : null;
860
- compiled.policy = (_d = compiled.policy) !== null && _d !== void 0 ? _d : DOM.policy;
861
- this.addTarget(compiled.targetNodeId, target);
862
- this.addBehavior(compiled.createBehavior());
863
- },
864
- addTarget(nodeId, target) {
865
- targets[nodeId] = target;
866
- },
867
- addBehavior(behavior) {
868
- behaviors.push(behavior);
869
- if (isConnected) {
870
- behavior.bind(this);
871
- }
872
- },
873
- onUnbind(unbindable) {
874
- if (unbindables === null) {
875
- unbindables = [];
876
- }
877
- unbindables.push(unbindable);
878
- },
879
- connectedCallback(controller) {
880
- if (!isConnected) {
881
- isConnected = true;
882
- behaviors.forEach(x => x.bind(this));
883
- }
884
- },
885
- disconnectedCallback(controller) {
886
- if (isConnected) {
887
- isConnected = false;
888
- if (unbindables !== null) {
889
- unbindables.forEach(x => x.unbind(this));
890
- }
891
- }
892
- },
893
- };
894
- },
895
- });
896
-
897
- var __defProp$2 = Object.defineProperty;
898
- var __decorateClass$2 = (decorators, target, key, kind) => {
899
- var result = void 0 ;
900
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
901
- if (decorator = decorators[i])
902
- result = (decorator(target, key, result) ) || result;
903
- if (result) __defProp$2(target, key, result);
904
- return result;
905
- };
906
- const defaultCellContentsTemplate = fastElement.html`
907
- <template>
908
- ${(x) => x.rowData === null || x.columnDefinition === null || x.columnDefinition.columnDataKey === null ? null : x.rowData[x.columnDefinition.columnDataKey]}
909
- </template>
910
- `;
911
- const defaultHeaderCellContentsTemplate = fastElement.html`
912
- <template>
913
- ${(x) => x.columnDefinition.title === void 0 ? x.columnDefinition.columnDataKey : x.columnDefinition.title}
914
- </template>
915
- `;
916
- class DataGridCell extends localized.Localized(hostSemantics.HostSemantics(vividElement.VividElement)) {
917
- constructor() {
918
- super(...arguments);
919
- // eslint-disable-next-line @repo/repo/no-attribute-default-value
920
- this.cellType = dataGrid_options.DataGridCellTypes.default;
921
- this.rowData = null;
922
- this.columnDefinition = null;
923
- this.isActiveCell = false;
924
- this.customCellView = null;
925
- this.updateCellStyle = () => {
926
- if (this.gridColumn && !this.gridColumn.includes("undefined")) {
927
- this.style.gridColumn = this.gridColumn;
928
- } else {
929
- this.style.removeProperty("grid-column");
930
- }
931
- };
932
- this._selectable = false;
933
- this.selected = false;
934
- /**
935
- * Indicates the selected status.
936
- *
937
- * @deprecated For setting selected state, please use `selected` property instead.
938
- * @public
939
- * HTML Attribute: aria-selected
940
- */
941
- this.ariaSelected = null;
942
- /**
943
- * Indicates the sort status.
944
- *
945
- * @deprecated To set the sorting visual style please use `sortDirection` property.
946
- * @public
947
- * HTML Attribute: aria-sort
948
- */
949
- this.ariaSort = null;
950
- }
951
- /**
952
- * @internal
953
- */
954
- cellTypeChanged() {
955
- if (this.$fastController.isConnected) {
956
- this.updateCellView();
957
- }
958
- }
959
- /**
960
- * @internal
961
- */
962
- gridColumnChanged() {
963
- if (this.$fastController.isConnected) {
964
- this.updateCellStyle();
965
- }
966
- }
967
- /**
968
- * @internal
969
- */
970
- columnDefinitionChanged(_oldValue, _newValue) {
971
- if (this.$fastController.isConnected) {
972
- this.updateCellView();
973
- }
974
- }
975
- /**
976
- * Updates the fixed column style
977
- * @internal
978
- */
979
- updateFixedStyle() {
980
- if (this.fixedPosition !== void 0) {
981
- this.setAttribute("data-fixed", "");
982
- this.style.left = this.fixedPosition;
983
- } else {
984
- this.removeAttribute("data-fixed");
985
- this.style.removeProperty("left");
986
- }
987
- }
988
- /**
989
- * Sets the fixed state and position for this cell
990
- * @internal
991
- */
992
- setFixedPosition(position) {
993
- this.fixedPosition = position;
994
- this.updateFixedStyle();
995
- }
996
- /**
997
- * @internal
998
- */
999
- connectedCallback() {
1000
- super.connectedCallback();
1001
- this.addEventListener(fastWebUtilities.eventFocusIn, this.handleFocusin);
1002
- this.addEventListener(fastWebUtilities.eventFocusOut, this.handleFocusout);
1003
- this.addEventListener(fastWebUtilities.eventKeyDown, this.handleKeydown);
1004
- this.style.gridColumn = `${this.columnDefinition?.gridColumn === void 0 ? 0 : this.columnDefinition.gridColumn}`;
1005
- this.updateCellView();
1006
- this.updateCellStyle();
1007
- this.updateFixedStyle();
1008
- }
1009
- /**
1010
- * @internal
1011
- */
1012
- disconnectedCallback() {
1013
- super.disconnectedCallback();
1014
- this.removeEventListener(fastWebUtilities.eventFocusIn, this.handleFocusin);
1015
- this.removeEventListener(
1016
- fastWebUtilities.eventFocusOut,
1017
- this.handleFocusout
1018
- );
1019
- this.removeEventListener(fastWebUtilities.eventKeyDown, this.handleKeydown);
1020
- this.disconnectCellView();
1021
- }
1022
- handleFocusin(_) {
1023
- this.shadowRoot.querySelector(".base").classList.add("active");
1024
- if (this.isActiveCell) {
1025
- return;
1026
- }
1027
- this.isActiveCell = true;
1028
- switch (this.cellType) {
1029
- case dataGrid_options.DataGridCellTypes.columnHeader:
1030
- if (this.columnDefinition !== null && this.columnDefinition.headerCellInternalFocusQueue !== true && typeof this.columnDefinition.headerCellFocusTargetCallback === "function") {
1031
- const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
1032
- if (focusTarget !== null) {
1033
- focusTarget.focus();
1034
- }
1035
- }
1036
- break;
1037
- default:
1038
- if (this.columnDefinition !== null && this.columnDefinition.cellInternalFocusQueue !== true && typeof this.columnDefinition.cellFocusTargetCallback === "function") {
1039
- const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
1040
- if (focusTarget !== null) {
1041
- focusTarget.focus();
1042
- }
1043
- }
1044
- break;
1045
- }
1046
- this.$emit("cell-focused", this);
1047
- }
1048
- handleFocusout(_) {
1049
- this.shadowRoot.querySelector(".base").classList.remove("active");
1050
- if (this !== document.activeElement && !this.contains(document.activeElement)) {
1051
- this.isActiveCell = false;
1052
- }
1053
- }
1054
- handleKeydown(e) {
1055
- if (e.defaultPrevented || this.columnDefinition === null || this.cellType === dataGrid_options.DataGridCellTypes.default && this.columnDefinition.cellInternalFocusQueue !== true || this.cellType === dataGrid_options.DataGridCellTypes.columnHeader && this.columnDefinition.headerCellInternalFocusQueue !== true) {
1056
- return;
1057
- }
1058
- switch (e.key) {
1059
- case fastWebUtilities.keyEnter:
1060
- case fastWebUtilities.keyFunction2:
1061
- if (this.contains(document.activeElement) && document.activeElement !== this) {
1062
- return;
1063
- }
1064
- switch (this.cellType) {
1065
- case dataGrid_options.DataGridCellTypes.columnHeader: {
1066
- if (this.columnDefinition.headerCellFocusTargetCallback !== void 0) {
1067
- const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
1068
- if (focusTarget !== null) {
1069
- focusTarget.focus();
1070
- }
1071
- e.preventDefault();
1072
- }
1073
- break;
1074
- }
1075
- default: {
1076
- if (this.columnDefinition.cellFocusTargetCallback !== void 0) {
1077
- const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
1078
- if (focusTarget !== null) {
1079
- focusTarget.focus();
1080
- }
1081
- e.preventDefault();
1082
- }
1083
- break;
1084
- }
1085
- }
1086
- break;
1087
- case fastWebUtilities.keyEscape: {
1088
- if (this.contains(document.activeElement) && document.activeElement !== this) {
1089
- this.focus();
1090
- e.preventDefault();
1091
- }
1092
- break;
1093
- }
1094
- }
1095
- }
1096
- updateCellView() {
1097
- this.disconnectCellView();
1098
- if (this.columnDefinition === null) {
1099
- return;
1100
- }
1101
- switch (this.cellType) {
1102
- case dataGrid_options.DataGridCellTypes.columnHeader:
1103
- if (this.columnDefinition.headerCellTemplate !== void 0) {
1104
- this.customCellView = this.columnDefinition.headerCellTemplate.render(
1105
- this,
1106
- this
1107
- );
1108
- } else {
1109
- this.customCellView = defaultHeaderCellContentsTemplate.render(
1110
- this,
1111
- this
1112
- );
1113
- }
1114
- break;
1115
- case dataGrid_options.DataGridCellTypes.rowHeader:
1116
- case dataGrid_options.DataGridCellTypes.default:
1117
- if (this.columnDefinition.cellTemplate !== void 0) {
1118
- this.customCellView = this.columnDefinition.cellTemplate.render(
1119
- this,
1120
- this
1121
- );
1122
- } else {
1123
- this.customCellView = defaultCellContentsTemplate.render(this, this);
1124
- }
1125
- break;
1126
- }
1127
- if (!this.columnDefinition?.sortable) {
1128
- this.sortDirection = void 0;
1129
- } else if (this.columnDefinition.sortDirection) {
1130
- this.sortDirection = this.columnDefinition.sortDirection;
1131
- } else {
1132
- this.sortDirection = dataGrid_options.DataGridCellSortStates.none;
1133
- }
1134
- }
1135
- disconnectCellView() {
1136
- if (this.customCellView !== null) {
1137
- this.customCellView.dispose();
1138
- this.customCellView = null;
1139
- }
1140
- }
1141
- /**
1142
- * @internal
1143
- */
1144
- ariaSelectedChanged(prevValue, newValue) {
1145
- super.ariaSelectedChanged(prevValue, newValue);
1146
- this._selectable = newValue !== null;
1147
- this.selected = newValue === "true";
1148
- }
1149
- /**
1150
- * @internal
1151
- */
1152
- ariaSortChanged(oldValue, newValue) {
1153
- super.ariaSortChanged(oldValue, newValue);
1154
- if (newValue === null) {
1155
- this.sortDirection = void 0;
1156
- return;
1157
- }
1158
- this.sortDirection = newValue;
1159
- }
1160
- #getColumnDataKey() {
1161
- return this.columnDefinition && this.columnDefinition.columnDataKey ? this.columnDefinition.columnDataKey : this.textContent.trim();
1162
- }
1163
- /**
1164
- * @internal
1165
- */
1166
- _handleInteraction() {
1167
- const isHeaderCell = this.cellType === "columnheader";
1168
- const isSortable = isHeaderCell && this.sortDirection !== void 0;
1169
- if (isSortable) {
1170
- this.$emit("sort", {
1171
- columnDataKey: this.#getColumnDataKey(),
1172
- sortDirection: this.sortDirection
1173
- });
1174
- }
1175
- const hasInternalFocusQueue = isHeaderCell ? this.columnDefinition?.headerCellInternalFocusQueue : this.columnDefinition?.cellInternalFocusQueue;
1176
- if (!hasInternalFocusQueue) {
1177
- this.$emit("cell-click", {
1178
- cell: this,
1179
- row: this.parentElement,
1180
- isHeaderCell,
1181
- columnDataKey: this.#getColumnDataKey()
1182
- });
1183
- }
1184
- return true;
1185
- }
1186
- }
1187
- __decorateClass$2([
1188
- fastElement.attr({ attribute: "cell-type" })
1189
- ], DataGridCell.prototype, "cellType");
1190
- __decorateClass$2([
1191
- fastElement.attr({ attribute: "grid-column" })
1192
- ], DataGridCell.prototype, "gridColumn");
1193
- __decorateClass$2([
1194
- fastElement.observable
1195
- ], DataGridCell.prototype, "rowData");
1196
- __decorateClass$2([
1197
- fastElement.observable
1198
- ], DataGridCell.prototype, "columnDefinition");
1199
- __decorateClass$2([
1200
- fastElement.observable
1201
- ], DataGridCell.prototype, "_selectable");
1202
- __decorateClass$2([
1203
- fastElement.attr({ mode: "boolean" })
1204
- ], DataGridCell.prototype, "selected");
1205
- __decorateClass$2([
1206
- fastElement.attr({ attribute: "sort-direction" })
1207
- ], DataGridCell.prototype, "sortDirection");
1208
- __decorateClass$2([
1209
- fastElement.observable
1210
- ], DataGridCell.prototype, "_actionItemsSlottedContent");
1211
-
1212
- var __defProp$1 = Object.defineProperty;
1213
- var __decorateClass$1 = (decorators, target, key, kind) => {
1214
- var result = void 0 ;
1215
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
1216
- if (decorator = decorators[i])
1217
- result = (decorator(target, key, result) ) || result;
1218
- if (result) __defProp$1(target, key, result);
1219
- return result;
1220
- };
1221
- class DataGridRow extends hostSemantics.HostSemantics(vividElement.VividElement) {
1222
- constructor() {
1223
- super(...arguments);
1224
- // eslint-disable-next-line @repo/repo/no-attribute-default-value
1225
- this.rowType = dataGrid_options.DataGridRowTypes.default;
1226
- this.rowData = null;
1227
- this.columnDefinitions = null;
1228
- this.behaviorOrchestrator = null;
1229
- /**
1230
- * @internal
1231
- */
1232
- this.focusColumnIndex = 0;
1233
- this.updateRowStyle = () => {
1234
- this.style.gridTemplateColumns = this.gridTemplateColumns;
1235
- };
1236
- /**
1237
- * Indicates the selected status.
1238
- *
1239
- * @deprecated
1240
- * @public
1241
- * HTML Attribute: aria-selected
1242
- */
1243
- this.ariaSelected = null;
1244
- this._selectable = false;
1245
- this.selected = false;
1246
- }
1247
- /**
1248
- * @internal
1249
- */
1250
- gridTemplateColumnsChanged() {
1251
- if (this.$fastController.isConnected) {
1252
- this.updateRowStyle();
1253
- }
1254
- }
1255
- /**
1256
- * @internal
1257
- */
1258
- rowTypeChanged() {
1259
- if (this.$fastController.isConnected) {
1260
- this.updateItemTemplate();
1261
- }
1262
- }
1263
- /**
1264
- * @internal
1265
- */
1266
- cellItemTemplateChanged() {
1267
- this.updateItemTemplate();
1268
- }
1269
- /**
1270
- * @internal
1271
- */
1272
- headerCellItemTemplateChanged() {
1273
- this.updateItemTemplate();
1274
- }
1275
- /**
1276
- * @internal
1277
- */
1278
- connectedCallback() {
1279
- super.connectedCallback();
1280
- if (this.behaviorOrchestrator === null) {
1281
- this.updateItemTemplate();
1282
- this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
1283
- this.$fastController.addBehavior(this.behaviorOrchestrator);
1284
- this.behaviorOrchestrator.addBehaviorFactory(
1285
- new fastElement.RepeatDirective(
1286
- fastElement.normalizeBinding((x) => x.columnDefinitions),
1287
- fastElement.normalizeBinding((x) => x.activeCellItemTemplate),
1288
- { positioning: true }
1289
- ),
1290
- this.appendChild(document.createComment(""))
1291
- );
1292
- }
1293
- this.addEventListener("cell-focused", this.handleCellFocus);
1294
- this.addEventListener(fastWebUtilities.eventFocusOut, this.handleFocusout);
1295
- this.addEventListener(fastWebUtilities.eventKeyDown, this.handleKeydown);
1296
- this.updateRowStyle();
1297
- }
1298
- /**
1299
- * @internal
1300
- */
1301
- disconnectedCallback() {
1302
- super.disconnectedCallback();
1303
- this.removeEventListener("cell-focused", this.handleCellFocus);
1304
- this.removeEventListener(
1305
- fastWebUtilities.eventFocusOut,
1306
- this.handleFocusout
1307
- );
1308
- this.removeEventListener(fastWebUtilities.eventKeyDown, this.handleKeydown);
1309
- }
1310
- handleFocusout(_) {
1311
- if (!this.contains(document.activeElement)) {
1312
- this.focusColumnIndex = 0;
1313
- }
1314
- }
1315
- handleCellFocus(e) {
1316
- this.focusColumnIndex = this.cellElements.indexOf(e.target);
1317
- this.$emit("row-focused", this);
1318
- }
1319
- handleKeydown(e) {
1320
- if (e.defaultPrevented) {
1321
- return;
1322
- }
1323
- let newFocusColumnIndex = 0;
1324
- switch (e.key) {
1325
- case keyCodes.keyArrowLeft:
1326
- newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
1327
- this.cellElements[newFocusColumnIndex].focus();
1328
- e.preventDefault();
1329
- break;
1330
- case keyCodes.keyArrowRight:
1331
- newFocusColumnIndex = Math.min(
1332
- this.cellElements.length - 1,
1333
- this.focusColumnIndex + 1
1334
- );
1335
- this.cellElements[newFocusColumnIndex].focus();
1336
- e.preventDefault();
1337
- break;
1338
- case fastWebUtilities.keyHome:
1339
- if (!e.ctrlKey) {
1340
- this.cellElements[0].focus();
1341
- e.preventDefault();
1342
- }
1343
- break;
1344
- case fastWebUtilities.keyEnd:
1345
- if (!e.ctrlKey) {
1346
- this.cellElements[this.cellElements.length - 1].focus();
1347
- e.preventDefault();
1348
- }
1349
- break;
1350
- }
1351
- }
1352
- updateItemTemplate() {
1353
- this.activeCellItemTemplate = this.rowType === dataGrid_options.DataGridRowTypes.default && this.cellItemTemplate !== void 0 ? this.cellItemTemplate : this.rowType === dataGrid_options.DataGridRowTypes.default && this.cellItemTemplate === void 0 ? this.defaultCellItemTemplate : this.headerCellItemTemplate !== void 0 ? this.headerCellItemTemplate : this.defaultHeaderCellItemTemplate;
1354
- }
1355
- /**
1356
- * @internal
1357
- */
1358
- ariaSelectedChanged(oldValue, newValue) {
1359
- super.ariaSelectedChanged(oldValue, newValue);
1360
- this._selectable = newValue !== null;
1361
- this.selected = newValue === "true";
1362
- }
1363
- }
1364
- // @ts-expect-error Type is incorrectly non-optional
1365
- __decorateClass$1([
1366
- fastElement.attr({ attribute: "grid-template-columns" })
1367
- ], DataGridRow.prototype, "gridTemplateColumns");
1368
- __decorateClass$1([
1369
- fastElement.attr({ attribute: "row-type" })
1370
- ], DataGridRow.prototype, "rowType");
1371
- __decorateClass$1([
1372
- fastElement.observable
1373
- ], DataGridRow.prototype, "rowData");
1374
- __decorateClass$1([
1375
- fastElement.observable
1376
- ], DataGridRow.prototype, "columnDefinitions");
1377
- __decorateClass$1([
1378
- fastElement.observable
1379
- ], DataGridRow.prototype, "cellItemTemplate");
1380
- __decorateClass$1([
1381
- fastElement.observable
1382
- ], DataGridRow.prototype, "headerCellItemTemplate");
1383
- __decorateClass$1([
1384
- fastElement.observable
1385
- ], DataGridRow.prototype, "rowIndex");
1386
- __decorateClass$1([
1387
- fastElement.observable
1388
- ], DataGridRow.prototype, "activeCellItemTemplate");
1389
- __decorateClass$1([
1390
- fastElement.observable
1391
- ], DataGridRow.prototype, "defaultCellItemTemplate");
1392
- __decorateClass$1([
1393
- fastElement.observable
1394
- ], DataGridRow.prototype, "defaultHeaderCellItemTemplate");
1395
- __decorateClass$1([
1396
- fastElement.observable
1397
- ], DataGridRow.prototype, "cellElements");
1398
- __decorateClass$1([
1399
- fastElement.observable
1400
- ], DataGridRow.prototype, "_selectable");
1401
- __decorateClass$1([
1402
- fastElement.attr({ mode: "boolean" })
1403
- ], DataGridRow.prototype, "selected");
1404
-
1405
- var __defProp = Object.defineProperty;
1406
- var __decorateClass = (decorators, target, key, kind) => {
1407
- var result = void 0 ;
1408
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
1409
- if (decorator = decorators[i])
1410
- result = (decorator(target, key, result) ) || result;
1411
- if (result) __defProp(target, key, result);
1412
- return result;
1413
- };
1414
- const DataGridSelectionMode = {
1415
- none: "none",
1416
- singleRow: "single-row",
1417
- multiRow: "multi-row",
1418
- singleCell: "single-cell",
1419
- multiCell: "multi-cell"
1420
- };
1421
- const _DataGrid = class _DataGrid extends vividElement.VividElement {
1422
- constructor() {
1423
- super();
1424
- this.noTabbing = false;
1425
- // eslint-disable-next-line @repo/repo/no-attribute-default-value
1426
- this.generateHeader = dataGrid_options.GenerateHeaderOptions.default;
1427
- this.rowsData = [];
1428
- this.columnDefinitions = null;
1429
- this.focusRowIndex = 0;
1430
- this.focusColumnIndex = 0;
1431
- /**
1432
- * @internal
1433
- */
1434
- this.fixedColumnsPositions = [];
1435
- this.behaviorOrchestrator = null;
1436
- this.generatedHeader = null;
1437
- this.isUpdatingFocus = false;
1438
- this.pendingFocusUpdate = false;
1439
- this.rowindexUpdateQueued = false;
1440
- this.columnDefinitionsStale = true;
1441
- this.generatedGridTemplateColumns = "";
1442
- this.focusOnCell = (rowIndex, columnIndex, scrollIntoView) => {
1443
- if (this.rowElements.length === 0) {
1444
- this.focusRowIndex = 0;
1445
- this.focusColumnIndex = 0;
1446
- return;
1447
- }
1448
- const focusRowIndex = Math.max(
1449
- 0,
1450
- Math.min(this.rowElements.length - 1, rowIndex)
1451
- );
1452
- const focusRow = this.rowElements[focusRowIndex];
1453
- const cells = focusRow.querySelectorAll(
1454
- '[role="cell"], [role="gridcell"], [role="columnheader"], [role="rowheader"], [data-vvd-component="data-grid-cell"]'
1455
- );
1456
- const focusColumnIndex = Math.max(
1457
- 0,
1458
- Math.min(cells.length - 1, columnIndex)
1459
- );
1460
- const focusTarget = cells[focusColumnIndex];
1461
- if (scrollIntoView && this.scrollHeight !== this.clientHeight && (focusRowIndex < this.focusRowIndex && this.scrollTop > 0 || focusRowIndex > this.focusRowIndex && this.scrollTop < this.scrollHeight - this.clientHeight)) {
1462
- focusTarget.scrollIntoView({ block: "center", inline: "center" });
1463
- }
1464
- focusTarget.focus();
1465
- };
1466
- this.onChildListChange = (mutations, _) => {
1467
- if (mutations && mutations.length) {
1468
- mutations.forEach((mutation) => {
1469
- mutation.addedNodes.forEach((newNode) => {
1470
- if (newNode.nodeType === 1 && (newNode.getAttribute("role") === "row" || newNode.getAttribute("row-type") === "default")) {
1471
- newNode.columnDefinitions = this.columnDefinitions;
1472
- }
1473
- });
1474
- });
1475
- this.queueRowIndexUpdate();
1476
- }
1477
- };
1478
- this.queueRowIndexUpdate = () => {
1479
- if (!this.rowindexUpdateQueued) {
1480
- this.rowindexUpdateQueued = true;
1481
- fastElement.Updates.enqueue(this.updateRowIndexes);
1482
- }
1483
- };
1484
- this.updateRowIndexes = () => {
1485
- let newGridTemplateColumns = this.gridTemplateColumns;
1486
- if (newGridTemplateColumns === void 0) {
1487
- if (this.generatedGridTemplateColumns === "" && this.rowElements.length > 0) {
1488
- const firstRow = this.rowElements[0];
1489
- this.generatedGridTemplateColumns = new Array(
1490
- firstRow.cellElements.length
1491
- ).fill("1fr").join(" ");
1492
- }
1493
- newGridTemplateColumns = this.generatedGridTemplateColumns;
1494
- }
1495
- this.rowElements.forEach((element, index) => {
1496
- const thisRow = element;
1497
- thisRow.rowIndex = index;
1498
- thisRow.gridTemplateColumns = newGridTemplateColumns;
1499
- if (this.columnDefinitionsStale) {
1500
- thisRow.columnDefinitions = this.columnDefinitions;
1501
- }
1502
- });
1503
- this.rowindexUpdateQueued = false;
1504
- this.columnDefinitionsStale = false;
1505
- };
1506
- this.#handleKeypress = (e) => {
1507
- if (e.key === "Enter" || e.key === " ") {
1508
- this.#handleClick(e);
1509
- }
1510
- };
1511
- this.#handleClick = ({ target, ctrlKey, shiftKey, metaKey }) => {
1512
- if (target.getAttribute("role") !== "gridcell" || target.getAttribute("cell-type") !== "default")
1513
- return;
1514
- if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
1515
- this.#handleCellSelection({ target, ctrlKey, shiftKey, metaKey });
1516
- return;
1517
- }
1518
- if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
1519
- this.#handleRowSelection({ target, ctrlKey, shiftKey, metaKey });
1520
- }
1521
- };
1522
- this.#handleCellSelection = ({
1523
- target,
1524
- ctrlKey,
1525
- shiftKey,
1526
- metaKey
1527
- }) => {
1528
- const cell = target;
1529
- if (this.selectionMode === DataGridSelectionMode.multiCell && (ctrlKey || shiftKey || metaKey)) {
1530
- cell.selected = !this.#selectedCells.includes(cell);
1531
- } else {
1532
- const cacheTargetSelection = cell.selected;
1533
- this._resetSelection(true);
1534
- cell.selected = !cacheTargetSelection;
1535
- }
1536
- };
1537
- this.#handleRowSelection = ({
1538
- target,
1539
- ctrlKey,
1540
- shiftKey,
1541
- metaKey
1542
- }) => {
1543
- const row = target.parentNode;
1544
- if (this.selectionMode === DataGridSelectionMode.multiRow && (ctrlKey || shiftKey || metaKey)) {
1545
- row.selected = !this.#selectedRows.includes(row);
1546
- } else {
1547
- const cacheTargetSelection = row.selected;
1548
- this._resetSelection(true);
1549
- row.selected = !cacheTargetSelection;
1550
- }
1551
- };
1552
- this.#changeHandler = {
1553
- handleChange(dataGrid, propertyName) {
1554
- if (propertyName === "columnDefinitions") {
1555
- if (dataGrid.$fastController.isConnected) {
1556
- dataGrid.toggleGeneratedHeader();
1557
- }
1558
- }
1559
- }
1560
- };
1561
- /**
1562
- * @internal
1563
- */
1564
- this._resetSelection = (clear = false) => {
1565
- const cells = Array.from(
1566
- this.querySelectorAll('[role="gridcell"], [cell-type="default"]')
1567
- );
1568
- const rows = Array.from(
1569
- this.querySelectorAll('[role="row"], [row-type="default"]')
1570
- );
1571
- if (this.selectionMode === DataGridSelectionMode.singleCell || this.selectionMode === DataGridSelectionMode.multiCell) {
1572
- for (const cell of cells) {
1573
- cell._selectable = true;
1574
- cell.selected = clear ? false : cell.selected || false;
1575
- }
1576
- for (const row of rows) {
1577
- row._selectable = false;
1578
- row.selected = false;
1579
- }
1580
- }
1581
- if (this.selectionMode === DataGridSelectionMode.none) {
1582
- for (const element of [...cells, ...rows]) {
1583
- element._selectable = false;
1584
- element.selected = false;
1585
- }
1586
- }
1587
- if (this.selectionMode === DataGridSelectionMode.singleRow || this.selectionMode === DataGridSelectionMode.multiRow) {
1588
- for (const cell of cells) {
1589
- cell._selectable = false;
1590
- cell.selected = false;
1591
- }
1592
- for (const row of rows) {
1593
- row._selectable = true;
1594
- row.selected = clear ? false : row.selected || false;
1595
- }
1596
- }
1597
- };
1598
- this.addEventListener("click", this.#handleClick);
1599
- this.addEventListener("keydown", this.#handleKeypress);
1600
- }
1601
- /**
1602
- * generates a gridTemplateColumns based on columndata array
1603
- */
1604
- static generateTemplateColumns(columnDefinitions) {
1605
- let templateColumns = "";
1606
- columnDefinitions.forEach((_) => {
1607
- templateColumns = `${templateColumns}${templateColumns === "" ? "" : " "}${"1fr"}`;
1608
- });
1609
- return templateColumns;
1610
- }
1611
- /**
1612
- * @internal
1613
- */
1614
- noTabbingChanged() {
1615
- if (this.$fastController.isConnected) {
1616
- this.#setTabIndex();
1617
- }
1618
- }
1619
- #setTabIndex() {
1620
- this.setAttribute(
1621
- "tabIndex",
1622
- this.noTabbing || this.contains(document.activeElement) ? "-1" : "0"
1623
- );
1624
- }
1625
- /**
1626
- * @internal
1627
- */
1628
- generateHeaderChanged() {
1629
- if (this.$fastController.isConnected) {
1630
- this.toggleGeneratedHeader();
1631
- }
1632
- }
1633
- /**
1634
- * @internal
1635
- */
1636
- gridTemplateColumnsChanged() {
1637
- if (this.$fastController.isConnected) {
1638
- this.updateRowIndexes();
1639
- if (this.fixedColumns && this.fixedColumns > 0) {
1640
- this.applyFixedColumns();
1641
- }
1642
- }
1643
- }
1644
- /**
1645
- * @internal
1646
- */
1647
- rowsDataChanged() {
1648
- if (this.columnDefinitions === null && this.rowsData.length > 0) {
1649
- this.columnDefinitions = _DataGrid.generateColumns(this.rowsData[0]);
1650
- }
1651
- if (this.$fastController.isConnected) {
1652
- this.toggleGeneratedHeader();
1653
- }
1654
- }
1655
- /**
1656
- * @internal
1657
- */
1658
- columnDefinitionsChanged() {
1659
- if (this.columnDefinitions === null) {
1660
- this.generatedGridTemplateColumns = "";
1661
- return;
1662
- }
1663
- this.generatedGridTemplateColumns = _DataGrid.generateTemplateColumns(
1664
- this.columnDefinitions
1665
- );
1666
- if (this.$fastController.isConnected) {
1667
- this.columnDefinitionsStale = true;
1668
- this.queueRowIndexUpdate();
1669
- }
1670
- }
1671
- /**
1672
- * @internal
1673
- */
1674
- headerCellItemTemplateChanged() {
1675
- if (this.$fastController.isConnected) {
1676
- if (this.generatedHeader !== null) {
1677
- this.generatedHeader.headerCellItemTemplate = this.headerCellItemTemplate;
1678
- }
1679
- }
1680
- }
1681
- /**
1682
- * @internal
1683
- */
1684
- focusRowIndexChanged() {
1685
- if (this.$fastController.isConnected) {
1686
- this.queueFocusUpdate();
1687
- }
1688
- }
1689
- /**
1690
- * @internal
1691
- */
1692
- focusColumnIndexChanged() {
1693
- if (this.$fastController.isConnected) {
1694
- this.queueFocusUpdate();
1695
- }
1696
- }
1697
- /**
1698
- * @internal
1699
- */
1700
- fixedColumnsChanged() {
1701
- if (this.$fastController.isConnected) {
1702
- this.applyFixedColumns();
1703
- this.setupResizeObserver();
1704
- }
1705
- }
1706
- /**
1707
- * @internal
1708
- */
1709
- setupResizeObserver() {
1710
- if (this.resizeObserver) {
1711
- this.resizeObserver.disconnect();
1712
- this.resizeObserver = void 0;
1713
- }
1714
- if (typeof ResizeObserver !== "undefined" && this.fixedColumns && this.fixedColumns > 0) {
1715
- this.resizeObserver = new ResizeObserver(() => {
1716
- this.applyFixedColumns();
1717
- });
1718
- this.resizeObserver.observe(this);
1719
- }
1720
- }
1721
- /**
1722
- * @internal
1723
- */
1724
- connectedCallback() {
1725
- super.connectedCallback();
1726
- if (this.rowItemTemplate === void 0) {
1727
- this.rowItemTemplate = this.defaultRowItemTemplate;
1728
- }
1729
- if (this.behaviorOrchestrator === null) {
1730
- this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
1731
- this.$fastController.addBehavior(this.behaviorOrchestrator);
1732
- this.behaviorOrchestrator.addBehaviorFactory(
1733
- new fastElement.RepeatDirective(
1734
- fastElement.normalizeBinding((x) => x.rowsData),
1735
- fastElement.normalizeBinding((x) => x.rowItemTemplate),
1736
- { positioning: true }
1737
- ),
1738
- this.appendChild(document.createComment(""))
1739
- );
1740
- }
1741
- this.toggleGeneratedHeader();
1742
- this.addEventListener("row-focused", this.handleRowFocus);
1743
- this.addEventListener(fastWebUtilities.eventFocus, this.handleFocus);
1744
- this.addEventListener(fastWebUtilities.eventKeyDown, this.handleKeydown);
1745
- this.addEventListener(fastWebUtilities.eventFocusOut, this.handleFocusOut);
1746
- this.observer = new MutationObserver(this.onChildListChange);
1747
- this.observer.observe(this, { childList: true });
1748
- this.setupResizeObserver();
1749
- fastElement.Updates.enqueue(this.queueRowIndexUpdate);
1750
- this.#setTabIndex();
1751
- fastElement.Observable.getNotifier(this).subscribe(
1752
- this.#changeHandler,
1753
- "columnDefinitions"
1754
- );
1755
- }
1756
- /**
1757
- * @internal
1758
- */
1759
- disconnectedCallback() {
1760
- super.disconnectedCallback();
1761
- this.removeEventListener("row-focused", this.handleRowFocus);
1762
- this.removeEventListener(fastWebUtilities.eventFocus, this.handleFocus);
1763
- this.removeEventListener(fastWebUtilities.eventKeyDown, this.handleKeydown);
1764
- this.removeEventListener(
1765
- fastWebUtilities.eventFocusOut,
1766
- this.handleFocusOut
1767
- );
1768
- this.observer.disconnect();
1769
- if (this.resizeObserver) {
1770
- this.resizeObserver.disconnect();
1771
- this.resizeObserver = void 0;
1772
- }
1773
- this.generatedHeader = null;
1774
- fastElement.Observable.getNotifier(this).unsubscribe(
1775
- this.#changeHandler,
1776
- "columnDefinitions"
1777
- );
1778
- }
1779
- /**
1780
- * @internal
1781
- */
1782
- handleRowFocus(e) {
1783
- this.isUpdatingFocus = true;
1784
- const focusRow = e.target;
1785
- this.focusRowIndex = this.rowElements.indexOf(focusRow);
1786
- this.focusColumnIndex = focusRow.focusColumnIndex;
1787
- this.setAttribute("tabIndex", "-1");
1788
- this.isUpdatingFocus = false;
1789
- }
1790
- /**
1791
- * @internal
1792
- */
1793
- handleFocus(_) {
1794
- this.focusOnCell(this.focusRowIndex, this.focusColumnIndex, true);
1795
- }
1796
- /**
1797
- * @internal
1798
- */
1799
- handleFocusOut(e) {
1800
- if (e.relatedTarget === null || !this.contains(e.relatedTarget)) {
1801
- this.setAttribute("tabIndex", this.noTabbing ? "-1" : "0");
1802
- }
1803
- }
1804
- /**
1805
- * @internal
1806
- */
1807
- handleKeydown(e) {
1808
- if (e.defaultPrevented) {
1809
- return;
1810
- }
1811
- let newFocusRowIndex;
1812
- const maxIndex = this.rowElements.length - 1;
1813
- const currentGridBottom = this.offsetHeight + this.scrollTop;
1814
- const lastRow = this.rowElements[maxIndex];
1815
- switch (e.key) {
1816
- case fastWebUtilities.keyArrowUp:
1817
- e.preventDefault();
1818
- this.focusOnCell(this.focusRowIndex - 1, this.focusColumnIndex, true);
1819
- break;
1820
- case fastWebUtilities.keyArrowDown:
1821
- e.preventDefault();
1822
- this.focusOnCell(this.focusRowIndex + 1, this.focusColumnIndex, true);
1823
- break;
1824
- case fastWebUtilities.keyPageUp:
1825
- e.preventDefault();
1826
- if (this.rowElements.length === 0) {
1827
- this.focusOnCell(0, 0, false);
1828
- break;
1829
- }
1830
- if (this.focusRowIndex === 0) {
1831
- this.focusOnCell(0, this.focusColumnIndex, false);
1832
- return;
1833
- }
1834
- newFocusRowIndex = this.focusRowIndex - 1;
1835
- for (newFocusRowIndex; newFocusRowIndex >= 0; newFocusRowIndex--) {
1836
- const thisRow = this.rowElements[newFocusRowIndex];
1837
- if (thisRow.offsetTop < this.scrollTop) {
1838
- this.scrollTop = thisRow.offsetTop + thisRow.clientHeight - this.clientHeight;
1839
- break;
1840
- }
1841
- }
1842
- this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
1843
- break;
1844
- case fastWebUtilities.keyPageDown:
1845
- e.preventDefault();
1846
- if (this.rowElements.length === 0) {
1847
- this.focusOnCell(0, 0, false);
1848
- break;
1849
- }
1850
- if (this.focusRowIndex >= maxIndex || lastRow.offsetTop + lastRow.offsetHeight <= currentGridBottom) {
1851
- this.focusOnCell(maxIndex, this.focusColumnIndex, false);
1852
- return;
1853
- }
1854
- newFocusRowIndex = this.focusRowIndex + 1;
1855
- for (newFocusRowIndex; newFocusRowIndex <= maxIndex; newFocusRowIndex++) {
1856
- const thisRow = this.rowElements[newFocusRowIndex];
1857
- if (thisRow.offsetTop + thisRow.offsetHeight > currentGridBottom) {
1858
- let stickyHeaderOffset = 0;
1859
- if (this.generateHeader === dataGrid_options.GenerateHeaderOptions.sticky && this.generatedHeader !== null) {
1860
- stickyHeaderOffset = this.generatedHeader.clientHeight;
1861
- }
1862
- this.scrollTop = thisRow.offsetTop - stickyHeaderOffset;
1863
- break;
1864
- }
1865
- }
1866
- this.focusOnCell(newFocusRowIndex, this.focusColumnIndex, false);
1867
- break;
1868
- case fastWebUtilities.keyHome: {
1869
- if (e.ctrlKey) {
1870
- e.preventDefault();
1871
- this.focusOnCell(0, 0, true);
1872
- }
1873
- break;
1874
- }
1875
- case fastWebUtilities.keyEnd: {
1876
- if (e.ctrlKey && this.columnDefinitions !== null) {
1877
- e.preventDefault();
1878
- this.focusOnCell(
1879
- this.rowElements.length - 1,
1880
- this.columnDefinitions.length - 1,
1881
- true
1882
- );
1883
- }
1884
- break;
1885
- }
1886
- }
1887
- }
1888
- queueFocusUpdate() {
1889
- if (this.isUpdatingFocus && this.contains(document.activeElement)) {
1890
- return;
1891
- }
1892
- if (this.pendingFocusUpdate === false) {
1893
- this.pendingFocusUpdate = true;
1894
- fastElement.Updates.enqueue(() => this.updateFocus());
1895
- }
1896
- }
1897
- updateFocus() {
1898
- this.pendingFocusUpdate = false;
1899
- this.focusOnCell(this.focusRowIndex, this.focusColumnIndex, true);
1900
- }
1901
- toggleGeneratedHeader() {
1902
- if (this.generatedHeader !== null) {
1903
- this.removeChild(this.generatedHeader);
1904
- this.generatedHeader = null;
1905
- }
1906
- if (this.generateHeader !== dataGrid_options.GenerateHeaderOptions.none && this.columnDefinitions !== null) {
1907
- const generatedHeaderElement = document.createElement(
1908
- this.rowElementTag
1909
- );
1910
- this.generatedHeader = generatedHeaderElement;
1911
- this.generatedHeader.columnDefinitions = this.columnDefinitions;
1912
- this.generatedHeader.gridTemplateColumns = this.gridTemplateColumns;
1913
- this.generatedHeader.rowType = this.generateHeader === dataGrid_options.GenerateHeaderOptions.sticky ? dataGrid_options.DataGridRowTypes.stickyHeader : dataGrid_options.DataGridRowTypes.header;
1914
- if (this.firstChild !== null) {
1915
- this.insertBefore(generatedHeaderElement, this.firstChild);
1916
- }
1917
- return;
1918
- }
1919
- }
1920
- /**
1921
- *
1922
- *
1923
- * @internal
1924
- */
1925
- slottedRowElementsChanged(_oldValue, _newValue) {
1926
- this._resetSelection();
1927
- }
1928
- get #selectedRows() {
1929
- return this.rowElements.filter((row) => row.selected);
1930
- }
1931
- get #selectedCells() {
1932
- return this.rowElements.reduce((acc, row) => {
1933
- const rowChildren = Array.from(row.children);
1934
- const selectedCells = rowChildren.filter(
1935
- (cell) => cell.selected
1936
- );
1937
- return acc.concat(selectedCells);
1938
- }, []);
1939
- }
1940
- selectionModeChanged(oldValue) {
1941
- if (oldValue === void 0) {
1942
- fastElement.Updates.enqueue(this._resetSelection);
1943
- return;
1944
- }
1945
- this._resetSelection(true);
1946
- }
1947
- #handleKeypress;
1948
- #handleClick;
1949
- #handleCellSelection;
1950
- #handleRowSelection;
1951
- #changeHandler;
1952
- static generateColumns(rowData) {
1953
- return Object.keys(rowData).map((property, index) => {
1954
- return {
1955
- columnDataKey: property,
1956
- gridColumn: `${index}`
1957
- };
1958
- });
1959
- }
1960
- /**
1961
- * @internal
1962
- */
1963
- applyFixedColumns() {
1964
- if (!this.fixedColumns || this.fixedColumns <= 0) {
1965
- this.clearFixedColumns();
1966
- return;
1967
- }
1968
- this.calculateFixedColumnPositions();
1969
- this.applyFixedColumnStyling();
1970
- }
1971
- /**
1972
- * Applies fixed columns styling using cached positions
1973
- * @internal
1974
- */
1975
- applyFixedColumnStyling() {
1976
- this.rowElements.forEach((row) => {
1977
- const cells = row.querySelectorAll(
1978
- '[role="cell"], [role="gridcell"], [role="columnheader"], [cell-type="default"], [cell-type="columnheader"]'
1979
- );
1980
- this.fixedColumnsPositions.forEach((position, index) => {
1981
- if (index < cells.length) {
1982
- const gridCell = cells[index];
1983
- if (typeof gridCell.setFixedPosition === "function") {
1984
- gridCell.setFixedPosition(`${position}px`);
1985
- }
1986
- }
1987
- });
1988
- });
1989
- }
1990
- /**
1991
- * Calculates and caches fixed columns positions based on current layout
1992
- * @internal
1993
- */
1994
- calculateFixedColumnPositions() {
1995
- this.fixedColumnsPositions = [];
1996
- if (this.rowElements.length === 0) return;
1997
- const cells = this.rowElements[0].querySelectorAll(
1998
- '[role="cell"], [role="gridcell"], [role="columnheader"], [cell-type="default"], [cell-type="columnheader"]'
1999
- );
2000
- let accumulator = 0;
2001
- for (let i = 0; i < Math.min(this.fixedColumns, cells.length); i++) {
2002
- this.fixedColumnsPositions.push(accumulator);
2003
- accumulator += cells[i].offsetWidth;
2004
- }
2005
- }
2006
- /**
2007
- * Clears all fixed columns state and styling
2008
- * @internal
2009
- */
2010
- clearFixedColumns() {
2011
- if (this.rowElements.length === 0) {
2012
- this.fixedColumnsPositions = [];
2013
- return;
2014
- }
2015
- this.rowElements.forEach((row) => {
2016
- const cells = row.querySelectorAll(
2017
- '[role="cell"], [role="gridcell"], [role="columnheader"], [cell-type="default"], [cell-type="columnheader"]'
2018
- );
2019
- this.fixedColumnsPositions.forEach((_, index) => {
2020
- if (index < cells.length) {
2021
- const gridCell = cells[index];
2022
- if (typeof gridCell.setFixedPosition === "function") {
2023
- gridCell.setFixedPosition(void 0);
2024
- }
2025
- }
2026
- });
2027
- });
2028
- this.fixedColumnsPositions = [];
2029
- }
2030
- };
2031
- __decorateClass([
2032
- fastElement.attr({ attribute: "no-tabbing", mode: "boolean" })
2033
- ], _DataGrid.prototype, "noTabbing");
2034
- __decorateClass([
2035
- fastElement.attr({ attribute: "generate-header" })
2036
- ], _DataGrid.prototype, "generateHeader");
2037
- // @ts-expect-error Type is incorrectly non-optional
2038
- __decorateClass([
2039
- fastElement.attr({ attribute: "grid-template-columns" })
2040
- ], _DataGrid.prototype, "gridTemplateColumns");
2041
- __decorateClass([
2042
- fastElement.observable
2043
- ], _DataGrid.prototype, "rowsData");
2044
- __decorateClass([
2045
- fastElement.observable
2046
- ], _DataGrid.prototype, "columnDefinitions");
2047
- __decorateClass([
2048
- fastElement.observable
2049
- ], _DataGrid.prototype, "rowItemTemplate");
2050
- __decorateClass([
2051
- fastElement.observable
2052
- ], _DataGrid.prototype, "cellItemTemplate");
2053
- __decorateClass([
2054
- fastElement.observable
2055
- ], _DataGrid.prototype, "headerCellItemTemplate");
2056
- __decorateClass([
2057
- fastElement.observable
2058
- ], _DataGrid.prototype, "focusRowIndex");
2059
- __decorateClass([
2060
- fastElement.observable
2061
- ], _DataGrid.prototype, "focusColumnIndex");
2062
- __decorateClass([
2063
- fastElement.attr({ attribute: "fixed-columns", converter: fastElement.nullableNumberConverter })
2064
- ], _DataGrid.prototype, "fixedColumns");
2065
- __decorateClass([
2066
- fastElement.observable
2067
- ], _DataGrid.prototype, "defaultRowItemTemplate");
2068
- __decorateClass([
2069
- fastElement.observable
2070
- ], _DataGrid.prototype, "rowElementTag");
2071
- __decorateClass([
2072
- fastElement.observable
2073
- ], _DataGrid.prototype, "rowElements");
2074
- __decorateClass([
2075
- fastElement.observable
2076
- ], _DataGrid.prototype, "slottedRowElements");
2077
- __decorateClass([
2078
- fastElement.attr({ attribute: "selection-mode" })
2079
- ], _DataGrid.prototype, "selectionMode");
2080
- let DataGrid = _DataGrid;
2081
-
2082
- function createRowItemTemplate(context) {
2083
- const rowTag = context.tagFor(DataGridRow);
2084
- return fastElement.html`
2085
- <${rowTag}
2086
- :rowData="${(x) => x}"
2087
- :cellItemTemplate="${(_, c) => c.parent.cellItemTemplate}"
2088
- :headerCellItemTemplate="${(_, c) => c.parent.headerCellItemTemplate}"
2089
- ></${rowTag}>
2090
- `;
2091
- }
2092
- function getMultiSelectAriaState(x) {
2093
- return x.selectionMode === void 0 || x.selectionMode === DataGridSelectionMode.none ? null : x.selectionMode.includes("multi") ? "true" : "false";
2094
- }
2095
- function setHeaderRow(x) {
2096
- if (x.columnDefinitions === null) {
2097
- const headerRow = x.querySelector(
2098
- '[cell-type="columnheader"]'
2099
- )?.parentElement;
2100
- if (x.generateHeader === dataGrid_options.GenerateHeaderOptions.default && (headerRow?.getAttribute("row-type") === dataGrid_options.DataGridRowTypes.header || headerRow?.getAttribute("row-type") === dataGrid_options.DataGridRowTypes.stickyHeader)) {
2101
- return;
2102
- }
2103
- if (headerRow) {
2104
- const rowType = x.generateHeader === dataGrid_options.GenerateHeaderOptions.sticky ? dataGrid_options.DataGridRowTypes.stickyHeader : dataGrid_options.DataGridRowTypes.header;
2105
- headerRow.setAttribute("row-type", rowType);
2106
- }
2107
- }
2108
- }
2109
- function handleColumnSort(_, { event }) {
2110
- event.stopPropagation();
2111
- }
2112
- const DataGridTemplate = (context) => {
2113
- const rowItemTemplate = createRowItemTemplate(context);
2114
- const rowTag = context.tagFor(DataGridRow, true);
2115
- return fastElement.html`
2116
- <template
2117
- aria-multiselectable="${getMultiSelectAriaState}"
2118
- role="grid"
2119
- tabindex="0"
2120
- @sort="${handleColumnSort}"
2121
- :rowElementTag="${() => rowTag}"
2122
- :defaultRowItemTemplate="${rowItemTemplate}"
2123
- ${fastElement.children({
2124
- property: "rowElements",
2125
- filter: fastElement.elements("[role=row],[data-vvd-component=data-grid-row]")
2126
- })}
2127
- >
2128
- <div class="base">
2129
- ${setHeaderRow}
2130
- <slot ${fastElement.slotted("slottedRowElements")}></slot>
2131
- </div>
2132
- </template>
2133
- `;
2134
- };
2135
-
2136
- function calculateAriaSelectedValue$1(x) {
2137
- if (x._selectable && x.selected) return "true";
2138
- if (x._selectable && !x.selected) return "false";
2139
- return null;
2140
- }
2141
- function createCellItemTemplate(context) {
2142
- const cellTag = context.tagFor(DataGridCell);
2143
- return fastElement.html`
2144
- <${cellTag}
2145
- cell-type="${(x) => x.isRowHeader ? "rowheader" : void 0}"
2146
- grid-column="${(_, c) => c.index + 1}"
2147
- :rowData="${(_, c) => c.parent.rowData}"
2148
- :columnDefinition="${(x) => x}"
2149
- selected="${(_, c) => c.parent.ariaSelected === "true" ? true : null}"
2150
- ></${cellTag}>
2151
- `;
2152
- }
2153
- function createHeaderCellItemTemplate(context) {
2154
- const cellTag = context.tagFor(DataGridCell);
2155
- return fastElement.html`
2156
- <${cellTag}
2157
- cell-type="columnheader"
2158
- grid-column="${(_, c) => c.index + 1}"
2159
- :columnDefinition="${(x) => x}"
2160
- ></${cellTag}>
2161
- `;
2162
- }
2163
- const DataGridRowTemplate = (context) => {
2164
- const cellItemTemplate = createCellItemTemplate(context);
2165
- const headerCellItemTemplate = createHeaderCellItemTemplate(context);
2166
- const getBaseClasses = (x) => fastWebUtilities.classNames("base", ["selected", !!x.selected]);
2167
- return fastElement.html`
2168
- <template
2169
- ${hostSemantics.applyHostSemantics({
2170
- role: "row",
2171
- ariaSelected: calculateAriaSelectedValue$1
2172
- })}
2173
- class="${(x) => x.rowType !== "default" ? x.rowType : ""}"
2174
- :defaultCellItemTemplate="${cellItemTemplate}"
2175
- :defaultHeaderCellItemTemplate="${headerCellItemTemplate}"
2176
- ${fastElement.children({
2177
- property: "cellElements",
2178
- filter: fastElement.elements(
2179
- '[role="cell"],[role="gridcell"],[role="columnheader"],[role="rowheader"],[data-vvd-component="data-grid-cell"]'
2180
- )
2181
- })}
2182
- >
2183
- <div
2184
- class="${getBaseClasses}"
2185
- style="grid-template-columns: ${(x) => x.gridTemplateColumns};"
2186
- >
2187
- <slot ${fastElement.slotted("slottedCellElements")}></slot>
2188
- </div>
2189
- </template>
2190
- `;
2191
- };
2192
-
2193
- function shouldShowSortIcons(x) {
2194
- return x.cellType === "columnheader" && x.sortDirection !== void 0 && x.sortDirection !== dataGrid_options.DataGridCellSortStates.other;
2195
- }
2196
- function getSortIcon(x) {
2197
- if (x.sortDirection === dataGrid_options.DataGridCellSortStates.ascending) {
2198
- return "sort-asc-solid";
2199
- }
2200
- if (x.sortDirection === dataGrid_options.DataGridCellSortStates.descending) {
2201
- return "sort-desc-solid";
2202
- }
2203
- return "sort-solid";
2204
- }
2205
- function calculateAriaSelectedValue(x) {
2206
- if (x._selectable && x.selected) return "true";
2207
- if (x._selectable && !x.selected) return "false";
2208
- return null;
2209
- }
2210
- function renderSortIcons(c) {
2211
- const iconTag = c.tagFor(icon_definition.VwcIconElement);
2212
- return fastElement.html`
2213
- ${fastElement.when(
2214
- shouldShowSortIcons,
2215
- fastElement.html`
2216
- <${iconTag} class="header-icon" name="${getSortIcon}"></${iconTag}>
2217
- `
2218
- )}
2219
- `;
2220
- }
2221
- function shouldAnnounceSortState(x) {
2222
- return x.cellType === dataGrid_options.DataGridCellTypes.columnHeader && x.sortDirection !== void 0;
2223
- }
2224
- function getSortStateKey(x) {
2225
- return x.sortDirection ?? dataGrid_options.DataGridCellSortStates.none;
2226
- }
2227
- function getLocalizedSortStatus(x) {
2228
- const direction = getSortStateKey(x);
2229
- const sortStatus = x.locale.dataGrid.cell.sortStatus;
2230
- return sortStatus?.[direction];
2231
- }
2232
- function getLocalizedSortInstruction(x) {
2233
- const direction = getSortStateKey(x);
2234
- const sortInstruction = x.locale.dataGrid.cell.sortInstruction;
2235
- return sortInstruction?.[direction];
2236
- }
2237
- function getSortAnnouncement(x) {
2238
- return [getLocalizedSortStatus(x), getLocalizedSortInstruction(x)].filter((part) => !!part).join(" ").trim();
2239
- }
2240
- function handleKeyDown(x, e) {
2241
- if (e.key === fastWebUtilities.keyEnter || e.key === fastWebUtilities.keySpace) {
2242
- const target = e.target;
2243
- if (target.closest('[slot="action-items"]')) return true;
2244
- x._handleInteraction();
2245
- }
2246
- return true;
2247
- }
2248
- function handleClick(x, e) {
2249
- const target = e.target;
2250
- if (target.closest('[slot="action-items"]')) return true;
2251
- x._handleInteraction();
2252
- return true;
2253
- }
2254
- const DataGridCellTemplate = (context) => {
2255
- const visuallyHiddenTagName = context.tagFor(visuallyHidden_definition.VwcVisuallyHiddenElement);
2256
- const getBaseClasses = ({
2257
- selected,
2258
- _actionItemsSlottedContent
2259
- }) => fastWebUtilities.classNames(
2260
- "base",
2261
- ["selected", !!selected],
2262
- ["has-action-items", Boolean(_actionItemsSlottedContent?.length)]
2263
- );
2264
- return fastElement.html`
2265
- <template
2266
- tabindex="-1"
2267
- ${hostSemantics.applyHostSemantics({
2268
- role: (x) => dataGrid_options.DataGridCellRole[x.cellType] ?? dataGrid_options.DataGridCellRole.default,
2269
- ariaSelected: calculateAriaSelectedValue,
2270
- ariaSort: (x) => x.sortDirection ?? null
2271
- })}
2272
- @click="${(x, c) => handleClick(x, c.event)}"
2273
- @keydown="${(x, c) => handleKeyDown(x, c.event)}"
2274
- >
2275
- <div class="${getBaseClasses}">
2276
- <div
2277
- class="content"
2278
- role="${(x) => shouldShowSortIcons(x) ? "button" : void 0}"
2279
- >
2280
- ${(x) => x.selected ? fastElement.html`<${visuallyHiddenTagName}
2281
- data-announcement="selection"
2282
- >
2283
- ${(x2) => x2.locale.dataGrid.cell.selected}
2284
- </${visuallyHiddenTagName}>` : null}
2285
- <slot></slot>
2286
- ${fastElement.when(
2287
- shouldShowSortIcons,
2288
- fastElement.html`<${visuallyHiddenTagName}
2289
- data-announcement="button-role"
2290
- >
2291
- ${(x) => x.locale.dataGrid.cell.button}
2292
- </${visuallyHiddenTagName}>
2293
- `
2294
- )}
2295
- ${fastElement.when(
2296
- shouldAnnounceSortState,
2297
- fastElement.html`<${visuallyHiddenTagName}
2298
- aria-live="polite"
2299
- data-announcement="sort-state"
2300
- >
2301
- ${getSortAnnouncement}
2302
- </${visuallyHiddenTagName}>`
2303
- )}
2304
- ${(_) => renderSortIcons(context)}
2305
- </div>
2306
- <slot
2307
- name="action-items"
2308
- ${fastElement.slotted("_actionItemsSlottedContent")}
2309
- ></slot>
2310
- </div>
2311
- </template>
2312
- `;
2313
- };
2314
-
2315
- const dataGridCellDefinition = vividElement.defineVividComponent(
2316
- "data-grid-cell",
2317
- DataGridCell,
2318
- DataGridCellTemplate,
2319
- [icon_definition.iconDefinition, visuallyHidden_definition.visuallyHiddenDefinition],
2320
- {
2321
- styles: dataGridCellStyles
2322
- }
2323
- );
2324
- const dataGridRowDefinition = vividElement.defineVividComponent(
2325
- "data-grid-row",
2326
- DataGridRow,
2327
- DataGridRowTemplate,
2328
- [dataGridCellDefinition],
2329
- {
2330
- styles: dataGridRowStyles
2331
- }
2332
- );
2333
- const dataGridDefinition = vividElement.defineVividComponent(
2334
- "data-grid",
2335
- DataGrid,
2336
- DataGridTemplate,
2337
- [dataGridRowDefinition],
2338
- {
2339
- styles: dataGridStyles
2340
- }
2341
- );
2342
- const registerDataGrid = vividElement.createRegisterFunction(dataGridDefinition);
2343
-
2344
- exports.VwcDataGridCellElement = DataGridCell;
2345
- exports.VwcDataGridElement = DataGrid;
2346
- exports.VwcDataGridRowElement = DataGridRow;
2347
- exports.dataGridCellDefinition = dataGridCellDefinition;
2348
- exports.dataGridDefinition = dataGridDefinition;
2349
- exports.dataGridRowDefinition = dataGridRowDefinition;
2350
- exports.registerDataGrid = registerDataGrid;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../unbundled/definition2.cjs");
3
+ const require_definition$1 = require("../unbundled/definition32.cjs");
4
+ exports.VwcDataGridCellElement = require_definition$1.DataGridCell;
5
+ exports.VwcDataGridElement = require_definition$1.DataGrid;
6
+ exports.VwcDataGridRowElement = require_definition$1.DataGridRow;
7
+ exports.dataGridCellDefinition = require_definition$1.dataGridCellDefinition;
8
+ exports.dataGridDefinition = require_definition$1.dataGridDefinition;
9
+ exports.dataGridRowDefinition = require_definition$1.dataGridRowDefinition;
10
+ exports.registerDataGrid = require_definition$1.registerDataGrid;