tinybase 7.0.0-beta.1 → 7.0.0-beta.3

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 (329) hide show
  1. package/@types/common/index.d.ts +1 -1
  2. package/@types/mergeable-store/index.d.ts +2 -1
  3. package/@types/mergeable-store/with-schemas/index.d.ts +5 -3
  4. package/@types/omni/index.d.ts +2 -0
  5. package/@types/omni/with-schemas/index.d.ts +2 -0
  6. package/@types/persisters/index.d.ts +4 -0
  7. package/@types/persisters/persister-automerge/index.d.ts +4 -6
  8. package/@types/persisters/persister-automerge/with-schemas/index.d.ts +7 -8
  9. package/@types/persisters/persister-browser/index.d.ts +97 -6
  10. package/@types/persisters/persister-browser/with-schemas/index.d.ts +113 -6
  11. package/@types/persisters/persister-cr-sqlite-wasm/index.d.ts +4 -0
  12. package/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.ts +7 -2
  13. package/@types/persisters/persister-durable-object-sql-storage/index.d.ts +6 -2
  14. package/@types/persisters/persister-durable-object-sql-storage/with-schemas/index.d.ts +5 -0
  15. package/@types/persisters/persister-durable-object-storage/index.d.ts +1 -2
  16. package/@types/persisters/persister-durable-object-storage/with-schemas/index.d.ts +3 -2
  17. package/@types/persisters/persister-electric-sql/index.d.ts +4 -0
  18. package/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +7 -2
  19. package/@types/persisters/persister-expo-sqlite/index.d.ts +5 -2
  20. package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.ts +7 -2
  21. package/@types/persisters/persister-file/index.d.ts +1 -2
  22. package/@types/persisters/persister-file/with-schemas/index.d.ts +3 -2
  23. package/@types/persisters/persister-indexed-db/with-schemas/index.d.ts +3 -2
  24. package/@types/persisters/persister-libsql/index.d.ts +4 -0
  25. package/@types/persisters/persister-libsql/with-schemas/index.d.ts +7 -2
  26. package/@types/persisters/persister-partykit-client/with-schemas/index.d.ts +3 -2
  27. package/@types/persisters/persister-pglite/index.d.ts +7 -3
  28. package/@types/persisters/persister-pglite/with-schemas/index.d.ts +9 -3
  29. package/@types/persisters/persister-postgres/index.d.ts +5 -2
  30. package/@types/persisters/persister-postgres/with-schemas/index.d.ts +7 -2
  31. package/@types/persisters/persister-powersync/index.d.ts +4 -0
  32. package/@types/persisters/persister-powersync/with-schemas/index.d.ts +7 -2
  33. package/@types/persisters/persister-react-native-mmkv/index.d.ts +117 -0
  34. package/@types/persisters/persister-react-native-mmkv/with-schemas/index.d.ts +133 -0
  35. package/@types/persisters/persister-react-native-sqlite/index.d.ts +184 -0
  36. package/@types/persisters/persister-react-native-sqlite/with-schemas/index.d.ts +207 -0
  37. package/@types/persisters/persister-remote/with-schemas/index.d.ts +3 -2
  38. package/@types/persisters/persister-sqlite-bun/index.d.ts +5 -2
  39. package/@types/persisters/persister-sqlite-bun/with-schemas/index.d.ts +7 -2
  40. package/@types/persisters/persister-sqlite-wasm/index.d.ts +6 -2
  41. package/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.ts +8 -2
  42. package/@types/persisters/persister-sqlite3/index.d.ts +5 -2
  43. package/@types/persisters/persister-sqlite3/with-schemas/index.d.ts +7 -2
  44. package/@types/persisters/persister-yjs/with-schemas/index.d.ts +3 -2
  45. package/@types/persisters/with-schemas/index.d.ts +4 -0
  46. package/@types/queries/index.d.ts +1 -1
  47. package/@types/queries/with-schemas/index.d.ts +4 -8
  48. package/@types/store/index.d.ts +34 -19
  49. package/@types/store/with-schemas/index.d.ts +28 -13
  50. package/@types/synchronizers/index.d.ts +1 -0
  51. package/@types/synchronizers/synchronizer-broadcast-channel/with-schemas/index.d.ts +3 -2
  52. package/@types/synchronizers/synchronizer-local/with-schemas/index.d.ts +3 -2
  53. package/@types/synchronizers/synchronizer-ws-client/index.d.ts +4 -2
  54. package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.ts +1 -0
  55. package/@types/synchronizers/synchronizer-ws-server/index.d.ts +7 -7
  56. package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +7 -7
  57. package/@types/synchronizers/synchronizer-ws-server-durable-object/index.d.ts +1 -0
  58. package/@types/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.d.ts +1 -0
  59. package/@types/synchronizers/synchronizer-ws-server-simple/index.d.ts +1 -1
  60. package/@types/synchronizers/synchronizer-ws-server-simple/with-schemas/index.d.ts +1 -1
  61. package/@types/synchronizers/with-schemas/index.d.ts +4 -2
  62. package/@types/ui-react/index.d.ts +6 -1
  63. package/@types/ui-react/with-schemas/index.d.ts +6 -1
  64. package/@types/ui-react-dom/index.d.ts +153 -20
  65. package/@types/ui-react-dom/with-schemas/index.d.ts +72 -20
  66. package/@types/ui-react-inspector/index.d.ts +8 -0
  67. package/@types/ui-react-inspector/with-schemas/index.d.ts +27 -1925
  68. package/agents.md +343 -0
  69. package/checkpoints/index.js +11 -6
  70. package/checkpoints/with-schemas/index.js +11 -6
  71. package/common/index.js +8 -4
  72. package/common/with-schemas/index.js +8 -4
  73. package/index.js +63 -31
  74. package/indexes/index.js +10 -5
  75. package/indexes/with-schemas/index.js +10 -5
  76. package/mergeable-store/index.js +54 -22
  77. package/mergeable-store/with-schemas/index.js +54 -22
  78. package/metrics/index.js +10 -5
  79. package/metrics/with-schemas/index.js +10 -5
  80. package/min/checkpoints/index.js +1 -1
  81. package/min/checkpoints/index.js.gz +0 -0
  82. package/min/checkpoints/with-schemas/index.js +1 -1
  83. package/min/checkpoints/with-schemas/index.js.gz +0 -0
  84. package/min/common/index.js +1 -1
  85. package/min/common/index.js.gz +0 -0
  86. package/min/common/with-schemas/index.js +1 -1
  87. package/min/common/with-schemas/index.js.gz +0 -0
  88. package/min/index.js +1 -1
  89. package/min/index.js.gz +0 -0
  90. package/min/indexes/index.js +1 -1
  91. package/min/indexes/index.js.gz +0 -0
  92. package/min/indexes/with-schemas/index.js +1 -1
  93. package/min/indexes/with-schemas/index.js.gz +0 -0
  94. package/min/mergeable-store/index.js +1 -1
  95. package/min/mergeable-store/index.js.gz +0 -0
  96. package/min/mergeable-store/with-schemas/index.js +1 -1
  97. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  98. package/min/metrics/index.js +1 -1
  99. package/min/metrics/index.js.gz +0 -0
  100. package/min/metrics/with-schemas/index.js +1 -1
  101. package/min/metrics/with-schemas/index.js.gz +0 -0
  102. package/min/omni/index.js +1 -1
  103. package/min/omni/index.js.gz +0 -0
  104. package/min/omni/with-schemas/index.js +1 -1
  105. package/min/omni/with-schemas/index.js.gz +0 -0
  106. package/min/persisters/index.js +1 -1
  107. package/min/persisters/index.js.gz +0 -0
  108. package/min/persisters/persister-automerge/index.js +1 -1
  109. package/min/persisters/persister-automerge/index.js.gz +0 -0
  110. package/min/persisters/persister-automerge/with-schemas/index.js +1 -1
  111. package/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
  112. package/min/persisters/persister-browser/index.js +1 -1
  113. package/min/persisters/persister-browser/index.js.gz +0 -0
  114. package/min/persisters/persister-browser/with-schemas/index.js +1 -1
  115. package/min/persisters/persister-browser/with-schemas/index.js.gz +0 -0
  116. package/min/persisters/persister-cr-sqlite-wasm/index.js +1 -1
  117. package/min/persisters/persister-cr-sqlite-wasm/index.js.gz +0 -0
  118. package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1 -1
  119. package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js.gz +0 -0
  120. package/min/persisters/persister-durable-object-sql-storage/index.js +1 -1
  121. package/min/persisters/persister-durable-object-sql-storage/index.js.gz +0 -0
  122. package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js +1 -1
  123. package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js.gz +0 -0
  124. package/min/persisters/persister-durable-object-storage/index.js +1 -1
  125. package/min/persisters/persister-durable-object-storage/index.js.gz +0 -0
  126. package/min/persisters/persister-durable-object-storage/with-schemas/index.js +1 -1
  127. package/min/persisters/persister-durable-object-storage/with-schemas/index.js.gz +0 -0
  128. package/min/persisters/persister-electric-sql/index.js +1 -1
  129. package/min/persisters/persister-electric-sql/index.js.gz +0 -0
  130. package/min/persisters/persister-electric-sql/with-schemas/index.js +1 -1
  131. package/min/persisters/persister-electric-sql/with-schemas/index.js.gz +0 -0
  132. package/min/persisters/persister-expo-sqlite/index.js +1 -1
  133. package/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
  134. package/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
  135. package/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
  136. package/min/persisters/persister-file/index.js +1 -1
  137. package/min/persisters/persister-file/index.js.gz +0 -0
  138. package/min/persisters/persister-file/with-schemas/index.js +1 -1
  139. package/min/persisters/persister-file/with-schemas/index.js.gz +0 -0
  140. package/min/persisters/persister-indexed-db/index.js +1 -1
  141. package/min/persisters/persister-indexed-db/index.js.gz +0 -0
  142. package/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
  143. package/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
  144. package/min/persisters/persister-libsql/index.js +1 -1
  145. package/min/persisters/persister-libsql/index.js.gz +0 -0
  146. package/min/persisters/persister-libsql/with-schemas/index.js +1 -1
  147. package/min/persisters/persister-libsql/with-schemas/index.js.gz +0 -0
  148. package/min/persisters/persister-partykit-client/index.js +1 -1
  149. package/min/persisters/persister-partykit-client/index.js.gz +0 -0
  150. package/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
  151. package/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
  152. package/min/persisters/persister-partykit-server/index.js +1 -1
  153. package/min/persisters/persister-partykit-server/index.js.gz +0 -0
  154. package/min/persisters/persister-partykit-server/with-schemas/index.js +1 -1
  155. package/min/persisters/persister-partykit-server/with-schemas/index.js.gz +0 -0
  156. package/min/persisters/persister-pglite/index.js +1 -1
  157. package/min/persisters/persister-pglite/index.js.gz +0 -0
  158. package/min/persisters/persister-pglite/with-schemas/index.js +1 -1
  159. package/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
  160. package/min/persisters/persister-postgres/index.js +1 -1
  161. package/min/persisters/persister-postgres/index.js.gz +0 -0
  162. package/min/persisters/persister-postgres/with-schemas/index.js +1 -1
  163. package/min/persisters/persister-postgres/with-schemas/index.js.gz +0 -0
  164. package/min/persisters/persister-powersync/index.js +1 -1
  165. package/min/persisters/persister-powersync/index.js.gz +0 -0
  166. package/min/persisters/persister-powersync/with-schemas/index.js +1 -1
  167. package/min/persisters/persister-powersync/with-schemas/index.js.gz +0 -0
  168. package/min/persisters/persister-react-native-mmkv/index.js +1 -0
  169. package/min/persisters/persister-react-native-mmkv/index.js.gz +0 -0
  170. package/min/persisters/persister-react-native-mmkv/with-schemas/index.js +1 -0
  171. package/min/persisters/persister-react-native-mmkv/with-schemas/index.js.gz +0 -0
  172. package/min/persisters/persister-react-native-sqlite/index.js +1 -0
  173. package/min/persisters/persister-react-native-sqlite/index.js.gz +0 -0
  174. package/min/persisters/persister-react-native-sqlite/with-schemas/index.js +1 -0
  175. package/min/persisters/persister-react-native-sqlite/with-schemas/index.js.gz +0 -0
  176. package/min/persisters/persister-remote/index.js +1 -1
  177. package/min/persisters/persister-remote/index.js.gz +0 -0
  178. package/min/persisters/persister-remote/with-schemas/index.js +1 -1
  179. package/min/persisters/persister-remote/with-schemas/index.js.gz +0 -0
  180. package/min/persisters/persister-sqlite-bun/index.js +1 -1
  181. package/min/persisters/persister-sqlite-bun/index.js.gz +0 -0
  182. package/min/persisters/persister-sqlite-bun/with-schemas/index.js +1 -1
  183. package/min/persisters/persister-sqlite-bun/with-schemas/index.js.gz +0 -0
  184. package/min/persisters/persister-sqlite-wasm/index.js +1 -1
  185. package/min/persisters/persister-sqlite-wasm/index.js.gz +0 -0
  186. package/min/persisters/persister-sqlite-wasm/with-schemas/index.js +1 -1
  187. package/min/persisters/persister-sqlite-wasm/with-schemas/index.js.gz +0 -0
  188. package/min/persisters/persister-sqlite3/index.js +1 -1
  189. package/min/persisters/persister-sqlite3/index.js.gz +0 -0
  190. package/min/persisters/persister-sqlite3/with-schemas/index.js +1 -1
  191. package/min/persisters/persister-sqlite3/with-schemas/index.js.gz +0 -0
  192. package/min/persisters/persister-yjs/index.js +1 -1
  193. package/min/persisters/persister-yjs/index.js.gz +0 -0
  194. package/min/persisters/persister-yjs/with-schemas/index.js +1 -1
  195. package/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
  196. package/min/persisters/with-schemas/index.js +1 -1
  197. package/min/persisters/with-schemas/index.js.gz +0 -0
  198. package/min/queries/index.js +1 -1
  199. package/min/queries/index.js.gz +0 -0
  200. package/min/queries/with-schemas/index.js +1 -1
  201. package/min/queries/with-schemas/index.js.gz +0 -0
  202. package/min/relationships/index.js +1 -1
  203. package/min/relationships/index.js.gz +0 -0
  204. package/min/relationships/with-schemas/index.js +1 -1
  205. package/min/relationships/with-schemas/index.js.gz +0 -0
  206. package/min/store/index.js +1 -1
  207. package/min/store/index.js.gz +0 -0
  208. package/min/store/with-schemas/index.js +1 -1
  209. package/min/store/with-schemas/index.js.gz +0 -0
  210. package/min/synchronizers/index.js +1 -1
  211. package/min/synchronizers/index.js.gz +0 -0
  212. package/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
  213. package/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
  214. package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
  215. package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
  216. package/min/synchronizers/synchronizer-local/index.js +1 -1
  217. package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
  218. package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  219. package/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
  220. package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  221. package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  222. package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  223. package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  224. package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  225. package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  226. package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  227. package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  228. package/min/synchronizers/synchronizer-ws-server-durable-object/index.js +1 -1
  229. package/min/synchronizers/synchronizer-ws-server-durable-object/index.js.gz +0 -0
  230. package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +1 -1
  231. package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js.gz +0 -0
  232. package/min/synchronizers/synchronizer-ws-server-simple/index.js +1 -1
  233. package/min/synchronizers/synchronizer-ws-server-simple/index.js.gz +0 -0
  234. package/min/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js +1 -1
  235. package/min/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js.gz +0 -0
  236. package/min/synchronizers/with-schemas/index.js +1 -1
  237. package/min/synchronizers/with-schemas/index.js.gz +0 -0
  238. package/min/ui-react/index.js +1 -1
  239. package/min/ui-react/index.js.gz +0 -0
  240. package/min/ui-react/with-schemas/index.js +1 -1
  241. package/min/ui-react/with-schemas/index.js.gz +0 -0
  242. package/min/ui-react-dom/index.js +1 -1
  243. package/min/ui-react-dom/index.js.gz +0 -0
  244. package/min/ui-react-dom/with-schemas/index.js +1 -1
  245. package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
  246. package/min/ui-react-inspector/index.js +1 -1
  247. package/min/ui-react-inspector/index.js.gz +0 -0
  248. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  249. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  250. package/min/with-schemas/index.js +1 -1
  251. package/min/with-schemas/index.js.gz +0 -0
  252. package/omni/index.js +2178 -1203
  253. package/omni/with-schemas/index.js +2178 -1203
  254. package/package.json +91 -11
  255. package/persisters/index.js +16 -10
  256. package/persisters/persister-automerge/index.js +15 -9
  257. package/persisters/persister-automerge/with-schemas/index.js +15 -9
  258. package/persisters/persister-browser/index.js +41 -9
  259. package/persisters/persister-browser/with-schemas/index.js +41 -9
  260. package/persisters/persister-cr-sqlite-wasm/index.js +16 -10
  261. package/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +16 -10
  262. package/persisters/persister-durable-object-sql-storage/index.js +16 -10
  263. package/persisters/persister-durable-object-sql-storage/with-schemas/index.js +16 -10
  264. package/persisters/persister-durable-object-storage/index.js +14 -8
  265. package/persisters/persister-durable-object-storage/with-schemas/index.js +14 -8
  266. package/persisters/persister-electric-sql/index.js +16 -10
  267. package/persisters/persister-electric-sql/with-schemas/index.js +16 -10
  268. package/persisters/persister-expo-sqlite/index.js +16 -10
  269. package/persisters/persister-expo-sqlite/with-schemas/index.js +16 -10
  270. package/persisters/persister-file/index.js +14 -8
  271. package/persisters/persister-file/with-schemas/index.js +14 -8
  272. package/persisters/persister-indexed-db/index.js +14 -8
  273. package/persisters/persister-indexed-db/with-schemas/index.js +14 -8
  274. package/persisters/persister-libsql/index.js +16 -10
  275. package/persisters/persister-libsql/with-schemas/index.js +16 -10
  276. package/persisters/persister-partykit-client/index.js +14 -8
  277. package/persisters/persister-partykit-client/with-schemas/index.js +14 -8
  278. package/persisters/persister-partykit-server/index.js +7 -3
  279. package/persisters/persister-partykit-server/with-schemas/index.js +7 -3
  280. package/persisters/persister-pglite/index.js +15 -9
  281. package/persisters/persister-pglite/with-schemas/index.js +15 -9
  282. package/persisters/persister-postgres/index.js +15 -9
  283. package/persisters/persister-postgres/with-schemas/index.js +15 -9
  284. package/persisters/persister-powersync/index.js +16 -10
  285. package/persisters/persister-powersync/with-schemas/index.js +16 -10
  286. package/persisters/persister-react-native-mmkv/index.js +465 -0
  287. package/persisters/persister-react-native-mmkv/with-schemas/index.js +465 -0
  288. package/persisters/persister-react-native-sqlite/index.js +1195 -0
  289. package/persisters/persister-react-native-sqlite/with-schemas/index.js +1195 -0
  290. package/persisters/persister-remote/index.js +16 -10
  291. package/persisters/persister-remote/with-schemas/index.js +16 -10
  292. package/persisters/persister-sqlite-bun/index.js +16 -10
  293. package/persisters/persister-sqlite-bun/with-schemas/index.js +16 -10
  294. package/persisters/persister-sqlite-wasm/index.js +16 -10
  295. package/persisters/persister-sqlite-wasm/with-schemas/index.js +16 -10
  296. package/persisters/persister-sqlite3/index.js +16 -10
  297. package/persisters/persister-sqlite3/with-schemas/index.js +16 -10
  298. package/persisters/persister-yjs/index.js +20 -12
  299. package/persisters/persister-yjs/with-schemas/index.js +20 -12
  300. package/persisters/with-schemas/index.js +16 -10
  301. package/queries/index.js +20 -12
  302. package/queries/with-schemas/index.js +20 -12
  303. package/readme.md +13 -13
  304. package/relationships/index.js +10 -5
  305. package/relationships/with-schemas/index.js +10 -5
  306. package/releases.md +179 -41
  307. package/store/index.js +50 -18
  308. package/store/with-schemas/index.js +50 -18
  309. package/synchronizers/index.js +16 -10
  310. package/synchronizers/synchronizer-broadcast-channel/index.js +17 -11
  311. package/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +17 -11
  312. package/synchronizers/synchronizer-local/index.js +17 -11
  313. package/synchronizers/synchronizer-local/with-schemas/index.js +17 -11
  314. package/synchronizers/synchronizer-ws-client/index.js +16 -10
  315. package/synchronizers/synchronizer-ws-client/with-schemas/index.js +16 -10
  316. package/synchronizers/synchronizer-ws-server/index.js +16 -10
  317. package/synchronizers/synchronizer-ws-server/with-schemas/index.js +16 -10
  318. package/synchronizers/synchronizer-ws-server-durable-object/index.js +16 -10
  319. package/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +16 -10
  320. package/synchronizers/synchronizer-ws-server-simple/index.js +8 -4
  321. package/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js +8 -4
  322. package/synchronizers/with-schemas/index.js +16 -10
  323. package/ui-react/index.js +408 -374
  324. package/ui-react/with-schemas/index.js +408 -374
  325. package/ui-react-dom/index.js +883 -437
  326. package/ui-react-dom/with-schemas/index.js +883 -437
  327. package/ui-react-inspector/index.js +1761 -556
  328. package/ui-react-inspector/with-schemas/index.js +1761 -556
  329. package/with-schemas/index.js +63 -31
