apex-grid 1.0.1 → 2.0.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 (453) hide show
  1. package/LICENSE +76 -5
  2. package/README.md +520 -10
  3. package/components/cell.d.ts +74 -0
  4. package/components/cell.js +376 -0
  5. package/components/cell.js.map +1 -0
  6. package/{dist/src/components → components}/filter-row.d.ts +13 -12
  7. package/components/filter-row.js +396 -0
  8. package/components/filter-row.js.map +1 -0
  9. package/components/grid.d.ts +1173 -0
  10. package/components/grid.js +620 -0
  11. package/components/grid.js.map +1 -0
  12. package/components/header-row.d.ts +43 -0
  13. package/components/header-row.js +205 -0
  14. package/components/header-row.js.map +1 -0
  15. package/{dist/src/components → components}/header.d.ts +11 -5
  16. package/components/header.js +263 -0
  17. package/components/header.js.map +1 -0
  18. package/components/paginator.d.ts +56 -0
  19. package/components/paginator.js +148 -0
  20. package/components/paginator.js.map +1 -0
  21. package/components/row.d.ts +43 -0
  22. package/components/row.js +239 -0
  23. package/components/row.js.map +1 -0
  24. package/components/toolbar.d.ts +60 -0
  25. package/components/toolbar.js +275 -0
  26. package/components/toolbar.js.map +1 -0
  27. package/{dist/src/components → components}/virtualizer.d.ts +2 -3
  28. package/{dist/src/components → components}/virtualizer.js +3 -3
  29. package/components/virtualizer.js.map +1 -0
  30. package/controllers/data-operation.d.ts +31 -0
  31. package/controllers/data-operation.js +53 -0
  32. package/controllers/data-operation.js.map +1 -0
  33. package/controllers/dom.d.ts +55 -0
  34. package/controllers/dom.js +221 -0
  35. package/controllers/dom.js.map +1 -0
  36. package/controllers/editing.d.ts +130 -0
  37. package/controllers/editing.js +197 -0
  38. package/controllers/editing.js.map +1 -0
  39. package/controllers/expansion.d.ts +68 -0
  40. package/controllers/expansion.js +126 -0
  41. package/controllers/expansion.js.map +1 -0
  42. package/{dist/src/controllers → controllers}/filter.d.ts +2 -3
  43. package/controllers/filter.js +105 -0
  44. package/controllers/filter.js.map +1 -0
  45. package/{dist/src/controllers → controllers}/navigation.d.ts +18 -8
  46. package/{dist/src/controllers → controllers}/navigation.js +31 -20
  47. package/controllers/navigation.js.map +1 -0
  48. package/controllers/pagination.d.ts +102 -0
  49. package/controllers/pagination.js +106 -0
  50. package/controllers/pagination.js.map +1 -0
  51. package/controllers/reorder.d.ts +78 -0
  52. package/controllers/reorder.js +124 -0
  53. package/controllers/reorder.js.map +1 -0
  54. package/{dist/src/controllers → controllers}/resize.d.ts +2 -3
  55. package/controllers/resize.js +52 -0
  56. package/controllers/resize.js.map +1 -0
  57. package/controllers/selection.d.ts +109 -0
  58. package/controllers/selection.js +168 -0
  59. package/controllers/selection.js.map +1 -0
  60. package/{dist/src/controllers → controllers}/sort.d.ts +1 -2
  61. package/controllers/sort.js +122 -0
  62. package/controllers/sort.js.map +1 -0
  63. package/controllers/state.d.ts +56 -0
  64. package/controllers/state.js +74 -0
  65. package/controllers/state.js.map +1 -0
  66. package/controllers/tree.d.ts +87 -0
  67. package/controllers/tree.js +0 -0
  68. package/controllers/tree.js.map +1 -0
  69. package/custom-elements.json +6901 -1554
  70. package/{dist/src/define.d.ts → define.d.ts} +0 -1
  71. package/define.js.map +1 -0
  72. package/docs/assets/hierarchy.js +1 -0
  73. package/docs/assets/highlight.css +127 -0
  74. package/docs/assets/icons.js +18 -0
  75. package/docs/assets/icons.svg +1 -0
  76. package/docs/assets/main.js +60 -0
  77. package/docs/assets/navigation.js +1 -0
  78. package/docs/assets/search.js +1 -0
  79. package/docs/assets/style.css +1633 -0
  80. package/docs/classes/ApexGrid.html +371 -0
  81. package/docs/functions/setup.html +22 -0
  82. package/docs/hierarchy.html +1 -0
  83. package/docs/index.html +504 -0
  84. package/docs/interfaces/ApexCellValueChangedEvent.html +11 -0
  85. package/docs/interfaces/ApexCellValueChangingEvent.html +13 -0
  86. package/docs/interfaces/ApexColumnMovedEvent.html +8 -0
  87. package/docs/interfaces/ApexColumnMovingEvent.html +11 -0
  88. package/docs/interfaces/ApexColumnPinnedEvent.html +6 -0
  89. package/docs/interfaces/ApexColumnPinningEvent.html +8 -0
  90. package/docs/interfaces/ApexDetailContext.html +8 -0
  91. package/docs/interfaces/ApexFilteredEvent.html +6 -0
  92. package/docs/interfaces/ApexFilteringEvent.html +12 -0
  93. package/docs/interfaces/ApexGridEventMap.html +68 -0
  94. package/docs/interfaces/ApexHeaderContext.html +6 -0
  95. package/docs/interfaces/ApexPageChangedEvent.html +10 -0
  96. package/docs/interfaces/ApexPageChangingEvent.html +10 -0
  97. package/docs/interfaces/ApexQuickFilterChangedEvent.html +4 -0
  98. package/docs/interfaces/ApexQuickFilterChangingEvent.html +6 -0
  99. package/docs/interfaces/ApexRowEditEndedEvent.html +6 -0
  100. package/docs/interfaces/ApexRowEditStartedEvent.html +4 -0
  101. package/docs/interfaces/ApexRowExpandedEvent.html +8 -0
  102. package/docs/interfaces/ApexRowExpandingEvent.html +11 -0
  103. package/docs/interfaces/ApexRowSelectedEvent.html +8 -0
  104. package/docs/interfaces/ApexRowSelectingEvent.html +11 -0
  105. package/docs/interfaces/ApexTreeRowExpandedEvent.html +8 -0
  106. package/docs/interfaces/ApexTreeRowExpandingEvent.html +10 -0
  107. package/docs/interfaces/BaseApexCellContext.html +16 -0
  108. package/docs/interfaces/BaseApexEditorContext.html +19 -0
  109. package/docs/interfaces/BaseColumnConfiguration.html +83 -0
  110. package/docs/interfaces/BaseColumnSortConfiguration.html +6 -0
  111. package/docs/interfaces/BaseFilterExpression.html +15 -0
  112. package/docs/interfaces/BaseSortExpression.html +12 -0
  113. package/docs/interfaces/CSVExportOptions.html +22 -0
  114. package/docs/interfaces/ColumnFilterConfiguration.html +4 -0
  115. package/docs/interfaces/DataPipelineConfiguration.html +15 -0
  116. package/docs/interfaces/ExportOptions.html +15 -0
  117. package/docs/interfaces/GridEditingConfiguration.html +10 -0
  118. package/docs/interfaces/GridExpansionConfiguration.html +15 -0
  119. package/docs/interfaces/GridSelectionConfiguration.html +11 -0
  120. package/docs/interfaces/GridSortConfiguration.html +6 -0
  121. package/docs/interfaces/GridTreeConfiguration.html +33 -0
  122. package/docs/interfaces/PaginationConfiguration.html +18 -0
  123. package/docs/interfaces/PaginationState.html +10 -0
  124. package/docs/interfaces/XLSXExportOptions.html +17 -0
  125. package/docs/media/package.json +83 -0
  126. package/docs/media/publish.yml +111 -0
  127. package/docs/modules.html +1 -0
  128. package/docs/types/ApexCellContext.html +2 -0
  129. package/docs/types/ApexEditorContext.html +2 -0
  130. package/docs/types/BasePropertyType.html +2 -0
  131. package/docs/types/BaseSortComparer.html +2 -0
  132. package/docs/types/ColumnConfiguration.html +2 -0
  133. package/docs/types/ColumnDropPosition.html +2 -0
  134. package/docs/types/ColumnSortConfiguration.html +2 -0
  135. package/docs/types/DataPipelineHook.html +2 -0
  136. package/docs/types/DataPipelineParams.html +8 -0
  137. package/docs/types/DataType.html +30 -0
  138. package/docs/types/EditMode.html +6 -0
  139. package/docs/types/EditTrigger.html +4 -0
  140. package/docs/types/ExportCellValue.html +5 -0
  141. package/docs/types/ExportSource.html +8 -0
  142. package/docs/types/FilterCriteria.html +6 -0
  143. package/docs/types/FilterExpression.html +2 -0
  144. package/docs/types/Keys.html +2 -0
  145. package/docs/types/PaginationMode.html +6 -0
  146. package/docs/types/PinPosition.html +5 -0
  147. package/docs/types/PropertyType.html +2 -0
  148. package/docs/types/SelectionMode.html +7 -0
  149. package/docs/types/SortComparer.html +2 -0
  150. package/docs/types/SortExpression.html +2 -0
  151. package/docs/types/SortState.html +2 -0
  152. package/docs/types/SortingDirection.html +3 -0
  153. package/index.d.ts +11 -0
  154. package/{dist/src/index.js → index.js} +1 -0
  155. package/index.js.map +1 -0
  156. package/internal/column-types.d.ts +94 -0
  157. package/internal/column-types.js +268 -0
  158. package/internal/column-types.js.map +1 -0
  159. package/{dist/src/internal → internal}/constants.d.ts +0 -1
  160. package/internal/constants.js.map +1 -0
  161. package/internal/export.d.ts +106 -0
  162. package/internal/export.js +122 -0
  163. package/internal/export.js.map +1 -0
  164. package/internal/flip.d.ts +80 -0
  165. package/internal/flip.js +52 -0
  166. package/internal/flip.js.map +1 -0
  167. package/internal/icons.d.ts +24 -0
  168. package/internal/icons.js +134 -0
  169. package/internal/icons.js.map +1 -0
  170. package/{dist/src/internal → internal}/is-defined.d.ts +0 -1
  171. package/internal/is-defined.js.map +1 -0
  172. package/{dist/src/internal → internal}/mixins/event-emitter.d.ts +0 -1
  173. package/internal/mixins/event-emitter.js.map +1 -0
  174. package/{dist/src/internal → internal}/normalize-case.d.ts +0 -1
  175. package/internal/normalize-case.js.map +1 -0
  176. package/{dist/src/internal → internal}/part-map.d.ts +0 -1
  177. package/{dist/src/internal → internal}/part-map.js +1 -1
  178. package/internal/part-map.js.map +1 -0
  179. package/{dist/src/internal → internal}/register.d.ts +3 -4
  180. package/internal/register.js +9 -0
  181. package/internal/register.js.map +1 -0
  182. package/{dist/src/internal → internal}/tags.d.ts +2 -1
  183. package/{dist/src/internal → internal}/tags.js +2 -0
  184. package/internal/tags.js.map +1 -0
  185. package/internal/theming.d.ts +34 -0
  186. package/internal/theming.js +123 -0
  187. package/internal/theming.js.map +1 -0
  188. package/internal/types.d.ts +619 -0
  189. package/internal/types.js.map +1 -0
  190. package/internal/utils.d.ts +29 -0
  191. package/internal/utils.js +75 -0
  192. package/internal/utils.js.map +1 -0
  193. package/{dist/src/internal → internal}/watch.d.ts +0 -1
  194. package/{dist/src/internal → internal}/watch.js +2 -2
  195. package/internal/watch.js.map +1 -0
  196. package/internal/xlsx.d.ts +22 -0
  197. package/internal/xlsx.js +228 -0
  198. package/internal/xlsx.js.map +1 -0
  199. package/{dist/src/operations → operations}/base.d.ts +0 -1
  200. package/operations/base.js.map +1 -0
  201. package/{dist/src/operations → operations}/filter/operands/boolean.d.ts +0 -1
  202. package/{dist/src/operations → operations}/filter/operands/boolean.js +5 -5
  203. package/operations/filter/operands/boolean.js.map +1 -0
  204. package/{dist/src/operations → operations}/filter/operands/number.d.ts +0 -1
  205. package/{dist/src/operations → operations}/filter/operands/number.js +2 -2
  206. package/operations/filter/operands/number.js.map +1 -0
  207. package/{dist/src/operations → operations}/filter/operands/string.d.ts +0 -1
  208. package/{dist/src/operations → operations}/filter/operands/string.js +2 -2
  209. package/operations/filter/operands/string.js.map +1 -0
  210. package/{dist/src/operations → operations}/filter/state.d.ts +1 -2
  211. package/{dist/src/operations → operations}/filter/state.js +3 -4
  212. package/operations/filter/state.js.map +1 -0
  213. package/{dist/src/operations → operations}/filter/tree.d.ts +1 -2
  214. package/{dist/src/operations → operations}/filter/tree.js +5 -6
  215. package/operations/filter/tree.js.map +1 -0
  216. package/{dist/src/operations → operations}/filter/types.d.ts +0 -1
  217. package/operations/filter/types.js.map +1 -0
  218. package/{dist/src/operations → operations}/filter.d.ts +0 -1
  219. package/{dist/src/operations → operations}/filter.js +4 -7
  220. package/operations/filter.js.map +1 -0
  221. package/operations/pagination.d.ts +19 -0
  222. package/operations/pagination.js +12 -0
  223. package/operations/pagination.js.map +1 -0
  224. package/operations/quick-filter.d.ts +21 -0
  225. package/operations/quick-filter.js +26 -0
  226. package/operations/quick-filter.js.map +1 -0
  227. package/{dist/src/operations → operations}/sort/types.d.ts +0 -1
  228. package/operations/sort/types.js.map +1 -0
  229. package/{dist/src/operations → operations}/sort.d.ts +0 -1
  230. package/{dist/src/operations → operations}/sort.js +5 -5
  231. package/operations/sort.js.map +1 -0
  232. package/package.json +25 -83
  233. package/setup.d.ts +58 -0
  234. package/setup.js +29 -0
  235. package/setup.js.map +1 -0
  236. package/{dist/src/styles/body-row/body-row-styles.css.d.ts → styles/_common.css.d.ts} +0 -1
  237. package/styles/_common.css.js +3 -0
  238. package/styles/_common.css.js.map +1 -0
  239. package/{dist/src/styles/body-cell/body-cell-styles.css.d.ts → styles/body-cell/body-cell.css.d.ts} +0 -1
  240. package/styles/body-cell/body-cell.css.js +3 -0
  241. package/styles/body-cell/body-cell.css.js.map +1 -0
  242. package/{dist/src/styles/filter-row/filter-row-styles.css.d.ts → styles/body-row/body-row.css.d.ts} +0 -1
  243. package/styles/body-row/body-row.css.js +3 -0
  244. package/styles/body-row/body-row.css.js.map +1 -0
  245. package/{dist/src/styles/grid/themes/light/grid.fluent-styles.css.d.ts → styles/filter-row/filter-row.css.d.ts} +0 -1
  246. package/styles/filter-row/filter-row.css.js +3 -0
  247. package/styles/filter-row/filter-row.css.js.map +1 -0
  248. package/styles/grid/_grid.base.css.d.ts +1 -0
  249. package/styles/grid/_grid.base.css.js +3 -0
  250. package/styles/grid/_grid.base.css.js.map +1 -0
  251. package/styles/grid/themes/light/grid.bootstrap.css.d.ts +1 -0
  252. package/styles/grid/themes/light/grid.bootstrap.css.js +3 -0
  253. package/styles/grid/themes/light/grid.bootstrap.css.js.map +1 -0
  254. package/styles/grid/themes/light/grid.fluent.css.d.ts +1 -0
  255. package/styles/grid/themes/light/grid.fluent.css.js +3 -0
  256. package/styles/grid/themes/light/grid.fluent.css.js.map +1 -0
  257. package/styles/grid/themes/light/grid.indigo.css.d.ts +1 -0
  258. package/styles/grid/themes/light/grid.indigo.css.js +3 -0
  259. package/styles/grid/themes/light/grid.indigo.css.js.map +1 -0
  260. package/styles/grid/themes/light/grid.material.css.d.ts +1 -0
  261. package/styles/grid/themes/light/grid.material.css.js +3 -0
  262. package/styles/grid/themes/light/grid.material.css.js.map +1 -0
  263. package/styles/header-cell/header-cell.css.d.ts +1 -0
  264. package/styles/header-cell/header-cell.css.js +3 -0
  265. package/styles/header-cell/header-cell.css.js.map +1 -0
  266. package/styles/header-row/header-row.base.css.d.ts +1 -0
  267. package/styles/header-row/header-row.base.css.js +3 -0
  268. package/styles/header-row/header-row.base.css.js.map +1 -0
  269. package/styles/paginator/paginator.css.d.ts +1 -0
  270. package/styles/paginator/paginator.css.js +3 -0
  271. package/styles/paginator/paginator.css.js.map +1 -0
  272. package/styles/toolbar/toolbar.css.d.ts +1 -0
  273. package/styles/toolbar/toolbar.css.js +3 -0
  274. package/styles/toolbar/toolbar.css.js.map +1 -0
  275. package/styles.css +17 -0
  276. package/dist/bundle.js +0 -2194
  277. package/dist/docs/assets/highlight.css +0 -43
  278. package/dist/docs/assets/main.js +0 -58
  279. package/dist/docs/assets/search.js +0 -1
  280. package/dist/docs/assets/style.css +0 -1365
  281. package/dist/docs/classes/ApexGrid.html +0 -327
  282. package/dist/docs/index.html +0 -82
  283. package/dist/docs/interfaces/ApexFilteredEvent.html +0 -104
  284. package/dist/docs/interfaces/ApexFilteringEvent.html +0 -116
  285. package/dist/docs/interfaces/ApexGridEventMap.html +0 -127
  286. package/dist/docs/interfaces/ApexHeaderContext.html +0 -104
  287. package/dist/docs/interfaces/BaseApexCellContext.html +0 -120
  288. package/dist/docs/interfaces/BaseColumnConfiguration.html +0 -196
  289. package/dist/docs/interfaces/BaseColumnSortConfiguration.html +0 -106
  290. package/dist/docs/interfaces/BaseFilterExpression.html +0 -132
  291. package/dist/docs/interfaces/BaseSortExpression.html +0 -124
  292. package/dist/docs/interfaces/ColumnFilterConfiguration.html +0 -92
  293. package/dist/docs/interfaces/DataPipelineConfiguration.html +0 -104
  294. package/dist/docs/interfaces/GridSortConfiguration.html +0 -99
  295. package/dist/docs/modules.html +0 -102
  296. package/dist/docs/types/ApexCellContext.html +0 -74
  297. package/dist/docs/types/BasePropertyType.html +0 -74
  298. package/dist/docs/types/BaseSortComparer.html +0 -89
  299. package/dist/docs/types/ColumnConfiguration.html +0 -74
  300. package/dist/docs/types/ColumnSortConfiguration.html +0 -74
  301. package/dist/docs/types/DataPipelineHook.html +0 -85
  302. package/dist/docs/types/DataPipelineParams.html +0 -87
  303. package/dist/docs/types/DataType.html +0 -67
  304. package/dist/docs/types/FilterCriteria.html +0 -71
  305. package/dist/docs/types/FilterExpression.html +0 -74
  306. package/dist/docs/types/Keys.html +0 -72
  307. package/dist/docs/types/PropertyType.html +0 -74
  308. package/dist/docs/types/SortComparer.html +0 -74
  309. package/dist/docs/types/SortExpression.html +0 -74
  310. package/dist/docs/types/SortState.html +0 -72
  311. package/dist/docs/types/SortingDirection.html +0 -69
  312. package/dist/src/components/cell.d.ts +0 -36
  313. package/dist/src/components/cell.d.ts.map +0 -1
  314. package/dist/src/components/cell.js +0 -55
  315. package/dist/src/components/cell.js.map +0 -1
  316. package/dist/src/components/filter-row.d.ts.map +0 -1
  317. package/dist/src/components/filter-row.js +0 -316
  318. package/dist/src/components/filter-row.js.map +0 -1
  319. package/dist/src/components/grid.d.ts +0 -226
  320. package/dist/src/components/grid.d.ts.map +0 -1
  321. package/dist/src/components/grid.js +0 -309
  322. package/dist/src/components/grid.js.map +0 -1
  323. package/dist/src/components/header-row.d.ts +0 -24
  324. package/dist/src/components/header-row.d.ts.map +0 -1
  325. package/dist/src/components/header-row.js +0 -78
  326. package/dist/src/components/header-row.js.map +0 -1
  327. package/dist/src/components/header.d.ts.map +0 -1
  328. package/dist/src/components/header.js +0 -144
  329. package/dist/src/components/header.js.map +0 -1
  330. package/dist/src/components/row.d.ts +0 -25
  331. package/dist/src/components/row.d.ts.map +0 -1
  332. package/dist/src/components/row.js +0 -68
  333. package/dist/src/components/row.js.map +0 -1
  334. package/dist/src/components/virtualizer.d.ts.map +0 -1
  335. package/dist/src/components/virtualizer.js.map +0 -1
  336. package/dist/src/controllers/data-operation.d.ts +0 -18
  337. package/dist/src/controllers/data-operation.d.ts.map +0 -1
  338. package/dist/src/controllers/data-operation.js +0 -37
  339. package/dist/src/controllers/data-operation.js.map +0 -1
  340. package/dist/src/controllers/dom.d.ts +0 -20
  341. package/dist/src/controllers/dom.d.ts.map +0 -1
  342. package/dist/src/controllers/dom.js +0 -60
  343. package/dist/src/controllers/dom.js.map +0 -1
  344. package/dist/src/controllers/filter.d.ts.map +0 -1
  345. package/dist/src/controllers/filter.js +0 -119
  346. package/dist/src/controllers/filter.js.map +0 -1
  347. package/dist/src/controllers/navigation.d.ts.map +0 -1
  348. package/dist/src/controllers/navigation.js.map +0 -1
  349. package/dist/src/controllers/resize.d.ts.map +0 -1
  350. package/dist/src/controllers/resize.js +0 -70
  351. package/dist/src/controllers/resize.js.map +0 -1
  352. package/dist/src/controllers/sort.d.ts.map +0 -1
  353. package/dist/src/controllers/sort.js +0 -94
  354. package/dist/src/controllers/sort.js.map +0 -1
  355. package/dist/src/controllers/state.d.ts +0 -25
  356. package/dist/src/controllers/state.d.ts.map +0 -1
  357. package/dist/src/controllers/state.js +0 -40
  358. package/dist/src/controllers/state.js.map +0 -1
  359. package/dist/src/define.d.ts.map +0 -1
  360. package/dist/src/define.js.map +0 -1
  361. package/dist/src/index.d.ts +0 -9
  362. package/dist/src/index.d.ts.map +0 -1
  363. package/dist/src/index.js.map +0 -1
  364. package/dist/src/internal/constants.d.ts.map +0 -1
  365. package/dist/src/internal/constants.js.map +0 -1
  366. package/dist/src/internal/icon-registry.d.ts +0 -2
  367. package/dist/src/internal/icon-registry.d.ts.map +0 -1
  368. package/dist/src/internal/icon-registry.js +0 -29
  369. package/dist/src/internal/icon-registry.js.map +0 -1
  370. package/dist/src/internal/is-defined.d.ts.map +0 -1
  371. package/dist/src/internal/is-defined.js.map +0 -1
  372. package/dist/src/internal/mixins/event-emitter.d.ts.map +0 -1
  373. package/dist/src/internal/mixins/event-emitter.js.map +0 -1
  374. package/dist/src/internal/normalize-case.d.ts.map +0 -1
  375. package/dist/src/internal/normalize-case.js.map +0 -1
  376. package/dist/src/internal/part-map.d.ts.map +0 -1
  377. package/dist/src/internal/part-map.js.map +0 -1
  378. package/dist/src/internal/register.d.ts.map +0 -1
  379. package/dist/src/internal/register.js +0 -9
  380. package/dist/src/internal/register.js.map +0 -1
  381. package/dist/src/internal/tags.d.ts.map +0 -1
  382. package/dist/src/internal/tags.js.map +0 -1
  383. package/dist/src/internal/types.d.ts +0 -199
  384. package/dist/src/internal/types.d.ts.map +0 -1
  385. package/dist/src/internal/types.js.map +0 -1
  386. package/dist/src/internal/utils.d.ts +0 -7
  387. package/dist/src/internal/utils.d.ts.map +0 -1
  388. package/dist/src/internal/utils.js +0 -37
  389. package/dist/src/internal/utils.js.map +0 -1
  390. package/dist/src/internal/watch.d.ts.map +0 -1
  391. package/dist/src/internal/watch.js.map +0 -1
  392. package/dist/src/operations/base.d.ts.map +0 -1
  393. package/dist/src/operations/base.js.map +0 -1
  394. package/dist/src/operations/filter/operands/boolean.d.ts.map +0 -1
  395. package/dist/src/operations/filter/operands/boolean.js.map +0 -1
  396. package/dist/src/operations/filter/operands/number.d.ts.map +0 -1
  397. package/dist/src/operations/filter/operands/number.js.map +0 -1
  398. package/dist/src/operations/filter/operands/string.d.ts.map +0 -1
  399. package/dist/src/operations/filter/operands/string.js.map +0 -1
  400. package/dist/src/operations/filter/state.d.ts.map +0 -1
  401. package/dist/src/operations/filter/state.js.map +0 -1
  402. package/dist/src/operations/filter/tree.d.ts.map +0 -1
  403. package/dist/src/operations/filter/tree.js.map +0 -1
  404. package/dist/src/operations/filter/types.d.ts.map +0 -1
  405. package/dist/src/operations/filter/types.js.map +0 -1
  406. package/dist/src/operations/filter.d.ts.map +0 -1
  407. package/dist/src/operations/filter.js.map +0 -1
  408. package/dist/src/operations/sort/types.d.ts.map +0 -1
  409. package/dist/src/operations/sort/types.js.map +0 -1
  410. package/dist/src/operations/sort.d.ts.map +0 -1
  411. package/dist/src/operations/sort.js.map +0 -1
  412. package/dist/src/styles/body-cell/body-cell-styles.css.d.ts.map +0 -1
  413. package/dist/src/styles/body-cell/body-cell-styles.css.js +0 -71
  414. package/dist/src/styles/body-cell/body-cell-styles.css.js.map +0 -1
  415. package/dist/src/styles/body-row/body-row-styles.css.d.ts.map +0 -1
  416. package/dist/src/styles/body-row/body-row-styles.css.js +0 -38
  417. package/dist/src/styles/body-row/body-row-styles.css.js.map +0 -1
  418. package/dist/src/styles/filter-row/filter-row-styles.css.d.ts.map +0 -1
  419. package/dist/src/styles/filter-row/filter-row-styles.css.js +0 -96
  420. package/dist/src/styles/filter-row/filter-row-styles.css.js.map +0 -1
  421. package/dist/src/styles/grid/themes/light/grid.bootstrap-styles.css.d.ts +0 -2
  422. package/dist/src/styles/grid/themes/light/grid.bootstrap-styles.css.d.ts.map +0 -1
  423. package/dist/src/styles/grid/themes/light/grid.bootstrap-styles.css.js +0 -83
  424. package/dist/src/styles/grid/themes/light/grid.bootstrap-styles.css.js.map +0 -1
  425. package/dist/src/styles/grid/themes/light/grid.fluent-styles.css.d.ts.map +0 -1
  426. package/dist/src/styles/grid/themes/light/grid.fluent-styles.css.js +0 -83
  427. package/dist/src/styles/grid/themes/light/grid.fluent-styles.css.js.map +0 -1
  428. package/dist/src/styles/grid/themes/light/grid.indigo-styles.css.d.ts +0 -2
  429. package/dist/src/styles/grid/themes/light/grid.indigo-styles.css.d.ts.map +0 -1
  430. package/dist/src/styles/grid/themes/light/grid.indigo-styles.css.js +0 -83
  431. package/dist/src/styles/grid/themes/light/grid.indigo-styles.css.js.map +0 -1
  432. package/dist/src/styles/grid/themes/light/grid.material-styles.css.d.ts +0 -2
  433. package/dist/src/styles/grid/themes/light/grid.material-styles.css.d.ts.map +0 -1
  434. package/dist/src/styles/grid/themes/light/grid.material-styles.css.js +0 -83
  435. package/dist/src/styles/grid/themes/light/grid.material-styles.css.js.map +0 -1
  436. package/dist/src/styles/header-cell/header-cell-styles.css.d.ts +0 -2
  437. package/dist/src/styles/header-cell/header-cell-styles.css.d.ts.map +0 -1
  438. package/dist/src/styles/header-cell/header-cell-styles.css.js +0 -141
  439. package/dist/src/styles/header-cell/header-cell-styles.css.js.map +0 -1
  440. package/dist/src/styles/header-row/header-row.base-styles.css.d.ts +0 -2
  441. package/dist/src/styles/header-row/header-row.base-styles.css.d.ts.map +0 -1
  442. package/dist/src/styles/header-row/header-row.base-styles.css.js +0 -35
  443. package/dist/src/styles/header-row/header-row.base-styles.css.js.map +0 -1
  444. /package/{dist/src/define.js → define.js} +0 -0
  445. /package/{dist/docs → docs}/.nojekyll +0 -0
  446. /package/{dist/src/internal → internal}/constants.js +0 -0
  447. /package/{dist/src/internal → internal}/is-defined.js +0 -0
  448. /package/{dist/src/internal → internal}/mixins/event-emitter.js +0 -0
  449. /package/{dist/src/internal → internal}/normalize-case.js +0 -0
  450. /package/{dist/src/internal → internal}/types.js +0 -0
  451. /package/{dist/src/operations → operations}/base.js +0 -0
  452. /package/{dist/src/operations → operations}/filter/types.js +0 -0
  453. /package/{dist/src/operations → operations}/sort/types.js +0 -0
