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
@@ -0,0 +1,939 @@
1
+ import { ai as SortModel, F as FilterModel, E as EventStore, b as GridSession, b0 as ExportRequestedPayload, b1 as ImportRequestedPayload, ah as SortDirection, d as CellRange, l as ColumnDef, m as GetRowId$1, G as GridEvent, x as FieldType, b2 as IRule, b3 as ColumnVisibilityRule, b4 as IDependOn, C as ColumnSchema, D as DefaultOptionType, b5 as ResolveOnConfig, b6 as IBaseQueryResponse, b7 as HostRemoteApi, U as UIRow, a7 as ItemType, b8 as Actor, f as Table, R as Row, b9 as ColDefOrGroup, ba as TableRepository, bb as PermissionPolicy, bc as CellEditType, bd as CellEditCommit, be as EnterNavigation, ab as RowModelType, e as TableEngine, i as ChangelogProjection, H as HistoryPanelViewModel, j as CellUndoStack, a as Unsubscribe, z as AppendResult, ap as Viewport, aq as VisibleRange, A as AggFunc, y as AggFuncName } from './GridSession-CeIfVFck.js';
2
+ import { h as SyncResult, e as SyncConflictPolicy, S as SyncConflict, M as ManualResolution, b as PresencePeer, U as UITableController, z as ConnectivitySource, i as SyncTransport, d as PresenceTransport, l as ClipboardCopyBuildOptions, q as GridPasteRuntimeOptions, O as OfflineStatus, g as SyncPort, c as PresencePort } from './UITableController-C71LXBiX.js';
3
+ import { ReactNode, CSSProperties } from 'react';
4
+ import { A as AuditLogger, R as RemoteApi } from './RemoteApi-CCQxiSf1.js';
5
+ import { c as GridQueryPort, G as GridPlugin } from './GridPlugin-Bewn0X51.js';
6
+
7
+ /**
8
+ * Host-provided row source for `rowModelType: 'infinite' | 'serverSide'` (PR-96).
9
+ * Block cache / LRU / `refreshServerSide` — PR-102.
10
+ */
11
+ type GridDatasourceGetRowsParams = {
12
+ startRow: number;
13
+ endRow: number;
14
+ sortModel: SortModel;
15
+ filterModel: FilterModel;
16
+ };
17
+ type GridDatasourceGetRowsResult<TRow = unknown> = {
18
+ rows: TRow[];
19
+ /** Total row count when known; drives pagination. */
20
+ lastRow?: number;
21
+ };
22
+ interface GridDatasource<TRow = unknown> {
23
+ getRows(p: GridDatasourceGetRowsParams): Promise<GridDatasourceGetRowsResult<TRow>>;
24
+ }
25
+
26
+ type RequestExportOptions = {
27
+ format: 'xlsx' | 'pdf' | 'csv';
28
+ collectionScope?: ExportRequestedPayload['collectionScope'];
29
+ correlationId?: string;
30
+ fileName?: string;
31
+ sheetName?: string;
32
+ direction?: 'rtl' | 'ltr';
33
+ };
34
+ type RequestImportOptions = {
35
+ format: 'xlsx';
36
+ data: Blob | ArrayBuffer | Uint8Array;
37
+ collectionScope?: ImportRequestedPayload['collectionScope'];
38
+ correlationId?: string;
39
+ sheetName?: string;
40
+ };
41
+ type PluginHostDeps = {
42
+ tableId: string;
43
+ actorId: string;
44
+ eventStore: EventStore;
45
+ session: GridSession;
46
+ query: GridQueryPort;
47
+ /** Runs before an export reads rows (createGrid: write the open cell edit). */
48
+ beforeRead?: () => Promise<void>;
49
+ };
50
+ /**
51
+ * Registers plugins and publishes plugin/view-stream events (e.g. EXPORT_REQUESTED).
52
+ */
53
+ declare class PluginHost {
54
+ private readonly deps;
55
+ private readonly plugins;
56
+ private readonly disposers;
57
+ private readonly importPayloads;
58
+ private version;
59
+ constructor(deps: PluginHostDeps);
60
+ private takeImportPayload;
61
+ private createBus;
62
+ register(plugins: readonly GridPlugin[]): void;
63
+ list(): readonly GridPlugin[];
64
+ has(pluginName: string): boolean;
65
+ requestExport(options: RequestExportOptions): Promise<void>;
66
+ requestImport(options: RequestImportOptions): Promise<void>;
67
+ dispose(): void;
68
+ }
69
+
70
+ /**
71
+ * Column layout state model (PR-115). Pure — no React/DOM.
72
+ * Used by GridApi get/apply and optional localStorage / EventStore persist.
73
+ */
74
+
75
+ type ColumnPinnedState = 'start' | 'end' | null;
76
+ type ColumnStateItem = {
77
+ colId: string;
78
+ width: number;
79
+ hide: boolean;
80
+ order: number;
81
+ pinned?: ColumnPinnedState;
82
+ sort?: SortDirection | null;
83
+ sortIndex?: number | null;
84
+ };
85
+
86
+ type GridRowNode<TRow = unknown> = {
87
+ id: string;
88
+ rowId: number;
89
+ data: TRow;
90
+ };
91
+ /** Column layout snapshot (PR-115). Includes pin + sort for persist/restore. */
92
+ type GridColumnState = ColumnStateItem;
93
+ type StartEditingCellParams = {
94
+ rowId: string | number;
95
+ colId: string;
96
+ };
97
+ type ExportDataAsExcelOptions = {
98
+ fileName?: string;
99
+ };
100
+ type CreateGridApiInput<TRow = unknown> = {
101
+ controller: UITableController;
102
+ pluginHost: PluginHost;
103
+ columnDefs?: ColumnDef<TRow>[];
104
+ getRowId?: GetRowId$1<TRow>;
105
+ /** Wired when `rowModelType` is infinite/serverSide (PR-102). */
106
+ refreshServerSide?: () => Promise<void>;
107
+ };
108
+ /**
109
+ * Imperative host API (PR-86). Thin adapter over `UITableController` +
110
+ * `PluginHost`. Does not expose `dispatch` or the full controller surface.
111
+ */
112
+ type GridApi<TRow = unknown> = {
113
+ getRowNode(id: string | number): GridRowNode<TRow> | undefined;
114
+ setRowData(rowData: readonly TRow[]): void;
115
+ refreshCells(): void;
116
+ getSelectedRows(): TRow[];
117
+ deselectAll(): Promise<void>;
118
+ startEditingCell(params: StartEditingCellParams): Promise<void>;
119
+ stopEditing(cancel?: boolean): void | Promise<void>;
120
+ exportDataAsExcel(options?: ExportDataAsExcelOptions): Promise<void>;
121
+ undo(): Promise<boolean>;
122
+ redo(): Promise<boolean>;
123
+ getColumnState(): GridColumnState[];
124
+ applyColumnState(state: readonly GridColumnState[]): Promise<void>;
125
+ setColumnVisible(colId: string, visible: boolean): void;
126
+ /** Measure header + cell text off-DOM and resize columns (PR-112). */
127
+ autoSizeColumns(colIds?: string[]): void;
128
+ /** Scale column widths to fit the scrollport (PR-112). */
129
+ sizeColumnsToFit(containerWidth?: number): void;
130
+ getSortModel(): SortModel;
131
+ setSortModel(sortModel: SortModel): void;
132
+ getQuickFilter(): string;
133
+ setQuickFilter(quickFilterText: string): void;
134
+ getFilterModel(): FilterModel;
135
+ setFilterModel(filterModel: FilterModel): void;
136
+ /** Active row-group columns (PR-120). Only the first is used in 0.12.0. */
137
+ getRowGroupColumns(): string[];
138
+ setRowGroupColumns(columns: readonly string[]): void;
139
+ setGroupDefaultExpanded(expanded: boolean): void;
140
+ toggleRowGroup(groupKey: string): void;
141
+ /** Purge server block cache and refetch (PR-102). */
142
+ refreshServerSide(): Promise<void>;
143
+ /** Current cell ranges in UI row/column space (PR-105). */
144
+ getCellRanges(): readonly CellRange[];
145
+ /** Append a normalized range (PR-105). */
146
+ addCellRange(range: CellRange): void;
147
+ /** Online / offline (PR-137). */
148
+ getConnectivity(): 'online' | 'offline';
149
+ /** Local data mutations not yet marked synced (PR-137). */
150
+ getPendingChangeCount(): number;
151
+ markPendingSynced(eventIds?: readonly string[]): void;
152
+ /** Push/pull sync when `syncTransport` was configured (PR-138). */
153
+ sync(): Promise<SyncResult | null>;
154
+ setSyncPolicy(policy: SyncConflictPolicy): void;
155
+ getSyncPolicy(): SyncConflictPolicy | undefined;
156
+ getOpenSyncConflicts(): readonly SyncConflict[];
157
+ resolveSyncConflict(conflictId: string, choice: ManualResolution): Promise<void>;
158
+ /** Remote peers currently broadcasting a cell cursor (PR-139). */
159
+ getPresencePeers(): readonly PresencePeer[];
160
+ };
161
+ declare function createGridApi<TRow = unknown>(input: CreateGridApiInput<TRow>): GridApi<TRow>;
162
+
163
+ /**
164
+ * Aggregate snapshot for fast reload: lastSnapshot + events after version.
165
+ */
166
+ interface AggregateSnapshot<TPayload = unknown> {
167
+ readonly tableId: string;
168
+ readonly streamId: string;
169
+ readonly version: number;
170
+ readonly takenAt: number;
171
+ readonly payload: TPayload;
172
+ }
173
+ interface SnapshotStore<TPayload = unknown> {
174
+ save(snapshot: AggregateSnapshot<TPayload>): Promise<void>;
175
+ loadLatest(streamId: string): Promise<AggregateSnapshot<TPayload> | null>;
176
+ clear(streamId: string): Promise<void>;
177
+ }
178
+
179
+ type SnapshotStrategyOptions = {
180
+ /** Take a snapshot every N appended domain events (default 200). */
181
+ readonly everyNEvents?: number;
182
+ };
183
+ /**
184
+ * After appends, periodically persists a snapshot of the selected payload.
185
+ * load(stream) = latest snapshot + events with version > snapshot.version
186
+ */
187
+ declare class SnapshotStrategy<TPayload = unknown> {
188
+ private readonly snapshots;
189
+ private readonly eventStore;
190
+ private readonly capture;
191
+ private readonly everyN;
192
+ private counts;
193
+ constructor(snapshots: SnapshotStore<TPayload>, eventStore: EventStore, capture: (streamId: string) => Promise<TPayload> | TPayload, options?: SnapshotStrategyOptions);
194
+ /** Call after a successful EventStore.append for the stream. */
195
+ onAppend(streamId: string, tableId: string, appendedCount: number): Promise<void>;
196
+ loadWithCatchUp(streamId: string): Promise<{
197
+ snapshot: AggregateSnapshot<TPayload> | null;
198
+ eventsAfter: GridEvent[];
199
+ }>;
200
+ }
201
+
202
+ /**
203
+ * Core column definition without React/DOM bindings.
204
+ * Host adapters attach renderers via ColumnViewBinding.
205
+ */
206
+ interface ColumnDefinition {
207
+ readonly fieldName: string;
208
+ readonly fieldCaption: string;
209
+ readonly fieldType: FieldType;
210
+ readonly fieldCollection?: string;
211
+ readonly order?: number;
212
+ readonly editable?: boolean;
213
+ readonly isUnique?: boolean;
214
+ readonly hidden?: boolean;
215
+ readonly disable?: boolean;
216
+ readonly noCache?: boolean;
217
+ readonly expandable?: boolean;
218
+ readonly rules?: IRule[];
219
+ readonly options?: ReadonlyArray<{
220
+ label?: unknown;
221
+ value?: string | number;
222
+ title?: string;
223
+ }>;
224
+ readonly visibility: ColumnVisibilityRule;
225
+ readonly dynamicSource?: {
226
+ endpoint: string;
227
+ dependsOn?: string[];
228
+ dependOn?: IDependOn | IDependOn[];
229
+ params?: Record<string, string>;
230
+ };
231
+ readonly computed?: {
232
+ dependsOn: readonly string[];
233
+ };
234
+ readonly selectOptions?: ReadonlyArray<{
235
+ label: string;
236
+ value: string | number;
237
+ }>;
238
+ readonly minWidth?: number;
239
+ readonly labelValue?: 'selectDisplay' | 'selectValue';
240
+ }
241
+ /**
242
+ * Presentation binding kept outside Domain (Adapter / Host).
243
+ * `render` is intentionally untyped here to avoid React import in core.
244
+ */
245
+ interface ColumnViewBinding {
246
+ readonly fieldName: string;
247
+ readonly className?: string;
248
+ readonly minWidth?: number;
249
+ readonly style?: unknown;
250
+ readonly render?: (...args: unknown[]) => unknown;
251
+ readonly displayFormat?: (value: unknown) => unknown;
252
+ readonly onChange?: (...args: unknown[]) => void;
253
+ readonly indexOptions?: (...args: unknown[]) => unknown[];
254
+ readonly popUpWidth?: number;
255
+ readonly dynamicSelectFilterOption?: (inputValue: string, option: unknown) => boolean;
256
+ }
257
+
258
+ /** Select option with a renderable label. */
259
+ type HostDefaultOptionType = Omit<DefaultOptionType, 'label'> & {
260
+ label?: ReactNode;
261
+ };
262
+ /** Remote flag resolution typed with the arianERP query envelope. */
263
+ type HostResolveOnConfig<K = unknown> = ResolveOnConfig<K, IBaseQueryResponse<K>>;
264
+ interface HostColumnSchema<T = unknown, K = unknown> extends Omit<ColumnSchema<T, K>, 'options' | 'resolveOn' | 'computed' | 'indexOptions' | 'onChange' | 'dynamicSelectFilterOption' | 'style'> {
265
+ options?: HostDefaultOptionType[];
266
+ resolveOn?: HostResolveOnConfig<K>;
267
+ computed?: {
268
+ dependsOn: readonly string[];
269
+ compute(row: Record<string, unknown>, remoteApi: HostRemoteApi): Promise<unknown>;
270
+ children?: [] | undefined;
271
+ };
272
+ /** Extra items of the row index menu. */
273
+ indexOptions?: (tableKey: string, rowId: number, row: UIRow, controller: UITableController) => ItemType[];
274
+ onChange?: (tableKey: string, rowId: number, row: UIRow, controller: UITableController, value: unknown, option?: HostDefaultOptionType) => void;
275
+ dynamicSelectFilterOption?: (inputValue: string, option: HostDefaultOptionType) => boolean;
276
+ style?: CSSProperties;
277
+ }
278
+ type CollectionRowMap = Record<string, object>;
279
+ type GetRowId<TRow = unknown> = (row: TRow, index: number) => string;
280
+ type RowInput = {
281
+ id: number;
282
+ values?: Record<string, unknown>;
283
+ collection?: string;
284
+ rowType?: string;
285
+ /** Host `TRow` reference (PR-82). Not deep-cloned. */
286
+ data?: unknown;
287
+ /** Stable id from `getRowId`. */
288
+ sourceId?: string;
289
+ };
290
+ type RowAccessControl = {
291
+ allowRoles?: string[];
292
+ denyRoles?: string[];
293
+ rule?: (ctx: {
294
+ actor: Actor;
295
+ table: Table;
296
+ row?: Row;
297
+ }) => boolean;
298
+ };
299
+ type CreateERPTableConfig<TRow = unknown> = {
300
+ /**
301
+ * Durable IndexedDB namespace. Omit for an in-memory grid (PR-83):
302
+ * no IndexedDB, `InMemoryEventStore`.
303
+ */
304
+ store?: string;
305
+ /**
306
+ * Table id. Omit and one is generated for this `createGrid` call
307
+ * (React: stable for the component lifetime).
308
+ */
309
+ tableKey?: string;
310
+ activeCollection?: string;
311
+ tableType?: string;
312
+ /**
313
+ * RBAC actor. Omit for `{ userId: 'anonymous', roles: ['admin'] }` (all access).
314
+ */
315
+ actor?: Actor;
316
+ rowAccess?: RowAccessControl;
317
+ /**
318
+ * ERP / legacy columns. Optional when `columnDefs` is set (PR-82).
319
+ * If both are set, `columns` wins.
320
+ * @deprecated Prefer `columnDefs` (D14). Remains working for ERP hosts.
321
+ */
322
+ columns?: HostColumnSchema[];
323
+ /**
324
+ * ERP / legacy rows. Optional when `rowData` is set (PR-82).
325
+ * If both are set, `rows` wins for the initial load.
326
+ * @deprecated Prefer `rowData` (D14). Remains working for ERP hosts.
327
+ */
328
+ rows?: RowInput[];
329
+ /**
330
+ * Host objects mapped to domain `Row` (PR-82 / D14).
331
+ * Each domain row keeps this object by reference (`row.data`).
332
+ */
333
+ rowData?: readonly TRow[];
334
+ /** Generic columns or nested groups. Mapped with `toColumnSchema` when `columns` is omitted. */
335
+ columnDefs?: ColDefOrGroup<NoInfer<TRow>>[];
336
+ /**
337
+ * Stable row identity. Default is the array index.
338
+ * Pass `(row) => String(row.id)` when the host has a real key.
339
+ */
340
+ getRowId?: GetRowId<NoInfer<TRow>>;
341
+ repo?: TableRepository;
342
+ /**
343
+ * Persistence strategy (requires `store`).
344
+ * - `'event-sourced'` (default): whole table in RAM, durable log in the
345
+ * EventStore, optional virtualization, sort/filter over every row.
346
+ * - `'paged-idb'`: arianERP document-grid mode. IndexedDB holds EVERY row
347
+ * (one record per row); RAM holds exactly one page window (heap is
348
+ * O(page), never O(rows)); pagination drives loading; delete-selected /
349
+ * select-all / search / save-snapshot stream from IndexedDB. Sort / filter
350
+ * / virtualization act on the current page only; for unbounded sets use
351
+ * `rowModelType: 'infinite'`.
352
+ */
353
+ persistence?: 'event-sourced' | 'paged-idb';
354
+ audit?: AuditLogger;
355
+ permissionPolicy?: PermissionPolicy;
356
+ tableHeight?: number;
357
+ recordPerPage?: number;
358
+ /** Used with `tableHeight` to derive pageSize. Default 40 (D12). */
359
+ rowHeight?: number;
360
+ /**
361
+ * Default `NoopRemoteApi` (D1) — no fetch, no ERP cookies.
362
+ * arianERP hosts import `FetchRemoteApi` from `persian-data-grid/adapters/arian-erp`.
363
+ */
364
+ remoteApi?: RemoteApi;
365
+ /**
366
+ * Override event store. Default: IndexedDbEventStore in the browser,
367
+ * InMemoryEventStore in Node/tests.
368
+ */
369
+ eventStore?: EventStore;
370
+ /**
371
+ * IndexedDB name prefix when `eventStore` is omitted (PR-80).
372
+ * Default `persian-data-grid-events` → `{prefix}:{store}`.
373
+ * 0.5.x databases used `erp-table-events` — pass that string (or
374
+ * `LEGACY_EVENT_STORE_PREFIX`) to keep existing local data.
375
+ */
376
+ eventStoreName?: string;
377
+ /**
378
+ * Online/offline detection (PR-137). Default: browser `navigator.onLine`.
379
+ * Inject a fake source in tests.
380
+ */
381
+ connectivity?: ConnectivitySource;
382
+ /**
383
+ * Optional sync transport (PR-138). When set, `GridSyncService` is wired and
384
+ * `api.sync()` / `<GridSyncPanel />` become available.
385
+ */
386
+ syncTransport?: SyncTransport;
387
+ /** Initial conflict policy when `syncTransport` is set (default lastWriteWins). */
388
+ syncConflictPolicy?: SyncConflictPolicy;
389
+ /**
390
+ * Presence transport (PR-139). When set (or `presence: true` for BroadcastChannel),
391
+ * peer cursors are tracked and `<GridPresencePanel />` works.
392
+ */
393
+ presenceTransport?: PresenceTransport;
394
+ /** Shorthand: enable BroadcastChannel presence for this table. */
395
+ presence?: boolean;
396
+ /** Display label for local peer (default actor.userId). */
397
+ presenceLabel?: string;
398
+ /**
399
+ * Opt-in aggregate snapshots (D7). Default stays dual-write repository only.
400
+ * When set, `SnapshotStrategy` snapshots every `snapshotEveryNEvents` (default 200)
401
+ * and `createGrid` runs catch-up on `grid.ready` (`last snapshot + events after version`).
402
+ */
403
+ snapshotStore?: SnapshotStore;
404
+ /** Snapshot cadence when `snapshotStore` is set. Default 200. */
405
+ snapshotEveryNEvents?: number;
406
+ /** Optional plugins (Excel/PDF export+import, …) registered at composition root. */
407
+ plugins?: readonly GridPlugin[];
408
+ /**
409
+ * Quick filter text (PR-93). Matching rows stay; others are hidden from the
410
+ * UI row index / pagination. Distinct from `GridSearchPanel` find-and-navigate.
411
+ * Updates after create: `api.setQuickFilter` / `controller.setQuickFilterText`.
412
+ */
413
+ quickFilterText?: string;
414
+ /**
415
+ * Single-level row grouping (PR-120 / RFC-002). Only the first column is
416
+ * active in 0.12.0; API accepts `string[]` for forward compatibility.
417
+ * Session-only — not EventStore. Updates: `api.setRowGroupColumns`.
418
+ */
419
+ groupBy?: string | readonly string[];
420
+ /**
421
+ * Whether row groups start expanded (PR-120). Default `true`.
422
+ */
423
+ groupDefaultExpanded?: boolean;
424
+ /**
425
+ * Start editing when a cell is activated (PR-126). Default `true`.
426
+ * When `false`, use Enter / F2 / double-click / `api.startEditingCell`.
427
+ */
428
+ singleClickEdit?: boolean;
429
+ /**
430
+ * Commit the draft when the grid loses focus / `stopEditing` (PR-126).
431
+ * Default `true`. Esc always cancels without writing EventStore.
432
+ */
433
+ stopEditingWhenCellsLoseFocus?: boolean;
434
+ /**
435
+ * `cell` (default) or `fullRow` — edit every editable column on the row (PR-126).
436
+ * Host `onRowValueChanged` still fires per committed cell change.
437
+ */
438
+ editType?: CellEditType;
439
+ /**
440
+ * When typed values become durable.
441
+ * - `'immediate'`: every editor change is written at once (the arianERP
442
+ * table contract): `getRowView`, totals, `computed` / `resolveOn`, host
443
+ * `onChange` code and saves always see what the user typed; `Esc` ends
444
+ * editing and keeps the value.
445
+ * - `'deferred'` (PR-126): typing edits a session draft, written on commit
446
+ * (move / Enter / Tab / focus leaves the grid / any durable read such as
447
+ * `getFullSnapShot`, `iterateRowsFromDb`, export, dispose); `Esc` discards.
448
+ *
449
+ * Default: `'immediate'` with `persistence: 'paged-idb'`, else `'deferred'`.
450
+ */
451
+ cellEditCommit?: CellEditCommit;
452
+ /**
453
+ * `Enter` on an active cell. `'nextCell'` (default): next editable cell of
454
+ * the row, then the next row; past the last row a new row is added
455
+ * (`Shift+Enter` goes back) — the data-entry behaviour of the 0.5 line /
456
+ * arianERP. `'down'`: commit and move to the cell below (spreadsheet style).
457
+ */
458
+ enterNavigation?: EnterNavigation;
459
+ /**
460
+ * Row model (PR-96). Default `clientSide`.
461
+ * `infinite` / `serverSide` skip local sort/filter and call `datasource.getRows`.
462
+ * Full block cache is PR-102.
463
+ */
464
+ rowModelType?: RowModelType;
465
+ /**
466
+ * Server/infinite row source (PR-96). Required when `rowModelType` is not
467
+ * `clientSide`.
468
+ */
469
+ datasource?: GridDatasource<NoInfer<TRow>>;
470
+ /** Rows per server cache block (PR-102). Default 100. */
471
+ cacheBlockSize?: number;
472
+ /** Max blocks kept in LRU cache (PR-102). Default 10. */
473
+ maxBlocksInCache?: number;
474
+ /**
475
+ * Clipboard copy uses formatted display strings when true (PR-106).
476
+ * Default false (raw values for Excel round-trip).
477
+ */
478
+ copyFormattedValue?: boolean;
479
+ /** Include column header row in clipboard output (PR-106). Default false. */
480
+ copyHeadersToClipboard?: boolean;
481
+ /**
482
+ * Convert eastern digits to ASCII in clipboard text (PR-106).
483
+ * Default true.
484
+ */
485
+ copyDigitsAsLatin?: boolean;
486
+ /** Override per-cell clipboard text (PR-106). */
487
+ processCellForClipboard?: ClipboardCopyBuildOptions['processCellForClipboard'];
488
+ /**
489
+ * When true (default), clipboard paste past the last row adds rows (PR-107).
490
+ */
491
+ pasteAddsRows?: boolean;
492
+ /** Fires before paste is applied; return false to cancel (PR-107). */
493
+ onClipboardPaste?: GridPasteRuntimeOptions['onClipboardPaste'];
494
+ /**
495
+ * Persist column layout (width, order, pin, hide, sort) to localStorage
496
+ * under this key and restore on next create (PR-115).
497
+ * When set, also emits `COLUMN_STATE_CHANGED` on the EventStore on change.
498
+ */
499
+ stateKey?: string;
500
+ };
501
+ type CreateERPTableResult<TRow = unknown> = {
502
+ engine: TableEngine;
503
+ controller: UITableController;
504
+ session: GridSession;
505
+ table: Table;
506
+ store: string;
507
+ tableKey: string;
508
+ columnMeta: Map<string, ColumnSchema>;
509
+ columnDefinitions: ColumnDefinition[];
510
+ columnBindings: ColumnViewBinding[];
511
+ eventStore: EventStore;
512
+ snapshotStrategy?: SnapshotStrategy;
513
+ changelogProjection: ChangelogProjection;
514
+ historyPanelViewModel: HistoryPanelViewModel;
515
+ cellUndoStack: CellUndoStack;
516
+ pluginHost: PluginHost;
517
+ api: GridApi<TRow>;
518
+ /** Online/offline + pending local mutations (PR-137). */
519
+ offlineStatus: OfflineStatus;
520
+ /** Cross-client sync when `syncTransport` was provided (PR-138). */
521
+ syncPort?: SyncPort;
522
+ /** Peer presence when `presence` / `presenceTransport` was set (PR-139). */
523
+ presencePort?: PresencePort;
524
+ };
525
+ /** Same shape as `CreateERPTableConfig` (D24). */
526
+ type CreateGridConfig<TRow = unknown> = CreateERPTableConfig<TRow>;
527
+ /**
528
+ * Handle returned immediately by `createGrid`.
529
+ * `engine` / `controller` / `session` / `api` are filled when `ready` resolves.
530
+ */
531
+ type CreateGridResult<TRow = unknown> = CreateERPTableResult<TRow> & {
532
+ readonly ready: Promise<CreateGridResult<TRow>>;
533
+ };
534
+
535
+ /**
536
+ * Catalog types that map to `onRowDataUpdated` (PR-85).
537
+ * Keep in sync with `EVENT_CATALOG` — do not invent a parallel bus.
538
+ */
539
+ declare const ROW_DATA_UPDATED_CATALOG_TYPES: readonly ["ROW_ADDED", "NEW_ROW_ADDED", "ROW_DELETED", "NEW_ROW_REMOVED", "ROW_RESTORED", "ROW_REORDERED"];
540
+ /** Single mapping table: EVENT_CATALOG token → React callback names. */
541
+ declare const CATALOG_TO_HOST_CALLBACKS: Readonly<Record<string, readonly string[]>>;
542
+ type CellValueChangedEvent<TRow = unknown> = {
543
+ oldValue: unknown;
544
+ newValue: unknown;
545
+ colId: string;
546
+ rowId: number;
547
+ data: TRow | undefined;
548
+ };
549
+ type RowValueChangedEvent<TRow = unknown> = {
550
+ rowId: number;
551
+ data: TRow | undefined;
552
+ };
553
+ type RowDataUpdatedEvent<TRow = unknown> = {
554
+ rowData: TRow[];
555
+ source: string;
556
+ };
557
+ type SelectionChangedEvent<TRow = unknown> = {
558
+ selectedRowIds: number[];
559
+ selectedRows: TRow[];
560
+ };
561
+ type CellFocusedEvent = {
562
+ rowId: number | null;
563
+ colId: string | null;
564
+ };
565
+ type CatalogHostEventHandlers<TRow = unknown> = {
566
+ onCellValueChanged?: (event: CellValueChangedEvent<TRow>) => void;
567
+ onRowValueChanged?: (event: RowValueChangedEvent<TRow>) => void;
568
+ onRowDataUpdated?: (event: RowDataUpdatedEvent<TRow>) => void;
569
+ };
570
+ type CatalogHostEventContext<TRow = unknown> = {
571
+ tableId: string;
572
+ getRowData: (rowId: number) => TRow | undefined;
573
+ getAllRowData: () => TRow[];
574
+ };
575
+ /**
576
+ * Map one `EVENT_CATALOG` GridEvent onto host React callbacks.
577
+ * Returns how many host notifications were emitted (0–2 for CELL_CHANGED).
578
+ */
579
+ declare function dispatchCatalogHostEvent<TRow = unknown>(event: GridEvent, ctx: CatalogHostEventContext<TRow>, handlers: CatalogHostEventHandlers<TRow>): number;
580
+ declare function subscribeCatalogHostEvents<TRow = unknown>(eventStore: EventStore, ctx: CatalogHostEventContext<TRow>, handlers: CatalogHostEventHandlers<TRow>): Unsubscribe;
581
+
582
+ /** Internal repo/event-store namespace when the host omits `store` (PR-83). */
583
+ declare const DEFAULT_MEMORY_STORE = "memory";
584
+ /** Actor used when the host omits `actor` — every permission check passes. */
585
+ declare const DEFAULT_GRID_ACTOR: Actor;
586
+ declare function createGridTableKey(): string;
587
+ type ResolvedGridIdentity = {
588
+ store: string;
589
+ tableKey: string;
590
+ actor: Actor;
591
+ persist: boolean;
592
+ };
593
+ /**
594
+ * Fill `store` / `tableKey` / `actor` when omitted.
595
+ * When `store` is set, identity is unchanged (PR-83: do not alter that path).
596
+ */
597
+ declare function resolveCreateGridDefaults(config: Pick<CreateERPTableConfig, 'store' | 'tableKey' | 'actor'>): ResolvedGridIdentity;
598
+
599
+ /**
600
+ * Sync composition root (D24). Returns immediately; EventStore / snapshot
601
+ * load runs in the background. Await `grid.ready` before using `engine` / `api`.
602
+ */
603
+ declare function createGrid<TRow = unknown>(config?: CreateGridConfig<TRow>): CreateGridResult<TRow>;
604
+ /**
605
+ * @deprecated Prefer {@link createGrid} (D24). `await createERPTable(cfg)` is
606
+ * equivalent to `await createGrid(cfg).ready`.
607
+ */
608
+ declare function createERPTable<TRow = unknown>(config?: CreateERPTableConfig<TRow>): Promise<CreateGridResult<TRow>>;
609
+
610
+ /**
611
+ * Maps host/legacy ColumnSchema into core ColumnDefinition + view bindings.
612
+ * Domain/runtime should prefer ColumnDefinition; React renderers stay in bindings.
613
+ */
614
+ declare function toColumnDefinition(schema: ColumnSchema): ColumnDefinition;
615
+ declare function toColumnViewBinding(schema: ColumnSchema): ColumnViewBinding;
616
+ declare function mapColumnSchemas(schemas: ColumnSchema[]): {
617
+ definitions: ColumnDefinition[];
618
+ bindings: ColumnViewBinding[];
619
+ };
620
+
621
+ /** Resolve the persisted column id (`colId` wins, then `field`). */
622
+ declare function columnDefFieldName<TRow, TValue = unknown>(def: ColumnDef<TRow, TValue>): string;
623
+ /**
624
+ * Generic `ColumnDef` → legacy/ERP `ColumnSchema`.
625
+ * Unmapped ColumnDef fields are stored on `schema.columnDef` for the reverse map.
626
+ */
627
+ declare function toColumnSchema<TRow, TValue = unknown>(def: ColumnDef<TRow, TValue>): ColumnSchema;
628
+ /**
629
+ * Legacy/ERP `ColumnSchema` → generic `ColumnDef`.
630
+ * `columnSchema` on the result is the source object so `toColumnSchema` is lossless.
631
+ */
632
+ declare function toColumnDef<TRow = unknown, TValue = unknown>(schema: ColumnSchema): ColumnDef<TRow, TValue> & {
633
+ columnSchema: ColumnSchema;
634
+ };
635
+ declare function mapColumnDefs<TRow>(defs: ColumnDef<TRow>[]): ColumnSchema[];
636
+ declare function mapColDefOrGroups<TRow>(items: ColDefOrGroup<TRow>[]): ColumnSchema[];
637
+ declare function mapColumnSchemasToDefs<TRow = unknown>(schemas: ColumnSchema[]): Array<ColumnDef<TRow> & {
638
+ columnSchema: ColumnSchema;
639
+ }>;
640
+
641
+ type Listener$1 = (event: GridEvent) => void;
642
+ declare class InMemoryEventStore implements EventStore {
643
+ private streams;
644
+ private globalLog;
645
+ private listeners;
646
+ private globalListeners;
647
+ append(streamId: string, events: GridEvent[], expectedVersion: number): Promise<AppendResult>;
648
+ read(streamId: string, fromVersion?: number): Promise<GridEvent[]>;
649
+ readAll(fromPosition?: number): Promise<GridEvent[]>;
650
+ subscribe(streamId: string, onEvent: Listener$1): Unsubscribe;
651
+ subscribeAll(onEvent: Listener$1): Unsubscribe;
652
+ getStreamVersion(streamId: string): number;
653
+ getGlobalPosition(): number;
654
+ }
655
+
656
+ /**
657
+ * Minimal async key-value backend so IndexedDbEventStore can run in Node tests
658
+ * without a real IndexedDB, and in browsers via an IDB adapter.
659
+ */
660
+ interface KvStore {
661
+ get<T = unknown>(key: string): Promise<T | undefined>;
662
+ put(key: string, value: unknown): Promise<void>;
663
+ delete(key: string): Promise<void>;
664
+ getAllKeys(): Promise<string[]>;
665
+ getAll<T = unknown>(): Promise<T[]>;
666
+ clear(): Promise<void>;
667
+ }
668
+ interface KvDatabase {
669
+ objectStore(name: string): KvStore;
670
+ /** Release the underlying connection (IndexedDB). Stored data is untouched. */
671
+ close?(): void;
672
+ }
673
+ declare class MemoryKvDatabase implements KvDatabase {
674
+ private stores;
675
+ objectStore(name: string): KvStore;
676
+ }
677
+ /**
678
+ * Browser IndexedDB adapter. Opens (or creates) a DB with the given object stores.
679
+ * Falls back callers should use MemoryKvDatabase in Node/tests.
680
+ */
681
+ declare function openIndexedDbDatabase(dbName: string, storeNames: string[], version?: number): Promise<KvDatabase>;
682
+
683
+ type Listener = (event: GridEvent) => void;
684
+ /**
685
+ * Durable EventStore backed by IndexedDB (or any KvDatabase).
686
+ * Same OCC contract as InMemoryEventStore.
687
+ */
688
+ declare class IndexedDbEventStore implements EventStore {
689
+ private readonly db;
690
+ private listeners;
691
+ private globalListeners;
692
+ private ready;
693
+ private closed;
694
+ private closePromise?;
695
+ private readonly inflight;
696
+ constructor(db: KvDatabase);
697
+ static open(dbName?: string): Promise<IndexedDbEventStore>;
698
+ /** Test / Node helper — durable API with in-memory persistence backend. */
699
+ static inMemory(): IndexedDbEventStore;
700
+ /**
701
+ * Release the IndexedDB connection (stored events are untouched). Waits for
702
+ * appends already in flight; appends started afterwards are dropped (they
703
+ * resolve `ok` without writing) because the owning grid is gone. Idempotent.
704
+ */
705
+ close(): Promise<void>;
706
+ append(streamId: string, events: GridEvent[], expectedVersion: number): Promise<AppendResult>;
707
+ private appendInternal;
708
+ read(streamId: string, fromVersion?: number): Promise<GridEvent[]>;
709
+ readAll(fromPosition?: number): Promise<GridEvent[]>;
710
+ subscribe(streamId: string, onEvent: Listener): Unsubscribe;
711
+ subscribeAll(onEvent: Listener): Unsubscribe;
712
+ }
713
+
714
+ /** Default IndexedDB database prefix (PR-80). */
715
+ declare const DEFAULT_EVENT_STORE_PREFIX = "persian-data-grid-events";
716
+ /**
717
+ * Prefix used by `persian-data-grid@0.5.x`.
718
+ * Pass as `eventStoreName` to keep reading existing local data.
719
+ */
720
+ declare const LEGACY_EVENT_STORE_PREFIX = "erp-table-events";
721
+ /** Full IndexedDB name: `{prefix}:{store}`. */
722
+ declare function eventStoreDbName(store: string, prefix?: string): string;
723
+
724
+ declare class InMemorySnapshotStore<TPayload = unknown> implements SnapshotStore<TPayload> {
725
+ private byStream;
726
+ save(snapshot: AggregateSnapshot<TPayload>): Promise<void>;
727
+ loadLatest(streamId: string): Promise<AggregateSnapshot<TPayload> | null>;
728
+ clear(streamId: string): Promise<void>;
729
+ }
730
+
731
+ /** Default RemoteApi — host injects FetchRemoteApi or a custom adapter. */
732
+ declare class NoopRemoteApi implements RemoteApi {
733
+ request<TResponse = unknown>(): Promise<TResponse>;
734
+ }
735
+
736
+ /**
737
+ * Plugin-facing event catalog (stable type tokens for subscribe / export plugins).
738
+ * Keep in sync with `application/events` and `domain/types/GridEvent`.
739
+ */
740
+ type EventCatalogEntry = {
741
+ readonly type: string;
742
+ readonly category: 'cell' | 'row' | 'column' | 'table' | 'view' | 'dynamic' | 'error' | 'plugin';
743
+ readonly undoable: boolean;
744
+ readonly description: string;
745
+ };
746
+ declare const EVENT_CATALOG: readonly EventCatalogEntry[];
747
+ declare function getEventCatalogEntry(type: string): EventCatalogEntry | undefined;
748
+ declare function listUndoableEventTypes(): string[];
749
+
750
+ /**
751
+ * Horizontal column window (PR-98).
752
+ * Variable-width columns via cumulative widths + binary search.
753
+ * Pinned columns are excluded from the scrollable slice (always rendered by the host).
754
+ */
755
+ type ColumnVisibleRange = {
756
+ /** Inclusive start into the scrollable-widths array. */
757
+ startIndex: number;
758
+ /** Exclusive end into the scrollable-widths array. */
759
+ endIndex: number;
760
+ /** px before the first visible scrollable column. */
761
+ spacerStart: number;
762
+ /** px after the last visible scrollable column. */
763
+ spacerEnd: number;
764
+ totalScrollableWidth: number;
765
+ visibleCount: number;
766
+ };
767
+ /** Prefix sums: `cum[i]` = sum(widths[0..i)). Length = widths.length + 1. */
768
+ declare function buildCumulativeWidths(widths: readonly number[]): number[];
769
+ /**
770
+ * @param scrollableWidths widths of non-pinned columns in document order
771
+ * @param scrollOffset absolute scroll from table inline-start (px)
772
+ * @param viewportSize visible width of the scrollport (px)
773
+ * @param pinnedStartWidth total width of inline-start pinned columns (px)
774
+ * @param overscan extra columns on each side
775
+ * @param pinnedEndWidth total width of inline-end pinned columns (px)
776
+ */
777
+ declare function calculateColumnViewport(scrollableWidths: readonly number[], scrollOffset: number, viewportSize: number, pinnedStartWidth?: number, overscan?: number, pinnedEndWidth?: number): ColumnVisibleRange;
778
+
779
+ /**
780
+ * Pure virtual-window calculator — no DOM / window / document.
781
+ * Vertical: totalRows + Viewport → VisibleRange.
782
+ * Horizontal (PR-98): scrollable widths + scroll → ColumnVisibleRange.
783
+ */
784
+ declare class ViewportCalculator {
785
+ static calculate(totalRows: number, viewport: Viewport): VisibleRange;
786
+ /** Contiguous index list for the visible window. */
787
+ static indices(range: VisibleRange): number[];
788
+ /** Slice a dense array by VisibleRange (O(window), not O(n)). */
789
+ static projectRows<T>(rows: readonly T[], range: VisibleRange): T[];
790
+ /**
791
+ * Project from sparse structure: ordered id list + Map by id.
792
+ * Suitable for 100k+ tables without materializing full UI rows.
793
+ */
794
+ static projectByIndex<T>(orderedIds: readonly number[], byId: ReadonlyMap<number, T>, range: VisibleRange): T[];
795
+ /** Horizontal column window (PR-98). */
796
+ static calculateColumns(scrollableWidths: readonly number[], scrollOffset: number, viewportSize: number, pinnedStartWidth?: number, overscan?: number, pinnedEndWidth?: number): ColumnVisibleRange;
797
+ static projectColumns<T>(items: readonly T[], range: ColumnVisibleRange): T[];
798
+ }
799
+
800
+ /**
801
+ * Column aggregation model (PR-118 / RFC-002). Pure — no React/DOM.
802
+ * Built-in aggs are incremental; money uses integer minor units (no float sum).
803
+ */
804
+
805
+ declare function isAggFuncName(value: unknown): value is AggFuncName;
806
+ declare function isCustomAggFunc(agg: AggFunc | undefined): agg is (values: readonly unknown[]) => unknown;
807
+ /**
808
+ * Coerce a cell value to integer minor units (rials).
809
+ * Rejects non-finite numbers; truncates toward zero (no float accumulation).
810
+ */
811
+ declare function toMinorUnits(value: unknown): number | null;
812
+ type AggAccumulator = {
813
+ kind: 'sum';
814
+ sum: number;
815
+ count: number;
816
+ } | {
817
+ kind: 'avg';
818
+ sum: number;
819
+ count: number;
820
+ } | {
821
+ kind: 'min';
822
+ min: number | null;
823
+ count: number;
824
+ } | {
825
+ kind: 'max';
826
+ max: number | null;
827
+ count: number;
828
+ } | {
829
+ kind: 'count';
830
+ count: number;
831
+ } | {
832
+ kind: 'first';
833
+ value: unknown;
834
+ set: boolean;
835
+ } | {
836
+ kind: 'last';
837
+ value: unknown;
838
+ set: boolean;
839
+ };
840
+ declare function createAccumulator(kind: AggFuncName): AggAccumulator;
841
+ /** Add one value into an accumulator. Returns 'rebuild' when min/max need a full pass. */
842
+ declare function accumulateAdd(acc: AggAccumulator, value: unknown): 'ok' | 'rebuild';
843
+ /** Remove one value from an accumulator (cell edit old value). */
844
+ declare function accumulateRemove(acc: AggAccumulator, value: unknown): 'ok' | 'rebuild';
845
+ declare function readAccumulator(acc: AggAccumulator): unknown;
846
+ /** Full (non-incremental) aggregate over a value list. */
847
+ declare function applyAgg(agg: AggFunc | undefined, values: readonly unknown[]): unknown;
848
+ type ColumnAggSpec = {
849
+ colId: string;
850
+ aggFunc: AggFunc;
851
+ };
852
+ /**
853
+ * Resolve which columns participate in footer aggregates (PR-119).
854
+ * - If any column declares `columnDef.aggFunc`, only those columns aggregate
855
+ * (columns without aggFunc stay empty — verify).
856
+ * - Else legacy: `price` / `number` columns default to `sum` (0.5.x hosts).
857
+ */
858
+ declare function resolveColumnAggSpecs(columns: readonly {
859
+ fieldName: string;
860
+ fieldType?: string;
861
+ columnDef?: {
862
+ aggFunc?: AggFunc;
863
+ } | undefined;
864
+ }[]): ColumnAggSpec[];
865
+ /**
866
+ * Incremental per-column aggregates (PR-118).
867
+ * Custom functions always rebuild; built-ins patch in O(1) when possible.
868
+ */
869
+ declare class ColumnAggIndex {
870
+ private readonly states;
871
+ private dirty;
872
+ invalidate(): void;
873
+ get isDirty(): boolean;
874
+ clear(): void;
875
+ /**
876
+ * Rebuild all tracked columns. `valuesFor` supplies current values per colId.
877
+ */
878
+ rebuild(specs: readonly ColumnAggSpec[], valuesFor: (colId: string) => readonly unknown[]): void;
879
+ /**
880
+ * O(1) patch for a cell change. Returns false if a rebuild is required.
881
+ */
882
+ patch(colId: string, oldValue: unknown, newValue: unknown): boolean;
883
+ get(colId: string): unknown;
884
+ toRecord(): Record<string, unknown>;
885
+ /** Numeric-only view for legacy footer (`Record<string, number>`). */
886
+ toNumberRecord(): Record<string, number>;
887
+ }
888
+
889
+ type QuickFilterBlobAccessor = {
890
+ /** Searchable cell values for one row (value + display, etc.). */
891
+ getParts: (rowId: number) => readonly unknown[];
892
+ };
893
+ /** Normalize query / cell text for quick filter (digits + ي/ك). */
894
+ declare function normalizeQuickFilterText(value: string): string;
895
+ /**
896
+ * Flatten row parts into one searchable blob (PR-93).
897
+ * Empty / null parts are skipped.
898
+ */
899
+ declare function buildQuickFilterBlob(parts: readonly unknown[]): string;
900
+ /**
901
+ * Per-row text cache + inverted token → rowIds (PR-93).
902
+ * Typing reuses blobs (no per-keystroke cell walk). Cell edits update one row.
903
+ */
904
+ declare class QuickFilterIndex {
905
+ private readonly blobs;
906
+ private readonly inverted;
907
+ clear(): void;
908
+ get size(): number;
909
+ getBlob(rowId: number): string;
910
+ rowIds(): IterableIterator<number>;
911
+ has(rowId: number): boolean;
912
+ removeRow(rowId: number): void;
913
+ setRow(rowId: number, parts: readonly unknown[]): void;
914
+ /** Rebuild from an ordered id list + accessor (full invalidate). */
915
+ rebuild(rowIds: readonly number[], accessor: QuickFilterBlobAccessor): void;
916
+ /**
917
+ * Candidate rows for one query part via inverted tokens (prefix / equality).
918
+ * Used to narrow before blob `includes` verification.
919
+ */
920
+ private candidatesForPart;
921
+ /**
922
+ * Filter `rowIds` whose cached blob contains every whitespace-separated
923
+ * query part (AND). Empty / blank query ⇒ shallow copy of `rowIds`.
924
+ */
925
+ filter(rowIds: readonly number[], quickFilterText: string | null | undefined): number[];
926
+ }
927
+ /**
928
+ * Pure quick filter over a blob getter (PR-93). Prefer {@link QuickFilterIndex}
929
+ * when filtering repeatedly (typing).
930
+ */
931
+ declare function applyQuickFilter(rowIds: readonly number[], quickFilterText: string | null | undefined, getBlob: ((rowId: number) => string) | QuickFilterIndex): number[];
932
+
933
+ /**
934
+ * Adapter: TableEngine → GridQueryPort for export plugins.
935
+ * When row grouping is active, projects the flat UI index (group + leaf).
936
+ */
937
+ declare function createEngineGridQuery(engine: TableEngine): GridQueryPort;
938
+
939
+ export { accumulateRemove as $, type AggAccumulator as A, type KvStore as B, CATALOG_TO_HOST_CALLBACKS as C, DEFAULT_EVENT_STORE_PREFIX as D, EVENT_CATALOG as E, QuickFilterIndex as F, type GetRowId as G, type HostColumnSchema as H, InMemoryEventStore as I, ROW_DATA_UPDATED_CATALOG_TYPES as J, type KvDatabase as K, LEGACY_EVENT_STORE_PREFIX as L, MemoryKvDatabase as M, NoopRemoteApi as N, type RequestExportOptions as O, PluginHost as P, type QuickFilterBlobAccessor as Q, type RowInput as R, type RequestImportOptions as S, type RowDataUpdatedEvent as T, type RowValueChangedEvent as U, type SelectionChangedEvent as V, type SnapshotStore as W, SnapshotStrategy as X, type StartEditingCellParams as Y, ViewportCalculator as Z, accumulateAdd as _, type AggregateSnapshot as a, applyAgg as a0, applyQuickFilter as a1, buildCumulativeWidths as a2, buildQuickFilterBlob as a3, calculateColumnViewport as a4, columnDefFieldName as a5, createAccumulator as a6, createERPTable as a7, createEngineGridQuery as a8, createGrid as a9, createGridApi as aa, createGridTableKey as ab, dispatchCatalogHostEvent as ac, eventStoreDbName as ad, getEventCatalogEntry as ae, isAggFuncName as af, isCustomAggFunc as ag, listUndoableEventTypes as ah, mapColumnDefs as ai, mapColumnSchemas as aj, mapColumnSchemasToDefs as ak, normalizeQuickFilterText as al, openIndexedDbDatabase as am, readAccumulator as an, resolveColumnAggSpecs as ao, resolveCreateGridDefaults as ap, subscribeCatalogHostEvents as aq, toColumnDef as ar, toColumnDefinition as as, toColumnSchema as at, toColumnViewBinding as au, toMinorUnits as av, type CatalogHostEventHandlers as aw, mapColDefOrGroups as ax, type CellFocusedEvent as b, type CellValueChangedEvent as c, type CollectionRowMap as d, ColumnAggIndex as e, type ColumnAggSpec as f, type ColumnDefinition as g, type ColumnViewBinding as h, type ColumnVisibleRange as i, type CreateERPTableConfig as j, type CreateERPTableResult as k, type CreateGridApiInput as l, type CreateGridConfig as m, type CreateGridResult as n, DEFAULT_GRID_ACTOR as o, DEFAULT_MEMORY_STORE as p, type EventCatalogEntry as q, type ExportDataAsExcelOptions as r, type GridApi as s, type GridColumnState as t, type GridDatasource as u, type GridDatasourceGetRowsParams as v, type GridDatasourceGetRowsResult as w, type GridRowNode as x, InMemorySnapshotStore as y, IndexedDbEventStore as z };