@@ -1,69 +1,102 @@
1
1
  import React from 'react';
2
2
  import {Fragment, jsx, jsxs} from 'react/jsx-runtime';
3
- import {
4
- CellView,
5
- ResultCellView,
6
- useCell,
7
- useIndexesOrIndexesById,
8
- useRelationshipsOrRelationshipsById,
9
- useRemoteRowId,
10
- useResultRowCount,
11
- useResultRowIds,
12
- useResultSortedRowIds,
13
- useResultTableCellIds,
14
- useRowCount,
15
- useRowIds,
16
- useSetCellCallback,
17
- useSetValueCallback,
18
- useSliceRowIds,
19
- useSortedRowIds,
20
- useStoreOrStoreById,
21
- useTableCellIds,
22
- useValue,
23
- useValueIds,
24
- ValueView,
25
- } from '../../ui-react/with-schemas/index.js';
3
+ import {CellView, ResultCellView, ValueView} from '../../ui-react/with-schemas/index.js';
26
4
 
27
5
  const getTypeOf = (thing) => typeof thing;
6
+ const TINYBASE = 'tinybase';
28
7
  const EMPTY_STRING = '';
29
8
  const DOT = '.';
30
9
  const STRING = getTypeOf(EMPTY_STRING);
31
10
  const BOOLEAN = getTypeOf(true);
