shutro-erp 0.3.4 → 0.3.6

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 (618) hide show
  1. package/dist/account_asset/.kosh/bindings.d.ts +22 -0
  2. package/dist/account_asset/.kosh/bindings.js +15 -0
  3. package/dist/account_asset/.kosh/schema.d.ts +1755 -0
  4. package/dist/account_asset/board.d.ts +61 -0
  5. package/dist/account_asset/board.js +86 -0
  6. package/dist/account_asset/books.d.ts +42 -0
  7. package/dist/account_asset/books.js +398 -0
  8. package/dist/account_asset/demo.d.ts +7 -0
  9. package/dist/account_asset/demo.js +72 -0
  10. package/dist/account_asset/index.d.ts +9 -0
  11. package/dist/account_asset/index.js +335 -0
  12. package/dist/account_asset/module.d.ts +7622 -0
  13. package/dist/account_asset/module.js +230 -0
  14. package/dist/account_budget/.kosh/bindings.d.ts +22 -0
  15. package/dist/account_budget/.kosh/bindings.js +15 -0
  16. package/dist/account_budget/.kosh/schema.d.ts +1767 -0
  17. package/dist/account_budget/budget.d.ts +5 -0
  18. package/dist/account_budget/budget.js +142 -0
  19. package/dist/account_budget/demo.d.ts +6 -0
  20. package/dist/account_budget/demo.js +30 -0
  21. package/dist/account_budget/index.d.ts +4 -0
  22. package/dist/account_budget/index.js +223 -0
  23. package/dist/account_budget/module.d.ts +13863 -0
  24. package/dist/account_budget/module.js +167 -0
  25. package/dist/account_portal/.kosh/bindings.js +1 -1
  26. package/dist/account_portal/.kosh/schema.d.ts +176 -6
  27. package/dist/account_portal/module.d.ts +505 -6
  28. package/dist/accounting/.kosh/bindings.js +1 -1
  29. package/dist/accounting/.kosh/schema.d.ts +176 -6
  30. package/dist/accounting/index.d.ts +1 -1
  31. package/dist/accounting/index.js +344 -4
  32. package/dist/accounting/module.d.ts +513 -5
  33. package/dist/accounting/module.js +55 -3
  34. package/dist/approvals/.kosh/bindings.d.ts +22 -0
  35. package/dist/approvals/.kosh/bindings.js +15 -0
  36. package/dist/approvals/.kosh/schema.d.ts +611 -0
  37. package/dist/approvals/index.d.ts +18 -0
  38. package/dist/approvals/index.js +302 -0
  39. package/dist/approvals/mails.d.ts +25 -0
  40. package/dist/approvals/mails.js +82 -0
  41. package/dist/approvals/module.d.ts +1 -0
  42. package/dist/approvals/module.js +12 -0
  43. package/dist/approvals/web/History.d.ts +4 -0
  44. package/dist/approvals/web/History.js +13 -0
  45. package/dist/approvals/web/Inbox.d.ts +9 -0
  46. package/dist/approvals/web/Inbox.js +114 -0
  47. package/dist/approvals/web/Mine.d.ts +7 -0
  48. package/dist/approvals/web/Mine.js +27 -0
  49. package/dist/approvals/web/index.d.ts +13 -0
  50. package/dist/approvals/web/index.js +22 -0
  51. package/dist/approvals/web/messages.d.ts +2 -0
  52. package/dist/approvals/web/messages.js +119 -0
  53. package/dist/approvals/web/shared.d.ts +59 -0
  54. package/dist/approvals/web/shared.js +46 -0
  55. package/dist/attendance/.kosh/bindings.d.ts +22 -0
  56. package/dist/attendance/.kosh/bindings.js +15 -0
  57. package/dist/attendance/.kosh/schema.d.ts +1048 -0
  58. package/dist/attendance/days.d.ts +96 -0
  59. package/dist/attendance/days.js +430 -0
  60. package/dist/attendance/demo.d.ts +7 -0
  61. package/dist/attendance/demo.js +58 -0
  62. package/dist/attendance/index.d.ts +4 -0
  63. package/dist/attendance/index.js +513 -0
  64. package/dist/attendance/module.d.ts +3969 -0
  65. package/dist/attendance/module.js +412 -0
  66. package/dist/attendance/routes.d.ts +16 -0
  67. package/dist/attendance/routes.js +266 -0
  68. package/dist/attendance/web/Check.d.ts +8 -0
  69. package/dist/attendance/web/Check.js +40 -0
  70. package/dist/attendance/web/Kiosk.d.ts +8 -0
  71. package/dist/attendance/web/Kiosk.js +62 -0
  72. package/dist/attendance/web/PinButton.d.ts +7 -0
  73. package/dist/attendance/web/PinButton.js +29 -0
  74. package/dist/attendance/web/index.d.ts +13 -0
  75. package/dist/attendance/web/index.js +22 -0
  76. package/dist/attendance/web/messages.d.ts +2 -0
  77. package/dist/attendance/web/messages.js +61 -0
  78. package/dist/calendar/.kosh/bindings.d.ts +22 -0
  79. package/dist/calendar/.kosh/bindings.js +15 -0
  80. package/dist/calendar/.kosh/schema.d.ts +795 -0
  81. package/dist/calendar/demo.d.ts +6 -0
  82. package/dist/calendar/demo.js +24 -0
  83. package/dist/calendar/index.d.ts +3 -0
  84. package/dist/calendar/index.js +291 -0
  85. package/dist/calendar/module.d.ts +1705 -0
  86. package/dist/calendar/module.js +180 -0
  87. package/dist/cli/init.js +80 -0
  88. package/dist/cli/templates.d.ts +1 -1
  89. package/dist/cli/templates.js +226 -0
  90. package/dist/contacts/.kosh/bindings.js +1 -1
  91. package/dist/contacts/.kosh/schema.d.ts +78 -3
  92. package/dist/contacts/demo.js +30 -1
  93. package/dist/contacts/index.d.ts +1 -1
  94. package/dist/contacts/index.js +155 -9
  95. package/dist/contacts/module.d.ts +338 -2
  96. package/dist/contacts/module.js +93 -5
  97. package/dist/crm/.kosh/bindings.d.ts +22 -0
  98. package/dist/crm/.kosh/bindings.js +15 -0
  99. package/dist/crm/.kosh/schema.d.ts +800 -0
  100. package/dist/crm/demo.d.ts +6 -0
  101. package/dist/crm/demo.js +45 -0
  102. package/dist/crm/index.d.ts +3 -0
  103. package/dist/crm/index.js +361 -0
  104. package/dist/crm/module.d.ts +1845 -0
  105. package/dist/crm/module.js +208 -0
  106. package/dist/documents/.kosh/bindings.d.ts +22 -0
  107. package/dist/documents/.kosh/bindings.js +15 -0
  108. package/dist/documents/.kosh/schema.d.ts +862 -0
  109. package/dist/documents/demo.d.ts +6 -0
  110. package/dist/documents/demo.js +22 -0
  111. package/dist/documents/documents.d.ts +98 -0
  112. package/dist/documents/documents.js +318 -0
  113. package/dist/documents/index.d.ts +30 -0
  114. package/dist/documents/index.js +442 -0
  115. package/dist/documents/module.d.ts +2781 -0
  116. package/dist/documents/module.js +214 -0
  117. package/dist/documents/web/Versions.d.ts +7 -0
  118. package/dist/documents/web/Versions.js +45 -0
  119. package/dist/documents/web/index.d.ts +11 -0
  120. package/dist/documents/web/index.js +16 -0
  121. package/dist/documents/web/messages.d.ts +2 -0
  122. package/dist/documents/web/messages.js +21 -0
  123. package/dist/event/.kosh/bindings.d.ts +22 -0
  124. package/dist/event/.kosh/bindings.js +15 -0
  125. package/dist/event/.kosh/schema.d.ts +843 -0
  126. package/dist/event/demo.d.ts +6 -0
  127. package/dist/event/demo.js +65 -0
  128. package/dist/event/index.d.ts +14 -0
  129. package/dist/event/index.js +333 -0
  130. package/dist/event/mails.d.ts +15 -0
  131. package/dist/event/mails.js +112 -0
  132. package/dist/event/module.d.ts +2800 -0
  133. package/dist/event/module.js +323 -0
  134. package/dist/event/web/CheckInBox.d.ts +9 -0
  135. package/dist/event/web/CheckInBox.js +87 -0
  136. package/dist/event/web/index.d.ts +11 -0
  137. package/dist/event/web/index.js +16 -0
  138. package/dist/event/web/messages.d.ts +2 -0
  139. package/dist/event/web/messages.js +23 -0
  140. package/dist/event_account/.kosh/bindings.d.ts +22 -0
  141. package/dist/event_account/.kosh/bindings.js +15 -0
  142. package/dist/event_account/.kosh/schema.d.ts +1758 -0
  143. package/dist/event_account/index.d.ts +3 -0
  144. package/dist/event_account/index.js +28 -0
  145. package/dist/event_account/module.d.ts +7114 -0
  146. package/dist/event_account/module.js +90 -0
  147. package/dist/expense/.kosh/bindings.d.ts +22 -0
  148. package/dist/expense/.kosh/bindings.js +15 -0
  149. package/dist/expense/.kosh/schema.d.ts +1299 -0
  150. package/dist/expense/demo.d.ts +7 -0
  151. package/dist/expense/demo.js +69 -0
  152. package/dist/expense/index.d.ts +3 -0
  153. package/dist/expense/index.js +495 -0
  154. package/dist/expense/module.d.ts +4747 -0
  155. package/dist/expense/module.js +647 -0
  156. package/dist/expense_account/.kosh/bindings.d.ts +22 -0
  157. package/dist/expense_account/.kosh/bindings.js +15 -0
  158. package/dist/expense_account/.kosh/schema.d.ts +1936 -0
  159. package/dist/expense_account/index.d.ts +3 -0
  160. package/dist/expense_account/index.js +74 -0
  161. package/dist/expense_account/module.d.ts +9153 -0
  162. package/dist/expense_account/module.js +318 -0
  163. package/dist/helpdesk/.kosh/bindings.d.ts +22 -0
  164. package/dist/helpdesk/.kosh/bindings.js +15 -0
  165. package/dist/helpdesk/.kosh/schema.d.ts +885 -0
  166. package/dist/helpdesk/demo.d.ts +7 -0
  167. package/dist/helpdesk/demo.js +65 -0
  168. package/dist/helpdesk/hours.d.ts +17 -0
  169. package/dist/helpdesk/hours.js +94 -0
  170. package/dist/helpdesk/index.d.ts +10 -0
  171. package/dist/helpdesk/index.js +461 -0
  172. package/dist/helpdesk/module.d.ts +2940 -0
  173. package/dist/helpdesk/module.js +326 -0
  174. package/dist/helpdesk/routes.d.ts +12 -0
  175. package/dist/helpdesk/routes.js +132 -0
  176. package/dist/helpdesk/sla.d.ts +37 -0
  177. package/dist/helpdesk/sla.js +226 -0
  178. package/dist/hr/.kosh/bindings.d.ts +22 -0
  179. package/dist/hr/.kosh/bindings.js +15 -0
  180. package/dist/hr/.kosh/schema.d.ts +878 -0
  181. package/dist/hr/demo.d.ts +6 -0
  182. package/dist/hr/demo.js +60 -0
  183. package/dist/hr/index.d.ts +3 -0
  184. package/dist/hr/index.js +483 -0
  185. package/dist/hr/module.d.ts +2611 -0
  186. package/dist/hr/module.js +350 -0
  187. package/dist/l10n_bd/.kosh/bindings.js +1 -1
  188. package/dist/l10n_bd/.kosh/schema.d.ts +176 -6
  189. package/dist/l10n_bd/module.d.ts +505 -6
  190. package/dist/l10n_bd_payroll/.kosh/bindings.d.ts +22 -0
  191. package/dist/l10n_bd_payroll/.kosh/bindings.js +15 -0
  192. package/dist/l10n_bd_payroll/.kosh/schema.d.ts +2312 -0
  193. package/dist/l10n_bd_payroll/data.d.ts +47 -0
  194. package/dist/l10n_bd_payroll/data.js +347 -0
  195. package/dist/l10n_bd_payroll/index.d.ts +4 -0
  196. package/dist/l10n_bd_payroll/index.js +24 -0
  197. package/dist/l10n_bd_payroll/module.d.ts +12932 -0
  198. package/dist/l10n_bd_payroll/module.js +86 -0
  199. package/dist/l10n_in/.kosh/bindings.js +1 -1
  200. package/dist/l10n_in/.kosh/schema.d.ts +176 -6
  201. package/dist/l10n_in/module.d.ts +527 -7
  202. package/dist/mail/inbound/handle.js +6 -1
  203. package/dist/maintenance/.kosh/bindings.d.ts +22 -0
  204. package/dist/maintenance/.kosh/bindings.js +15 -0
  205. package/dist/maintenance/.kosh/schema.d.ts +911 -0
  206. package/dist/maintenance/demo.d.ts +6 -0
  207. package/dist/maintenance/demo.js +60 -0
  208. package/dist/maintenance/index.d.ts +3 -0
  209. package/dist/maintenance/index.js +422 -0
  210. package/dist/maintenance/module.d.ts +3545 -0
  211. package/dist/maintenance/module.js +446 -0
  212. package/dist/maintenance_stock/.kosh/bindings.d.ts +22 -0
  213. package/dist/maintenance_stock/.kosh/bindings.js +15 -0
  214. package/dist/maintenance_stock/.kosh/schema.d.ts +1446 -0
  215. package/dist/maintenance_stock/index.d.ts +9 -0
  216. package/dist/maintenance_stock/index.js +52 -0
  217. package/dist/maintenance_stock/module.d.ts +7675 -0
  218. package/dist/maintenance_stock/module.js +192 -0
  219. package/dist/modules-sdk/index.d.ts +1 -1
  220. package/dist/modules-sdk/manifest.d.ts +109 -2
  221. package/dist/modules-sdk/manifest.js +35 -1
  222. package/dist/mrp/.kosh/bindings.d.ts +22 -0
  223. package/dist/mrp/.kosh/bindings.js +15 -0
  224. package/dist/mrp/.kosh/schema.d.ts +1453 -0
  225. package/dist/mrp/demo.d.ts +7 -0
  226. package/dist/mrp/demo.js +42 -0
  227. package/dist/mrp/index.d.ts +3 -0
  228. package/dist/mrp/index.js +393 -0
  229. package/dist/mrp/module.d.ts +9335 -0
  230. package/dist/mrp/module.js +757 -0
  231. package/dist/mrp_account/.kosh/bindings.d.ts +22 -0
  232. package/dist/mrp_account/.kosh/bindings.js +15 -0
  233. package/dist/mrp_account/.kosh/schema.d.ts +2299 -0
  234. package/dist/mrp_account/index.d.ts +3 -0
  235. package/dist/mrp_account/index.js +22 -0
  236. package/dist/mrp_account/module.d.ts +23151 -0
  237. package/dist/mrp_account/module.js +123 -0
  238. package/dist/payment/.kosh/bindings.js +1 -1
  239. package/dist/payment/.kosh/schema.d.ts +178 -7
  240. package/dist/payment/index.d.ts +41 -0
  241. package/dist/payment/index.js +131 -74
  242. package/dist/payment/module.d.ts +569 -12
  243. package/dist/payment/module.js +19 -3
  244. package/dist/payment/settle.js +10 -1
  245. package/dist/payroll/.kosh/bindings.d.ts +22 -0
  246. package/dist/payroll/.kosh/bindings.js +15 -0
  247. package/dist/payroll/.kosh/schema.d.ts +1390 -0
  248. package/dist/payroll/compute.d.ts +35 -0
  249. package/dist/payroll/compute.js +398 -0
  250. package/dist/payroll/demo.d.ts +55 -0
  251. package/dist/payroll/demo.js +121 -0
  252. package/dist/payroll/formula.d.ts +62 -0
  253. package/dist/payroll/formula.js +320 -0
  254. package/dist/payroll/index.d.ts +230 -0
  255. package/dist/payroll/index.js +713 -0
  256. package/dist/payroll/module.d.ts +9390 -0
  257. package/dist/payroll/module.js +606 -0
  258. package/dist/payroll/routes.d.ts +10 -0
  259. package/dist/payroll/routes.js +112 -0
  260. package/dist/payroll_account/.kosh/bindings.d.ts +22 -0
  261. package/dist/payroll_account/.kosh/bindings.js +15 -0
  262. package/dist/payroll_account/.kosh/schema.d.ts +2308 -0
  263. package/dist/payroll_account/index.d.ts +3 -0
  264. package/dist/payroll_account/index.js +40 -0
  265. package/dist/payroll_account/module.d.ts +12396 -0
  266. package/dist/payroll_account/module.js +256 -0
  267. package/dist/permissions/approvals.d.ts +131 -9
  268. package/dist/permissions/approvals.js +662 -57
  269. package/dist/permissions/index.d.ts +1 -1
  270. package/dist/permissions/index.js +2 -2
  271. package/dist/permissions/models.js +191 -12
  272. package/dist/permissions/routes.d.ts +6 -1
  273. package/dist/permissions/routes.js +37 -4
  274. package/dist/permissions/web/ApprovalPanel.d.ts +5 -4
  275. package/dist/permissions/web/ApprovalPanel.js +39 -13
  276. package/dist/permissions/web/index.d.ts +6 -4
  277. package/dist/permissions/web/index.js +13 -4
  278. package/dist/permissions/web/messages.d.ts +2 -0
  279. package/dist/permissions/web/messages.js +43 -0
  280. package/dist/portal/.kosh/bindings.js +1 -1
  281. package/dist/portal/.kosh/schema.d.ts +78 -3
  282. package/dist/portal/index.js +1 -1
  283. package/dist/portal/module.d.ts +166 -2
  284. package/dist/pos/.kosh/bindings.d.ts +22 -0
  285. package/dist/pos/.kosh/bindings.js +15 -0
  286. package/dist/pos/.kosh/schema.d.ts +1809 -0
  287. package/dist/pos/accounting.d.ts +10 -0
  288. package/dist/pos/accounting.js +149 -0
  289. package/dist/pos/demo.d.ts +6 -0
  290. package/dist/pos/demo.js +90 -0
  291. package/dist/pos/index.d.ts +9 -0
  292. package/dist/pos/index.js +353 -0
  293. package/dist/pos/module.d.ts +9783 -0
  294. package/dist/pos/module.js +423 -0
  295. package/dist/pos/routes.d.ts +39 -0
  296. package/dist/pos/routes.js +368 -0
  297. package/dist/pos/web/Register.d.ts +9 -0
  298. package/dist/pos/web/Register.js +252 -0
  299. package/dist/pos/web/index.d.ts +11 -0
  300. package/dist/pos/web/index.js +16 -0
  301. package/dist/pos/web/messages.d.ts +2 -0
  302. package/dist/pos/web/messages.js +87 -0
  303. package/dist/pos_stock/.kosh/bindings.d.ts +22 -0
  304. package/dist/pos_stock/.kosh/bindings.js +15 -0
  305. package/dist/pos_stock/.kosh/schema.d.ts +2208 -0
  306. package/dist/pos_stock/index.d.ts +9 -0
  307. package/dist/pos_stock/index.js +35 -0
  308. package/dist/pos_stock/module.d.ts +12803 -0
  309. package/dist/pos_stock/module.js +115 -0
  310. package/dist/product/.kosh/bindings.js +1 -1
  311. package/dist/product/.kosh/schema.d.ts +52 -1
  312. package/dist/product/index.js +94 -4
  313. package/dist/product/module.d.ts +45 -1
  314. package/dist/product/module.js +11 -3
  315. package/dist/project/.kosh/bindings.js +1 -1
  316. package/dist/project/.kosh/schema.d.ts +725 -3
  317. package/dist/project/index.d.ts +3 -1
  318. package/dist/project/index.js +1045 -18
  319. package/dist/project/module.d.ts +10168 -458
  320. package/dist/project/module.js +1578 -14
  321. package/dist/project/routes.d.ts +44 -0
  322. package/dist/project/routes.js +314 -0
  323. package/dist/project/schedule.d.ts +72 -0
  324. package/dist/project/schedule.js +192 -0
  325. package/dist/project/web/Refresh.d.ts +8 -0
  326. package/dist/project/web/Refresh.js +29 -0
  327. package/dist/project/web/Schedule.d.ts +9 -0
  328. package/dist/project/web/Schedule.js +93 -0
  329. package/dist/project/web/Structure.d.ts +8 -0
  330. package/dist/project/web/Structure.js +86 -0
  331. package/dist/project/web/Workload.d.ts +8 -0
  332. package/dist/project/web/Workload.js +43 -0
  333. package/dist/project/web/index.d.ts +14 -0
  334. package/dist/project/web/index.js +25 -0
  335. package/dist/project/web/messages.d.ts +2 -0
  336. package/dist/project/web/messages.js +85 -0
  337. package/dist/project_account/.kosh/bindings.d.ts +22 -0
  338. package/dist/project_account/.kosh/bindings.js +15 -0
  339. package/dist/project_account/.kosh/schema.d.ts +2241 -0
  340. package/dist/project_account/index.d.ts +3 -0
  341. package/dist/project_account/index.js +27 -0
  342. package/dist/project_account/module.d.ts +11539 -0
  343. package/dist/project_account/module.js +76 -0
  344. package/dist/project_portal/.kosh/bindings.js +1 -1
  345. package/dist/project_portal/.kosh/schema.d.ts +725 -3
  346. package/dist/project_portal/module.d.ts +5137 -119
  347. package/dist/project_purchase/.kosh/bindings.d.ts +22 -0
  348. package/dist/project_purchase/.kosh/bindings.js +15 -0
  349. package/dist/project_purchase/.kosh/schema.d.ts +2320 -0
  350. package/dist/project_purchase/index.d.ts +9 -0
  351. package/dist/project_purchase/index.js +22 -0
  352. package/dist/project_purchase/module.d.ts +25147 -0
  353. package/dist/project_purchase/module.js +56 -0
  354. package/dist/purchase/.kosh/bindings.js +1 -1
  355. package/dist/purchase/.kosh/schema.d.ts +150 -6
  356. package/dist/purchase/index.js +163 -3
  357. package/dist/purchase/module.d.ts +228 -5
  358. package/dist/purchase/module.js +30 -3
  359. package/dist/purchase_account/.kosh/bindings.js +1 -1
  360. package/dist/purchase_account/.kosh/schema.d.ts +180 -8
  361. package/dist/purchase_account/index.js +27 -1
  362. package/dist/purchase_account/module.d.ts +591 -30
  363. package/dist/purchase_account/module.js +13 -2
  364. package/dist/purchase_portal/.kosh/bindings.js +1 -1
  365. package/dist/purchase_portal/.kosh/schema.d.ts +150 -6
  366. package/dist/purchase_portal/module.d.ts +372 -6
  367. package/dist/purchase_stock/.kosh/bindings.d.ts +22 -0
  368. package/dist/purchase_stock/.kosh/bindings.js +15 -0
  369. package/dist/purchase_stock/.kosh/schema.d.ts +1479 -0
  370. package/dist/purchase_stock/index.d.ts +7 -0
  371. package/dist/purchase_stock/index.js +98 -0
  372. package/dist/purchase_stock/module.d.ts +7535 -0
  373. package/dist/purchase_stock/module.js +380 -0
  374. package/dist/purchase_stock_account/.kosh/bindings.d.ts +22 -0
  375. package/dist/purchase_stock_account/.kosh/bindings.js +15 -0
  376. package/dist/purchase_stock_account/.kosh/schema.d.ts +2155 -0
  377. package/dist/purchase_stock_account/index.d.ts +3 -0
  378. package/dist/purchase_stock_account/index.js +24 -0
  379. package/dist/purchase_stock_account/module.d.ts +38015 -0
  380. package/dist/purchase_stock_account/module.js +168 -0
  381. package/dist/recruitment/.kosh/bindings.d.ts +22 -0
  382. package/dist/recruitment/.kosh/bindings.js +15 -0
  383. package/dist/recruitment/.kosh/schema.d.ts +991 -0
  384. package/dist/recruitment/demo.d.ts +6 -0
  385. package/dist/recruitment/demo.js +45 -0
  386. package/dist/recruitment/index.d.ts +3 -0
  387. package/dist/recruitment/index.js +385 -0
  388. package/dist/recruitment/module.d.ts +3249 -0
  389. package/dist/recruitment/module.js +194 -0
  390. package/dist/recruitment/web/HireButton.d.ts +9 -0
  391. package/dist/recruitment/web/HireButton.js +32 -0
  392. package/dist/recruitment/web/index.d.ts +11 -0
  393. package/dist/recruitment/web/index.js +16 -0
  394. package/dist/recruitment/web/messages.d.ts +2 -0
  395. package/dist/recruitment/web/messages.js +19 -0
  396. package/dist/reporting/documents.d.ts +5 -0
  397. package/dist/reporting/documents.js +28 -1
  398. package/dist/reporting/index.d.ts +1 -1
  399. package/dist/reporting/index.js +4 -2
  400. package/dist/reporting/models.js +9 -0
  401. package/dist/reporting/overviews.d.ts +16 -0
  402. package/dist/reporting/overviews.js +56 -0
  403. package/dist/reporting/routes-documents.js +1 -1
  404. package/dist/reporting/routes.js +138 -80
  405. package/dist/reporting/web/DashboardView.d.ts +11 -0
  406. package/dist/reporting/web/DashboardView.js +2 -2
  407. package/dist/reporting/web/DesignerView.js +5 -0
  408. package/dist/reporting/web/Overview.d.ts +9 -0
  409. package/dist/reporting/web/Overview.js +53 -0
  410. package/dist/reporting/web/index.d.ts +1 -0
  411. package/dist/reporting/web/index.js +4 -1
  412. package/dist/reporting/web/messages.js +9 -0
  413. package/dist/sale_account/.kosh/bindings.js +1 -1
  414. package/dist/sale_account/.kosh/schema.d.ts +181 -6
  415. package/dist/sale_account/index.js +22 -1
  416. package/dist/sale_account/module.d.ts +639 -38
  417. package/dist/sale_portal/.kosh/bindings.js +1 -1
  418. package/dist/sale_portal/.kosh/schema.d.ts +59 -3
  419. package/dist/sale_portal/module.d.ts +435 -5
  420. package/dist/sale_project/.kosh/bindings.js +1 -1
  421. package/dist/sale_project/.kosh/schema.d.ts +732 -3
  422. package/dist/sale_project/module.d.ts +5349 -208
  423. package/dist/sale_project/module.js +17 -1
  424. package/dist/sale_stock/.kosh/bindings.d.ts +22 -0
  425. package/dist/sale_stock/.kosh/bindings.js +15 -0
  426. package/dist/sale_stock/.kosh/schema.d.ts +1303 -0
  427. package/dist/sale_stock/index.d.ts +7 -0
  428. package/dist/sale_stock/index.js +84 -0
  429. package/dist/sale_stock/module.d.ts +7514 -0
  430. package/dist/sale_stock/module.js +146 -0
  431. package/dist/sales/.kosh/bindings.js +1 -1
  432. package/dist/sales/.kosh/schema.d.ts +59 -3
  433. package/dist/sales/index.js +195 -4
  434. package/dist/sales/module.d.ts +356 -3
  435. package/dist/sales/module.js +78 -3
  436. package/dist/server/api/metadata.d.ts +5 -0
  437. package/dist/server/api/metadata.js +5 -0
  438. package/dist/server/api/rest.js +64 -1
  439. package/dist/server/api/views.js +1 -0
  440. package/dist/server/app-settings.d.ts +7 -0
  441. package/dist/server/app-settings.js +10 -0
  442. package/dist/server/auth/base.js +9 -0
  443. package/dist/server/index.d.ts +1 -0
  444. package/dist/server/index.js +1 -0
  445. package/dist/settings/app-settings.d.ts +2 -0
  446. package/dist/settings/app-settings.js +518 -0
  447. package/dist/settings/index.d.ts +1 -0
  448. package/dist/settings/index.js +15 -0
  449. package/dist/settings/people.js +29 -5
  450. package/dist/settings/web/AppSettingsPage.d.ts +11 -0
  451. package/dist/settings/web/AppSettingsPage.js +210 -0
  452. package/dist/settings/web/OverviewPage.js +16 -3
  453. package/dist/settings/web/PeoplePage.js +20 -6
  454. package/dist/settings/web/index.d.ts +1 -0
  455. package/dist/settings/web/index.js +3 -0
  456. package/dist/settings/web/messages.js +118 -2
  457. package/dist/sign/.kosh/bindings.d.ts +22 -0
  458. package/dist/sign/.kosh/bindings.js +15 -0
  459. package/dist/sign/.kosh/schema.d.ts +990 -0
  460. package/dist/sign/index.d.ts +14 -0
  461. package/dist/sign/index.js +350 -0
  462. package/dist/sign/module.d.ts +4478 -0
  463. package/dist/sign/module.js +158 -0
  464. package/dist/sign/sign.d.ts +82 -0
  465. package/dist/sign/sign.js +474 -0
  466. package/dist/stock/.kosh/bindings.d.ts +22 -0
  467. package/dist/stock/.kosh/bindings.js +15 -0
  468. package/dist/stock/.kosh/schema.d.ts +1222 -0
  469. package/dist/stock/demo.d.ts +8 -0
  470. package/dist/stock/demo.js +82 -0
  471. package/dist/stock/index.d.ts +4 -0
  472. package/dist/stock/index.js +903 -0
  473. package/dist/stock/module.d.ts +7856 -0
  474. package/dist/stock/module.js +1880 -0
  475. package/dist/stock/replenish.d.ts +38 -0
  476. package/dist/stock/replenish.js +176 -0
  477. package/dist/stock/web/Replenishment.d.ts +8 -0
  478. package/dist/stock/web/Replenishment.js +84 -0
  479. package/dist/stock/web/ScanBox.d.ts +8 -0
  480. package/dist/stock/web/ScanBox.js +90 -0
  481. package/dist/stock/web/index.d.ts +13 -0
  482. package/dist/stock/web/index.js +20 -0
  483. package/dist/stock/web/messages.d.ts +2 -0
  484. package/dist/stock/web/messages.js +77 -0
  485. package/dist/stock_account/.kosh/bindings.d.ts +22 -0
  486. package/dist/stock_account/.kosh/bindings.js +15 -0
  487. package/dist/stock_account/.kosh/schema.d.ts +2068 -0
  488. package/dist/stock_account/index.d.ts +3 -0
  489. package/dist/stock_account/index.js +140 -0
  490. package/dist/stock_account/module.d.ts +11523 -0
  491. package/dist/stock_account/module.js +339 -0
  492. package/dist/storage/attachments.d.ts +5 -0
  493. package/dist/storage/attachments.js +12 -1
  494. package/dist/storage/models.js +3 -0
  495. package/dist/storage/routes.js +13 -2
  496. package/dist/todo/.kosh/bindings.d.ts +22 -0
  497. package/dist/todo/.kosh/bindings.js +15 -0
  498. package/dist/todo/.kosh/schema.d.ts +732 -0
  499. package/dist/todo/demo.d.ts +6 -0
  500. package/dist/todo/demo.js +35 -0
  501. package/dist/todo/index.d.ts +3 -0
  502. package/dist/todo/index.js +187 -0
  503. package/dist/todo/module.d.ts +1180 -0
  504. package/dist/todo/module.js +130 -0
  505. package/dist/trade_finance/.kosh/bindings.d.ts +22 -0
  506. package/dist/trade_finance/.kosh/bindings.js +15 -0
  507. package/dist/trade_finance/.kosh/schema.d.ts +884 -0
  508. package/dist/trade_finance/demo.d.ts +6 -0
  509. package/dist/trade_finance/demo.js +63 -0
  510. package/dist/trade_finance/index.d.ts +3 -0
  511. package/dist/trade_finance/index.js +415 -0
  512. package/dist/trade_finance/module.d.ts +3779 -0
  513. package/dist/trade_finance/module.js +507 -0
  514. package/dist/trade_finance_account/.kosh/bindings.d.ts +22 -0
  515. package/dist/trade_finance_account/.kosh/bindings.js +15 -0
  516. package/dist/trade_finance_account/.kosh/schema.d.ts +1830 -0
  517. package/dist/trade_finance_account/index.d.ts +3 -0
  518. package/dist/trade_finance_account/index.js +93 -0
  519. package/dist/trade_finance_account/module.d.ts +8074 -0
  520. package/dist/trade_finance_account/module.js +245 -0
  521. package/dist/trade_finance_purchase/.kosh/bindings.d.ts +22 -0
  522. package/dist/trade_finance_purchase/.kosh/bindings.js +15 -0
  523. package/dist/trade_finance_purchase/.kosh/schema.d.ts +1246 -0
  524. package/dist/trade_finance_purchase/index.d.ts +8 -0
  525. package/dist/trade_finance_purchase/index.js +50 -0
  526. package/dist/trade_finance_purchase/module.d.ts +4257 -0
  527. package/dist/trade_finance_purchase/module.js +44 -0
  528. package/dist/trade_finance_sale/.kosh/bindings.d.ts +22 -0
  529. package/dist/trade_finance_sale/.kosh/bindings.js +15 -0
  530. package/dist/trade_finance_sale/.kosh/schema.d.ts +1072 -0
  531. package/dist/trade_finance_sale/index.d.ts +8 -0
  532. package/dist/trade_finance_sale/index.js +50 -0
  533. package/dist/trade_finance_sale/module.d.ts +4281 -0
  534. package/dist/trade_finance_sale/module.js +44 -0
  535. package/dist/ui/api.d.ts +2 -1
  536. package/dist/ui/api.js +2 -1
  537. package/dist/ui/app.js +26 -13
  538. package/dist/ui/components/AppIcon.js +30 -1
  539. package/dist/ui/components/primitives.d.ts +2 -0
  540. package/dist/ui/components/primitives.js +7 -1
  541. package/dist/ui/i18n/messages.d.ts +27 -0
  542. package/dist/ui/i18n/messages.js +46 -0
  543. package/dist/ui/index.d.ts +1 -0
  544. package/dist/ui/index.js +1 -0
  545. package/dist/ui/offline/queue.d.ts +5 -1
  546. package/dist/ui/offline/queue.js +2 -0
  547. package/dist/ui/registry.d.ts +5 -0
  548. package/dist/ui/shell/Home.js +55 -4
  549. package/dist/ui/views/FormView.js +102 -19
  550. package/dist/ui/views/KanbanView.d.ts +2 -0
  551. package/dist/ui/views/KanbanView.js +40 -3
  552. package/dist/ui/views/ListView.js +110 -11
  553. package/dist/ui/views/StatsRow.d.ts +14 -0
  554. package/dist/ui/views/StatsRow.js +88 -0
  555. package/dist/ui/views/widgets.d.ts +2 -1
  556. package/dist/ui/views/widgets.js +200 -1
  557. package/dist/views/builders.d.ts +19 -2
  558. package/dist/views/builders.js +21 -1
  559. package/dist/views/condition.d.ts +6 -0
  560. package/dist/views/condition.js +20 -0
  561. package/dist/views/documents.d.ts +8 -0
  562. package/dist/views/extend.d.ts +2 -2
  563. package/dist/views/extend.js +11 -1
  564. package/dist/views/index.d.ts +2 -2
  565. package/dist/views/index.js +2 -2
  566. package/dist/views/types.d.ts +52 -5
  567. package/dist/views/validate.js +39 -1
  568. package/dist/website/.kosh/bindings.d.ts +22 -0
  569. package/dist/website/.kosh/bindings.js +15 -0
  570. package/dist/website/.kosh/schema.d.ts +881 -0
  571. package/dist/website/demo.d.ts +6 -0
  572. package/dist/website/demo.js +115 -0
  573. package/dist/website/index.d.ts +9 -0
  574. package/dist/website/index.js +251 -0
  575. package/dist/website/module.d.ts +2987 -0
  576. package/dist/website/module.js +282 -0
  577. package/dist/website/render.d.ts +45 -0
  578. package/dist/website/render.js +102 -0
  579. package/dist/website/routes.d.ts +12 -0
  580. package/dist/website/routes.js +246 -0
  581. package/dist/website/web/PagePreview.d.ts +7 -0
  582. package/dist/website/web/PagePreview.js +33 -0
  583. package/dist/website/web/index.d.ts +11 -0
  584. package/dist/website/web/index.js +16 -0
  585. package/dist/website/web/messages.d.ts +2 -0
  586. package/dist/website/web/messages.js +15 -0
  587. package/dist/website_crm/.kosh/bindings.d.ts +22 -0
  588. package/dist/website_crm/.kosh/bindings.js +15 -0
  589. package/dist/website_crm/.kosh/schema.d.ts +967 -0
  590. package/dist/website_crm/index.d.ts +3 -0
  591. package/dist/website_crm/index.js +39 -0
  592. package/dist/website_crm/module.d.ts +2956 -0
  593. package/dist/website_crm/module.js +44 -0
  594. package/dist/website_sale/.kosh/bindings.d.ts +22 -0
  595. package/dist/website_sale/.kosh/bindings.js +15 -0
  596. package/dist/website_sale/.kosh/schema.d.ts +2284 -0
  597. package/dist/website_sale/couriers.d.ts +50 -0
  598. package/dist/website_sale/couriers.js +59 -0
  599. package/dist/website_sale/demo.d.ts +7 -0
  600. package/dist/website_sale/demo.js +90 -0
  601. package/dist/website_sale/growth.d.ts +31 -0
  602. package/dist/website_sale/growth.js +163 -0
  603. package/dist/website_sale/index.d.ts +49 -0
  604. package/dist/website_sale/index.js +538 -0
  605. package/dist/website_sale/module.d.ts +22027 -0
  606. package/dist/website_sale/module.js +397 -0
  607. package/dist/website_sale/shipments.d.ts +16 -0
  608. package/dist/website_sale/shipments.js +113 -0
  609. package/dist/website_sale/shop.d.ts +81 -0
  610. package/dist/website_sale/shop.js +649 -0
  611. package/dist/website_sale_stock/.kosh/bindings.d.ts +22 -0
  612. package/dist/website_sale_stock/.kosh/bindings.js +15 -0
  613. package/dist/website_sale_stock/.kosh/schema.d.ts +2681 -0
  614. package/dist/website_sale_stock/index.d.ts +9 -0
  615. package/dist/website_sale_stock/index.js +20 -0
  616. package/dist/website_sale_stock/module.d.ts +24998 -0
  617. package/dist/website_sale_stock/module.js +28 -0
  618. package/package.json +200 -2
