shutro-erp 0.3.3 → 0.3.5

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 (412) hide show
  1. package/dist/account_portal/.kosh/bindings.js +1 -1
  2. package/dist/account_portal/.kosh/schema.d.ts +181 -3
  3. package/dist/account_portal/module.d.ts +359 -6
  4. package/dist/accounting/.kosh/bindings.js +1 -1
  5. package/dist/accounting/.kosh/schema.d.ts +181 -3
  6. package/dist/accounting/index.js +214 -2
  7. package/dist/accounting/module.d.ts +217 -5
  8. package/dist/accounting/module.js +23 -2
  9. package/dist/calendar/.kosh/bindings.d.ts +22 -0
  10. package/dist/calendar/.kosh/bindings.js +15 -0
  11. package/dist/calendar/.kosh/schema.d.ts +795 -0
  12. package/dist/calendar/demo.d.ts +6 -0
  13. package/dist/calendar/demo.js +24 -0
  14. package/dist/calendar/index.d.ts +3 -0
  15. package/dist/calendar/index.js +291 -0
  16. package/dist/calendar/module.d.ts +1705 -0
  17. package/dist/calendar/module.js +180 -0
  18. package/dist/cli/init.js +48 -0
  19. package/dist/cli/templates.d.ts +1 -1
  20. package/dist/cli/templates.js +137 -0
  21. package/dist/contacts/.kosh/bindings.js +1 -1
  22. package/dist/contacts/.kosh/schema.d.ts +205 -3
  23. package/dist/contacts/demo.js +30 -1
  24. package/dist/contacts/index.d.ts +1 -1
  25. package/dist/contacts/index.js +155 -9
  26. package/dist/contacts/module.d.ts +338 -2
  27. package/dist/contacts/module.js +82 -5
  28. package/dist/crm/.kosh/bindings.d.ts +22 -0
  29. package/dist/crm/.kosh/bindings.js +15 -0
  30. package/dist/crm/.kosh/schema.d.ts +799 -0
  31. package/dist/crm/demo.d.ts +6 -0
  32. package/dist/crm/demo.js +45 -0
  33. package/dist/crm/index.d.ts +3 -0
  34. package/dist/crm/index.js +361 -0
  35. package/dist/crm/module.d.ts +1843 -0
  36. package/dist/crm/module.js +207 -0
  37. package/dist/event/.kosh/bindings.d.ts +22 -0
  38. package/dist/event/.kosh/bindings.js +15 -0
  39. package/dist/event/.kosh/schema.d.ts +843 -0
  40. package/dist/event/demo.d.ts +6 -0
  41. package/dist/event/demo.js +65 -0
  42. package/dist/event/index.d.ts +14 -0
  43. package/dist/event/index.js +333 -0
  44. package/dist/event/mails.d.ts +15 -0
  45. package/dist/event/mails.js +112 -0
  46. package/dist/event/module.d.ts +2800 -0
  47. package/dist/event/module.js +323 -0
  48. package/dist/event/web/CheckInBox.d.ts +9 -0
  49. package/dist/event/web/CheckInBox.js +87 -0
  50. package/dist/event/web/index.d.ts +11 -0
  51. package/dist/event/web/index.js +16 -0
  52. package/dist/event/web/messages.d.ts +2 -0
  53. package/dist/event/web/messages.js +23 -0
  54. package/dist/event_account/.kosh/bindings.d.ts +22 -0
  55. package/dist/event_account/.kosh/bindings.js +15 -0
  56. package/dist/event_account/.kosh/schema.d.ts +1639 -0
  57. package/dist/event_account/index.d.ts +3 -0
  58. package/dist/event_account/index.js +28 -0
  59. package/dist/event_account/module.d.ts +6968 -0
  60. package/dist/event_account/module.js +90 -0
  61. package/dist/hr/.kosh/bindings.d.ts +22 -0
  62. package/dist/hr/.kosh/bindings.js +15 -0
  63. package/dist/hr/.kosh/schema.d.ts +878 -0
  64. package/dist/hr/demo.d.ts +6 -0
  65. package/dist/hr/demo.js +60 -0
  66. package/dist/hr/index.d.ts +3 -0
  67. package/dist/hr/index.js +483 -0
  68. package/dist/hr/module.d.ts +2611 -0
  69. package/dist/hr/module.js +350 -0
  70. package/dist/integrations/index.js +12 -0
  71. package/dist/integrations/web/OAuthAppsPage.d.ts +9 -0
  72. package/dist/integrations/web/OAuthAppsPage.js +79 -0
  73. package/dist/integrations/web/index.d.ts +1 -0
  74. package/dist/integrations/web/index.js +3 -0
  75. package/dist/integrations/web/messages.js +58 -0
  76. package/dist/l10n_bd/.kosh/bindings.js +1 -1
  77. package/dist/l10n_bd/.kosh/schema.d.ts +181 -3
  78. package/dist/l10n_bd/module.d.ts +359 -6
  79. package/dist/l10n_in/.kosh/bindings.js +1 -1
  80. package/dist/l10n_in/.kosh/schema.d.ts +181 -3
  81. package/dist/l10n_in/module.d.ts +380 -7
  82. package/dist/maintenance/.kosh/bindings.d.ts +22 -0
  83. package/dist/maintenance/.kosh/bindings.js +15 -0
  84. package/dist/maintenance/.kosh/schema.d.ts +911 -0
  85. package/dist/maintenance/demo.d.ts +6 -0
  86. package/dist/maintenance/demo.js +60 -0
  87. package/dist/maintenance/index.d.ts +3 -0
  88. package/dist/maintenance/index.js +422 -0
  89. package/dist/maintenance/module.d.ts +3545 -0
  90. package/dist/maintenance/module.js +446 -0
  91. package/dist/maintenance_stock/.kosh/bindings.d.ts +22 -0
  92. package/dist/maintenance_stock/.kosh/bindings.js +15 -0
  93. package/dist/maintenance_stock/.kosh/schema.d.ts +1371 -0
  94. package/dist/maintenance_stock/index.d.ts +9 -0
  95. package/dist/maintenance_stock/index.js +52 -0
  96. package/dist/maintenance_stock/module.d.ts +6953 -0
  97. package/dist/maintenance_stock/module.js +192 -0
  98. package/dist/messaging/web/index.js +1 -1
  99. package/dist/modules-sdk/index.d.ts +1 -1
  100. package/dist/modules-sdk/manifest.d.ts +70 -0
  101. package/dist/modules-sdk/manifest.js +35 -1
  102. package/dist/mrp/.kosh/bindings.d.ts +22 -0
  103. package/dist/mrp/.kosh/bindings.js +15 -0
  104. package/dist/mrp/.kosh/schema.d.ts +1378 -0
  105. package/dist/mrp/demo.d.ts +7 -0
  106. package/dist/mrp/demo.js +42 -0
  107. package/dist/mrp/index.d.ts +3 -0
  108. package/dist/mrp/index.js +392 -0
  109. package/dist/mrp/module.d.ts +8608 -0
  110. package/dist/mrp/module.js +695 -0
  111. package/dist/mrp_account/.kosh/bindings.d.ts +22 -0
  112. package/dist/mrp_account/.kosh/bindings.js +15 -0
  113. package/dist/mrp_account/.kosh/schema.d.ts +2106 -0
  114. package/dist/mrp_account/index.d.ts +3 -0
  115. package/dist/mrp_account/index.js +22 -0
  116. package/dist/mrp_account/module.d.ts +20840 -0
  117. package/dist/mrp_account/module.js +123 -0
  118. package/dist/notify/web/index.js +1 -1
  119. package/dist/payment/.kosh/bindings.js +1 -1
  120. package/dist/payment/.kosh/schema.d.ts +181 -3
  121. package/dist/payment/module.d.ts +359 -6
  122. package/dist/portal/.kosh/bindings.js +1 -1
  123. package/dist/portal/.kosh/schema.d.ts +205 -3
  124. package/dist/portal/module.d.ts +166 -2
  125. package/dist/pos/.kosh/bindings.d.ts +22 -0
  126. package/dist/pos/.kosh/bindings.js +15 -0
  127. package/dist/pos/.kosh/schema.d.ts +1690 -0
  128. package/dist/pos/accounting.d.ts +10 -0
  129. package/dist/pos/accounting.js +149 -0
  130. package/dist/pos/demo.d.ts +6 -0
  131. package/dist/pos/demo.js +90 -0
  132. package/dist/pos/index.d.ts +9 -0
  133. package/dist/pos/index.js +349 -0
  134. package/dist/pos/module.d.ts +9636 -0
  135. package/dist/pos/module.js +423 -0
  136. package/dist/pos/routes.d.ts +39 -0
  137. package/dist/pos/routes.js +368 -0
  138. package/dist/pos/web/Register.d.ts +9 -0
  139. package/dist/pos/web/Register.js +252 -0
  140. package/dist/pos/web/index.d.ts +11 -0
  141. package/dist/pos/web/index.js +16 -0
  142. package/dist/pos/web/messages.d.ts +2 -0
  143. package/dist/pos/web/messages.js +87 -0
  144. package/dist/pos_stock/.kosh/bindings.d.ts +22 -0
  145. package/dist/pos_stock/.kosh/bindings.js +15 -0
  146. package/dist/pos_stock/.kosh/schema.d.ts +2015 -0
  147. package/dist/pos_stock/index.d.ts +9 -0
  148. package/dist/pos_stock/index.js +35 -0
  149. package/dist/pos_stock/module.d.ts +11935 -0
  150. package/dist/pos_stock/module.js +115 -0
  151. package/dist/product/.kosh/bindings.js +1 -1
  152. package/dist/product/.kosh/schema.d.ts +178 -1
  153. package/dist/product/index.js +81 -4
  154. package/dist/product/module.d.ts +43 -1
  155. package/dist/product/module.js +9 -2
  156. package/dist/project/.kosh/bindings.js +1 -1
  157. package/dist/project/.kosh/schema.d.ts +181 -3
  158. package/dist/project/index.js +147 -7
  159. package/dist/project/module.d.ts +210 -2
  160. package/dist/project/module.js +52 -5
  161. package/dist/project_portal/.kosh/bindings.js +1 -1
  162. package/dist/project_portal/.kosh/schema.d.ts +181 -3
  163. package/dist/project_portal/module.d.ts +353 -4
  164. package/dist/purchase/.kosh/bindings.js +1 -1
  165. package/dist/purchase/.kosh/schema.d.ts +181 -3
  166. package/dist/purchase/index.js +163 -3
  167. package/dist/purchase/module.d.ts +215 -3
  168. package/dist/purchase/module.js +21 -3
  169. package/dist/purchase_account/.kosh/bindings.js +1 -1
  170. package/dist/purchase_account/.kosh/schema.d.ts +182 -3
  171. package/dist/purchase_account/index.js +26 -1
  172. package/dist/purchase_account/module.d.ts +393 -7
  173. package/dist/purchase_portal/.kosh/bindings.js +1 -1
  174. package/dist/purchase_portal/.kosh/schema.d.ts +181 -3
  175. package/dist/purchase_portal/module.d.ts +366 -5
  176. package/dist/purchase_stock/.kosh/bindings.d.ts +22 -0
  177. package/dist/purchase_stock/.kosh/bindings.js +15 -0
  178. package/dist/purchase_stock/.kosh/schema.d.ts +1310 -0
  179. package/dist/purchase_stock/index.d.ts +7 -0
  180. package/dist/purchase_stock/index.js +91 -0
  181. package/dist/purchase_stock/module.d.ts +6763 -0
  182. package/dist/purchase_stock/module.js +144 -0
  183. package/dist/purchase_stock_account/.kosh/bindings.d.ts +22 -0
  184. package/dist/purchase_stock_account/.kosh/bindings.js +15 -0
  185. package/dist/purchase_stock_account/.kosh/schema.d.ts +1959 -0
  186. package/dist/purchase_stock_account/index.d.ts +3 -0
  187. package/dist/purchase_stock_account/index.js +24 -0
  188. package/dist/purchase_stock_account/module.d.ts +35366 -0
  189. package/dist/purchase_stock_account/module.js +162 -0
  190. package/dist/recruitment/.kosh/bindings.d.ts +22 -0
  191. package/dist/recruitment/.kosh/bindings.js +15 -0
  192. package/dist/recruitment/.kosh/schema.d.ts +990 -0
  193. package/dist/recruitment/demo.d.ts +6 -0
  194. package/dist/recruitment/demo.js +45 -0
  195. package/dist/recruitment/index.d.ts +3 -0
  196. package/dist/recruitment/index.js +385 -0
  197. package/dist/recruitment/module.d.ts +3247 -0
  198. package/dist/recruitment/module.js +193 -0
  199. package/dist/recruitment/web/HireButton.d.ts +9 -0
  200. package/dist/recruitment/web/HireButton.js +32 -0
  201. package/dist/recruitment/web/index.d.ts +11 -0
  202. package/dist/recruitment/web/index.js +16 -0
  203. package/dist/recruitment/web/messages.d.ts +2 -0
  204. package/dist/recruitment/web/messages.js +19 -0
  205. package/dist/reporting/documents.d.ts +5 -0
  206. package/dist/reporting/documents.js +28 -1
  207. package/dist/reporting/index.d.ts +1 -1
  208. package/dist/reporting/index.js +4 -2
  209. package/dist/reporting/models.js +9 -0
  210. package/dist/reporting/overviews.d.ts +16 -0
  211. package/dist/reporting/overviews.js +56 -0
  212. package/dist/reporting/routes-documents.js +1 -1
  213. package/dist/reporting/routes.js +138 -80
  214. package/dist/reporting/web/DashboardView.d.ts +11 -0
  215. package/dist/reporting/web/DashboardView.js +2 -2
  216. package/dist/reporting/web/DesignerView.js +5 -0
  217. package/dist/reporting/web/Overview.d.ts +9 -0
  218. package/dist/reporting/web/Overview.js +53 -0
  219. package/dist/reporting/web/index.d.ts +1 -0
  220. package/dist/reporting/web/index.js +4 -1
  221. package/dist/reporting/web/messages.js +9 -0
  222. package/dist/sale_account/.kosh/bindings.js +1 -1
  223. package/dist/sale_account/.kosh/schema.d.ts +186 -3
  224. package/dist/sale_account/index.js +22 -1
  225. package/dist/sale_account/module.d.ts +461 -7
  226. package/dist/sale_portal/.kosh/bindings.js +1 -1
  227. package/dist/sale_portal/.kosh/schema.d.ts +185 -3
  228. package/dist/sale_portal/module.d.ts +434 -5
  229. package/dist/sale_project/.kosh/bindings.js +1 -1
  230. package/dist/sale_project/.kosh/schema.d.ts +187 -3
  231. package/dist/sale_project/module.d.ts +476 -6
  232. package/dist/sale_stock/.kosh/bindings.d.ts +22 -0
  233. package/dist/sale_stock/.kosh/bindings.js +15 -0
  234. package/dist/sale_stock/.kosh/schema.d.ts +1228 -0
  235. package/dist/sale_stock/index.d.ts +7 -0
  236. package/dist/sale_stock/index.js +84 -0
  237. package/dist/sale_stock/module.d.ts +6791 -0
  238. package/dist/sale_stock/module.js +146 -0
  239. package/dist/sales/.kosh/bindings.js +1 -1
  240. package/dist/sales/.kosh/schema.d.ts +185 -3
  241. package/dist/sales/index.js +191 -4
  242. package/dist/sales/module.d.ts +355 -3
  243. package/dist/sales/module.js +78 -3
  244. package/dist/server/api/metadata.d.ts +5 -0
  245. package/dist/server/api/metadata.js +5 -0
  246. package/dist/server/api/rest.js +64 -1
  247. package/dist/server/api/views.js +1 -0
  248. package/dist/server/app-settings.d.ts +7 -0
  249. package/dist/server/app-settings.js +10 -0
  250. package/dist/server/auth/base.js +85 -0
  251. package/dist/server/auth/oauth.d.ts +21 -0
  252. package/dist/server/auth/oauth.js +579 -0
  253. package/dist/server/auth/service.d.ts +4 -0
  254. package/dist/server/auth/service.js +17 -0
  255. package/dist/server/identity.d.ts +2 -0
  256. package/dist/server/images.d.ts +12 -0
  257. package/dist/server/images.js +139 -0
  258. package/dist/server/index.d.ts +2 -0
  259. package/dist/server/index.js +2 -0
  260. package/dist/server/server.d.ts +4 -0
  261. package/dist/server/server.js +9 -1
  262. package/dist/settings/app-settings.d.ts +2 -0
  263. package/dist/settings/app-settings.js +518 -0
  264. package/dist/settings/company.js +3 -1
  265. package/dist/settings/index.d.ts +1 -0
  266. package/dist/settings/index.js +15 -0
  267. package/dist/settings/people.js +32 -6
  268. package/dist/settings/web/AppSettingsPage.d.ts +11 -0
  269. package/dist/settings/web/AppSettingsPage.js +210 -0
  270. package/dist/settings/web/CompaniesPage.js +2 -2
  271. package/dist/settings/web/CompanyPage.js +13 -2
  272. package/dist/settings/web/ConnectedAppsPage.d.ts +7 -0
  273. package/dist/settings/web/ConnectedAppsPage.js +33 -0
  274. package/dist/settings/web/OverviewPage.js +28 -4
  275. package/dist/settings/web/PeoplePage.js +23 -18
  276. package/dist/settings/web/ProfilePage.js +9 -7
  277. package/dist/settings/web/index.d.ts +2 -0
  278. package/dist/settings/web/index.js +8 -0
  279. package/dist/settings/web/messages.js +146 -2
  280. package/dist/stock/.kosh/bindings.d.ts +22 -0
  281. package/dist/stock/.kosh/bindings.js +15 -0
  282. package/dist/stock/.kosh/schema.d.ts +1147 -0
  283. package/dist/stock/demo.d.ts +7 -0
  284. package/dist/stock/demo.js +55 -0
  285. package/dist/stock/index.d.ts +3 -0
  286. package/dist/stock/index.js +674 -0
  287. package/dist/stock/module.d.ts +6330 -0
  288. package/dist/stock/module.js +1325 -0
  289. package/dist/stock/web/ScanBox.d.ts +8 -0
  290. package/dist/stock/web/ScanBox.js +90 -0
  291. package/dist/stock/web/index.d.ts +11 -0
  292. package/dist/stock/web/index.js +16 -0
  293. package/dist/stock/web/messages.d.ts +2 -0
  294. package/dist/stock/web/messages.js +25 -0
  295. package/dist/stock_account/.kosh/bindings.d.ts +22 -0
  296. package/dist/stock_account/.kosh/bindings.js +15 -0
  297. package/dist/stock_account/.kosh/schema.d.ts +1875 -0
  298. package/dist/stock_account/index.d.ts +3 -0
  299. package/dist/stock_account/index.js +130 -0
  300. package/dist/stock_account/module.d.ts +10655 -0
  301. package/dist/stock_account/module.js +339 -0
  302. package/dist/storage/attachments.d.ts +5 -0
  303. package/dist/storage/attachments.js +12 -1
  304. package/dist/storage/models.js +3 -0
  305. package/dist/storage/routes.js +13 -2
  306. package/dist/todo/.kosh/bindings.d.ts +22 -0
  307. package/dist/todo/.kosh/bindings.js +15 -0
  308. package/dist/todo/.kosh/schema.d.ts +732 -0
  309. package/dist/todo/demo.d.ts +6 -0
  310. package/dist/todo/demo.js +35 -0
  311. package/dist/todo/index.d.ts +3 -0
  312. package/dist/todo/index.js +187 -0
  313. package/dist/todo/module.d.ts +1180 -0
  314. package/dist/todo/module.js +130 -0
  315. package/dist/trade_finance/.kosh/bindings.d.ts +22 -0
  316. package/dist/trade_finance/.kosh/bindings.js +15 -0
  317. package/dist/trade_finance/.kosh/schema.d.ts +884 -0
  318. package/dist/trade_finance/demo.d.ts +6 -0
  319. package/dist/trade_finance/demo.js +63 -0
  320. package/dist/trade_finance/index.d.ts +3 -0
  321. package/dist/trade_finance/index.js +413 -0
  322. package/dist/trade_finance/module.d.ts +3779 -0
  323. package/dist/trade_finance/module.js +505 -0
  324. package/dist/trade_finance_account/.kosh/bindings.d.ts +22 -0
  325. package/dist/trade_finance_account/.kosh/bindings.js +15 -0
  326. package/dist/trade_finance_account/.kosh/schema.d.ts +1711 -0
  327. package/dist/trade_finance_account/index.d.ts +3 -0
  328. package/dist/trade_finance_account/index.js +92 -0
  329. package/dist/trade_finance_account/module.d.ts +7928 -0
  330. package/dist/trade_finance_account/module.js +244 -0
  331. package/dist/trade_finance_purchase/.kosh/bindings.d.ts +22 -0
  332. package/dist/trade_finance_purchase/.kosh/bindings.js +15 -0
  333. package/dist/trade_finance_purchase/.kosh/schema.d.ts +1153 -0
  334. package/dist/trade_finance_purchase/index.d.ts +8 -0
  335. package/dist/trade_finance_purchase/index.js +50 -0
  336. package/dist/trade_finance_purchase/module.d.ts +4252 -0
  337. package/dist/trade_finance_purchase/module.js +44 -0
  338. package/dist/trade_finance_sale/.kosh/bindings.d.ts +22 -0
  339. package/dist/trade_finance_sale/.kosh/bindings.js +15 -0
  340. package/dist/trade_finance_sale/.kosh/schema.d.ts +1071 -0
  341. package/dist/trade_finance_sale/index.d.ts +8 -0
  342. package/dist/trade_finance_sale/index.js +50 -0
  343. package/dist/trade_finance_sale/module.d.ts +4280 -0
  344. package/dist/trade_finance_sale/module.js +44 -0
  345. package/dist/ui/api.d.ts +6 -1
  346. package/dist/ui/api.js +2 -1
  347. package/dist/ui/app.js +51 -17
  348. package/dist/ui/components/AppIcon.js +33 -1
  349. package/dist/ui/components/Avatar.d.ts +21 -0
  350. package/dist/ui/components/Avatar.js +71 -0
  351. package/dist/ui/components/primitives.d.ts +2 -0
  352. package/dist/ui/components/primitives.js +7 -1
  353. package/dist/ui/i18n/messages.d.ts +53 -0
  354. package/dist/ui/i18n/messages.js +98 -0
  355. package/dist/ui/index.d.ts +2 -0
  356. package/dist/ui/index.js +2 -0
  357. package/dist/ui/offline/queue.d.ts +5 -1
  358. package/dist/ui/offline/queue.js +2 -0
  359. package/dist/ui/registry.d.ts +12 -1
  360. package/dist/ui/registry.js +10 -1
  361. package/dist/ui/search/ViewTabs.d.ts +14 -0
  362. package/dist/ui/search/ViewTabs.js +42 -0
  363. package/dist/ui/shell/Consent.d.ts +5 -0
  364. package/dist/ui/shell/Consent.js +35 -0
  365. package/dist/ui/shell/Home.js +136 -16
  366. package/dist/ui/shell/Sidebar.js +15 -22
  367. package/dist/ui/views/FormView.js +98 -17
  368. package/dist/ui/views/KanbanView.d.ts +2 -0
  369. package/dist/ui/views/KanbanView.js +32 -3
  370. package/dist/ui/views/ListView.js +155 -31
  371. package/dist/ui/views/StatsRow.d.ts +14 -0
  372. package/dist/ui/views/StatsRow.js +88 -0
  373. package/dist/ui/views/widgets.d.ts +2 -1
  374. package/dist/ui/views/widgets.js +194 -1
  375. package/dist/views/builders.d.ts +19 -2
  376. package/dist/views/builders.js +21 -1
  377. package/dist/views/condition.d.ts +6 -0
  378. package/dist/views/condition.js +20 -0
  379. package/dist/views/documents.d.ts +8 -0
  380. package/dist/views/extend.d.ts +2 -2
  381. package/dist/views/extend.js +11 -1
  382. package/dist/views/index.d.ts +2 -2
  383. package/dist/views/index.js +2 -2
  384. package/dist/views/types.d.ts +52 -5
  385. package/dist/views/validate.js +39 -1
  386. package/dist/website/.kosh/bindings.d.ts +22 -0
  387. package/dist/website/.kosh/bindings.js +15 -0
  388. package/dist/website/.kosh/schema.d.ts +881 -0
  389. package/dist/website/demo.d.ts +6 -0
  390. package/dist/website/demo.js +115 -0
  391. package/dist/website/index.d.ts +9 -0
  392. package/dist/website/index.js +250 -0
  393. package/dist/website/module.d.ts +2987 -0
  394. package/dist/website/module.js +281 -0
  395. package/dist/website/render.d.ts +45 -0
  396. package/dist/website/render.js +102 -0
  397. package/dist/website/routes.d.ts +12 -0
  398. package/dist/website/routes.js +246 -0
  399. package/dist/website/web/PagePreview.d.ts +7 -0
  400. package/dist/website/web/PagePreview.js +33 -0
  401. package/dist/website/web/index.d.ts +11 -0
  402. package/dist/website/web/index.js +16 -0
  403. package/dist/website/web/messages.d.ts +2 -0
  404. package/dist/website/web/messages.js +15 -0
  405. package/dist/website_crm/.kosh/bindings.d.ts +22 -0
  406. package/dist/website_crm/.kosh/bindings.js +15 -0
  407. package/dist/website_crm/.kosh/schema.d.ts +966 -0
  408. package/dist/website_crm/index.d.ts +3 -0
  409. package/dist/website_crm/index.js +39 -0
  410. package/dist/website_crm/module.d.ts +2955 -0
  411. package/dist/website_crm/module.js +44 -0
  412. package/package.json +118 -1