32
11
  const NUMBER = getTypeOf(0);
12
+ const FUNCTION = getTypeOf(getTypeOf);
13
+ const LISTENER = 'Listener';
14
+ const RESULT = 'Result';
15
+ const GET = 'get';
16
+ const SET = 'set';
17
+ const ADD = 'add';
18
+ const HAS = 'Has';
19
+ const _HAS = 'has';
20
+ const IDS = 'Ids';
21
+ const TABLE = 'Table';
22
+ const ROW = 'Row';
23
+ const ROW_COUNT = ROW + 'Count';
24
+ const ROW_IDS = ROW + IDS;
25
+ const SORTED_ROW_IDS = 'Sorted' + ROW + IDS;
33
26
  const CELL = 'Cell';
27
+ const CELL_IDS = CELL + IDS;
34
28
  const VALUE = 'Value';
29
+ const VALUE_IDS = VALUE + IDS;
30
+ const SLICE = 'Slice';
31
+ const REMOTE_ROW_ID = 'Remote' + ROW + 'Id';
35
32
  const CURRENT_TARGET = 'currentTarget';
36
33
  const _VALUE = 'value';
34
+ const EXTRA = 'extra';
37
35
  const strSplit = (str, separator = EMPTY_STRING, limit) =>
38
36
  str.split(separator, limit);
39
37
 
38
+ const getIfNotFunction =
39
+ (predicate = isNullish) =>
40
+ (value, then, otherwise) =>
41
+ predicate(value) ? otherwise?.() : then(value);
42
+ const GLOBAL = globalThis;
40
43
  const math = Math;
41
44
  const mathMin = math.min;
42
45
  const isFiniteNumber = isFinite;
43
- const isUndefined = (thing) => thing == void 0;
46
+ const isNullish = (thing) => thing == null;
47
+ const isUndefined = (thing) => thing === void 0;
48
+ const isNull = (thing) => thing === null;
49
+ const ifNotNullish = getIfNotFunction(isNullish);
50
+ const ifNotUndefined = getIfNotFunction(isUndefined);
44
51
  const isTypeStringOrBoolean = (type) => type == STRING || type == BOOLEAN;
45
52
  const isString = (thing) => getTypeOf(thing) == STRING;
53
+ const isFunction = (thing) => getTypeOf(thing) == FUNCTION;
46
54
  const isArray = (thing) => Array.isArray(thing);
55
+ const size = (arrayOrString) => arrayOrString.length;
56
+ const getUndefined = () => void 0;
47
57
 
58
+ const arrayEvery = (array, cb) => array.every(cb);
59
+ const arrayIsEqual = (array1, array2) =>
60
+ size(array1) === size(array2) &&
61
+ arrayEvery(array1, (value1, index) => array2[index] === value1);
48
62
  const arrayMap = (array, cb) => array.map(cb);
49
-
50
- const getCellOrValueType = (cellOrValue) => {
51
- const type = getTypeOf(cellOrValue);
52
- return isTypeStringOrBoolean(type) ||
53
- (type == NUMBER && isFiniteNumber(cellOrValue))
54
- ? type
55
- : void 0;
56
- };
57
- const getTypeCase = (type, stringCase, numberCase, booleanCase) =>
58
- type == STRING ? stringCase : type == NUMBER ? numberCase : booleanCase;
63
+ const arrayFilter = (array, cb) => array.filter(cb);
59
64
 
60
65
  const object = Object;
66
+ const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
61
67
  const objEntries = object.entries;
68
+ const isObject = (obj) =>
69
+ !isNullish(obj) &&
70
+ ifNotNullish(
71
+ getPrototypeOf(obj),
72
+ (objPrototype) =>
73
+ objPrototype == object.prototype ||
74
+ isNullish(getPrototypeOf(objPrototype)),
75
+
76
+ /* istanbul ignore next */
77
+ () => true,
78
+ );
79
+ const objIds = object.keys;
62
80
  const objNew = (entries = []) => object.fromEntries(entries);
81
+ const objGet = (obj, id) => ifNotUndefined(obj, (obj2) => obj2[id]);
63
82
  const objToArray = (obj, cb) =>
64
83
  arrayMap(objEntries(obj), ([id, value]) => cb(value, id));
65
84
  const objMap = (obj, cb) =>
66
85
  objNew(objToArray(obj, (value, id) => [id, cb(value, id)]));
86
+ const objSize = (obj) => size(objIds(obj));
87
+ const objIsEqual = (obj1, obj2) => {
88
+ const entries1 = objEntries(obj1);
89
+ return (
90
+ size(entries1) === objSize(obj2) &&
91
+ arrayEvery(entries1, ([index, value1]) =>
92
+ isObject(value1)
93
+ ? isObject(obj2[index])
94
+ ? objIsEqual(obj2[index], value1)
95
+ : false
96
+ : obj2[index] === value1,
97
+ )
98
+ );
99
+ };
67
100
 