package/index.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export type { ApexCellValueChangedEvent, ApexCellValueChangingEvent, ApexColumnMovedEvent, ApexColumnMovingEvent, ApexColumnPinnedEvent, ApexColumnPinningEvent, ApexFilteredEvent, ApexFilteringEvent, ApexGridEventMap, ApexPageChangedEvent, ApexPageChangingEvent, ApexQuickFilterChangedEvent, ApexQuickFilterChangingEvent, ApexRowEditEndedEvent, ApexRowEditStartedEvent, ApexRowExpandedEvent, ApexRowExpandingEvent, ApexRowSelectedEvent, ApexRowSelectingEvent, ApexTreeRowExpandedEvent, ApexTreeRowExpandingEvent, ColumnDropPosition, } from './components/grid.js';
2
+ export { ApexGrid } from './components/grid.js';
3
+ export type { CSVExportOptions, ExportCellValue, ExportOptions, ExportSource, XLSXExportOptions, } from './internal/export.js';
4
+ export type { ApexCellContext, ApexDetailContext, ApexEditorContext, ApexHeaderContext, BaseApexCellContext, BaseApexEditorContext, BaseColumnConfiguration, BaseColumnSortConfiguration, BasePropertyType, ColumnConfiguration, ColumnFilterConfiguration, ColumnSortConfiguration, DataPipelineConfiguration, DataPipelineHook, DataPipelineParams, DataType, EditMode, EditTrigger, GridEditingConfiguration, GridExpansionConfiguration, GridSelectionConfiguration, GridSortConfiguration, GridTreeConfiguration, Keys, PaginationConfiguration, PaginationMode, PaginationState, PinPosition, PropertyType, SelectionMode, } from './internal/types.js';
5
+ export { BooleanOperands } from './operations/filter/operands/boolean.js';
6
+ export { NumberOperands } from './operations/filter/operands/number.js';
7
+ export { StringOperands } from './operations/filter/operands/string.js';
8
+ export type { BaseFilterExpression, FilterCriteria, FilterExpression, FilterOperation, FilterOperationLogic, OperandKeys, } from './operations/filter/types.js';
9
+ export type { BaseSortComparer, BaseSortExpression, SortComparer, SortExpression, SortingDirection, SortState, } from './operations/sort/types.js';
10
+ export type { ApexGridSetupOptions } from './setup.js';
11
+ export { setup } from './setup.js';
@@ -2,4 +2,5 @@ export { ApexGrid } from './components/grid.js';
2
2
  export { BooleanOperands } from './operations/filter/operands/boolean.js';
