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.
- package/dist/account_asset/.kosh/bindings.d.ts +22 -0
- package/dist/account_asset/.kosh/bindings.js +15 -0
- package/dist/account_asset/.kosh/schema.d.ts +1755 -0
- package/dist/account_asset/board.d.ts +61 -0
- package/dist/account_asset/board.js +86 -0
- package/dist/account_asset/books.d.ts +42 -0
- package/dist/account_asset/books.js +398 -0
- package/dist/account_asset/demo.d.ts +7 -0
- package/dist/account_asset/demo.js +72 -0
- package/dist/account_asset/index.d.ts +9 -0
- package/dist/account_asset/index.js +335 -0
- package/dist/account_asset/module.d.ts +7622 -0
- package/dist/account_asset/module.js +230 -0
- package/dist/account_budget/.kosh/bindings.d.ts +22 -0
- package/dist/account_budget/.kosh/bindings.js +15 -0
- package/dist/account_budget/.kosh/schema.d.ts +1767 -0
- package/dist/account_budget/budget.d.ts +5 -0
- package/dist/account_budget/budget.js +142 -0
- package/dist/account_budget/demo.d.ts +6 -0
- package/dist/account_budget/demo.js +30 -0
- package/dist/account_budget/index.d.ts +4 -0
- package/dist/account_budget/index.js +223 -0
- package/dist/account_budget/module.d.ts +13863 -0
- package/dist/account_budget/module.js +167 -0
- package/dist/account_portal/.kosh/bindings.js +1 -1
- package/dist/account_portal/.kosh/schema.d.ts +176 -6
- package/dist/account_portal/module.d.ts +505 -6
- package/dist/accounting/.kosh/bindings.js +1 -1
- package/dist/accounting/.kosh/schema.d.ts +176 -6
- package/dist/accounting/index.d.ts +1 -1
- package/dist/accounting/index.js +344 -4
- package/dist/accounting/module.d.ts +513 -5
- package/dist/accounting/module.js +55 -3
- package/dist/approvals/.kosh/bindings.d.ts +22 -0
- package/dist/approvals/.kosh/bindings.js +15 -0
- package/dist/approvals/.kosh/schema.d.ts +611 -0
- package/dist/approvals/index.d.ts +18 -0
- package/dist/approvals/index.js +302 -0
- package/dist/approvals/mails.d.ts +25 -0
- package/dist/approvals/mails.js +82 -0
- package/dist/approvals/module.d.ts +1 -0
- package/dist/approvals/module.js +12 -0
- package/dist/approvals/web/History.d.ts +4 -0
- package/dist/approvals/web/History.js +13 -0
- package/dist/approvals/web/Inbox.d.ts +9 -0
- package/dist/approvals/web/Inbox.js +114 -0
- package/dist/approvals/web/Mine.d.ts +7 -0
- package/dist/approvals/web/Mine.js +27 -0
- package/dist/approvals/web/index.d.ts +13 -0
- package/dist/approvals/web/index.js +22 -0
- package/dist/approvals/web/messages.d.ts +2 -0
- package/dist/approvals/web/messages.js +119 -0
- package/dist/approvals/web/shared.d.ts +59 -0
- package/dist/approvals/web/shared.js +46 -0
- package/dist/attendance/.kosh/bindings.d.ts +22 -0
- package/dist/attendance/.kosh/bindings.js +15 -0
- package/dist/attendance/.kosh/schema.d.ts +1048 -0
- package/dist/attendance/days.d.ts +96 -0
- package/dist/attendance/days.js +430 -0
- package/dist/attendance/demo.d.ts +7 -0
- package/dist/attendance/demo.js +58 -0
- package/dist/attendance/index.d.ts +4 -0
- package/dist/attendance/index.js +513 -0
- package/dist/attendance/module.d.ts +3969 -0
- package/dist/attendance/module.js +412 -0
- package/dist/attendance/routes.d.ts +16 -0
- package/dist/attendance/routes.js +266 -0
- package/dist/attendance/web/Check.d.ts +8 -0
- package/dist/attendance/web/Check.js +40 -0
- package/dist/attendance/web/Kiosk.d.ts +8 -0
- package/dist/attendance/web/Kiosk.js +62 -0
- package/dist/attendance/web/PinButton.d.ts +7 -0
- package/dist/attendance/web/PinButton.js +29 -0
- package/dist/attendance/web/index.d.ts +13 -0
- package/dist/attendance/web/index.js +22 -0
- package/dist/attendance/web/messages.d.ts +2 -0
- package/dist/attendance/web/messages.js +61 -0
- package/dist/calendar/.kosh/bindings.d.ts +22 -0
- package/dist/calendar/.kosh/bindings.js +15 -0
- package/dist/calendar/.kosh/schema.d.ts +795 -0
- package/dist/calendar/demo.d.ts +6 -0
- package/dist/calendar/demo.js +24 -0
- package/dist/calendar/index.d.ts +3 -0
- package/dist/calendar/index.js +291 -0
- package/dist/calendar/module.d.ts +1705 -0
- package/dist/calendar/module.js +180 -0
- package/dist/cli/init.js +80 -0
- package/dist/cli/templates.d.ts +1 -1
- package/dist/cli/templates.js +226 -0
- package/dist/contacts/.kosh/bindings.js +1 -1
- package/dist/contacts/.kosh/schema.d.ts +78 -3
- package/dist/contacts/demo.js +30 -1
- package/dist/contacts/index.d.ts +1 -1
- package/dist/contacts/index.js +155 -9
- package/dist/contacts/module.d.ts +338 -2
- package/dist/contacts/module.js +93 -5
- package/dist/crm/.kosh/bindings.d.ts +22 -0
- package/dist/crm/.kosh/bindings.js +15 -0
- package/dist/crm/.kosh/schema.d.ts +800 -0
- package/dist/crm/demo.d.ts +6 -0
- package/dist/crm/demo.js +45 -0
- package/dist/crm/index.d.ts +3 -0
- package/dist/crm/index.js +361 -0
- package/dist/crm/module.d.ts +1845 -0
- package/dist/crm/module.js +208 -0
- package/dist/documents/.kosh/bindings.d.ts +22 -0
- package/dist/documents/.kosh/bindings.js +15 -0
- package/dist/documents/.kosh/schema.d.ts +862 -0
- package/dist/documents/demo.d.ts +6 -0
- package/dist/documents/demo.js +22 -0
- package/dist/documents/documents.d.ts +98 -0
- package/dist/documents/documents.js +318 -0
- package/dist/documents/index.d.ts +30 -0
- package/dist/documents/index.js +442 -0
- package/dist/documents/module.d.ts +2781 -0
- package/dist/documents/module.js +214 -0
- package/dist/documents/web/Versions.d.ts +7 -0
- package/dist/documents/web/Versions.js +45 -0
- package/dist/documents/web/index.d.ts +11 -0
- package/dist/documents/web/index.js +16 -0
- package/dist/documents/web/messages.d.ts +2 -0
- package/dist/documents/web/messages.js +21 -0
- package/dist/event/.kosh/bindings.d.ts +22 -0
- package/dist/event/.kosh/bindings.js +15 -0
- package/dist/event/.kosh/schema.d.ts +843 -0
- package/dist/event/demo.d.ts +6 -0
- package/dist/event/demo.js +65 -0
- package/dist/event/index.d.ts +14 -0
- package/dist/event/index.js +333 -0
- package/dist/event/mails.d.ts +15 -0
- package/dist/event/mails.js +112 -0
- package/dist/event/module.d.ts +2800 -0
- package/dist/event/module.js +323 -0
- package/dist/event/web/CheckInBox.d.ts +9 -0
- package/dist/event/web/CheckInBox.js +87 -0
- package/dist/event/web/index.d.ts +11 -0
- package/dist/event/web/index.js +16 -0
- package/dist/event/web/messages.d.ts +2 -0
- package/dist/event/web/messages.js +23 -0
- package/dist/event_account/.kosh/bindings.d.ts +22 -0
- package/dist/event_account/.kosh/bindings.js +15 -0
- package/dist/event_account/.kosh/schema.d.ts +1758 -0
- package/dist/event_account/index.d.ts +3 -0
- package/dist/event_account/index.js +28 -0
- package/dist/event_account/module.d.ts +7114 -0
- package/dist/event_account/module.js +90 -0
- package/dist/expense/.kosh/bindings.d.ts +22 -0
- package/dist/expense/.kosh/bindings.js +15 -0
- package/dist/expense/.kosh/schema.d.ts +1299 -0
- package/dist/expense/demo.d.ts +7 -0
- package/dist/expense/demo.js +69 -0
- package/dist/expense/index.d.ts +3 -0
- package/dist/expense/index.js +495 -0
- package/dist/expense/module.d.ts +4747 -0
- package/dist/expense/module.js +647 -0
- package/dist/expense_account/.kosh/bindings.d.ts +22 -0
- package/dist/expense_account/.kosh/bindings.js +15 -0
- package/dist/expense_account/.kosh/schema.d.ts +1936 -0
- package/dist/expense_account/index.d.ts +3 -0
- package/dist/expense_account/index.js +74 -0
- package/dist/expense_account/module.d.ts +9153 -0
- package/dist/expense_account/module.js +318 -0
- package/dist/helpdesk/.kosh/bindings.d.ts +22 -0
- package/dist/helpdesk/.kosh/bindings.js +15 -0
- package/dist/helpdesk/.kosh/schema.d.ts +885 -0
- package/dist/helpdesk/demo.d.ts +7 -0
- package/dist/helpdesk/demo.js +65 -0
- package/dist/helpdesk/hours.d.ts +17 -0
- package/dist/helpdesk/hours.js +94 -0
- package/dist/helpdesk/index.d.ts +10 -0
- package/dist/helpdesk/index.js +461 -0
- package/dist/helpdesk/module.d.ts +2940 -0
- package/dist/helpdesk/module.js +326 -0
- package/dist/helpdesk/routes.d.ts +12 -0
- package/dist/helpdesk/routes.js +132 -0
- package/dist/helpdesk/sla.d.ts +37 -0
- package/dist/helpdesk/sla.js +226 -0
- package/dist/hr/.kosh/bindings.d.ts +22 -0
- package/dist/hr/.kosh/bindings.js +15 -0
- package/dist/hr/.kosh/schema.d.ts +878 -0
- package/dist/hr/demo.d.ts +6 -0
- package/dist/hr/demo.js +60 -0
- package/dist/hr/index.d.ts +3 -0
- package/dist/hr/index.js +483 -0
- package/dist/hr/module.d.ts +2611 -0
- package/dist/hr/module.js +350 -0
- package/dist/l10n_bd/.kosh/bindings.js +1 -1
- package/dist/l10n_bd/.kosh/schema.d.ts +176 -6
- package/dist/l10n_bd/module.d.ts +505 -6
- package/dist/l10n_bd_payroll/.kosh/bindings.d.ts +22 -0
- package/dist/l10n_bd_payroll/.kosh/bindings.js +15 -0
- package/dist/l10n_bd_payroll/.kosh/schema.d.ts +2312 -0
- package/dist/l10n_bd_payroll/data.d.ts +47 -0
- package/dist/l10n_bd_payroll/data.js +347 -0
- package/dist/l10n_bd_payroll/index.d.ts +4 -0
- package/dist/l10n_bd_payroll/index.js +24 -0
- package/dist/l10n_bd_payroll/module.d.ts +12932 -0
- package/dist/l10n_bd_payroll/module.js +86 -0
- package/dist/l10n_in/.kosh/bindings.js +1 -1
- package/dist/l10n_in/.kosh/schema.d.ts +176 -6
- package/dist/l10n_in/module.d.ts +527 -7
- package/dist/mail/inbound/handle.js +6 -1
- package/dist/maintenance/.kosh/bindings.d.ts +22 -0
- package/dist/maintenance/.kosh/bindings.js +15 -0
- package/dist/maintenance/.kosh/schema.d.ts +911 -0
- package/dist/maintenance/demo.d.ts +6 -0
- package/dist/maintenance/demo.js +60 -0
- package/dist/maintenance/index.d.ts +3 -0
- package/dist/maintenance/index.js +422 -0
- package/dist/maintenance/module.d.ts +3545 -0
- package/dist/maintenance/module.js +446 -0
- package/dist/maintenance_stock/.kosh/bindings.d.ts +22 -0
- package/dist/maintenance_stock/.kosh/bindings.js +15 -0
- package/dist/maintenance_stock/.kosh/schema.d.ts +1446 -0
- package/dist/maintenance_stock/index.d.ts +9 -0
- package/dist/maintenance_stock/index.js +52 -0
- package/dist/maintenance_stock/module.d.ts +7675 -0
- package/dist/maintenance_stock/module.js +192 -0
- package/dist/modules-sdk/index.d.ts +1 -1
- package/dist/modules-sdk/manifest.d.ts +109 -2
- package/dist/modules-sdk/manifest.js +35 -1
- package/dist/mrp/.kosh/bindings.d.ts +22 -0
- package/dist/mrp/.kosh/bindings.js +15 -0
- package/dist/mrp/.kosh/schema.d.ts +1453 -0
- package/dist/mrp/demo.d.ts +7 -0
- package/dist/mrp/demo.js +42 -0
- package/dist/mrp/index.d.ts +3 -0
- package/dist/mrp/index.js +393 -0
- package/dist/mrp/module.d.ts +9335 -0
- package/dist/mrp/module.js +757 -0
- package/dist/mrp_account/.kosh/bindings.d.ts +22 -0
- package/dist/mrp_account/.kosh/bindings.js +15 -0
- package/dist/mrp_account/.kosh/schema.d.ts +2299 -0
- package/dist/mrp_account/index.d.ts +3 -0
- package/dist/mrp_account/index.js +22 -0
- package/dist/mrp_account/module.d.ts +23151 -0
- package/dist/mrp_account/module.js +123 -0
- package/dist/payment/.kosh/bindings.js +1 -1
- package/dist/payment/.kosh/schema.d.ts +178 -7
- package/dist/payment/index.d.ts +41 -0
- package/dist/payment/index.js +131 -74
- package/dist/payment/module.d.ts +569 -12
- package/dist/payment/module.js +19 -3
- package/dist/payment/settle.js +10 -1
- package/dist/payroll/.kosh/bindings.d.ts +22 -0
- package/dist/payroll/.kosh/bindings.js +15 -0
- package/dist/payroll/.kosh/schema.d.ts +1390 -0
- package/dist/payroll/compute.d.ts +35 -0
- package/dist/payroll/compute.js +398 -0
- package/dist/payroll/demo.d.ts +55 -0
- package/dist/payroll/demo.js +121 -0
- package/dist/payroll/formula.d.ts +62 -0
- package/dist/payroll/formula.js +320 -0
- package/dist/payroll/index.d.ts +230 -0
- package/dist/payroll/index.js +713 -0
- package/dist/payroll/module.d.ts +9390 -0
- package/dist/payroll/module.js +606 -0
- package/dist/payroll/routes.d.ts +10 -0
- package/dist/payroll/routes.js +112 -0
- package/dist/payroll_account/.kosh/bindings.d.ts +22 -0
- package/dist/payroll_account/.kosh/bindings.js +15 -0
- package/dist/payroll_account/.kosh/schema.d.ts +2308 -0
- package/dist/payroll_account/index.d.ts +3 -0
- package/dist/payroll_account/index.js +40 -0
- package/dist/payroll_account/module.d.ts +12396 -0
- package/dist/payroll_account/module.js +256 -0
- package/dist/permissions/approvals.d.ts +131 -9
- package/dist/permissions/approvals.js +662 -57
- package/dist/permissions/index.d.ts +1 -1
- package/dist/permissions/index.js +2 -2
- package/dist/permissions/models.js +191 -12
- package/dist/permissions/routes.d.ts +6 -1
- package/dist/permissions/routes.js +37 -4
- package/dist/permissions/web/ApprovalPanel.d.ts +5 -4
- package/dist/permissions/web/ApprovalPanel.js +39 -13
- package/dist/permissions/web/index.d.ts +6 -4
- package/dist/permissions/web/index.js +13 -4
- package/dist/permissions/web/messages.d.ts +2 -0
- package/dist/permissions/web/messages.js +43 -0
- package/dist/portal/.kosh/bindings.js +1 -1
- package/dist/portal/.kosh/schema.d.ts +78 -3
- package/dist/portal/index.js +1 -1
- package/dist/portal/module.d.ts +166 -2
- package/dist/pos/.kosh/bindings.d.ts +22 -0
- package/dist/pos/.kosh/bindings.js +15 -0
- package/dist/pos/.kosh/schema.d.ts +1809 -0
- package/dist/pos/accounting.d.ts +10 -0
- package/dist/pos/accounting.js +149 -0
- package/dist/pos/demo.d.ts +6 -0
- package/dist/pos/demo.js +90 -0
- package/dist/pos/index.d.ts +9 -0
- package/dist/pos/index.js +353 -0
- package/dist/pos/module.d.ts +9783 -0
- package/dist/pos/module.js +423 -0
- package/dist/pos/routes.d.ts +39 -0
- package/dist/pos/routes.js +368 -0
- package/dist/pos/web/Register.d.ts +9 -0
- package/dist/pos/web/Register.js +252 -0
- package/dist/pos/web/index.d.ts +11 -0
- package/dist/pos/web/index.js +16 -0
- package/dist/pos/web/messages.d.ts +2 -0
- package/dist/pos/web/messages.js +87 -0
- package/dist/pos_stock/.kosh/bindings.d.ts +22 -0
- package/dist/pos_stock/.kosh/bindings.js +15 -0
- package/dist/pos_stock/.kosh/schema.d.ts +2208 -0
- package/dist/pos_stock/index.d.ts +9 -0
- package/dist/pos_stock/index.js +35 -0
- package/dist/pos_stock/module.d.ts +12803 -0
- package/dist/pos_stock/module.js +115 -0
- package/dist/product/.kosh/bindings.js +1 -1
- package/dist/product/.kosh/schema.d.ts +52 -1
- package/dist/product/index.js +94 -4
- package/dist/product/module.d.ts +45 -1
- package/dist/product/module.js +11 -3
- package/dist/project/.kosh/bindings.js +1 -1
- package/dist/project/.kosh/schema.d.ts +725 -3
- package/dist/project/index.d.ts +3 -1
- package/dist/project/index.js +1045 -18
- package/dist/project/module.d.ts +10168 -458
- package/dist/project/module.js +1578 -14
- package/dist/project/routes.d.ts +44 -0
- package/dist/project/routes.js +314 -0
- package/dist/project/schedule.d.ts +72 -0
- package/dist/project/schedule.js +192 -0
- package/dist/project/web/Refresh.d.ts +8 -0
- package/dist/project/web/Refresh.js +29 -0
- package/dist/project/web/Schedule.d.ts +9 -0
- package/dist/project/web/Schedule.js +93 -0
- package/dist/project/web/Structure.d.ts +8 -0
- package/dist/project/web/Structure.js +86 -0
- package/dist/project/web/Workload.d.ts +8 -0
- package/dist/project/web/Workload.js +43 -0
- package/dist/project/web/index.d.ts +14 -0
- package/dist/project/web/index.js +25 -0
- package/dist/project/web/messages.d.ts +2 -0
- package/dist/project/web/messages.js +85 -0
- package/dist/project_account/.kosh/bindings.d.ts +22 -0
- package/dist/project_account/.kosh/bindings.js +15 -0
- package/dist/project_account/.kosh/schema.d.ts +2241 -0
- package/dist/project_account/index.d.ts +3 -0
- package/dist/project_account/index.js +27 -0
- package/dist/project_account/module.d.ts +11539 -0
- package/dist/project_account/module.js +76 -0
- package/dist/project_portal/.kosh/bindings.js +1 -1
- package/dist/project_portal/.kosh/schema.d.ts +725 -3
- package/dist/project_portal/module.d.ts +5137 -119
- package/dist/project_purchase/.kosh/bindings.d.ts +22 -0
- package/dist/project_purchase/.kosh/bindings.js +15 -0
- package/dist/project_purchase/.kosh/schema.d.ts +2320 -0
- package/dist/project_purchase/index.d.ts +9 -0
- package/dist/project_purchase/index.js +22 -0
- package/dist/project_purchase/module.d.ts +25147 -0
- package/dist/project_purchase/module.js +56 -0
- package/dist/purchase/.kosh/bindings.js +1 -1
- package/dist/purchase/.kosh/schema.d.ts +150 -6
- package/dist/purchase/index.js +163 -3
- package/dist/purchase/module.d.ts +228 -5
- package/dist/purchase/module.js +30 -3
- package/dist/purchase_account/.kosh/bindings.js +1 -1
- package/dist/purchase_account/.kosh/schema.d.ts +180 -8
- package/dist/purchase_account/index.js +27 -1
- package/dist/purchase_account/module.d.ts +591 -30
- package/dist/purchase_account/module.js +13 -2
- package/dist/purchase_portal/.kosh/bindings.js +1 -1
- package/dist/purchase_portal/.kosh/schema.d.ts +150 -6
- package/dist/purchase_portal/module.d.ts +372 -6
- package/dist/purchase_stock/.kosh/bindings.d.ts +22 -0
- package/dist/purchase_stock/.kosh/bindings.js +15 -0
- package/dist/purchase_stock/.kosh/schema.d.ts +1479 -0
- package/dist/purchase_stock/index.d.ts +7 -0
- package/dist/purchase_stock/index.js +98 -0
- package/dist/purchase_stock/module.d.ts +7535 -0
- package/dist/purchase_stock/module.js +380 -0
- package/dist/purchase_stock_account/.kosh/bindings.d.ts +22 -0
- package/dist/purchase_stock_account/.kosh/bindings.js +15 -0
- package/dist/purchase_stock_account/.kosh/schema.d.ts +2155 -0
- package/dist/purchase_stock_account/index.d.ts +3 -0
- package/dist/purchase_stock_account/index.js +24 -0
- package/dist/purchase_stock_account/module.d.ts +38015 -0
- package/dist/purchase_stock_account/module.js +168 -0
- package/dist/recruitment/.kosh/bindings.d.ts +22 -0
- package/dist/recruitment/.kosh/bindings.js +15 -0
- package/dist/recruitment/.kosh/schema.d.ts +991 -0
- package/dist/recruitment/demo.d.ts +6 -0
- package/dist/recruitment/demo.js +45 -0
- package/dist/recruitment/index.d.ts +3 -0
- package/dist/recruitment/index.js +385 -0
- package/dist/recruitment/module.d.ts +3249 -0
- package/dist/recruitment/module.js +194 -0
- package/dist/recruitment/web/HireButton.d.ts +9 -0
- package/dist/recruitment/web/HireButton.js +32 -0
- package/dist/recruitment/web/index.d.ts +11 -0
- package/dist/recruitment/web/index.js +16 -0
- package/dist/recruitment/web/messages.d.ts +2 -0
- package/dist/recruitment/web/messages.js +19 -0
- package/dist/reporting/documents.d.ts +5 -0
- package/dist/reporting/documents.js +28 -1
- package/dist/reporting/index.d.ts +1 -1
- package/dist/reporting/index.js +4 -2
- package/dist/reporting/models.js +9 -0
- package/dist/reporting/overviews.d.ts +16 -0
- package/dist/reporting/overviews.js +56 -0
- package/dist/reporting/routes-documents.js +1 -1
- package/dist/reporting/routes.js +138 -80
- package/dist/reporting/web/DashboardView.d.ts +11 -0
- package/dist/reporting/web/DashboardView.js +2 -2
- package/dist/reporting/web/DesignerView.js +5 -0
- package/dist/reporting/web/Overview.d.ts +9 -0
- package/dist/reporting/web/Overview.js +53 -0
- package/dist/reporting/web/index.d.ts +1 -0
- package/dist/reporting/web/index.js +4 -1
- package/dist/reporting/web/messages.js +9 -0
- package/dist/sale_account/.kosh/bindings.js +1 -1
- package/dist/sale_account/.kosh/schema.d.ts +181 -6
- package/dist/sale_account/index.js +22 -1
- package/dist/sale_account/module.d.ts +639 -38
- package/dist/sale_portal/.kosh/bindings.js +1 -1
- package/dist/sale_portal/.kosh/schema.d.ts +59 -3
- package/dist/sale_portal/module.d.ts +435 -5
- package/dist/sale_project/.kosh/bindings.js +1 -1
- package/dist/sale_project/.kosh/schema.d.ts +732 -3
- package/dist/sale_project/module.d.ts +5349 -208
- package/dist/sale_project/module.js +17 -1
- package/dist/sale_stock/.kosh/bindings.d.ts +22 -0
- package/dist/sale_stock/.kosh/bindings.js +15 -0
- package/dist/sale_stock/.kosh/schema.d.ts +1303 -0
- package/dist/sale_stock/index.d.ts +7 -0
- package/dist/sale_stock/index.js +84 -0
- package/dist/sale_stock/module.d.ts +7514 -0
- package/dist/sale_stock/module.js +146 -0
- package/dist/sales/.kosh/bindings.js +1 -1
- package/dist/sales/.kosh/schema.d.ts +59 -3
- package/dist/sales/index.js +195 -4
- package/dist/sales/module.d.ts +356 -3
- package/dist/sales/module.js +78 -3
- package/dist/server/api/metadata.d.ts +5 -0
- package/dist/server/api/metadata.js +5 -0
- package/dist/server/api/rest.js +64 -1
- package/dist/server/api/views.js +1 -0
- package/dist/server/app-settings.d.ts +7 -0
- package/dist/server/app-settings.js +10 -0
- package/dist/server/auth/base.js +9 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/settings/app-settings.d.ts +2 -0
- package/dist/settings/app-settings.js +518 -0
- package/dist/settings/index.d.ts +1 -0
- package/dist/settings/index.js +15 -0
- package/dist/settings/people.js +29 -5
- package/dist/settings/web/AppSettingsPage.d.ts +11 -0
- package/dist/settings/web/AppSettingsPage.js +210 -0
- package/dist/settings/web/OverviewPage.js +16 -3
- package/dist/settings/web/PeoplePage.js +20 -6
- package/dist/settings/web/index.d.ts +1 -0
- package/dist/settings/web/index.js +3 -0
- package/dist/settings/web/messages.js +118 -2
- package/dist/sign/.kosh/bindings.d.ts +22 -0
- package/dist/sign/.kosh/bindings.js +15 -0
- package/dist/sign/.kosh/schema.d.ts +990 -0
- package/dist/sign/index.d.ts +14 -0
- package/dist/sign/index.js +350 -0
- package/dist/sign/module.d.ts +4478 -0
- package/dist/sign/module.js +158 -0
- package/dist/sign/sign.d.ts +82 -0
- package/dist/sign/sign.js +474 -0
- package/dist/stock/.kosh/bindings.d.ts +22 -0
- package/dist/stock/.kosh/bindings.js +15 -0
- package/dist/stock/.kosh/schema.d.ts +1222 -0
- package/dist/stock/demo.d.ts +8 -0
- package/dist/stock/demo.js +82 -0
- package/dist/stock/index.d.ts +4 -0
- package/dist/stock/index.js +903 -0
- package/dist/stock/module.d.ts +7856 -0
- package/dist/stock/module.js +1880 -0
- package/dist/stock/replenish.d.ts +38 -0
- package/dist/stock/replenish.js +176 -0
- package/dist/stock/web/Replenishment.d.ts +8 -0
- package/dist/stock/web/Replenishment.js +84 -0
- package/dist/stock/web/ScanBox.d.ts +8 -0
- package/dist/stock/web/ScanBox.js +90 -0
- package/dist/stock/web/index.d.ts +13 -0
- package/dist/stock/web/index.js +20 -0
- package/dist/stock/web/messages.d.ts +2 -0
- package/dist/stock/web/messages.js +77 -0
- package/dist/stock_account/.kosh/bindings.d.ts +22 -0
- package/dist/stock_account/.kosh/bindings.js +15 -0
- package/dist/stock_account/.kosh/schema.d.ts +2068 -0
- package/dist/stock_account/index.d.ts +3 -0
- package/dist/stock_account/index.js +140 -0
- package/dist/stock_account/module.d.ts +11523 -0
- package/dist/stock_account/module.js +339 -0
- package/dist/storage/attachments.d.ts +5 -0
- package/dist/storage/attachments.js +12 -1
- package/dist/storage/models.js +3 -0
- package/dist/storage/routes.js +13 -2
- package/dist/todo/.kosh/bindings.d.ts +22 -0
- package/dist/todo/.kosh/bindings.js +15 -0
- package/dist/todo/.kosh/schema.d.ts +732 -0
- package/dist/todo/demo.d.ts +6 -0
- package/dist/todo/demo.js +35 -0
- package/dist/todo/index.d.ts +3 -0
- package/dist/todo/index.js +187 -0
- package/dist/todo/module.d.ts +1180 -0
- package/dist/todo/module.js +130 -0
- package/dist/trade_finance/.kosh/bindings.d.ts +22 -0
- package/dist/trade_finance/.kosh/bindings.js +15 -0
- package/dist/trade_finance/.kosh/schema.d.ts +884 -0
- package/dist/trade_finance/demo.d.ts +6 -0
- package/dist/trade_finance/demo.js +63 -0
- package/dist/trade_finance/index.d.ts +3 -0
- package/dist/trade_finance/index.js +415 -0
- package/dist/trade_finance/module.d.ts +3779 -0
- package/dist/trade_finance/module.js +507 -0
- package/dist/trade_finance_account/.kosh/bindings.d.ts +22 -0
- package/dist/trade_finance_account/.kosh/bindings.js +15 -0
- package/dist/trade_finance_account/.kosh/schema.d.ts +1830 -0
- package/dist/trade_finance_account/index.d.ts +3 -0
- package/dist/trade_finance_account/index.js +93 -0
- package/dist/trade_finance_account/module.d.ts +8074 -0
- package/dist/trade_finance_account/module.js +245 -0
- package/dist/trade_finance_purchase/.kosh/bindings.d.ts +22 -0
- package/dist/trade_finance_purchase/.kosh/bindings.js +15 -0
- package/dist/trade_finance_purchase/.kosh/schema.d.ts +1246 -0
- package/dist/trade_finance_purchase/index.d.ts +8 -0
- package/dist/trade_finance_purchase/index.js +50 -0
- package/dist/trade_finance_purchase/module.d.ts +4257 -0
- package/dist/trade_finance_purchase/module.js +44 -0
- package/dist/trade_finance_sale/.kosh/bindings.d.ts +22 -0
- package/dist/trade_finance_sale/.kosh/bindings.js +15 -0
- package/dist/trade_finance_sale/.kosh/schema.d.ts +1072 -0
- package/dist/trade_finance_sale/index.d.ts +8 -0
- package/dist/trade_finance_sale/index.js +50 -0
- package/dist/trade_finance_sale/module.d.ts +4281 -0
- package/dist/trade_finance_sale/module.js +44 -0
- package/dist/ui/api.d.ts +2 -1
- package/dist/ui/api.js +2 -1
- package/dist/ui/app.js +26 -13
- package/dist/ui/components/AppIcon.js +30 -1
- package/dist/ui/components/primitives.d.ts +2 -0
- package/dist/ui/components/primitives.js +7 -1
- package/dist/ui/i18n/messages.d.ts +27 -0
- package/dist/ui/i18n/messages.js +46 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/offline/queue.d.ts +5 -1
- package/dist/ui/offline/queue.js +2 -0
- package/dist/ui/registry.d.ts +5 -0
- package/dist/ui/shell/Home.js +55 -4
- package/dist/ui/views/FormView.js +102 -19
- package/dist/ui/views/KanbanView.d.ts +2 -0
- package/dist/ui/views/KanbanView.js +40 -3
- package/dist/ui/views/ListView.js +110 -11
- package/dist/ui/views/StatsRow.d.ts +14 -0
- package/dist/ui/views/StatsRow.js +88 -0
- package/dist/ui/views/widgets.d.ts +2 -1
- package/dist/ui/views/widgets.js +200 -1
- package/dist/views/builders.d.ts +19 -2
- package/dist/views/builders.js +21 -1
- package/dist/views/condition.d.ts +6 -0
- package/dist/views/condition.js +20 -0
- package/dist/views/documents.d.ts +8 -0
- package/dist/views/extend.d.ts +2 -2
- package/dist/views/extend.js +11 -1
- package/dist/views/index.d.ts +2 -2
- package/dist/views/index.js +2 -2
- package/dist/views/types.d.ts +52 -5
- package/dist/views/validate.js +39 -1
- package/dist/website/.kosh/bindings.d.ts +22 -0
- package/dist/website/.kosh/bindings.js +15 -0
- package/dist/website/.kosh/schema.d.ts +881 -0
- package/dist/website/demo.d.ts +6 -0
- package/dist/website/demo.js +115 -0
- package/dist/website/index.d.ts +9 -0
- package/dist/website/index.js +251 -0
- package/dist/website/module.d.ts +2987 -0
- package/dist/website/module.js +282 -0
- package/dist/website/render.d.ts +45 -0
- package/dist/website/render.js +102 -0
- package/dist/website/routes.d.ts +12 -0
- package/dist/website/routes.js +246 -0
- package/dist/website/web/PagePreview.d.ts +7 -0
- package/dist/website/web/PagePreview.js +33 -0
- package/dist/website/web/index.d.ts +11 -0
- package/dist/website/web/index.js +16 -0
- package/dist/website/web/messages.d.ts +2 -0
- package/dist/website/web/messages.js +15 -0
- package/dist/website_crm/.kosh/bindings.d.ts +22 -0
- package/dist/website_crm/.kosh/bindings.js +15 -0
- package/dist/website_crm/.kosh/schema.d.ts +967 -0
- package/dist/website_crm/index.d.ts +3 -0
- package/dist/website_crm/index.js +39 -0
- package/dist/website_crm/module.d.ts +2956 -0
- package/dist/website_crm/module.js +44 -0
- package/dist/website_sale/.kosh/bindings.d.ts +22 -0
- package/dist/website_sale/.kosh/bindings.js +15 -0
- package/dist/website_sale/.kosh/schema.d.ts +2284 -0
- package/dist/website_sale/couriers.d.ts +50 -0
- package/dist/website_sale/couriers.js +59 -0
- package/dist/website_sale/demo.d.ts +7 -0
- package/dist/website_sale/demo.js +90 -0
- package/dist/website_sale/growth.d.ts +31 -0
- package/dist/website_sale/growth.js +163 -0
- package/dist/website_sale/index.d.ts +49 -0
- package/dist/website_sale/index.js +538 -0
- package/dist/website_sale/module.d.ts +22027 -0
- package/dist/website_sale/module.js +397 -0
- package/dist/website_sale/shipments.d.ts +16 -0
- package/dist/website_sale/shipments.js +113 -0
- package/dist/website_sale/shop.d.ts +81 -0
- package/dist/website_sale/shop.js +649 -0
- package/dist/website_sale_stock/.kosh/bindings.d.ts +22 -0
- package/dist/website_sale_stock/.kosh/bindings.js +15 -0
- package/dist/website_sale_stock/.kosh/schema.d.ts +2681 -0
- package/dist/website_sale_stock/index.d.ts +9 -0
- package/dist/website_sale_stock/index.js +20 -0
- package/dist/website_sale_stock/module.d.ts +24998 -0
- package/dist/website_sale_stock/module.js +28 -0
- package/package.json +200 -2
|
@@ -18,14 +18,21 @@ import { useDesign } from '../design.js';
|
|
|
18
18
|
import { cn } from '../lib/cn.js';
|
|
19
19
|
import { useLiveRecord } from '../live.js';
|
|
20
20
|
import { useToast } from '../shell/toast.js';
|
|
21
|
+
import { StatsRow } from './StatsRow.js';
|
|
21
22
|
import { StatusChip } from './StatusChip.js';
|
|
22
23
|
import { PrefetchedNames, useRowNames } from './widgets.js';
|
|
23
24
|
const pick = (row, keys) => Object.fromEntries(keys.filter((k) => k in row).map((k) => [k, row[k]]));
|
|
24
25
|
/** A line's values as the server takes them: many2many as `{ set }` (a line's taxes). */
|
|
25
26
|
function lineValues(values, fields) {
|
|
26
27
|
const out = {};
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
// Only what a line can be given: its id and read-only columns (a computed total, a reserved quantity) are shown,
|
|
29
|
+
// never written.
|
|
30
|
+
for (const [key, value] of Object.entries(values)) {
|
|
31
|
+
const field = fields[key];
|
|
32
|
+
if (field === undefined || field.readonly === true)
|
|
33
|
+
continue;
|
|
34
|
+
out[key] = field.kind === 'many2many' && Array.isArray(value) ? { set: value } : value;
|
|
35
|
+
}
|
|
29
36
|
return out;
|
|
30
37
|
}
|
|
31
38
|
/**
|
|
@@ -93,7 +100,10 @@ function commandsOf(lines, fields) {
|
|
|
93
100
|
? {
|
|
94
101
|
update: lines.rows
|
|
95
102
|
.filter((r) => r.id !== undefined && r.dirty)
|
|
96
|
-
.map((r) => ({
|
|
103
|
+
.map((r) => ({
|
|
104
|
+
id: r.id,
|
|
105
|
+
values: lineValues(Object.fromEntries((r.edited ?? []).map((k) => [k, r.values[k]])), fields),
|
|
106
|
+
})),
|
|
97
107
|
}
|
|
98
108
|
: {}),
|
|
99
109
|
...(lines.deleted.length > 0 ? { delete: lines.deleted } : {}),
|
|
@@ -118,7 +128,7 @@ lineFields) {
|
|
|
118
128
|
return out;
|
|
119
129
|
}
|
|
120
130
|
function Lines({ node, served, ids, readonly, state, onState, }) {
|
|
121
|
-
const { api, registry } = useKosh();
|
|
131
|
+
const { api, registry, uid, companyId } = useKosh();
|
|
122
132
|
const { t } = useTranslation();
|
|
123
133
|
const field = served.fields[served.view.model]?.[node.field];
|
|
124
134
|
const target = field?.target ?? '';
|
|
@@ -147,13 +157,30 @@ function Lines({ node, served, ids, readonly, state, onState, }) {
|
|
|
147
157
|
return (_jsx(PrefetchedNames.Provider, { value: names, children: _jsxs("div", { className: "col-span-full overflow-x-auto", children: [_jsxs("table", { className: "w-full text-sm", children: [_jsx("caption", { className: "sr-only", children: node.id }), _jsx("thead", { children: _jsxs("tr", { className: "border-b", children: [columns.map((c) => (_jsx("th", { scope: "col", className: "px-2 py-1.5 text-start font-medium text-muted-foreground", children: c.label ?? columnFields[c.field]?.label ?? c.field }, c.id))), _jsx("th", { className: "w-10", children: _jsx("span", { className: "sr-only", children: t('views.removeLine') }) })] }) }), _jsx("tbody", { children: rows.map((row, index) => (_jsxs("tr", { className: "border-b", children: [columns.map((c) => {
|
|
148
158
|
const meta = columnFields[c.field];
|
|
149
159
|
const Widget = registry.widget(c, meta);
|
|
150
|
-
return (_jsx("td", { className: "px-2 py-1", children: _jsx(Widget, { id: `${row.key}-${c.id}`, node: c, field: meta, value: row.values[c.field], record: row.values, readonly: readonly ||
|
|
151
|
-
|
|
160
|
+
return (_jsx("td", { className: "px-2 py-1", children: _jsx(Widget, { id: `${row.key}-${c.id}`, node: c, field: meta, value: row.values[c.field], record: row.values, readonly: readonly ||
|
|
161
|
+
meta.readonly ||
|
|
162
|
+
holds(c.readonlyWhen, row.values, { uid, companyId }), onChange: (value) => set(rows.map((r, i) => i === index
|
|
163
|
+
? {
|
|
164
|
+
...r,
|
|
165
|
+
values: { ...r.values, [c.field]: value },
|
|
166
|
+
dirty: true,
|
|
167
|
+
edited: [...new Set([...(r.edited ?? []), c.field])],
|
|
168
|
+
}
|
|
152
169
|
: r)) }) }, c.id));
|
|
153
170
|
}), _jsx("td", { children: readonly ? null : (_jsx(Button, { variant: "ghost", size: "icon", "aria-label": t('views.removeLine'), onClick: () => set(rows.filter((_, i) => i !== index), row.id === undefined
|
|
154
171
|
? (state?.deleted ?? [])
|
|
155
172
|
: [...(state?.deleted ?? []), row.id]), children: _jsx(Trash2, { "aria-hidden": true }) })) })] }, row.key))) })] }), readonly ? null : (_jsxs(Button, { variant: "link", size: "sm", className: "mt-1", onClick: () => set([...rows, { key: `new-${rows.length}-${Date.now()}`, values: {}, dirty: true }]), children: [_jsx(Plus, { "aria-hidden": true }), t('views.addLine')] }))] }) }));
|
|
156
173
|
}
|
|
174
|
+
/** Every field node of a sheet, in order (groups, pages and loose fields; not line columns). */
|
|
175
|
+
function flatFieldNodes(nodes) {
|
|
176
|
+
return nodes.flatMap((n) => n.kind === 'field'
|
|
177
|
+
? [n]
|
|
178
|
+
: n.kind === 'group'
|
|
179
|
+
? flatFieldNodes(n.children)
|
|
180
|
+
: n.kind === 'notebook'
|
|
181
|
+
? n.pages.flatMap((p) => flatFieldNodes(p.children))
|
|
182
|
+
: []);
|
|
183
|
+
}
|
|
157
184
|
/** The default form renderer. */
|
|
158
185
|
export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs, pager, proposed, }) {
|
|
159
186
|
const { api, registry, uid, companyId, offline } = useKosh();
|
|
@@ -228,6 +255,8 @@ export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs,
|
|
|
228
255
|
])
|
|
229
256
|
: []);
|
|
230
257
|
const [changes, setChanges] = useState(proposedChanges);
|
|
258
|
+
/** The latest onchange request: older answers are ignored. */
|
|
259
|
+
const onchangeSequence = useRef(0);
|
|
231
260
|
const [lines, setLines] = useState(proposedLines);
|
|
232
261
|
const [problem, setProblem] = useState(null);
|
|
233
262
|
const [warnings, setWarnings] = useState([]);
|
|
@@ -242,6 +271,12 @@ export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs,
|
|
|
242
271
|
const record = loaded.data?.record;
|
|
243
272
|
const values = useMemo(() => ({ ...(record ?? {}), ...changes }), [record, changes]);
|
|
244
273
|
const env = { uid, companyId };
|
|
274
|
+
// RFC 0022 §3.4: the next step — the transitions the record may take now, and what blocks the others.
|
|
275
|
+
const next = useQuery({
|
|
276
|
+
queryKey: ['next', model, recordId, loaded.data?.etag ?? null],
|
|
277
|
+
queryFn: () => api.call('GET', `/api/v1/models/${model}/${recordId}/next`),
|
|
278
|
+
enabled: !isNew && recordId !== null && served.transitions.length > 0,
|
|
279
|
+
});
|
|
245
280
|
const dirty = Object.keys(changes).length > 0 || lines.size > 0;
|
|
246
281
|
// Leaving with unsaved changes asks first (in-app navigation and closing the tab). A ref, not the render's
|
|
247
282
|
// value: a save clears it before navigating to the saved record, ahead of the next render.
|
|
@@ -262,7 +297,11 @@ export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs,
|
|
|
262
297
|
};
|
|
263
298
|
const save = useMutation({
|
|
264
299
|
mutationFn: async () => {
|
|
265
|
-
|
|
300
|
+
// A new record is created with the action's defaults too (a bill from Bills, a delivery from Deliveries):
|
|
301
|
+
// they are part of it without being changes.
|
|
302
|
+
const payload = payloadOf(isNew
|
|
303
|
+
? { ...Object.fromEntries(Object.entries(base).filter(([k]) => !isLines(k))), ...changes }
|
|
304
|
+
: changes, fields, lines, (key) => served.fields[fields[key]?.target ?? ''] ?? {});
|
|
266
305
|
const etag = loaded.data?.etag ?? null;
|
|
267
306
|
try {
|
|
268
307
|
return isNew
|
|
@@ -292,6 +331,8 @@ export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs,
|
|
|
292
331
|
setChanges({});
|
|
293
332
|
setLines(new Map());
|
|
294
333
|
setProblem(null);
|
|
334
|
+
// The next step may have changed with the lines, which leave the record's version as it was.
|
|
335
|
+
void queryClient.invalidateQueries({ queryKey: ['next', model] });
|
|
295
336
|
if (result.queued === true) {
|
|
296
337
|
unsaved.current = false;
|
|
297
338
|
toast({
|
|
@@ -326,7 +367,14 @@ export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs,
|
|
|
326
367
|
onSuccess: async (result, name) => {
|
|
327
368
|
setProblem(null);
|
|
328
369
|
queryClient.setQueryData(['record', model, recordId], result);
|
|
329
|
-
|
|
370
|
+
// The answer has the record's own fields: its lines (and what the transition changed in them, a line's
|
|
371
|
+
// reserved quantity) are fetched again.
|
|
372
|
+
await Promise.all([
|
|
373
|
+
queryClient.invalidateQueries({ queryKey: ['record', model, recordId] }),
|
|
374
|
+
queryClient.invalidateQueries({ queryKey: ['lines'] }),
|
|
375
|
+
queryClient.invalidateQueries({ queryKey: ['list', model] }),
|
|
376
|
+
queryClient.invalidateQueries({ queryKey: ['next', model] }),
|
|
377
|
+
]);
|
|
330
378
|
const button = view.type === 'form' ? view.header.buttons.find((b) => b.transition === name) : undefined;
|
|
331
379
|
toast({ title: t('views.transitionDone', { action: button?.label ?? name }) });
|
|
332
380
|
},
|
|
@@ -342,6 +390,8 @@ export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs,
|
|
|
342
390
|
onError: fail,
|
|
343
391
|
});
|
|
344
392
|
const runOnchange = (draft, changed) => {
|
|
393
|
+
// Only the latest change's answer applies: an earlier one arriving late would undo what was typed since.
|
|
394
|
+
const sequence = ++onchangeSequence.current;
|
|
345
395
|
// The record's id travels on its own: it is not a field of the draft.
|
|
346
396
|
const { id: _id, ...plain } = draft;
|
|
347
397
|
void api
|
|
@@ -351,6 +401,8 @@ export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs,
|
|
|
351
401
|
changed: [...changed],
|
|
352
402
|
})
|
|
353
403
|
.then((result) => {
|
|
404
|
+
if (sequence !== onchangeSequence.current)
|
|
405
|
+
return;
|
|
354
406
|
const assisted = {};
|
|
355
407
|
// Computed values (display name, totals) come back too: shown, never written.
|
|
356
408
|
for (const [k, v] of Object.entries(result.values))
|
|
@@ -370,13 +422,14 @@ export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs,
|
|
|
370
422
|
if (served.onchange.includes(key))
|
|
371
423
|
runOnchange({ ...values, [key]: value }, [key]);
|
|
372
424
|
};
|
|
373
|
-
// Proposed values trigger their onchanges once the new record is there (the customer's
|
|
374
|
-
// from them is part of the
|
|
425
|
+
// Proposed values and the action's defaults trigger their onchanges once the new record is there (the customer's
|
|
426
|
+
// currency; a new receipt's locations): what follows from them is part of the new record, unsaved like it.
|
|
375
427
|
// biome-ignore lint/correctness/useExhaustiveDependencies: once per loaded new record
|
|
376
428
|
useEffect(() => {
|
|
377
|
-
if (!isNew || record === undefined
|
|
429
|
+
if (!isNew || record === undefined)
|
|
378
430
|
return;
|
|
379
|
-
const
|
|
431
|
+
const given = [...new Set([...(proposed ?? []), ...Object.keys(defaults ?? {})])];
|
|
432
|
+
const keys = given.filter((key) => served.onchange.includes(key) && !isLines(key));
|
|
380
433
|
if (keys.length > 0)
|
|
381
434
|
runOnchange(values, keys);
|
|
382
435
|
}, [record]);
|
|
@@ -394,7 +447,7 @@ export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs,
|
|
|
394
447
|
const readonly = locked || field.readonly || holds(node.readonlyWhen, values, env);
|
|
395
448
|
const id = `${formId}-${node.id}`;
|
|
396
449
|
const invalid = problem?.problem.detail.includes(node.field) === true;
|
|
397
|
-
return (_jsxs("div", { className: cn('grid gap-1', (field.kind === 'text' || field.kind === 'html') && 'col-span-full'), children: [_jsxs(Label, { htmlFor: id, children: [node.label ?? field.label, field.required && !readonly ? (_jsxs("span", { "aria-hidden": true, className: "text-danger", children: [' ', "*"] })) : null, recordId === 'new' && proposed?.includes(node.field) === true ? (_jsx("span", { className: "ms-2 rounded bg-accent px-1.5 py-0.5 text-[10px] font-medium text-accent-foreground", children: t('views.proposed') })) : null] }), _jsx("div", { className: "min-h-9 py-1.5 text-sm", children: _jsx(Widget, { id: id, node: node, field: field, value: values[node.field], record: values, readonly: readonly, onChange: (v) => change(node.field, v), invalid: invalid }) }), node.help === undefined ? null : (_jsx("p", { className: "text-xs text-muted-foreground", children: node.help }))] }, node.id));
|
|
450
|
+
return (_jsxs("div", { className: cn('grid gap-1', (field.kind === 'text' || field.kind === 'html') && 'col-span-full'), children: [_jsxs(Label, { htmlFor: id, children: [node.label ?? field.label, (field.required || holds(node.requiredWhen, values, env)) && !readonly ? (_jsxs("span", { "aria-hidden": true, className: "text-danger", children: [' ', "*"] })) : null, recordId === 'new' && proposed?.includes(node.field) === true ? (_jsx("span", { className: "ms-2 rounded bg-accent px-1.5 py-0.5 text-[10px] font-medium text-accent-foreground", children: t('views.proposed') })) : null] }), _jsx("div", { className: "min-h-9 py-1.5 text-sm", children: _jsx(Widget, { id: id, node: node, field: field, value: values[node.field], record: values, model: model, readonly: readonly, onChange: (v) => change(node.field, v), invalid: invalid }) }), (node.help ?? field.help) === undefined ? null : (_jsx("p", { className: "text-xs text-muted-foreground", children: node.help ?? field.help }))] }, node.id));
|
|
398
451
|
};
|
|
399
452
|
const renderNodes = (nodes) => nodes.map((node) => {
|
|
400
453
|
switch (node.kind) {
|
|
@@ -403,7 +456,7 @@ export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs,
|
|
|
403
456
|
case 'group':
|
|
404
457
|
if (!visible(node.visibleWhen))
|
|
405
458
|
return null;
|
|
406
|
-
return (_jsxs("fieldset", { className: "col-span-full", children: [node.label === undefined ? null : (_jsx("legend", { className: "mb-2 text-sm font-semibold", children: node.label })), _jsx("div", { className: cn('grid gap-x-6 gap-y-3', node.columns === 1
|
|
459
|
+
return (_jsxs("fieldset", { className: "col-span-full", children: [node.label === undefined ? null : (_jsx("legend", { className: "mb-2 text-sm font-semibold", children: node.label })), node.description === undefined ? null : (_jsx("p", { className: "col-span-full mb-3 text-sm text-muted-foreground", children: node.description })), _jsx("div", { className: cn('grid gap-x-6 gap-y-3', node.columns === 1
|
|
407
460
|
? 'grid-cols-1'
|
|
408
461
|
: node.columns === 3
|
|
409
462
|
? 'sm:grid-cols-3'
|
|
@@ -418,8 +471,12 @@ export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs,
|
|
|
418
471
|
const pages = node.pages.filter((p) => visible(p.visibleWhen));
|
|
419
472
|
if (pages.length === 0)
|
|
420
473
|
return null;
|
|
421
|
-
return (_jsxs(Tabs, { defaultValue: pages[0]?.id, className: "col-span-full", children: [_jsx(TabsList, { children: pages.map((p) => (_jsx(TabsTrigger, { value: p.id, children: p.label }, p.id))) }), pages.map((p) => (
|
|
474
|
+
return (_jsxs(Tabs, { defaultValue: pages[0]?.id, className: "col-span-full", children: [_jsx(TabsList, { children: pages.map((p) => (_jsx(TabsTrigger, { value: p.id, children: p.label }, p.id))) }), pages.map((p) => (_jsxs(TabsContent, { value: p.id, children: [p.description === undefined ? null : (_jsx("p", { className: "mb-3 text-sm text-muted-foreground", children: p.description })), _jsx("div", { className: "grid gap-x-6 gap-y-3 sm:grid-cols-2", children: renderNodes(p.children) })] }, p.id)))] }, node.id));
|
|
422
475
|
}
|
|
476
|
+
case 'stats':
|
|
477
|
+
if (isNew || !visible(node.visibleWhen))
|
|
478
|
+
return null;
|
|
479
|
+
return (_jsx(StatsRow, { node: node, values: values, env: env, version: loaded.data?.etag ?? null }, node.id));
|
|
423
480
|
case 'lines': {
|
|
424
481
|
const ids = Array.isArray(values[node.field])
|
|
425
482
|
? values[node.field].filter((v) => typeof v === 'number')
|
|
@@ -439,6 +496,30 @@ export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs,
|
|
|
439
496
|
});
|
|
440
497
|
const statusbar = view.header.statusbar;
|
|
441
498
|
const state = statusbar === undefined ? undefined : values[statusbar];
|
|
499
|
+
// The step to show: the primary action when it is one of the record's next transitions (blocked or not),
|
|
500
|
+
// else the first the record may take, else the first blocked one.
|
|
501
|
+
const candidates = (next.data?.transitions ?? []).filter((tr) => view.header.buttons.some((b) => b.transition === tr.name));
|
|
502
|
+
const nextStep = candidates.find((tr) => view.header.buttons.find((b) => b.transition === tr.name)?.primary === true) ??
|
|
503
|
+
candidates.find((tr) => tr.allowed) ??
|
|
504
|
+
candidates[0];
|
|
505
|
+
const nextButton = nextStep === undefined
|
|
506
|
+
? undefined
|
|
507
|
+
: view.header.buttons.find((b) => b.transition === nextStep.name);
|
|
508
|
+
// The required fields still empty (new and draft records): the checklist in the rail.
|
|
509
|
+
const missing = isNew
|
|
510
|
+
? []
|
|
511
|
+
: flatFieldNodes(view.sheet)
|
|
512
|
+
.filter((n) => {
|
|
513
|
+
const meta = fields[n.field];
|
|
514
|
+
const v = values[n.field];
|
|
515
|
+
return (meta !== undefined &&
|
|
516
|
+
!meta.readonly &&
|
|
517
|
+
(meta.required || holds(n.requiredWhen, values, env)) &&
|
|
518
|
+
(v === null || v === undefined || v === '' || (Array.isArray(v) && v.length === 0)));
|
|
519
|
+
})
|
|
520
|
+
.map((n) => n.field);
|
|
521
|
+
// RFC 0022 §3.5: the record's document templates as a Print menu, when reporting's web is registered.
|
|
522
|
+
const Print = registry.component('reporting.Documents');
|
|
442
523
|
const buttons = view.header.buttons.filter((b) => {
|
|
443
524
|
const spec = served.transitions.find((tr) => tr.name === b.transition);
|
|
444
525
|
return (!isNew &&
|
|
@@ -469,7 +550,7 @@ export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs,
|
|
|
469
550
|
const chatter = view.chatter === true && registry.component('chatter') !== undefined && !isNew
|
|
470
551
|
? registry.component('chatter')
|
|
471
552
|
: undefined;
|
|
472
|
-
const rail = (_jsxs(_Fragment, { children: [summaryNodes.length === 0 ? null : (_jsxs("section", { className: "rounded-lg border bg-surface p-4", "aria-labelledby": `${formId}-summary`, children: [_jsx("h2", { id: `${formId}-summary`, className: "mb-1 text-sm font-semibold", children: t('views.summary') }), _jsx("dl", { className: "divide-y", children: summaryNodes.map(row) })] })), isNew || detailNodes.length === 0 ? null : (_jsxs("section", { className: "rounded-lg border bg-surface p-4", "aria-labelledby": `${formId}-details`, children: [_jsx("h2", { id: `${formId}-details`, className: "mb-1 text-sm font-semibold", children: t('views.details') }), _jsx("dl", { children: detailNodes.map(row) })] })), chatter === undefined
|
|
553
|
+
const rail = (_jsxs(_Fragment, { children: [summaryNodes.length === 0 ? null : (_jsxs("section", { className: "rounded-lg border bg-surface p-4", "aria-labelledby": `${formId}-summary`, children: [_jsx("h2", { id: `${formId}-summary`, className: "mb-1 text-sm font-semibold", children: t('views.summary') }), _jsx("dl", { className: "divide-y", children: summaryNodes.map(row) })] })), missing.length === 0 ? null : (_jsxs("section", { className: "rounded-lg border bg-surface p-4", "aria-labelledby": `${formId}-missing`, children: [_jsx("h2", { id: `${formId}-missing`, className: "mb-1 text-sm font-semibold", children: t('views.nextStep.missing', { count: missing.length }) }), _jsx("ul", { className: "grid gap-1 text-sm", children: missing.map((key) => (_jsxs("li", { className: "flex items-center gap-2", children: [_jsx("span", { "aria-hidden": true, className: "size-1.5 rounded-full bg-warning" }), fields[key]?.label ?? key] }, key))) })] })), isNew || detailNodes.length === 0 ? null : (_jsxs("section", { className: "rounded-lg border bg-surface p-4", "aria-labelledby": `${formId}-details`, children: [_jsx("h2", { id: `${formId}-details`, className: "mb-1 text-sm font-semibold", children: t('views.details') }), _jsx("dl", { children: detailNodes.map(row) })] })), chatter === undefined
|
|
473
554
|
? null
|
|
474
555
|
: (() => {
|
|
475
556
|
const Chatter = chatter;
|
|
@@ -542,9 +623,11 @@ export function FormView({ served, recordId, defaults, onSaved, onBack, crumbs,
|
|
|
542
623
|
setChanges({});
|
|
543
624
|
setProblem(null);
|
|
544
625
|
void loaded.refetch();
|
|
545
|
-
}, children: t('views.reload') })) : undefined, children: problem.kind === 'stale-record' ? t('views.stale') : problem.message })), warnings.map((w) => (_jsx(Alert, { tone: "info", children: w }, w))),
|
|
546
|
-
|
|
547
|
-
|
|
626
|
+
}, children: t('views.reload') })) : undefined, children: problem.kind === 'stale-record' ? t('views.stale') : problem.message })), warnings.map((w) => (_jsx(Alert, { tone: "info", children: w }, w))), nextStep === undefined || nextButton === undefined || locked ? null : (_jsx(Alert, { tone: nextStep.allowed ? 'info' : 'warning', children: nextStep.allowed
|
|
627
|
+
? t('views.nextStep.ready', { step: nextButton.label ?? nextButton.transition })
|
|
628
|
+
: `${t('views.nextStep.before', { step: nextButton.label ?? nextButton.transition })} ${nextStep.message ?? ''}`.trim() })), buttons.length === 0 && (isNew || Print === undefined) ? null : (_jsxs("div", { role: "toolbar", "aria-label": t('views.recordActions'), className: "flex flex-wrap gap-2", children: [isNew || Print === undefined ? null : (_jsx(Print, { node: { kind: 'component', id: 'print', component: 'reporting.Documents' }, record: record ?? null, model: model, served: served, api: api, version: loaded.data?.etag ?? null, reload: () => void loaded.refetch() })), _jsx("div", { className: "contents", children: buttons.map((b, i) => (_jsx(Button, { type: "button", size: "sm", variant: b.primary === true || (i === 0 && !buttons.some((x) => x.primary === true))
|
|
629
|
+
? 'primary'
|
|
630
|
+
: 'secondary', busy: transition.isPending && transition.variables === b.transition, onClick: () => b.confirm === undefined ? transition.mutate(b.transition) : setConfirming(b), children: b.label ?? b.transition }, b.id))) })] })), sections.map((section) => section.nodes[0]?.kind === 'stats' ? (_jsx("div", { className: "grid", children: renderNodes(section.nodes) }, section.key)) : (_jsx("section", { className: "rounded-lg border bg-surface p-5", children: _jsx("div", { className: "grid gap-x-6 gap-y-4 sm:grid-cols-2", children: renderNodes(section.nodes) }) }, section.key))), showRail ? null : rail] }), showRail ? (_jsx("aside", { "aria-label": t('views.recordPanel'),
|
|
548
631
|
// Beside the record when wide; under it otherwise (one grid column).
|
|
549
632
|
className: "grid content-start gap-4 xl:sticky xl:top-28", children: rail })) : null] })] }), _jsx(Dialog, { open: confirming !== null, onOpenChange: (open) => !open && setConfirming(null), title: confirming?.label ?? confirming?.transition ?? '', description: confirming?.confirm ?? '', footer: _jsxs(_Fragment, { children: [_jsx(Button, { onClick: () => setConfirming(null), children: t('views.no') }), _jsx(Button, { variant: "primary", onClick: () => {
|
|
550
633
|
if (confirming !== null)
|
|
@@ -8,5 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { type ReactElement } from 'react';
|
|
10
10
|
import type { ViewProps } from '../registry.js';
|
|
11
|
+
/** A stable tint for a value (a stage, a tag): a hue from its text, in the theme's saturation. */
|
|
12
|
+
export declare const tintOf: (v: unknown) => string;
|
|
11
13
|
/** The default kanban renderer. */
|
|
12
14
|
export declare function KanbanView(props: ViewProps): ReactElement;
|
|
@@ -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;
|
|
@@ -37,6 +56,14 @@ function Card({ row, served, onOpen, }) {
|
|
|
37
56
|
if (view.type !== 'kanban')
|
|
38
57
|
throw new Error('kanban');
|
|
39
58
|
const fields = served.fields[view.model] ?? {};
|
|
59
|
+
// A number, or a decimal's string ("75.0").
|
|
60
|
+
const rawProgress = view.card.progress === undefined ? undefined : row[view.card.progress];
|
|
61
|
+
const progressValue = typeof rawProgress === 'number' || (typeof rawProgress === 'string' && rawProgress !== '')
|
|
62
|
+
? Number(rawProgress)
|
|
63
|
+
: Number.NaN;
|
|
64
|
+
const progress = Number.isFinite(progressValue)
|
|
65
|
+
? Math.max(0, Math.min(100, progressValue))
|
|
66
|
+
: null;
|
|
40
67
|
const show = (node) => {
|
|
41
68
|
const field = fields[node.field];
|
|
42
69
|
if (field === undefined)
|
|
@@ -50,9 +77,19 @@ function Card({ row, served, onOpen, }) {
|
|
|
50
77
|
const field = fields[key];
|
|
51
78
|
return field === undefined ? null : show({ kind: 'field', id: key, field: key });
|
|
52
79
|
};
|
|
53
|
-
return (_jsxs("li", { ref: setNodeRef,
|
|
54
|
-
|
|
55
|
-
|
|
80
|
+
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: {
|
|
81
|
+
...(transform === null
|
|
82
|
+
? {}
|
|
83
|
+
: { transform: `translate3d(${transform.x}px, ${transform.y}px, 0)` }),
|
|
84
|
+
...(view.card.color === undefined
|
|
85
|
+
? {}
|
|
86
|
+
: { borderInlineStartColor: tintOf(row[view.card.color]) }),
|
|
87
|
+
}, 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'
|
|
88
|
+
? (row['displayName'] ?? row['name'])
|
|
89
|
+
: nameOfValue(row[view.card.avatar])) ?? ''), src: fields[view.card.avatar]?.target === 'storage.attachment' &&
|
|
90
|
+
idOfValue(row[view.card.avatar]) !== null
|
|
91
|
+
? `/api/v1/attachments/${idOfValue(row[view.card.avatar])}/download?inline=true&w=256`
|
|
92
|
+
: 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) })), progress === null ? null : (_jsx("div", { role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": 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: `${progress}%` } }) }))] }));
|
|
56
93
|
}
|
|
57
94
|
function ColumnView({ column, props, keys, groupField, stats, folded, onUnfold, }) {
|
|
58
95
|
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';
|
|
@@ -28,6 +28,14 @@ const features = tableFeatures({});
|
|
|
28
28
|
const helper = createColumnHelper();
|
|
29
29
|
const HEIGHTS = { comfortable: 40, compact: 32 };
|
|
30
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
|
+
};
|
|
31
39
|
function openInNewTab(id) {
|
|
32
40
|
const path = window.location.pathname.replace(/\/$/, '');
|
|
33
41
|
window.open(`${path}/${id}`, '_blank', 'noopener');
|
|
@@ -60,6 +68,43 @@ async function each(ids, fn) {
|
|
|
60
68
|
}
|
|
61
69
|
return { done, failed, reason };
|
|
62
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 ?? DEFAULT_WIDTH, "aria-valuemin": MIN_WIDTH, "aria-valuemax": MAX_WIDTH, 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
|
+
}
|
|
63
108
|
const stored = {
|
|
64
109
|
get(key, fallback) {
|
|
65
110
|
try {
|
|
@@ -165,8 +210,35 @@ const SKELETON_CELLS = ['name', 'second', 'third', 'fourth', 'fifth', 'sixth'];
|
|
|
165
210
|
function SkeletonRows({ columns, height }) {
|
|
166
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))) }));
|
|
167
212
|
}
|
|
168
|
-
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, }) {
|
|
169
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
|
+
};
|
|
170
242
|
const { t } = useTranslation();
|
|
171
243
|
const toast = useToast();
|
|
172
244
|
const queryClient = useQueryClient();
|
|
@@ -527,18 +599,20 @@ function Rows({ props, where, columns, fields, offset, limit, height, selection,
|
|
|
527
599
|
const direction = order[0]?.startsWith(`${node.field} `)
|
|
528
600
|
? order[0].split(' ')[1]
|
|
529
601
|
: undefined;
|
|
530
|
-
return (
|
|
602
|
+
return (_jsxs("th", { scope: "col", style: colStyle(node.id), "aria-sort": direction === 'asc'
|
|
531
603
|
? 'ascending'
|
|
532
604
|
: direction === 'desc'
|
|
533
605
|
? 'descending'
|
|
534
|
-
: 'none', className:
|
|
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));
|
|
535
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) => {
|
|
536
610
|
const row = rows[v.index];
|
|
537
611
|
if (row === undefined)
|
|
538
612
|
return null;
|
|
539
613
|
const id = row.original.id;
|
|
540
614
|
const isSelected = selection?.selected.has(id) === true;
|
|
541
|
-
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'),
|
|
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)),
|
|
542
616
|
// Ctrl / Cmd + click or the middle button: the record in a new tab, the list stays.
|
|
543
617
|
onClick: (e) => {
|
|
544
618
|
if (e.ctrlKey || e.metaKey)
|
|
@@ -569,7 +643,7 @@ function Rows({ props, where, columns, fields, offset, limit, height, selection,
|
|
|
569
643
|
const isActive = active?.row === v.index && active.col === colIndex;
|
|
570
644
|
const inSelection = range !== null && anchor !== null && inRange(range, ref);
|
|
571
645
|
const isEditing = editing?.cell.row === v.index && editing.cell.col === colIndex;
|
|
572
|
-
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: () => {
|
|
573
647
|
if (isActive)
|
|
574
648
|
return;
|
|
575
649
|
setAnchor(null); // a click or Tab starts a new selection
|
|
@@ -625,7 +699,7 @@ function Totals({ props, columns, fields, }) {
|
|
|
625
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));
|
|
626
700
|
}) }));
|
|
627
701
|
}
|
|
628
|
-
function Groups({ props, columns, fields, height, }) {
|
|
702
|
+
function Groups({ props, columns, fields, height, layout, }) {
|
|
629
703
|
const { api } = useKosh();
|
|
630
704
|
const { t } = useTranslation();
|
|
631
705
|
const key = props.groupBy[0];
|
|
@@ -665,7 +739,7 @@ function Groups({ props, columns, fields, height, }) {
|
|
|
665
739
|
else
|
|
666
740
|
next.add(id);
|
|
667
741
|
return next;
|
|
668
|
-
}), 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));
|
|
669
743
|
}) }));
|
|
670
744
|
}
|
|
671
745
|
/** Saves a downloaded file. */
|
|
@@ -700,9 +774,29 @@ export function ListView(props) {
|
|
|
700
774
|
const allColumns = view.columns.filter((c) => fields[c.field] !== undefined);
|
|
701
775
|
const columnsKey = `kosh.columns.${uid}.${view.id}`;
|
|
702
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
|
+
};
|
|
703
796
|
const { density, setDensity } = useKosh();
|
|
704
797
|
const height = HEIGHTS[density];
|
|
705
798
|
const columns = allColumns.filter((c) => !hidden.has(c.id));
|
|
799
|
+
const layout = { widths, pinned, setWidth };
|
|
706
800
|
const design = useDesign();
|
|
707
801
|
const [offset, setOffset] = useState(0);
|
|
708
802
|
const [count, setCount] = useState(null);
|
|
@@ -828,7 +922,7 @@ export function ListView(props) {
|
|
|
828
922
|
...(where === undefined ? {} : { filter: where }),
|
|
829
923
|
...(props.order.length === 0 ? {} : { order: props.order }),
|
|
830
924
|
})
|
|
831
|
-
: await api.download(`/api/v1/models/${encodeURIComponent(model)}/export
|
|
925
|
+
: await api.download(`/api/v1/models/${encodeURIComponent(model)}/export/${format}`, {
|
|
832
926
|
fields: keys,
|
|
833
927
|
...(where === undefined ? {} : { filter: where }),
|
|
834
928
|
});
|
|
@@ -858,8 +952,13 @@ export function ListView(props) {
|
|
|
858
952
|
next.add(c.id);
|
|
859
953
|
setHidden(next);
|
|
860
954
|
stored.set(columnsKey, [...next]);
|
|
861
|
-
}, children: c.label ?? fields[c.field]?.label ?? c.field }, c.id)))
|
|
862
|
-
|
|
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, { "aria-label": t('views.pinColumn', {
|
|
956
|
+
name: c.label ?? fields[c.field]?.label ?? c.field,
|
|
957
|
+
}), 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: () => {
|
|
958
|
+
setWidths({});
|
|
959
|
+
stored.set(widthsKey, {});
|
|
960
|
+
}, 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] }));
|
|
961
|
+
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', {
|
|
863
962
|
from: offset + 1,
|
|
864
963
|
to: Math.min(offset + pageSize, count),
|
|
865
964
|
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;
|