persian-data-grid 0.5.0 → 0.7.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 (282) hide show
  1. package/OFL.txt +93 -0
  2. package/README.md +179 -22
  3. package/dist/ERPTableGroupRow-E5Q6FYDS.js +125 -0
  4. package/dist/ERPTableGroupRow-E5Q6FYDS.js.map +1 -0
  5. package/dist/ERPTableGroupRow-F2IPDYL5.cjs +131 -0
  6. package/dist/ERPTableGroupRow-F2IPDYL5.cjs.map +1 -0
  7. package/dist/GridPlugin-Bewn0X51.d.ts +57 -0
  8. package/dist/GridPlugin-DewWufGZ.d.cts +57 -0
  9. package/dist/GridPresenceService-GEH6535Q.js +3 -0
  10. package/dist/GridPresenceService-GEH6535Q.js.map +1 -0
  11. package/dist/GridPresenceService-RDN5FXHQ.cjs +12 -0
  12. package/dist/GridPresenceService-RDN5FXHQ.cjs.map +1 -0
  13. package/dist/GridSession-CeIfVFck.d.ts +2625 -0
  14. package/dist/GridSession-CmQn2RnL.d.cts +2625 -0
  15. package/dist/GridSyncService-3JQLEY65.cjs +12 -0
  16. package/dist/GridSyncService-3JQLEY65.cjs.map +1 -0
  17. package/dist/GridSyncService-GECXGEKL.js +3 -0
  18. package/dist/GridSyncService-GECXGEKL.js.map +1 -0
  19. package/dist/PdfRenderer-B9FJaCo_.d.cts +22 -0
  20. package/dist/PdfRenderer-bN7ca_Aj.d.ts +22 -0
  21. package/dist/RemoteApi-CCQxiSf1.d.cts +28 -0
  22. package/dist/RemoteApi-CCQxiSf1.d.ts +28 -0
  23. package/dist/SelectImpl-NM4O4IGW.js +447 -0
  24. package/dist/SelectImpl-NM4O4IGW.js.map +1 -0
  25. package/dist/SelectImpl-W2EI4T7O.cjs +453 -0
  26. package/dist/SelectImpl-W2EI4T7O.cjs.map +1 -0
  27. package/dist/UITableController-C71LXBiX.d.ts +678 -0
  28. package/dist/UITableController-CIwnHIw8.d.cts +678 -0
  29. package/dist/VazirmatnPdfRenderer-CpCqA-Wh.d.cts +96 -0
  30. package/dist/VazirmatnPdfRenderer-D46smncn.d.ts +96 -0
  31. package/dist/adapters/arian-erp.cjs +89 -0
  32. package/dist/adapters/arian-erp.cjs.map +1 -0
  33. package/dist/adapters/arian-erp.d.cts +62 -0
  34. package/dist/adapters/arian-erp.d.ts +62 -0
  35. package/dist/adapters/arian-erp.js +79 -0
  36. package/dist/adapters/arian-erp.js.map +1 -0
  37. package/dist/appendAtEnd-RHIQRG2W.cjs +35 -0
  38. package/dist/appendAtEnd-RHIQRG2W.cjs.map +1 -0
  39. package/dist/appendAtEnd-TJEABLGD.js +33 -0
  40. package/dist/appendAtEnd-TJEABLGD.js.map +1 -0
  41. package/dist/applyImportedRows-C2fWYoPy.d.cts +135 -0
  42. package/dist/applyImportedRows-Cqh_N_0k.d.ts +135 -0
  43. package/dist/applyRowVisibilityHandler-Q64ZFC7A.cjs +86 -0
  44. package/dist/applyRowVisibilityHandler-Q64ZFC7A.cjs.map +1 -0
  45. package/dist/applyRowVisibilityHandler-ZLZXQEGY.js +84 -0
  46. package/dist/applyRowVisibilityHandler-ZLZXQEGY.js.map +1 -0
  47. package/dist/broadcastChannelTransport-FHUMV76O.cjs +12 -0
  48. package/dist/broadcastChannelTransport-FHUMV76O.cjs.map +1 -0
  49. package/dist/broadcastChannelTransport-MIH53VNZ.js +3 -0
  50. package/dist/broadcastChannelTransport-MIH53VNZ.js.map +1 -0
  51. package/dist/callbackRemoteApi-BYLjmSI6.d.ts +51 -0
  52. package/dist/callbackRemoteApi-Cv26MmSD.d.cts +51 -0
  53. package/dist/cellRenderContext-BaNh4qn_.d.ts +42 -0
  54. package/dist/cellRenderContext-DvngkptV.d.cts +42 -0
  55. package/dist/chunk-27ALJSZP.js +12187 -0
  56. package/dist/chunk-27ALJSZP.js.map +1 -0
  57. package/dist/chunk-3HP3HQCW.cjs +688 -0
  58. package/dist/chunk-3HP3HQCW.cjs.map +1 -0
  59. package/dist/chunk-3Y3KKGEC.js +3 -0
  60. package/dist/chunk-3Y3KKGEC.js.map +1 -0
  61. package/dist/chunk-52LFOPXD.cjs +588 -0
  62. package/dist/chunk-52LFOPXD.cjs.map +1 -0
  63. package/dist/chunk-5ALMNLUR.cjs +1408 -0
  64. package/dist/chunk-5ALMNLUR.cjs.map +1 -0
  65. package/dist/chunk-5HKVMPBD.js +937 -0
  66. package/dist/chunk-5HKVMPBD.js.map +1 -0
  67. package/dist/chunk-72IVAOTK.cjs +38 -0
  68. package/dist/chunk-72IVAOTK.cjs.map +1 -0
  69. package/dist/chunk-77UXAJII.js +112 -0
  70. package/dist/chunk-77UXAJII.js.map +1 -0
  71. package/dist/chunk-7GWV5HGO.js +36 -0
  72. package/dist/chunk-7GWV5HGO.js.map +1 -0
  73. package/dist/chunk-7T6AWRPU.js +581 -0
  74. package/dist/chunk-7T6AWRPU.js.map +1 -0
  75. package/dist/chunk-AU3RDJYQ.js +243 -0
  76. package/dist/chunk-AU3RDJYQ.js.map +1 -0
  77. package/dist/chunk-CILNIWYW.cjs +100 -0
  78. package/dist/chunk-CILNIWYW.cjs.map +1 -0
  79. package/dist/chunk-CMQ4VLCW.cjs +840 -0
  80. package/dist/chunk-CMQ4VLCW.cjs.map +1 -0
  81. package/dist/chunk-DFFP7SJ6.cjs +257 -0
  82. package/dist/chunk-DFFP7SJ6.cjs.map +1 -0
  83. package/dist/chunk-E2J533UH.cjs +53 -0
  84. package/dist/chunk-E2J533UH.cjs.map +1 -0
  85. package/dist/chunk-EBV6HGZB.cjs +33 -0
  86. package/dist/chunk-EBV6HGZB.cjs.map +1 -0
  87. package/dist/chunk-F4PYOYHR.js +112 -0
  88. package/dist/chunk-F4PYOYHR.js.map +1 -0
  89. package/dist/chunk-F6EMC75A.cjs +34 -0
  90. package/dist/chunk-F6EMC75A.cjs.map +1 -0
  91. package/dist/chunk-GKE33FOJ.js +32 -0
  92. package/dist/chunk-GKE33FOJ.js.map +1 -0
  93. package/dist/chunk-GQEDLUMB.js +168 -0
  94. package/dist/chunk-GQEDLUMB.js.map +1 -0
  95. package/dist/chunk-HLOHWFOA.js +645 -0
  96. package/dist/chunk-HLOHWFOA.js.map +1 -0
  97. package/dist/chunk-IMPCRWYP.cjs +251 -0
  98. package/dist/chunk-IMPCRWYP.cjs.map +1 -0
  99. package/dist/chunk-IPPIXOVQ.js +317 -0
  100. package/dist/chunk-IPPIXOVQ.js.map +1 -0
  101. package/dist/chunk-J4XJ4UBC.js +1404 -0
  102. package/dist/chunk-J4XJ4UBC.js.map +1 -0
  103. package/dist/chunk-J7CPPFXT.cjs +89 -0
  104. package/dist/chunk-J7CPPFXT.cjs.map +1 -0
  105. package/dist/chunk-JOICD47Q.cjs +41 -0
  106. package/dist/chunk-JOICD47Q.cjs.map +1 -0
  107. package/dist/chunk-KCNTKYUY.js +206 -0
  108. package/dist/chunk-KCNTKYUY.js.map +1 -0
  109. package/dist/chunk-KHMG6EI2.js +13 -0
  110. package/dist/chunk-KHMG6EI2.js.map +1 -0
  111. package/dist/chunk-KMRURD5J.cjs +15 -0
  112. package/dist/chunk-KMRURD5J.cjs.map +1 -0
  113. package/dist/chunk-KRJG3KMP.cjs +174 -0
  114. package/dist/chunk-KRJG3KMP.cjs.map +1 -0
  115. package/dist/chunk-LY27YAXE.cjs +208 -0
  116. package/dist/chunk-LY27YAXE.cjs.map +1 -0
  117. package/dist/chunk-MT3KLB2Q.cjs +944 -0
  118. package/dist/chunk-MT3KLB2Q.cjs.map +1 -0
  119. package/dist/chunk-MUQQKPWR.js +84 -0
  120. package/dist/chunk-MUQQKPWR.js.map +1 -0
  121. package/dist/chunk-N7SJTINL.cjs +4 -0
  122. package/dist/chunk-N7SJTINL.cjs.map +1 -0
  123. package/dist/chunk-NB5GCGHL.js +833 -0
  124. package/dist/chunk-NB5GCGHL.js.map +1 -0
  125. package/dist/chunk-NQUVAJQA.js +298 -0
  126. package/dist/chunk-NQUVAJQA.js.map +1 -0
  127. package/dist/chunk-NTV2UUAJ.cjs +149 -0
  128. package/dist/chunk-NTV2UUAJ.cjs.map +1 -0
  129. package/dist/chunk-PJQWHF6T.js +31 -0
  130. package/dist/chunk-PJQWHF6T.js.map +1 -0
  131. package/dist/chunk-PQY54EL5.js +248 -0
  132. package/dist/chunk-PQY54EL5.js.map +1 -0
  133. package/dist/chunk-Q7TBBUTX.cjs +110 -0
  134. package/dist/chunk-Q7TBBUTX.cjs.map +1 -0
  135. package/dist/chunk-QZN7R2WP.cjs +114 -0
  136. package/dist/chunk-QZN7R2WP.cjs.map +1 -0
  137. package/dist/chunk-RKVSJU46.js +35 -0
  138. package/dist/chunk-RKVSJU46.js.map +1 -0
  139. package/dist/chunk-SVO62ZV2.js +50 -0
  140. package/dist/chunk-SVO62ZV2.js.map +1 -0
  141. package/dist/chunk-SX4VQXAA.cjs +114 -0
  142. package/dist/chunk-SX4VQXAA.cjs.map +1 -0
  143. package/dist/chunk-SZ7BLAY3.js +92 -0
  144. package/dist/chunk-SZ7BLAY3.js.map +1 -0
  145. package/dist/chunk-TN4MG6FY.js +112 -0
  146. package/dist/chunk-TN4MG6FY.js.map +1 -0
  147. package/dist/chunk-UC7PHDM6.cjs +331 -0
  148. package/dist/chunk-UC7PHDM6.cjs.map +1 -0
  149. package/dist/chunk-UXVLYUUW.js +108 -0
  150. package/dist/chunk-UXVLYUUW.js.map +1 -0
  151. package/dist/chunk-VBAZ77Q4.js +932 -0
  152. package/dist/chunk-VBAZ77Q4.js.map +1 -0
  153. package/dist/chunk-VSAFQTW5.cjs +319 -0
  154. package/dist/chunk-VSAFQTW5.cjs.map +1 -0
  155. package/dist/chunk-VYJQ2HTA.cjs +936 -0
  156. package/dist/chunk-VYJQ2HTA.cjs.map +1 -0
  157. package/dist/chunk-W5256BJ4.js +56 -0
  158. package/dist/chunk-W5256BJ4.js.map +1 -0
  159. package/dist/chunk-WTHTVKVI.cjs +12299 -0
  160. package/dist/chunk-WTHTVKVI.cjs.map +1 -0
  161. package/dist/chunk-WUMOSOEK.cjs +62 -0
  162. package/dist/chunk-WUMOSOEK.cjs.map +1 -0
  163. package/dist/chunk-XLRE2J25.js +140 -0
  164. package/dist/chunk-XLRE2J25.js.map +1 -0
  165. package/dist/chunk-Z4QPZ3Z3.cjs +114 -0
  166. package/dist/chunk-Z4QPZ3Z3.cjs.map +1 -0
  167. package/dist/createEngineGridQuery-BBkud5oE.d.ts +939 -0
  168. package/dist/createEngineGridQuery-D-fgO_jg.d.cts +939 -0
  169. package/dist/date-picker-jalali.cjs +263 -0
  170. package/dist/date-picker-jalali.cjs.map +1 -0
  171. package/dist/date-picker-jalali.d.cts +62 -0
  172. package/dist/date-picker-jalali.d.ts +62 -0
  173. package/dist/date-picker-jalali.js +256 -0
  174. package/dist/date-picker-jalali.js.map +1 -0
  175. package/dist/finance.cjs +205 -0
  176. package/dist/finance.cjs.map +1 -0
  177. package/dist/finance.d.cts +90 -0
  178. package/dist/finance.d.ts +90 -0
  179. package/dist/finance.js +157 -0
  180. package/dist/finance.js.map +1 -0
  181. package/dist/foldedColumn-IHDT4ARZ.cjs +66 -0
  182. package/dist/foldedColumn-IHDT4ARZ.cjs.map +1 -0
  183. package/dist/foldedColumn-TFURUKFG.js +64 -0
  184. package/dist/foldedColumn-TFURUKFG.js.map +1 -0
  185. package/dist/headless.cjs +729 -0
  186. package/dist/headless.cjs.map +1 -0
  187. package/dist/headless.d.cts +508 -0
  188. package/dist/headless.d.ts +508 -0
  189. package/dist/headless.js +226 -0
  190. package/dist/headless.js.map +1 -0
  191. package/dist/index-DN8M8Jkq.d.cts +14 -0
  192. package/dist/index-DmzL-F_o.d.ts +14 -0
  193. package/dist/index.cjs +8060 -11409
  194. package/dist/index.cjs.map +1 -1
  195. package/dist/index.d.cts +457 -2305
  196. package/dist/index.d.ts +457 -2305
  197. package/dist/index.js +7302 -11084
  198. package/dist/index.js.map +1 -1
  199. package/dist/locales/ar.cjs +12 -0
  200. package/dist/locales/ar.cjs.map +1 -0
  201. package/dist/locales/ar.d.cts +6 -0
  202. package/dist/locales/ar.d.ts +6 -0
  203. package/dist/locales/ar.js +3 -0
  204. package/dist/locales/ar.js.map +1 -0
  205. package/dist/locales/en.cjs +12 -0
  206. package/dist/locales/en.cjs.map +1 -0
  207. package/dist/locales/en.d.cts +6 -0
  208. package/dist/locales/en.d.ts +6 -0
  209. package/dist/locales/en.js +3 -0
  210. package/dist/locales/en.js.map +1 -0
  211. package/dist/locales/fa.cjs +12 -0
  212. package/dist/locales/fa.cjs.map +1 -0
  213. package/dist/locales/fa.d.cts +6 -0
  214. package/dist/locales/fa.d.ts +6 -0
  215. package/dist/locales/fa.js +3 -0
  216. package/dist/locales/fa.js.map +1 -0
  217. package/dist/locales/index.cjs +51 -0
  218. package/dist/locales/index.cjs.map +1 -0
  219. package/dist/locales/index.d.cts +5 -0
  220. package/dist/locales/index.d.ts +5 -0
  221. package/dist/locales/index.js +6 -0
  222. package/dist/locales/index.js.map +1 -0
  223. package/dist/memoryRecords-AWDKUJ2F.cjs +50 -0
  224. package/dist/memoryRecords-AWDKUJ2F.cjs.map +1 -0
  225. package/dist/memoryRecords-OJTGXLRH.js +47 -0
  226. package/dist/memoryRecords-OJTGXLRH.js.map +1 -0
  227. package/dist/pagedFooterTotals-DXCGDO6F.cjs +27 -0
  228. package/dist/pagedFooterTotals-DXCGDO6F.cjs.map +1 -0
  229. package/dist/pagedFooterTotals-ORWKUNE7.js +25 -0
  230. package/dist/pagedFooterTotals-ORWKUNE7.js.map +1 -0
  231. package/dist/pagedKit-MFGAJFSK.cjs +134 -0
  232. package/dist/pagedKit-MFGAJFSK.cjs.map +1 -0
  233. package/dist/pagedKit-WYWY4LRV.js +127 -0
  234. package/dist/pagedKit-WYWY4LRV.js.map +1 -0
  235. package/dist/pagedSearch-HCPJW7VM.js +38 -0
  236. package/dist/pagedSearch-HCPJW7VM.js.map +1 -0
  237. package/dist/pagedSearch-U3WCG4GN.cjs +42 -0
  238. package/dist/pagedSearch-U3WCG4GN.cjs.map +1 -0
  239. package/dist/plugins/csv.cjs +124 -0
  240. package/dist/plugins/csv.cjs.map +1 -0
  241. package/dist/plugins/csv.d.cts +44 -0
  242. package/dist/plugins/csv.d.ts +44 -0
  243. package/dist/plugins/csv.js +120 -0
  244. package/dist/plugins/csv.js.map +1 -0
  245. package/dist/plugins/excel.cjs +52 -0
  246. package/dist/plugins/excel.cjs.map +1 -0
  247. package/dist/plugins/excel.d.cts +14 -0
  248. package/dist/plugins/excel.d.ts +14 -0
  249. package/dist/plugins/excel.js +7 -0
  250. package/dist/plugins/excel.js.map +1 -0
  251. package/dist/plugins/pdf/fonts/vazirmatn.cjs +50 -0
  252. package/dist/plugins/pdf/fonts/vazirmatn.cjs.map +1 -0
  253. package/dist/plugins/pdf/fonts/vazirmatn.d.cts +24 -0
  254. package/dist/plugins/pdf/fonts/vazirmatn.d.ts +24 -0
  255. package/dist/plugins/pdf/fonts/vazirmatn.js +39 -0
  256. package/dist/plugins/pdf/fonts/vazirmatn.js.map +1 -0
  257. package/dist/plugins/pdf.cjs +24 -0
  258. package/dist/plugins/pdf.cjs.map +1 -0
  259. package/dist/plugins/pdf.d.cts +21 -0
  260. package/dist/plugins/pdf.d.ts +21 -0
  261. package/dist/plugins/pdf.js +7 -0
  262. package/dist/plugins/pdf.js.map +1 -0
  263. package/dist/presence.cjs +56 -0
  264. package/dist/presence.cjs.map +1 -0
  265. package/dist/presence.d.cts +17 -0
  266. package/dist/presence.d.ts +17 -0
  267. package/dist/presence.js +54 -0
  268. package/dist/presence.js.map +1 -0
  269. package/dist/rebuildRowVisibility-66EAZ356.cjs +21 -0
  270. package/dist/rebuildRowVisibility-66EAZ356.cjs.map +1 -0
  271. package/dist/rebuildRowVisibility-6TYM5BP2.js +19 -0
  272. package/dist/rebuildRowVisibility-6TYM5BP2.js.map +1 -0
  273. package/dist/styles.css +1440 -0
  274. package/dist/sync.cjs +148 -0
  275. package/dist/sync.cjs.map +1 -0
  276. package/dist/sync.d.cts +17 -0
  277. package/dist/sync.d.ts +17 -0
  278. package/dist/sync.js +146 -0
  279. package/dist/sync.js.map +1 -0
  280. package/dist/types-D__47BKv.d.cts +23 -0
  281. package/dist/types-D__47BKv.d.ts +23 -0
  282. package/package.json +185 -29