@@ -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 {};
@@ -8,7 +8,8 @@ import { useQueries, useQuery } from '@tanstack/react-query';
8
8
  import { Popover } from 'radix-ui';
9
9
  import { createContext, useContext, useId, useMemo, useState, } from 'react';
10
10
  import { useTranslation } from 'react-i18next';
11
- import { Badge, Checkbox, Input, Select, Textarea } from '../components/primitives.js';
11
+ import { Avatar } from '../components/Avatar.js';
12
+ import { Badge, Button, buttonClass, Checkbox, Input, Select, Textarea, } from '../components/primitives.js';
12
13
  import { useKosh } from '../context.js';
13
14
  import { cn } from '../lib/cn.js';
14
15
  import { DateField } from './DateField.js';
@@ -242,6 +243,192 @@ function JsonWidget({ id, value, readonly, onChange, invalid }) {
242
243
  } }));
243
244
  }
244
245
  /** Registers the default widgets. */
246
+ // ---- Richer widgets (RFC 0022 §3.3) ------------------------------------------------------------------------
247
+ const idOfValue = (v) => typeof v === 'number'
248
+ ? v
249
+ : typeof v === 'object' && v !== null && 'id' in v
250
+ ? Number(v.id)
251
+ : null;
252
+ /** A link in display, the text input otherwise: `mailto:`, `tel:` or the address itself. */
253
+ function linkWidget(kind) {
254
+ return function LinkWidget(props) {
255
+ const value = text(props.value);
256
+ if (props.onChange !== undefined && !props.readonly)
257
+ return _jsx(CharWidget, { ...props });
258
+ if (value === '')
259
+ return _jsx("span", {});
260
+ const href = kind === 'email'
261
+ ? `mailto:${value}`
262
+ : kind === 'phone'
263
+ ? `tel:${value.replace(/[^\d+]/g, '')}`
264
+ : /^https?:\/\//i.test(value)
265
+ ? value
266
+ : `https://${value}`;
267
+ return (_jsx("a", { href: href, className: "text-primary underline-offset-2 hover:underline", ...(kind === 'url' ? { target: '_blank', rel: 'noreferrer' } : {}), onClick: (e) => e.stopPropagation(), children: kind === 'url' ? value.replace(/^https?:\/\//i, '') : value }));
268
+ };
269
+ }
270
+ /** 0–100 as a bar with the number; the integer input to edit. */
271
+ function ProgressWidget(props) {
272
+ const { format } = useKosh();
273
+ if (props.onChange !== undefined && !props.readonly)
274
+ return _jsx(IntegerWidget, { ...props });
275
+ // Decimals arrive as strings ("75.0"), integers as numbers.
276
+ const raw = typeof props.value === 'number'
277
+ ? props.value
278
+ : typeof props.value === 'string' && props.value.trim() !== ''
279
+ ? Number(props.value)
280
+ : Number.NaN;
281
+ const n = Number.isFinite(raw) ? Math.max(0, Math.min(100, raw)) : null;
282
+ if (n === null)
283
+ return _jsx("span", {});
284
+ return (_jsxs("span", { className: "inline-flex w-full max-w-40 items-center gap-2", children: [_jsx("span", { role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": n, "aria-label": props.field.label, className: "h-1.5 flex-1 overflow-hidden rounded-full bg-muted", children: _jsx("span", { className: "block h-full rounded-full bg-primary", style: { width: `${n}%` } }) }), _jsxs("span", { className: "tabular-nums text-xs text-muted-foreground", children: [format.number(n), "%"] })] }));
285
+ }
286
+ /** A number as a percentage. */
287
+ function PercentageWidget(props) {
288
+ const { format } = useKosh();
289
+ if (props.onChange !== undefined && !props.readonly)
290
+ return _jsx(DecimalWidget, { ...props });
291
+ const v = typeof props.value === 'number'
292
+ ? props.value
293
+ : typeof props.value === 'string' && props.value !== ''
294
+ ? Number(props.value)
295
+ : null;
296
+ return (_jsx("span", { className: "tabular-nums", children: v === null || Number.isNaN(v) ? '' : `${format.number(v)}%` }));
297
+ }
298
+ /** Stars in a row: read-only as one image, editable as radios (a visually hidden input under each star). */
299
+ function Stars({ label, options, selected, editable, onPick, }) {
300
+ const group = useId();
301
+ if (!editable)
302
+ return (_jsx("span", { role: "img", "aria-label": label, className: "inline-flex gap-0.5 text-warning-text", children: options.map((o, i) => (_jsx("span", { "aria-hidden": true, children: i <= selected ? '★' : '☆' }, o.key))) }));
303
+ return (_jsxs("fieldset", { className: "inline-flex gap-0.5 text-warning-text", children: [_jsx("legend", { className: "sr-only", children: label }), options.map((o, i) => (_jsxs("label", { className: "cursor-pointer leading-none", title: o.label, children: [_jsx("input", { type: "radio", name: group, className: "sr-only", checked: i === selected, onChange: () => onPick(i) }), _jsx("span", { "aria-hidden": true, children: i <= selected ? '★' : '☆' }), _jsx("span", { className: "sr-only", children: o.label })] }, o.key)))] }));
304
+ }
305
+ /** Stars out of five for a 0–5 number; click a star to set it. */
306
+ function RatingWidget({ value, readonly, onChange, field }) {
307
+ const n = typeof value === 'number' ? value : typeof value === 'string' ? Number(value) : 0;
308
+ const rounded = Number.isNaN(n) ? 0 : Math.round(n);
309
+ return (_jsx(Stars, { label: `${field.label}: ${Number.isNaN(n) ? 0 : n} / 5`, options: [1, 2, 3, 4, 5].map((s) => ({ key: String(s), label: `${s} / 5` })), selected: rounded - 1, editable: onChange !== undefined && !readonly, onPick: (i) => onChange?.(i + 1) }));
310
+ }
311
+ /** A selection shown as stars (its options in order: the first is one star); click to set it. */
312
+ function PriorityWidget({ value, readonly, onChange, field }) {
313
+ const options = field.options ?? [];
314
+ const index = options.findIndex((o) => o.value === value);
315
+ return (_jsx(Stars, { label: `${field.label}: ${options[index]?.label ?? ''}`, options: options.map((o) => ({ key: o.value, label: o.label })), selected: index, editable: onChange !== undefined && !readonly, onPick: (i) => onChange?.(options[i]?.value ?? null) }));
316
+ }
317
+ /** A stable tint for a value (a stage, a tag): a hue from its text. */
318
+ export const tintOf = (key) => {
319
+ let h = 0;
320
+ for (const c of key)
321
+ h = (h * 31 + c.charCodeAt(0)) % 360;
322
+ return `oklch(0.7 0.14 ${h})`;
323
+ };
324
+ /** A selection or text as a coloured dot with its label; the select to edit. */
325
+ function ColorWidget(props) {
326
+ if (props.onChange !== undefined && !props.readonly)
327
+ return props.field.kind === 'selection' ? (_jsx(SelectionWidget, { ...props })) : (_jsx(CharWidget, { ...props }));
328
+ const value = text(props.value);
329
+ if (value === '')
330
+ return _jsx("span", {});
331
+ const label = (props.field.options ?? []).find((o) => o.value === value)?.label ?? value;
332
+ return (_jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx("span", { "aria-hidden": true, className: "size-2.5 rounded-full", style: { background: tintOf(value) } }), label] }));
333
+ }
334
+ /** A date as "in 3 days" / "2 days late", toned; the date field to edit. */
335
+ function DaysLeftWidget(props) {
336
+ const { t } = useTranslation();
337
+ const { format } = useKosh();
338
+ if (props.onChange !== undefined && !props.readonly)
339
+ return _jsx(DateWidget, { ...props });
340
+ const value = text(props.value);
341
+ if (value === '')
342
+ return _jsx("span", {});
343
+ const day = new Date(`${value.slice(0, 10)}T00:00:00Z`).getTime();
344
+ const today = new Date();
345
+ const now = Date.UTC(today.getFullYear(), today.getMonth(), today.getDate());
346
+ const days = Math.round((day - now) / 86_400_000);
347
+ const label = days === 0
348
+ ? t('views.daysLeft.today')
349
+ : days > 0
350
+ ? t('views.daysLeft.in', { count: days })
351
+ : t('views.daysLeft.late', { count: -days });
352
+ return (_jsx("span", { title: format.date(value), className: cn('tabular-nums', days < 0 ? 'text-danger' : days <= 3 ? 'text-warning-text' : 'text-muted-foreground'), children: label }));
353
+ }
354
+ /** Many2many chips tinted by their name; the picker to edit. */
355
+ function TagsWidget(props) {
356
+ const ids = Array.isArray(props.value)
357
+ ? props.value.map(idOf).filter((v) => v !== null)
358
+ : [];
359
+ const names = useDisplayNames(props.field.target, ids);
360
+ if (props.onChange !== undefined && !props.readonly)
361
+ return _jsx(Many2manyWidget, { ...props });
362
+ return (_jsx("span", { className: "flex flex-wrap gap-1", children: ids.map((i) => {
363
+ const name = names.get(i) ?? `#${i}`;
364
+ return (_jsxs("span", { className: "inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs", children: [_jsx("span", { "aria-hidden": true, className: "size-2 rounded-full", style: { background: tintOf(name) } }), name] }, i));
365
+ }) }));
366
+ }
367
+ /** Draws `file` at most `max` pixels wide or high, as a WebP blob. */
368
+ async function shrinkTo(file, max) {
369
+ const bitmap = await createImageBitmap(file);
370
+ const scale = Math.min(1, max / Math.max(bitmap.width, bitmap.height));
371
+ const canvas = document.createElement('canvas');
372
+ canvas.width = Math.max(1, Math.round(bitmap.width * scale));
373
+ canvas.height = Math.max(1, Math.round(bitmap.height * scale));
374
+ const ctx = canvas.getContext('2d');
375
+ if (ctx === null)
376
+ throw new Error('No canvas');
377
+ ctx.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
378
+ bitmap.close();
379
+ return new Promise((resolve, reject) => canvas.toBlob((b) => (b === null ? reject(new Error('No image')) : resolve(b)), 'image/webp', 0.86));
380
+ }
381
+ /**
382
+ * An image kept as an attachment of the record (RFC 0022 §3.3): shown from its 256 px thumbnail, uploaded from a
383
+ * file the browser first shrinks (at most 1600 px, and the thumbnail), both attached to the record; the field then
384
+ * holds the image. A new record has to be saved first (its attachments need it).
385
+ */
386
+ function imageWidget(shape) {
387
+ return function ImageWidget({ value, readonly, onChange, field, record, model, }) {
388
+ const { api } = useKosh();
389
+ const { t } = useTranslation();
390
+ const inputId = useId();
391
+ const [busy, setBusy] = useState(false);
392
+ const [error, setError] = useState(null);
393
+ const id = idOfValue(value);
394
+ const recordId = typeof record['id'] === 'number' ? record['id'] : null;
395
+ const src = id === null ? null : `/api/v1/attachments/${id}/download?inline=true&w=256`;
396
+ const name = String(record['displayName'] ?? record['name'] ?? '');
397
+ const editable = onChange !== undefined && !readonly;
398
+ const pick = async (file) => {
399
+ if (model === undefined || recordId === null)
400
+ return setError(t('views.image.saveFirst'));
401
+ setBusy(true);
402
+ setError(null);
403
+ try {
404
+ const [full, thumb] = await Promise.all([shrinkTo(file, 1600), shrinkTo(file, 256)]);
405
+ const path = `/api/v1/attachments/${model}/${recordId}`;
406
+ const stem = file.name.replace(/\.[^.]+$/, '') || field.label;
407
+ const made = await api.upload(path, full, `${stem}.webp`);
408
+ await api.upload(path, thumb, `${stem}-256.webp`, {
409
+ 'x-variant-of': String(made.id),
410
+ 'x-width': '256',
411
+ });
412
+ onChange?.(made.id);
413
+ }
414
+ catch (e) {
415
+ setError(e instanceof Error ? e.message : String(e));
416
+ }
417
+ finally {
418
+ setBusy(false);
419
+ }
420
+ };
421
+ const picture = shape === 'avatar' ? (_jsx(Avatar, { name: name, src: src, shape: "circle" })) : src === null ? (_jsx("span", { className: "grid size-24 place-items-center rounded-md border border-dashed text-xs text-muted-foreground", children: t('views.image.none') })) : (_jsx("img", { src: src, alt: name, className: "size-24 rounded-md border object-cover" }));
422
+ if (!editable)
423
+ return picture;
424
+ return (_jsxs("span", { className: "inline-flex items-center gap-3", children: [picture, _jsxs("span", { className: "grid gap-1", children: [_jsx("input", { id: inputId, type: "file", accept: "image/*", className: "sr-only", onChange: (e) => {
425
+ const file = e.target.files?.[0];
426
+ if (file !== undefined)
427
+ void pick(file);
428
+ e.target.value = '';
429
+ } }), _jsx("label", { htmlFor: inputId, className: cn(buttonClass('secondary', 'sm'), 'cursor-pointer', busy && 'pointer-events-none opacity-50'), children: t('views.image.choose') }), id === null ? null : (_jsx(Button, { type: "button", size: "sm", variant: "ghost", onClick: () => onChange?.(null), children: t('views.image.remove') })), error === null ? null : (_jsx("span", { role: "alert", className: "text-xs text-danger", children: error }))] })] }));
430
+ };
431
+ }
245
432
  export function registerDefaultWidgets(registry) {
246
433
  for (const [name, widget] of [
247
434
  ['char', CharWidget],
@@ -264,6 +451,18 @@ export function registerDefaultWidgets(registry) {
264
451
  ['many2one', Many2oneWidget],
265
452
  ['many2many', Many2manyWidget],
266
453
  ['one2many', One2manyWidget],
454
+ ['email', linkWidget('email')],
455
+ ['phone', linkWidget('phone')],
456
+ ['url', linkWidget('url')],
457
+ ['progress', ProgressWidget],
458
+ ['percentage', PercentageWidget],
459
+ ['rating', RatingWidget],
460
+ ['priority', PriorityWidget],
461
+ ['color', ColorWidget],
462
+ ['daysLeft', DaysLeftWidget],
463
+ ['tags', TagsWidget],
464
+ ['image', imageWidget('image')],
465
+ ['avatar', imageWidget('avatar')],
267
466
  ])
268
467
  registry.registerWidget(name, widget);
269
468
  return registry;
@@ -6,7 +6,7 @@
6
6
  * The model handle is described structurally (a name and a `fields` record), so this package does not depend on
7
7
  * Shutro.
8
8
  */
9
- import type { ButtonNode, CalendarView, CohortView, ComponentNode, Condition, DashboardView, FieldNode, FormNode, FormView, GanttView, GraphView, GroupNode, HierarchyView, KanbanView, LinesNode, ListView, MapView, NotebookNode, PageNode, PivotView, SearchSpec, SpreadsheetView, WindowAction } from './types.js';
9
+ import type { ButtonNode, CalendarView, CohortView, ComponentNode, Condition, DashboardView, FieldNode, FormNode, FormView, GanttView, GraphView, GroupNode, HierarchyView, KanbanView, LinesNode, ListView, MapView, NotebookNode, PageNode, PivotView, SearchSpec, SpreadsheetView, StatNode, StatsNode, WindowAction } from './types.js';
10
10
  /** What the builders read from a Shutro model handle. */
11
11
  export interface ModelHandle {
12
12
  readonly name: string;
@@ -24,6 +24,12 @@ export type FieldInput<K extends string> = K | ({
24
24
  } & Omit<FieldNode, 'kind' | 'id' | 'field'>);
25
25
  /** A field node (forms, cards). */
26
26
  export declare function field<K extends string>(input: FieldInput<K>): FieldNode;
27
+ /** A stat tile's input: the related model's handle or name, the rest as the node. */
28
+ export type StatInput = Omit<StatNode, 'kind' | 'model'> & {
29
+ readonly model: ModelRef;
30
+ };
31
+ /** A stat tile (RFC 0022 §3.1), for `k.stats` and for extensions appending to another module's row. */
32
+ export declare function stat(input: StatInput): StatNode;
27
33
  type ViewInput<V> = Omit<V, 'id' | 'model' | 'type'>;
28
34
  /** A list view. */
29
35
  export declare function list<M extends ModelRef>(model: M, spec: Omit<ViewInput<ListView>, 'columns' | 'inlineEdit' | 'defaultOrder'> & {
@@ -36,12 +42,19 @@ export interface FormKit<K extends string> {
36
42
  field(input: FieldInput<K>): FieldNode;
37
43
  group(id: string, children: readonly (FieldInput<K> | FormNode)[], options?: Omit<GroupNode, 'kind' | 'id' | 'children'>): GroupNode;
38
44
  notebook(id: string, pages: readonly PageNode[]): NotebookNode;
39
- page(id: string, label: string, children: readonly (FieldInput<K> | FormNode)[]): PageNode;
45
+ page(id: string, label: string, children: readonly (FieldInput<K> | FormNode)[], options?: {
46
+ readonly description?: string;
47
+ readonly visibleWhen?: Condition;
48
+ }): PageNode;
40
49
  /** An editable one2many; its columns are keys of the related model (checked at load). */
41
50
  lines(field: K, columns: readonly FieldInput<string>[], options?: {
42
51
  readonly readonlyWhen?: Condition;
43
52
  }): LinesNode;
44
53
  component(id: string, component: string, props?: Readonly<Record<string, unknown>>): ComponentNode;
54
+ /** A row of tiles of related records; empty rows are for other modules to fill. */
55
+ stats(id: string, children: readonly StatInput[], options?: {
56
+ readonly visibleWhen?: Condition;
57
+ }): StatsNode;
45
58
  button(transition: string, options?: Omit<ButtonNode, 'kind' | 'id' | 'transition'> & {
46
59
  readonly id?: string;
47
60
  }): ButtonNode;
@@ -63,6 +76,10 @@ export declare function kanban<M extends ModelRef>(model: M, spec: Omit<ViewInpu
63
76
  readonly subtitle?: FieldKey<M>;
64
77
  readonly footer?: readonly FieldInput<FieldKey<M>>[];
65
78
  readonly badges?: readonly FieldInput<FieldKey<M>>[];
79
+ readonly image?: FieldKey<M>;
80
+ readonly avatar?: FieldKey<M>;
81
+ readonly progress?: FieldKey<M>;
82
+ readonly color?: FieldKey<M>;
66
83
  };
67
84
  }): KanbanView;
68
85
  /** A window action. */
@@ -9,6 +9,10 @@ function fieldNode(input) {
9
9
  export function field(input) {
10
10
  return fieldNode(input);
11
11
  }
12
+ /** A stat tile (RFC 0022 §3.1), for `k.stats` and for extensions appending to another module's row. */
13
+ export function stat(input) {
14
+ return { ...input, kind: 'stat', model: nameOf(input.model) };
15
+ }
12
16
  /** A list view. */
13
17
  export function list(model, spec) {
14
18
  return {
@@ -30,7 +34,13 @@ function kit() {
30
34
  children: children.map(child),
31
35
  }),
32
36
  notebook: (id, pages) => ({ kind: 'notebook', id, pages }),
33
- page: (id, label, children) => ({ kind: 'page', id, label, children: children.map(child) }),
37
+ page: (id, label, children, options = {}) => ({
38
+ kind: 'page',
39
+ id,
40
+ label,
41
+ ...options,
42
+ children: children.map(child),
43
+ }),
34
44
  lines: (key, columns, options = {}) => ({
35
45
  kind: 'lines',
36
46
  id: key,
@@ -44,6 +54,12 @@ function kit() {
44
54
  component,
45
55
  ...(props === undefined ? {} : { props }),
46
56
  }),
57
+ stats: (id, children, options = {}) => ({
58
+ kind: 'stats',
59
+ id,
60
+ ...options,
61
+ children: children.map(stat),
62
+ }),
47
63
  button: (transition, options = {}) => {
48
64
  const { id, ...rest } = options;
49
65
  return { kind: 'button', id: id ?? transition, transition, ...rest };
@@ -76,6 +92,10 @@ export function kanban(model, spec) {
76
92
  ...(spec.card.subtitle === undefined ? {} : { subtitle: spec.card.subtitle }),
77
93
  footer: (spec.card.footer ?? []).map(fieldNode),
78
94
  badges: (spec.card.badges ?? []).map(fieldNode),
95
+ ...(spec.card.image === undefined ? {} : { image: spec.card.image }),
96
+ ...(spec.card.avatar === undefined ? {} : { avatar: spec.card.avatar }),
97
+ ...(spec.card.progress === undefined ? {} : { progress: spec.card.progress }),
98
+ ...(spec.card.color === undefined ? {} : { color: spec.card.color }),
79
99
  },
80
100
  };
81
101
  }
@@ -21,3 +21,9 @@ export declare function holds(condition: Condition | undefined, values: Readonly
21
21
  * (relation paths, unknown operators).
22
22
  */
23
23
  export declare function evaluate(condition: Condition | undefined, values: Readonly<Record<string, unknown>>, env: ConditionEnv): boolean | undefined;
24
+ /**
25
+ * A condition with its `$record` placeholders replaced by the record's values (`{ partner: { $record: 'id' } }` on
26
+ * record 42 becomes `{ partner: 42 }`); related values give their id. For stat tiles (RFC 0022 §3.1) and any
27
+ * filter a record page opens.
28
+ */
29
+ export declare function resolveRecord(condition: Condition, values: Readonly<Record<string, unknown>>): Condition;
@@ -119,3 +119,23 @@ export function evaluate(condition, values, env) {
119
119
  }
120
120
  return unknown ? undefined : true;
121
121
  }
122
+ const idOfValue = (v) => typeof v === 'object' && v !== null && !Array.isArray(v) && 'id' in v
123
+ ? v.id
124
+ : v;
125
+ /**
126
+ * A condition with its `$record` placeholders replaced by the record's values (`{ partner: { $record: 'id' } }` on
127
+ * record 42 becomes `{ partner: 42 }`); related values give their id. For stat tiles (RFC 0022 §3.1) and any
128
+ * filter a record page opens.
129
+ */
130
+ export function resolveRecord(condition, values) {
131
+ const walk = (value) => {
132
+ if (Array.isArray(value))
133
+ return value.map(walk);
134
+ if (typeof value !== 'object' || value === null)
135
+ return value;
136
+ if ('$record' in value)
137
+ return idOfValue(values[String(value.$record)]) ?? null;
138
+ return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, walk(v)]));
139
+ };
140
+ return walk(condition);
141
+ }
@@ -46,6 +46,14 @@ export type Block = {
46
46
  readonly kind: 'signature';
47
47
  readonly id: string;
48
48
  readonly labels: readonly string[];
49
+ }
50
+ /** A QR code of a field's value (a ticket's check-in code, an e-invoice's signed QR), `size` millimetres wide. */
51
+ | {
52
+ readonly kind: 'qr';
53
+ readonly id: string;
54
+ readonly bind: string;
55
+ readonly size?: number;
56
+ readonly label?: string;
49
57
  } | {
50
58
  readonly kind: 'columns';
51
59
  readonly id: string;
@@ -3,8 +3,8 @@
3
3
  * module dependency order, with the origin of every node recorded. An unknown anchor is an error at load time, not
4
4
  * a silently missing button.
5
5
  */
6
- import type { ButtonNode, FormNode, ResolvedView, ViewDefinition, ViewExtension } from './types.js';
7
- type AnyNode = FormNode | ButtonNode;
6
+ import type { ButtonNode, FormNode, ResolvedView, StatNode, ViewDefinition, ViewExtension } from './types.js';
7
+ type AnyNode = FormNode | ButtonNode | StatNode;
8
8
  /** A view or extension that cannot apply. */
9
9
  export declare class ViewDefinitionError extends Error {
10
10
  readonly view: string;
@@ -22,6 +22,8 @@ export function nodesOf(view) {
22
22
  }
23
23
  if (node.kind === 'lines')
24
24
  out.push(...node.columns);
25
+ if (node.kind === 'stats')
26
+ out.push(...node.children);
25
27
  }
26
28
  };
27
29
  switch (view.type) {
@@ -80,7 +82,7 @@ function applyIn(nodes, op) {
80
82
  ...target,
81
83
  children: [...target.children, ...added],
82
84
  };
83
- else if (target.kind === 'page')
85
+ else if (target.kind === 'page' || target.kind === 'stats')
84
86
  out[index] = {
85
87
  ...target,
86
88
  children: [
@@ -122,6 +124,14 @@ function applyIn(nodes, op) {
122
124
  }
123
125
  }
124
126
  }
127
+ if (node.kind === 'stats') {
128
+ const [children, done] = applyIn(node.children, op);
129
+ if (done) {
130
+ const out = [...nodes];
131
+ out[i] = { ...node, children };
132
+ return [out, true];
133
+ }
134
+ }
125
135
  if (node.kind === 'lines') {
126
136
  const [columns, done] = applyIn(node.columns, op);
127
137
  if (done) {
@@ -4,8 +4,8 @@
4
4
  * actions and search definitions, extension by anchors, client-side condition evaluation and load-time checks.
5
5
  * Shared by the server (validation, per-user filtering) and the UI (rendering). No dependencies.
6
6
  */
7
- export { action, calendar, cohort, dashboard, type FieldInput, type FieldKey, type FormKit, field, form, type GroupKey, gantt, graph, hierarchy, type ImplicitKey, kanban, list, type MeasureInput, type ModelHandle, map, pivot, search, spreadsheet, } from './builders.js';
8
- export { type ConditionEnv, evaluate, holds } from './condition.js';
7
+ export { action, calendar, cohort, dashboard, type FieldInput, type FieldKey, type FormKit, field, form, type GroupKey, gantt, graph, hierarchy, type ImplicitKey, kanban, list, type MeasureInput, type ModelHandle, map, pivot, type StatInput, search, spreadsheet, stat, } from './builders.js';
8
+ export { type ConditionEnv, evaluate, holds, resolveRecord } from './condition.js';
9
9
  export type { Block, Layout } from './documents.js';
10
10
  export { nodesOf, resolveView, ViewDefinitionError } from './extend.js';
11
11
  export type * from './types.js';
@@ -4,8 +4,8 @@
4
4
  * actions and search definitions, extension by anchors, client-side condition evaluation and load-time checks.
5
5
  * Shared by the server (validation, per-user filtering) and the UI (rendering). No dependencies.
6
6
  */
7
- export { action, calendar, cohort, dashboard, field, form, gantt, graph, hierarchy, kanban, list, map, pivot, search, spreadsheet, } from './builders.js';
8
- export { evaluate, holds } from './condition.js';
7
+ export { action, calendar, cohort, dashboard, field, form, gantt, graph, hierarchy, kanban, list, map, pivot, search, spreadsheet, stat, } from './builders.js';
8
+ export { evaluate, holds, resolveRecord } from './condition.js';
9
9
  export { nodesOf, resolveView, ViewDefinitionError } from './extend.js';
10
10
  export { validateAction, validateSearch, validateView, } from './validate.js';
11
11
  /** Package identity. */