68
101
  const {
69
102
  PureComponent,
@@ -91,13 +124,305 @@ const getIndexStoreTableId = (indexes, indexId) => [
91
124
  indexes?.getTableId(indexId),
92
125
  ];
93
126
 
94
- const EDITABLE = 'editable';
95
- const LEFT_ARROW = '\u2190';
96
- const UP_ARROW = '\u2191';
97
- const RIGHT_ARROW = '\u2192';
98
- const DOWN_ARROW = '\u2193';
99
- const useDottedCellIds = (tableId, store) =>
100
- arrayMap(useTableCellIds(tableId, store), (cellId) => tableId + DOT + cellId);
127
+ const TINYBASE_CONTEXT = TINYBASE + '_uirc';
128
+ const Context = GLOBAL[TINYBASE_CONTEXT]
129
+ ? /* istanbul ignore next */
130
+ GLOBAL[TINYBASE_CONTEXT]
131
+ : (GLOBAL[TINYBASE_CONTEXT] = createContext([]));
132
+ const useThing = (id, offset) => {
133
+ const contextValue = useContext(Context);
134
+ return isUndefined(id)
135
+ ? contextValue[offset * 2]
136
+ : isString(id)
137
+ ? objGet(contextValue[offset * 2 + 1], id)
138
+ : id;
139
+ };
140
+ const useThingOrThingById = (thingOrThingId, offset) => {
141
+ const thing = useThing(thingOrThingId, offset);
142
+ return isUndefined(thingOrThingId) || isString(thingOrThingId)
143
+ ? thing
144
+ : thingOrThingId;
145
+ };
146
+
147
+ const OFFSET_STORE = 0;
148
+ const OFFSET_INDEXES = 2;
149
+ const OFFSET_RELATIONSHIPS = 3;
150
+ const OFFSET_QUERIES = 4;
151
+
152
+ const EMPTY_ARRAY = [];
153
+ const DEFAULTS = [{}, [], [EMPTY_ARRAY, void 0, EMPTY_ARRAY], void 0, false, 0];
154
+ const IS_EQUALS = [
155
+ objIsEqual,
156
+ arrayIsEqual,
157
+ (
158
+ [backwardIds1, currentId1, forwardIds1],
159
+ [backwardIds2, currentId2, forwardIds2],
160
+ ) =>
161
+ currentId1 === currentId2 &&
162
+ arrayIsEqual(backwardIds1, backwardIds2) &&
163
+ arrayIsEqual(forwardIds1, forwardIds2),
164
+ ];
165
+ const isEqual = (thing1, thing2) => thing1 === thing2;
166
+ const addAndDelListener = (thing, listenable, ...args) => {
167
+ const listenerId = thing?.[ADD + listenable + LISTENER]?.(...args);
168
+ return () => thing?.delListener?.(listenerId);
169
+ };
170
+ const useListenable = (listenable, thing, returnType, args = EMPTY_ARRAY) => {
171
+ const lastResult = useRef(DEFAULTS[returnType]);
172
+ const getResult = useCallback(
173
+ () => {
174
+ const nextResult =
175
+ thing?.[(returnType == 4 /* Boolean */ ? _HAS : GET) + listenable]?.(
176
+ ...args,
177
+ ) ?? DEFAULTS[returnType];
178
+ return !(IS_EQUALS[returnType] ?? isEqual)(nextResult, lastResult.current)
179
+ ? (lastResult.current = nextResult)
180
+ : lastResult.current;
181
+ },
182
+ /* eslint-disable-next-line react-hooks/exhaustive-deps */
183
+ [thing, returnType, listenable, ...args],
184
+ );
185
+ const subscribe = useCallback(
186
+ (listener) =>
187
+ addAndDelListener(
188
+ thing,
189
+ (returnType == 4 /* Boolean */ ? HAS : EMPTY_STRING) + listenable,
190
+ ...args,
191
+ listener,
192
+ ),
193
+ /* eslint-disable-next-line react-hooks/exhaustive-deps */
194
+ [thing, returnType, listenable, ...args],
195
+ );
196
+ return useSyncExternalStore(subscribe, getResult, getResult);
197
+ };
198
+ const useSetCallback = (
199
+ storeOrStoreId,
200
+ settable,
201
+ get,
202
+ getDeps = EMPTY_ARRAY,
203
+ then = getUndefined,
204
+ thenDeps = EMPTY_ARRAY,
205
+ ...args
206
+ ) => {
207
+ const store = useStoreOrStoreById(storeOrStoreId);
208
+ return useCallback(
209
+ (parameter) =>
210
+ ifNotUndefined(store, (store2) =>
211
+ ifNotUndefined(get(parameter, store2), (thing) =>
212
+ then(
213
+ store2[SET + settable](
214
+ ...argsOrGetArgs(args, store2, parameter),
215
+ thing,
216
+ ),
217
+ thing,
218
+ ),
219
+ ),
220
+ ),
221
+ // eslint-disable-next-line react-hooks/exhaustive-deps
222
+ [store, settable, ...getDeps, ...thenDeps, ...nonFunctionDeps(args)],
223
+ );
224
+ };
225
+ const argsOrGetArgs = (args, store, parameter) =>
226
+ arrayMap(args, (arg) => (isFunction(arg) ? arg(parameter, store) : arg));
227
+ const nonFunctionDeps = (args) => arrayFilter(args, (arg) => !isFunction(arg));
228
+ const useSortedRowIdsImpl = (
229
+ tableId,
230
+ cellId,
231
+ descending,
232
+ offset,
233
+ limit,
234
+ storeOrStoreId,
235
+ ) =>
236
+ useListenable(
237
+ SORTED_ROW_IDS,
238
+ useStoreOrStoreById(storeOrStoreId),
239
+ 1 /* Array */,
240
+ [tableId, cellId, descending, offset, limit],
241
+ );
242
+ const useStoreOrStoreById = (storeOrStoreId) =>
243
+ useThingOrThingById(storeOrStoreId, OFFSET_STORE);
244
+ const useTableCellIds = (tableId, storeOrStoreId) =>
245
+ useListenable(
246
+ TABLE + CELL_IDS,
247
+ useStoreOrStoreById(storeOrStoreId),
248
+ 1 /* Array */,
249
+ [tableId],
250
+ );
251
+ const useRowCount = (tableId, storeOrStoreId) =>
252
+ useListenable(
253
+ ROW_COUNT,
254
+ useStoreOrStoreById(storeOrStoreId),
255
+ 5 /* Number */,
256
+ [tableId],
257
+ );
258
+ const useRowIds = (tableId, storeOrStoreId) =>
259
+ useListenable(ROW_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */, [
260
+ tableId,
261
+ ]);
262
+ const useSortedRowIds = (
263
+ tableIdOrArgs,
264
+ cellIdOrStoreOrStoreId,
265
+ descending,
266
+ offset,
267
+ limit,
268
+ storeOrStoreId,
269
+ ) =>
270
+ useSortedRowIdsImpl(
271
+ ...(isObject(tableIdOrArgs)
272
+ ? [
273
+ tableIdOrArgs.tableId,
274
+ tableIdOrArgs.cellId,
275
+ tableIdOrArgs.descending ?? false,
276
+ tableIdOrArgs.offset ?? 0,
277
+ tableIdOrArgs.limit,
278
+ cellIdOrStoreOrStoreId,
279
+ ]
280
+ : [
281
+ tableIdOrArgs,
282
+ cellIdOrStoreOrStoreId,
283
+ descending,
284
+ offset,
285
+ limit,
286
+ storeOrStoreId,
287
+ ]),
288
+ );
289
+ const useCell = (tableId, rowId, cellId, storeOrStoreId) =>
290
+ useListenable(
291
+ CELL,
292
+ useStoreOrStoreById(storeOrStoreId),
293
+ 3 /* CellOrValue */,
294
+ [tableId, rowId, cellId],
295
+ );
296
+ const useValueIds = (storeOrStoreId) =>
297
+ useListenable(VALUE_IDS, useStoreOrStoreById(storeOrStoreId), 1 /* Array */);
298
+ const useValue = (valueId, storeOrStoreId) =>
299
+ useListenable(
300
+ VALUE,
301
+ useStoreOrStoreById(storeOrStoreId),
302
+ 3 /* CellOrValue */,
303
+ [valueId],
304
+ );
305
+ const useSetCellCallback = (
306
+ tableId,
307
+ rowId,
308
+ cellId,
309
+ getCell,
310
+ getCellDeps,
311
+ storeOrStoreId,
312
+ then,
313
+ thenDeps,
314
+ ) =>
315
+ useSetCallback(
316
+ storeOrStoreId,
317
+ CELL,
318
+ getCell,
319
+ getCellDeps,
320
+ then,
321
+ thenDeps,
322
+ tableId,
323
+ rowId,
324
+ cellId,
325
+ );
326
+ const useSetValueCallback = (
327
+ valueId,
328
+ getValue,
329
+ getValueDeps,
330
+ storeOrStoreId,
331
+ then,
332
+ thenDeps,
333
+ ) =>
334
+ useSetCallback(
335
+ storeOrStoreId,
336
+ VALUE,
337
+ getValue,
338
+ getValueDeps,
339
+ then,
340
+ thenDeps,
341
+ valueId,
342
+ );
343
+ const useIndexesOrIndexesById = (indexesOrIndexesId) =>
344
+ useThingOrThingById(indexesOrIndexesId, OFFSET_INDEXES);
345
+ const useSliceRowIds = (indexId, sliceId, indexesOrIndexesId) =>
346
+ useListenable(
347
+ SLICE + ROW_IDS,
348
+ useIndexesOrIndexesById(indexesOrIndexesId),
349
+ 1 /* Array */,
350
+ [indexId, sliceId],
351
+ );
352
+ const useRelationshipsOrRelationshipsById = (relationshipsOrRelationshipsId) =>
353
+ useThingOrThingById(relationshipsOrRelationshipsId, OFFSET_RELATIONSHIPS);
354
+ const useRemoteRowId = (
355
+ relationshipId,
356
+ localRowId,
357
+ relationshipsOrRelationshipsId,
358
+ ) =>
359
+ useListenable(
360
+ REMOTE_ROW_ID,
361
+ useRelationshipsOrRelationshipsById(relationshipsOrRelationshipsId),
362
+ 3 /* CellOrValue */,
363
+ [relationshipId, localRowId],
364
+ );
365
+ const useQueriesOrQueriesById = (queriesOrQueriesId) =>
366
+ useThingOrThingById(queriesOrQueriesId, OFFSET_QUERIES);
367
+ const useResultTableCellIds = (queryId, queriesOrQueriesId) =>
368
+ useListenable(
369
+ RESULT + TABLE + CELL_IDS,
370
+ useQueriesOrQueriesById(queriesOrQueriesId),
371
+ 1 /* Array */,
372
+ [queryId],
373
+ );
374
+ const useResultRowCount = (queryId, queriesOrQueriesId) =>
375
+ useListenable(
376
+ RESULT + ROW_COUNT,
377
+ useQueriesOrQueriesById(queriesOrQueriesId),
378
+ 5 /* Number */,
379
+ [queryId],
380
+ );
381
+ const useResultRowIds = (queryId, queriesOrQueriesId) =>
382
+ useListenable(
383
+ RESULT + ROW_IDS,
384
+ useQueriesOrQueriesById(queriesOrQueriesId),
385
+ 1 /* Array */,
386
+ [queryId],
387
+ );
388
+ const useResultSortedRowIds = (
389
+ queryId,
390
+ cellId,
391
+ descending,
392
+ offset = 0,
393
+ limit,
394
+ queriesOrQueriesId,
395
+ ) =>
396
+ useListenable(
397
+ RESULT + SORTED_ROW_IDS,
398
+ useQueriesOrQueriesById(queriesOrQueriesId),
399
+ 1 /* Array */,
400
+ [queryId, cellId, descending, offset, limit],
401
+ );
402
+
403
+ const getCellOrValueType = (cellOrValue) => {
404
+ if (isNull(cellOrValue)) {
405
+ return 'null';
406
+ }
407
+ const type = getTypeOf(cellOrValue);
408
+ return isTypeStringOrBoolean(type) ||
409
+ (type == NUMBER && isFiniteNumber(cellOrValue))
410
+ ? type
411
+ : void 0;
412
+ };
413
+ const getTypeCase = (type, stringCase, numberCase, booleanCase) =>
414
+ type == STRING
415
+ ? stringCase
416
+ : type == NUMBER
417
+ ? numberCase
418
+ : type == BOOLEAN
419
+ ? booleanCase
420
+ : null;
421
+
422
+ const useStoreCellComponentProps = (store, tableId) =>
423
+ useMemo(() => ({store, tableId}), [store, tableId]);
424
+ const useQueriesCellComponentProps = (queries, queryId) =>
425
+ useMemo(() => ({queries, queryId}), [queries, queryId]);
101
426
  const useCallbackOrUndefined = (callback, deps, test) => {
102
427
  const returnCallback = useCallback(callback, deps);
103
428
  return test ? returnCallback : void 0;
@@ -108,69 +433,6 @@ const useParams = (...args) =>
108
433
  // eslint-disable-next-line react-hooks/exhaustive-deps
109
434
  args,
110
435
  );
111
- const useStoreCellComponentProps = (store, tableId) =>
112
- useMemo(() => ({store, tableId}), [store, tableId]);
113
- const useQueriesCellComponentProps = (queries, queryId) =>
114
- useMemo(() => ({queries, queryId}), [queries, queryId]);
115
- const useSortingAndPagination = (
116
- cellId,
117
- descending = false,
118
- sortOnClick,
119
- offset = 0,
120
- limit,
121
- total,
122
- paginator,
123
- onChange,
124
- ) => {
125
- const [[currentCellId, currentDescending, currentOffset], setState] =
126
- useState([cellId, descending, offset]);
127
- const setStateAndChange = useCallback(
128
- (sortAndOffset) => {
129
- setState(sortAndOffset);
130
- onChange?.(sortAndOffset);
131
- },
132
- [onChange],
133
- );
134
- const handleSort = useCallbackOrUndefined(
135
- (cellId2) =>
136
- setStateAndChange([
137
- cellId2,
138
- cellId2 == currentCellId ? !currentDescending : false,
139
- currentOffset,
140
- ]),
141
- [setStateAndChange, currentCellId, currentDescending, currentOffset],
142
- sortOnClick,
143
- );
144
- const handleChangeOffset = useCallback(
145
- (offset2) => setStateAndChange([currentCellId, currentDescending, offset2]),
146
- [setStateAndChange, currentCellId, currentDescending],
147
- );
148
- const PaginatorComponent =
149
- paginator === true ? SortedTablePaginator : paginator;
150
- return [
151
- [currentCellId, currentDescending, currentOffset],
152
- handleSort,
153
- useMemo(
154
- () =>
155
- paginator === false
156
- ? null
157
- : /* @__PURE__ */ jsx(PaginatorComponent, {
158
- offset: currentOffset,
159
- limit,
160
- total,
161
- onChange: handleChangeOffset,
162
- }),
163
- [
164
- paginator,
165
- PaginatorComponent,
166
- currentOffset,
167
- limit,
168
- total,
169
- handleChangeOffset,
170
- ],
171
- ),
172
- ];
173
- };
174
436
  const useCells = (defaultCellIds, customCells, defaultCellComponent) =>
175
437
  useMemo(() => {
176
438
  const cellIds = customCells ?? defaultCellIds;
@@ -186,6 +448,54 @@ const useCells = (defaultCellIds, customCells, defaultCellComponent) =>
186
448
  }),
187
449
  );