package/dist/index.d.cts CHANGED
@@ -1,1973 +1,417 @@
1
+ import { y as AggFuncName, x as FieldType, C as ColumnSchema, F as FilterModel, S as ColumnFilter, E as EventStore, bf as IMultiSelectConfig, U as UIRow, r as HistoryItem, b as GridSession, T as TableSnapShot, p as ChangelogEntry, o as ChangelogQuery, q as HistoryQuery, aq as VisibleRange, ap as Viewport, al as SparseRowIndex } from './GridSession-CmQn2RnL.cjs';
2
+ export { A as AggFunc, z as AppendResult, B as AriaSortValue, J as BooleanColumnFilter, K as BooleanFilterOp, L as BuiltinFilterKind, b9 as ColDefOrGroup, l as ColumnDef, P as ColumnDefBridge, Q as ColumnField, bg as ColumnGroupDef, bh as ColumnGroupMeta, bi as ColumnGroupPathEntry, X as ColumnPinned, Y as CombinedColumnFilter, Z as CustomColumnFilter, _ as CustomFilterFn, $ as CycleSortModelOptions, a0 as DateColumnFilter, a1 as DateFilterOp, a2 as FilterAccessor, a3 as FilterDef, a4 as FilterJoin, a5 as HEADER_SORT_CLICK_MAX_MOVE_PX, a6 as INDEX_COL_ID, a7 as ItemType, a8 as NumberColumnFilter, a9 as NumberFilterOp, ab as RowModelType, ac as RowStateEnum, ad as SetColumnFilter, ae as SetFilterOp, af as SimpleColumnFilter, ag as SortAccessor, ah as SortDirection, ai as SortModel, aj as SortModelItem, ak as SortValueComparator, e as TableEngine, k as TableViewState, am as TextColumnFilter, an as TextFilterOp, V as ValidCell, ao as ViewIntent, ar as applyFilter, as as applyHostRowDataToTable, at as applySort, au as ariaSortForColumn, az as collectUniqueFilterValues, aA as compareSortValues, aB as compareTypedValues, aE as cycleSortModel, aF as defaultGetRowId, aG as ensureIndexColumnDef, aH as isBlankSortValue, aJ as isColumnFilterActive, bj as isColumnGroupDef, aK as isHeaderColumnSortable, aL as isServerRowModel, aN as mapRowDataToRowInputs, aR as normalizeDigits, aS as normalizeFilterText, aT as pageWindow, aW as resolveBuiltinFilterKind, a_ as shouldCommitHeaderSortClick, a$ as sortPriorityForColumn } from './GridSession-CmQn2RnL.cjs';
1
3
  import * as React from 'react';