3
3
  export { NumberOperands } from './operations/filter/operands/number.js';
4
4
  export { StringOperands } from './operations/filter/operands/string.js';
5
+ export { setup } from './setup.js';
5
6
  //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAwChD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAkBxE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export type {\n ApexCellValueChangedEvent,\n ApexCellValueChangingEvent,\n ApexColumnMovedEvent,\n ApexColumnMovingEvent,\n ApexColumnPinnedEvent,\n ApexColumnPinningEvent,\n ApexFilteredEvent,\n ApexFilteringEvent,\n ApexGridEventMap,\n ApexPageChangedEvent,\n ApexPageChangingEvent,\n ApexQuickFilterChangedEvent,\n ApexQuickFilterChangingEvent,\n ApexRowEditEndedEvent,\n ApexRowEditStartedEvent,\n ApexRowExpandedEvent,\n ApexRowExpandingEvent,\n ApexRowSelectedEvent,\n ApexRowSelectingEvent,\n ApexTreeRowExpandedEvent,\n ApexTreeRowExpandingEvent,\n ColumnDropPosition,\n} from './components/grid.js';\nexport { ApexGrid } from './components/grid.js';\nexport type {\n CSVExportOptions,\n ExportCellValue,\n ExportOptions,\n ExportSource,\n XLSXExportOptions,\n} from './internal/export.js';\nexport type {\n ApexCellContext,\n ApexDetailContext,\n ApexEditorContext,\n ApexHeaderContext,\n BaseApexCellContext,\n BaseApexEditorContext,\n BaseColumnConfiguration,\n BaseColumnSortConfiguration,\n BasePropertyType,\n ColumnConfiguration,\n ColumnFilterConfiguration,\n ColumnSortConfiguration,\n DataPipelineConfiguration,\n DataPipelineHook,\n DataPipelineParams,\n DataType,\n EditMode,\n EditTrigger,\n GridEditingConfiguration,\n GridExpansionConfiguration,\n GridSelectionConfiguration,\n GridSortConfiguration,\n GridTreeConfiguration,\n Keys,\n PaginationConfiguration,\n PaginationMode,\n PaginationState,\n PinPosition,\n PropertyType,\n SelectionMode,\n} from './internal/types.js';\nexport { BooleanOperands } from './operations/filter/operands/boolean.js';\nexport { NumberOperands } from './operations/filter/operands/number.js';\nexport { StringOperands } from './operations/filter/operands/string.js';\nexport type {\n BaseFilterExpression,\n FilterCriteria,\n FilterExpression,\n FilterOperation,\n FilterOperationLogic,\n OperandKeys,\n} from './operations/filter/types.js';\nexport type {\n BaseSortComparer,\n BaseSortExpression,\n SortComparer,\n SortExpression,\n SortingDirection,\n SortState,\n} from './operations/sort/types.js';\nexport type { ApexGridSetupOptions } from './setup.js';\nexport { setup } from './setup.js';\n"]}