188
450
  }, [customCells, defaultCellComponent, defaultCellIds]);
451
+
452
+ const UP_ARROW = '\u2191';
453
+ const DOWN_ARROW = '\u2193';
454
+ const EDITABLE = 'editable';
455
+ const extraRowCells = (extraRowCells2 = [], extraRowCellProps, after = 0) =>
456
+ arrayMap(extraRowCells2, ({component: Component}, index) =>
457
+ /* @__PURE__ */ jsx(
458
+ 'td',
459
+ {
460
+ className: EXTRA,
461
+ children: /* @__PURE__ */ jsx(Component, {...extraRowCellProps}),
462
+ },
463
+ extraKey(index, after),
464
+ ),
465
+ );
466
+ const extraKey = (index, after) => (after ? '>' : '<') + index;
467
+ const extraHeaders = (extraCells = [], after = 0) =>
468
+ arrayMap(extraCells, ({label}, index) =>
469
+ /* @__PURE__ */ jsx(
470
+ 'th',
471
+ {className: EXTRA, children: label},
472
+ extraKey(index, after),
473
+ ),
474
+ );
475
+
476
+ const HtmlHeaderCell = ({
477
+ cellId,
478
+ sort: [sortCellId, sortDescending],
479
+ label = cellId ?? EMPTY_STRING,
480
+ onClick,
481
+ }) =>
482
+ /* @__PURE__ */ jsxs('th', {
483
+ onClick: useCallbackOrUndefined(
484
+ () => onClick?.(cellId),
485
+ [onClick, cellId],
486
+ onClick,
487
+ ),
488
+ className:
489
+ isUndefined(sortDescending) || sortCellId != cellId
490
+ ? void 0
491
+ : `sorted ${sortDescending ? 'de' : 'a'}scending`,
492
+ children: [
493
+ isUndefined(sortDescending) || sortCellId != cellId
494
+ ? null
495
+ : (sortDescending ? DOWN_ARROW : UP_ARROW) + ' ',
496
+ label,
497
+ ],
498
+ });
189
499
  const HtmlTable = ({
190
500
  className,
191
501
  headerRow,
@@ -194,6 +504,8 @@ const HtmlTable = ({
194
504
  cells,
195
505
  cellComponentProps,
196
506
  rowIds,
507
+ extraCellsBefore,
508
+ extraCellsAfter,
197
509
  sortAndOffset,
198
510
  handleSort,
199
511
  paginatorComponent,
@@ -210,6 +522,7 @@ const HtmlTable = ({
210
522
  : /* @__PURE__ */ jsx('thead', {
211
523
  children: /* @__PURE__ */ jsxs('tr', {
212
524
  children: [
525
+ extraHeaders(extraCellsBefore),
213
526
  idColumn === false
214
527
  ? null
215
528
  : /* @__PURE__ */ jsx(HtmlHeaderCell, {
@@ -229,124 +542,51 @@ const HtmlTable = ({
229
542
  cellId,
230
543
  ),
231
544
  ),
545
+ extraHeaders(extraCellsAfter, 1),
232
546
  ],
233
547
  }),
234
548
  }),
235
549
  /* @__PURE__ */ jsx('tbody', {
236
- children: arrayMap(rowIds, (rowId) =>
237
- /* @__PURE__ */ jsxs(
550
+ children: arrayMap(rowIds, (rowId) => {
551
+ const rowProps = {...cellComponentProps, rowId};
552
+ return /* @__PURE__ */ jsxs(
238
553
  'tr',
239
554
  {
240
555
  children: [
556
+ extraRowCells(extraCellsBefore, rowProps),
241
557
  idColumn === false
242
558
  ? null
243
- : /* @__PURE__ */ jsx('th', {children: rowId}),
559
+ : /* @__PURE__ */ jsx('th', {title: rowId, children: rowId}),
244
560
  objToArray(
245
561
  cells,
246
- ({component: CellView2, getComponentProps}, cellId) =>
562
+ ({component: CellView, getComponentProps}, cellId) =>
247
563
  /* @__PURE__ */ jsx(
248
564
  'td',
249
565
  {
250
- children: /* @__PURE__ */ jsx(CellView2, {
566
+ children: /* @__PURE__ */ jsx(CellView, {
251
567
  ...getProps(getComponentProps, rowId, cellId),
252
- ...cellComponentProps,
253
- rowId,
568
+ ...rowProps,
254
569
  cellId,
255
570
  }),
256
571
  },
257
572
  cellId,
258
573
  ),
259
574
  ),
575
+ extraRowCells(extraCellsAfter, rowProps, 1),
260
576
  ],
261
577
  },
262
578
  rowId,
263
- ),
264
- ),
579
+ );
580
+ }),
265
581
  }),
266
582
  ],
267
583
  });
268
- const HtmlHeaderCell = ({
269
- cellId,
270
- sort: [sortCellId, sortDescending],
271
- label = cellId ?? EMPTY_STRING,
272
- onClick,
273
- }) =>
274
- /* @__PURE__ */ jsxs('th', {
275
- onClick: useCallbackOrUndefined(
276
- () => onClick?.(cellId),
277
- [onClick, cellId],
278
- onClick,
279
- ),
280
- className:
281
- isUndefined(sortDescending) || sortCellId != cellId
282
- ? void 0
283
- : `sorted ${sortDescending ? 'de' : 'a'}scending`,
284
- children: [
285
- isUndefined(sortDescending) || sortCellId != cellId
286
- ? null
287
- : (sortDescending ? DOWN_ARROW : UP_ARROW) + ' ',
288
- label,
289
- ],
290
- });
291
- const RelationshipInHtmlRow = ({
292
- localRowId,
293
- params: [
294
- idColumn,
295
- cells,
296
- localTableId,
297
- remoteTableId,
298
- relationshipId,
299
- relationships,
300
- store,
301
- ],
302
- }) => {
303
- const remoteRowId = useRemoteRowId(relationshipId, localRowId, relationships);
304
- return /* @__PURE__ */ jsxs('tr', {
305
- children: [
306
- idColumn === false
307
- ? null
308
- : /* @__PURE__ */ jsxs(Fragment, {
309
- children: [
310
- /* @__PURE__ */ jsx('th', {children: localRowId}),
311
- /* @__PURE__ */ jsx('th', {children: remoteRowId}),
312
- ],
313
- }),
314
- objToArray(
315
- cells,
316
- ({component: CellView2, getComponentProps}, compoundCellId) => {
317
- const [tableId, cellId] = strSplit(compoundCellId, DOT, 2);
318
- const rowId =
319
- tableId === localTableId
320
- ? localRowId
321
- : tableId === remoteTableId
322
- ? remoteRowId
323
- : null;
324
- return isUndefined(rowId)
325
- ? null
326
- : /* @__PURE__ */ jsx(
327
- 'td',
328
- {
329
- children: /* @__PURE__ */ jsx(CellView2, {
330
- ...getProps(getComponentProps, rowId, cellId),
331
- store,
332
- tableId,
333
- rowId,
334
- cellId,
335
- }),
336
- },
337
- compoundCellId,
338
- );
339
- },
340
- ),
341
- ],
342
- });
343
- };
344
- const EditableThing = ({
345
- thing,
346
- onThingChange,
347
- className,
348
- hasSchema,
349
- showType = true,
584
+ const EditableThing = ({
585
+ thing,
586
+ onThingChange,
587
+ className,
588
+ hasSchema,
589
+ showType = true,
350
590
  }) => {
351
591
  const [thingType, setThingType] = useState();
352
592
  const [currentThing, setCurrentThing] = useState();
@@ -389,194 +629,172 @@ const EditableThing = ({
389
629
  booleanThing,
390
630
  thingType,
391
631
  ]);
632
+ const widget = getTypeCase(
633
+ thingType,
634
+ /* @__PURE__ */ jsx(
635
+ 'input',
636
+ {
637
+ value: stringThing,
638
+ onChange: useCallback(
639
+ (event) =>
640
+ handleThingChange(
641
+ String(event[CURRENT_TARGET][_VALUE]),
642
+ setStringThing,
643
+ ),
644
+ [handleThingChange],
645
+ ),
646
+ },
647
+ thingType,
648
+ ),
649
+ /* @__PURE__ */ jsx(
650
+ 'input',
651
+ {
652
+ type: 'number',
653
+ value: numberThing,
654
+ onChange: useCallback(
655
+ (event) =>
656
+ handleThingChange(
657
+ Number(event[CURRENT_TARGET][_VALUE] || 0),
658
+ setNumberThing,
659
+ ),
660
+ [handleThingChange],
661
+ ),
662
+ },
663
+ thingType,
664
+ ),
665
+ /* @__PURE__ */ jsx(
666
+ 'input',
667
+ {
668
+ type: 'checkbox',
669
+ checked: booleanThing,
670
+ onChange: useCallback(
671
+ (event) =>
672
+ handleThingChange(
673
+ Boolean(event[CURRENT_TARGET].checked),
674
+ setBooleanThing,
675
+ ),
676
+ [handleThingChange],
677
+ ),
678
+ },
679
+ thingType,
680
+ ),
681
+ );
392
682
  return /* @__PURE__ */ jsxs('div', {
393
683
  className,
394
684
  children: [
395
- showType
685
+ showType && widget
396
686
  ? /* @__PURE__ */ jsx('button', {
687
+ title: thingType,
397
688
  className: thingType,
398
689
  onClick: handleTypeChange,
399
690
  children: thingType,
400
691
  })
401
692
  : null,
402
- getTypeCase(
403
- thingType,
404
- /* @__PURE__ */ jsx(
405
- 'input',
406
- {
407
- value: stringThing,
408
- onChange: useCallback(
409
- (event) =>
410
- handleThingChange(
411
- String(event[CURRENT_TARGET][_VALUE]),
412
- setStringThing,
413
- ),
414
- [handleThingChange],
415
- ),
416
- },
417
- thingType,
418
- ),
419
- /* @__PURE__ */ jsx(
420
- 'input',
421
- {
422
- type: 'number',
423
- value: numberThing,
424
- onChange: useCallback(
425
- (event) =>
426
- handleThingChange(
427
- Number(event[CURRENT_TARGET][_VALUE] || 0),
428
- setNumberThing,
429
- ),
430
- [handleThingChange],
431
- ),
432
- },
433
- thingType,
434
- ),
435
- /* @__PURE__ */ jsx(
436
- 'input',
437
- {
438
- type: 'checkbox',
439
- checked: booleanThing,
440
- onChange: useCallback(
441
- (event) =>
442
- handleThingChange(
443
- Boolean(event[CURRENT_TARGET].checked),
444
- setBooleanThing,
445
- ),
446
- [handleThingChange],
447
- ),
448
- },
449
- thingType,
450
- ),
451
- ),
693
+ widget,
452
694
  ],
453
695
  });
454
696
  };
455
- const TableInHtmlTable = ({tableId, store, editable, customCells, ...props}) =>
456
- /* @__PURE__ */ jsx(HtmlTable, {
457
- ...props,
458
- params: useParams(
459
- useCells(
460
- useTableCellIds(tableId, store),
461
- customCells,
462
- editable ? EditableCellView : CellView,
463
- ),
464
- useStoreCellComponentProps(store, tableId),
465
- useRowIds(tableId, store),
466
- ),
467
- });
468
- const SortedTableInHtmlTable = ({
697
+
698
+ const EditableCellView = ({
469
699
  tableId,
700
+ rowId,
470
701
  cellId,
471
- descending,
472
- offset,
473
- limit,
474
702
  store,
475
- editable,
476
- sortOnClick,
477
- paginator = false,
478
- onChange,
479
- customCells,
480
- ...props
481
- }) => {
482
- const [sortAndOffset, handleSort, paginatorComponent] =
483
- useSortingAndPagination(
703
+ className,
704
+ showType,
705
+ }) =>
706
+ /* @__PURE__ */ jsx(EditableThing, {
707
+ thing: useCell(tableId, rowId, cellId, store),
708
+ onThingChange: useSetCellCallback(
709
+ tableId,
710
+ rowId,
484
711
  cellId,
485
- descending,
486
- sortOnClick,
487
- offset,
488
- limit,
489
- useRowCount(tableId, store),
490
- paginator,
491
- onChange,
492
- );
493
- return /* @__PURE__ */ jsx(HtmlTable, {
494
- ...props,
495
- params: useParams(
496
- useCells(
497
- useTableCellIds(tableId, store),
498
- customCells,
499
- editable ? EditableCellView : CellView,
500
- ),
501
- useStoreCellComponentProps(store, tableId),
502
- useSortedRowIds(tableId, ...sortAndOffset, limit, store),
503
- sortAndOffset,
504
- handleSort,
505
- paginatorComponent,
712
+ (cell) => cell,
713
+ [],
714
+ store,
506
715
  ),
716
+ className: className ?? EDITABLE + CELL,
717
+ showType,
718
+ hasSchema: useStoreOrStoreById(store)?.hasTablesSchema,
507
719
  });
508
- };
509
- const ValuesInHtmlTable = ({
510
- store,
511
- editable = false,
512
- valueComponent: Value = editable ? EditableValueView : ValueView,
513
- getValueComponentProps,
514
- className,
515
- headerRow,
516
- idColumn,
517
- }) =>
518
- /* @__PURE__ */ jsxs('table', {
519
- className,
720
+
721
+ const EditableValueView = ({valueId, store, className, showType}) =>
722
+ /* @__PURE__ */ jsx(EditableThing, {
723
+ thing: useValue(valueId, store),
724
+ onThingChange: useSetValueCallback(valueId, (value) => value, [], store),
725
+ className: className ?? EDITABLE + VALUE,
726
+ showType,
727
+ hasSchema: useStoreOrStoreById(store)?.hasValuesSchema,
728
+ });
729
+
730
+ const useDottedCellIds = (tableId, store) =>
731
+ arrayMap(useTableCellIds(tableId, store), (cellId) => tableId + DOT + cellId);
732
+ const RelationshipInHtmlRow = ({
733
+ localRowId,
734
+ params: [
735
+ idColumn,
736
+ cells,
737
+ localTableId,
738
+ remoteTableId,
739
+ relationshipId,
740
+ relationships,
741
+ store,
742
+ extraCellsBefore,
743
+ extraCellsAfter,
744
+ ],
745
+ }) => {
746
+ const remoteRowId = useRemoteRowId(relationshipId, localRowId, relationships);
747
+ const rowProps = {
748
+ tableId: localTableId ?? '',
749
+ rowId: localRowId,
750
+ store,
751
+ };
752
+ return /* @__PURE__ */ jsxs('tr', {
520
753
  children: [
521
- headerRow === false
754
+ extraRowCells(extraCellsBefore, rowProps),
755
+ idColumn === false
522
756
  ? null
523
- : /* @__PURE__ */ jsx('thead', {
524
- children: /* @__PURE__ */ jsxs('tr', {
525
- children: [
526
- idColumn === false
527
- ? null
528
- : /* @__PURE__ */ jsx('th', {children: 'Id'}),
529
- /* @__PURE__ */ jsx('th', {children: VALUE}),
530
- ],
531
- }),
757
+ : /* @__PURE__ */ jsxs(Fragment, {
758
+ children: [
759
+ /* @__PURE__ */ jsx('th', {
760
+ title: localRowId,
761
+ children: localRowId,
762
+ }),
763
+ /* @__PURE__ */ jsx('th', {
764
+ title: remoteRowId,
765
+ children: remoteRowId,
766
+ }),
767
+ ],
532
768
  }),
533
- /* @__PURE__ */ jsx('tbody', {
534
- children: arrayMap(useValueIds(store), (valueId) =>
535
- /* @__PURE__ */ jsxs(
536
- 'tr',
537
- {
538
- children: [
539
- idColumn === false
540
- ? null
541
- : /* @__PURE__ */ jsx('th', {children: valueId}),
542
- /* @__PURE__ */ jsx('td', {
543
- children: /* @__PURE__ */ jsx(Value, {
544
- ...getProps(getValueComponentProps, valueId),
545
- valueId,
769
+ objToArray(
770
+ cells,
771
+ ({component: CellView2, getComponentProps}, compoundCellId) => {
772
+ const [tableId, cellId] = strSplit(compoundCellId, DOT, 2);
773
+ const rowId =
774
+ tableId === localTableId
775
+ ? localRowId
776
+ : tableId === remoteTableId
777
+ ? remoteRowId
778
+ : void 0;
779
+ return isUndefined(rowId)
780
+ ? null
781
+ : /* @__PURE__ */ jsx(
782
+ 'td',
783
+ {
784
+ children: /* @__PURE__ */ jsx(CellView2, {
785
+ ...getProps(getComponentProps, rowId, cellId),
546
786
  store,
787
+ tableId,
788
+ rowId,
789
+ cellId,
547
790
  }),
548
- }),
549
- ],
550
- },
551
- valueId,
552
- ),
553
- ),
554
- }),
555
- ],
556
- });
557
- const SliceInHtmlTable = ({
558
- indexId,
559
- sliceId,
560
- indexes,
561
- editable,
562
- customCells,
563
- ...props
564
- }) => {
565
- const [resolvedIndexes, store, tableId] = getIndexStoreTableId(
566
- useIndexesOrIndexesById(indexes),
567
- indexId,
568
- );
569
- return /* @__PURE__ */ jsx(HtmlTable, {
570
- ...props,
571
- params: useParams(
572
- useCells(
573
- useTableCellIds(tableId, store),
574
- customCells,
575
- editable ? EditableCellView : CellView,
791
+ },
792
+ compoundCellId,
793
+ );
794
+ },
576
795
  ),
577
- useStoreCellComponentProps(store, tableId),
578
- useSliceRowIds(indexId, sliceId, resolvedIndexes),
579
- ),
796
+ extraRowCells(extraCellsAfter, rowProps, 1),
797
+ ],
580
798
  });
581
799
  };
582
800
  const RelationshipInHtmlTable = ({
@@ -584,6 +802,8 @@ const RelationshipInHtmlTable = ({
584
802
  relationships,
585
803
  editable,
586
804
  customCells,
805
+ extraCellsBefore,
806
+ extraCellsAfter,
587
807
  className,
588
808
  headerRow,
589
809
  idColumn = true,
@@ -609,6 +829,8 @@ const RelationshipInHtmlTable = ({
609
829
  relationshipId,
610
830
  resolvedRelationships,
611
831
  store,
832
+ extraCellsBefore,
833
+ extraCellsAfter,
612
834
  );
613
835
  return /* @__PURE__ */ jsxs('table', {
614
836
  className,
@@ -618,6 +840,7 @@ const RelationshipInHtmlTable = ({
618
840
  : /* @__PURE__ */ jsx('thead', {
619
841
  children: /* @__PURE__ */ jsxs('tr', {
620
842
  children: [
843
+ extraHeaders(extraCellsBefore),
621
844
  idColumn === false
622
845
  ? null
623
846
  : /* @__PURE__ */ jsxs(Fragment, {
@@ -633,6 +856,7 @@ const RelationshipInHtmlTable = ({
633
856
  objToArray(cells, ({label}, cellId) =>
634
857
  /* @__PURE__ */ jsx('th', {children: label}, cellId),
635
858
  ),
859
+ extraHeaders(extraCellsAfter, 1),
636
860
  ],
637
861
  }),
638
862
  }),
@@ -651,89 +875,68 @@ const RelationshipInHtmlTable = ({
651
875
  ],
652
876
  });
653
877
  };
654
- const ResultTableInHtmlTable = ({queryId, queries, customCells, ...props}) =>
655
- /* @__PURE__ */ jsx(HtmlTable, {
656
- ...props,
657
- params: useParams(
658
- useCells(
659
- useResultTableCellIds(queryId, queries),
660
- customCells,
661
- ResultCellView,
662
- ),
663
- useQueriesCellComponentProps(queries, queryId),
664
- useResultRowIds(queryId, queries),
665
- ),
666
- });
667
- const ResultSortedTableInHtmlTable = ({
668
- queryId,
878
+
879
+ const LEFT_ARROW = '\u2190';
880
+ const RIGHT_ARROW = '\u2192';
881
+ const useSortingAndPagination = (
669
882
  cellId,
670
- descending,
671
- offset,
672
- limit,
673
- queries,
883
+ descending = false,
674
884
  sortOnClick,
675
- paginator = false,
676
- customCells,
885
+ offset = 0,
886
+ limit,
887
+ total,
888
+ paginator,
677
889
  onChange,
678
- ...props
679
- }) => {
680
- const [sortAndOffset, handleSort, paginatorComponent] =
681
- useSortingAndPagination(
682
- cellId,
683
- descending,
684
- sortOnClick,
685
- offset,
686
- limit,
687
- useResultRowCount(queryId, queries),
688
- paginator,
689
- onChange,
690
- );
691
- return /* @__PURE__ */ jsx(HtmlTable, {
692
- ...props,
693
- params: useParams(
694
- useCells(
695
- useResultTableCellIds(queryId, queries),
696
- customCells,
697
- ResultCellView,
698
- ),
699
- useQueriesCellComponentProps(queries, queryId),
700
- useResultSortedRowIds(queryId, ...sortAndOffset, limit, queries),
701
- sortAndOffset,
702
- handleSort,
703
- paginatorComponent,
890
+ ) => {
891
+ const [[currentCellId, currentDescending, currentOffset], setState] =
892
+ useState([cellId, descending, offset]);
893
+ const setStateAndChange = useCallback(
894
+ (sortAndOffset) => {
895
+ setState(sortAndOffset);
896
+ onChange?.(sortAndOffset);
897
+ },
898
+ [onChange],
899
+ );
900
+ const handleSort = useCallbackOrUndefined(
901
+ (cellId2) =>
902
+ setStateAndChange([
903
+ cellId2,
904
+ cellId2 == currentCellId ? !currentDescending : false,
905
+ currentOffset,
906
+ ]),
907
+ [setStateAndChange, currentCellId, currentDescending, currentOffset],
908
+ sortOnClick,
909
+ );
910
+ const handleChangeOffset = useCallback(
911
+ (offset2) => setStateAndChange([currentCellId, currentDescending, offset2]),
912
+ [setStateAndChange, currentCellId, currentDescending],
913
+ );
914
+ const PaginatorComponent =
915
+ paginator === true ? SortedTablePaginator : paginator;
916
+ return [
917
+ [currentCellId, currentDescending, currentOffset],
918
+ handleSort,
919
+ useMemo(
920
+ () =>
921
+ paginator === false
922
+ ? null
923
+ : /* @__PURE__ */ jsx(PaginatorComponent, {
924
+ offset: currentOffset,
925
+ limit,
926
+ total,
927
+ onChange: handleChangeOffset,
928
+ }),
929
+ [
930
+ paginator,
931
+ PaginatorComponent,
932
+ currentOffset,
933
+ limit,
934
+ total,
935
+ handleChangeOffset,
936
+ ],
704
937
  ),
705
- });
938
+ ];
706
939
  };
707
- const EditableCellView = ({
708
- tableId,
709
- rowId,
710
- cellId,
711
- store,
712
- className,
713
- showType,
714
- }) =>
715
- /* @__PURE__ */ jsx(EditableThing, {
716
- thing: useCell(tableId, rowId, cellId, store),
717
- onThingChange: useSetCellCallback(
718
- tableId,
719
- rowId,
720
- cellId,
721
- (cell) => cell,
722
- [],
723
- store,
724
- ),
725
- className: className ?? EDITABLE + CELL,
726
- showType,
727
- hasSchema: useStoreOrStoreById(store)?.hasTablesSchema,
728
- });
729
- const EditableValueView = ({valueId, store, className, showType}) =>
730
- /* @__PURE__ */ jsx(EditableThing, {
731
- thing: useValue(valueId, store),
732
- onThingChange: useSetValueCallback(valueId, (value) => value, [], store),
733
- className: className ?? EDITABLE + VALUE,
734
- showType,
735
- hasSchema: useStoreOrStoreById(store)?.hasValuesSchema,
736
- });
737
940
  const SortedTablePaginator = ({
738
941
  onChange,
739
942
  total,
@@ -786,9 +989,251 @@ const SortedTablePaginator = ({
786
989
  });
787
990
  };
788
991
 
992
+ const ResultSortedTableInHtmlTable = ({
993
+ queryId,
994
+ cellId,
995
+ descending,
996
+ offset,
997
+ limit,
998
+ queries,
999
+ sortOnClick,
1000
+ paginator = false,
1001
+ customCells,
1002
+ extraCellsBefore,
1003
+ extraCellsAfter,
1004
+ onChange,
1005
+ ...props
1006
+ }) => {
1007
+ const [sortAndOffset, handleSort, paginatorComponent] =
1008
+ useSortingAndPagination(
1009
+ cellId,
1010
+ descending,
1011
+ sortOnClick,
1012
+ offset,
1013
+ limit,
1014
+ useResultRowCount(queryId, queries),
1015
+ paginator,
1016
+ onChange,
1017
+ );
1018
+ return /* @__PURE__ */ jsx(HtmlTable, {
1019
+ ...props,
1020
+ params: useParams(
1021
+ useCells(
1022
+ useResultTableCellIds(queryId, queries),
1023
+ customCells,
1024
+ ResultCellView,
1025
+ ),
1026
+ useQueriesCellComponentProps(queries, queryId),
1027
+ useResultSortedRowIds(queryId, ...sortAndOffset, limit, queries),
1028
+ extraCellsBefore,
1029
+ extraCellsAfter,
1030
+ sortAndOffset,
1031
+ handleSort,
1032
+ paginatorComponent,
1033
+ ),
1034
+ });
1035
+ };
1036
+
1037
+ const ResultTableInHtmlTable = ({
1038
+ queryId,
1039
+ queries,
1040
+ customCells,
1041
+ extraCellsBefore,
1042
+ extraCellsAfter,
1043
+ ...props
1044
+ }) =>
1045
+ /* @__PURE__ */ jsx(HtmlTable, {
1046
+ ...props,
1047
+ params: useParams(
1048
+ useCells(
1049
+ useResultTableCellIds(queryId, queries),
1050
+ customCells,
1051
+ ResultCellView,
1052
+ ),
1053
+ useQueriesCellComponentProps(queries, queryId),
1054
+ useResultRowIds(queryId, queries),
1055
+ extraCellsBefore,
1056
+ extraCellsAfter,
1057
+ ),
1058
+ });
1059
+
1060
+ const SliceInHtmlTable = ({
1061
+ indexId,
1062
+ sliceId,
1063
+ indexes,
1064
+ editable,
1065
+ customCells,
1066
+ extraCellsBefore,
1067
+ extraCellsAfter,
1068
+ ...props
1069
+ }) => {
1070
+ const [resolvedIndexes, store, tableId] = getIndexStoreTableId(
1071
+ useIndexesOrIndexesById(indexes),
1072
+ indexId,
1073
+ );
1074
+ return /* @__PURE__ */ jsx(HtmlTable, {
1075
+ ...props,
1076
+ params: useParams(
1077
+ useCells(
1078
+ useTableCellIds(tableId, store),
1079
+ customCells,
1080
+ editable ? EditableCellView : CellView,
1081
+ ),
1082
+ useStoreCellComponentProps(store, tableId),
1083
+ useSliceRowIds(indexId, sliceId, resolvedIndexes),
1084
+ extraCellsBefore,
1085
+ extraCellsAfter,
1086
+ ),
1087
+ });
1088
+ };
1089
+
1090
+ const SortedTableInHtmlTable = ({
1091
+ tableId,
1092
+ cellId,
1093
+ descending,
1094
+ offset,
1095
+ limit,
1096
+ store,
1097
+ editable,
1098
+ sortOnClick,
1099
+ paginator = false,
1100
+ onChange,
1101
+ customCells,
1102
+ extraCellsBefore,
1103
+ extraCellsAfter,
1104
+ ...props
1105
+ }) => {
1106
+ const [sortAndOffset, handleSort, paginatorComponent] =
1107
+ useSortingAndPagination(
1108
+ cellId,
1109
+ descending,
1110
+ sortOnClick,
1111
+ offset,
1112
+ limit,
1113
+ useRowCount(tableId, store),
1114
+ paginator,
1115
+ onChange,
1116
+ );
1117
+ return /* @__PURE__ */ jsx(HtmlTable, {
1118
+ ...props,
1119
+ params: useParams(
1120
+ useCells(
1121
+ useTableCellIds(tableId, store),
1122
+ customCells,
1123
+ editable ? EditableCellView : CellView,
1124
+ ),
1125
+ useStoreCellComponentProps(store, tableId),
1126
+ useSortedRowIds(tableId, ...sortAndOffset, limit, store),
1127
+ extraCellsBefore,
1128
+ extraCellsAfter,
1129
+ sortAndOffset,
1130
+ handleSort,
1131
+ paginatorComponent,
1132
+ ),
1133
+ });
1134
+ };
1135
+
1136
+ const TableInHtmlTable = ({
1137
+ tableId,
1138
+ store,
1139
+ editable,
1140
+ customCells,
1141
+ extraCellsBefore,
1142
+ extraCellsAfter,
1143
+ ...props
1144
+ }) =>
1145
+ /* @__PURE__ */ jsx(HtmlTable, {
1146
+ ...props,
1147
+ params: useParams(
1148
+ useCells(
1149
+ useTableCellIds(tableId, store),
1150
+ customCells,
1151
+ editable ? EditableCellView : CellView,
1152
+ ),
1153
+ useStoreCellComponentProps(store, tableId),
1154
+ useRowIds(tableId, store),
1155
+ extraCellsBefore,
1156
+ extraCellsAfter,
1157
+ ),
1158
+ });
1159
+
1160
+ const extraValueCells = (
1161
+ extraValueCells2 = [],
1162
+ extraValueCellProps,
1163
+ after = 0,
1164
+ ) =>
1165
+ arrayMap(extraValueCells2, ({component: Component}, index) =>
1166
+ /* @__PURE__ */ jsx(
1167
+ 'td',
1168
+ {
1169
+ className: EXTRA,
1170
+ children: /* @__PURE__ */ jsx(Component, {...extraValueCellProps}),
1171
+ },
1172
+ extraKey(index, after),
1173
+ ),
1174
+ );
1175
+ const ValuesInHtmlTable = ({
1176
+ store,
1177
+ editable = false,
1178
+ valueComponent: Value = editable ? EditableValueView : ValueView,
1179
+ getValueComponentProps,
1180
+ extraCellsBefore,
1181
+ extraCellsAfter,
1182
+ className,
1183
+ headerRow,
1184
+ idColumn,
1185
+ }) =>
1186
+ /* @__PURE__ */ jsxs('table', {
1187
+ className,
1188
+ children: [
1189
+ headerRow === false
1190
+ ? null
1191
+ : /* @__PURE__ */ jsx('thead', {
1192
+ children: /* @__PURE__ */ jsxs('tr', {
1193
+ children: [
1194
+ extraHeaders(extraCellsBefore),
1195
+ idColumn === false
1196
+ ? null
1197
+ : /* @__PURE__ */ jsx('th', {children: 'Id'}),
1198
+ /* @__PURE__ */ jsx('th', {children: VALUE}),
1199
+ extraHeaders(extraCellsAfter, 1),
1200
+ ],
1201
+ }),
1202
+ }),
1203
+ /* @__PURE__ */ jsx('tbody', {
1204
+ children: arrayMap(useValueIds(store), (valueId) => {
1205
+ const valueProps = {valueId, store};
1206
+ return /* @__PURE__ */ jsxs(
1207
+ 'tr',
1208
+ {
1209
+ children: [
1210
+ extraValueCells(extraCellsBefore, valueProps),
1211
+ idColumn === false
1212
+ ? null
1213
+ : /* @__PURE__ */ jsx('th', {
1214
+ title: valueId,
1215
+ children: valueId,
1216
+ }),
1217
+ /* @__PURE__ */ jsx('td', {
1218
+ children: /* @__PURE__ */ jsx(Value, {
1219
+ ...getProps(getValueComponentProps, valueId),
1220
+ ...valueProps,
1221
+ }),
1222
+ }),
1223
+ extraValueCells(extraCellsAfter, valueProps, 1),
1224
+ ],
1225
+ },
1226
+ valueId,
1227
+ );
1228
+ }),
1229
+ }),
1230
+ ],
1231
+ });
1232
+
789
1233
  export {
790
1234
  EditableCellView,
791
1235
  EditableValueView,
1236
+ RelationshipInHtmlRow,
792
1237
  RelationshipInHtmlTable,
793
1238
  ResultSortedTableInHtmlTable,
794
1239
  ResultTableInHtmlTable,
@@ -796,5 +1241,6 @@ export {
796
1241
  SortedTableInHtmlTable,
797
1242
  SortedTablePaginator,
798
1243
  TableInHtmlTable,
1244
+ useSortingAndPagination,
799
1245
  ValuesInHtmlTable,
800
1246
  };