@@ -12,6 +12,7 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
12
12
  import { useState } from 'react';
13
13
  import { useTranslation } from 'react-i18next';
14
14
  import { ApiError } from '../api.js';
15
+ import { Avatar } from '../components/Avatar.js';
15
16
  import { Alert, Input, Skeleton } from '../components/primitives.js';
16
17
  import { useKosh } from '../context.js';
17
18
  import { cn } from '../lib/cn.js';
@@ -27,6 +28,24 @@ function amountOf(v) {
27
28
  return String(v.amount);
28
29
  return v === null || v === undefined ? '0' : String(v);
29
30
  }
31
+ const idOfValue = (v) => typeof v === 'number'
32
+ ? v
33
+ : typeof v === 'object' && v !== null && 'id' in v
34
+ ? Number(v.id)
35
+ : null;
36
+ const nameOfValue = (v) => typeof v === 'object' && v !== null && 'displayName' in v
37
+ ? String(v.displayName)
38
+ : typeof v === 'string'
39
+ ? v
40
+ : null;
41
+ /** A stable tint for a value (a stage, a tag): a hue from its text, in the theme's saturation. */
42
+ export const tintOf = (v) => {
43
+ const key = String(nameOfValue(v) ?? idOfValue(v) ?? v ?? '');
44
+ let h = 0;
45
+ for (const c of key)
46
+ h = (h * 31 + c.charCodeAt(0)) % 360;
47
+ return `oklch(0.7 0.14 ${h})`;
48
+ };
30
49
  function Card({ row, served, onOpen, }) {
31
50
  const { registry } = useKosh();
32
51
  const view = served.view;
@@ -50,9 +69,19 @@ function Card({ row, served, onOpen, }) {
50
69
  const field = fields[key];
51
70
  return field === undefined ? null : show({ kind: 'field', id: key, field: key });
52
71
  };
53
- return (_jsxs("li", { ref: setNodeRef, style: transform === null
54
- ? undefined
55
- : { transform: `translate3d(${transform.x}px, ${transform.y}px, 0)` }, className: cn('rounded-md border bg-surface p-3 text-sm shadow-sm transition-shadow hover:shadow-md', isDragging && 'opacity-70 shadow-lg'), children: [_jsxs("div", { className: "flex items-start justify-between gap-2", children: [_jsx("button", { type: "button", className: "text-start font-medium hover:underline", onClick: () => onOpen(row.id), children: text(view.card.title) }), _jsx("button", { type: "button", className: "cursor-grab rounded px-1 text-muted-foreground hover:bg-muted", "aria-label": `Move ${String(row['displayName'] ?? row[view.card.title] ?? row.id)}`, ...attributes, ...listeners, children: "\u283F" })] }), view.card.subtitle === undefined ? null : (_jsx("div", { className: "text-muted-foreground", children: text(view.card.subtitle) })), (view.card.badges ?? []).length === 0 ? null : (_jsx("div", { className: "mt-2 flex flex-wrap gap-1", children: (view.card.badges ?? []).map(show) })), (view.card.footer ?? []).length === 0 ? null : (_jsx("div", { className: "mt-2 flex flex-wrap justify-between gap-2 text-xs text-muted-foreground", children: (view.card.footer ?? []).map(show) }))] }));
72
+ return (_jsxs("li", { ref: setNodeRef, className: cn('rounded-md border bg-surface p-3 text-sm shadow-sm transition-shadow hover:shadow-md', isDragging && 'opacity-70 shadow-lg', view.card.color !== undefined && 'border-s-4'), style: {
73
+ ...(transform === null
74
+ ? {}
75
+ : { transform: `translate3d(${transform.x}px, ${transform.y}px, 0)` }),
76
+ ...(view.card.color === undefined
77
+ ? {}
78
+ : { borderInlineStartColor: tintOf(row[view.card.color]) }),
79
+ }, children: [view.card.image === undefined || idOfValue(row[view.card.image]) === null ? null : (_jsx("img", { src: `/api/v1/attachments/${idOfValue(row[view.card.image])}/download?inline=true&w=256`, alt: "", className: "mb-2 aspect-[4/3] w-full rounded object-cover" })), _jsxs("div", { className: "flex items-start justify-between gap-2", children: [view.card.avatar === undefined ? null : (_jsx(Avatar, { name: String((fields[view.card.avatar]?.target === 'storage.attachment'
80
+ ? (row['displayName'] ?? row['name'])
81
+ : nameOfValue(row[view.card.avatar])) ?? ''), src: fields[view.card.avatar]?.target === 'storage.attachment' &&
82
+ idOfValue(row[view.card.avatar]) !== null
83
+ ? `/api/v1/attachments/${idOfValue(row[view.card.avatar])}/download?inline=true&w=256`
84
+ : null, className: "mt-0.5" })), _jsx("button", { type: "button", className: "text-start font-medium hover:underline", onClick: () => onOpen(row.id), children: text(view.card.title) }), _jsx("button", { type: "button", className: "cursor-grab rounded px-1 text-muted-foreground hover:bg-muted", "aria-label": `Move ${String(row['displayName'] ?? row[view.card.title] ?? row.id)}`, ...attributes, ...listeners, children: "\u283F" })] }), view.card.subtitle === undefined ? null : (_jsx("div", { className: "text-muted-foreground", children: text(view.card.subtitle) })), (view.card.badges ?? []).length === 0 ? null : (_jsx("div", { className: "mt-2 flex flex-wrap gap-1", children: (view.card.badges ?? []).map(show) })), (view.card.footer ?? []).length === 0 ? null : (_jsx("div", { className: "mt-2 flex flex-wrap justify-between gap-2 text-xs text-muted-foreground", children: (view.card.footer ?? []).map(show) })), view.card.progress === undefined || typeof row[view.card.progress] !== 'number' ? null : (_jsx("div", { role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": row[view.card.progress], className: "mt-2 h-1.5 w-full overflow-hidden rounded-full bg-muted", children: _jsx("div", { className: "h-full rounded-full bg-primary", style: { width: `${Math.max(0, Math.min(100, row[view.card.progress]))}%` } }) }))] }));
56
85
  }
57
86
  function ColumnView({ column, props, keys, groupField, stats, folded, onUnfold, }) {
58
87
  const { api, format } = useKosh();
@@ -15,7 +15,7 @@ import { Archive, ArrowDown, ArrowUp, ChevronRight, Columns3, Download, Inbox, P
15
15
  import { useEffect, useMemo, useRef, useState, } from 'react';
16
16
  import { useTranslation } from 'react-i18next';
17
17
  import { ApiError } from '../api.js';
18
- import { Alert, Button, Checkbox, Dialog, EmptyState, Menu, MenuCheckboxItem, MenuContent, MenuItem, MenuLabel, MenuTrigger, Skeleton, } from '../components/primitives.js';
18
+ import { Alert, Button, Checkbox, Dialog, EmptyState, Menu, MenuCheckboxItem, MenuContent, MenuItem, MenuLabel, MenuSeparator, MenuTrigger, Skeleton, } from '../components/primitives.js';
19
19
  import { useKosh } from '../context.js';
20
20
  import { useDesign } from '../design.js';
21
21
  import { cn } from '../lib/cn.js';
@@ -27,6 +27,19 @@ import { PrefetchedNames, useRowNames } from './widgets.js';
27
27
  const features = tableFeatures({});
28
28
  const helper = createColumnHelper();
29
29
  const HEIGHTS = { comfortable: 40, compact: 32 };
30
+ /** The record's page in a new tab: the list's address with the record's id (`/<app>/a/<action>/<id>`). */
31
+ /** A decorated row (RFC 0022 §3.3): its text in the tone; `neutral` mutes it (done, cancelled). */
32
+ const ROW_TONES = {
33
+ danger: 'text-danger',
34
+ warning: 'text-warning-text',
35
+ success: 'text-success',
36
+ info: 'text-primary',
37
+ neutral: 'text-muted-foreground',
38
+ };
39
+ function openInNewTab(id) {
40
+ const path = window.location.pathname.replace(/\/$/, '');
41
+ window.open(`${path}/${id}`, '_blank', 'noopener');
42
+ }
30
43
  /** Requests a bulk action sends at once. */
31
44
  const PARALLEL = 6;
32
45
  /** How long a bulk delete waits for Undo before it runs. */
@@ -55,6 +68,43 @@ async function each(ids, fn) {
55
68
  }
56
69
  return { done, failed, reason };
57
70
  }
71
+ const MIN_WIDTH = 64;
72
+ const MAX_WIDTH = 960;
73
+ const DEFAULT_WIDTH = 160;
74
+ const SELECT_WIDTH = 40;
75
+ /**
76
+ * The handle at a header cell's end (RFC 0022 §3.5): drag it to resize the column, double-click to reset; with the
77
+ * keyboard, the arrows change the width by 16 px and Home resets it.
78
+ */
79
+ function ResizeHandle({ label, width, onResize, onReset, }) {
80
+ const drag = useRef(null);
81
+ return (_jsx("span", { role: "separator", "aria-orientation": "vertical", "aria-label": label, "aria-valuenow": width ?? undefined, tabIndex: 0, className: "absolute inset-y-0 end-0 w-2 cursor-col-resize touch-none select-none hover:bg-primary/30 focus-visible:bg-primary/40 focus-visible:outline-none", onPointerDown: (e) => {
82
+ const cell = e.currentTarget.parentElement;
83
+ if (cell === null)
84
+ return;
85
+ drag.current = { x: e.clientX, width: cell.getBoundingClientRect().width };
86
+ e.currentTarget.setPointerCapture(e.pointerId);
87
+ e.preventDefault();
88
+ }, onPointerMove: (e) => {
89
+ if (drag.current === null)
90
+ return;
91
+ onResize(drag.current.width + (e.clientX - drag.current.x) * (document.dir === 'rtl' ? -1 : 1));
92
+ }, onPointerUp: () => {
93
+ drag.current = null;
94
+ }, onDoubleClick: onReset, onKeyDown: (e) => {
95
+ const cell = e.currentTarget.parentElement;
96
+ const current = width ?? cell?.getBoundingClientRect().width ?? DEFAULT_WIDTH;
97
+ if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
98
+ const grow = (e.key === 'ArrowRight') !== (document.dir === 'rtl');
99
+ onResize(current + (grow ? 16 : -16));
100
+ e.preventDefault();
101
+ }
102
+ else if (e.key === 'Home') {
103
+ onReset();
104
+ e.preventDefault();
105
+ }
106
+ } }));
107
+ }
58
108
  const stored = {
59
109
  get(key, fallback) {
60
110
  try {
@@ -160,8 +210,35 @@ const SKELETON_CELLS = ['name', 'second', 'third', 'fourth', 'fifth', 'sixth'];
160
210
  function SkeletonRows({ columns, height }) {
161
211
  return (_jsx("div", { className: "grid gap-px p-3", "aria-busy": true, children: [0, 1, 2, 3, 4, 5, 6, 7].map((i) => (_jsx("div", { className: "flex items-center gap-6", style: { height }, children: SKELETON_CELLS.slice(0, Math.max(1, Math.min(columns, 6))).map((cell) => (_jsx(Skeleton, { className: cn('h-4', cell === 'name' ? 'w-1/4' : 'w-1/6') }, cell))) }, i))) }));
162
212
  }
163
- function Rows({ props, where, columns, fields, offset, limit, height, selection, hiddenIds, onCount, onRows, filtered, }) {
213
+ function Rows({ props, where, columns, fields, offset, limit, height, selection, hiddenIds, onCount, onRows, filtered, layout, }) {
164
214
  const { api, uid, companyId } = useKosh();
215
+ const { widths, pinned, setWidth } = layout;
216
+ // A column's cells: its width, and when pinned, stuck to the start after the pinned ones before it.
217
+ const colStyle = (id) => {
218
+ const width = widths[id];
219
+ const style = width === undefined ? {} : { width, minWidth: width, maxWidth: width };
220
+ if (!pinned.includes(id))
221
+ return style;
222
+ let left = selection === undefined ? 0 : SELECT_WIDTH;
223
+ for (const c of columns) {
224
+ if (c.id === id)
225
+ break;
226
+ if (pinned.includes(c.id))
227
+ left += widths[c.id] ?? DEFAULT_WIDTH;
228
+ }
229
+ return { ...style, position: 'sticky', left, zIndex: 1 };
230
+ };
231
+ const pinnedClass = (id) => pinned.includes(id) ? 'bg-surface shadow-[1px_0_0_0_var(--border)]' : undefined;
232
+ // Row decorations (RFC 0022 §3.3): the first tone whose condition holds on the row, danger first.
233
+ const decorations = props.served.view.type === 'list' ? props.served.view.decorations : undefined;
234
+ const rowTone = (row) => {
235
+ if (decorations === undefined)
236
+ return undefined;
237
+ for (const tone of ['danger', 'warning', 'success', 'info', 'neutral'])
238
+ if (holds(decorations[tone], row, { uid, companyId }))
239
+ return ROW_TONES[tone];
240
+ return undefined;
241
+ };
165
242
  const { t } = useTranslation();
166
243
  const toast = useToast();
167
244
  const queryClient = useQueryClient();
@@ -188,7 +265,6 @@ function Rows({ props, where, columns, fields, offset, limit, height, selection,
188
265
  offset,
189
266
  count: true,
190
267
  });
191
- onCount?.(result.count ?? result.items.length);
192
268
  rememberList(model, result.items.map((r) => r.id), offset, result.count ?? result.items.length);
193
269
  return result;
194
270
  },
@@ -199,6 +275,11 @@ function Rows({ props, where, columns, fields, offset, limit, height, selection,
199
275
  if (query.data !== undefined)
200
276
  onRows?.(query.data.items);
201
277
  }, [query.data, onRows]);
278
+ // From the data, not the fetch: a search answered from the cache (back to All) has its count too.
279
+ useEffect(() => {
280
+ if (query.data !== undefined)
281
+ onCount?.(query.data.count ?? query.data.items.length);
282
+ }, [query.data, onCount]);
202
283
  const names = useRowNames(items, Object.values(fields));
203
284
  const tableColumns = useMemo(() => helper.columns(columns.map((node) => helper.accessor((row) => row[node.field], {
204
285
  id: node.id,
@@ -488,7 +569,11 @@ function Rows({ props, where, columns, fields, offset, limit, height, selection,
488
569
  if (query.isError)
489
570
  return (_jsx(Alert, { action: _jsx(Button, { size: "sm", onClick: () => void query.refetch(), children: t('app.retry') }), children: query.error instanceof ApiError ? query.error.message : t('app.error') }));
490
571
  if (items.length === 0)
491
- return (_jsx(EmptyState, { icon: _jsx(Inbox, { "aria-hidden": true }), title: filtered === true ? t('views.emptyFiltered') : t('views.emptyTitle'), ...(filtered === true ? {} : { description: t('views.emptyHint') }), ...(props.served.operations.create && offset === 0
572
+ return (_jsx(EmptyState, { icon: _jsx(Inbox, { "aria-hidden": true }), title: filtered === true
573
+ ? t('views.emptyFiltered')
574
+ : props.served.view.label === undefined
575
+ ? t('views.emptyTitle')
576
+ : t('views.emptyNamed', { name: props.served.view.label.toLocaleLowerCase() }), ...(filtered === true ? {} : { description: t('views.emptyHint') }), ...(props.served.operations.create && offset === 0
492
577
  ? {
493
578
  action: (_jsxs(Button, { variant: "primary", size: "sm", onClick: () => props.onOpen('new'), children: [_jsx(Plus, { "aria-hidden": true }), t('views.createFirst')] })),
494
579
  }
@@ -514,19 +599,33 @@ function Rows({ props, where, columns, fields, offset, limit, height, selection,
514
599
  const direction = order[0]?.startsWith(`${node.field} `)
515
600
  ? order[0].split(' ')[1]
516
601
  : undefined;
517
- return (_jsx("th", { scope: "col", "aria-sort": direction === 'asc'
602
+ return (_jsxs("th", { scope: "col", style: colStyle(node.id), "aria-sort": direction === 'asc'
518
603
  ? 'ascending'
519
604
  : direction === 'desc'
520
605
  ? 'descending'
521
- : 'none', className: "px-3 py-2 text-start font-medium text-muted-foreground", children: _jsxs("button", { type: "button", className: "inline-flex items-center gap-1", onClick: () => toggleOrder(node.field), children: [_jsx(table.FlexRender, { header: header }), direction === 'asc' ? (_jsx(ArrowUp, { className: "size-3", "aria-hidden": true })) : direction === 'desc' ? (_jsx(ArrowDown, { className: "size-3", "aria-hidden": true })) : null] }) }, header.id));
606
+ : 'none', className: cn('relative px-3 py-2 text-start font-medium text-muted-foreground', pinnedClass(node.id)), children: [_jsxs("button", { type: "button", className: "inline-flex items-center gap-1", onClick: () => toggleOrder(node.field), children: [_jsx(table.FlexRender, { header: header }), direction === 'asc' ? (_jsx(ArrowUp, { className: "size-3", "aria-hidden": true })) : direction === 'desc' ? (_jsx(ArrowDown, { className: "size-3", "aria-hidden": true })) : null] }), _jsx(ResizeHandle, { label: t('views.resize', {
607
+ column: node.label ?? fields[node.field]?.label ?? node.field,
608
+ }), width: widths[node.id] ?? null, onResize: (w) => setWidth(node.id, w), onReset: () => setWidth(node.id, null) })] }, header.id));
522
609
  })] }, group.id))) }), _jsxs("tbody", { children: [top > 0 ? (_jsx("tr", { "aria-hidden": true, children: _jsx("td", { style: { height: top }, colSpan: span }) })) : null, virtual.map((v) => {
523
610
  const row = rows[v.index];
524
611
  if (row === undefined)
525
612
  return null;
526
613
  const id = row.original.id;
527
614
  const isSelected = selection?.selected.has(id) === true;
528
- return (_jsxs("tr", { tabIndex: 0, "aria-selected": selection === undefined ? undefined : isSelected, style: { height }, className: cn('cursor-pointer border-b hover:bg-muted/60 focus-visible:bg-muted', isSelected && 'bg-accent/60 hover:bg-accent/70'), onClick: () => props.onOpen(id), onKeyDown: (e) => {
529
- if (e.key === 'Enter')
615
+ return (_jsxs("tr", { tabIndex: 0, "aria-selected": selection === undefined ? undefined : isSelected, style: { height }, className: cn('cursor-pointer border-b hover:bg-muted/60 focus-visible:bg-muted', isSelected && 'bg-accent/60 hover:bg-accent/70', rowTone(row.original)),
616
+ // Ctrl / Cmd + click or the middle button: the record in a new tab, the list stays.
617
+ onClick: (e) => {
618
+ if (e.ctrlKey || e.metaKey)
619
+ openInNewTab(id);
620
+ else
621
+ props.onOpen(id);
622
+ }, onAuxClick: (e) => {
623
+ if (e.button === 1)
624
+ openInNewTab(id);
625
+ }, onKeyDown: (e) => {
626
+ if (e.key === 'Enter' && (e.ctrlKey || e.metaKey))
627
+ openInNewTab(id);
628
+ else if (e.key === 'Enter')
530
629
  props.onOpen(id);
531
630
  // Space on the row itself selects it (the checkbox handles its own keys).
532
631
  if (e.key === ' ' && selection !== undefined && e.target === e.currentTarget) {
@@ -544,7 +643,7 @@ function Rows({ props, where, columns, fields, offset, limit, height, selection,
544
643
  const isActive = active?.row === v.index && active.col === colIndex;
545
644
  const inSelection = range !== null && anchor !== null && inRange(range, ref);
546
645
  const isEditing = editing?.cell.row === v.index && editing.cell.col === colIndex;
547
- return (_jsx("td", { "data-row": v.index, "data-col": colIndex, tabIndex: isActive ? 0 : -1, className: cn(cellPad, 'outline-none', isActive && 'outline-2 -outline-offset-2 outline-primary', inSelection && 'bg-accent/40'), onFocus: () => {
646
+ return (_jsx("td", { "data-row": v.index, "data-col": colIndex, tabIndex: isActive ? 0 : -1, style: colStyle(node.id), className: cn(cellPad, 'outline-none', pinnedClass(node.id), isActive && 'outline-2 -outline-offset-2 outline-primary', inSelection && 'bg-accent/40'), onFocus: () => {
548
647
  if (isActive)
549
648
  return;
550
649
  setAnchor(null); // a click or Tab starts a new selection
@@ -600,7 +699,7 @@ function Totals({ props, columns, fields, }) {
600
699
  return (_jsxs("div", { className: "flex gap-2", children: [_jsx("dt", { className: "text-muted-foreground", children: totalLabel(t('views.total'), c.label ?? fields[c.field]?.label ?? c.field) }), _jsx("dd", { className: "font-medium tabular-nums", children: format.decimal(amount) })] }, c.id));
601
700
  }) }));
602
701
  }
603
- function Groups({ props, columns, fields, height, }) {
702
+ function Groups({ props, columns, fields, height, layout, }) {
604
703
  const { api } = useKosh();
605
704
  const { t } = useTranslation();
606
705
  const key = props.groupBy[0];
@@ -640,7 +739,7 @@ function Groups({ props, columns, fields, height, }) {
640
739
  else
641
740
  next.add(id);
642
741
  return next;
643
- }), children: [expandable ? (_jsx(ChevronRight, { className: cn('size-4 transition-transform rtl:-scale-x-100', isOpen && 'rotate-90'), "aria-hidden": true })) : null, _jsx("span", { children: label(value) }), _jsxs("span", { className: "text-muted-foreground", children: ["(", String(group['__count'] ?? 0), ")"] })] }), isOpen ? (_jsx(Rows, { props: props, where: and(props.where, { [field]: value }), columns: columns, fields: fields, offset: 0, limit: 200, height: height })) : null] }, id));
742
+ }), children: [expandable ? (_jsx(ChevronRight, { className: cn('size-4 transition-transform rtl:-scale-x-100', isOpen && 'rotate-90'), "aria-hidden": true })) : null, _jsx("span", { children: label(value) }), _jsxs("span", { className: "text-muted-foreground", children: ["(", String(group['__count'] ?? 0), ")"] })] }), isOpen ? (_jsx(Rows, { props: props, where: and(props.where, { [field]: value }), columns: columns, fields: fields, offset: 0, limit: 200, height: height, layout: layout })) : null] }, id));
644
743
  }) }));
645
744
  }
646
745
  /** Saves a downloaded file. */
@@ -675,9 +774,29 @@ export function ListView(props) {
675
774
  const allColumns = view.columns.filter((c) => fields[c.field] !== undefined);
676
775
  const columnsKey = `kosh.columns.${uid}.${view.id}`;
677
776
  const [hidden, setHidden] = useState(() => new Set(stored.get(columnsKey, [])));
777
+ // RFC 0022 §3.5: column widths (dragged or set with the keyboard) and pinned columns, per user and view.
778
+ const widthsKey = `kosh.widths.${uid}.${view.id}`;
779
+ const pinnedKey = `kosh.pinned.${uid}.${view.id}`;
780
+ const [widths, setWidths] = useState(() => stored.get(widthsKey, {}));
781
+ const [pinned, setPinned] = useState(() => stored.get(pinnedKey, []));
782
+ const setWidth = (id, width) => {
783
+ const next = { ...widths };
784
+ if (width === null)
785
+ delete next[id];
786
+ else
787
+ next[id] = Math.max(MIN_WIDTH, Math.min(MAX_WIDTH, Math.round(width)));
788
+ setWidths(next);
789
+ stored.set(widthsKey, next);
790
+ };
791
+ const togglePin = (id) => {
792
+ const next = pinned.includes(id) ? pinned.filter((p) => p !== id) : [...pinned, id];
793
+ setPinned(next);
794
+ stored.set(pinnedKey, next);
795
+ };
678
796
  const { density, setDensity } = useKosh();
679
797
  const height = HEIGHTS[density];
680
798
  const columns = allColumns.filter((c) => !hidden.has(c.id));
799
+ const layout = { widths, pinned, setWidth };
681
800
  const design = useDesign();
682
801
  const [offset, setOffset] = useState(0);
683
802
  const [count, setCount] = useState(null);
@@ -803,7 +922,7 @@ export function ListView(props) {
803
922
  ...(where === undefined ? {} : { filter: where }),
804
923
  ...(props.order.length === 0 ? {} : { order: props.order }),
805
924
  })
806
- : await api.download(`/api/v1/models/${encodeURIComponent(model)}/export/xlsx`, {
925
+ : await api.download(`/api/v1/models/${encodeURIComponent(model)}/export/${format}`, {
807
926
  fields: keys,
808
927
  ...(where === undefined ? {} : { filter: where }),
809
928
  });
@@ -814,25 +933,30 @@ export function ListView(props) {
814
933
  tone: 'danger',
815
934
  }),
816
935
  });
817
- const toolbar = ids.length > 0 ? (_jsxs("div", { role: "toolbar", "aria-label": t('views.selected', { count: ids.length }), className: "flex flex-wrap items-center gap-2 border-b bg-accent/40 px-3 py-2 text-sm", children: [_jsx("span", { className: "font-medium", children: t('views.selected', { count: ids.length }) }), _jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('views.clearSelection'), onClick: () => setSelected(new Set()), children: _jsx(X, { "aria-hidden": true }) }), _jsx("span", { className: "flex-1" }), transitions.map((tr) => (_jsx(Button, { size: "sm", busy: transition.isPending && transition.variables?.name === tr.name, onClick: () => transition.mutate({ name: tr.name, what: ids }), children: tr.name.charAt(0).toUpperCase() + tr.name.slice(1).replace(/_/g, ' ') }, tr.name))), archivable ? (_jsxs(Button, { size: "sm", busy: archive.isPending, onClick: () => archive.mutate(ids), children: [_jsx(Archive, { "aria-hidden": true }), t('views.archive')] })) : null, served.operations.unlink ? (_jsxs(Button, { size: "sm", variant: "danger", onClick: () => setConfirmingDelete(true), children: [_jsx(Trash2, { "aria-hidden": true }), t('views.delete')] })) : null, canExport ? (_jsxs(Button, { size: "sm", busy: exportAs.isPending, onClick: () => exportAs.mutate('csv'), children: [_jsx(Download, { "aria-hidden": true }), t('views.export')] })) : null] })) : (_jsxs("div", { className: "flex flex-wrap items-center gap-2 border-b px-3 py-1.5 text-sm", children: [_jsx("span", { className: "text-muted-foreground", children: count === null ? (_jsx(Skeleton, { className: "inline-block h-4 w-20" })) : (t('views.records', { count })) }), _jsx("span", { className: "flex-1" }), design.active ? (_jsxs(Button, { size: "sm", variant: "ghost", className: "border border-dashed border-primary/50 text-primary", onClick: () => design.choose({
818
- kind: 'list',
819
- view: view.id,
820
- model,
821
- after: allColumns.at(-1)?.id ?? '',
822
- shown: allColumns.map((c) => c.field),
823
- }), children: [_jsx(Plus, { "aria-hidden": true }), t('views.design.addColumn')] })) : null, _jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('views.density'), "aria-pressed": density === 'compact', title: density === 'compact' ? t('views.comfortable') : t('views.compact'), onClick: () => {
824
- const next = density === 'compact' ? 'comfortable' : 'compact';
825
- setDensity(next);
826
- }, children: _jsx(Rows3, { "aria-hidden": true }) }), _jsxs(Menu, { children: [_jsx(MenuTrigger, { asChild: true, children: _jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('views.columns'), children: _jsx(Columns3, { "aria-hidden": true }) }) }), _jsxs(MenuContent, { align: "end", children: [_jsx(MenuLabel, { children: t('views.columns') }), allColumns.map((c) => (_jsx(MenuCheckboxItem, { checked: !hidden.has(c.id), onCheckedChange: (checked) => {
827
- const next = new Set(hidden);
828
- if (checked)
829
- next.delete(c.id);
830
- else if (next.size < allColumns.length - 1)
831
- next.add(c.id);
832
- setHidden(next);
833
- stored.set(columnsKey, [...next]);
834
- }, children: c.label ?? fields[c.field]?.label ?? c.field }, c.id)))] })] }), canExport ? (_jsxs(Menu, { children: [_jsx(MenuTrigger, { asChild: true, children: _jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('views.export'), busy: exportAs.isPending, children: _jsx(Download, { "aria-hidden": true }) }) }), _jsxs(MenuContent, { align: "end", children: [_jsx(MenuLabel, { children: t('views.export') }), _jsx(MenuItem, { onSelect: () => exportAs.mutate('csv'), children: t('views.exportCsv') }), _jsx(MenuItem, { onSelect: () => exportAs.mutate('xlsx'), children: t('views.exportXlsx') })] })] })) : null] }));
835
- return (_jsxs("div", { className: "rounded-lg border bg-surface", children: [props.groupBy.length > 0 ? (_jsx(Groups, { props: props, columns: columns, fields: fields, height: height })) : (_jsxs(_Fragment, { children: [toolbar, _jsx(Rows, { props: props, where: props.where, columns: columns, fields: fields, offset: offset, limit: pageSize, height: height, selection: { selected, onToggle: toggle, onToggleAll: toggleAll }, hiddenIds: pendingDelete, onCount: setCount, onRows: setPageRows, filtered: filtered }), count !== null && count > pageSize ? (_jsxs("nav", { "aria-label": "Pagination", className: "flex items-center justify-end gap-2 border-t px-3 py-2 text-sm", children: [_jsx("span", { className: "text-muted-foreground", children: t('views.range', {
936
+ // Selected rows: a floating bar at the bottom of the screen (RFC 0018 §4.3); the list's own toolbar stays put.
937
+ const floating = ids.length > 0 ? (_jsxs("div", { role: "toolbar", "aria-label": t('views.selected', { count: ids.length }), "data-kosh-selection-bar": true, className: "fixed inset-x-0 bottom-4 z-30 mx-auto flex w-fit max-w-[calc(100vw-2rem)] flex-wrap items-center gap-2 rounded-xl border bg-surface px-3 py-2 text-sm shadow-lg", children: [_jsx("span", { className: "font-medium", children: t('views.selected', { count: ids.length }) }), _jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('views.clearSelection'), onClick: () => setSelected(new Set()), children: _jsx(X, { "aria-hidden": true }) }), _jsx("span", { className: "flex-1" }), transitions.map((tr) => (_jsx(Button, { size: "sm", busy: transition.isPending && transition.variables?.name === tr.name, onClick: () => transition.mutate({ name: tr.name, what: ids }), children: tr.name.charAt(0).toUpperCase() + tr.name.slice(1).replace(/_/g, ' ') }, tr.name))), archivable ? (_jsxs(Button, { size: "sm", busy: archive.isPending, onClick: () => archive.mutate(ids), children: [_jsx(Archive, { "aria-hidden": true }), t('views.archive')] })) : null, served.operations.unlink ? (_jsxs(Button, { size: "sm", variant: "danger", onClick: () => setConfirmingDelete(true), children: [_jsx(Trash2, { "aria-hidden": true }), t('views.delete')] })) : null, canExport ? (_jsxs(Button, { size: "sm", busy: exportAs.isPending, onClick: () => exportAs.mutate('csv'), children: [_jsx(Download, { "aria-hidden": true }), t('views.export')] })) : null] })) : null;
938
+ const toolbar = (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2 border-b px-3 py-1.5 text-sm", children: [_jsx("span", { className: "text-muted-foreground", children: count === null ? (_jsx(Skeleton, { className: "inline-block h-4 w-20" })) : (t('views.records', { count })) }), _jsx("span", { className: "flex-1" }), design.active ? (_jsxs(Button, { size: "sm", variant: "ghost", className: "border border-dashed border-primary/50 text-primary", onClick: () => design.choose({
939
+ kind: 'list',
940
+ view: view.id,
941
+ model,
942
+ after: allColumns.at(-1)?.id ?? '',
943
+ shown: allColumns.map((c) => c.field),
944
+ }), children: [_jsx(Plus, { "aria-hidden": true }), t('views.design.addColumn')] })) : null, _jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('views.density'), "aria-pressed": density === 'compact', title: density === 'compact' ? t('views.comfortable') : t('views.compact'), onClick: () => {
945
+ const next = density === 'compact' ? 'comfortable' : 'compact';
946
+ setDensity(next);
947
+ }, children: _jsx(Rows3, { "aria-hidden": true }) }), _jsxs(Menu, { children: [_jsx(MenuTrigger, { asChild: true, children: _jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('views.columns'), children: _jsx(Columns3, { "aria-hidden": true }) }) }), _jsxs(MenuContent, { align: "end", children: [_jsx(MenuLabel, { children: t('views.columns') }), allColumns.map((c) => (_jsx(MenuCheckboxItem, { checked: !hidden.has(c.id), onCheckedChange: (checked) => {
948
+ const next = new Set(hidden);
949
+ if (checked)
950
+ next.delete(c.id);
951
+ else if (next.size < allColumns.length - 1)
952
+ next.add(c.id);
953
+ setHidden(next);
954
+ stored.set(columnsKey, [...next]);
955
+ }, children: c.label ?? fields[c.field]?.label ?? c.field }, c.id))), _jsx(MenuSeparator, {}), _jsx(MenuLabel, { children: t('views.pinned') }), columns.map((c) => (_jsx(MenuCheckboxItem, { checked: pinned.includes(c.id), onCheckedChange: () => togglePin(c.id), children: c.label ?? fields[c.field]?.label ?? c.field }, `pin-${c.id}`))), Object.keys(widths).length === 0 ? null : (_jsxs(_Fragment, { children: [_jsx(MenuSeparator, {}), _jsx(MenuItem, { onSelect: () => {
956
+ setWidths({});
957
+ stored.set(widthsKey, {});
958
+ }, children: t('views.resetWidths') })] }))] })] }), canExport ? (_jsxs(Menu, { children: [_jsx(MenuTrigger, { asChild: true, children: _jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('views.export'), busy: exportAs.isPending, children: _jsx(Download, { "aria-hidden": true }) }) }), _jsxs(MenuContent, { align: "end", children: [_jsx(MenuLabel, { children: t('views.export') }), _jsx(MenuItem, { onSelect: () => exportAs.mutate('csv'), children: t('views.exportCsv') }), _jsx(MenuItem, { onSelect: () => exportAs.mutate('xlsx'), children: t('views.exportXlsx') }), _jsx(MenuItem, { onSelect: () => exportAs.mutate('pdf'), children: t('views.exportPdf') })] })] })) : null] }), floating] }));
959
+ return (_jsxs("div", { className: "rounded-lg border bg-surface", children: [props.groupBy.length > 0 ? (_jsx(Groups, { props: props, columns: columns, fields: fields, height: height, layout: layout })) : (_jsxs(_Fragment, { children: [toolbar, _jsx(Rows, { props: props, where: props.where, layout: layout, columns: columns, fields: fields, offset: offset, limit: pageSize, height: height, selection: { selected, onToggle: toggle, onToggleAll: toggleAll }, hiddenIds: pendingDelete, onCount: setCount, onRows: setPageRows, filtered: filtered }), count !== null && count > pageSize ? (_jsxs("nav", { "aria-label": "Pagination", className: "flex items-center justify-end gap-2 border-t px-3 py-2 text-sm", children: [_jsx("span", { className: "text-muted-foreground", children: t('views.range', {
836
960
  from: offset + 1,
837
961
  to: Math.min(offset + pageSize, count),
838
962
  total: count,
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A row of stat tiles on a record page (RFC 0022 §3.1): how many — or how much — of another model relate to this
3
+ * record, computed by the server with the user's rights (`aggregate`), live with the record's version, each tile a
4
+ * jump to that list filtered the same way. Other modules append their tiles to the row (view extensions).
5
+ */
6
+ import { type ConditionEnv, type StatsNode } from '../../views/index.js';
7
+ import type { ReactElement } from 'react';
8
+ export declare function StatsRow({ node, values, env, version, }: {
9
+ readonly node: StatsNode;
10
+ readonly values: Readonly<Record<string, unknown>>;
11
+ readonly env: ConditionEnv;
12
+ /** The record's version: tiles refetch when it changes. */
13
+ readonly version: string | null;
14
+ }): ReactElement | null;
@@ -0,0 +1,88 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * A row of stat tiles on a record page (RFC 0022 §3.1): how many — or how much — of another model relate to this
4
+ * record, computed by the server with the user's rights (`aggregate`), live with the record's version, each tile a
5
+ * jump to that list filtered the same way. Other modules append their tiles to the row (view extensions).
6
+ */
7
+ import { holds, resolveRecord, } from '../../views/index.js';
8
+ import { useQueries, useQuery } from '@tanstack/react-query';
9
+ import { useNavigate } from '@tanstack/react-router';
10
+ import { useKosh } from '../context.js';
11
+ import { cn } from '../lib/cn.js';
12
+ // The badge's tones (primitives), on the figure only.
13
+ const TONES = {
14
+ neutral: 'text-foreground',
15
+ info: 'text-primary',
16
+ success: 'text-success',
17
+ warning: 'text-warning-text',
18
+ danger: 'text-danger',
19
+ };
20
+ /** The measure's value as the aggregate route returns it: a count, a decimal string, or amounts per currency. */
21
+ function textOf(raw, format) {
22
+ if (raw === null || raw === undefined)
23
+ return { text: '0' };
24
+ if (typeof raw === 'number')
25
+ return { text: format.number(raw) };
26
+ if (typeof raw === 'string')
27
+ return { text: format.decimal(raw) };
28
+ if (Array.isArray(raw)) {
29
+ const [first] = raw;
30
+ if (first === undefined)
31
+ return { text: '0' };
32
+ return {
33
+ text: format.decimal(String(first.amount ?? '0')),
34
+ ...(typeof first.currency === 'string' ? { currency: first.currency } : {}),
35
+ };
36
+ }
37
+ if (typeof raw === 'object' && 'amount' in raw) {
38
+ const a = raw;
39
+ return {
40
+ text: format.decimal(String(a.amount)),
41
+ ...(typeof a.currency === 'string' ? { currency: a.currency } : {}),
42
+ };
43
+ }
44
+ return { text: String(raw) };
45
+ }
46
+ export function StatsRow({ node, values, env, version, }) {
47
+ const { api, format } = useKosh();
48
+ const navigate = useNavigate();
49
+ const routes = useQuery({ queryKey: ['routes'], queryFn: () => api.routes() });
50
+ const tiles = node.children.filter((tile) => tile.visibleWhen === undefined || holds(tile.visibleWhen, values, env));
51
+ const wheres = tiles.map((tile) => resolveRecord(tile.where, values));
52
+ const results = useQueries({
53
+ queries: tiles.map((tile, i) => ({
54
+ queryKey: ['stat', tile.model, wheres[i], tile.measure ?? 'count', version],
55
+ queryFn: async () => {
56
+ const [row] = await api.aggregate(tile.model, {
57
+ where: wheres[i],
58
+ measures: { value: tile.measure ?? 'count' },
59
+ });
60
+ return row?.['value'] ?? null;
61
+ },
62
+ })),
63
+ });
64
+ if (tiles.length === 0)
65
+ return null;
66
+ const open = (i) => {
67
+ const tile = tiles[i];
68
+ if (tile === undefined)
69
+ return;
70
+ const route = routes.data?.[tile.model];
71
+ const action = tile.action ?? route?.action;
72
+ if (action === undefined || route?.app === undefined)
73
+ return;
74
+ void navigate({
75
+ to: '/$app/a/$action',
76
+ params: { app: route.app, action },
77
+ search: { q: JSON.stringify({ c: wheres[i], cl: tile.label }) },
78
+ });
79
+ };
80
+ return (_jsx("section", { "aria-label": node.id, className: "col-span-full grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4", children: tiles.map((tile, i) => {
81
+ const result = results[i];
82
+ const value = textOf(result?.data, format);
83
+ const clickable = routes.data?.[tile.model]?.app !== undefined;
84
+ const body = (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-xs font-medium text-muted-foreground", children: tile.label }), _jsxs("span", { className: cn('text-xl font-semibold tabular-nums leading-tight', TONES[tile.tone ?? 'neutral']), children: [result?.isPending === true ? '…' : value.text, value.currency === undefined ? null : (_jsx("span", { className: "ms-1 text-xs font-normal text-muted-foreground", children: value.currency }))] })] }));
85
+ const className = 'grid gap-0.5 rounded-lg border bg-surface px-3 py-2 text-start transition-colors';
86
+ return clickable ? (_jsx("button", { type: "button", className: cn(className, 'hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring'), onClick: () => open(i), children: body }, tile.id)) : (_jsx("div", { className: className, children: body }, tile.id));
87
+ }) }));
88
+ }
@@ -12,6 +12,7 @@ export declare function useRowNames(rows: readonly Readonly<Record<string, unkno
12
12
  readonly kind: string;
13
13
  readonly target?: string;
14
14
  }[]): ReadonlyMap<string, ReadonlyMap<number, string>>;
15
- /** Registers the default widgets. */
15
+ /** A stable tint for a value (a stage, a tag): a hue from its text. */
16
+ export declare const tintOf: (key: string) => string;
16
17
  export declare function registerDefaultWidgets(registry: Registry): Registry;
17
18
  export {};