@@ -0,0 +1,94 @@
1
+ import { type TemplateResult } from 'lit';
2
+ import type ApexGridCell from '../components/cell.js';
3
+ import type ApexGridRow from '../components/row.js';
4
+ import type { ColumnConfiguration } from './types.js';
5
+ /**
6
+ * An option entry for a `'select'` column. May be either a bare value (the
7
+ * displayed label is `String(value)`) or an explicit `{ value, label }` pair.
8
+ */
9
+ export type SelectOption<V = unknown> = V | {
10
+ value: V;
11
+ label?: string;
12
+ };
13
+ /**
14
+ * The flat, non-distributive cell context handed to a column-type renderer's
15
+ * `display` function. Mirrors {@link ApexCellContext} but uses `unknown` for
16
+ * `value` so renderers can author against a single shape without
17
+ * conditional-type narrowing in generic positions.
18
+ */
19
+ export interface ColumnTypeCellContext<T extends object> {
20
+ parent: ApexGridCell<T>;
21
+ row: ApexGridRow<T>;
22
+ column: ColumnConfiguration<T>;
23
+ value: unknown;
24
+ /**
25
+ * Commits a new value for this cell without entering edit mode. Only
26
+ * present when the column is editable. Used by interactive display
27
+ * widgets like the boolean checkbox.
28
+ */
29
+ commit?(value: unknown): Promise<boolean>;
30
+ }
31
+ /**
32
+ * Cell context handed to a column-type renderer's `editor` function. Adds the
33
+ * `commit` / `cancel` helpers wired through {@link EditingController}.
34
+ */
35
+ export interface ColumnTypeEditorContext<T extends object> extends ColumnTypeCellContext<T> {
36
+ commit(value: unknown): Promise<boolean>;
37
+ cancel(): void;
38
+ }
39
+ /**
40
+ * Built-in column-type renderer contract. A renderer can supply either a
41
+ * display template, an editor template, or both. Cells fall back to the
42
+ * column's `cellTemplate` / `editorTemplate` / built-in primitive editor if
43
+ * the renderer is absent.
44
+ */
45
+ export interface ColumnTypeRenderer<T extends object> {
46
+ /**
47
+ * Renders the display (read-only) representation of the cell.
48
+ *
49
+ * @remarks
50
+ * Called when the cell is not in edit mode and the column has no
51
+ * `cellTemplate`. Return any lit-renderable value.
52
+ */
53
+ display?(ctx: ColumnTypeCellContext<T>): TemplateResult | unknown;
54
+ /**
55
+ * Renders the inline editor while the cell is in edit mode.
56
+ *
57
+ * @remarks
58
+ * Called when the cell is in edit mode and the column has no
59
+ * `editorTemplate`. The returned template SHOULD include `data-apex-editor`
60
+ * on its focusable element so the cell auto-focuses it. The editor is
61
+ * responsible for calling `ctx.commit(value)` / `ctx.cancel()`.
62
+ */
63
+ editor?(ctx: ColumnTypeEditorContext<T>): TemplateResult | unknown;
64
+ }
65
+ interface NormalizedSelectOption {
66
+ value: unknown;
67
+ label: string;
68
+ }
69
+ /**
70
+ * Normalizes a column's `options` configuration into a uniform
71
+ * `{ value, label }[]` list. Accepts both bare-value entries and explicit
72
+ * `{ value, label }` pairs.
73
+ */
74
+ export declare function getSelectOptions(column: {
75
+ options?: SelectOption[];
76
+ }): NormalizedSelectOption[];
77
+ /**
78
+ * Parses a stored cell value into a `Date`, or `null` when the value can't be
79
+ * resolved to a real date.
80
+ *
81
+ * @remarks
82
+ * Accepts `Date` instances, ISO/parseable strings, and millisecond
83
+ * timestamps. `YYYY-MM-DD` strings are interpreted as **floating dates**
84
+ * (local midnight) rather than UTC midnight, so they render on the same
85
+ * calendar day in every timezone.
86
+ */
87
+ export declare function parseDate(value: unknown): Date | null;
88
+ /**
89
+ * Returns the built-in renderer for a column `type`, or `undefined` when the
90
+ * type has no built-in display/editor (the cell falls back to plain text /
91
+ * the primitive editor in that case).
92
+ */
93
+ export declare function getColumnTypeRenderer<T extends object>(type?: string): ColumnTypeRenderer<T> | undefined;
94
+ export {};
@@ -0,0 +1,268 @@
1
+ import { html, nothing } from 'lit';
2
+ import { ref } from 'lit/directives/ref.js';
3
+ import { renderIcon } from './icons.js';
4
+ const RATING_DEFAULT_MAX = 5;
5
+ function getRatingMax(column) {
6
+ const max = typeof column.max === 'number' ? Math.floor(column.max) : RATING_DEFAULT_MAX;
7
+ return max > 0 ? max : RATING_DEFAULT_MAX;
8
+ }
9
+ function clampRating(value, max) {
10
+ const n = typeof value === 'number' ? value : Number(value ?? 0);
11
+ if (!Number.isFinite(n))
12
+ return 0;
13
+ if (n < 0)
14
+ return 0;
15
+ if (n > max)
16
+ return max;
17
+ return Math.round(n);
18
+ }
19
+ export function getSelectOptions(column) {
20
+ const raw = column.options ?? [];
21
+ return raw.map((entry) => {
22
+ if (entry !== null && typeof entry === 'object' && 'value' in entry) {
23
+ const opt = entry;
24
+ return { value: opt.value, label: opt.label ?? String(opt.value) };
25
+ }
26
+ return { value: entry, label: String(entry) };
27
+ });
28
+ }
29
+ const selectType = {
30
+ display(ctx) {
31
+ const opts = getSelectOptions(ctx.column);
32
+ const match = opts.find((o) => o.value === ctx.value);
33
+ const label = match?.label ?? (ctx.value == null ? '' : String(ctx.value));
34
+ return html `<span part="select-label">${label}</span>`;
35
+ },
36
+ editor(ctx) {
37
+ const opts = getSelectOptions(ctx.column);
38
+ const current = ctx.value;
39
+ const match = opts.find((o) => o.value === current);
40
+ const label = match?.label ?? (current == null ? '' : String(current));
41
+ const selectedIdx = Math.max(0, opts.findIndex((o) => o.value === current));
42
+ const mountPopover = (el) => {
43
+ if (!el)
44
+ return;
45
+ const popover = el;
46
+ if (popover.dataset.apexFocused)
47
+ return;
48
+ popover.dataset.apexFocused = '1';
49
+ const items = Array.from(popover.querySelectorAll('[part~="select-option"]'));
50
+ items[selectedIdx]?.focus();
51
+ };
52
+ const handleKeydown = (event) => {
53
+ const target = event.target;
54
+ const list = target.closest('[part~="select-popover"]');
55
+ if (!list)
56
+ return;
57
+ const items = Array.from(list.querySelectorAll('[part~="select-option"]'));
58
+ const idx = items.indexOf(target);
59
+ if (idx < 0)
60
+ return;
61
+ if (event.key === 'ArrowDown') {
62
+ event.preventDefault();
63
+ event.stopPropagation();
64
+ items[Math.min(idx + 1, items.length - 1)]?.focus();
65
+ }
66
+ else if (event.key === 'ArrowUp') {
67
+ event.preventDefault();
68
+ event.stopPropagation();
69
+ items[Math.max(idx - 1, 0)]?.focus();
70
+ }
71
+ else if (event.key === 'Home') {
72
+ event.preventDefault();
73
+ event.stopPropagation();
74
+ items[0]?.focus();
75
+ }
76
+ else if (event.key === 'End') {
77
+ event.preventDefault();
78
+ event.stopPropagation();
79
+ items[items.length - 1]?.focus();
80
+ }
81
+ else if (event.key === 'Enter' || event.key === ' ') {
82
+ event.preventDefault();
83
+ event.stopPropagation();
84
+ ctx.commit(opts[idx].value);
85
+ }
86
+ };
87
+ return html `<span part="select-label">${label}</span>
88
+ <div
89
+ part="select-popover"
90
+ role="listbox"
91
+ @keydown=${handleKeydown}
92
+ ${ref(mountPopover)}
93
+ >
94
+ ${opts.map((o, i) => html `<div
95
+ part=${o.value === current ? 'select-option selected' : 'select-option'}
96
+ role="option"
97
+ aria-selected=${o.value === current ? 'true' : 'false'}
98
+ tabindex=${i === selectedIdx ? '0' : '-1'}
99
+ data-apex-editor=${i === selectedIdx ? '' : nothing}
100
+ @click=${() => ctx.commit(o.value)}
101
+ >
102
+ ${o.label}
103
+ </div>`)}
104
+ </div>`;
105
+ },
106
+ };
107
+ export function parseDate(value) {
108
+ if (value instanceof Date) {
109
+ return Number.isNaN(value.getTime()) ? null : value;
110
+ }
111
+ if (typeof value === 'number') {
112
+ const d = new Date(value);
113
+ return Number.isNaN(d.getTime()) ? null : d;
114
+ }
115
+ if (typeof value === 'string') {
116
+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
117
+ if (match) {
118
+ const [, y, m, d] = match;
119
+ const date = new Date(Number(y), Number(m) - 1, Number(d));
120
+ return Number.isNaN(date.getTime()) ? null : date;
121
+ }
122
+ const date = new Date(value);
123
+ return Number.isNaN(date.getTime()) ? null : date;
124
+ }
125
+ return null;
126
+ }
127
+ function toDateInputValue(date) {
128
+ const y = date.getFullYear();
129
+ const m = String(date.getMonth() + 1).padStart(2, '0');
130
+ const d = String(date.getDate()).padStart(2, '0');
131
+ return `${y}-${m}-${d}`;
132
+ }
133
+ function formatDateValue(value, style) {
134
+ const date = parseDate(value);
135
+ if (!date)
136
+ return '';
137
+ return new Intl.DateTimeFormat(undefined, {
138
+ dateStyle: style,
139
+ }).format(date);
140
+ }
141
+ function commitDateInSameShape(original, next) {
142
+ if (next === null)
143
+ return null;
144
+ if (original instanceof Date)
145
+ return next;
146
+ if (typeof original === 'number')
147
+ return next.getTime();
148
+ return toDateInputValue(next);
149
+ }
150
+ const dateType = {
151
+ display(ctx) {
152
+ const style = ctx.column.format ?? 'medium';
153
+ return html `${formatDateValue(ctx.value, style)}`;
154
+ },
155
+ editor(ctx) {
156
+ const initial = parseDate(ctx.value);
157
+ const initialInput = initial ? toDateInputValue(initial) : '';
158
+ const handleChange = (event) => {
159
+ const raw = event.target.value;
160
+ const next = raw ? parseDate(raw) : null;
161
+ ctx.commit(commitDateInSameShape(ctx.value, next));
162
+ };
163
+ const handleKeydown = (event) => {
164
+ if (event.key === 'Enter') {
165
+ event.preventDefault();
166
+ event.stopPropagation();
167
+ const raw = event.target.value;
168
+ const next = raw ? parseDate(raw) : null;
169
+ ctx.commit(commitDateInSameShape(ctx.value, next));
170
+ }
171
+ };
172
+ return html `<input
173
+ type="date"
174
+ part="editor"
175
+ data-apex-editor
176
+ .value=${initialInput}
177
+ @change=${handleChange}
178
+ @keydown=${handleKeydown}
179
+ />`;
180
+ },
181
+ };
182
+ const ratingType = {
183
+ display(ctx) {
184
+ const max = getRatingMax(ctx.column);
185
+ const value = clampRating(ctx.value, max);
186
+ const stars = Array.from({ length: max }, (_, i) => i < value);
187
+ return html `<span part="rating" role="img" aria-label="${value} of ${max}">
188
+ ${stars.map((filled) => html `<span part=${filled ? 'rating-star filled' : 'rating-star'} aria-hidden="true">
189
+ ${renderIcon('star')}
190
+ </span>`)}
191
+ </span>`;
192
+ },
193
+ editor(ctx) {
194
+ const max = getRatingMax(ctx.column);
195
+ const current = clampRating(ctx.value, max);
196
+ const focusRank = Math.max(current, 1);
197
+ const commitTo = (next) => ctx.commit(clampRating(next, max));
198
+ const stars = Array.from({ length: max }, (_, i) => i + 1);
199
+ return html `<span
200
+ part="rating-editor"
201
+ role="radiogroup"
202
+ aria-label="Rating"
203
+ >
204
+ ${stars.map((rank) => html `<button
205
+ type="button"
206
+ part=${rank <= current ? 'rating-star filled selected' : 'rating-star'}
207
+ role="radio"
208
+ aria-checked=${rank === current}
209
+ aria-label=${`${rank} of ${max}`}
210
+ data-rating-value=${rank}
211
+ data-apex-editor=${rank === focusRank ? '' : nothing}
212
+ @click=${() => commitTo(rank === current ? 0 : rank)}
213
+ >
214
+ ${renderIcon('star')}
215
+ </button>`)}
216
+ </span>`;
217
+ },
218
+ };
219
+ const booleanType = {
220
+ display(ctx) {
221
+ const truthy = ctx.value === true;
222
+ const editable = typeof ctx.commit === 'function';
223
+ return html `<input
224
+ type="checkbox"
225
+ part=${truthy ? 'boolean-mark checked' : 'boolean-mark'}
226
+ .checked=${truthy}
227
+ tabindex=${editable ? '0' : '-1'}
228
+ aria-readonly=${editable ? 'false' : 'true'}
229
+ aria-label=${truthy ? 'true' : 'false'}
230
+ @click=${(event) => {
231
+ event.stopPropagation();
232
+ }}
233
+ @change=${editable
234
+ ? (event) => {
235
+ const next = event.target.checked;
236
+ ctx.commit?.(next);
237
+ }
238
+ : undefined}
239
+ />`;
240
+ },
241
+ };
242
+ const imageType = {
243
+ display(ctx) {
244
+ const value = ctx.value;
245
+ if (value == null || value === '')
246
+ return html ``;
247
+ const shape = ctx.column.shape ?? 'square';
248
+ const colAny = ctx.column;
249
+ const alt = colAny.alt ?? String(colAny.key ?? '');
250
+ return html `<img
251
+ part=${shape === 'circle' ? 'image circle' : 'image'}
252
+ src=${String(value)}
253
+ alt=${alt}
254
+ loading="lazy"
255
+ />`;
256
+ },
257
+ };
258
+ const BUILTIN_TYPES = {
259
+ select: selectType,
260
+ rating: ratingType,
261
+ date: dateType,
262
+ boolean: booleanType,
263
+ image: imageType,
264
+ };
265
+ export function getColumnTypeRenderer(type) {
266
+ return type ? BUILTIN_TYPES[type] : undefined;
267
+ }
268
+ //# sourceMappingURL=column-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-types.js","sourceRoot":"","sources":["../../src/internal/column-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,SAAS,YAAY,CAAC,MAAwB;IAC5C,MAAM,GAAG,GAAG,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC;IACzF,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,kBAAkB,CAAC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IAAI,EAAE,CAAC,CAAC;QACnD,OAAO,IAAI,CAAA;aACF,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO;YAC9C,MAAM,CAAC,KAAK,CAAC;YACb,GAAG;;OAER,CAAC;IACN,CAAC;CAGF,CAAC;AAEF,MAAM,aAAa,GAA+C;IAChE,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,WAAW;IACpB,KAAK,EAAE,SAAS;CACjB,CAAC;AAOF,MAAM,UAAU,qBAAqB,CACnC,IAAa;IAEb,OAAO,IAAI,CAAC,CAAC,CAAE,aAAa,CAAC,IAAI,CAAkD,CAAC,CAAC,CAAC,SAAS,CAAC;AAClG,CAAC","sourcesContent":["import { html, nothing, type TemplateResult } from 'lit';\nimport { ref } from 'lit/directives/ref.js';\nimport type ApexGridCell from '../components/cell.js';\nimport type ApexGridRow from '../components/row.js';\nimport { renderIcon } from './icons.js';\nimport type { ColumnConfiguration } from './types.js';\n\nconst RATING_DEFAULT_MAX = 5;\n\nfunction getRatingMax(column: { max?: number }): number {\n const max = typeof column.max === 'number' ? Math.floor(column.max) : RATING_DEFAULT_MAX;\n return max > 0 ? max : RATING_DEFAULT_MAX;\n}\n\nfunction clampRating(value: unknown, max: number): number {\n const n = typeof value === 'number' ? value : Number(value ?? 0);\n if (!Number.isFinite(n)) return 0;\n if (n < 0) return 0;\n if (n > max) return max;\n return Math.round(n);\n}\n\n/**\n * An option entry for a `'select'` column. May be either a bare value (the\n * displayed label is `String(value)`) or an explicit `{ value, label }` pair.\n */\nexport type SelectOption<V = unknown> = V | { value: V; label?: string };\n\n/**\n * The flat, non-distributive cell context handed to a column-type renderer's\n * `display` function. Mirrors {@link ApexCellContext} but uses `unknown` for\n * `value` so renderers can author against a single shape without\n * conditional-type narrowing in generic positions.\n */\nexport interface ColumnTypeCellContext<T extends object> {\n parent: ApexGridCell<T>;\n row: ApexGridRow<T>;\n column: ColumnConfiguration<T>;\n value: unknown;\n /**\n * Commits a new value for this cell without entering edit mode. Only\n * present when the column is editable. Used by interactive display\n * widgets like the boolean checkbox.\n */\n commit?(value: unknown): Promise<boolean>;\n}\n\n/**\n * Cell context handed to a column-type renderer's `editor` function. Adds the\n * `commit` / `cancel` helpers wired through {@link EditingController}.\n */\nexport interface ColumnTypeEditorContext<T extends object> extends ColumnTypeCellContext<T> {\n commit(value: unknown): Promise<boolean>;\n cancel(): void;\n}\n\n/**\n * Built-in column-type renderer contract. A renderer can supply either a\n * display template, an editor template, or both. Cells fall back to the\n * column's `cellTemplate` / `editorTemplate` / built-in primitive editor if\n * the renderer is absent.\n */\nexport interface ColumnTypeRenderer<T extends object> {\n /**\n * Renders the display (read-only) representation of the cell.\n *\n * @remarks\n * Called when the cell is not in edit mode and the column has no\n * `cellTemplate`. Return any lit-renderable value.\n */\n display?(ctx: ColumnTypeCellContext<T>): TemplateResult | unknown;\n\n /**\n * Renders the inline editor while the cell is in edit mode.\n *\n * @remarks\n * Called when the cell is in edit mode and the column has no\n * `editorTemplate`. The returned template SHOULD include `data-apex-editor`\n * on its focusable element so the cell auto-focuses it. The editor is\n * responsible for calling `ctx.commit(value)` / `ctx.cancel()`.\n */\n editor?(ctx: ColumnTypeEditorContext<T>): TemplateResult | unknown;\n}\n\ninterface NormalizedSelectOption {\n value: unknown;\n label: string;\n}\n\n/**\n * Normalizes a column's `options` configuration into a uniform\n * `{ value, label }[]` list. Accepts both bare-value entries and explicit\n * `{ value, label }` pairs.\n */\nexport function getSelectOptions(column: { options?: SelectOption[] }): NormalizedSelectOption[] {\n const raw = column.options ?? [];\n return raw.map((entry) => {\n if (entry !== null && typeof entry === 'object' && 'value' in entry) {\n const opt = entry as { value: unknown; label?: string };\n return { value: opt.value, label: opt.label ?? String(opt.value) };\n }\n return { value: entry, label: String(entry) };\n });\n}\n\nconst selectType: ColumnTypeRenderer<object> = {\n display(ctx) {\n const opts = getSelectOptions(ctx.column as { options?: SelectOption[] });\n const match = opts.find((o) => o.value === ctx.value);\n const label = match?.label ?? (ctx.value == null ? '' : String(ctx.value));\n // Closed-state display is intentionally plain text — the cell reads as\n // a normal value cell until the user double-clicks to edit. The\n // dropdown affordance appears only in edit mode (the listbox popover).\n return html`<span part=\"select-label\">${label}</span>`;\n },\n\n editor(ctx) {\n const opts = getSelectOptions(ctx.column as { options?: SelectOption[] });\n const current = ctx.value;\n const match = opts.find((o) => o.value === current);\n const label = match?.label ?? (current == null ? '' : String(current));\n const selectedIdx = Math.max(\n 0,\n opts.findIndex((o) => o.value === current)\n );\n\n // The popover is rendered as a `position: absolute` child of the cell\n // (the cell host is `position: relative`). That positions it relative\n // to the cell regardless of how the row is laid out — important\n // because the virtualizer applies `transform: translate` to each row,\n // which would re-anchor a `position: fixed` descendant onto the row.\n // The cell-level SCSS lifts `overflow: hidden` for select-type editing\n // cells so the popover can extend below the cell's box.\n const mountPopover = (el: Element | undefined) => {\n if (!el) return;\n const popover = el as HTMLElement;\n if (popover.dataset.apexFocused) return;\n popover.dataset.apexFocused = '1';\n const items = Array.from(popover.querySelectorAll<HTMLElement>('[part~=\"select-option\"]'));\n items[selectedIdx]?.focus();\n };\n\n const handleKeydown = (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const list = target.closest('[part~=\"select-popover\"]') as HTMLElement | null;\n if (!list) return;\n const items = Array.from(list.querySelectorAll<HTMLElement>('[part~=\"select-option\"]'));\n const idx = items.indexOf(target);\n if (idx < 0) return;\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n event.stopPropagation();\n items[Math.min(idx + 1, items.length - 1)]?.focus();\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n event.stopPropagation();\n items[Math.max(idx - 1, 0)]?.focus();\n } else if (event.key === 'Home') {\n event.preventDefault();\n event.stopPropagation();\n items[0]?.focus();\n } else if (event.key === 'End') {\n event.preventDefault();\n event.stopPropagation();\n items[items.length - 1]?.focus();\n } else if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n event.stopPropagation();\n ctx.commit(opts[idx].value);\n }\n // Escape / Tab fall through to the cell-level handler which cancels /\n // exits — we don't consume them here so the standard exit flow applies.\n };\n\n return html`<span part=\"select-label\">${label}</span>\n <div\n part=\"select-popover\"\n role=\"listbox\"\n @keydown=${handleKeydown}\n ${ref(mountPopover)}\n >\n ${opts.map(\n (o, i) => html`<div\n part=${o.value === current ? 'select-option selected' : 'select-option'}\n role=\"option\"\n aria-selected=${o.value === current ? 'true' : 'false'}\n tabindex=${i === selectedIdx ? '0' : '-1'}\n data-apex-editor=${i === selectedIdx ? '' : nothing}\n @click=${() => ctx.commit(o.value)}\n >\n ${o.label}\n </div>`\n )}\n </div>`;\n },\n};\n\n/**\n * Parses a stored cell value into a `Date`, or `null` when the value can't be\n * resolved to a real date.\n *\n * @remarks\n * Accepts `Date` instances, ISO/parseable strings, and millisecond\n * timestamps. `YYYY-MM-DD` strings are interpreted as **floating dates**\n * (local midnight) rather than UTC midnight, so they render on the same\n * calendar day in every timezone.\n */\nexport function parseDate(value: unknown): Date | null {\n if (value instanceof Date) {\n return Number.isNaN(value.getTime()) ? null : value;\n }\n if (typeof value === 'number') {\n const d = new Date(value);\n return Number.isNaN(d.getTime()) ? null : d;\n }\n if (typeof value === 'string') {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value);\n if (match) {\n const [, y, m, d] = match;\n const date = new Date(Number(y), Number(m) - 1, Number(d));\n return Number.isNaN(date.getTime()) ? null : date;\n }\n const date = new Date(value);\n return Number.isNaN(date.getTime()) ? null : date;\n }\n return null;\n}\n\nfunction toDateInputValue(date: Date): string {\n const y = date.getFullYear();\n const m = String(date.getMonth() + 1).padStart(2, '0');\n const d = String(date.getDate()).padStart(2, '0');\n return `${y}-${m}-${d}`;\n}\n\nfunction formatDateValue(value: unknown, style: string): string {\n const date = parseDate(value);\n if (!date) return '';\n return new Intl.DateTimeFormat(undefined, {\n dateStyle: style as Intl.DateTimeFormatOptions['dateStyle'],\n }).format(date);\n}\n\n/**\n * Returns a `next` value cast to the same shape as `original` (Date / number\n * timestamp / ISO string). Empty inputs commit `null` regardless of the\n * source shape, which is the simplest \"clear\" semantics.\n */\nfunction commitDateInSameShape(original: unknown, next: Date | null): unknown {\n if (next === null) return null;\n if (original instanceof Date) return next;\n if (typeof original === 'number') return next.getTime();\n return toDateInputValue(next);\n}\n\nconst dateType: ColumnTypeRenderer<object> = {\n display(ctx) {\n const style = (ctx.column as { format?: string }).format ?? 'medium';\n return html`${formatDateValue(ctx.value, style)}`;\n },\n\n editor(ctx) {\n const initial = parseDate(ctx.value);\n const initialInput = initial ? toDateInputValue(initial) : '';\n\n const handleChange = (event: Event) => {\n const raw = (event.target as HTMLInputElement).value;\n const next = raw ? parseDate(raw) : null;\n ctx.commit(commitDateInSameShape(ctx.value, next));\n };\n // Escape / Tab / focus-out are handled at the cell level; we only need\n // Enter here to commit the typed value without waiting for `change`.\n const handleKeydown = (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n const raw = (event.target as HTMLInputElement).value;\n const next = raw ? parseDate(raw) : null;\n ctx.commit(commitDateInSameShape(ctx.value, next));\n }\n };\n return html`<input\n type=\"date\"\n part=\"editor\"\n data-apex-editor\n .value=${initialInput}\n @change=${handleChange}\n @keydown=${handleKeydown}\n />`;\n },\n};\n\nconst ratingType: ColumnTypeRenderer<object> = {\n display(ctx) {\n const max = getRatingMax(ctx.column as { max?: number });\n const value = clampRating(ctx.value, max);\n const stars = Array.from({ length: max }, (_, i) => i < value);\n return html`<span part=\"rating\" role=\"img\" aria-label=\"${value} of ${max}\">\n ${stars.map(\n (filled) =>\n html`<span part=${filled ? 'rating-star filled' : 'rating-star'} aria-hidden=\"true\">\n ${renderIcon('star')}\n </span>`\n )}\n </span>`;\n },\n\n editor(ctx) {\n const max = getRatingMax(ctx.column as { max?: number });\n const current = clampRating(ctx.value, max);\n const focusRank = Math.max(current, 1);\n\n const commitTo = (next: number) => ctx.commit(clampRating(next, max));\n\n // Escape / Tab / focus-out are handled at the cell level — no per-editor\n // handlers needed here. Clicking a star is the primary commit action;\n // clicking the currently-rated star clears the rating back to 0, which\n // is the only way to get below 1 once any star is set.\n const stars = Array.from({ length: max }, (_, i) => i + 1);\n return html`<span\n part=\"rating-editor\"\n role=\"radiogroup\"\n aria-label=\"Rating\"\n >\n ${stars.map(\n (rank) => html`<button\n type=\"button\"\n part=${rank <= current ? 'rating-star filled selected' : 'rating-star'}\n role=\"radio\"\n aria-checked=${rank === current}\n aria-label=${`${rank} of ${max}`}\n data-rating-value=${rank}\n data-apex-editor=${rank === focusRank ? '' : nothing}\n @click=${() => commitTo(rank === current ? 0 : rank)}\n >\n ${renderIcon('star')}\n </button>`\n )}\n </span>`;\n },\n};\n\nconst booleanType: ColumnTypeRenderer<object> = {\n display(ctx) {\n const truthy = ctx.value === true;\n const editable = typeof ctx.commit === 'function';\n // For editable boolean cells the display IS the interactive control —\n // a single click toggles and commits via `ctx.commit`, no edit mode\n // dance and no visual reflow. For non-editable cells the checkbox\n // reads as a state indicator (tabindex=-1, aria-readonly, pointer-\n // events disabled via SCSS).\n return html`<input\n type=\"checkbox\"\n part=${truthy ? 'boolean-mark checked' : 'boolean-mark'}\n .checked=${truthy}\n tabindex=${editable ? '0' : '-1'}\n aria-readonly=${editable ? 'false' : 'true'}\n aria-label=${truthy ? 'true' : 'false'}\n @click=${(event: Event) => {\n // Keep the click inside the cell — we don't want it to bubble into\n // the grid body-click handler twice or trigger edit-mode logic.\n event.stopPropagation();\n }}\n @change=${\n editable\n ? (event: Event) => {\n const next = (event.target as HTMLInputElement).checked;\n ctx.commit?.(next);\n }\n : undefined\n }\n />`;\n },\n // No `editor` — boolean cells never enter edit mode (the display widget\n // commits directly). Programmatic `editCell` on a boolean column is a\n // no-op as far as the user can see.\n};\n\nconst imageType: ColumnTypeRenderer<object> = {\n display(ctx) {\n const value = ctx.value;\n if (value == null || value === '') return html``;\n const shape = (ctx.column as { shape?: 'square' | 'circle' }).shape ?? 'square';\n const colAny = ctx.column as { alt?: string; key?: unknown };\n const alt = colAny.alt ?? String(colAny.key ?? '');\n return html`<img\n part=${shape === 'circle' ? 'image circle' : 'image'}\n src=${String(value)}\n alt=${alt}\n loading=\"lazy\"\n />`;\n },\n // Editing an image URL is just text editing — fall through to the default\n // text editor for `editable: true` image columns.\n};\n\nconst BUILTIN_TYPES: Record<string, ColumnTypeRenderer<object>> = {\n select: selectType,\n rating: ratingType,\n date: dateType,\n boolean: booleanType,\n image: imageType,\n};\n\n/**\n * Returns the built-in renderer for a column `type`, or `undefined` when the\n * type has no built-in display/editor (the cell falls back to plain text /\n * the primitive editor in that case).\n */\nexport function getColumnTypeRenderer<T extends object>(\n type?: string\n): ColumnTypeRenderer<T> | undefined {\n return type ? (BUILTIN_TYPES[type] as unknown as ColumnTypeRenderer<T> | undefined) : undefined;\n}\n"]}
@@ -6,4 +6,3 @@ export declare const MIN_COL_RESIZE_WIDTH = 80;
6
6
  export declare const SENTINEL_NODE: Readonly<ActiveNode<any>>;