2
- import React__default, { ReactNode } from 'react';
3
-
4
- type AuditEvent = {
5
- message: string;
6
- payload?: unknown;
7
- type: 'INFORMATION' | 'ERROR' | 'FORBIDDEN' | 'CELL_CHANGED' | 'CELL_DISPLAY_CHANGED' | 'ROW_ADDED' | 'NEW_ROW_ADDED' | 'ROW_DELETED' | 'ROW_RESTORED' | 'ROW_REORDERED' | 'COLUMN_REORDERED' | 'UNIT_COLUMN_ADDED' | 'PAGE_CHANGED' | 'PAGE_SIZE_CHANGED' | 'TABLE_DELETED' | 'TABLE_RESET' | 'ROWS_LOADED' | 'DYNAMIC_DATA_REQUESTED' | 'VALIDATION_FAILED' | 'ROW_NOT_FOUND' | 'PAGE_NOT_CHANGED' | 'COLUMN_NOT_FOUND' | 'CELL_NOT_FOUND' | 'NOT_EDITABLE' | 'FORBIDDEN' | 'INVALID_VALUE' | 'DUPLICATE_ROW' | 'INVARIANT_VIOLATION' | 'ROW_NOT_EXPANDED' | 'ACTIVE_COLLECTION_CHANGED' | 'DRAG_OR_DROP_ROW_NOT_FOUND';
8
- };
9
- interface AuditLogger {
10
- log(event: AuditEvent): void;
11
- error(event: AuditEvent): void;
12
- warn(event: AuditEvent): void;
13
- info(event: AuditEvent): void;
14
- }
15
-
16
- interface RemoteApi {
17
- request<TResponse = any>(input: {
18
- endpoint: string;
19
- params?: Record<string, any>;
20
- method?: 'GET' | 'POST';
21
- }): Promise<TResponse>;
22
- }
23
-
24
- type Actor$1 = {
25
- userId: string;
26
- roles: string[];
27
- };
28
- interface PermissionPolicy {
29
- canChangeCell(input: {
30
- actor: Actor$1;
31
- rowId: number;
32
- columnId: string;
33
- }): boolean;
34
- canEdit?: (input: {
35
- actor: Actor$1;
36
- rowId: number;
37
- columnId: string;
38
- }) => boolean;
39
- canAddRow?: (input: {
40
- actor: Actor$1;
41
- }) => boolean;
42
- canCopyRow?: (input: {
43
- actor: Actor$1;
44
- rowId: number;
45
- }) => boolean;
46
- canDeleteRow?: (input: {
47
- actor: Actor$1;
48
- rowId: number;
49
- }) => boolean;
50
- canReorderRow?: (input: {
51
- actor: Actor$1;
52
- rowId: number;
53
- }) => boolean;
54
- }
55
-
56
- /**
57
- * View-state value object for virtual scrolling.
58
- * Lives in Domain types but is NOT an accounting invariant — Adapters drive it.
59
- */
60
- declare class Viewport {
61
- /** Vertical scroll offset in pixels. */
62
- readonly scrollOffset: number;
63
- /** Visible viewport height in pixels. */
64
- readonly viewportSize: number;
65
- /** Fixed row height in pixels (variable-height later). */
66
- readonly rowHeight: number;
67
- /** Extra rows rendered above/below the window. */
68
- readonly overscan: number;
69
- constructor(
70
- /** Vertical scroll offset in pixels. */
71
- scrollOffset: number,
72
- /** Visible viewport height in pixels. */
73
- viewportSize: number,
74
- /** Fixed row height in pixels (variable-height later). */
75
- rowHeight: number,
76
- /** Extra rows rendered above/below the window. */
77
- overscan?: number);
78
- equals(other: Viewport): boolean;
79
- withScrollOffset(scrollOffset: number): Viewport;
80
- withViewportSize(viewportSize: number): Viewport;
81
- toJSON(): {
82
- scrollOffset: number;
83
- viewportSize: number;
84
- rowHeight: number;
85
- overscan: number;
86
- };
87
- }
88
- /** Inclusive start, exclusive end — indices into the ordered row list. */
89
- type VisibleRange = {
90
- readonly startIndex: number;
91
- readonly endIndex: number;
92
- readonly startOffset: number;
93
- readonly endOffset: number;
94
- readonly totalHeight: number;
95
- readonly visibleCount: number;
96
- };
97
-
98
- declare class CellValue {
99
- readonly value: unknown;
100
- constructor(value: unknown);
101
- equals(other: CellValue): boolean;
102
- }
103
- declare class CellDisplay {
104
- readonly value: unknown;
105
- constructor(value: unknown);
106
- equals(other: CellDisplay): boolean;
107
- }
108
- declare class ColumnId {
109
- readonly value: string;
110
- constructor(value: string);
111
- equals(other: ColumnId): boolean;
112
- }
113
- type KeyValue = {
114
- key: string;
115
- value: unknown;
116
- display: unknown;
117
- };
118
- type IRule = {
119
- type?: string | 'array' | 'object' | 'enum' | 'date' | 'number' | 'integer' | 'float' | 'boolean' | 'email' | 'url' | 'hex' | RegExp;
120
- required?: boolean;
121
- whitespace?: boolean;
122
- message?: string;
123
- transform?: (value: any) => any;
124
- pattern?: string | RegExp;
125
- min?: number;
126
- max?: number;
127
- len?: number;
128
- enum?: any[];
129
- validator?: (rule: IRule, value: any, callback: (error?: string[]) => void) => void | Promise<void>;
130
- asyncValidator?: (rule: IRule, value: any) => Promise<void>;
131
- warningOnly?: boolean;
132
- validateTrigger?: string | string[];
133
- };
134
- declare class RowId {
135
- value: number;
136
- constructor(value: number);
137
- equals(other: RowId): boolean;
138
- set(id: RowId): void;
139
- }
140
- declare class RowState {
141
- value: RowStateEnum;
142
- constructor(value: RowStateEnum);
143
- equals(other: RowStateEnum): boolean;
144
- set(rowState: RowStateEnum): void;
145
- }
146
- declare enum RowStateEnum {
147
- Added = "Add",
148
- Modified = "Update",
149
- Deleted = "Delete",
150
- Unchanged = "None"
151
- }
152
- type TableActions = "copy" | "cut" | "paste" | "pasteInsert" | null;
153
-
154
- declare class Pagination {
155
- readonly page: number;
156
- readonly pageSize: number;
157
- readonly totalRows: number;
158
- readonly totalPages: number;
159
- readonly canPrev: boolean;
160
- readonly canNext: boolean;
161
- constructor(page: number, pageSize: number, totalRows: number);
162
- changePage(page: number): Pagination;
163
- changePageSize(size: number): Pagination;
164
- toJSON(): {
165
- page: number;
166
- pageSize: number;
167
- totalRows: number;
168
- totalPages: number;
169
- canPrev: boolean;
170
- canNext: boolean;
171
- };
172
- }
173
-
174
- declare class CellChanged {
175
- readonly rowId: RowId;
176
- readonly columnId: ColumnId;
177
- readonly newValue: unknown;
178
- readonly previousValue: unknown;
179
- readonly type = "CELL_CHANGED";
180
- constructor(rowId: RowId, columnId: ColumnId, newValue: unknown, previousValue: unknown);
181
- }
182
- declare class DisplayChanged {
183
- readonly rowId: RowId;
184
- readonly columnId: ColumnId;
185
- readonly newValue: unknown;
186
- readonly type = "DISPLAY_CHANGED";
187
- constructor(rowId: RowId, columnId: ColumnId, newValue: unknown);
188
- }
189
- declare class DescriptionSaved {
190
- readonly rowId: RowId;
191
- readonly flag: boolean;
192
- readonly type = "DESCRIPTION_SAVED";
193
- constructor(rowId: RowId, flag: boolean);
194
- }
195
- declare class ColumnReordered {
196
- readonly sourceIndex: number;
197
- readonly destIndex: number;
198
- readonly type = "COLUMN_REORDERED";
199
- constructor(sourceIndex: number, destIndex: number);
200
- }
201
- declare class RowAdded {
202
- readonly rowId: RowId;
203
- readonly type = "ROW_ADDED";
204
- constructor(rowId: RowId);
205
- }
206
- declare class RowDeleted {
207
- readonly rowId: RowId;
208
- readonly type = "ROW_DELETED";
209
- constructor(rowId: RowId);
210
- }
211
- declare class RowRemoved {
212
- readonly rowId: RowId;
213
- readonly type = "NEW_ROW_REMOVED";
214
- constructor(rowId: RowId);
215
- }
216
- declare class MinimumRowConstraintViolated {
217
- readonly rowId: RowId;
218
- readonly type = "NEW_AND_FIRST_ROW_CAN_NOT_BE_REMOVE";
219
- constructor(rowId: RowId);
220
- }
221
- declare class RowRestored {
222
- readonly rowId: RowId;
223
- readonly type = "ROW_RESTORED";
224
- constructor(rowId: RowId);
225
- }
226
- declare class RowReordered {
227
- readonly draggedRowNum: number;
228
- readonly droppedRowNum: number;
229
- readonly type = "ROW_REORDERED";
230
- constructor(draggedRowNum: number, droppedRowNum: number);
231
- }
232
-
233
- declare class Cell {
234
- readonly rowId: RowId;
235
- readonly columnId: ColumnId;
236
- private value;
237
- private originalValue;
238
- private display;
239
- constructor(rowId: RowId, columnId: ColumnId, value: CellValue, originalValue: CellValue, display: CellDisplay);
240
- changeValue(newValue: unknown): CellChanged | null;
241
- changeDisplay(newValue: unknown): DisplayChanged | null;
242
- changeOriginalValue(newValue: unknown): CellChanged | null;
243
- getValue(): unknown;
244
- getValueObject(): CellValue;
245
- getDisplay(): unknown;
246
- getDisplayObject(): CellDisplay;
247
- getOriginalValue(): CellValue;
248
- clone(): Cell;
249
- }
250
-
251
- declare class Row {
252
- id: RowId;
253
- cells: Map<string, Cell>;
254
- rowState: RowState;
255
- changeFields: Set<string>;
256
- visibilityCondition: Record<string, boolean>;
257
- collection: string;
258
- isSaveDescription: boolean;
259
- constructor(id: RowId, cells: Map<string, Cell>, rowState: RowState, changeFields: Set<string> | undefined, visibilityCondition: Record<string, boolean>, collection: string | undefined, isSaveDescription: boolean);
260
- updateChangeFields(columnId: ColumnId): void;
261
- getCollection(): string;
262
- setCollection(collection: string): void;
263
- getChangeFields(): readonly string[];
264
- getSnapshotChangeFields(): readonly string[];
265
- changeCell(columnId: ColumnId, value: unknown): CellChanged | null;
266
- saveDescription(flag: boolean): DescriptionSaved;
267
- changeDisplay(columnId: ColumnId, value: unknown): DisplayChanged | null;
268
- getCells(): ReadonlyMap<string, Cell>;
269
- getCell(columnId: string): Cell | undefined;
270
- ensureCell(columnId: ColumnId, defaultValue: CellValue, displayValue: CellDisplay): void;
271
- setRowId(rowId: RowId): void;
272
- setVisibilityCondition(Condition: Record<string, boolean>): void;
273
- getVisibilityCondition(): Record<string, boolean>;
274
- removeCell(columnId: ColumnId): void;
275
- clone(): Row;
276
- }
277
-
278
- type FieldType = 'index' | 'text' | 'number' | 'price' | 'select' | 'selectOption' | 'date' | 'static' | 'description' | 'checkbox';
279
- type ColumnVisibilityRule = {
280
- kind: 'always';
281
- } | {
282
- kind: 'never';
283
- } | {
284
- kind: 'showUnitLevelConditionally';
285
- fieldName: string;
286
- } | {
287
- kind: 'whenFieldTruthy';
288
- fieldName: string;
289
- } | {
290
- kind: 'whenRemoteFlag';
291
- sourceFieldName: string;
292
- flag: string;
293
- } | {
294
- kind: 'whenCollection';
295
- collection: string;
296
- } | {
297
- kind: 'whenTableType';
298
- tableType: string;
299
- };
300
- interface ResolveOnConfig<K = unknown, TResponse = unknown> {
301
- endpoint: string;
302
- fieldName: string;
303
- buildParams: (row: Record<string, unknown>) => Record<string, unknown>;
304
- getResponse?: (response: TResponse, row: Row) => unknown;
305
- mapFlags?: (response: TResponse) => Record<string, boolean>;
306
- }
307
- type ColumnAccessControl = {
308
- allowRoles?: string[];
309
- denyRoles?: string[];
310
- rule?: (ctx: {
311
- actor: Actor$1;
312
- row: Row;
313
- table: Table;
314
- }) => boolean;
315
- };
316
- interface IDependOn {
317
- fieldName: string;
318
- value: any;
319
- }
320
- type DefaultOptionType = {
321
- value?: string | number;
322
- label?: any;
323
- title?: string;
324
- [key: string]: unknown;
325
- };
326
- interface ColumnSchema<T = unknown, K = unknown> {
327
- fieldName: string;
328
- fieldCaption: string;
329
- fieldType: FieldType;
330
- fieldCollection?: string;
331
- order?: number;
332
- rules?: IRule[];
333
- options?: DefaultOptionType[];
334
- editable?: boolean;
335
- isUnique?: boolean;
336
- noCache?: boolean;
337
- expandable?: boolean;
338
- returnValue?: (values: T, colId: string) => unknown;
339
- returnDisplayValue?: (values: T, colId: string) => unknown;
340
- enableDeleteButton?: boolean;
341
- enableExpandButton?: boolean;
342
- enableMoveButton?: boolean;
343
- enableOptionsButton?: boolean;
344
- disable?: boolean;
345
- colAccess?: ColumnAccessControl;
346
- dynamicSource?: {
347
- endpoint: string;
348
- dependsOn?: string[];
349
- dependOn?: IDependOn | IDependOn[];
350
- params?: Record<string, string>;
351
- [key: string]: unknown;
352
- };
353
- hidden?: boolean;
354
- className?: string;
355
- visibility: ColumnVisibilityRule;
356
- resolveOn?: ResolveOnConfig<K>;
357
- computed?: {
358
- dependsOn: readonly string[];
359
- compute: (row: Record<string, unknown>, remoteApi: RemoteApi) => Promise<unknown>;
360
- children?: [] | undefined;
361
- };
362
- selectOptions?: {
363
- label: string;
364
- value: string | number;
365
- }[];
366
- indexOptions?: (...args: any[]) => any[];
367
- onChange?: (...args: any[]) => void;
368
- displayFormat?: (value: unknown) => unknown;
369
- minWidth?: number;
370
- style?: any;
371
- popUpWidth?: number;
372
- dynamicSelectFilterOption?: (inputValue: string, option: any) => boolean;
373
- labelValue?: 'selectDisplay' | 'selectValue';
374
- }
375
-
376
- declare class Collection {
377
- name: string;
378
- private rows;
379
- private columns;
380
- constructor(name: string | undefined, rows: Map<number, Row>, columns: Map<string, ColumnSchema>);
381
- setCollectionName(name: string): void;
382
- getCollectionName(): string;
383
- getRows(): Map<number, Row>;
384
- setRows(rows: Map<number, Row>): void;
385
- getColumns(): Map<string, ColumnSchema>;
386
- }
387
-
388
- type CollectionScope = 'active' | 'all' | string[];
389
- declare class Table {
390
- readonly id: string;
391
- private collection;
392
- private pagination;
393
- private action;
394
- private activeCollection;
395
- constructor(id: string, collection: Map<string, Collection>, pagination: Pagination, action: TableActions, activeCollection?: string);
396
- private getActiveCollection;
397
- private getCollection;
398
- /** Finds which Collection currently owns a given column id (if any). */
399
- private findCollectionForColumn;
400
- getCollections(): Map<string, Collection>;
401
- getColumnSchema(columnId: ColumnId): ColumnSchema | undefined;
402
- getActiveCollectionName(): string;
403
- setActiveCollection(activeCollection: string): void;
404
- getRowCollection(rowId: number): string | undefined;
405
- setRowCollection(rowId: number, collection: string): void;
406
- setColumnSchema(columnId: ColumnId, DetailColumnConfig: ColumnSchema): ColumnSchema | undefined;
407
- getColumns(): ColumnSchema[];
408
- getActiveCollectionColumns(): ColumnSchema[];
409
- getColumnsForCollectionScope(collectionScope?: CollectionScope): ColumnSchema[];
410
- getColumnValues(colId: string): unknown[];
411
- setColumns(newColumns: ColumnSchema[]): void;
412
- changeCell(rowId: RowId, columnId: ColumnId, value: unknown): CellChanged | null;
413
- changeDisplay(rowId: RowId, columnId: ColumnId, value: unknown): DisplayChanged | null;
414
- saveDescription(rowId: RowId, flag: boolean): DescriptionSaved | null;
415
- duplicateRow(rowId: RowId): RowAdded;
416
- addRow(targetRowId: number, placedRowId?: number): RowAdded;
417
- addNewRow(data?: KeyValue[]): RowAdded;
418
- addNewRows(cmd: {
419
- rows: KeyValue[][];
420
- detailFieldKey: string;
421
- }): RowAdded[];
422
- addColumns(newColumns: ColumnSchema[]): {
423
- added: ColumnId[];
424
- };
425
- removeColumns(columnIds: ColumnId[]): {
426
- removed: ColumnId[];
427
- };
428
- getRows(collectionScope?: CollectionScope): Row[];
429
- getCollectionsRows(collections: string[]): Row[];
430
- getRow(rowId: number): Row | undefined;
431
- addRows(newRows: Row[]): void;
432
- getPagination(): Pagination;
433
- setPagination(pagination: Pagination): void;
434
- changePage(page: number): void;
435
- changePageSize(size: number): void;
436
- getVisibleRows(): Row[];
437
- setTableAction(action: TableActions): void;
438
- getTableAction(): TableActions;
439
- /**
440
- * Re-inserts a previously Added row after hard-remove (undo of ADD → redo).
441
- * Preserves rowId and cell values; no-ops if the id already exists.
442
- */
443
- restoreAddedRow(params: {
444
- rowId: number;
445
- cells: Readonly<Record<string, {
446
- readonly value: unknown;
447
- readonly display?: unknown;
448
- readonly originalValue?: unknown;
449
- }>>;
450
- collection?: string;
451
- isSaveDescription?: boolean;
452
- }): RowAdded;
453
- deleteRow(rowId: RowId): RowDeleted | RowRestored | RowRemoved | MinimumRowConstraintViolated | null;
454
- reorderRows(draggedRowNum: number, droppedRowNum: number, position?: 'before' | 'after'): RowReordered;
455
- reorderColumns(sourceIndex: number, destIndex: number): ColumnReordered;
456
- clone(): Table;
457
- }
458
-
459
- interface TableRepository {
460
- getById(store: string, tableKey: string): Promise<Table>;
461
- save(store: string, table: Table): Promise<void>;
462
- delete(store: string, tableKey: string): Promise<void>;
463
- resetTable(store: string, tableKey: string): Promise<void>;
464
- exists(store: string, tableKey: string): Promise<boolean>;
465
- getFromDbById?(store: string, tableKey: string): Promise<Table>;
466
- }
467
-
468
- /**
469
- * Host-agnostic request config shape used by UI multi-select bindings.
470
- * Host apps may narrow this to their own IRequestConfig.
471
- */
472
- type IRequestConfig = {
473
- endpoint?: string;
474
- params?: Record<string, unknown>;
475
- method?: 'GET' | 'POST';
476
- [key: string]: unknown;
477
- };
478
-
479
- interface UIRow {
480
- id: number;
481
- cells: Record<string, TCell>;
482
- rowState: RowStateEnum;
483
- isExpanded: boolean;
484
- changeFields: readonly string[];
485
- visibilityCondition: Record<string, boolean>;
486
- }
487
- type MultiSelectDependOn = {
488
- fieldName: string;
489
- value: unknown;
490
- };
491
- interface IMultiSelectConfig {
492
- dynamicValue: IRequestConfig & {
493
- dependsOn?: string[];
494
- dependOn?: MultiSelectDependOn | MultiSelectDependOn[];
495
- };
496
- fieldKey: string;
497
- detailFieldKey: string;
498
- onAdd: (e: any) => void;
499
- ListConfig: {
500
- fieldName: string;
501
- fieldCaption: string;
502
- fieldType: FieldType;
503
- hidden?: boolean;
504
- returnValue?: (row: Record<string, unknown>[], colId: string) => unknown;
505
- returnDisplayValue?: (row: Record<string, unknown>[], colId: string) => unknown;
506
- }[];
507
- }
508
-
509
- type GridSearchMatch = {
510
- rowId: number;
511
- columnId: string;
512
- };
513
- type GridSearchState = {
514
- columnId: string;
515
- query: string;
516
- matches: GridSearchMatch[];
517
- currentIndex: number;
518
- } | null;
519
- type MobileEditorState = {
520
- mode: 'add' | 'edit';
521
- rowId: number;
522
- } | null;
523
- type TableViewState = {
524
- activeCell: ActiveCell;
525
- selectedRows: Record<number, true>;
526
- rows: UIRow[];
527
- deletedRows: Array<{
528
- id: string;
529
- cells: Record<string, unknown>;
530
- isExpanded: boolean;
531
- }>;
532
- columns: ColumnSchema[];
533
- activeCollectionColumn: ColumnSchema[];
534
- pagination: {
535
- page: number;
536
- pageSize: number;
537
- totalRows: number;
538
- totalPages: number;
539
- canPrev: boolean;
540
- canNext: boolean;
541
- };
542
- action: TableActions;
543
- gridSearch: GridSearchState;
544
- mobileEditor: MobileEditorState;
545
- };
546
- type MobileTableViewState = {
547
- rows: UIRow[];
548
- columns: ColumnSchema[];
549
- totalRows: number;
550
- visibleCount: number;
551
- hasMore: boolean;
552
- pageSize: number;
553
- mobileEditor: MobileEditorState;
554
- };
555
- type TableSnapShot = {
556
- rows: Array<{
557
- id: number;
558
- cells: Record<string, unknown>;
559
- rowState: RowStateEnum;
560
- collection: string;
561
- rowType?: string;
562
- changeFields: readonly string[];
563
- isSaveDescription: boolean;
564
- }>;
565
- };
566
- type ActiveCell = {
567
- rowId: number;
568
- columnId: string;
569
- } | null;
570
- type ValidCell = {
571
- isValid: boolean;
572
- cellError: CellError;
573
- };
574
- type TableState = {
575
- table: Table;
576
- expandedRows: Record<string, boolean>;
577
- selectedRows: Record<number, true>;
578
- activeRowId: number | undefined;
579
- activeCell: ActiveCell | undefined;
580
- rangeAnchorRowId: number | undefined;
581
- gridSearch: GridSearchState;
582
- mobileEditor: MobileEditorState;
583
- };
584
- type TCell = {
585
- value: unknown;
586
- originalValue: unknown;
587
- display: unknown;
588
- };
589
- type ItemType = {
590
- type?: 'submenu' | 'item' | 'group' | 'divider';
591
- label?: React.ReactNode;
592
- children?: ItemType[];
593
- disabled?: boolean;
594
- ref?: React.Ref<HTMLLIElement | null>;
595
- style?: React.CSSProperties;
596
- className?: string;
597
- isSelected?: boolean;
598
- isOpen?: boolean;
599
- isSubMenu?: boolean;
600
- danger?: boolean;
601
- icon?: React.ReactNode;
602
- title?: string;
603
- key: string;
604
- theme?: 'dark' | 'light';
605
- dashed?: boolean;
606
- rootClassName?: string;
607
- itemIcon?: React.ReactNode;
608
- expandIcon?: React.ReactNode;
609
- popupClassName?: string;
610
- popupOffset?: number[];
611
- popupStyle?: React.CSSProperties;
612
- onClick?: () => void;
613
- extra?: React.ReactNode;
614
- };
615
- type ValidationCallback = (result: ValidationCallbackResult) => void;
616
- type ValidationCallbackResult = {
617
- valid: boolean;
618
- errors?: Map<string, CellError>;
619
- data?: any;
620
- };
621
- interface CellError {
622
- rowId: number;
623
- caption: string;
624
- message: string;
625
- }
626
-
627
- interface BaseTableCommand {
628
- readonly store: string;
629
- readonly tableKey: string;
630
- /** When set, undoable events from separate executes merge into one undo unit. */
631
- readonly correlationId?: string;
632
- }
633
- type Actor = {
634
- readonly userId: string;
635
- readonly roles: string[];
636
- };
637
- /**
638
- * Base invariant:
639
- * هر Command دقیقاً متعلق به یک Table است
640
- */
641
- interface MoveActiveCellCommand {
642
- readonly type: 'MOVE_ACTIVE_CELL';
643
- readonly store: string;
644
- readonly tableKey: string;
645
- readonly rowId: number;
646
- readonly columnId: string;
647
- readonly direction: 'next' | 'prev';
648
- }
649
- interface MoveActiveCellVerticalCommand {
650
- readonly type: 'MOVE_ACTIVE_CELL_VERTICAL';
651
- readonly store: string;
652
- readonly tableKey: string;
653
- readonly rowId: number;
654
- readonly columnId: string;
655
- readonly direction: 'up' | 'down';
656
- }
657
- interface MoveVerticalSelectedRows {
658
- readonly type: 'MOVE_VERTICAL_SELECTED_ROWS';
659
- readonly tableKey: string;
660
- readonly direction: 'up' | 'down';
661
- }
662
- interface MoveVerticalActiveRow {
663
- readonly type: 'MOVE_VERTICAL_ACTIVE_ROW';
664
- readonly tableKey: string;
665
- readonly direction: 'up' | 'down';
666
- }
667
- interface ActiveCellCommand {
668
- readonly type: 'ACTIVE_CELL';
669
- readonly tableKey: string;
670
- readonly rowId: number;
671
- readonly columnId: string;
672
- }
673
- interface ActiveRowCommand extends BaseTableCommand {
674
- readonly type: 'ACTIVE_ROW';
675
- readonly tableKey: string;
676
- readonly rowId: number;
677
- }
678
- interface ActiveFirstCellCommand {
679
- readonly type: 'ACTIVATE_FIRST_CELL';
680
- readonly tableKey: string;
681
- readonly rowId: number;
682
- }
683
- interface ChangeCellValueCommand extends BaseTableCommand {
684
- readonly type: 'CHANGE_CELL_VALUE';
685
- readonly rowId: number;
686
- readonly columnId: string;
687
- readonly newValue: unknown;
688
- }
689
- interface SaveDescriptionCommand extends BaseTableCommand {
690
- readonly type: 'SAVE_DESCRIPTION';
691
- readonly rowId: number;
692
- readonly flag: boolean;
693
- }
694
- interface ChangeCellDisplayValueCommand extends BaseTableCommand {
695
- readonly type: 'CHANGE_CELL_DISPLAY_VALUE';
696
- readonly rowId: number;
697
- readonly columnId: string;
698
- readonly newValue: string;
699
- }
700
- interface AddEmptyRowCommand extends BaseTableCommand {
701
- readonly type: 'ADD_EMPTY_ROW';
702
- readonly autoActivate: boolean;
703
- }
704
- interface AddNewRowsCommand extends BaseTableCommand {
705
- readonly type: 'ADD_NEW_ROWS';
706
- readonly detailFieldKey: string;
707
- readonly rows: {
708
- key: string;
709
- value: unknown;
710
- display: unknown;
711
- }[][];
712
- readonly autoActivate?: boolean;
713
- }
714
- interface DuplicateRowCommand extends BaseTableCommand {
715
- readonly type: 'DUPLICATE_ROW';
716
- readonly rowId: number;
717
- }
718
- /**
719
- * Clone one source row (clipboard paste). Engine batches these with a shared
720
- * correlationId so undo reverses the whole paste unit.
721
- */
722
- interface PasteRowCommand extends BaseTableCommand {
723
- readonly type: 'PASTE_ROW';
724
- readonly sourceRowId: number;
725
- /** When set (pasteInsert), place the clone relative to this row. */
726
- readonly placeAtRowId?: number;
727
- }
728
- interface DeleteRowCommand extends BaseTableCommand {
729
- readonly type: 'ROW_DELETED';
730
- readonly rowId: number;
731
- }
732
- /** Undo-stack redo: re-insert a previously added row with original identity/values. */
733
- interface RestoreAddedRowCommand extends BaseTableCommand {
734
- readonly type: 'RESTORE_ADDED_ROW';
735
- readonly rowId: number;
736
- readonly cells: Readonly<Record<string, {
737
- readonly value: unknown;
738
- readonly display?: unknown;
739
- readonly originalValue?: unknown;
740
- }>>;
741
- readonly collection?: string;
742
- readonly isSaveDescription?: boolean;
743
- }
744
- interface DeleteRowsCommand extends BaseTableCommand {
745
- readonly type: 'ROWS_DELETED';
746
- }
747
- interface ExpandRowCommand {
748
- readonly type: 'ROW_EXPANDED';
749
- readonly tableKey: string;
750
- readonly rowId: number;
751
- readonly value: boolean;
752
- }
753
- interface SelectRowCommand {
754
- readonly type: 'ROW_SELECTED';
755
- readonly tableKey: string;
756
- readonly rowId: number;
757
- }
758
- interface ToggleRowSelectionCommand {
759
- readonly type: "ROW_SELECTION_TOGGLED";
760
- readonly tableKey: string;
761
- readonly rowId: number;
762
- }
763
- interface ToggleRowExpandCommand {
764
- readonly type: 'ROW_EXPAND_TOGGLED';
765
- readonly tableKey: string;
766
- readonly rowId: number;
767
- }
768
- interface SelectRangeCommand {
769
- readonly type: "ROW_RANGE_SELECTED";
770
- readonly tableKey: string;
771
- readonly rowId: number;
772
- }
773
- interface SelectActiveRowToLastCommand {
774
- readonly type: "SELECT_FROM_ACTIVE_TO_LAST";
775
- readonly tableKey: string;
776
- readonly anchorRowId: number;
777
- }
778
- interface RowReorderedCommand extends BaseTableCommand {
779
- readonly type: 'ROW_REORDERED';
780
- readonly draggedRowId: number;
781
- readonly droppedRowId: number;
782
- readonly position: 'before' | 'after';
783
- }
784
- interface SelectAllRowsCommand {
785
- readonly type: 'TOGGLE_SELECT_ALL_ROWS';
786
- readonly tableKey: string;
787
- }
788
- interface SelectPageRowsCommand {
789
- readonly type: 'TOGGLE_SELECT_PAGE_ROWS';
790
- readonly tableKey: string;
791
- }
792
- interface CollapseAllRowsCommand {
793
- readonly type: 'COLLAPSE_ALL_ROWS';
794
- readonly tableKey: string;
795
- }
796
- interface ColumnReorderedCommand extends BaseTableCommand {
797
- readonly type: 'COLUMN_REORDERED';
798
- readonly sourceIndex: number;
799
- readonly destIndex: number;
800
- }
801
- interface DeleteTableCommand extends BaseTableCommand {
802
- readonly type: 'TABLE_DELETED';
803
- }
804
- interface SetActiveCollectionCommand extends BaseTableCommand {
805
- readonly type: 'SET_ACTIVE_COLLECTION';
806
- readonly activeCollection: string;
807
- }
808
- interface ResetTableCommand extends BaseTableCommand {
809
- readonly type: 'TABLE_RESET';
810
- readonly rowId: string;
811
- }
812
- interface RegisterTableCommand extends BaseTableCommand {
813
- readonly type: 'TABLE_REGISTERED';
814
- readonly store: string;
815
- readonly table: Table;
816
- }
817
- interface DisposeTableCommand extends BaseTableCommand {
818
- readonly type: 'TABLE_DISPOSED';
819
- }
820
- interface ChangeTableActionCommand extends BaseTableCommand {
821
- readonly type: 'SET_TABLE_ACTION';
822
- action: TableActions;
823
- }
824
- interface ChangePageCommand extends BaseTableCommand {
825
- readonly type: 'CHANGE_PAGE';
826
- readonly page: number;
827
- }
828
- interface ChangePageSizeCommand extends BaseTableCommand {
829
- readonly type: 'CHANGE_PAGE_SIZE';
830
- readonly pageSize: number;
831
- }
832
- interface ChangeUnitLevelCommand extends BaseTableCommand {
833
- readonly type: 'SET_UNIT_LEVEL';
834
- readonly level: number;
835
- }
836
- interface ApplyDynamicProjectionCommand extends BaseTableCommand {
837
- readonly type: 'APPLY_DYNAMIC_PROJECTION';
838
- readonly tableKey: string;
839
- readonly rowId: number;
840
- readonly columnId: string;
841
- }
842
- interface SetGridSearchCommand {
843
- readonly type: 'SET_GRID_SEARCH';
844
- readonly tableKey: string;
845
- readonly search: GridSearchState;
846
- }
847
- interface SetMobileEditorCommand {
848
- readonly type: 'SET_MOBILE_EDITOR';
849
- readonly tableKey: string;
850
- readonly editor: MobileEditorState;
851
- }
852
- type EngineTableCommand = SelectActiveRowToLastCommand | SelectRangeCommand | ToggleRowExpandCommand | SelectRowCommand | ColumnReorderedCommand | CollapseAllRowsCommand | RegisterTableCommand | DisposeTableCommand | DeleteRowsCommand | ToggleRowSelectionCommand | SelectAllRowsCommand | SelectPageRowsCommand | ActiveCellCommand | ActiveRowCommand | MoveActiveCellCommand | MoveActiveCellVerticalCommand | MoveVerticalSelectedRows | MoveVerticalActiveRow | ActiveFirstCellCommand | ExpandRowCommand | ChangeTableActionCommand | SetGridSearchCommand | SetMobileEditorCommand;
853
- type ApplicationTableCommand = ChangeCellValueCommand | SaveDescriptionCommand | ChangeCellDisplayValueCommand | AddEmptyRowCommand | AddNewRowsCommand | DuplicateRowCommand | PasteRowCommand | DeleteRowCommand | RestoreAddedRowCommand | DeleteTableCommand | SetActiveCollectionCommand | ResetTableCommand | RowReorderedCommand | ChangePageCommand | ChangePageSizeCommand | ApplyDynamicProjectionCommand | ChangeUnitLevelCommand;
854
- type TableCommand = EngineTableCommand | ApplicationTableCommand;
855
-
856
- interface BaseTableEvent {
857
- readonly tableId: string;
858
- readonly type: string;
859
- }
860
- interface CellChangedEvent extends BaseTableEvent {
861
- type: 'CELL_CHANGED';
862
- rowId: number;
863
- columnId: string;
864
- newValue: unknown;
865
- previousValue: unknown;
866
- }
867
- interface DynamicProjectionEvent extends BaseTableEvent {
868
- type: 'DYNAMIC_PROJECTION_DONE';
869
- rowId: number;
870
- columnId: string;
871
- }
872
- interface CellDisplayChangedEvent extends BaseTableEvent {
873
- type: 'CELL_DISPLAY_CHANGED';
874
- rowId: number;
875
- columnId: string;
876
- newValue: unknown;
877
- }
878
- interface RowAddedEvent extends BaseTableEvent {
879
- type: 'ROW_ADDED';
880
- rowId: string;
881
- }
882
- interface NewRowAddedEvent extends BaseTableEvent {
883
- type: 'NEW_ROW_ADDED';
884
- rowId: string;
885
- }
886
- interface RowDeletedEvent extends BaseTableEvent {
887
- type: 'ROW_DELETED';
888
- rowId: string;
889
- }
890
- interface NewRowRemovedEvent extends BaseTableEvent {
891
- type: 'NEW_ROW_REMOVED';
892
- rowId: string;
893
- }
894
- interface RowRestoredEvent extends BaseTableEvent {
895
- type: 'ROW_RESTORED';
896
- rowId: string;
897
- }
898
- interface RowReorderedEvent extends BaseTableEvent {
899
- type: 'ROW_REORDERED';
900
- sourceIndex: number;
901
- destIndex: number;
902
- }
903
- interface RowDescriptionSaved extends BaseTableEvent {
904
- type: 'ROW_DESCRIPTION_SAVED';
905
- rowId: number;
906
- description: boolean;
907
- }
908
- interface ColumnReorderedEvent extends BaseTableEvent {
909
- type: 'COLUMN_REORDERED';
910
- sourceIndex: number;
911
- destIndex: number;
912
- }
913
- interface UnitColumnAddedEvent extends BaseTableEvent {
914
- type: 'UNIT_COLUMN_ADDED';
915
- reason: string;
916
- details?: unknown;
917
- }
918
- interface PageChangedEvent extends BaseTableEvent {
919
- type: 'PAGE_CHANGED';
920
- page: number;
921
- }
922
- interface PageSizeChangedEvent extends BaseTableEvent {
923
- type: 'PAGE_SIZE_CHANGED';
924
- tableId: string;
925
- pageSize: number;
926
- }
927
- interface TableDeletedEvent extends BaseTableEvent {
928
- type: 'TABLE_DELETED';
929
- tableId: string;
930
- }
931
- interface TableResetEvent extends BaseTableEvent {
932
- type: 'TABLE_RESET';
933
- tableId: string;
934
- }
935
- interface ActiveCollectionChangedEvent extends BaseTableEvent {
936
- type: 'ACTIVE_COLLECTION_CHANGED';
937
- tableId: string;
938
- }
939
- interface RowsLoadedEvent extends BaseTableEvent {
940
- type: 'ROWS_LOADED';
941
- count: number;
942
- }
943
- interface DynamicDataRequestedEvent extends BaseTableEvent {
944
- type: 'DYNAMIC_DATA_REQUESTED';
945
- requestId: string;
946
- sourceColumn: string;
947
- value: unknown;
948
- }
949
- interface ValidationFailedEvent extends BaseTableEvent {
950
- type: 'VALIDATION_FAILED';
951
- reason: string;
952
- details?: unknown;
953
- }
954
- type TableEvent = CellChangedEvent | DynamicProjectionEvent | CellDisplayChangedEvent | RowAddedEvent | NewRowAddedEvent | RowDeletedEvent | NewRowRemovedEvent | RowRestoredEvent | RowReorderedEvent | RowDescriptionSaved | ColumnReorderedEvent | UnitColumnAddedEvent | PageChangedEvent | PageSizeChangedEvent | RowsLoadedEvent | DynamicDataRequestedEvent | ValidationFailedEvent | TableDeletedEvent | ActiveCollectionChangedEvent | TableResetEvent;
955
-
956
- type DynamicConfig = {
957
- columnMeta: Map<string, ColumnSchema>;
958
- remoteApi: RemoteApi;
959
- };
960
- declare class ChangeCellValueHandler {
961
- private readonly repo;
962
- private readonly audit;
963
- private readonly permissionPolicy;
964
- private readonly dynamic?;
965
- constructor(repo: TableRepository, audit: AuditLogger, permissionPolicy: PermissionPolicy, dynamic?: DynamicConfig | undefined);
966
- execute(command: ChangeCellValueCommand, actor: Actor$1): Promise<TableEvent[]>;
967
- private applyRemoteVisibilityRules;
968
- private applyComputedColumns;
969
- private validateCellValue;
970
- private applyDynamicProjection;
971
- }
972
- declare class ChangeCellDisplayValueHandler {
973
- private readonly repo;
974
- private readonly audit;
975
- private readonly permissionPolicy;
976
- constructor(repo: TableRepository, audit: AuditLogger, permissionPolicy: PermissionPolicy);
977
- execute(command: ChangeCellDisplayValueCommand, actor: Actor$1): Promise<TableEvent[]>;
978
- }
979
- declare class SaveDescriptionHandler {
980
- private readonly repo;
981
- private readonly audit;
982
- private readonly permissionPolicy;
983
- constructor(repo: TableRepository, audit: AuditLogger, permissionPolicy: PermissionPolicy);
984
- execute(command: SaveDescriptionCommand, actor: Actor$1): Promise<TableEvent[]>;
985
- }
986
- declare class ApplyDynamicProjectionHandler {
987
- private readonly repo;
988
- private readonly audit;
989
- private readonly permissionPolicy;
990
- private readonly dynamic?;
991
- constructor(repo: TableRepository, audit: AuditLogger, permissionPolicy: PermissionPolicy, dynamic?: DynamicConfig | undefined);
992
- execute(command: ApplyDynamicProjectionCommand, actor: Actor$1): Promise<TableEvent[]>;
993
- private applyRemoteVisibilityRules;
994
- private applyComputedColumns;
995
- private validateCellValue;
996
- private applyDynamicProjection;
997
- }
998
-
999
- declare class AddNewRowCommandHandler {
1000
- private readonly repo;
1001
- private readonly audit;
1002
- private readonly permission;
1003
- constructor(repo: TableRepository, audit: AuditLogger, permission: PermissionPolicy);
1004
- execute(command: AddEmptyRowCommand, actor: Actor$1): Promise<RowAdded | null>;
1005
- }
1006
- declare class AddNewRowsCommandHandler {
1007
- private readonly repo;
1008
- private readonly audit;
1009
- private readonly permission;
1010
- constructor(repo: TableRepository, audit: AuditLogger, permission: PermissionPolicy);
1011
- execute(command: AddNewRowsCommand, actor: Actor$1): Promise<RowAdded[] | null>;
1012
- }
1013
- declare class PasteRowCommandHandler {
1014
- private readonly repo;
1015
- private readonly audit;
1016
- private readonly permission;
1017
- constructor(repo: TableRepository, audit: AuditLogger, permission: PermissionPolicy);
1018
- execute(command: PasteRowCommand, actor: Actor$1): Promise<RowAdded | null>;
1019
- }
1020
- declare class DuplicateRowCommandHandler {
1021
- private readonly repo;
1022
- private readonly audit;
1023
- private readonly permission;
1024
- constructor(repo: TableRepository, audit: AuditLogger, permission: PermissionPolicy);
1025
- execute(command: DuplicateRowCommand, actor: Actor$1): Promise<RowAdded | null>;
1026
- }
1027
- declare class DeleteRowCommandHandler {
1028
- private readonly repo;
1029
- private readonly audit;
1030
- private readonly permission;
1031
- constructor(repo: TableRepository, audit: AuditLogger, permission: PermissionPolicy);
1032
- execute(command: DeleteRowCommand, actor: Actor$1): Promise<RowDeleted | RowRemoved | MinimumRowConstraintViolated | RowRestored | null>;
1033
- }
1034
- declare class RestoreAddedRowCommandHandler {
1035
- private readonly repo;
1036
- private readonly audit;
1037
- private readonly permission;
1038
- constructor(repo: TableRepository, audit: AuditLogger, permission: PermissionPolicy);
1039
- execute(command: RestoreAddedRowCommand, actor: Actor$1): Promise<RowAdded | null>;
1040
- }
1041
- declare class ReorderRowCommandHandler {
1042
- private readonly repo;
1043
- private readonly audit;
1044
- private readonly permission;
1045
- constructor(repo: TableRepository, audit: AuditLogger, permission: PermissionPolicy);
1046
- execute(command: RowReorderedCommand, actor: Actor$1): Promise<RowReordered | null>;
1047
- }
1048
-
1049
- declare class ChangeUnitLevelHandler {
1050
- private readonly repo;
1051
- private readonly audit;
1052
- constructor(repo: TableRepository, audit: AuditLogger);
1053
- execute(command: ChangeUnitLevelCommand, actor: Actor$1): Promise<TableEvent[]>;
1054
- }
1055
- declare class ChangePageCommandHandler {
1056
- private readonly repo;
1057
- private readonly audit;
1058
- constructor(repo: TableRepository, audit: AuditLogger);
1059
- execute(command: ChangePageCommand, actor: Actor$1): Promise<TableEvent[]>;
1060
- }
1061
- declare class ChangePageSizeCommandHandler {
1062
- private readonly repo;
1063
- private readonly audit;
1064
- constructor(repo: TableRepository, audit: AuditLogger);
1065
- execute(command: ChangePageSizeCommand, actor: Actor$1): Promise<TableEvent[]>;
1066
- }
1067
- declare class DeleteTableCommandHandler {
1068
- private readonly repo;
1069
- private readonly audit;
1070
- private readonly permissionPolicy;
1071
- constructor(repo: TableRepository, audit: AuditLogger, permissionPolicy: PermissionPolicy);
1072
- execute(command: DeleteTableCommand, actor: Actor$1): Promise<TableEvent[]>;
1073
- }
1074
- declare class ResetTableCommandHandler {
1075
- private readonly repo;
1076
- private readonly audit;
1077
- private readonly permissionPolicy;
1078
- constructor(repo: TableRepository, audit: AuditLogger, permissionPolicy: PermissionPolicy);
1079
- execute(command: ResetTableCommand, actor: Actor$1): Promise<TableEvent[]>;
1080
- }
1081
- declare class SetActiveCollectionCommandHandler {
1082
- private readonly repo;
1083
- private readonly audit;
1084
- constructor(repo: TableRepository, audit: AuditLogger);
1085
- private applyVisibility;
1086
- execute(command: SetActiveCollectionCommand, actor: Actor$1): Promise<TableEvent[]>;
1087
- }
1088
-
1089
- interface GridEvent<TType extends string = string, TPayload = unknown> {
1090
- readonly eventId: string;
1091
- readonly type: TType;
1092
- readonly tableId: string;
1093
- readonly streamId: string;
1094
- readonly version: number;
1095
- readonly occurredAt: number;
1096
- readonly actorId: string;
1097
- readonly payload: TPayload;
1098
- readonly correlationId?: string;
1099
- readonly causationId?: string;
1100
- }
1101
- interface ExportRequestedPayload {
1102
- readonly format: 'xlsx' | 'pdf';
1103
- readonly collectionScope: 'active' | 'all' | string[];
1104
- readonly fileName?: string;
1105
- readonly sheetName?: string;
1106
- readonly direction?: 'rtl' | 'ltr';
1107
- }
1108
- interface ImportRequestedPayload {
1109
- readonly format: 'xlsx';
1110
- readonly collectionScope: 'active' | 'all' | string[];
1111
- readonly sheetName?: string;
1112
- readonly byteLength?: number;
1113
- }
1114
-
1115
- type AppendResult = {
1116
- ok: true;
1117
- version: number;
1118
- } | {
1119
- ok: false;
1120
- conflict: {
1121
- expectedVersion: number;
1122
- actualVersion: number;
1123
- };
1124
- };
1125
- type Unsubscribe = () => void;
1126
- interface EventStore {
1127
- append(streamId: string, events: GridEvent[], expectedVersion: number): Promise<AppendResult>;
1128
- read(streamId: string, fromVersion?: number): Promise<GridEvent[]>;
1129
- /** Ordered global stream for catch-up of cross-stream projections. */
1130
- readAll(fromPosition?: number): Promise<GridEvent[]>;
1131
- subscribe(streamId: string, onEvent: (event: GridEvent) => void): Unsubscribe;
1132
- subscribeAll(onEvent: (event: GridEvent) => void): Unsubscribe;
1133
- }
1134
-
1135
- interface CellUndoEntry {
1136
- readonly kind: 'CELL_CHANGED';
1137
- readonly tableId: string;
1138
- readonly rowId: number;
1139
- readonly columnId: string;
1140
- readonly newValue: unknown;
1141
- readonly previousValue: unknown;
1142
- }
1143
- type RowCellSnapshot = {
1144
- readonly value: unknown;
1145
- readonly display?: unknown;
1146
- readonly originalValue?: unknown;
1147
- };
1148
- interface RowAddedUndoEntry {
1149
- readonly kind: 'ROW_ADDED';
1150
- readonly tableId: string;
1151
- readonly rowId: number;
1152
- /** Captured at record time so redo can restore identity + values. */
1153
- readonly cells: Readonly<Record<string, RowCellSnapshot>>;
1154
- readonly collection?: string;
1155
- readonly isSaveDescription?: boolean;
1156
- }
1157
- /**
1158
- * Compensating entry for a delete:
1159
- * - soft: Unchanged→Deleted (undo/redo = toggle ROW_DELETED)
1160
- * - hard: Added row removed from map (undo = RESTORE_ADDED_ROW)
1161
- */
1162
- interface RowDeletedUndoEntry {
1163
- readonly kind: 'ROW_DELETED';
1164
- readonly tableId: string;
1165
- readonly rowId: number;
1166
- readonly mode: 'soft' | 'hard';
1167
- readonly cells: Readonly<Record<string, RowCellSnapshot>>;
1168
- readonly collection?: string;
1169
- readonly isSaveDescription?: boolean;
1170
- }
1171
- type AtomicUndoEntry = CellUndoEntry | RowAddedUndoEntry | RowDeletedUndoEntry;
1172
- type UndoDispatchCommand = {
1173
- type: 'CHANGE_CELL_VALUE';
1174
- store: string;
1175
- tableKey: string;
1176
- rowId: number;
1177
- columnId: string;
1178
- newValue: unknown;
1179
- } | {
1180
- type: 'ROW_DELETED';
1181
- store: string;
1182
- tableKey: string;
1183
- rowId: number;
1184
- } | {
1185
- type: 'RESTORE_ADDED_ROW';
1186
- store: string;
1187
- tableKey: string;
1188
- rowId: number;
1189
- cells: Readonly<Record<string, RowCellSnapshot>>;
1190
- collection?: string;
1191
- isSaveDescription?: boolean;
1192
- };
1193
- type CellUndoDispatch = (command: UndoDispatchCommand) => Promise<void>;
1194
- /**
1195
- * Compensating undo/redo stack for domain edits.
1196
- * - CELL_CHANGED: restore previousValue / re-apply newValue
1197
- * - ROW_ADDED: delete on undo; RESTORE_ADDED_ROW on redo
1198
- * - ROW_DELETED soft: toggle ROW_DELETED; hard: RESTORE_ADDED_ROW / ROW_DELETED
1199
- * - Same correlationId merges into one undo unit (paste / cut+paste)
1200
- */
1201
- declare class CellUndoStack {
1202
- private undoEntries;
1203
- private redoEntries;
1204
- private applying;
1205
- record(event: CellChangedEvent, correlationId?: string): void;
1206
- recordRowAdded(event: {
1207
- tableId: string;
1208
- rowId: number;
1209
- cells?: Readonly<Record<string, RowCellSnapshot>>;
1210
- collection?: string;
1211
- isSaveDescription?: boolean;
1212
- }, correlationId?: string): void;
1213
- recordRowDeleted(event: {
1214
- tableId: string;
1215
- rowId: number;
1216
- mode: 'soft' | 'hard';
1217
- cells?: Readonly<Record<string, RowCellSnapshot>>;
1218
- collection?: string;
1219
- isSaveDescription?: boolean;
1220
- }, correlationId?: string): void;
1221
- recordMany(entries: AtomicUndoEntry[], correlationId?: string): void;
1222
- canUndo(): boolean;
1223
- canRedo(): boolean;
1224
- undoDepth(): number;
1225
- redoDepth(): number;
1226
- undo(store: string, dispatch: CellUndoDispatch): Promise<boolean>;
1227
- redo(store: string, dispatch: CellUndoDispatch): Promise<boolean>;
1228
- clear(): void;
1229
- private pushAtomic;
1230
- private applyCompensating;
1231
- private applyForward;
1232
- }
1233
-
1234
- declare class TableAppService {
1235
- private readonly changeCellValue;
1236
- private readonly changeCellDisplayValue;
1237
- private readonly saveDescription;
1238
- private readonly addEmptyRow;
1239
- private readonly addNewRows;
1240
- private readonly duplicateRow;
1241
- private readonly deleteRow;
1242
- private readonly reorderRow;
1243
- private readonly setUnitLevel;
1244
- private readonly setPageSize;
1245
- private readonly setPage;
1246
- private readonly setActiveCollection;
1247
- private readonly deleteTable;
1248
- private readonly resetTable;
1249
- private readonly applyDynamicProjection;
1250
- private readonly restoreAddedRow?;
1251
- private readonly pasteRow?;
1252
- private eventStore?;
1253
- private undoStack?;
1254
- private repo?;
1255
- constructor(changeCellValue: ChangeCellValueHandler, changeCellDisplayValue: ChangeCellDisplayValueHandler, saveDescription: SaveDescriptionHandler, addEmptyRow: AddNewRowCommandHandler, addNewRows: AddNewRowsCommandHandler, duplicateRow: DuplicateRowCommandHandler, deleteRow: DeleteRowCommandHandler, reorderRow: ReorderRowCommandHandler, setUnitLevel: ChangeUnitLevelHandler, setPageSize: ChangePageSizeCommandHandler, setPage: ChangePageCommandHandler, setActiveCollection: SetActiveCollectionCommandHandler, deleteTable: DeleteTableCommandHandler, resetTable: ResetTableCommandHandler, applyDynamicProjection: ApplyDynamicProjectionHandler, restoreAddedRow?: RestoreAddedRowCommandHandler | undefined, pasteRow?: PasteRowCommandHandler | undefined);
1256
- setEventStore(eventStore: EventStore): void;
1257
- setUndoStack(undoStack: CellUndoStack): void;
1258
- setRepository(repo: TableRepository): void;
1259
- execute(command: ApplicationTableCommand, actor: Actor): Promise<RowAdded | RowDeleted | RowRemoved | MinimumRowConstraintViolated | RowRestored | RowReordered | RowAdded[] | TableEvent[] | null>;
1260
- private dispatch;
1261
- private recordUndoableEvents;
1262
- private captureRowSnapshot;
1263
- private appendToEventStore;
1264
- private normalizeResult;
1265
- private resolveRowId;
1266
- private toGridPayload;
1267
- private createCorrelationId;
1268
- }
1269
-
1270
- declare class ConsoleAuditLogger implements AuditLogger {
1271
- log(event: unknown): void;
1272
- error(event: unknown): void;
1273
- warn(event: unknown): void;
1274
- info(event: unknown): void;
1275
- }
1276
-
1277
- declare class TableEngine {
1278
- private readonly app;
1279
- private readonly repo;
1280
- private readonly actor;
1281
- private tableStore?;
1282
- private tableKey?;
1283
- readonly errors: Map<string, CellError>;
1284
- readonly searchResult: Map<string, CellError>;
1285
- private readonly errHandler;
1286
- private readonly selection;
1287
- private readonly rowMgr;
1288
- private readonly nav;
1289
- private readonly viewBuilder;
1290
- constructor(app: TableAppService, repo: TableRepository, actor: Actor, audit: ConsoleAuditLogger);
1291
- private registerTable;
1292
- private deleteTable;
1293
- private disposeTable;
1294
- private resetTable;
1295
- private getStore;
1296
- /**
1297
- * Default case در dispatch:
1298
- * command را به AppService می‌دهد و سپس repo را reload می‌کند.
1299
- */
1300
- private executeAppCommand;
1301
- /**
1302
- * Paste goes through AppService (PASTE_ROW + optional ROW_DELETED for cut)
1303
- * with one correlationId so undo reverses the whole unit.
1304
- */
1305
- private executePasteAction;
1306
- dispatch(command: TableCommand): Promise<void>;
1307
- private setGridSearch;
1308
- private setMobileEditor;
1309
- getViewState(): TableViewState | undefined;
1310
- getAllRows(): Row[] | null;
1311
- getAllUIRows(): UIRow[] | null;
1312
- getMobileViewState(): MobileTableViewState | undefined;
1313
- getRowView(rowId: number): UIRow | null;
1314
- getSnapShot(collectionScope: CollectionScope): TableSnapShot | null;
1315
- getExpandedRowData(rowId: number): Record<string, unknown> | null;
1316
- getActiveCell(): TableState['activeCell'] | null;
1317
- getActiveRow(): number | null;
1318
- getSelectedRows(): Record<number, boolean> | undefined;
1319
- getCell(rowId: number, columnId: string): Cell | undefined;
1320
- getMobileEditor(): TableState['mobileEditor'] | undefined;
1321
- isActiveCell(rowId: number, columnId: string): boolean;
1322
- isSelectedRow(rowId: number): boolean;
1323
- isCutRow(rowId: number): boolean;
1324
- isActiveRow(rowId: number): boolean;
1325
- private validateCell;
1326
- validation(cb: ValidationCallback): void;
1327
- isValidCell(rowId: number, caption: string): ValidCell;
1328
- subscribe(cb: () => void): (() => void) | null;
1329
- /**
1330
- * Selector-based subscription over engine-derived view data.
1331
- * `selector` closes over engine getters (snapshot, activeCell, …).
1332
- */
1333
- subscribeSelected<TSelected>(selector: () => TSelected, listener: (selected: TSelected) => void, isEqual?: (a: TSelected, b: TSelected) => boolean): (() => void) | null;
1334
- subscribeColumn<T = unknown>(columnId: string, collections: CollectionScope, cb: (items: Array<{
1335
- id: number;
1336
- rowNum: unknown;
1337
- value: T;
1338
- }>) => void): (() => void) | null;
1339
- }
1340
-
1341
- interface ChangelogEntry {
1342
- readonly eventId: string;
1343
- readonly type: string;
1344
- readonly tableId: string;
1345
- readonly occurredAt: number;
1346
- readonly actorId: string;
1347
- readonly payload: unknown;
1348
- }
1349
- interface ChangelogQuery {
1350
- tableId?: string;
1351
- rowId?: number | string;
1352
- columnId?: string;
1353
- type?: string;
1354
- since?: number;
1355
- limit?: number;
1356
- }
1357
- declare class ChangelogProjection {
1358
- private readonly eventStore;
1359
- private entries;
1360
- private unsubscribe;
1361
- private subscribers;
1362
- private seenEventIds;
1363
- private started;
1364
- constructor(eventStore: EventStore);
1365
- /**
1366
- * Catch up via readAll, then subscribe for live events.
1367
- * Dedupes by eventId so subscribe-before-replay races are safe.
1368
- */
1369
- start(): Promise<void>;
1370
- stop(): void;
1371
- query(filter?: ChangelogQuery): ChangelogEntry[];
1372
- count(filter?: ChangelogQuery): number;
1373
- subscribe(notify: (entries: ChangelogEntry[]) => void, filter?: ChangelogQuery): Unsubscribe;
1374
- clear(): void;
1375
- private project;
1376
- private notifySubscribers;
1377
- }
1378
-
1379
- type HistorySeverity = 'info' | 'warning' | 'error';
1380
- type HistoryCategory = 'data' | 'structure' | 'view' | 'system';
1381
- interface HistoryQuery extends ChangelogQuery {
1382
- severity?: HistorySeverity;
1383
- category?: HistoryCategory;
1384
- }
1385
- interface HistoryItem {
1386
- readonly id: string;
1387
- readonly type: string;
1388
- readonly title: string;
1389
- readonly description: string;
1390
- readonly occurredAt: number;
1391
- readonly tableId: string;
1392
- readonly actorId: string;
1393
- readonly severity: HistorySeverity;
1394
- readonly category: HistoryCategory;
1395
- readonly raw: ChangelogEntry;
1396
- }
1397
- declare class HistoryPanelViewModel {
1398
- private readonly changelogProjection;
1399
- constructor(changelogProjection: ChangelogProjection);
1400
- query(filter?: HistoryQuery): HistoryItem[];
1401
- count(filter?: HistoryQuery): number;
1402
- subscribe(cb: (items: HistoryItem[]) => void, filter?: HistoryQuery): Unsubscribe;
1403
- private toHistoryItem;
1404
- }
1405
-
1406
- /**
1407
- * Session-centric view / keyboard intents.
1408
- * These are not domain commands; GridSession maps them to engine dispatches.
1409
- */
1410
- type ViewIntent = {
1411
- type: 'ADD_EMPTY_ROW';
1412
- autoActivate?: boolean;
1413
- } | {
1414
- type: 'DUPLICATE_ROW';
1415
- rowId: number;
1416
- } | {
1417
- type: 'DELETE_ROW';
1418
- rowId: number;
1419
- } | {
1420
- type: 'TOGGLE_ROW_SELECTION';
1421
- rowId: number;
1422
- } | {
1423
- type: 'SELECT_FROM_ACTIVE_TO_LAST';
1424
- anchorRowId: number;
1425
- } | {
1426
- type: 'ACTIVATE_FIRST_CELL';
1427
- rowId: number;
1428
- } | {
1429
- type: 'MOVE_ACTIVE_CELL';
1430
- rowId: number;
1431
- columnId: string;
1432
- direction: 'next' | 'prev';
1433
- } | {
1434
- type: 'MOVE_ACTIVE_CELL_VERTICAL';
1435
- rowId: number;
1436
- columnId: string;
1437
- direction: 'up' | 'down';
1438
- } | {
1439
- type: 'MOVE_VERTICAL_SELECTED_ROWS';
1440
- direction: 'up' | 'down';
1441
- } | {
1442
- type: 'MOVE_VERTICAL_ACTIVE_ROW';
1443
- direction: 'up' | 'down';
1444
- } | {
1445
- type: 'COLLAPSE_ALL_ROWS';
1446
- } | {
1447
- type: 'CHANGE_PAGE';
1448
- page: number;
1449
- } | {
1450
- type: 'CHANGE_PAGE_SIZE';
1451
- pageSize: number;
1452
- } | {
1453
- type: 'SET_TABLE_ACTION';
1454
- action: TableActions;
1455
- } | {
1456
- type: 'SET_GRID_SEARCH';
1457
- search: GridSearchState;
1458
- } | {
1459
- type: 'SET_MOBILE_EDITOR';
1460
- editor: MobileEditorState;
1461
- } | {
1462
- type: 'CHANGE_VIEWPORT';
1463
- scrollOffset: number;
1464
- viewportSize?: number;
1465
- rowHeight?: number;
1466
- overscan?: number;
1467
- } | {
1468
- type: 'UNDO';
1469
- } | {
1470
- type: 'REDO';
1471
- };
1472
- type ViewIntentDispatcher = (intent: ViewIntent) => Promise<void>;
1473
-
1474
- type GridSessionSubscribeSelected = <TSelected>(selector: () => TSelected, listener: (selected: TSelected) => void, isEqual?: (a: TSelected, b: TSelected) => boolean) => () => void;
1475
- /**
1476
- * Framework-agnostic session facade (target shape of useGrid / createGrid).
1477
- * Adapters should prefer this over raw Engine.
1478
- */
1479
- interface GridSession {
1480
- readonly store: string;
1481
- readonly tableKey: string;
1482
- dispatchViewIntent: ViewIntentDispatcher;
1483
- handleKeydown(event: KeyboardEvent, ctx: {
1484
- activeRowId: number | null;
1485
- activeColumnId: string | null;
1486
- }): Promise<void>;
1487
- getSnapShot(collectionScope?: CollectionScope): TableSnapShot | null;
1488
- getViewState(): ReturnType<TableEngine['getViewState']>;
1489
- subscribe(cb: () => void): () => void;
1490
- subscribeSelected: GridSessionSubscribeSelected;
1491
- canUndo(): boolean;
1492
- canRedo(): boolean;
1493
- undo(): Promise<boolean>;
1494
- redo(): Promise<boolean>;
1495
- getChangelog(filter?: Omit<ChangelogQuery, 'tableId'>): ChangelogEntry[];
1496
- getChangelogCount(filter?: Omit<ChangelogQuery, 'tableId'>): number;
1497
- subscribeChangelog(cb: (entries: ChangelogEntry[]) => void, filter?: Omit<ChangelogQuery, 'tableId'>): () => void;
1498
- getHistoryItems(filter?: Omit<HistoryQuery, 'tableId'>): HistoryItem[];
1499
- getHistoryItemCount(filter?: Omit<HistoryQuery, 'tableId'>): number;
1500
- subscribeHistoryItems(cb: (items: HistoryItem[]) => void, filter?: Omit<HistoryQuery, 'tableId'>): () => void;
1501
- getEngine(): TableEngine;
1502
- /** Current virtual-scroll viewport (view state; not domain). */
1503
- getViewport(): Viewport;
1504
- getVisibleRange(totalRows?: number): VisibleRange;
1505
- projectVisibleRows<T>(rows: readonly T[], totalRows?: number): T[];
1506
- }
1507
-
1508
- interface UICommandBase {
1509
- readonly type: string;
1510
- }
1511
- interface UICellChangeEvent extends UICommandBase {
1512
- readonly type: 'UI_CELL_CHANGE';
1513
- readonly rowId: number;
1514
- readonly columnId: string;
1515
- readonly value: unknown;
1516
- }
1517
- interface UIDescriptionSaveEvent extends UICommandBase {
1518
- readonly type: 'UI_DESCRIPTION_SAVE';
1519
- readonly rowId: number;
1520
- readonly flag: boolean;
1521
- }
1522
- interface UICellChangeDisplayEvent extends UICommandBase {
1523
- readonly type: 'UI_CELL_CHANGE_DISPLAY';
1524
- readonly rowId: number;
1525
- readonly columnId: string;
1526
- readonly value: string;
1527
- }
1528
- interface UIMoveActiveCellEvent extends UICommandBase {
1529
- readonly type: 'UI_MOVE_ACTIVE_CELL';
1530
- readonly rowId: number;
1531
- readonly columnId: string;
1532
- readonly direction: "next" | "prev";
1533
- }
1534
- interface UIMoveActiveVerticalCellEvent extends UICommandBase {
1535
- readonly type: 'UI_MOVE_ACTIVE_CELL_VERTICAL';
1536
- readonly rowId: number;
1537
- readonly columnId: string;
1538
- readonly direction: 'up' | 'down';
1539
- }
1540
- interface UIActiveFirstCellEvent extends UICommandBase {
1541
- readonly type: 'UI_ACTIVE_FIRST_CELL';
1542
- readonly rowId: number;
1543
- }
1544
- interface UIActiveCellEvent extends UICommandBase {
1545
- readonly type: 'UI_ACTIVE_CELL';
1546
- readonly rowId: number;
1547
- readonly columnId: string;
1548
- }
1549
- interface ChangePageSizeUiCommand extends UICommandBase {
1550
- readonly type: 'CHANGE_PAGE_SIZE';
1551
- readonly pageSize: number;
1552
- }
1553
- interface ChangePageUiCommand extends UICommandBase {
1554
- readonly type: 'CHANGE_PAGE';
1555
- readonly page: number;
1556
- }
1557
- interface ActiveRowUiCommand extends UICommandBase {
1558
- readonly type: 'UI_ACTIVE_ROW';
1559
- readonly rowId: number;
1560
- }
1561
- interface AddEmptyRowUiCommand extends UICommandBase {
1562
- readonly type: 'ADD_EMPTY_ROW';
1563
- }
1564
- interface AddNewRowsUiCommand extends UICommandBase {
1565
- readonly type: 'ADD_NEW_ROWS';
1566
- readonly detailFieldKey: string;
1567
- readonly rows: {
1568
- key: string;
1569
- value: unknown;
1570
- display: unknown;
1571
- }[][];
1572
- }
1573
- interface DuplicateRowUiCommand extends UICommandBase {
1574
- readonly type: 'DUPLICATE_ROW';
1575
- readonly rowId: number;
1576
- }
1577
- interface DeleteRowUiCommand extends UICommandBase {
1578
- readonly type: 'ROW_DELETED';
1579
- readonly rowId: number;
1580
- }
1581
- interface DeleteSelectedRowsUiCommand extends UICommandBase {
1582
- readonly type: 'UI_DELETE_SELECTED_ROW';
1583
- }
1584
- interface DeleteTableUiCommand extends UICommandBase {
1585
- readonly type: 'TABLE_DELETED';
1586
- }
1587
- interface RegisterTableUiCommand extends UICommandBase {
1588
- readonly type: 'TABLE_REGISTERED';
1589
- readonly storeName: string;
1590
- readonly table: Table;
1591
- }
1592
- interface ToggleRowExpandedUiCommand extends UICommandBase {
1593
- readonly type: 'TOGGLE_ROW_EXPANDED';
1594
- readonly rowId: number;
1595
- }
1596
- interface ReorderRowUiCommand extends UICommandBase {
1597
- readonly type: 'ROW_REORDERED';
1598
- readonly draggedRowId: number;
1599
- readonly droppedRowId: number;
1600
- readonly position: 'before' | 'after';
1601
- }
1602
- interface ToggleRowSelectedUiCommand extends UICommandBase {
1603
- readonly type: 'TOGGLE_ROW_SELECTED';
1604
- }
1605
- interface TogglePageRowSelectedUiCommand extends UICommandBase {
1606
- readonly type: 'TOGGLE_PAGE_ROW_SELECTED';
1607
- }
1608
- interface RowSelectedUiCommand extends UICommandBase {
1609
- readonly type: 'ROW_SELECTED';
1610
- readonly rowId: number;
1611
- }
1612
- interface ActionTableUiCommand extends UICommandBase {
1613
- readonly type: 'UI_ACTION_TABLE';
1614
- readonly action: TableActions;
1615
- }
1616
- interface ActiveCollectionUiCommand extends UICommandBase {
1617
- readonly type: 'UI_CHANGE_ACTIVE_COLLECTION';
1618
- readonly activeCollection: string;
1619
- }
1620
- interface KeyDownUiCommand extends UICommandBase {
1621
- readonly type: 'KEY_DOWN';
1622
- readonly event: KeyboardEvent;
1623
- readonly ctx: {
1624
- tableKey: string;
1625
- activeRowId: number | null;
1626
- activeColumnId: string | null;
1627
- };
1628
- }
1629
- interface SetGridSearchUiCommand extends UICommandBase {
1630
- readonly type: 'UI_SET_GRID_SEARCH';
1631
- readonly search: GridSearchState;
1632
- }
1633
- interface ClearGridSearchUiCommand extends UICommandBase {
1634
- readonly type: 'UI_CLEAR_GRID_SEARCH';
1635
- }
1636
- interface OpenMobileAddUiCommand extends UICommandBase {
1637
- readonly type: 'UI_OPEN_MOBILE_ADD';
1638
- }
1639
- interface OpenMobileEditUiCommand extends UICommandBase {
1640
- readonly type: 'UI_OPEN_MOBILE_EDIT';
1641
- readonly rowId: number;
1642
- }
1643
- interface CloseMobileEditorUiCommand extends UICommandBase {
1644
- readonly type: 'UI_CLOSE_MOBILE_EDITOR';
1645
- }
1646
- type UITableCommand = ActiveRowUiCommand | ToggleRowSelectedUiCommand | TogglePageRowSelectedUiCommand | RowSelectedUiCommand | UIMoveActiveVerticalCellEvent | UIMoveActiveCellEvent | UIActiveCellEvent | UIActiveFirstCellEvent | UICellChangeEvent | UIDescriptionSaveEvent | UICellChangeDisplayEvent | ChangePageSizeUiCommand | ChangePageUiCommand | AddEmptyRowUiCommand | AddNewRowsUiCommand | DuplicateRowUiCommand | DeleteRowUiCommand | DeleteTableUiCommand | RegisterTableUiCommand | ToggleRowExpandedUiCommand | ReorderRowUiCommand | ActionTableUiCommand | ActiveCollectionUiCommand | DeleteSelectedRowsUiCommand | KeyDownUiCommand | SetGridSearchUiCommand | ClearGridSearchUiCommand | OpenMobileAddUiCommand | OpenMobileEditUiCommand | CloseMobileEditorUiCommand;
1647
-
1648
- declare class UITableController {
1649
- private readonly engine;
1650
- private readonly store;
1651
- private readonly tableKey;
1652
- private readonly audit;
1653
- private readonly changelogProjection?;
1654
- private readonly historyPanelViewModel?;
1655
- private readonly cellUndoStack?;
1656
- private readonly session?;
1657
- private readonly remoteApi?;
1658
- private disposed;
1659
- constructor(engine: TableEngine, store: string, tableKey: string, audit: AuditLogger, changelogProjection?: ChangelogProjection | undefined, historyPanelViewModel?: HistoryPanelViewModel | undefined, cellUndoStack?: CellUndoStack | undefined, session?: GridSession | undefined, remoteApi?: RemoteApi | undefined);
1660
- getRemoteApi(): RemoteApi | undefined;
1661
- private safe;
1662
- private changePageSize;
1663
- private changePage;
1664
- private onCellChange;
1665
- private onDescriptionSave;
1666
- private onCellDisplayChange;
1667
- private setActiveCell;
1668
- private setActiveRow;
1669
- private moveActiveCellVertical;
1670
- private reorderRow;
1671
- private addEmptyRow;
1672
- private openMobileAddEditor;
1673
- private addNewRows;
1674
- private duplicateRow;
1675
- private deleteRow;
1676
- private deleteRows;
1677
- private deleteTable;
1678
- private registerTable;
1679
- private toggleRowExpanded;
1680
- private toggleRowSelect;
1681
- private togglePageRowSelect;
1682
- private selectFromActiveToLast;
1683
- private activateFirstEditableCell;
1684
- private moveToNextCell;
1685
- private setTableAction;
1686
- private setActiveCollection;
1687
- private setGridSearch;
1688
- private setMobileEditor;
1689
- getViewState(): TableViewState | null | undefined;
1690
- getMobileViewState(): MobileTableViewState | null | undefined;
1691
- getRowView(rowId: number): UIRow | null;
1692
- getAllRows(): Row[] | null;
1693
- getAllUIRows(): UIRow[] | null;
1694
- getSnapShot(collectionScope?: CollectionScope): TableSnapShot | null;
1695
- getCell(rowId: number, columnId: string): Cell | null | undefined;
1696
- getChangelog(filter?: Omit<ChangelogQuery, 'tableId'>): ChangelogEntry[];
1697
- getChangelogCount(filter?: Omit<ChangelogQuery, 'tableId'>): number;
1698
- subscribeChangelog(cb: (entries: ChangelogEntry[]) => void, filter?: Omit<ChangelogQuery, 'tableId'>): () => void;
1699
- getHistoryItems(filter?: Omit<HistoryQuery, 'tableId'>): HistoryItem[];
1700
- getHistoryItemCount(filter?: Omit<HistoryQuery, 'tableId'>): number;
1701
- subscribeHistoryItems(cb: (items: HistoryItem[]) => void, filter?: Omit<HistoryQuery, 'tableId'>): () => void;
1702
- canUndo(): boolean;
1703
- canRedo(): boolean;
1704
- undo(): Promise<boolean>;
1705
- redo(): Promise<boolean>;
1706
- getActiveRow(): number | null;
1707
- getSelectedRows(): Record<number, boolean> | null | undefined;
1708
- getActiveCell(): ActiveCell | undefined;
1709
- getMobileEditor(): MobileEditorState | undefined;
1710
- resetMobileVisibleRows(size?: number): void;
1711
- loadMoreMobileRows(step?: number): void;
1712
- revealAllMobileRows(minSize?: number): void;
1713
- isActiveCell(rowId: number, columnId: string): boolean | null;
1714
- isActiveRow(rowId: number): boolean | null;
1715
- isSelectedRow(rowId: number): boolean | null;
1716
- isCutRow(rowId: number): boolean | null;
1717
- subscribe(cb: () => void): (() => void) | null;
1718
- subscribeSelected<TSelected>(selector: () => TSelected, listener: (selected: TSelected) => void, isEqual?: (a: TSelected, b: TSelected) => boolean): () => void;
1719
- getSession(): GridSession | undefined;
1720
- getTableKey(): string;
1721
- subscribeColumn<T>(columnId: string, collections: CollectionScope, cb: (values: T[]) => void): (() => void) | null;
1722
- validation: () => (callback: (result: ValidationCallbackResult) => void) => void;
1723
- isValidCell(rowId: number, columnId: string): ValidCell | null;
1724
- onRowClick(rowId: number, modifiers: {
1725
- ctrlKey: boolean;
1726
- shiftKey: boolean;
1727
- }): void;
1728
- onRowSelect(rowId: number): void;
1729
- dispose(): void;
1730
- dispatch(command: UITableCommand): Promise<void>;
1731
- private dispatchInternal;
1732
- }
1733
-
1734
- type ExportColumnDef = {
1735
- readonly fieldName: string;
1736
- readonly fieldCaption?: string;
1737
- readonly fieldType?: string;
1738
- readonly order?: number;
1739
- };
1740
- type ExportCellSource = {
1741
- readonly value: unknown;
1742
- readonly display?: unknown;
4
+ import React__default, { ReactNode, Ref } from 'react';
5
+ import { s as GridApi, aw as CatalogHostEventHandlers, V as SelectionChangedEvent, b as CellFocusedEvent, j as CreateERPTableConfig, c as CellValueChangedEvent, U as RowValueChangedEvent, T as RowDataUpdatedEvent, P as PluginHost } from './createEngineGridQuery-D-fgO_jg.cjs';
6
+ export { A as AggAccumulator, a as AggregateSnapshot, C as CATALOG_TO_HOST_CALLBACKS, d as CollectionRowMap, e as ColumnAggIndex, f as ColumnAggSpec, g as ColumnDefinition, H as ColumnSchema, h as ColumnViewBinding, i as ColumnVisibleRange, k as CreateERPTableResult, l as CreateGridApiInput, m as CreateGridConfig, n as CreateGridResult, D as DEFAULT_EVENT_STORE_PREFIX, o as DEFAULT_GRID_ACTOR, p as DEFAULT_MEMORY_STORE, E as EVENT_CATALOG, q as EventCatalogEntry, r as ExportDataAsExcelOptions, G as GetRowId, t as GridColumnState, u as GridDatasource, v as GridDatasourceGetRowsParams, w as GridDatasourceGetRowsResult, x as GridRowNode, I as InMemoryEventStore, y as InMemorySnapshotStore, z as IndexedDbEventStore, K as KvDatabase, B as KvStore, L as LEGACY_EVENT_STORE_PREFIX, M as MemoryKvDatabase, N as NoopRemoteApi, Q as QuickFilterBlobAccessor, F as QuickFilterIndex, J as ROW_DATA_UPDATED_CATALOG_TYPES, O as RequestExportOptions, S as RequestImportOptions, R as RowInput, W as SnapshotStore, X as SnapshotStrategy, Y as StartEditingCellParams, Z as ViewportCalculator, _ as accumulateAdd, $ as accumulateRemove, a0 as applyAgg, a1 as applyQuickFilter, a2 as buildCumulativeWidths, a3 as buildQuickFilterBlob, a4 as calculateColumnViewport, a5 as columnDefFieldName, a6 as createAccumulator, a7 as createERPTable, a8 as createEngineGridQuery, a9 as createGrid, aa as createGridApi, ab as createGridTableKey, ac as dispatchCatalogHostEvent, ad as eventStoreDbName, ae as getEventCatalogEntry, af as isAggFuncName, ag as isCustomAggFunc, ah as listUndoableEventTypes, ax as mapColDefOrGroups, ai as mapColumnDefs, aj as mapColumnSchemas, ak as mapColumnSchemasToDefs, al as normalizeQuickFilterText, am as openIndexedDbDatabase, an as readAccumulator, ao as resolveColumnAggSpecs, ap as resolveCreateGridDefaults, aq as subscribeCatalogHostEvents, ar as toColumnDef, as as toColumnDefinition, at as toColumnSchema, au as toColumnViewBinding, av as toMinorUnits } from './createEngineGridQuery-D-fgO_jg.cjs';
7
+ import { U as UITableController, r as ProcessCellForClipboardParams, m as ClipboardCopyEvent, n as ClipboardPasteEvent, z as ConnectivitySource, A as SyncWatermarkStore } from './UITableController-CIwnHIw8.cjs';
8
+ export { B as Connectivity, M as ManualResolution, O as OfflineStatus, D as PendingChange, S as SyncConflict, e as SyncConflictPolicy, f as SyncConflictSide, g as SyncPort, h as SyncResult, i as SyncTransport, E as alwaysOnlineConnectivity } from './UITableController-CIwnHIw8.cjs';
9
+ import { R as RemoteApi } from './RemoteApi-CCQxiSf1.cjs';
10
+ import { C as CellRenderContext, a as CustomCellResolveResult } from './cellRenderContext-DvngkptV.cjs';
11
+ export { r as resolveCustomCellNode } from './cellRenderContext-DvngkptV.cjs';
12
+ import { a as ERPTableMessages, E as ERPTableLocale, N as NumberingSystem } from './types-D__47BKv.cjs';
13
+ export { r as resolveDirection, c as resolveLocaleMeta } from './types-D__47BKv.cjs';
14
+ export { E as ExportSource, G as GridPlugin, a as GridPluginContext, c as GridQueryPort } from './GridPlugin-DewWufGZ.cjs';
15
+ export { P as PdfRenderer } from './PdfRenderer-B9FJaCo_.cjs';
16
+ export { E as ExcelExportPlugin, b as ExcelImportPlugin, g as applyImportedRows, h as buildExportTable, i as buildXlsxBlob, k as exportActiveCollectionToExcel, m as mapImportedSheet, p as parseXlsxBlob } from './applyImportedRows-C2fWYoPy.cjs';
17
+ export { a as PdfExportPlugin, V as VazirmatnPdfRenderer } from './VazirmatnPdfRenderer-CpCqA-Wh.cjs';
18
+ export { TextPdfRenderer } from './plugins/pdf.cjs';
19
+ export { f as formatLocaleDate, a as formatLocaleNumber } from './index-DN8M8Jkq.cjs';
20
+
21
+ /** Multi-row footer aggregation chrome (PR-119 / RFC-002). */
22
+ type FooterRowDef = {
23
+ id: string;
24
+ label?: string;
25
+ /** Override column aggFunc for this row. */
26
+ aggFunc?: AggFuncName;
27
+ };
28
+
29
+ /**
30
+ * Pluggable calendar port (PR-128 / D21).
31
+ * Domain values stay as JS `Date` (or null); adapters own parse/format.
32
+ */
33
+ type DateAdapter = {
34
+ /** Parse host/cell input into a Date, or null if empty/invalid. */
35
+ parse(input: unknown): Date | null;
36
+ /** Format a Date for display / edit. */
37
+ format(date: Date): string;
38
+ addDays(date: Date, days: number): Date;
39
+ startOfMonth(date: Date): Date;
40
+ /** Negative if a < b, 0 if equal (by UTC day), positive if a > b. */
41
+ compare(a: Date, b: Date): number;
42
+ /** Calendar id for docs / Intl hints. */
43
+ readonly id: 'jalali' | 'gregory';
44
+ };
45
+
46
+ /** One dependency: a named sibling field and (optionally) its current value. */
47
+ type DependOnItem = string | {
48
+ fieldName: string;
49
+ value?: unknown;
1743
50
  };
1744
- type ExportRowSource = {
1745
- readonly id: number;
1746
- readonly rowState: string;
1747
- readonly cells: Readonly<Record<string, ExportCellSource>>;
51
+ type DependOn = DependOnItem | DependOnItem[];
52
+ type UseDependOnOptions = {
53
+ /**
54
+ * Ask the host to resolve dependency values (e.g. from the form that owns
55
+ * the grid). When false/omitted, the `value` carried by each item is used.
56
+ */
57
+ enabled?: boolean;
58
+ /** Send `value.value` when a resolved value is an option-like object. */
59
+ unwrapObjectValue?: boolean;
1748
60
  };
1749
- type ExportSource = {
1750
- readonly columns: readonly ExportColumnDef[];
1751
- readonly rows: readonly ExportRowSource[];
61
+ type UseDependOnResult = {
62
+ /** `{ [fieldName]: value }` to merge into a remote request body. */
63
+ dependencyBody: Record<string, unknown>;
64
+ /** Every dependency has a value (true when there is no dependOn). */
65
+ isReady: boolean;
66
+ /** Stable string that changes when the dependencies change. */
67
+ dependencyKey: string;
1752
68
  };
1753
69
  /**
1754
- * Read-only query surface for plugins (never mutates aggregates).
70
+ * Host-injectable dependency resolver. The arianERP host implements this on
71
+ * top of Redux page data; the default implementation reads the static values
72
+ * carried by the `dependOn` items.
1755
73
  */
1756
- interface GridQueryPort {
1757
- getSnapShot(collectionScope?: CollectionScope): TableSnapShot | null;
1758
- getExportSource(collectionScope?: CollectionScope): ExportSource | null;
1759
- }
1760
- type PluginEventBus = {
1761
- subscribeAll(onEvent: (event: GridEvent) => void): Unsubscribe;
1762
- publish(event: GridEvent): Promise<void>;
1763
- };
1764
- interface GridPluginContext {
1765
- readonly tableId: string;
1766
- readonly bus: PluginEventBus;
1767
- readonly session: GridSession;
1768
- readonly query: GridQueryPort;
1769
- readonly eventStore: EventStore;
1770
- /**
1771
- * Out-of-band binary for IMPORT_REQUESTED (not stored on the event bus /
1772
- * IndexedDB payload — only correlationId is published).
1773
- */
1774
- resolveImportData?: (correlationId: string) => Uint8Array | undefined;
1775
- }
1776
- interface GridPlugin {
1777
- readonly name: string;
1778
- register(ctx: GridPluginContext): void;
1779
- dispose?(): void;
1780
- }
74
+ type UseDependOnHook = (dependOn?: DependOn | null, options?: UseDependOnOptions) => UseDependOnResult;
75
+ /** Default `UseDependOnHook`: static values carried by the items. */
76
+ declare const useStaticDependOn: UseDependOnHook;
1781
77
 
1782
- type RequestExportOptions = {
1783
- format: 'xlsx' | 'pdf';
1784
- collectionScope?: ExportRequestedPayload['collectionScope'];
1785
- correlationId?: string;
1786
- fileName?: string;
1787
- sheetName?: string;
1788
- direction?: 'rtl' | 'ltr';
1789
- };
1790
- type RequestImportOptions = {
1791
- format: 'xlsx';
1792
- data: Blob | ArrayBuffer | Uint8Array;
1793
- collectionScope?: ImportRequestedPayload['collectionScope'];
1794
- correlationId?: string;
1795
- sheetName?: string;
1796
- };
1797
- type PluginHostDeps = {
1798
- tableId: string;
1799
- actorId: string;
1800
- eventStore: EventStore;
1801
- session: GridSession;
1802
- query: GridQueryPort;
1803
- };
1804
78
  /**
1805
- * Registers plugins and publishes plugin/view-stream events (e.g. EXPORT_REQUESTED).
79
+ * Column header menu item model (PR-114). Pure — no React/DOM.
1806
80
  */
1807
- declare class PluginHost {
1808
- private readonly deps;
1809
- private readonly plugins;
1810
- private readonly disposers;
1811
- private readonly importPayloads;
1812
- private version;
1813
- constructor(deps: PluginHostDeps);
1814
- private takeImportPayload;
1815
- private createBus;
1816
- register(plugins: readonly GridPlugin[]): void;
1817
- list(): readonly GridPlugin[];
1818
- requestExport(options: RequestExportOptions): Promise<void>;
1819
- requestImport(options: RequestImportOptions): Promise<void>;
1820
- dispose(): void;
1821
- }
1822
81
 
82
+ type ColumnMenuBuiltInId = 'sortAsc' | 'sortDesc' | 'sortNone' | 'filter' | 'hideColumn' | 'pinStart' | 'pinEnd' | 'pinNone' | 'autoSize' | 'columnsPanel' | 'separator';
83
+ type ColumnMenuCustomItem = {
84
+ name: string;
85
+ label: string;
86
+ disabled?: boolean;
87
+ };
88
+ type ColumnMenuItemDef = ColumnMenuBuiltInId | ColumnMenuCustomItem;
89
+ type ColumnMenuItemsConfig = ColumnMenuItemDef[] | ((defaults: ColumnMenuItemDef[]) => ColumnMenuItemDef[]);
90
+
91
+ type CellComponent = (ctx: CellRenderContext) => ReactNode;
1823
92
  /**
1824
- * Core column definition without React/DOM bindings.
1825
- * Host adapters attach renderers via ColumnViewBinding.
93
+ * Built-in FieldType keys plus free strings for host cell types (PR-56 `textArea`, …).
1826
94
  */
1827
- interface ColumnDefinition {
1828
- readonly fieldName: string;
1829
- readonly fieldCaption: string;
1830
- readonly fieldType: FieldType;
1831
- readonly fieldCollection?: string;
1832
- readonly order?: number;
1833
- readonly editable?: boolean;
1834
- readonly isUnique?: boolean;
1835
- readonly hidden?: boolean;
1836
- readonly disable?: boolean;
1837
- readonly noCache?: boolean;
1838
- readonly expandable?: boolean;
1839
- readonly rules?: IRule[];
1840
- readonly options?: ReadonlyArray<{
1841
- label?: string;
1842
- value?: string | number;
1843
- title?: string;
1844
- }>;
1845
- readonly visibility: ColumnVisibilityRule;
1846
- readonly dynamicSource?: {
1847
- endpoint: string;
1848
- dependsOn?: string[];
1849
- dependOn?: IDependOn | IDependOn[];
1850
- params?: Record<string, string>;
1851
- };
1852
- readonly computed?: {
1853
- dependsOn: readonly string[];
1854
- };
1855
- readonly selectOptions?: ReadonlyArray<{
1856
- label: string;
1857
- value: string | number;
1858
- }>;
1859
- readonly minWidth?: number;
1860
- readonly labelValue?: 'selectDisplay' | 'selectValue';
1861
- }
95
+ type CellComponentMap = Partial<Record<FieldType, CellComponent>> & {
96
+ [customType: string]: CellComponent | undefined;
97
+ };
98
+ declare function resolveRegisteredCellNode(fieldType: string | undefined, components: CellComponentMap | undefined, ctx: CellRenderContext): CustomCellResolveResult;
99
+ /** Built-in registry. Host `components` override these keys. */
100
+ declare const DEFAULT_CELL_COMPONENTS: CellComponentMap;
101
+ declare function mergeCellComponents(host?: CellComponentMap): CellComponentMap;
1862
102
  /**
1863
- * Presentation binding kept outside Domain (Adapter / Host).
1864
- * `render` is intentionally untyped here to avoid React import in core.
103
+ * Column `render` (PR-54) wins; then `components[fieldType]` (PR-55/56);
104
+ * miss → built-in FieldType switch.
1865
105
  */
1866
- interface ColumnViewBinding {
1867
- readonly fieldName: string;
1868
- readonly className?: string;
1869
- readonly minWidth?: number;
1870
- readonly style?: unknown;
1871
- readonly render?: (...args: unknown[]) => unknown;
1872
- readonly displayFormat?: (value: unknown) => unknown;
1873
- readonly onChange?: (...args: unknown[]) => void;
1874
- readonly indexOptions?: (...args: unknown[]) => unknown[];
1875
- readonly popUpWidth?: number;
1876
- readonly dynamicSelectFilterOption?: (inputValue: string, option: unknown) => boolean;
1877
- }
106
+ declare function resolveBoundCellNode(meta: Pick<ColumnSchema, 'render' | 'fieldType'> | undefined, components: CellComponentMap | undefined, ctx: CellRenderContext): CustomCellResolveResult;
1878
107
 
1879
- type CollectionRowMap = Record<string, object>;
1880
- type RowInput = {
1881
- id: number;
1882
- values?: Record<string, unknown>;
1883
- collection?: string;
1884
- rowType?: string;
1885
- };
1886
- type RowAccessControl = {
1887
- allowRoles?: string[];
1888
- denyRoles?: string[];
1889
- rule?: (ctx: {
1890
- actor: Actor$1;
1891
- table: Table;
1892
- row?: Row;
1893
- }) => boolean;
1894
- };
1895
- type CreateERPTableConfig = {
1896
- store: string;
1897
- tableKey: string;
1898
- activeCollection?: string;
1899
- tableType?: string;
1900
- actor: Actor$1;
1901
- rowAccess?: RowAccessControl;
1902
- columns: ColumnSchema[];
1903
- rows: RowInput[];
1904
- repo?: TableRepository;
1905
- audit?: AuditLogger;
1906
- permissionPolicy?: PermissionPolicy;
1907
- tableHeight?: number;
1908
- recordPerPage?: number;
1909
- remoteApi?: RemoteApi;
1910
- /**
1911
- * Override event store. Default: IndexedDbEventStore in the browser,
1912
- * InMemoryEventStore in Node/tests.
1913
- */
1914
- eventStore?: EventStore;
1915
- /** Optional plugins (Excel/PDF export+import, …) registered at composition root. */
1916
- plugins?: readonly GridPlugin[];
1917
- };
1918
- type CreateERPTableResult = {
1919
- engine: TableEngine;
1920
- controller: UITableController;
1921
- session: GridSession;
1922
- table: Table;
1923
- tableKey: string;
1924
- columnMeta: Map<string, ColumnSchema>;
1925
- columnDefinitions: ColumnDefinition[];
1926
- columnBindings: ColumnViewBinding[];
1927
- eventStore: EventStore;
1928
- changelogProjection: ChangelogProjection;
1929
- historyPanelViewModel: HistoryPanelViewModel;
1930
- cellUndoStack: CellUndoStack;
1931
- pluginHost: PluginHost;
108
+ type ColumnMenuActionEvent = {
109
+ name: string;
110
+ columnId: string;
1932
111
  };
1933
112
 
1934
- type ERPTableLocale = 'fa' | 'en';
1935
- type ERPTableMessages = Record<string, string>;
113
+ /**
114
+ * Context passed to a host `FilterComponent` (PR-95).
115
+ * Call `apply` with a `ColumnFilter` (usually `{ filterType: 'custom', customFilter }`).
116
+ */
117
+ type FilterComponentContext = {
118
+ column: ColumnSchema;
119
+ colId: string;
120
+ filterModel: FilterModel;
121
+ current: ColumnFilter | undefined;
122
+ params?: Record<string, unknown>;
123
+ controller: UITableController;
124
+ apply: (next: ColumnFilter | null) => void;
125
+ close: () => void;
126
+ };
127
+ type FilterComponent = (ctx: FilterComponentContext) => ReactNode;
128
+ /**
129
+ * Host map of custom filter UIs. Keys match `ColumnDef.filter` string / `{ type }` (PR-95).
130
+ */
131
+ type FilterComponentMap = Record<string, FilterComponent | undefined>;
132
+ declare function resolveFilterComponent(name: string | undefined, components: FilterComponentMap | undefined): FilterComponent | undefined;
133
+
134
+ type ThemeParams = {
135
+ backgroundColor: string;
136
+ foregroundColor: string;
137
+ accentColor: string;
138
+ headerBackgroundColor: string;
139
+ rowStripeColor: string;
140
+ rowSelectedColor: string;
141
+ borderColor: string;
142
+ dangerColor: string;
143
+ searchMatchColor: string;
144
+ fontFamily: string;
145
+ rowHeight: number;
146
+ cellFontSize: number;
147
+ borderRadius: string;
148
+ };
149
+ type ThemeCssVars = Record<string, string>;
150
+ declare class GridTheme {
151
+ readonly params: ThemeParams;
152
+ readonly extraCssVars: ThemeCssVars;
153
+ constructor(params: ThemeParams, extraCssVars?: ThemeCssVars);
154
+ withParams(partial: Partial<ThemeParams>): GridTheme;
155
+ withExtraCssVars(extra: ThemeCssVars): GridTheme;
156
+ toCssVars(): ThemeCssVars;
157
+ }
158
+ /** Default grid chrome — same computed colors as the CSS palette aliases. */
159
+ declare const themeDefault: GridTheme;
160
+ /** @deprecated Use {@link themeDefault}. Removed in 1.0.0. */
161
+ declare const themeErp: GridTheme;
162
+ declare const themeDark: GridTheme;
163
+ /** @deprecated Use {@link themeDark}. Removed in 1.0.0. */
164
+ declare const themeErpDark: GridTheme;
165
+
166
+ /** @deprecated Prefer `faMessages` from `persian-data-grid/locales/fa`. */
167
+ declare const FA_MESSAGES: ERPTableMessages;
168
+ /** @deprecated Prefer `enMessages` from `persian-data-grid/locales/en`. */
169
+ declare const EN_MESSAGES: ERPTableMessages;
170
+ /** Arabic pack alias (PR-127). */
171
+ declare const AR_MESSAGES: ERPTableMessages;
1936
172
 
1937
173
  type ERPTableToastKind = 'success' | 'error';
1938
174
  type ERPTableHostValue = {
1939
175
  locale: ERPTableLocale;
1940
176
  direction: 'rtl' | 'ltr';
177
+ /** Intl digit system (PR-127). Default from locale meta. */
178
+ numberingSystem?: NumberingSystem;
179
+ /**
180
+ * Calendar port (PR-128 / D21). Default: `jalaliAdapter` for `fa`,
181
+ * otherwise `gregorianAdapter`.
182
+ */
183
+ dateAdapter?: DateAdapter;
1941
184
  remoteApi?: RemoteApi;
1942
185
  messages?: Partial<ERPTableMessages>;
1943
186
  onToast?: (kind: ERPTableToastKind, message: string, detail?: unknown) => void;
187
+ theme?: GridTheme;
188
+ themeToggle?: boolean;
189
+ themeLocked?: boolean;
190
+ onToggleTheme?: () => void;
191
+ components?: CellComponentMap;
192
+ /** Custom column filter UIs (PR-95). Keys match `ColumnDef.filter`. */
193
+ filterComponents?: FilterComponentMap;
194
+ /** Column header menu items (PR-114). */
195
+ columnMenuItems?: ColumnMenuItemsConfig;
196
+ /** Custom column menu action handler (PR-114). */
197
+ onColumnMenuAction?: (event: ColumnMenuActionEvent) => void;
198
+ /**
199
+ * Resolves `dependOn` values for remote lists (e.g. from the form that owns
200
+ * the grid — Redux, React context, …). Default: static item values.
201
+ */
202
+ useDependOn?: UseDependOnHook;
1944
203
  };
1945
- declare function ERPTableHostProvider({ children, locale, direction, remoteApi, messages, onToast, }: ERPTableHostValue & {
204
+ declare function ERPTableHostProvider({ children, locale, direction, numberingSystem, dateAdapter, remoteApi, messages: messagesProp, onToast: onToastProp, theme, themeToggle, themeLocked, onToggleTheme, components: componentsProp, filterComponents: filterComponentsProp, columnMenuItems: columnMenuItemsProp, onColumnMenuAction: onColumnMenuActionProp, useDependOn: useDependOnProp, }: ERPTableHostValue & {
1946
205
  children: ReactNode;
1947
206
  }): React__default.JSX.Element;
207
+ declare function useERPTableTheme(): GridTheme;
208
+
209
+ /** Default calendar for Persian hosts (PR-128 / D21). */
210
+ declare const jalaliAdapter: DateAdapter;
211
+
212
+ /** Gregorian calendar adapter (PR-128 / D21). */
213
+ declare const gregorianAdapter: DateAdapter;
214
+
215
+ type GridReadyEvent<TRow = unknown> = {
216
+ api: GridApi<TRow>;
217
+ };
218
+ type GridHostEventHandlers<TRow = unknown> = CatalogHostEventHandlers<TRow> & {
219
+ onSelectionChanged?: (event: SelectionChangedEvent<TRow>) => void;
220
+ onCellFocused?: (event: CellFocusedEvent) => void;
221
+ onGridReady?: (event: GridReadyEvent<TRow>) => void;
222
+ };
223
+ /**
224
+ * Subscribe to EVENT_CATALOG (`EventStore`) plus the existing view store
225
+ * (selection / focus). One unsubscribe. Not a second event bus.
226
+ */
227
+ declare function bindGridHostEvents<TRow = unknown>(input: {
228
+ eventStore: EventStore;
229
+ controller: UITableController;
230
+ tableKey: string;
231
+ handlers: GridHostEventHandlers<TRow>;
232
+ }): () => void;
233
+
234
+ /**
235
+ * Which full-body overlay to show (PR-103). Pure — no React.
236
+ * `loading` wins over no-rows.
237
+ */
238
+ type GridOverlayKind = 'loading' | 'noRows' | null;
239
+ declare function resolveGridOverlay(loading: boolean | undefined, rowCount: number): GridOverlayKind;
240
+
241
+ type GridOverlayContext = {
242
+ loading: boolean;
243
+ rowCount: number;
244
+ kind: Exclude<GridOverlayKind, null>;
245
+ };
246
+ type GridOverlayComponent = (ctx: GridOverlayContext) => ReactNode;
247
+ type GridOverlaysProps = {
248
+ loading?: boolean;
249
+ rowCount: number;
250
+ loadingOverlayComponent?: GridOverlayComponent;
251
+ noRowsOverlayComponent?: GridOverlayComponent;
252
+ };
253
+ /**
254
+ * Absolute layer over the scroll body: loading or empty (PR-103).
255
+ */
256
+ declare function GridOverlays({ loading, rowCount, loadingOverlayComponent, noRowsOverlayComponent, }: GridOverlaysProps): React__default.JSX.Element | null;
1948
257
 
1949
- interface ERPTableProps extends CreateERPTableConfig {
258
+ interface DataGridProps<TRow = unknown> extends CreateERPTableConfig<TRow> {
259
+ /**
260
+ * Filled when the grid hydrates; cleared on unmount.
261
+ * Prefer this over `onReady` (PR-86).
262
+ */
263
+ apiRef?: Ref<GridApi<TRow> | null>;
264
+ /**
265
+ * @deprecated Prefer {@link DataGridProps.apiRef} / `onGridReady` (PR-86).
266
+ * Still receives `UITableController` for one version so existing hosts compile.
267
+ */
1950
268
  onReady?: (controller: UITableController) => void;
269
+ /** Fires once when the grid has hydrated. Same moment as `onReady` (PR-85). */
270
+ onGridReady?: (event: GridReadyEvent<NoInfer<TRow>>) => void;
271
+ /** One call per `CELL_CHANGED` catalog event. */
272
+ onCellValueChanged?: (event: CellValueChangedEvent<NoInfer<TRow>>) => void;
273
+ /** Same `CELL_CHANGED` event, with the host row (`data`). */
274
+ onRowValueChanged?: (event: RowValueChangedEvent<NoInfer<TRow>>) => void;
275
+ /** Row add/delete/reorder catalog events, or later `rowData` prop updates. */
276
+ onRowDataUpdated?: (event: RowDataUpdatedEvent<NoInfer<TRow>>) => void;
277
+ /** View-store selection (`selectedRows`), not a second event bus. */
278
+ onSelectionChanged?: (event: SelectionChangedEvent<NoInfer<TRow>>) => void;
279
+ /** View-store active cell. */
280
+ onCellFocused?: (event: CellFocusedEvent) => void;
1951
281
  tableTitle?: ReactNode;
1952
282
  header?: ReactNode;
1953
283
  footer?: boolean | ReactNode;
284
+ /**
285
+ * When `footer={true}`, optional multi-row aggregates (PR-119).
286
+ * Each row can override `aggFunc` (e.g. sum + avg).
287
+ */
288
+ footerRows?: readonly FooterRowDef[];
1954
289
  activeCollection?: string;
1955
290
  tableHeight?: number;
1956
- multiSelectConfig: IMultiSelectConfig;
291
+ /** When omitted, the choose-from-list button and modal are not rendered (D11). */
292
+ multiSelectConfig?: IMultiSelectConfig;
1957
293
  moreDetailComponent?: React__default.ComponentType<{
1958
294
  data: unknown;
1959
295
  }>;
1960
296
  /**
1961
- * Desktop virtual scroll. Default **false** to match ERP pagination.
1962
- * Pass true to enable GridSession virtualization.
297
+ * Desktop virtual scroll. Default **on** when a session is present (PR-97 / D17).
298
+ * Pass `virtualization={false}` for classic pagination chrome.
1963
299
  */
1964
300
  virtualization?: boolean;
1965
301
  locale?: ERPTableLocale;
302
+ /**
303
+ * Writing direction. Default derived from `locale` (`fa`/`ar` → rtl, `en` → ltr).
304
+ * Pass explicitly to override (PR-127).
305
+ */
1966
306
  direction?: 'rtl' | 'ltr';
307
+ /**
308
+ * Intl digit system (PR-127). Default from locale meta
309
+ * (`fa` → arabext, `ar` → arab, `en` → latn).
310
+ */
311
+ numberingSystem?: NumberingSystem;
312
+ /**
313
+ * Calendar port (PR-128 / D21). Default jalali for `locale="fa"`, else gregorian.
314
+ */
315
+ dateAdapter?: DateAdapter;
1967
316
  messages?: Partial<ERPTableMessages>;
1968
317
  onToast?: (kind: ERPTableToastKind, message: string, detail?: unknown) => void;
318
+ /** Typed CSS variables on the table root. Default `themeDefault`. */
319
+ theme?: GridTheme;
320
+ /**
321
+ * Show the light/dark button in product chrome. Default true.
322
+ * Hidden when `theme` is a custom (non-stock) GridTheme.
323
+ */
324
+ themeToggle?: boolean;
325
+ /**
326
+ * Replace built-in FieldType editors (PR-55). Keys are FieldType or a custom
327
+ * string. Column `render` still wins. Omit = CellRenderer switch fallback.
328
+ */
329
+ components?: CellComponentMap;
330
+ /**
331
+ * Custom column filter UIs (PR-95). Keys match `ColumnDef.filter` string /
332
+ * `{ type }`. Built-in names (`text`/`number`/…) stay on the default popover.
333
+ */
334
+ filterComponents?: FilterComponentMap;
335
+ /**
336
+ * Show a floating filter row under the header (PR-94).
337
+ * Column menu filters work without this.
338
+ */
339
+ floatingFilter?: boolean;
340
+ /**
341
+ * Full-grid loading overlay (PR-103). Independent of hydrate `ready`.
342
+ */
343
+ loading?: boolean;
344
+ /** Replace the default loading overlay (PR-103). */
345
+ loadingOverlayComponent?: GridOverlayComponent;
346
+ /** Replace the default empty overlay (PR-103). */
347
+ noRowsOverlayComponent?: GridOverlayComponent;
348
+ /**
349
+ * Copy formatted display strings instead of raw values (PR-106).
350
+ * Default false.
351
+ */
352
+ copyFormattedValue?: boolean;
353
+ /** Include column headers in clipboard TSV/HTML (PR-106). Default false. */
354
+ copyHeadersToClipboard?: boolean;
355
+ /**
356
+ * Convert eastern digits to ASCII in clipboard text (PR-106).
357
+ * Default true.
358
+ */
359
+ copyDigitsAsLatin?: boolean;
360
+ /** Override per-cell clipboard text (PR-106). */
361
+ processCellForClipboard?: (params: ProcessCellForClipboardParams) => string;
362
+ /**
363
+ * Fires before writing to the system clipboard (PR-106).
364
+ * Return `false` to cancel the default write.
365
+ */
366
+ onClipboardCopy?: (event: ClipboardCopyEvent) => boolean | void;
367
+ /**
368
+ * When true (default), paste past the last row adds rows (PR-107).
369
+ */
370
+ pasteAddsRows?: boolean;
371
+ /** Fires before paste; return false to cancel (PR-107). */
372
+ onClipboardPaste?: (event: ClipboardPasteEvent) => boolean | void;
373
+ /**
374
+ * Column header ⋮ menu items (PR-114). Pass a function to trim/reorder defaults
375
+ * or append `{ name, label }` custom entries (handle via `onColumnMenuAction`).
376
+ */
377
+ columnMenuItems?: ColumnMenuItemsConfig;
378
+ /** Fires for custom column menu items (PR-114). */
379
+ onColumnMenuAction?: (event: ColumnMenuActionEvent) => void;
380
+ /**
381
+ * Host hook resolving `dependOn` values of remote lists (see
382
+ * `ERPTableHostProvider`). When omitted, an outer `ERPTableHostProvider`'s
383
+ * hook is used, else the static item values.
384
+ */
385
+ useDependOn?: UseDependOnHook;
386
+ /**
387
+ * Rows stuck under the header (PR-116). Display-only; not virtualized,
388
+ * sorted, filtered, or selected with body rows.
389
+ */
390
+ pinnedTopRowData?: readonly NoInfer<TRow>[];
391
+ /**
392
+ * Rows stuck above the footer (PR-116). Display-only; not virtualized.
393
+ */
394
+ pinnedBottomRowData?: readonly NoInfer<TRow>[];
1969
395
  }
1970
- declare function ERPTable(props: ERPTableProps): React__default.JSX.Element | null;
396
+ /** @deprecated Use {@link DataGridProps}. Removed in 1.0.0. */
397
+ type ERPTableProps<TRow = unknown> = DataGridProps<TRow>;
398
+ declare function DataGrid<TRow = unknown>(props: DataGridProps<TRow>): React__default.JSX.Element | null;
399
+ /** @deprecated Use {@link DataGrid}. Removed in 1.0.0. */
400
+ declare const ERPTable: typeof DataGrid;
401
+
402
+ declare function injectGridStyles(): void;
403
+ /** @deprecated Use `injectGridStyles()` (PR-77 / D16). */
404
+ declare function injectERPTableStyles(): void;
405
+
406
+ /**
407
+ * Default `textArea` editor (PR-56). Registered in DEFAULT_CELL_COMPONENTS —
408
+ * not a `switch (FieldType)` case in CellRenderer.
409
+ */
410
+ declare function TextAreaCell(ctx: CellRenderContext): React.JSX.Element;
411
+
412
+ /** Read-only cell text: wrap the current grid-search hit, otherwise return the string. */
413
+ declare function highlightIfCurrentSearch(text: unknown, query: string | undefined, isCurrent: boolean | undefined): React__default.ReactNode;
414
+ declare function highlightSearchText(text: unknown, query: string, isCurrent: boolean): React__default.ReactNode;
1971
415
 
1972
416
  interface CellRendererProps {
1973
417
  tableKey: string;
@@ -1979,14 +423,81 @@ interface CellRendererProps {
1979
423
  tabIndex: number;
1980
424
  mode?: "view" | "cell" | "form";
1981
425
  }
426
+ /** A cell without column meta renders nothing (the body keeps a stable hook order). */
1982
427
  declare const CellRenderer: React__default.FC<CellRendererProps>;
1983
428
 
1984
- type UseERPTableResult = {
429
+ type GridHistoryPanelProps = {
430
+ controller: UITableController;
431
+ /** Max timeline rows (newest last in the ViewModel; we reverse for display). */
432
+ limit?: number;
433
+ className?: string;
434
+ /** Fires after jump-to-cell (for hosts that want to close a drawer). */
435
+ onNavigate?: (item: HistoryItem) => void;
436
+ };
437
+ /**
438
+ * Product audit timeline (PR-136). Subscribes to `HistoryPanelViewModel`
439
+ * via the controller; jump focuses a cell; restore writes previousValue.
440
+ */
441
+ declare function GridHistoryPanel({ controller, limit, className, onNavigate, }: GridHistoryPanelProps): React__default.JSX.Element;
442
+
443
+ type GridOfflineStatusProps = {
444
+ controller: UITableController;
445
+ className?: string;
446
+ /** Show the pending mutation list (default true). */
447
+ showQueue?: boolean;
448
+ };
449
+ /**
450
+ * Online/offline badge + pending local mutations (PR-137).
451
+ */
452
+ declare function GridOfflineStatus({ controller, className, showQueue, }: GridOfflineStatusProps): React__default.JSX.Element;
453
+
454
+ /** Browser `navigator.onLine` + window online/offline events (PR-137). */
455
+ declare function createBrowserConnectivity(overrides?: Partial<ConnectivitySource>): ConnectivitySource;
456
+
457
+ /** localStorage-backed sync watermark (PR-137). */
458
+ declare function createLocalStorageWatermark(key: string): SyncWatermarkStore;
459
+
460
+ /**
461
+ * Table shortcuts that must win over a focused Select: every Alt shortcut and
462
+ * the Ctrl+Space / Ctrl+Arrow / Ctrl+End row shortcuts. The caller must
463
+ * `preventDefault()` + `stopPropagation()` synchronously — an async dispatch
464
+ * is too late to stop the Select's own handling.
465
+ */
466
+ declare function isGridShortcutKey(e: {
467
+ altKey: boolean;
468
+ ctrlKey: boolean;
469
+ code: string;
470
+ getModifierState?: (key: string) => boolean;
471
+ }): boolean;
472
+ /**
473
+ * Window-capture KEY_DOWN must not steal Enter/arrows from native controls.
474
+ * Select: keep existing skip. Textarea: Enter inserts a newline (PR-56).
475
+ */
476
+ declare function shouldSkipGridNavigation(target: EventTarget | null, code: string): boolean;
477
+ /**
478
+ * Where a window-level keydown came from, relative to ONE grid root.
479
+ * - `cell`: a body cell or the grid's own table (APG focus) → grid keyboard.
480
+ * - `page`: nothing focused (body / document) → grid keyboard (arrows keep
481
+ * working after a click on a non-focusable area, as in the legacy table).
482
+ * - `outside`: any other control — page forms, the grid toolbar, header
483
+ * filters, popovers, dialogs → only the legacy global chords
484
+ * (`isGridShortcutKey`); typing, copy/paste, Enter, Tab, arrows stay native.
485
+ * - `other-grid`: inside another grid → ignored.
486
+ */
487
+ type GridKeyScope = 'cell' | 'page' | 'outside' | 'other-grid';
488
+ declare function resolveGridKeyScope(target: EventTarget | null, root: Element | null): GridKeyScope;
489
+
490
+ type UseGridResult<TRow = unknown> = {
1985
491
  ready: false;
1986
492
  } | {
1987
493
  ready: true;
1988
494
  controller: UITableController;
495
+ api: GridApi<TRow>;
1989
496
  session: GridSession;
497
+ pluginHost: PluginHost;
498
+ eventStore: EventStore;
499
+ store: string;
500
+ tableKey: string;
1990
501
  rows: TableSnapShot;
1991
502
  changelog: ChangelogEntry[];
1992
503
  changelogCount: number;
@@ -2002,6 +513,8 @@ type UseERPTableResult = {
2002
513
  getViewport: GridSession['getViewport'];
2003
514
  getVisibleRange: GridSession['getVisibleRange'];
2004
515
  projectVisibleRows: GridSession['projectVisibleRows'];
516
+ getUiRowCount: GridSession['getUiRowCount'];
517
+ projectVisibleUiRows: GridSession['projectVisibleUiRows'];
2005
518
  changeViewport: (input: {
2006
519
  scrollOffset: number;
2007
520
  viewportSize?: number;
@@ -2011,176 +524,11 @@ type UseERPTableResult = {
2011
524
  undo: () => Promise<boolean>;
2012
525
  redo: () => Promise<boolean>;
2013
526
  };
2014
- declare function useERPTable(config: CreateERPTableConfig): UseERPTableResult;
2015
-
2016
- declare function createERPTable(config: CreateERPTableConfig): Promise<CreateERPTableResult>;
2017
-
2018
- /**
2019
- * Maps host/legacy ColumnSchema into core ColumnDefinition + view bindings.
2020
- * Domain/runtime should prefer ColumnDefinition; React renderers stay in bindings.
2021
- */
2022
- declare function toColumnDefinition(schema: ColumnSchema): ColumnDefinition;
2023
- declare function toColumnViewBinding(schema: ColumnSchema): ColumnViewBinding;
2024
- declare function mapColumnSchemas(schemas: ColumnSchema[]): {
2025
- definitions: ColumnDefinition[];
2026
- bindings: ColumnViewBinding[];
2027
- };
2028
-
2029
- type Listener$1 = (event: GridEvent) => void;
2030
- declare class InMemoryEventStore implements EventStore {
2031
- private streams;
2032
- private globalLog;
2033
- private listeners;
2034
- private globalListeners;
2035
- append(streamId: string, events: GridEvent[], expectedVersion: number): Promise<AppendResult>;
2036
- read(streamId: string, fromVersion?: number): Promise<GridEvent[]>;
2037
- readAll(fromPosition?: number): Promise<GridEvent[]>;
2038
- subscribe(streamId: string, onEvent: Listener$1): Unsubscribe;
2039
- subscribeAll(onEvent: Listener$1): Unsubscribe;
2040
- getStreamVersion(streamId: string): number;
2041
- getGlobalPosition(): number;
2042
- }
2043
-
2044
- /**
2045
- * Minimal async key-value backend so IndexedDbEventStore can run in Node tests
2046
- * without a real IndexedDB, and in browsers via an IDB adapter.
2047
- */
2048
- interface KvStore {
2049
- get<T = unknown>(key: string): Promise<T | undefined>;
2050
- put(key: string, value: unknown): Promise<void>;
2051
- delete(key: string): Promise<void>;
2052
- getAllKeys(): Promise<string[]>;
2053
- getAll<T = unknown>(): Promise<T[]>;
2054
- clear(): Promise<void>;
2055
- }
2056
- interface KvDatabase {
2057
- objectStore(name: string): KvStore;
2058
- }
2059
- declare class MemoryKvDatabase implements KvDatabase {
2060
- private stores;
2061
- objectStore(name: string): KvStore;
2062
- }
2063
- /**
2064
- * Browser IndexedDB adapter. Opens (or creates) a DB with the given object stores.
2065
- * Falls back callers should use MemoryKvDatabase in Node/tests.
2066
- */
2067
- declare function openIndexedDbDatabase(dbName: string, storeNames: string[], version?: number): Promise<KvDatabase>;
2068
-
2069
- type Listener = (event: GridEvent) => void;
2070
- /**
2071
- * Durable EventStore backed by IndexedDB (or any KvDatabase).
2072
- * Same OCC contract as InMemoryEventStore.
2073
- */
2074
- declare class IndexedDbEventStore implements EventStore {
2075
- private readonly db;
2076
- private listeners;
2077
- private globalListeners;
2078
- private ready;
2079
- constructor(db: KvDatabase);
2080
- static open(dbName?: string): Promise<IndexedDbEventStore>;
2081
- /** Test / Node helper — durable API with in-memory persistence backend. */
2082
- static inMemory(): IndexedDbEventStore;
2083
- append(streamId: string, events: GridEvent[], expectedVersion: number): Promise<AppendResult>;
2084
- read(streamId: string, fromVersion?: number): Promise<GridEvent[]>;
2085
- readAll(fromPosition?: number): Promise<GridEvent[]>;
2086
- subscribe(streamId: string, onEvent: Listener): Unsubscribe;
2087
- subscribeAll(onEvent: Listener): Unsubscribe;
2088
- }
2089
-
2090
- /**
2091
- * Aggregate snapshot for fast reload: lastSnapshot + events after version.
2092
- */
2093
- interface AggregateSnapshot<TPayload = unknown> {
2094
- readonly tableId: string;
2095
- readonly streamId: string;
2096
- readonly version: number;
2097
- readonly takenAt: number;
2098
- readonly payload: TPayload;
2099
- }
2100
- interface SnapshotStore<TPayload = unknown> {
2101
- save(snapshot: AggregateSnapshot<TPayload>): Promise<void>;
2102
- loadLatest(streamId: string): Promise<AggregateSnapshot<TPayload> | null>;
2103
- clear(streamId: string): Promise<void>;
2104
- }
2105
-
2106
- type SnapshotStrategyOptions = {
2107
- /** Take a snapshot every N appended domain events (default 200). */
2108
- readonly everyNEvents?: number;
2109
- };
2110
- /**
2111
- * After appends, periodically persists a snapshot of the selected payload.
2112
- * load(stream) = latest snapshot + events with version > snapshot.version
2113
- */
2114
- declare class SnapshotStrategy<TPayload = unknown> {
2115
- private readonly snapshots;
2116
- private readonly eventStore;
2117
- private readonly capture;
2118
- private readonly everyN;
2119
- private counts;
2120
- constructor(snapshots: SnapshotStore<TPayload>, eventStore: EventStore, capture: (streamId: string) => Promise<TPayload> | TPayload, options?: SnapshotStrategyOptions);
2121
- /** Call after a successful EventStore.append for the stream. */
2122
- onAppend(streamId: string, tableId: string, appendedCount: number): Promise<void>;
2123
- loadWithCatchUp(streamId: string): Promise<{
2124
- snapshot: AggregateSnapshot<TPayload> | null;
2125
- eventsAfter: GridEvent[];
2126
- }>;
2127
- }
2128
-
2129
- declare class InMemorySnapshotStore<TPayload = unknown> implements SnapshotStore<TPayload> {
2130
- private byStream;
2131
- save(snapshot: AggregateSnapshot<TPayload>): Promise<void>;
2132
- loadLatest(streamId: string): Promise<AggregateSnapshot<TPayload> | null>;
2133
- clear(streamId: string): Promise<void>;
2134
- }
2135
-
2136
- /** Default RemoteApi for Node/tests/package builds — host injects a real adapter. */
2137
- declare class NoopRemoteApi implements RemoteApi {
2138
- request<TResponse = unknown>(): Promise<TResponse>;
2139
- }
2140
-
2141
- declare class EngineErrorHandler {
2142
- private readonly audit;
2143
- constructor(audit: ConsoleAuditLogger);
2144
- /**
2145
- * همه‌ی خطاها — چه DomainError چه runtime error — از اینجا رد می‌شن
2146
- * و از طریق ConsoleAuditLogger لاگ می‌شن.
2147
- */
2148
- handle(error: unknown, context?: string): void;
2149
- /** برای جاهایی که store یا table پیدا نشد */
2150
- notFound(entity: string, key: string, context?: string): void;
2151
- }
2152
-
2153
- /**
2154
- * Browser RemoteApi used by ERP after npm install.
2155
- * Reads auth cookie `_auth` and redux-persist `persist:arianERP` the same way
2156
- * the ERP FetchRemoteApi did, then POSTs JSON (relative URLs work on the ERP host).
2157
- */
2158
- declare class FetchRemoteApi implements RemoteApi {
2159
- private readonly err?;
2160
- private readonly options;
2161
- constructor(err?: EngineErrorHandler | undefined, options?: {
2162
- baseUrl?: string;
2163
- });
2164
- request<TResponse = any>(input: {
2165
- endpoint: string;
2166
- params?: Record<string, any>;
2167
- method?: 'GET' | 'POST';
2168
- }): Promise<TResponse>;
2169
- }
2170
-
2171
- /**
2172
- * Plugin-facing event catalog (stable type tokens for subscribe / export plugins).
2173
- * Keep in sync with `application/events` and `domain/types/GridEvent`.
2174
- */
2175
- type EventCatalogEntry = {
2176
- readonly type: string;
2177
- readonly category: 'cell' | 'row' | 'column' | 'table' | 'view' | 'dynamic' | 'error' | 'plugin';
2178
- readonly undoable: boolean;
2179
- readonly description: string;
2180
- };
2181
- declare const EVENT_CATALOG: readonly EventCatalogEntry[];
2182
- declare function getEventCatalogEntry(type: string): EventCatalogEntry | undefined;
2183
- declare function listUndoableEventTypes(): string[];
527
+ /** @deprecated Use {@link UseGridResult}. Removed in 1.0.0. */
528
+ type UseERPTableResult<TRow = unknown> = UseGridResult<TRow>;
529
+ declare function useGrid<TRow = unknown>(config: CreateERPTableConfig<TRow>): UseGridResult<TRow>;
530
+ /** @deprecated Use {@link useGrid}. Removed in 1.0.0. */
531
+ declare const useERPTable: typeof useGrid;
2184
532
 
2185
533
  type BenchmarkSample = {
2186
534
  readonly name: string;
@@ -2225,47 +573,14 @@ declare const DEFAULT_PERFORMANCE_BUDGETS: {
2225
573
  readonly maxAvgMs: 5;
2226
574
  readonly maxMaxMs: 20;
2227
575
  };
576
+ /** PR-99: one arrow-key neighbor lookup on a 100k SparseRowIndex. */
577
+ readonly arrowNeighbor100k: {
578
+ readonly name: "arrowNeighbor100k";
579
+ readonly maxAvgMs: 2;
580
+ readonly maxMaxMs: 20;
581
+ };
2228
582
  };
2229
583
 
2230
- /**
2231
- * Pure virtual-window calculator — no DOM / window / document.
2232
- * Input: totalRows + Viewport → VisibleRange for Adapter rendering.
2233
- */
2234
- declare class ViewportCalculator {
2235
- static calculate(totalRows: number, viewport: Viewport): VisibleRange;
2236
- /** Contiguous index list for the visible window. */
2237
- static indices(range: VisibleRange): number[];
2238
- /** Slice a dense array by VisibleRange (O(window), not O(n)). */
2239
- static projectRows<T>(rows: readonly T[], range: VisibleRange): T[];
2240
- /**
2241
- * Project from sparse structure: ordered id list + Map by id.
2242
- * Suitable for 100k+ tables without materializing full UI rows.
2243
- */
2244
- static projectByIndex<T>(orderedIds: readonly number[], byId: ReadonlyMap<number, T>, range: VisibleRange): T[];
2245
- }
2246
-
2247
- /**
2248
- * Sparse ordered index for large tables: O(1) id lookup + O(window) projection.
2249
- * Keeps full row payloads in a Map; visible window never walks all rows.
2250
- */
2251
- declare class SparseRowIndex<T> {
2252
- private readonly byId;
2253
- private orderedIds;
2254
- constructor(entries?: Iterable<readonly [number, T]>);
2255
- get size(): number;
2256
- getOrderedIds(): readonly number[];
2257
- getById(id: number): T | undefined;
2258
- set(id: number, value: T): void;
2259
- /** Replace order without rebuilding payloads (e.g. after sort). */
2260
- setOrder(orderedIds: readonly number[]): void;
2261
- clear(): void;
2262
- /** Project only the visible window — O(window), not O(n). */
2263
- projectVisible(range: {
2264
- startIndex: number;
2265
- endIndex: number;
2266
- }): T[];
2267
- }
2268
-
2269
584
  type VirtualListProps<T> = {
2270
585
  session: GridSession;
2271
586
  items: readonly T[];
@@ -2306,182 +621,19 @@ type UseVirtualWindowResult<T> = VirtualWindowModel<T> & {
2306
621
  * Syncs GridSession viewport with a scrollable container and returns
2307
622
  * only the visible item window for rendering.
2308
623
  */
2309
- declare function useVirtualWindow<T>(session: GridSession | null | undefined, items: readonly T[], options?: {
624
+ declare function useVirtualWindow<T>(session: GridSession | null | undefined, items: readonly T[] | SparseRowIndex<T>, options?: {
2310
625
  rowHeight?: number;
2311
626
  overscan?: number;
2312
627
  initialViewportSize?: number;
2313
628
  }): UseVirtualWindowResult<T>;
2314
629
 
2315
630
  /**
2316
- * Adapter: TableEngine → GridQueryPort for export plugins.
2317
- */
2318
- declare function createEngineGridQuery(engine: TableEngine): GridQueryPort;
2319
-
2320
- /**
2321
- * Port so PDF libraries (jsPDF, etc.) stay out of Core.
2322
- * Host or plugin package injects a concrete renderer.
2323
- */
2324
- interface PdfRenderer {
2325
- render(source: ExportSource, options?: {
2326
- title?: string;
2327
- direction?: 'rtl' | 'ltr';
2328
- }): Promise<Blob>;
2329
- }
2330
-
2331
- type ExcelExportPluginOptions = {
2332
- /** Skip browser download (useful in tests / Node). */
2333
- download?: boolean;
2334
- onBlob?: (blob: Blob, meta: {
2335
- fileName: string;
2336
- rowCount: number;
2337
- columnCount: number;
2338
- }) => void;
2339
- };
2340
- /**
2341
- * Subscribes to EXPORT_REQUESTED (format=xlsx); never mutates Domain.
2342
- */
2343
- declare class ExcelExportPlugin implements GridPlugin {
2344
- private readonly options;
2345
- readonly name = "excel-export";
2346
- private unsub;
2347
- constructor(options?: ExcelExportPluginOptions);
2348
- register(ctx: GridPluginContext): void;
2349
- dispose(): void;
2350
- private onEvent;
2351
- }
2352
-
2353
- type ExcelImportPluginOptions = {
2354
- onImported?: (meta: {
2355
- rowCount: number;
2356
- columnCount: number;
2357
- }) => void;
2358
- };
2359
- /**
2360
- * Subscribes to IMPORT_REQUESTED (format=xlsx); mutates domain only via
2361
- * session/engine commands (never touches Entity directly).
2362
- */
2363
- declare class ExcelImportPlugin implements GridPlugin {
2364
- private readonly options;
2365
- readonly name = "excel-import";
2366
- private unsub;
2367
- constructor(options?: ExcelImportPluginOptions);
2368
- register(ctx: GridPluginContext): void;
2369
- dispose(): void;
2370
- private onEvent;
2371
- }
2372
-
2373
- type ExportActiveCollectionResult = {
2374
- rowCount: number;
2375
- columnCount: number;
2376
- };
2377
- type ExportActiveCollectionOptions = {
2378
- fileName?: string;
2379
- sheetName?: string;
2380
- direction?: 'rtl' | 'ltr';
2381
- rowHeaderLabel?: string;
2382
- /** When false, skip browser download (tests). */
2383
- download?: boolean;
2384
- };
2385
- /**
2386
- * Imperative facade used by ERP toolbar buttons.
2387
- * Prefer PluginHost.requestExport + ExcelExportPlugin for event-driven hosts.
2388
- */
2389
- declare function exportActiveCollectionToExcel(controller: UITableController, options?: ExportActiveCollectionOptions): Promise<ExportActiveCollectionResult>;
2390
-
2391
- type ExportTable = {
2392
- columns: Array<{
2393
- fieldName: string;
2394
- caption: string;
2395
- }>;
2396
- /** Parallel to columns; already stringified cell text */
2397
- rows: string[][];
2398
- };
2399
- /**
2400
- * Builds a dense string matrix from ExportSource (plugin query port).
2401
- */
2402
- declare function buildExportTable(source: ExportSource): ExportTable;
2403
-
2404
- type BuildXlsxOptions = {
2405
- sheetName?: string;
2406
- direction?: 'rtl' | 'ltr';
2407
- rowHeaderLabel?: string;
2408
- };
2409
- declare function buildXlsxBlob(table: ExportTable, options?: BuildXlsxOptions): Blob;
2410
-
2411
- type ParsedXlsxSheet = {
2412
- /** First row cells (header captions / field names). */
2413
- headers: string[];
2414
- /** Body rows; each row length matches headers (padded with ''). */
2415
- rows: string[][];
2416
- };
2417
- /**
2418
- * Parses a minimal OOXML .xlsx (store or deflate) into a string matrix.
2419
- * Supports shared strings and inlineStr (as produced by buildXlsxBlob).
2420
- */
2421
- declare function parseXlsxBlob(data: Blob | ArrayBuffer | Uint8Array, options?: {
2422
- sheetName?: string;
2423
- }): Promise<ParsedXlsxSheet>;
2424
-
2425
- type ImportCellKv = {
2426
- key: string;
2427
- value: unknown;
2428
- display: unknown;
2429
- };
2430
- type MappedImportRows = {
2431
- columns: Array<{
2432
- fieldName: string;
2433
- fieldType?: string;
2434
- }>;
2435
- /** One KeyValue[] per data row (no index column). */
2436
- rows: ImportCellKv[][];
2437
- };
2438
- /**
2439
- * Maps sheet headers to export/query columns by caption or fieldName.
2440
- * Skips index/static columns.
2441
- */
2442
- declare function mapImportedSheet(sheet: ParsedXlsxSheet, columns: readonly ExportColumnDef[]): MappedImportRows;
2443
-
2444
- type ApplyImportedRowsResult = {
2445
- rowCount: number;
2446
- };
2447
- /**
2448
- * Applies imported cell matrices through the engine (ADD_NEW_ROWS) so
2449
- * CachedTableRepository / IndexedDB persistence stays on the normal path.
2450
- *
2451
- * Uses a synthetic unique `index` token only for dedupe in Table.addNewRows;
2452
- * addNewRow still auto-assigns the real index cell.
2453
- */
2454
- declare function applyImportedRows(session: GridSession, rows: ImportCellKv[][]): Promise<ApplyImportedRowsResult>;
2455
-
2456
- type PdfExportPluginOptions = {
2457
- renderer?: PdfRenderer;
2458
- download?: boolean;
2459
- onBlob?: (blob: Blob, meta: {
2460
- fileName: string;
2461
- rowCount: number;
2462
- }) => void;
2463
- };
2464
- /**
2465
- * Subscribes to EXPORT_REQUESTED (format=pdf); Domain stays untouched.
2466
- */
2467
- declare class PdfExportPlugin implements GridPlugin {
2468
- private readonly options;
2469
- readonly name = "pdf-export";
2470
- private unsub;
2471
- private readonly renderer;
2472
- constructor(options?: PdfExportPluginOptions);
2473
- register(ctx: GridPluginContext): void;
2474
- dispose(): void;
2475
- private onEvent;
2476
- }
2477
-
2478
- /**
2479
- * Minimal text PDF (no external lib) — Host can swap for jsPDF via PdfRenderer.
631
+ * Window events that ask every mounted grid header to re-run validation.
632
+ * Hosts dispatch one after changing something the grid cannot observe
633
+ * (e.g. a header form field that feeds a column `requiredIf` rule).
634
+ * `erp-table:revalidate` is the legacy arianERP name and stays supported.
2480
635
  */
2481
- declare class TextPdfRenderer implements PdfRenderer {
2482
- render(source: ExportSource, options?: {
2483
- title?: string;
2484
- }): Promise<Blob>;
2485
- }
636
+ declare const GRID_REVALIDATE_EVENT = "pdg-grid:revalidate";
637
+ declare const LEGACY_GRID_REVALIDATE_EVENT = "erp-table:revalidate";
2486
638
 
2487
- export { type AggregateSnapshot, type AppendResult, type BenchmarkResult, type BenchmarkSample, CellRenderer, type CollectionRowMap, type ColumnDefinition, type ColumnSchema, type ColumnViewBinding, type CreateERPTableConfig, type CreateERPTableResult, DEFAULT_PERFORMANCE_BUDGETS, ERPTable, ERPTableHostProvider, type ERPTableHostValue, type ERPTableLocale, type ERPTableMessages, type ERPTableProps, EVENT_CATALOG, type EventCatalogEntry, type EventStore, ExcelExportPlugin, ExcelImportPlugin, type ExportSource, FetchRemoteApi, type FieldType, type GridPlugin, type GridPluginContext, type GridQueryPort, type GridSession, type IMultiSelectConfig, InMemoryEventStore, InMemorySnapshotStore, IndexedDbEventStore, type ItemType, type KvDatabase, type KvStore, MemoryKvDatabase, NoopRemoteApi, PdfExportPlugin, type PdfRenderer, type PerformanceBudget, PluginHost, type RemoteApi, type RequestExportOptions, type RequestImportOptions, type RowInput, RowStateEnum, type SnapshotStore, SnapshotStrategy, SparseRowIndex, TableEngine, type TableSnapShot, type TableViewState, TextPdfRenderer, type UIRow, UITableController, type UseERPTableResult, type UseVirtualWindowResult, type ValidCell, type ViewIntent, Viewport, ViewportCalculator, VirtualList, type VirtualListProps, type VirtualWindowModel, type VisibleRange, applyImportedRows, buildExportTable, buildVirtualWindow, buildXlsxBlob, checkBudget, createERPTable, createEngineGridQuery, exportActiveCollectionToExcel, getEventCatalogEntry, listUndoableEventTypes, mapColumnSchemas, mapImportedSheet, openIndexedDbDatabase, parseXlsxBlob, runBenchmark, toColumnDefinition, toColumnViewBinding, useERPTable, useVirtualWindow };
639
+ export { AR_MESSAGES, AggFuncName, type BenchmarkResult, type BenchmarkSample, type CellComponent, type CellComponentMap, CellFocusedEvent, CellRenderContext, CellRenderer, CellValueChangedEvent, ColumnFilter, type ColumnMenuActionEvent, type ColumnMenuBuiltInId, type ColumnMenuCustomItem, type ColumnMenuItemDef, type ColumnMenuItemsConfig, ConnectivitySource, CreateERPTableConfig, DEFAULT_CELL_COMPONENTS, DEFAULT_PERFORMANCE_BUDGETS, DataGrid, type DataGridProps, type DateAdapter, EN_MESSAGES, ERPTable, ERPTableHostProvider, type ERPTableHostValue, ERPTableLocale, ERPTableMessages, type ERPTableProps, EventStore, FA_MESSAGES, FieldType, type FilterComponent, type FilterComponentContext, type FilterComponentMap, FilterModel, type FooterRowDef, GRID_REVALIDATE_EVENT, GridApi, GridHistoryPanel, type GridHistoryPanelProps, type GridHostEventHandlers, type GridKeyScope, GridOfflineStatus, type GridOfflineStatusProps, type GridOverlayComponent, type GridOverlayContext, type GridOverlayKind, GridOverlays, type GridOverlaysProps, type GridReadyEvent, GridSession, GridTheme, IMultiSelectConfig, LEGACY_GRID_REVALIDATE_EVENT, NumberingSystem, type PerformanceBudget, PluginHost, RemoteApi, RowDataUpdatedEvent, RowValueChangedEvent, SelectionChangedEvent, SparseRowIndex, SyncWatermarkStore, TableSnapShot, TextAreaCell, type ThemeCssVars, type ThemeParams, UIRow, UITableController, type UseDependOnHook, type UseDependOnOptions, type UseDependOnResult, type UseERPTableResult, type UseGridResult, type UseVirtualWindowResult, Viewport, VirtualList, type VirtualListProps, type VirtualWindowModel, VisibleRange, bindGridHostEvents, buildVirtualWindow, checkBudget, createBrowserConnectivity, createLocalStorageWatermark, gregorianAdapter, highlightIfCurrentSearch, highlightSearchText, injectERPTableStyles, injectGridStyles, isGridShortcutKey, jalaliAdapter, mergeCellComponents, resolveBoundCellNode, resolveFilterComponent, resolveGridKeyScope, resolveGridOverlay, resolveRegisteredCellNode, runBenchmark, shouldSkipGridNavigation, themeDark, themeDefault, themeErp, themeErpDark, useERPTable, useERPTableTheme, useGrid, useStaticDependOn, useVirtualWindow };