7
7
  export declare const DEFAULT_COLUMN_CONFIG: Readonly<ColumnConfiguration<any>>;
8
8
  export declare const NAVIGATION_STATE: Map<NavigationState, ActiveNode<any>>;
9
- //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/internal/constants.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC;AAE3B,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;AACnC,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAuB,CAAC;AAC3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAyB,CAAC;AAE9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC,MAAM,CAAC,MAAM,aAAa,GAA8B,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAC/F,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAA2B;IAC3E,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,KAAK;IACX,MAAM,EAAE,KAAK;CACd,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA0C,IAAI,GAAG,CAAC;IAC7E,CAAC,UAAU,EAAE,aAAa,CAAC;IAC3B,CAAC,SAAS,EAAE,aAAa,CAAC;CAC3B,CAAC,CAAC","sourcesContent":["import type { ActiveNode, ColumnConfiguration, NavigationState } from './types.js';\n\nconst columnKey = Symbol();\n\nexport const PIPELINE = 'pipeline';\nexport const SORT_ICON_ASCENDING = 'arrow-upward' as const;\nexport const SORT_ICON_DESCENDING = 'arrow-downward' as const;\n\nexport const MIN_COL_RESIZE_WIDTH = 80;\n\nexport const SENTINEL_NODE: Readonly<ActiveNode<any>> = Object.freeze({ column: '', row: -1 });\nexport const DEFAULT_COLUMN_CONFIG = Object.freeze<ColumnConfiguration<any>>({\n key: columnKey,\n type: 'string',\n resizable: false,\n hidden: false,\n sort: false,\n filter: false,\n});\nexport const NAVIGATION_STATE: Map<NavigationState, ActiveNode<any>> = new Map([\n ['previous', SENTINEL_NODE],\n ['current', SENTINEL_NODE],\n]);\n"]}
@@ -0,0 +1,106 @@
1
+ import type { ApexGrid } from '../components/grid.js';
2
+ import type { ColumnConfiguration, Keys } from './types.js';
3
+ /**
4
+ * Primitive cell values supported by the export pipeline.
5
+ *
6
+ * @remarks
7
+ * Returned by the default formatter and accepted from user-supplied formatters.
8
+ * `Date` is preserved (not stringified) so that XLSX export can write it as a
9
+ * native date cell instead of inline text.
10
+ */
11
+ export type ExportCellValue = string | number | boolean | Date | null | undefined;
12
+ /**
13
+ * Which row set should drive the export.
14
+ *
15
+ * - `'view'` (default) — post-filter, post-sort rows across all pages.
16
+ * - `'all'` — the raw `data` array as supplied by the consumer.
17
+ * - `'page'` — only the rows in the current page slice.
18
+ * - `'selected'` — the current row selection (insertion order).
19
+ */
20
+ export type ExportSource = 'view' | 'all' | 'page' | 'selected';
21
+ /**
22
+ * Options shared by all export targets.
23
+ */
24
+ export interface ExportOptions<T extends object> {
25
+ /** Output filename, without extension. Defaults to `'data'`. */
26
+ filename?: string;
27
+ /** Row set to export. Defaults to `'view'`. */
28
+ source?: ExportSource;
29
+ /**
30
+ * Column keys to include. When omitted, every visible non-hidden column with
31
+ * `exportable !== false` is exported, in display order.
32
+ */
33
+ columns?: ReadonlyArray<Keys<T>>;
34
+ /** Whether to emit a header row. Defaults to `true`. */
35
+ includeHeader?: boolean;
36
+ /**
37
+ * Per-cell value formatter. Receives the column configuration, the raw value
38
+ * from the record, and the record itself. Return one of {@link ExportCellValue}
39
+ * (return a `Date` to keep date typing in XLSX).
40
+ */
41
+ formatter?: (column: ColumnConfiguration<T>, value: unknown, row: T) => ExportCellValue;
42
+ }
43
+ /**
44
+ * Options for {@link ApexGrid.exportToCSV}.
45
+ */
46
+ export interface CSVExportOptions<T extends object> extends ExportOptions<T> {
47
+ /** Field delimiter. Defaults to `','`. */
48
+ delimiter?: string;
49
+ /**
50
+ * Prepend a UTF-8 byte-order mark so Excel auto-detects the encoding when
51
+ * opening the file. Defaults to `true`.
52
+ */
53
+ bom?: boolean;
54
+ /** Line separator. Defaults to `'\r\n'` (RFC 4180). */
55
+ newline?: string;
56
+ }
57
+ /**
58
+ * Options for {@link ApexGrid.exportToXLSX}.
59
+ */
60
+ export interface XLSXExportOptions<T extends object> extends ExportOptions<T> {
61
+ /** Worksheet tab name. Defaults to `'Sheet1'`. Trimmed to 31 chars. */
62
+ sheetName?: string;
63
+ }
64
+ /**
65
+ * Resolves the columns that should appear in the export, in display order.
66
+ */
67
+ export declare function resolveExportColumns<T extends object>(grid: ApexGrid<T>, opts: ExportOptions<T>): Array<ColumnConfiguration<T>>;
68
+ /**
69
+ * Resolves the rows that should appear in the export.
70
+ */
71
+ export declare function resolveExportRows<T extends object>(grid: ApexGrid<T>, source?: ExportSource): ReadonlyArray<T>;
72
+ /**
73
+ * Returns the column's display label, used as the header cell value.
74
+ */
75
+ export declare function getColumnLabel<T extends object>(column: ColumnConfiguration<T>): string;
76
+ /**
77
+ * Default cell-value formatter. Mirrors the on-screen rendering for each
78
+ * column type while keeping primitive types primitive (so number/boolean/date
79
+ * survive into XLSX as native cells instead of strings).
80
+ */
81
+ export declare function defaultExportFormat<T extends object>(column: ColumnConfiguration<T>, value: unknown): ExportCellValue;
82
+ /**
83
+ * Resolves the export value for a single cell, applying the user-supplied
84
+ * formatter when present and falling back to {@link defaultExportFormat}.
85
+ */
86
+ export declare function resolveExportValue<T extends object>(column: ColumnConfiguration<T>, row: T, opts: ExportOptions<T>): ExportCellValue;
87
+ /** Formats a `Date` into the configured date style for CSV output. */
88
+ export declare function formatDateForCSV<T extends object>(column: ColumnConfiguration<T>, value: Date): string;
89
+ /**
90
+ * Builds the CSV string for the grid without triggering a download.
91
+ *
92
+ * @remarks
93
+ * Useful when consumers want to ship the bytes through their own transport
94
+ * (clipboard, HTTP upload). The {@link ApexGrid.exportToCSV} method calls
95
+ * this and then triggers a browser download.
96
+ */
97
+ export declare function buildCSV<T extends object>(grid: ApexGrid<T>, opts?: CSVExportOptions<T>): string;
98
+ /**
99
+ * Triggers a browser download for the given payload.
100
+ *
101
+ * @remarks
102
+ * Falls back to a no-op when called outside the browser (during SSR or unit
103
+ * tests on JSDOM without a body), so consumers can still call the public
104
+ * export API safely.
105
+ */
106
+ export declare function downloadBlob(filename: string, content: string | Uint8Array, mimeType: string): void;