@protobase/ui 0.117.0 → 0.117.2
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/messages.d.ts +2 -2
- package/dist/app/change-confirm/messages.d.ts +2 -2
- package/dist/app/charts/messages.d.ts +2 -2
- package/dist/app/conversation/messages.d.ts +2 -2
- package/dist/app/conversation/thread-state.d.ts +1 -1
- package/dist/app/create/messages.d.ts +2 -2
- package/dist/app/delete/messages.d.ts +2 -2
- package/dist/app/displays/messages.d.ts +2 -2
- package/dist/app/embedded-list/messages.d.ts +2 -2
- package/dist/app/export/messages.d.ts +2 -2
- package/dist/app/field-messages.d.ts +2 -2
- package/dist/app/field-types/json/messages.d.ts +2 -2
- package/dist/app/field-types/runner-install/messages.d.ts +2 -2
- package/dist/app/field-types/workflow/definition.d.ts +1 -1
- package/dist/app/field-types/workflow/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
- package/dist/app/field-types/workflow-status/messages.d.ts +2 -2
- package/dist/app/file-viewers/messages.d.ts +2 -2
- package/dist/app/focus/messages.d.ts +2 -2
- package/dist/app/gallery/gallery-layout.d.ts +2 -2
- package/dist/app/gallery/messages.d.ts +2 -2
- package/dist/app/hand-order/messages.d.ts +2 -2
- package/dist/app/history/messages.d.ts +2 -2
- package/dist/app/import/messages.d.ts +2 -2
- package/dist/app/list-messages.d.ts +2 -2
- package/dist/app/messages.d.ts +2 -2
- package/dist/app/meta-gate-messages.d.ts +2 -2
- package/dist/app/new-version/messages.d.ts +2 -2
- package/dist/app/pages/guide/billing-config.d.ts +1 -1
- package/dist/app/pages/guide/billing-views.d.ts +1 -1
- package/dist/app/pages/messages.d.ts +2 -2
- package/dist/app/record-chart/messages.d.ts +2 -2
- package/dist/app/record-messages.d.ts +2 -2
- package/dist/app/record-row/messages.d.ts +2 -2
- package/dist/app/related-cards/messages.d.ts +2 -2
- package/dist/app/runtime/messages.d.ts +2 -2
- package/dist/app/saved/messages.d.ts +2 -2
- package/dist/app/saved/use-favorite.d.ts +1 -1
- package/dist/app/search/messages.d.ts +2 -2
- package/dist/app/searches/messages.d.ts +2 -2
- package/dist/app/searches/use-save-search.d.ts +1 -1
- package/dist/app-shell/messages.d.ts +2 -2
- package/dist/assistant-dock/messages.d.ts +2 -2
- package/dist/auth/messages.d.ts +2 -2
- package/dist/calls/messages.d.ts +2 -2
- package/dist/carousel/messages.d.ts +2 -2
- package/dist/chat/messages.d.ts +2 -2
- package/dist/compact-table/messages.d.ts +2 -2
- package/dist/data-grid/column-spec.d.ts +1 -1
- package/dist/data-grid/messages.d.ts +2 -2
- package/dist/filter-panel/messages.d.ts +2 -2
- package/dist/forms/messages.d.ts +2 -2
- package/dist/inline-child-table/messages.d.ts +2 -2
- package/dist/invitations/messages.d.ts +2 -2
- package/dist/live/messages.d.ts +2 -2
- package/dist/locale/texts-gate.d.ts +21 -2
- package/dist/locale/texts-gate.js +33 -6
- package/dist/mentions/messages.d.ts +2 -2
- package/dist/mocks/orders.d.ts +2 -2
- package/dist/notifications/bell/messages.d.ts +2 -2
- package/dist/organizations/messages.d.ts +2 -2
- package/dist/package.js +1 -1
- package/dist/plugins/messages.d.ts +2 -2
- package/dist/record-view/messages.d.ts +2 -2
- package/dist/shell/assets/{account-page-dcJyxP-d.js → account-page-U7RldneI.js} +2 -2
- package/dist/shell/assets/{app-DTl8rg8j.js → app-94a88jzE.js} +11 -11
- package/dist/shell/assets/{assistant-shell-Bw1jJrLm.js → assistant-shell-BJWCAwCu.js} +2 -2
- package/dist/shell/assets/{board-display-DDFDZzOk.js → board-display-DSazq67h.js} +2 -2
- package/dist/shell/assets/{calendar-display-B0R6JkIL.js → calendar-display-CpqjM4oV.js} +2 -2
- package/dist/shell/assets/{call-rings-CzvSKlfI.js → call-rings-DnL8InVq.js} +2 -2
- package/dist/shell/assets/{calls-BgwbMyeR.js → calls-CTRygR5f.js} +2 -2
- package/dist/shell/assets/{circle-alert-CANqQIsU.js → circle-alert-B63XjMgn.js} +2 -2
- package/dist/shell/assets/{composed-page-gwTeW0b3.js → composed-page-BVm_6eWU.js} +2 -2
- package/dist/shell/assets/{composer-section-gsOgYgY2.js → composer-section-DETU2Obd.js} +2 -2
- package/dist/shell/assets/{connect-route-CtL1EJIN.js → connect-route-BILeY04q.js} +2 -2
- package/dist/shell/assets/{copy-field-CamvXHHQ.js → copy-field-CmFjZmVI.js} +2 -2
- package/dist/shell/assets/{create-route-Cx8yqS-H.js → create-route-BT69PwsI.js} +2 -2
- package/dist/shell/assets/{custom-step-container-field-0-Q_RuZy.js → custom-step-container-field-CZDuNAGK.js} +2 -2
- package/dist/shell/assets/{embedded-list-56J4XDiR.js → embedded-list-C9U2ypuX.js} +3 -3
- package/dist/shell/assets/{export-dialog-CEp2g6vx.js → export-dialog-DoaQ8h-M.js} +2 -2
- package/dist/shell/assets/{graph-view-CgjfBK_g.js → graph-view-COd5Mp2P.js} +2 -2
- package/dist/shell/assets/{group-donut-DGZUg_gn.js → group-donut-DUBQuhYa.js} +2 -2
- package/dist/shell/assets/{guest-call-page-BhTshbrl.js → guest-call-page-Bu41Ptk4.js} +3 -3
- package/dist/shell/assets/{html-viewer-GD1mwLEo.js → html-viewer-Bz3ots0-.js} +2 -2
- package/dist/shell/assets/{import-dialog-ByRCf2Cp.js → import-dialog-B0lJXEBq.js} +2 -2
- package/dist/shell/assets/{import-table-dialog-CiDY_0RT.js → import-table-dialog-CaZameXo.js} +2 -2
- package/dist/shell/assets/{index-PtDa8a1m.js → index-YZpQ8sMq.js} +1 -1
- package/dist/shell/assets/{invitations-page-Bh-RCnnl.js → invitations-page-DPzcVGHk.js} +2 -2
- package/dist/shell/assets/{layout-grid-DJrFC12w.js → layout-grid-hoLv1QVh.js} +2 -2
- package/dist/shell/assets/{legend-item-YdN_NHUz.js → legend-item-CU6Kt-GZ.js} +2 -2
- package/dist/shell/assets/{list-page-BU1MrXbN.js → list-page-C8Z3OhmV.js} +4 -4
- package/dist/shell/assets/{maplibre-BedvDUG2.js → maplibre-BOVzS79J.js} +2 -2
- package/dist/shell/assets/{markdown-content-BlKajH2l.js → markdown-content-BMDl_vl_.js} +2 -2
- package/dist/shell/assets/{members-page-BYUO0Dq2.js → members-page-O752tFj8.js} +2 -2
- package/dist/shell/assets/{messages-DQ0cj-Ao.js → messages-TLh-JbDm.js} +2 -2
- package/dist/shell/assets/{organization-page-BrC1nHC-.js → organization-page-DDwBkk8F.js} +2 -2
- package/dist/shell/assets/{organizations-page-CaUeWdr4.js → organizations-page-DNYezYgw.js} +2 -2
- package/dist/shell/assets/{pending-invitation-row-juUdWvG6.js → pending-invitation-row-DRjEfn76.js} +2 -2
- package/dist/shell/assets/{period-chart-BUZhUb5l.js → period-chart-B_Vtp_OD.js} +2 -2
- package/dist/shell/assets/{person-row-DH3JhMfz.js → person-row-ehgAozYT.js} +2 -2
- package/dist/shell/assets/{public-form-page-d3TamPPE.js → public-form-page-JM_r4BIq.js} +2 -2
- package/dist/shell/assets/{record-lines-NtlHP9Lz.js → record-lines-B8maPngL.js} +2 -2
- package/dist/shell/assets/{record-map-BDXoF9AS.js → record-map-BJI9HhZO.js} +2 -2
- package/dist/shell/assets/{record-opens-C1KgR6ff.js → record-opens-BP2LRuAM.js} +2 -2
- package/dist/shell/assets/{record-page-D88DdoET.js → record-page-DsLORKNo.js} +3 -3
- package/dist/shell/assets/{record-preview-BT9_Hdcn.js → record-preview-BDMeb9qp.js} +2 -2
- package/dist/shell/assets/{records-map-BjHcY5gU.js → records-map-D2IAAn9Z.js} +2 -2
- package/dist/shell/assets/{render-node-v6KfRocH.js → render-node-CAL7-6hf.js} +3 -3
- package/dist/shell/assets/{reorder-button-B3GeKMOJ.js → reorder-button-D9hO_nqd.js} +2 -2
- package/dist/shell/assets/{run-trace-view-Ddc0SELh.js → run-trace-view-CqCld741.js} +2 -2
- package/dist/shell/assets/{runner-install-field-CiD9Pw1j.js → runner-install-field-Cpd0yW2w.js} +2 -2
- package/dist/shell/assets/{runtime-update-CoXcnfxB.js → runtime-update-Cg98ENel.js} +2 -2
- package/dist/shell/assets/{shared-protobase-ui-CwLnXvxx.js → shared-protobase-ui-JVA65IEp.js} +1 -1
- package/dist/shell/assets/{sheet-source-DbJu1SrV.js → sheet-source-fKebPN-3.js} +2 -2
- package/dist/shell/assets/{sign-in-policy-page-B40iAeJa.js → sign-in-policy-page-DtxdycdZ.js} +2 -2
- package/dist/shell/assets/{start-block-queries-C_udrEM9.js → start-block-queries-DIJZ-fEE.js} +2 -2
- package/dist/shell/assets/{step-catalog-7obnZV6X.js → step-catalog-DefIkvlp.js} +2 -2
- package/dist/shell/assets/{step-panel-BM_xu6Yy.js → step-panel-DhFvGljv.js} +2 -2
- package/dist/shell/assets/{timeline-display-CdLfWAbQ.js → timeline-display-CsGry__i.js} +2 -2
- package/dist/shell/assets/{trash-BHo3HvFy.js → trash-B3Zy6Kx1.js} +2 -2
- package/dist/shell/assets/{update-set-DTikSoau.js → update-set-C_skfvwV.js} +2 -2
- package/dist/shell/assets/{use-calendar-move-Bhha2yOp.js → use-calendar-move-CZtjDwpL.js} +2 -2
- package/dist/shell/assets/{use-display-rows-CS_0O_UE.js → use-display-rows-DHVZ49lA.js} +2 -2
- package/dist/shell/assets/{use-paged-search-ChxCRCpF.js → use-paged-search-COK4rUdF.js} +2 -2
- package/dist/shell/assets/{use-run-trace-BfRRgSgG.js → use-run-trace-CRPYmppF.js} +2 -2
- package/dist/shell/assets/{use-workflow-page-CTdBd8_8.js → use-workflow-page-NQnBpQBn.js} +2 -2
- package/dist/shell/assets/{use-workflow-types-cZQ59ATf.js → use-workflow-types-BONTV-ip.js} +2 -2
- package/dist/shell/assets/{workflow-canvas-B0kWJeH0.js → workflow-canvas-wK7am90B.js} +2 -2
- package/dist/shell/assets/{workflow-field-DXIk6V2Y.js → workflow-field-D4NB5B1z.js} +3 -3
- package/dist/shell/assets/{workflow-graph-editor-Cem4aY2u.js → workflow-graph-editor-CBPqhazd.js} +2 -2
- package/dist/shell/assets/{workflow-run-field-BeMn3eOH.js → workflow-run-field-C1N-mmHl.js} +3 -3
- package/dist/shell/assets/{workflow-status-field-0wvGDiva.js → workflow-status-field-DEgDvkpV.js} +2 -2
- package/dist/shell/assets/{workflow-workbench-qT5c0xnH.js → workflow-workbench-mJR1exSe.js} +2 -2
- package/dist/shell/index.html +3 -3
- package/dist/shell/protobase.shell.json +3 -3
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/{account-page-dcJyxP-d.js.map → account-page-U7RldneI.js.map} +1 -1
- package/dist/shell-source-maps/assets/app-94a88jzE.js.map +1 -0
- package/dist/shell-source-maps/assets/{assistant-shell-Bw1jJrLm.js.map → assistant-shell-BJWCAwCu.js.map} +1 -1
- package/dist/shell-source-maps/assets/{board-display-DDFDZzOk.js.map → board-display-DSazq67h.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calendar-display-B0R6JkIL.js.map → calendar-display-CpqjM4oV.js.map} +1 -1
- package/dist/shell-source-maps/assets/{call-rings-CzvSKlfI.js.map → call-rings-DnL8InVq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{calls-BgwbMyeR.js.map → calls-CTRygR5f.js.map} +1 -1
- package/dist/shell-source-maps/assets/{circle-alert-CANqQIsU.js.map → circle-alert-B63XjMgn.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composed-page-gwTeW0b3.js.map → composed-page-BVm_6eWU.js.map} +1 -1
- package/dist/shell-source-maps/assets/{composer-section-gsOgYgY2.js.map → composer-section-DETU2Obd.js.map} +1 -1
- package/dist/shell-source-maps/assets/{connect-route-CtL1EJIN.js.map → connect-route-BILeY04q.js.map} +1 -1
- package/dist/shell-source-maps/assets/{copy-field-CamvXHHQ.js.map → copy-field-CmFjZmVI.js.map} +1 -1
- package/dist/shell-source-maps/assets/{create-route-Cx8yqS-H.js.map → create-route-BT69PwsI.js.map} +1 -1
- package/dist/shell-source-maps/assets/{custom-step-container-field-0-Q_RuZy.js.map → custom-step-container-field-CZDuNAGK.js.map} +1 -1
- package/dist/shell-source-maps/assets/{embedded-list-56J4XDiR.js.map → embedded-list-C9U2ypuX.js.map} +1 -1
- package/dist/shell-source-maps/assets/{export-dialog-CEp2g6vx.js.map → export-dialog-DoaQ8h-M.js.map} +1 -1
- package/dist/shell-source-maps/assets/{graph-view-CgjfBK_g.js.map → graph-view-COd5Mp2P.js.map} +1 -1
- package/dist/shell-source-maps/assets/{group-donut-DGZUg_gn.js.map → group-donut-DUBQuhYa.js.map} +1 -1
- package/dist/shell-source-maps/assets/{guest-call-page-BhTshbrl.js.map → guest-call-page-Bu41Ptk4.js.map} +1 -1
- package/dist/shell-source-maps/assets/{html-viewer-GD1mwLEo.js.map → html-viewer-Bz3ots0-.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-dialog-ByRCf2Cp.js.map → import-dialog-B0lJXEBq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{import-table-dialog-CiDY_0RT.js.map → import-table-dialog-CaZameXo.js.map} +1 -1
- package/dist/shell-source-maps/assets/{invitations-page-Bh-RCnnl.js.map → invitations-page-DPzcVGHk.js.map} +1 -1
- package/dist/shell-source-maps/assets/{layout-grid-DJrFC12w.js.map → layout-grid-hoLv1QVh.js.map} +1 -1
- package/dist/shell-source-maps/assets/{legend-item-YdN_NHUz.js.map → legend-item-CU6Kt-GZ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{list-page-BU1MrXbN.js.map → list-page-C8Z3OhmV.js.map} +1 -1
- package/dist/shell-source-maps/assets/{maplibre-BedvDUG2.js.map → maplibre-BOVzS79J.js.map} +1 -1
- package/dist/shell-source-maps/assets/{markdown-content-BlKajH2l.js.map → markdown-content-BMDl_vl_.js.map} +1 -1
- package/dist/shell-source-maps/assets/{members-page-BYUO0Dq2.js.map → members-page-O752tFj8.js.map} +1 -1
- package/dist/shell-source-maps/assets/{messages-DQ0cj-Ao.js.map → messages-TLh-JbDm.js.map} +1 -1
- package/dist/shell-source-maps/assets/{organization-page-BrC1nHC-.js.map → organization-page-DDwBkk8F.js.map} +1 -1
- package/dist/shell-source-maps/assets/{organizations-page-CaUeWdr4.js.map → organizations-page-DNYezYgw.js.map} +1 -1
- package/dist/shell-source-maps/assets/{pending-invitation-row-juUdWvG6.js.map → pending-invitation-row-DRjEfn76.js.map} +1 -1
- package/dist/shell-source-maps/assets/{period-chart-BUZhUb5l.js.map → period-chart-B_Vtp_OD.js.map} +1 -1
- package/dist/shell-source-maps/assets/{person-row-DH3JhMfz.js.map → person-row-ehgAozYT.js.map} +1 -1
- package/dist/shell-source-maps/assets/{public-form-page-d3TamPPE.js.map → public-form-page-JM_r4BIq.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-lines-NtlHP9Lz.js.map → record-lines-B8maPngL.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-map-BDXoF9AS.js.map → record-map-BJI9HhZO.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-opens-C1KgR6ff.js.map → record-opens-BP2LRuAM.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-page-D88DdoET.js.map → record-page-DsLORKNo.js.map} +1 -1
- package/dist/shell-source-maps/assets/{record-preview-BT9_Hdcn.js.map → record-preview-BDMeb9qp.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-BjHcY5gU.js.map → records-map-D2IAAn9Z.js.map} +1 -1
- package/dist/shell-source-maps/assets/{render-node-v6KfRocH.js.map → render-node-CAL7-6hf.js.map} +1 -1
- package/dist/shell-source-maps/assets/{reorder-button-B3GeKMOJ.js.map → reorder-button-D9hO_nqd.js.map} +1 -1
- package/dist/shell-source-maps/assets/{run-trace-view-Ddc0SELh.js.map → run-trace-view-CqCld741.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runner-install-field-CiD9Pw1j.js.map → runner-install-field-Cpd0yW2w.js.map} +1 -1
- package/dist/shell-source-maps/assets/{runtime-update-CoXcnfxB.js.map → runtime-update-Cg98ENel.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sheet-source-DbJu1SrV.js.map → sheet-source-fKebPN-3.js.map} +1 -1
- package/dist/shell-source-maps/assets/{sign-in-policy-page-B40iAeJa.js.map → sign-in-policy-page-DtxdycdZ.js.map} +1 -1
- package/dist/shell-source-maps/assets/{start-block-queries-C_udrEM9.js.map → start-block-queries-DIJZ-fEE.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-catalog-7obnZV6X.js.map → step-catalog-DefIkvlp.js.map} +1 -1
- package/dist/shell-source-maps/assets/{step-panel-BM_xu6Yy.js.map → step-panel-DhFvGljv.js.map} +1 -1
- package/dist/shell-source-maps/assets/{timeline-display-CdLfWAbQ.js.map → timeline-display-CsGry__i.js.map} +1 -1
- package/dist/shell-source-maps/assets/{trash-BHo3HvFy.js.map → trash-B3Zy6Kx1.js.map} +1 -1
- package/dist/shell-source-maps/assets/{update-set-DTikSoau.js.map → update-set-C_skfvwV.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-calendar-move-Bhha2yOp.js.map → use-calendar-move-CZtjDwpL.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-display-rows-CS_0O_UE.js.map → use-display-rows-DHVZ49lA.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-paged-search-ChxCRCpF.js.map → use-paged-search-COK4rUdF.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-run-trace-BfRRgSgG.js.map → use-run-trace-CRPYmppF.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-page-CTdBd8_8.js.map → use-workflow-page-NQnBpQBn.js.map} +1 -1
- package/dist/shell-source-maps/assets/{use-workflow-types-cZQ59ATf.js.map → use-workflow-types-BONTV-ip.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-canvas-B0kWJeH0.js.map → workflow-canvas-wK7am90B.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-field-DXIk6V2Y.js.map → workflow-field-D4NB5B1z.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-graph-editor-Cem4aY2u.js.map → workflow-graph-editor-CBPqhazd.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-run-field-BeMn3eOH.js.map → workflow-run-field-C1N-mmHl.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-status-field-0wvGDiva.js.map → workflow-status-field-DEgDvkpV.js.map} +1 -1
- package/dist/shell-source-maps/assets/{workflow-workbench-qT5c0xnH.js.map → workflow-workbench-mJR1exSe.js.map} +1 -1
- package/dist/status/messages.d.ts +2 -2
- package/dist/users/messages.d.ts +2 -2
- package/package.json +5 -5
- package/dist/shell-source-maps/assets/app-DTl8rg8j.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-table-dialog-CiDY_0RT.js","names":["_Fragment","useMemo","useState","useRef","_Fragment","n","a","t","__toESM","require_react","require_jsx_runtime","AppLink","ResponsiveDialog","useAppAddress","buttonClass","Field","Button","Input","useResourceClients","ErrorBanner","TriangleAlert","keys","useQueryClient","ImportFileStep","ImportChecking","runImport","ImportSummary","createLookups","ImportSelect","fieldLabel","ImportProgressStep","workerSheetSource","proposeTable","isEmptyCell","text","userTableNameIssue","includedFields","fieldsResource","cellText","changeField","columnName","createTableOps","isEmptyFileCell","cell","wholePattern","decimalPattern","datePattern","timePattern","isCalendarDate","match","year","month","day","at","textKind","time","cellKind","plainNumber","maxPrecision","int4","kindTypes","columnTypeReader","kinds","wholeDigits","scale","pastInteger","longest","add","kind","whole","fraction","value","decimal","precision","only","widerFieldTypes","type","fieldTexts","tables","views","tablesResource","fields","name","issueText","issue","maxBytes","labelProblem","proposalProblems","tableIssue","proposal","maxTableBytes","problems","taken","included","seen","field","label","hasProblems","import_jsx_runtime","leaveOut","FieldRow","texts","types","column","examples","onChange","event","none","TableSection","titles","plural","singular","title","TableFieldsStep","flow","read","row","example","edit","import_react","sampleRows","readColumns","headers","readers","sample","rows","chunk","source","sheet","signal","reader","onProgress","emptyProgress","asTyped","useTableImportFlow","clientFor","queryClient","organizations","resources","step","setStep","error","setError","file","setFile","setSheet","setRead","setProposal","table","setTable","cancelled","reading","fail","cause","next","open","controller","columns","chosen","choose","sourceFor","sheets","openSheet","change","current","changeTable","servedTable","meta","model","importRows","context","plan","latest","result","progress","stopped","go","made","results","errorTitle","ImportTableDialog","busy","close","onClose","cancelButton"],"sources":["../../../../schema/src/user-tables/cell-kind.ts","../../../../schema/src/user-tables/column-type.ts","../../../src/app/import/new-table/field-texts.ts","../../../src/app/import/new-table/proposal-problems.ts","../../../src/app/import/new-table/field-row.tsx","../../../src/app/import/new-table/table-section.tsx","../../../src/app/import/new-table/table-fields-step.tsx","../../../src/app/import/new-table/read-columns.ts","../../../src/app/import/new-table/use-table-import-flow.ts","../../../src/app/import/new-table/import-table-dialog.tsx"],"sourcesContent":["/**\n * A cell of a file as a table is made from it: text (every CSV cell), a number, a boolean, a date or time a workbook\n * stores as one (`{ date: '2026-03-01' }` or `{ date: '2026-03-01T14:30:00' }`, without a zone), a JSON file's nested\n * object or array (`{ json }`), or `null` for an empty cell.\n */\nexport type FileCell = string | number | boolean | FileDate | FileJson | null\n\n/** A date or time a workbook stores as one. */\nexport type FileDate = {\n /** `2026-03-01`, or `2026-03-01T14:30:00` with its time and no zone. */\n date: string\n}\n\n/** A JSON file's nested object or array. */\nexport type FileJson = {\n /** The value as the file states it. */\n json: unknown\n}\n\n/** Whether the cell holds nothing: no value, or only spaces. */\nexport const isEmptyFileCell = (cell: FileCell) => cell === null || (typeof cell === 'string' && cell.trim() === '')\n\n/**\n * What one cell says it is. Only forms that read one way are anything but text: a whole number without leading zeros\n * or a plus sign (so `007` and `+31` stay text), a decimal with a point, true or false, an ISO date, an ISO date and\n * time with its zone (`zoned`) or without (`local`), or a nested JSON value. A comma decimal, a thousands separator or\n * `03/04/2026` could be read two ways, so they are text.\n */\nexport type CellKind = 'text' | 'whole' | 'decimal' | 'boolean' | 'date' | 'local' | 'zoned' | 'json'\n\nconst wholePattern = /^-?(0|[1-9]\\d*)$/\nconst decimalPattern = /^-?(0|[1-9]\\d*)\\.\\d+$/\nconst datePattern = /^(\\d{4})-(\\d{2})-(\\d{2})$/\nconst timePattern = /^(\\d{4}-\\d{2}-\\d{2})[T ](\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.\\d{1,6})?)?(Z|[+-]\\d{2}:\\d{2})?$/\n\nconst isCalendarDate = (text: string) => {\n const match = datePattern.exec(text)\n if (!match) return false\n const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])]\n const at = new Date(Date.UTC(year, month - 1, day))\n return at.getUTCFullYear() === year && at.getUTCMonth() === month - 1 && at.getUTCDate() === day\n}\n\nconst textKind = (text: string): CellKind => {\n if (wholePattern.test(text)) return 'whole'\n if (decimalPattern.test(text)) return 'decimal'\n if (/^(true|false)$/i.test(text)) return 'boolean'\n if (isCalendarDate(text)) return 'date'\n const time = timePattern.exec(text)\n if (!time?.[1] || !isCalendarDate(time[1])) return 'text'\n if (Number(time[2]) > 23 || Number(time[3]) > 59 || Number(time[4] ?? 0) > 59) return 'text'\n return time[5] ? 'zoned' : 'local'\n}\n\n/** What a cell that is not empty says it is. */\nexport const cellKind = (cell: Exclude<FileCell, null>): CellKind => {\n if (typeof cell === 'boolean') return 'boolean'\n if (typeof cell === 'number') return Number.isInteger(cell) ? 'whole' : 'decimal'\n if (typeof cell === 'string') return textKind(cell.trim())\n if ('json' in cell) return 'json'\n return cell.date.includes('T') ? 'local' : 'date'\n}\n\n/** A number cell, or the text of a whole or decimal one, as plain digits with a point: `1e21` as `1000000000000000000000`. */\nexport const plainNumber = (cell: string | number) =>\n typeof cell === 'number' ? cell.toLocaleString('en-US', { useGrouping: false, maximumFractionDigits: 100 }) : cell.trim()\n","import { cellKind, isEmptyFileCell, plainNumber, type CellKind, type FileCell } from './cell-kind'\nimport type { UserTableFieldType } from './names'\n\n/** The type a column of a file becomes, with a decimal's precision and scale. */\nexport type ColumnType = {\n /** The field type of a table users add. */\n type: UserTableFieldType\n /** A decimal's digits in all. */\n precision?: number\n /** A decimal's digits after the point. */\n scale?: number\n}\n\n/** A decimal number's type, which always has its precision and scale. */\nexport type DecimalType = ColumnType & {\n /** Its digits in all, from 1 to 1000. */\n precision: number\n /** Its digits after the point, at most the precision. */\n scale: number\n}\n\n/** Reads a column's cells one at a time; see `columnTypeReader`. */\nexport type ColumnTypeReader = {\n /** Reads one more cell of the column. */\n add: (cell: FileCell) => void\n /** The type every cell read so far is written as. */\n type: () => ColumnType\n /** The decimal number that holds every number read so far, for a column of numbers or one changed to a decimal. */\n decimal: () => DecimalType\n}\n\n/** The most characters a `text` field holds; a column with a longer value is `long_text`. */\nexport const maxShortText = 500\n\n/** The digits a decimal keeps before its point at least: 15, as many as a spreadsheet keeps of a number. */\nexport const minWholeDigits = 15\n\nconst maxPrecision = 1000\nconst int4 = 2147483647n\n\nconst kindTypes: Record<Exclude<CellKind, 'whole' | 'decimal' | 'text'>, UserTableFieldType> = {\n boolean: 'boolean',\n date: 'date',\n local: 'timestamp',\n zoned: 'timestamp',\n json: 'json',\n}\n\n/**\n * Reads a column's cells one at a time and keeps only what its type needs, so a file of any length is read in the\n * memory of one row: `add` each cell, then `type()` is one type every non-empty cell is written as, else text, and\n * nothing else.\n *\n * - Whole numbers are `integer`, or a decimal of scale 0 once one is past the integer range.\n * - Whole numbers with decimals are a `decimal` whose scale is the most digits after the point, with room for at least\n * `minWholeDigits` before it.\n * - True or false is `boolean`, ISO dates `date`, ISO dates and times `timestamp`: a time without a zone is read in\n * the browser's time zone, as Import reads one.\n * - A column with a nested JSON value is `json`, which holds its other values as they are.\n * - A column of mixed forms, or of no values, is text: `long_text` once a value is over `maxShortText` characters.\n */\nexport const columnTypeReader = (): ColumnTypeReader => {\n const kinds = new Set<CellKind>()\n let wholeDigits = 1\n let scale = 0\n let pastInteger = false\n let longest = 0\n\n const add = (cell: FileCell) => {\n if (cell === null || isEmptyFileCell(cell)) return\n if (typeof cell === 'string') longest = Math.max(longest, cell.length)\n const kind = cellKind(cell)\n kinds.add(kind)\n if (kind !== 'whole' && kind !== 'decimal') return\n const [whole = '', fraction = ''] = plainNumber(cell as string | number).replace('-', '').split('.')\n wholeDigits = Math.max(wholeDigits, whole.length)\n scale = Math.max(scale, fraction.length)\n if (kind === 'whole' && !pastInteger) {\n const value = BigInt(plainNumber(cell as string | number))\n pastInteger = (value < 0n ? -value - 1n : value) > int4\n }\n }\n\n const decimal = (): DecimalType => {\n const precision = Math.min(maxPrecision, Math.max(wholeDigits, minWholeDigits) + scale)\n return { type: 'decimal', precision, scale: Math.min(scale, precision) }\n }\n\n const type = (): ColumnType => {\n if (kinds.has('json')) return { type: 'json' }\n const only = kinds.size === 1 ? [...kinds][0] : undefined\n if (only === 'whole') return pastInteger ? decimal() : { type: 'integer' }\n if (kinds.size === 2 && kinds.has('whole') && kinds.has('decimal')) return decimal()\n if (only === 'decimal') return decimal()\n if (only && only !== 'text') return { type: kindTypes[only] }\n return { type: longest > maxShortText ? 'long_text' : 'text' }\n }\n\n return { add, type, decimal }\n}\n\n/** The type of a column from all its cells at once; see `columnTypeReader`. */\nexport const inferColumnType = (cells: Iterable<FileCell>) => {\n const reader = columnTypeReader()\n for (const cell of cells) reader.add(cell)\n return reader.type()\n}\n\n/**\n * The types a column of `type` may be changed to, itself first: only less specific ones, which take every value it\n * holds as the file wrote it. A long text and a JSON column keep their type.\n */\nexport const widerFieldTypes = (type: UserTableFieldType): UserTableFieldType[] => {\n switch (type) {\n case 'integer':\n return ['integer', 'decimal', 'text', 'long_text']\n case 'decimal':\n case 'boolean':\n case 'date':\n case 'timestamp':\n return [type, 'text', 'long_text']\n case 'text':\n return ['text', 'long_text']\n case 'long_text':\n case 'json':\n return [type]\n }\n}\n","import type { UserTableFieldType, ViewModel } from '@protobase/schema'\nimport { fieldLabel } from '../mapping'\nimport { fieldsResource } from './create-table-ops'\n\n/**\n * The texts the fields step shares with the forms tables and fields are made in: the labels and help of the tables'\n * and fields' views, and each type's name in words, such as Whole number, all in the app's language.\n */\nexport const fieldTexts = (views: Record<string, ViewModel>, tablesResource: string) => {\n const tables = views[tablesResource]\n const fields = views[fieldsResource]\n return {\n table: (name: string) => ({ label: fieldLabel(tables, name), help: tables?.fields[name]?.help }),\n field: (name: string) => ({ label: fieldLabel(fields, name), help: fields?.fields[name]?.help }),\n type: (type: UserTableFieldType) => fields?.fields.type?.valueLabels?.[type] ?? type,\n }\n}\n\nexport type FieldTexts = ReturnType<typeof fieldTexts>\n","import { userTableNameIssue, type UserTableNameIssue } from '@protobase/schema'\nimport { maxLabelLength } from '@protobase/schema/internal'\nimport { text } from '../messages'\nimport { includedFields, type TableProposal } from './table-proposal'\n\n/** What keeps a proposal from being made, by where it shows: the table's name and labels, and each column's field. */\nexport type ProposalProblems = {\n name?: string\n pluralLabel?: string\n singularLabel?: string\n /** No column is left to become a field. */\n noFields?: string\n fields: Record<number, { name?: string; label?: string }>\n}\n\nconst issueText = (issue: UserTableNameIssue, name: string, maxBytes: number) => {\n if (issue === 'form') return text('nameForm', { max: maxBytes })\n if (issue === 'reserved_word') return text('nameReservedWord', { name })\n return text('nameReservedField', { name })\n}\n\n// A label is needed, and fits\nconst labelProblem = (value: string) => {\n if (value.trim() === '') return text('needed')\n if (value.trim().length > maxLabelLength) return text('labelTooLong', { max: maxLabelLength })\n return\n}\n\n/**\n * The problems the server would refuse a proposal for that the page can tell: names outside the rules, a table name a\n * resource in `taken` has, two fields of one name, an empty or too long label, or no field at all. The server checks it all again.\n */\nexport const proposalProblems = (proposal: TableProposal, taken: ReadonlySet<string>, maxTableBytes: number): ProposalProblems => {\n const tableIssue = userTableNameIssue(proposal.name, 'table', maxTableBytes)\n const problems: ProposalProblems = {\n name: tableIssue ? issueText(tableIssue, proposal.name, maxTableBytes) : taken.has(proposal.name) ? text('nameTaken', { name: proposal.name }) : undefined,\n pluralLabel: labelProblem(proposal.pluralLabel),\n singularLabel: labelProblem(proposal.singularLabel),\n fields: {},\n }\n const included = includedFields(proposal)\n if (included.length === 0) problems.noFields = text('noFields')\n const seen = new Set<string>()\n for (const field of included) {\n const issue = userTableNameIssue(field.name, 'field')\n const name = issue ? issueText(issue, field.name, 63) : seen.has(field.name) ? text('nameTwice', { name: field.name }) : undefined\n seen.add(field.name)\n const label = labelProblem(field.label)\n if (name || label) problems.fields[field.column] = { ...(name && { name }), ...(label && { label }) }\n }\n return problems\n}\n\n/** Whether a proposal has none of the problems the page can tell. */\nexport const hasProblems = (problems: ProposalProblems) =>\n Boolean(problems.name || problems.pluralLabel || problems.singularLabel || problems.noFields || Object.keys(problems.fields).length > 0)\n","import { widerFieldTypes, type UserTableFieldType } from '@protobase/schema'\nimport { Field } from '../../../record-view/field'\nimport { Input } from '../../../primitives/input'\nimport { ImportSelect } from '../import-select'\nimport { text } from '../messages'\nimport type { FieldTexts } from './field-texts'\nimport type { ProposedField } from './table-proposal'\n\ntype FieldRowProps = {\n field: ProposedField\n /** The column's header, or its letters. */\n column: string\n /** Up to three values of its first rows. */\n examples: string[]\n problems?: { name?: string; label?: string }\n texts: FieldTexts\n onChange: (edit: Partial<Pick<ProposedField, 'include' | 'name' | 'label' | 'type'>>) => void\n}\n\nconst leaveOut = ''\n\n/**\n * A column of the file and the field it becomes: its type, only ever the one its cells say or a less specific one, or\n * left out, and its label and name.\n */\nexport const FieldRow = ({ field, column, examples, problems, texts, onChange }: FieldRowProps) => {\n const type = texts.field('type')\n const label = texts.field('label')\n const name = texts.field('name')\n const types = widerFieldTypes(field.inferred.type).map((value) => ({ value, label: texts.type(value) }))\n const decimal = field.include && field.type === 'decimal'\n return (\n <div className=\"grid grid-cols-1 gap-2 py-3 sm:grid-cols-2 sm:gap-4\">\n <div className=\"min-w-0\">\n <p className=\"truncate font-medium\">{column}</p>\n <p className=\"truncate text-xs text-muted-foreground\">{examples.length > 0 ? examples.join(', ') : text('emptyInFirstRows')}</p>\n </div>\n <div className=\"flex min-w-0 flex-col gap-2\">\n <ImportSelect\n label={type.label}\n name={text('typeFor', { name: column })}\n value={field.include ? field.type : leaveOut}\n options={[...types, { value: leaveOut, label: text('doNotImport') }]}\n onChange={(value) => onChange(value === leaveOut ? { include: false } : { include: true, type: value as UserTableFieldType })}\n help={decimal ? text('decimalSize', { precision: field.decimal.precision, scale: field.decimal.scale }) : undefined}\n />\n {field.include && (\n <>\n <Field label={label.label} error={problems?.label} required>\n <Input wrapperClassName=\"max-sm:min-h-11\" aria-label={text('labelFor', { name: column })} value={field.label} onChange={(event) => onChange({ label: event.target.value })} />\n </Field>\n <Field label={name.label} error={problems?.name} required>\n <Input wrapperClassName=\"max-sm:min-h-11\" className=\"font-mono\" aria-label={text('nameFor', { name: column })} autoCapitalize=\"none\" autoCorrect=\"off\" spellCheck={false} value={field.name} onChange={(event) => onChange({ name: event.target.value })} />\n </Field>\n </>\n )}\n </div>\n </div>\n )\n}\n","import { Field } from '../../../record-view/field'\nimport { Input } from '../../../primitives/input'\nimport { ImportSelect } from '../import-select'\nimport { text } from '../messages'\nimport type { FieldTexts } from './field-texts'\nimport type { ProposalProblems } from './proposal-problems'\nimport { includedFields, type TableProposal } from './table-proposal'\n\ntype TableSectionProps = {\n proposal: TableProposal\n problems: ProposalProblems\n texts: FieldTexts\n onChange: (edit: Partial<Pick<TableProposal, 'name' | 'pluralLabel' | 'singularLabel' | 'titleField'>>) => void\n}\n\nconst none = ''\n\n/** The new table's labels, name and title field, as the New table form asks for them. */\nexport const TableSection = ({ proposal, problems, texts, onChange }: TableSectionProps) => {\n const titles = includedFields(proposal).filter((field) => field.type === 'text')\n const plural = texts.table('plural_label')\n const singular = texts.table('singular_label')\n const name = texts.table('name')\n const title = texts.table('title_field')\n return (\n <section aria-label={text('newTable')} className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <Field label={plural.label} help={plural.help} error={problems.pluralLabel} required>\n <Input wrapperClassName=\"max-sm:min-h-11\" value={proposal.pluralLabel} onChange={(event) => onChange({ pluralLabel: event.target.value })} />\n </Field>\n <Field label={singular.label} help={singular.help} error={problems.singularLabel} required>\n <Input wrapperClassName=\"max-sm:min-h-11\" value={proposal.singularLabel} onChange={(event) => onChange({ singularLabel: event.target.value })} />\n </Field>\n <Field label={name.label} help={name.help} error={problems.name} required>\n <Input wrapperClassName=\"max-sm:min-h-11\" className=\"font-mono\" autoCapitalize=\"none\" autoCorrect=\"off\" spellCheck={false} value={proposal.name} onChange={(event) => onChange({ name: event.target.value })} />\n </Field>\n <ImportSelect\n label={title.label}\n value={proposal.titleField ?? none}\n options={[{ value: none, label: text('noTitle') }, ...titles.map((field) => ({ value: field.name, label: field.label || field.name }))]}\n onChange={(value) => onChange({ titleField: value || undefined })}\n help={title.help}\n />\n </section>\n )\n}\n","import { TriangleAlert } from 'lucide-react'\nimport { cellText, columnName } from '../sheet-cell'\nimport { text } from '../messages'\nimport { FieldRow } from './field-row'\nimport type { FieldTexts } from './field-texts'\nimport type { ProposalProblems } from './proposal-problems'\nimport { TableSection } from './table-section'\nimport type { TableImportFlow } from './use-table-import-flow'\n\n/**\n * The table a file becomes, to review before it is made: its labels and name, then a field per column, typed only from\n * what the column's cells say, which the user may rename, relabel, make less specific or leave out.\n */\nexport const TableFieldsStep = ({ flow, problems, texts }: { flow: TableImportFlow; problems: ProposalProblems; texts: FieldTexts }) => {\n const { proposal, read } = flow\n if (!proposal || !read) return null\n return (\n <div className=\"flex flex-col gap-5\">\n <TableSection proposal={proposal} problems={problems} texts={texts} onChange={flow.changeTable} />\n <p className=\"-mb-3 text-xs text-muted-foreground\">{text('typesFromCells', { rows: read.rows })}</p>\n <section aria-label={text('columns')} className=\"flex flex-col divide-y divide-border border-y\">\n {proposal.fields.map((field) => (\n <FieldRow\n key={field.column}\n field={field}\n column={columnName(read.headers, field.column)}\n examples={read.sample.map((row) => cellText(row.cells[field.column] ?? null)).filter((example) => example !== '').slice(0, 3)}\n problems={problems.fields[field.column]}\n texts={texts}\n onChange={(edit) => flow.change(field.column, edit)}\n />\n ))}\n </section>\n {problems.noFields && (\n <p role=\"alert\" className=\"flex gap-2 rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-warning-text\">\n <TriangleAlert className=\"mt-0.5 size-4 shrink-0\" />\n <span>{problems.noFields}</span>\n </p>\n )}\n </div>\n )\n}\n","import { columnTypeReader, type ColumnType, type DecimalType } from '@protobase/schema'\nimport { cellText, isEmptyCell, type SheetRow } from '../sheet-cell'\nimport type { SheetSource } from '../sheet-source'\n\n/** How many data rows the fields step shows under each column. */\nconst sampleRows = 5\n\n/** What reading a whole sheet found: its headers, each column's type and the decimal it would be, its first rows and how many rows it has. */\nexport type ReadColumns = { headers: string[]; types: ColumnType[]; decimals: DecimalType[]; sample: SheetRow[]; rows: number }\n\n/**\n * Reads every row of the sheet once, as it streams in, and keeps of each column only what its type needs (see\n * `columnTypeReader`), so a file's length never adds to the memory it takes; `onProgress` gets the rows read so far.\n */\nexport const readColumns = async (source: SheetSource, sheet: string | undefined, onProgress: (rows: number) => void, signal?: AbortSignal): Promise<ReadColumns> => {\n let headers: string[] | undefined\n let readers: ReturnType<typeof columnTypeReader>[] = []\n const sample: SheetRow[] = []\n let rows = 0\n for await (const chunk of source.rows(sheet)) {\n signal?.throwIfAborted()\n for (const row of chunk) {\n if (!headers) {\n headers = row.cells.map(cellText)\n readers = headers.map(() => columnTypeReader())\n continue\n }\n if (row.cells.every(isEmptyCell)) continue\n rows++\n if (sample.length < sampleRows) sample.push(row)\n readers.forEach((reader, column) => reader.add(row.cells[column] ?? null))\n }\n onProgress(rows)\n }\n return { headers: headers ?? [], types: readers.map((reader) => reader.type()), decimals: readers.map((reader) => reader.decimal()), sample, rows }\n}\n","import { useQueryClient } from '@tanstack/react-query'\nimport { useMemo, useRef, useState } from 'react'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { maxNameBytes, maxOrganizationNameBytes } from '@protobase/schema/internal'\nimport { useResourceClients } from '../../../data/api-provider'\nimport type { MetaData } from '../../../data/meta-data'\nimport { keys } from '../../../data/query-keys'\nimport { useAppAddress } from '../../use-app-address'\nimport { createLookups } from '../lookups'\nimport type { ImportPlan } from '../prepare-rows'\nimport { runImport, type ImportProgress } from '../run-import'\nimport { workerSheetSource, type SheetSource } from '../sheet-source'\nimport { createTableOps } from './create-table-ops'\nimport { readColumns, type ReadColumns } from './read-columns'\nimport { changeField, includedFields, proposeTable, type ProposedField, type TableProposal } from './table-proposal'\n\n/** Where making a table from a file is: choosing the file, reading it, reviewing its fields, making the table, writing its rows, or done. */\nexport type TableImportStep =\n | { kind: 'file'; reading: boolean }\n | { kind: 'reading'; rows: number }\n | { kind: 'fields' }\n | { kind: 'creating' }\n | { kind: 'importing'; progress: ImportProgress; total: number; cancelling: boolean }\n | { kind: 'done'; result: ImportProgress & { cancelled: boolean }; stopped?: unknown }\n\nexport type TableImportFlowOptions = {\n /** The resource of the tables users add, whose list offers this. */\n tables: ResourceModel\n resources: Record<string, ResourceModel>\n /** Reads the chosen file; a Web Worker by default. */\n sourceFor?: (file: File) => SheetSource\n}\n\nconst emptyProgress: ImportProgress = { created: 0, updated: 0, skipped: 0, failed: 0, notWritten: [] }\n\n// The rows are read as the cells say, which `readColumns` typed: numbers with a point, ISO dates, and true or false\n// kept as text where the column is text\nconst asTyped: ImportPlan['options'] = { decimal: '.', dateOrder: 'dmy', booleanText: true }\n\n/**\n * The state of making a table from a file: the file is read once to propose its fields, the table and its fields are\n * made in one batch write, and the rows are then written as Import writes them. With organizations a table's name is\n * shorter, and may be one a resource in code has.\n */\nexport const useTableImportFlow = ({ tables, resources, sourceFor = workerSheetSource }: TableImportFlowOptions) => {\n const clientFor = useResourceClients()\n const queryClient = useQueryClient()\n const { go } = useAppAddress()\n const organizations = tables.tenant !== undefined\n const maxTableBytes = organizations ? maxOrganizationNameBytes : maxNameBytes\n const taken = useMemo(() => new Set(organizations ? [] : Object.keys(resources)), [organizations, resources])\n const [step, setStep] = useState<TableImportStep>({ kind: 'file', reading: false })\n const [error, setError] = useState<unknown>()\n const [file, setFile] = useState<{ file: File; source: SheetSource; sheets: string[] }>()\n const [sheet, setSheet] = useState<string>()\n const [read, setRead] = useState<ReadColumns>()\n const [proposal, setProposal] = useState<TableProposal>()\n const [table, setTable] = useState<string>()\n const cancelled = useRef(false)\n const reading = useRef<AbortController | undefined>(undefined)\n\n const fail = (next: TableImportStep) => (cause: unknown) => {\n setError(cause)\n setStep(next)\n }\n\n // Reads the whole sheet and proposes a field for each of its columns\n const open = (chosen: File, source: SheetSource, name: string | undefined) => {\n const controller = new AbortController()\n reading.current = controller\n setStep({ kind: 'reading', rows: 0 })\n readColumns(source, name, (rows) => setStep({ kind: 'reading', rows }), controller.signal)\n .then((columns) => {\n if (controller.signal.aborted) return\n setRead(columns)\n setProposal(proposeTable(chosen.name, columns, taken, maxTableBytes))\n setStep({ kind: 'fields' })\n })\n .catch((cause: unknown) => {\n if (!controller.signal.aborted) fail({ kind: 'file', reading: false })(cause)\n })\n }\n\n /** Reads the chosen file's sheet names; a CSV, a JSON file, or a workbook of one sheet goes on to its columns. */\n const choose = (chosen: File) => {\n setError(undefined)\n setStep({ kind: 'file', reading: true })\n const source = sourceFor(chosen)\n void source\n .sheets()\n .then((sheets) => {\n setFile({ file: chosen, source, sheets })\n setSheet(sheets[0])\n if (sheets.length <= 1) return open(chosen, source, sheets[0])\n setStep({ kind: 'file', reading: false })\n })\n .catch(fail({ kind: 'file', reading: false }))\n }\n\n const openSheet = () => {\n if (!file) return\n setError(undefined)\n open(file.file, file.source, sheet)\n }\n\n const change = (column: number, edit: Partial<Pick<ProposedField, 'include' | 'name' | 'label' | 'type'>>) => setProposal((current) => current && changeField(current, column, edit))\n const changeTable = (edit: Partial<Pick<TableProposal, 'name' | 'pluralLabel' | 'singularLabel' | 'titleField'>>) => setProposal((current) => current && { ...current, ...edit })\n\n // The new table's model and view, from `/meta` read again: the server that made it serves it at once\n const servedTable = async (name: string) => {\n await queryClient.refetchQueries({ queryKey: keys.meta })\n const meta = queryClient.getQueryData<MetaData>(keys.meta)\n const model = meta?.resources[name]\n if (!meta || !model) throw new Error(`The server does not serve the new table ${name} yet`)\n return { model, resources: meta.resources, views: meta.views as Record<string, ViewModel> }\n }\n\n // Writes the rows into the new table as Import writes them, with progress and Cancel between batches\n const importRows = async (name: string, current: TableProposal) => {\n if (!file || !read) return\n const context = { ...(await servedTable(name)), lookups: createLookups(clientFor) }\n const plan: ImportPlan = { mode: 'create', columns: includedFields(current).map((field) => ({ column: field.column, field: field.name })), options: asTyped }\n cancelled.current = false\n let latest = emptyProgress\n setStep({ kind: 'importing', progress: emptyProgress, total: read.rows, cancelling: false })\n const result = await runImport(file.source, sheet, plan, context, {\n client: clientFor(name),\n onProgress: (progress) => {\n latest = progress\n setStep({ kind: 'importing', progress, total: read.rows, cancelling: cancelled.current })\n },\n cancelled: () => cancelled.current,\n }).catch((cause: unknown) => ({ ...latest, cancelled: false, stopped: cause }))\n const stopped = 'stopped' in result ? result.stopped : undefined\n // Every row written: the new table's list, as after making any record\n if (stopped === undefined && !result.cancelled && result.notWritten.length === 0) return go({ kind: 'list', resource: name })\n setStep({ kind: 'done', result, stopped })\n }\n\n /** Makes the table and its fields in one batch write, then writes the file's rows into it. */\n const create = () => {\n if (!proposal) return\n setError(undefined)\n setStep({ kind: 'creating' })\n clientFor(tables.name)\n .batchWrite(createTableOps(tables.name, proposal))\n .then(({ results }) => {\n const [made] = results\n const name = made?.op === 'create' ? String(made.record.table_name) : proposal.name\n setTable(name)\n // The table stays made when its rows cannot be written; the summary says why and links to it\n return importRows(name, proposal).catch((cause: unknown) => setStep({ kind: 'done', result: { ...emptyProgress, cancelled: false }, stopped: cause }))\n }, fail({ kind: 'fields' }))\n }\n\n const cancel = () => {\n cancelled.current = true\n setStep((current) => (current.kind === 'importing' ? { ...current, cancelling: true } : current))\n }\n\n /** Back from reading the file to choosing it. */\n const back = () => {\n reading.current?.abort()\n setError(undefined)\n setStep({ kind: 'file', reading: false })\n }\n\n /** Stops reading the file when the dialog closes. */\n const stop = () => reading.current?.abort()\n\n return { step, error, file: file?.file, sheets: file?.sheets ?? [], sheet, setSheet, read, proposal, table, taken, maxTableBytes, choose, openSheet, change, changeTable, create, cancel, back, stop }\n}\n\nexport type TableImportFlow = ReturnType<typeof useTableImportFlow>\n","import type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { Button, buttonClass } from '../../../primitives/button'\nimport { ResponsiveDialog } from '../../../primitives/responsive-dialog'\nimport { ErrorBanner } from '../../error-banner'\nimport { AppLink } from '../../use-app-address'\nimport { ImportChecking } from '../import-check-step'\nimport { ImportFileStep } from '../import-file-step'\nimport { ImportProgressStep, ImportSummary } from '../import-result-step'\nimport { text } from '../messages'\nimport type { SheetSource } from '../sheet-source'\nimport { fieldTexts } from './field-texts'\nimport { hasProblems, proposalProblems } from './proposal-problems'\nimport { TableFieldsStep } from './table-fields-step'\nimport { useTableImportFlow, type TableImportFlow } from './use-table-import-flow'\n\nexport type ImportTableDialogProps = {\n /** The resource of the tables users add. */\n tables: ResourceModel\n resources: Record<string, ResourceModel>\n views: Record<string, ViewModel>\n onClose: () => void\n /** Reads the chosen file; a Web Worker by default. */\n sourceFor?: (file: File) => SheetSource\n}\n\nconst errorTitle = (flow: TableImportFlow) => (flow.step.kind === 'fields' ? text('couldNotMakeTable') : text('couldNotReadFile'))\n\n/**\n * Makes a new table from an .xlsx, CSV or JSON file: choose the file (and its sheet), review the field each column\n * becomes, then the table and its fields are made in one request and the rows written as Import writes them, landing\n * on the new table's list, or on a summary with the rows not imported to download.\n */\nexport const ImportTableDialog = ({ tables, resources, views, onClose, sourceFor }: ImportTableDialogProps) => {\n const flow = useTableImportFlow({ tables, resources, sourceFor })\n const texts = fieldTexts(views, tables.name)\n const { step, proposal } = flow\n const problems = proposal ? proposalProblems(proposal, flow.taken, flow.maxTableBytes) : undefined\n const headers = flow.read?.headers ?? []\n const busy = step.kind === 'creating' || step.kind === 'importing'\n\n const close = () => {\n if (busy) return\n flow.stop()\n onClose()\n }\n const cancelButton = <Button onClick={close}>{text('cancel')}</Button>\n\n const actions = () => {\n switch (step.kind) {\n case 'file':\n return (\n <>\n {cancelButton}\n {flow.sheets.length > 1 && (\n <Button variant=\"primary\" loading={step.reading} onClick={flow.openSheet}>\n {text('next')}\n </Button>\n )}\n </>\n )\n case 'reading':\n return <Button onClick={flow.back}>{text('back')}</Button>\n case 'fields':\n case 'creating': {\n const rows = flow.read?.rows ?? 0\n return (\n <>\n {cancelButton}\n <Button variant=\"primary\" loading={step.kind === 'creating'} disabled={!problems || hasProblems(problems)} onClick={flow.create}>\n {text('makeTable', { rows })}\n </Button>\n </>\n )\n }\n case 'importing':\n return (\n <Button variant=\"danger\" disabled={step.cancelling} onClick={flow.cancel}>\n {text('cancelImport')}\n </Button>\n )\n case 'done':\n return (\n <>\n <Button onClick={onClose}>{text('done')}</Button>\n {flow.table && (\n <AppLink to={{ kind: 'list', resource: flow.table }} className={buttonClass({ variant: 'primary' })}>\n {text('openTable')}\n </AppLink>\n )}\n </>\n )\n }\n }\n\n const body = () => {\n switch (step.kind) {\n case 'file':\n return <ImportFileStep file={flow.file} sheets={flow.sheets} sheet={flow.sheet} reading={step.reading} onChoose={flow.choose} onSheet={flow.setSheet} />\n case 'reading':\n return <ImportChecking rows={step.rows} />\n case 'fields':\n case 'creating':\n return problems && <TableFieldsStep flow={flow} problems={problems} texts={texts} />\n case 'importing':\n return <ImportProgressStep progress={step.progress} total={step.total} cancelling={step.cancelling} />\n case 'done':\n return <ImportSummary result={step.result} stopped={step.stopped} headers={headers} fileName={flow.file?.name} />\n }\n }\n\n return (\n <ResponsiveDialog open wide title={text('tableFromFile')} description={flow.file && step.kind !== 'file' ? flow.file.name : undefined} onClose={close} actions={actions()}>\n <div className=\"flex flex-col gap-4\">\n {flow.error !== undefined && <ErrorBanner title={errorTitle(flow)} error={flow.error} />}\n {body()}\n </div>\n </ResponsiveDialog>\n )\n}\n"],"mappings":"46BAoBA,IAAa0C,EAAmB,GAAmBC,IAAS,MAAS,OAAOA,GAAS,UAAYA,EAAK,KAAK,IAAM,GAU3GC,EAAe,mBACfC,EAAiB,wBACjBC,EAAc,4BACdC,EAAc,0FAEdC,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AK,QAAS,SAAUzB,EAAK,OAAQ,QAASA,EAAK,QAAW,CAAA,EACzJ,IAAK,UACH,OAAO,EAAAhB,EAAA,IAAA,CAAC1E,EAAD,CAAgB,KAAMmH,EAAK,IAAO,CAAA,EAC3C,IAAK,SACL,IAAK,WACH,OAAOhD,IAAY,EAAAO,EAAA,IAAA,CAACe,GAAD,CAAuB,OAAgB,WAAiB,OAAQ,CAAA,EACrF,IAAK,YACH,OAAO,EAAAf,EAAA,IAAA,CAACpE,EAAD,CAAoB,SAAU6G,EAAK,SAAU,MAAOA,EAAK,MAAO,WAAYA,EAAK,UAAa,CAAA,EACvG,IAAK,OACH,OAAO,EAAAzC,EAAA,IAAA,CAACxE,EAAD,CAAe,OAAQiH,EAAK,OAAQ,QAASA,EAAK,QAAkB,UAAS,SAAUzB,EAAK,MAAM,IAAO,CAAA,CACpH,CACF,EAMO,CAAK,CACH,GACW,CAAA,CAEtB","debugId":"a20d8ff4-4530-4910-befc-dd3add330c24"}
|
|
1
|
+
{"version":3,"file":"import-table-dialog-CaZameXo.js","names":["_Fragment","useMemo","useState","useRef","_Fragment","n","a","t","__toESM","require_react","require_jsx_runtime","AppLink","ResponsiveDialog","useAppAddress","buttonClass","Field","Button","Input","useResourceClients","ErrorBanner","TriangleAlert","keys","useQueryClient","ImportFileStep","ImportChecking","runImport","ImportSummary","createLookups","ImportSelect","fieldLabel","ImportProgressStep","workerSheetSource","proposeTable","isEmptyCell","text","userTableNameIssue","includedFields","fieldsResource","cellText","changeField","columnName","createTableOps","isEmptyFileCell","cell","wholePattern","decimalPattern","datePattern","timePattern","isCalendarDate","match","year","month","day","at","textKind","time","cellKind","plainNumber","maxPrecision","int4","kindTypes","columnTypeReader","kinds","wholeDigits","scale","pastInteger","longest","add","kind","whole","fraction","value","decimal","precision","only","widerFieldTypes","type","fieldTexts","tables","views","tablesResource","fields","name","issueText","issue","maxBytes","labelProblem","proposalProblems","tableIssue","proposal","maxTableBytes","problems","taken","included","seen","field","label","hasProblems","import_jsx_runtime","leaveOut","FieldRow","texts","types","column","examples","onChange","event","none","TableSection","titles","plural","singular","title","TableFieldsStep","flow","read","row","example","edit","import_react","sampleRows","readColumns","headers","readers","sample","rows","chunk","source","sheet","signal","reader","onProgress","emptyProgress","asTyped","useTableImportFlow","clientFor","queryClient","organizations","resources","step","setStep","error","setError","file","setFile","setSheet","setRead","setProposal","table","setTable","cancelled","reading","fail","cause","next","open","controller","columns","chosen","choose","sourceFor","sheets","openSheet","change","current","changeTable","servedTable","meta","model","importRows","context","plan","latest","result","progress","stopped","go","made","results","errorTitle","ImportTableDialog","busy","close","onClose","cancelButton"],"sources":["../../../../schema/src/user-tables/cell-kind.ts","../../../../schema/src/user-tables/column-type.ts","../../../src/app/import/new-table/field-texts.ts","../../../src/app/import/new-table/proposal-problems.ts","../../../src/app/import/new-table/field-row.tsx","../../../src/app/import/new-table/table-section.tsx","../../../src/app/import/new-table/table-fields-step.tsx","../../../src/app/import/new-table/read-columns.ts","../../../src/app/import/new-table/use-table-import-flow.ts","../../../src/app/import/new-table/import-table-dialog.tsx"],"sourcesContent":["/**\n * A cell of a file as a table is made from it: text (every CSV cell), a number, a boolean, a date or time a workbook\n * stores as one (`{ date: '2026-03-01' }` or `{ date: '2026-03-01T14:30:00' }`, without a zone), a JSON file's nested\n * object or array (`{ json }`), or `null` for an empty cell.\n */\nexport type FileCell = string | number | boolean | FileDate | FileJson | null\n\n/** A date or time a workbook stores as one. */\nexport type FileDate = {\n /** `2026-03-01`, or `2026-03-01T14:30:00` with its time and no zone. */\n date: string\n}\n\n/** A JSON file's nested object or array. */\nexport type FileJson = {\n /** The value as the file states it. */\n json: unknown\n}\n\n/** Whether the cell holds nothing: no value, or only spaces. */\nexport const isEmptyFileCell = (cell: FileCell) => cell === null || (typeof cell === 'string' && cell.trim() === '')\n\n/**\n * What one cell says it is. Only forms that read one way are anything but text: a whole number without leading zeros\n * or a plus sign (so `007` and `+31` stay text), a decimal with a point, true or false, an ISO date, an ISO date and\n * time with its zone (`zoned`) or without (`local`), or a nested JSON value. A comma decimal, a thousands separator or\n * `03/04/2026` could be read two ways, so they are text.\n */\nexport type CellKind = 'text' | 'whole' | 'decimal' | 'boolean' | 'date' | 'local' | 'zoned' | 'json'\n\nconst wholePattern = /^-?(0|[1-9]\\d*)$/\nconst decimalPattern = /^-?(0|[1-9]\\d*)\\.\\d+$/\nconst datePattern = /^(\\d{4})-(\\d{2})-(\\d{2})$/\nconst timePattern = /^(\\d{4}-\\d{2}-\\d{2})[T ](\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.\\d{1,6})?)?(Z|[+-]\\d{2}:\\d{2})?$/\n\nconst isCalendarDate = (text: string) => {\n const match = datePattern.exec(text)\n if (!match) return false\n const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])]\n const at = new Date(Date.UTC(year, month - 1, day))\n return at.getUTCFullYear() === year && at.getUTCMonth() === month - 1 && at.getUTCDate() === day\n}\n\nconst textKind = (text: string): CellKind => {\n if (wholePattern.test(text)) return 'whole'\n if (decimalPattern.test(text)) return 'decimal'\n if (/^(true|false)$/i.test(text)) return 'boolean'\n if (isCalendarDate(text)) return 'date'\n const time = timePattern.exec(text)\n if (!time?.[1] || !isCalendarDate(time[1])) return 'text'\n if (Number(time[2]) > 23 || Number(time[3]) > 59 || Number(time[4] ?? 0) > 59) return 'text'\n return time[5] ? 'zoned' : 'local'\n}\n\n/** What a cell that is not empty says it is. */\nexport const cellKind = (cell: Exclude<FileCell, null>): CellKind => {\n if (typeof cell === 'boolean') return 'boolean'\n if (typeof cell === 'number') return Number.isInteger(cell) ? 'whole' : 'decimal'\n if (typeof cell === 'string') return textKind(cell.trim())\n if ('json' in cell) return 'json'\n return cell.date.includes('T') ? 'local' : 'date'\n}\n\n/** A number cell, or the text of a whole or decimal one, as plain digits with a point: `1e21` as `1000000000000000000000`. */\nexport const plainNumber = (cell: string | number) =>\n typeof cell === 'number' ? cell.toLocaleString('en-US', { useGrouping: false, maximumFractionDigits: 100 }) : cell.trim()\n","import { cellKind, isEmptyFileCell, plainNumber, type CellKind, type FileCell } from './cell-kind'\nimport type { UserTableFieldType } from './names'\n\n/** The type a column of a file becomes, with a decimal's precision and scale. */\nexport type ColumnType = {\n /** The field type of a table users add. */\n type: UserTableFieldType\n /** A decimal's digits in all. */\n precision?: number\n /** A decimal's digits after the point. */\n scale?: number\n}\n\n/** A decimal number's type, which always has its precision and scale. */\nexport type DecimalType = ColumnType & {\n /** Its digits in all, from 1 to 1000. */\n precision: number\n /** Its digits after the point, at most the precision. */\n scale: number\n}\n\n/** Reads a column's cells one at a time; see `columnTypeReader`. */\nexport type ColumnTypeReader = {\n /** Reads one more cell of the column. */\n add: (cell: FileCell) => void\n /** The type every cell read so far is written as. */\n type: () => ColumnType\n /** The decimal number that holds every number read so far, for a column of numbers or one changed to a decimal. */\n decimal: () => DecimalType\n}\n\n/** The most characters a `text` field holds; a column with a longer value is `long_text`. */\nexport const maxShortText = 500\n\n/** The digits a decimal keeps before its point at least: 15, as many as a spreadsheet keeps of a number. */\nexport const minWholeDigits = 15\n\nconst maxPrecision = 1000\nconst int4 = 2147483647n\n\nconst kindTypes: Record<Exclude<CellKind, 'whole' | 'decimal' | 'text'>, UserTableFieldType> = {\n boolean: 'boolean',\n date: 'date',\n local: 'timestamp',\n zoned: 'timestamp',\n json: 'json',\n}\n\n/**\n * Reads a column's cells one at a time and keeps only what its type needs, so a file of any length is read in the\n * memory of one row: `add` each cell, then `type()` is one type every non-empty cell is written as, else text, and\n * nothing else.\n *\n * - Whole numbers are `integer`, or a decimal of scale 0 once one is past the integer range.\n * - Whole numbers with decimals are a `decimal` whose scale is the most digits after the point, with room for at least\n * `minWholeDigits` before it.\n * - True or false is `boolean`, ISO dates `date`, ISO dates and times `timestamp`: a time without a zone is read in\n * the browser's time zone, as Import reads one.\n * - A column with a nested JSON value is `json`, which holds its other values as they are.\n * - A column of mixed forms, or of no values, is text: `long_text` once a value is over `maxShortText` characters.\n */\nexport const columnTypeReader = (): ColumnTypeReader => {\n const kinds = new Set<CellKind>()\n let wholeDigits = 1\n let scale = 0\n let pastInteger = false\n let longest = 0\n\n const add = (cell: FileCell) => {\n if (cell === null || isEmptyFileCell(cell)) return\n if (typeof cell === 'string') longest = Math.max(longest, cell.length)\n const kind = cellKind(cell)\n kinds.add(kind)\n if (kind !== 'whole' && kind !== 'decimal') return\n const [whole = '', fraction = ''] = plainNumber(cell as string | number).replace('-', '').split('.')\n wholeDigits = Math.max(wholeDigits, whole.length)\n scale = Math.max(scale, fraction.length)\n if (kind === 'whole' && !pastInteger) {\n const value = BigInt(plainNumber(cell as string | number))\n pastInteger = (value < 0n ? -value - 1n : value) > int4\n }\n }\n\n const decimal = (): DecimalType => {\n const precision = Math.min(maxPrecision, Math.max(wholeDigits, minWholeDigits) + scale)\n return { type: 'decimal', precision, scale: Math.min(scale, precision) }\n }\n\n const type = (): ColumnType => {\n if (kinds.has('json')) return { type: 'json' }\n const only = kinds.size === 1 ? [...kinds][0] : undefined\n if (only === 'whole') return pastInteger ? decimal() : { type: 'integer' }\n if (kinds.size === 2 && kinds.has('whole') && kinds.has('decimal')) return decimal()\n if (only === 'decimal') return decimal()\n if (only && only !== 'text') return { type: kindTypes[only] }\n return { type: longest > maxShortText ? 'long_text' : 'text' }\n }\n\n return { add, type, decimal }\n}\n\n/** The type of a column from all its cells at once; see `columnTypeReader`. */\nexport const inferColumnType = (cells: Iterable<FileCell>) => {\n const reader = columnTypeReader()\n for (const cell of cells) reader.add(cell)\n return reader.type()\n}\n\n/**\n * The types a column of `type` may be changed to, itself first: only less specific ones, which take every value it\n * holds as the file wrote it. A long text and a JSON column keep their type.\n */\nexport const widerFieldTypes = (type: UserTableFieldType): UserTableFieldType[] => {\n switch (type) {\n case 'integer':\n return ['integer', 'decimal', 'text', 'long_text']\n case 'decimal':\n case 'boolean':\n case 'date':\n case 'timestamp':\n return [type, 'text', 'long_text']\n case 'text':\n return ['text', 'long_text']\n case 'long_text':\n case 'json':\n return [type]\n }\n}\n","import type { UserTableFieldType, ViewModel } from '@protobase/schema'\nimport { fieldLabel } from '../mapping'\nimport { fieldsResource } from './create-table-ops'\n\n/**\n * The texts the fields step shares with the forms tables and fields are made in: the labels and help of the tables'\n * and fields' views, and each type's name in words, such as Whole number, all in the app's language.\n */\nexport const fieldTexts = (views: Record<string, ViewModel>, tablesResource: string) => {\n const tables = views[tablesResource]\n const fields = views[fieldsResource]\n return {\n table: (name: string) => ({ label: fieldLabel(tables, name), help: tables?.fields[name]?.help }),\n field: (name: string) => ({ label: fieldLabel(fields, name), help: fields?.fields[name]?.help }),\n type: (type: UserTableFieldType) => fields?.fields.type?.valueLabels?.[type] ?? type,\n }\n}\n\nexport type FieldTexts = ReturnType<typeof fieldTexts>\n","import { userTableNameIssue, type UserTableNameIssue } from '@protobase/schema'\nimport { maxLabelLength } from '@protobase/schema/internal'\nimport { text } from '../messages'\nimport { includedFields, type TableProposal } from './table-proposal'\n\n/** What keeps a proposal from being made, by where it shows: the table's name and labels, and each column's field. */\nexport type ProposalProblems = {\n name?: string\n pluralLabel?: string\n singularLabel?: string\n /** No column is left to become a field. */\n noFields?: string\n fields: Record<number, { name?: string; label?: string }>\n}\n\nconst issueText = (issue: UserTableNameIssue, name: string, maxBytes: number) => {\n if (issue === 'form') return text('nameForm', { max: maxBytes })\n if (issue === 'reserved_word') return text('nameReservedWord', { name })\n return text('nameReservedField', { name })\n}\n\n// A label is needed, and fits\nconst labelProblem = (value: string) => {\n if (value.trim() === '') return text('needed')\n if (value.trim().length > maxLabelLength) return text('labelTooLong', { max: maxLabelLength })\n return\n}\n\n/**\n * The problems the server would refuse a proposal for that the page can tell: names outside the rules, a table name a\n * resource in `taken` has, two fields of one name, an empty or too long label, or no field at all. The server checks it all again.\n */\nexport const proposalProblems = (proposal: TableProposal, taken: ReadonlySet<string>, maxTableBytes: number): ProposalProblems => {\n const tableIssue = userTableNameIssue(proposal.name, 'table', maxTableBytes)\n const problems: ProposalProblems = {\n name: tableIssue ? issueText(tableIssue, proposal.name, maxTableBytes) : taken.has(proposal.name) ? text('nameTaken', { name: proposal.name }) : undefined,\n pluralLabel: labelProblem(proposal.pluralLabel),\n singularLabel: labelProblem(proposal.singularLabel),\n fields: {},\n }\n const included = includedFields(proposal)\n if (included.length === 0) problems.noFields = text('noFields')\n const seen = new Set<string>()\n for (const field of included) {\n const issue = userTableNameIssue(field.name, 'field')\n const name = issue ? issueText(issue, field.name, 63) : seen.has(field.name) ? text('nameTwice', { name: field.name }) : undefined\n seen.add(field.name)\n const label = labelProblem(field.label)\n if (name || label) problems.fields[field.column] = { ...(name && { name }), ...(label && { label }) }\n }\n return problems\n}\n\n/** Whether a proposal has none of the problems the page can tell. */\nexport const hasProblems = (problems: ProposalProblems) =>\n Boolean(problems.name || problems.pluralLabel || problems.singularLabel || problems.noFields || Object.keys(problems.fields).length > 0)\n","import { widerFieldTypes, type UserTableFieldType } from '@protobase/schema'\nimport { Field } from '../../../record-view/field'\nimport { Input } from '../../../primitives/input'\nimport { ImportSelect } from '../import-select'\nimport { text } from '../messages'\nimport type { FieldTexts } from './field-texts'\nimport type { ProposedField } from './table-proposal'\n\ntype FieldRowProps = {\n field: ProposedField\n /** The column's header, or its letters. */\n column: string\n /** Up to three values of its first rows. */\n examples: string[]\n problems?: { name?: string; label?: string }\n texts: FieldTexts\n onChange: (edit: Partial<Pick<ProposedField, 'include' | 'name' | 'label' | 'type'>>) => void\n}\n\nconst leaveOut = ''\n\n/**\n * A column of the file and the field it becomes: its type, only ever the one its cells say or a less specific one, or\n * left out, and its label and name.\n */\nexport const FieldRow = ({ field, column, examples, problems, texts, onChange }: FieldRowProps) => {\n const type = texts.field('type')\n const label = texts.field('label')\n const name = texts.field('name')\n const types = widerFieldTypes(field.inferred.type).map((value) => ({ value, label: texts.type(value) }))\n const decimal = field.include && field.type === 'decimal'\n return (\n <div className=\"grid grid-cols-1 gap-2 py-3 sm:grid-cols-2 sm:gap-4\">\n <div className=\"min-w-0\">\n <p className=\"truncate font-medium\">{column}</p>\n <p className=\"truncate text-xs text-muted-foreground\">{examples.length > 0 ? examples.join(', ') : text('emptyInFirstRows')}</p>\n </div>\n <div className=\"flex min-w-0 flex-col gap-2\">\n <ImportSelect\n label={type.label}\n name={text('typeFor', { name: column })}\n value={field.include ? field.type : leaveOut}\n options={[...types, { value: leaveOut, label: text('doNotImport') }]}\n onChange={(value) => onChange(value === leaveOut ? { include: false } : { include: true, type: value as UserTableFieldType })}\n help={decimal ? text('decimalSize', { precision: field.decimal.precision, scale: field.decimal.scale }) : undefined}\n />\n {field.include && (\n <>\n <Field label={label.label} error={problems?.label} required>\n <Input wrapperClassName=\"max-sm:min-h-11\" aria-label={text('labelFor', { name: column })} value={field.label} onChange={(event) => onChange({ label: event.target.value })} />\n </Field>\n <Field label={name.label} error={problems?.name} required>\n <Input wrapperClassName=\"max-sm:min-h-11\" className=\"font-mono\" aria-label={text('nameFor', { name: column })} autoCapitalize=\"none\" autoCorrect=\"off\" spellCheck={false} value={field.name} onChange={(event) => onChange({ name: event.target.value })} />\n </Field>\n </>\n )}\n </div>\n </div>\n )\n}\n","import { Field } from '../../../record-view/field'\nimport { Input } from '../../../primitives/input'\nimport { ImportSelect } from '../import-select'\nimport { text } from '../messages'\nimport type { FieldTexts } from './field-texts'\nimport type { ProposalProblems } from './proposal-problems'\nimport { includedFields, type TableProposal } from './table-proposal'\n\ntype TableSectionProps = {\n proposal: TableProposal\n problems: ProposalProblems\n texts: FieldTexts\n onChange: (edit: Partial<Pick<TableProposal, 'name' | 'pluralLabel' | 'singularLabel' | 'titleField'>>) => void\n}\n\nconst none = ''\n\n/** The new table's labels, name and title field, as the New table form asks for them. */\nexport const TableSection = ({ proposal, problems, texts, onChange }: TableSectionProps) => {\n const titles = includedFields(proposal).filter((field) => field.type === 'text')\n const plural = texts.table('plural_label')\n const singular = texts.table('singular_label')\n const name = texts.table('name')\n const title = texts.table('title_field')\n return (\n <section aria-label={text('newTable')} className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <Field label={plural.label} help={plural.help} error={problems.pluralLabel} required>\n <Input wrapperClassName=\"max-sm:min-h-11\" value={proposal.pluralLabel} onChange={(event) => onChange({ pluralLabel: event.target.value })} />\n </Field>\n <Field label={singular.label} help={singular.help} error={problems.singularLabel} required>\n <Input wrapperClassName=\"max-sm:min-h-11\" value={proposal.singularLabel} onChange={(event) => onChange({ singularLabel: event.target.value })} />\n </Field>\n <Field label={name.label} help={name.help} error={problems.name} required>\n <Input wrapperClassName=\"max-sm:min-h-11\" className=\"font-mono\" autoCapitalize=\"none\" autoCorrect=\"off\" spellCheck={false} value={proposal.name} onChange={(event) => onChange({ name: event.target.value })} />\n </Field>\n <ImportSelect\n label={title.label}\n value={proposal.titleField ?? none}\n options={[{ value: none, label: text('noTitle') }, ...titles.map((field) => ({ value: field.name, label: field.label || field.name }))]}\n onChange={(value) => onChange({ titleField: value || undefined })}\n help={title.help}\n />\n </section>\n )\n}\n","import { TriangleAlert } from 'lucide-react'\nimport { cellText, columnName } from '../sheet-cell'\nimport { text } from '../messages'\nimport { FieldRow } from './field-row'\nimport type { FieldTexts } from './field-texts'\nimport type { ProposalProblems } from './proposal-problems'\nimport { TableSection } from './table-section'\nimport type { TableImportFlow } from './use-table-import-flow'\n\n/**\n * The table a file becomes, to review before it is made: its labels and name, then a field per column, typed only from\n * what the column's cells say, which the user may rename, relabel, make less specific or leave out.\n */\nexport const TableFieldsStep = ({ flow, problems, texts }: { flow: TableImportFlow; problems: ProposalProblems; texts: FieldTexts }) => {\n const { proposal, read } = flow\n if (!proposal || !read) return null\n return (\n <div className=\"flex flex-col gap-5\">\n <TableSection proposal={proposal} problems={problems} texts={texts} onChange={flow.changeTable} />\n <p className=\"-mb-3 text-xs text-muted-foreground\">{text('typesFromCells', { rows: read.rows })}</p>\n <section aria-label={text('columns')} className=\"flex flex-col divide-y divide-border border-y\">\n {proposal.fields.map((field) => (\n <FieldRow\n key={field.column}\n field={field}\n column={columnName(read.headers, field.column)}\n examples={read.sample.map((row) => cellText(row.cells[field.column] ?? null)).filter((example) => example !== '').slice(0, 3)}\n problems={problems.fields[field.column]}\n texts={texts}\n onChange={(edit) => flow.change(field.column, edit)}\n />\n ))}\n </section>\n {problems.noFields && (\n <p role=\"alert\" className=\"flex gap-2 rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-warning-text\">\n <TriangleAlert className=\"mt-0.5 size-4 shrink-0\" />\n <span>{problems.noFields}</span>\n </p>\n )}\n </div>\n )\n}\n","import { columnTypeReader, type ColumnType, type DecimalType } from '@protobase/schema'\nimport { cellText, isEmptyCell, type SheetRow } from '../sheet-cell'\nimport type { SheetSource } from '../sheet-source'\n\n/** How many data rows the fields step shows under each column. */\nconst sampleRows = 5\n\n/** What reading a whole sheet found: its headers, each column's type and the decimal it would be, its first rows and how many rows it has. */\nexport type ReadColumns = { headers: string[]; types: ColumnType[]; decimals: DecimalType[]; sample: SheetRow[]; rows: number }\n\n/**\n * Reads every row of the sheet once, as it streams in, and keeps of each column only what its type needs (see\n * `columnTypeReader`), so a file's length never adds to the memory it takes; `onProgress` gets the rows read so far.\n */\nexport const readColumns = async (source: SheetSource, sheet: string | undefined, onProgress: (rows: number) => void, signal?: AbortSignal): Promise<ReadColumns> => {\n let headers: string[] | undefined\n let readers: ReturnType<typeof columnTypeReader>[] = []\n const sample: SheetRow[] = []\n let rows = 0\n for await (const chunk of source.rows(sheet)) {\n signal?.throwIfAborted()\n for (const row of chunk) {\n if (!headers) {\n headers = row.cells.map(cellText)\n readers = headers.map(() => columnTypeReader())\n continue\n }\n if (row.cells.every(isEmptyCell)) continue\n rows++\n if (sample.length < sampleRows) sample.push(row)\n readers.forEach((reader, column) => reader.add(row.cells[column] ?? null))\n }\n onProgress(rows)\n }\n return { headers: headers ?? [], types: readers.map((reader) => reader.type()), decimals: readers.map((reader) => reader.decimal()), sample, rows }\n}\n","import { useQueryClient } from '@tanstack/react-query'\nimport { useMemo, useRef, useState } from 'react'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { maxNameBytes, maxOrganizationNameBytes } from '@protobase/schema/internal'\nimport { useResourceClients } from '../../../data/api-provider'\nimport type { MetaData } from '../../../data/meta-data'\nimport { keys } from '../../../data/query-keys'\nimport { useAppAddress } from '../../use-app-address'\nimport { createLookups } from '../lookups'\nimport type { ImportPlan } from '../prepare-rows'\nimport { runImport, type ImportProgress } from '../run-import'\nimport { workerSheetSource, type SheetSource } from '../sheet-source'\nimport { createTableOps } from './create-table-ops'\nimport { readColumns, type ReadColumns } from './read-columns'\nimport { changeField, includedFields, proposeTable, type ProposedField, type TableProposal } from './table-proposal'\n\n/** Where making a table from a file is: choosing the file, reading it, reviewing its fields, making the table, writing its rows, or done. */\nexport type TableImportStep =\n | { kind: 'file'; reading: boolean }\n | { kind: 'reading'; rows: number }\n | { kind: 'fields' }\n | { kind: 'creating' }\n | { kind: 'importing'; progress: ImportProgress; total: number; cancelling: boolean }\n | { kind: 'done'; result: ImportProgress & { cancelled: boolean }; stopped?: unknown }\n\nexport type TableImportFlowOptions = {\n /** The resource of the tables users add, whose list offers this. */\n tables: ResourceModel\n resources: Record<string, ResourceModel>\n /** Reads the chosen file; a Web Worker by default. */\n sourceFor?: (file: File) => SheetSource\n}\n\nconst emptyProgress: ImportProgress = { created: 0, updated: 0, skipped: 0, failed: 0, notWritten: [] }\n\n// The rows are read as the cells say, which `readColumns` typed: numbers with a point, ISO dates, and true or false\n// kept as text where the column is text\nconst asTyped: ImportPlan['options'] = { decimal: '.', dateOrder: 'dmy', booleanText: true }\n\n/**\n * The state of making a table from a file: the file is read once to propose its fields, the table and its fields are\n * made in one batch write, and the rows are then written as Import writes them. With organizations a table's name is\n * shorter, and may be one a resource in code has.\n */\nexport const useTableImportFlow = ({ tables, resources, sourceFor = workerSheetSource }: TableImportFlowOptions) => {\n const clientFor = useResourceClients()\n const queryClient = useQueryClient()\n const { go } = useAppAddress()\n const organizations = tables.tenant !== undefined\n const maxTableBytes = organizations ? maxOrganizationNameBytes : maxNameBytes\n const taken = useMemo(() => new Set(organizations ? [] : Object.keys(resources)), [organizations, resources])\n const [step, setStep] = useState<TableImportStep>({ kind: 'file', reading: false })\n const [error, setError] = useState<unknown>()\n const [file, setFile] = useState<{ file: File; source: SheetSource; sheets: string[] }>()\n const [sheet, setSheet] = useState<string>()\n const [read, setRead] = useState<ReadColumns>()\n const [proposal, setProposal] = useState<TableProposal>()\n const [table, setTable] = useState<string>()\n const cancelled = useRef(false)\n const reading = useRef<AbortController | undefined>(undefined)\n\n const fail = (next: TableImportStep) => (cause: unknown) => {\n setError(cause)\n setStep(next)\n }\n\n // Reads the whole sheet and proposes a field for each of its columns\n const open = (chosen: File, source: SheetSource, name: string | undefined) => {\n const controller = new AbortController()\n reading.current = controller\n setStep({ kind: 'reading', rows: 0 })\n readColumns(source, name, (rows) => setStep({ kind: 'reading', rows }), controller.signal)\n .then((columns) => {\n if (controller.signal.aborted) return\n setRead(columns)\n setProposal(proposeTable(chosen.name, columns, taken, maxTableBytes))\n setStep({ kind: 'fields' })\n })\n .catch((cause: unknown) => {\n if (!controller.signal.aborted) fail({ kind: 'file', reading: false })(cause)\n })\n }\n\n /** Reads the chosen file's sheet names; a CSV, a JSON file, or a workbook of one sheet goes on to its columns. */\n const choose = (chosen: File) => {\n setError(undefined)\n setStep({ kind: 'file', reading: true })\n const source = sourceFor(chosen)\n void source\n .sheets()\n .then((sheets) => {\n setFile({ file: chosen, source, sheets })\n setSheet(sheets[0])\n if (sheets.length <= 1) return open(chosen, source, sheets[0])\n setStep({ kind: 'file', reading: false })\n })\n .catch(fail({ kind: 'file', reading: false }))\n }\n\n const openSheet = () => {\n if (!file) return\n setError(undefined)\n open(file.file, file.source, sheet)\n }\n\n const change = (column: number, edit: Partial<Pick<ProposedField, 'include' | 'name' | 'label' | 'type'>>) => setProposal((current) => current && changeField(current, column, edit))\n const changeTable = (edit: Partial<Pick<TableProposal, 'name' | 'pluralLabel' | 'singularLabel' | 'titleField'>>) => setProposal((current) => current && { ...current, ...edit })\n\n // The new table's model and view, from `/meta` read again: the server that made it serves it at once\n const servedTable = async (name: string) => {\n await queryClient.refetchQueries({ queryKey: keys.meta })\n const meta = queryClient.getQueryData<MetaData>(keys.meta)\n const model = meta?.resources[name]\n if (!meta || !model) throw new Error(`The server does not serve the new table ${name} yet`)\n return { model, resources: meta.resources, views: meta.views as Record<string, ViewModel> }\n }\n\n // Writes the rows into the new table as Import writes them, with progress and Cancel between batches\n const importRows = async (name: string, current: TableProposal) => {\n if (!file || !read) return\n const context = { ...(await servedTable(name)), lookups: createLookups(clientFor) }\n const plan: ImportPlan = { mode: 'create', columns: includedFields(current).map((field) => ({ column: field.column, field: field.name })), options: asTyped }\n cancelled.current = false\n let latest = emptyProgress\n setStep({ kind: 'importing', progress: emptyProgress, total: read.rows, cancelling: false })\n const result = await runImport(file.source, sheet, plan, context, {\n client: clientFor(name),\n onProgress: (progress) => {\n latest = progress\n setStep({ kind: 'importing', progress, total: read.rows, cancelling: cancelled.current })\n },\n cancelled: () => cancelled.current,\n }).catch((cause: unknown) => ({ ...latest, cancelled: false, stopped: cause }))\n const stopped = 'stopped' in result ? result.stopped : undefined\n // Every row written: the new table's list, as after making any record\n if (stopped === undefined && !result.cancelled && result.notWritten.length === 0) return go({ kind: 'list', resource: name })\n setStep({ kind: 'done', result, stopped })\n }\n\n /** Makes the table and its fields in one batch write, then writes the file's rows into it. */\n const create = () => {\n if (!proposal) return\n setError(undefined)\n setStep({ kind: 'creating' })\n clientFor(tables.name)\n .batchWrite(createTableOps(tables.name, proposal))\n .then(({ results }) => {\n const [made] = results\n const name = made?.op === 'create' ? String(made.record.table_name) : proposal.name\n setTable(name)\n // The table stays made when its rows cannot be written; the summary says why and links to it\n return importRows(name, proposal).catch((cause: unknown) => setStep({ kind: 'done', result: { ...emptyProgress, cancelled: false }, stopped: cause }))\n }, fail({ kind: 'fields' }))\n }\n\n const cancel = () => {\n cancelled.current = true\n setStep((current) => (current.kind === 'importing' ? { ...current, cancelling: true } : current))\n }\n\n /** Back from reading the file to choosing it. */\n const back = () => {\n reading.current?.abort()\n setError(undefined)\n setStep({ kind: 'file', reading: false })\n }\n\n /** Stops reading the file when the dialog closes. */\n const stop = () => reading.current?.abort()\n\n return { step, error, file: file?.file, sheets: file?.sheets ?? [], sheet, setSheet, read, proposal, table, taken, maxTableBytes, choose, openSheet, change, changeTable, create, cancel, back, stop }\n}\n\nexport type TableImportFlow = ReturnType<typeof useTableImportFlow>\n","import type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { Button, buttonClass } from '../../../primitives/button'\nimport { ResponsiveDialog } from '../../../primitives/responsive-dialog'\nimport { ErrorBanner } from '../../error-banner'\nimport { AppLink } from '../../use-app-address'\nimport { ImportChecking } from '../import-check-step'\nimport { ImportFileStep } from '../import-file-step'\nimport { ImportProgressStep, ImportSummary } from '../import-result-step'\nimport { text } from '../messages'\nimport type { SheetSource } from '../sheet-source'\nimport { fieldTexts } from './field-texts'\nimport { hasProblems, proposalProblems } from './proposal-problems'\nimport { TableFieldsStep } from './table-fields-step'\nimport { useTableImportFlow, type TableImportFlow } from './use-table-import-flow'\n\nexport type ImportTableDialogProps = {\n /** The resource of the tables users add. */\n tables: ResourceModel\n resources: Record<string, ResourceModel>\n views: Record<string, ViewModel>\n onClose: () => void\n /** Reads the chosen file; a Web Worker by default. */\n sourceFor?: (file: File) => SheetSource\n}\n\nconst errorTitle = (flow: TableImportFlow) => (flow.step.kind === 'fields' ? text('couldNotMakeTable') : text('couldNotReadFile'))\n\n/**\n * Makes a new table from an .xlsx, CSV or JSON file: choose the file (and its sheet), review the field each column\n * becomes, then the table and its fields are made in one request and the rows written as Import writes them, landing\n * on the new table's list, or on a summary with the rows not imported to download.\n */\nexport const ImportTableDialog = ({ tables, resources, views, onClose, sourceFor }: ImportTableDialogProps) => {\n const flow = useTableImportFlow({ tables, resources, sourceFor })\n const texts = fieldTexts(views, tables.name)\n const { step, proposal } = flow\n const problems = proposal ? proposalProblems(proposal, flow.taken, flow.maxTableBytes) : undefined\n const headers = flow.read?.headers ?? []\n const busy = step.kind === 'creating' || step.kind === 'importing'\n\n const close = () => {\n if (busy) return\n flow.stop()\n onClose()\n }\n const cancelButton = <Button onClick={close}>{text('cancel')}</Button>\n\n const actions = () => {\n switch (step.kind) {\n case 'file':\n return (\n <>\n {cancelButton}\n {flow.sheets.length > 1 && (\n <Button variant=\"primary\" loading={step.reading} onClick={flow.openSheet}>\n {text('next')}\n </Button>\n )}\n </>\n )\n case 'reading':\n return <Button onClick={flow.back}>{text('back')}</Button>\n case 'fields':\n case 'creating': {\n const rows = flow.read?.rows ?? 0\n return (\n <>\n {cancelButton}\n <Button variant=\"primary\" loading={step.kind === 'creating'} disabled={!problems || hasProblems(problems)} onClick={flow.create}>\n {text('makeTable', { rows })}\n </Button>\n </>\n )\n }\n case 'importing':\n return (\n <Button variant=\"danger\" disabled={step.cancelling} onClick={flow.cancel}>\n {text('cancelImport')}\n </Button>\n )\n case 'done':\n return (\n <>\n <Button onClick={onClose}>{text('done')}</Button>\n {flow.table && (\n <AppLink to={{ kind: 'list', resource: flow.table }} className={buttonClass({ variant: 'primary' })}>\n {text('openTable')}\n </AppLink>\n )}\n </>\n )\n }\n }\n\n const body = () => {\n switch (step.kind) {\n case 'file':\n return <ImportFileStep file={flow.file} sheets={flow.sheets} sheet={flow.sheet} reading={step.reading} onChoose={flow.choose} onSheet={flow.setSheet} />\n case 'reading':\n return <ImportChecking rows={step.rows} />\n case 'fields':\n case 'creating':\n return problems && <TableFieldsStep flow={flow} problems={problems} texts={texts} />\n case 'importing':\n return <ImportProgressStep progress={step.progress} total={step.total} cancelling={step.cancelling} />\n case 'done':\n return <ImportSummary result={step.result} stopped={step.stopped} headers={headers} fileName={flow.file?.name} />\n }\n }\n\n return (\n <ResponsiveDialog open wide title={text('tableFromFile')} description={flow.file && step.kind !== 'file' ? flow.file.name : undefined} onClose={close} actions={actions()}>\n <div className=\"flex flex-col gap-4\">\n {flow.error !== undefined && <ErrorBanner title={errorTitle(flow)} error={flow.error} />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G,MAAOA,EAAK,KAAQ,CAAA,OAnB1E,CACjB,OAAQyB,EAAK,KAAb,CACE,IAAK,OACH,OAAO,EAAAzC,EAAA,IAAA,CAAC3E,EAAD,CAAgB,KAAM2F,EAAK,KAAM,OAAQA,EAAK,OAAQ,MAAOA,EAAK,MAAO,QAASyB,EAAK,QAAS,SAAUzB,EAAK,OAAQ,QAASA,EAAK,QAAW,CAAA,EACzJ,IAAK,UACH,OAAO,EAAAhB,EAAA,IAAA,CAAC1E,EAAD,CAAgB,KAAMmH,EAAK,IAAO,CAAA,EAC3C,IAAK,SACL,IAAK,WACH,OAAOhD,IAAY,EAAAO,EAAA,IAAA,CAACe,GAAD,CAAuB,OAAgB,WAAiB,OAAQ,CAAA,EACrF,IAAK,YACH,OAAO,EAAAf,EAAA,IAAA,CAACpE,EAAD,CAAoB,SAAU6G,EAAK,SAAU,MAAOA,EAAK,MAAO,WAAYA,EAAK,UAAa,CAAA,EACvG,IAAK,OACH,OAAO,EAAAzC,EAAA,IAAA,CAACxE,EAAD,CAAe,OAAQiH,EAAK,OAAQ,QAASA,EAAK,QAAkB,UAAS,SAAUzB,EAAK,MAAM,IAAO,CAAA,CACpH,CACF,EAMO,CAAK,CACH,GACW,CAAA,CAEtB","debugId":"9a65a99e-5e88-4a0f-8471-5f22f01e617d"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitations-page-
|
|
1
|
+
{"version":3,"file":"invitations-page-DPzcVGHk.js","names":["useState","useCallback","n","a","t","__toESM","require_react","require_jsx_runtime","text","organizationRoleLabel","AccountSection","grantableRoles","useAuth","roleLabel","PageHeader","InviteForm","PendingInvitationRow","AppRolesPicker","import_react","import_jsx_runtime","InviteToOrganization","roles","organizations","role","setRole","appRoles","setAppRoles","sent","session","current","onSent","event","assignableOrganizationRoles","option","candidate","PendingRow","invitation","name","organizationId","onChanged","InvitationsPage","invitations","setInvitations","load","list"],"sources":["../../../src/organizations/invitations-page.tsx"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react'\nimport type { CurrentOrganization, OrganizationInvitation, OrganizationRole } from '@protobase/client'\nimport { AccountSection } from '../account/account-section'\nimport { PageHeader } from '../app-shell'\nimport { useAuth } from '../auth/auth-provider'\nimport { InviteForm } from '../invitations/invite-form'\nimport { PendingInvitationRow } from '../invitations/pending-invitation-row'\nimport { AppRolesPicker } from './app-roles-picker'\nimport { assignableOrganizationRoles } from './members-page'\nimport { grantableRoles, organizationRoleLabel, roleLabel } from './organization-paths'\nimport { text } from './messages'\n\nconst InviteToOrganization = ({ current, onSent }: { current: CurrentOrganization; onSent: () => void }) => {\n const { session, organizations } = useAuth()\n const roles = organizations?.roles ?? []\n const [role, setRole] = useState<OrganizationRole>('member')\n const [appRoles, setAppRoles] = useState<string[]>([])\n const invite = async (email: string) => {\n const sent = await session.organizations.invite(current.organization!.id, { email, role, appRoles })\n setAppRoles([])\n onSent()\n return sent\n }\n return (\n <InviteForm\n title={text('inviteSomeone')}\n description={text('inviteDescription')}\n onInvite={invite}\n beside={\n <select aria-label={text('organizationRole')} value={role} onChange={(event) => setRole(event.target.value as OrganizationRole)} className=\"h-8 rounded-md border border-border-strong bg-background px-2\">\n {assignableOrganizationRoles(current).map((option) => <option key={option} value={option}>{organizationRoleLabel(option)}</option>)}\n </select>\n }\n >\n <AppRolesPicker roles={roles.filter((candidate) => candidate.membership)} selected={appRoles} grantable={grantableRoles(roles, current)} onChange={setAppRoles} />\n </InviteForm>\n )\n}\n\nconst PendingRow = ({ invitation, organizationId, onChanged }: { invitation: OrganizationInvitation; organizationId: string; onChanged: () => void }) => {\n const { session, organizations } = useAuth()\n const appRoles = invitation.appRoles.map((name) => roleLabel(organizations?.roles ?? [], name))\n return (\n <PendingInvitationRow\n email={invitation.email}\n gives={`${organizationRoleLabel(invitation.role)}${appRoles.length > 0 ? ` · ${appRoles.join(', ')}` : ''}`}\n expiresAt={invitation.expiresAt}\n onResend={async () => {\n const sent = await session.organizations.resend(organizationId, invitation)\n onChanged()\n return sent\n }}\n onRevoke={async () => {\n await session.organizations.revoke(invitation.id)\n onChanged()\n }}\n />\n )\n}\n\n/** Inviting people to the organization one works in, and the invitations not yet accepted, for its owners and admins. */\nexport const InvitationsPage = ({ current }: { current?: CurrentOrganization }) => {\n const { session } = useAuth()\n const [invitations, setInvitations] = useState<OrganizationInvitation[]>([])\n const organizationId = current?.organization?.id\n const load = useCallback(() => {\n if (organizationId) void session.organizations.invitations(organizationId).then((list) => setInvitations(list.filter((invitation) => invitation.status === 'pending')), () => setInvitations([]))\n }, [session, organizationId])\n useEffect(load, [load])\n if (!current?.organization || !organizationId) return null\n return (\n <div className=\"mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6\">\n <PageHeader title={text('invitations')} subtitle={text('peopleInvited', { organization: current.organization.name })} />\n <InviteToOrganization current={current} onSent={load} />\n <AccountSection title={text('notAcceptedYet')} description={invitations.length > 0 ? text('sendingAgain') : text('nobodyWaiting')}>\n {invitations.length > 0 && (\n <ul className=\"divide-y rounded-md border\">\n {invitations.map((invitation) => <PendingRow key={invitation.id} invitation={invitation} organizationId={organizationId} onChanged={load} />)}\n </ul>\n )}\n </AccountSection>\n </div>\n )\n}\n"],"mappings":"s4BAYMoB,GAAwB,CAAE,UAAS,YAAmE,CAC1G,GAAM,CAAE,UAAS,iBAAkBR,EAAQ,EACrCS,EAAQC,GAAe,OAAS,CAAC,EACjC,CAACC,EAAMC,IAAA,EAAWxB,EAAAA,SAAAA,CAA2B,QAAQ,EACrD,CAACyB,EAAUC,IAAA,EAAe1B,EAAAA,SAAAA,CAAmB,CAAC,CAAC,EAOrD,OACE,EAAAmB,EAAA,IAAA,CAACJ,EAAD,CACE,MAAOP,EAAK,eAAe,EAC3B,YAAaA,EAAK,mBAAmB,EACrC,SAAU,KAVQ,IAAkB,CACtC,IAAMmB,EAAO,MAAMC,EAAQ,cAAc,OAAOC,EAAQ,aAAc,GAAI,CAAE,QAAO,OAAM,UAAS,CAAC,EAGnG,OAFAH,EA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C,EAAiBT,GAAS,cAAc,GACxCc,GAAA,EAAO1C,EAAAA,YAAAA,KAAkB,CACzBqC,GAAgBV,EAAa,cAAc,YAAYU,CAAc,CAAC,CAAC,KAAM,GAASI,EAAeE,EAAK,OAAQ,GAAeR,EAAW,SAAW,SAAS,CAAC,MAASM,EAAe,CAAC,CAAC,CAAC,CAClM,EAAG,CAACd,EAASU,CAAc,CAAC,EAG5B,OAFA,EAAApB,EAAA,UAAA,CAAUyB,EAAM,CAACA,CAAI,CAAC,EAClB,CAACd,GAAS,cAAgB,CAACS,EAAuB,MAEpD,EAAAnB,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,iEAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAACL,EAAD,CAAY,MAAON,EAAK,aAAa,EAAG,SAAUA,EAAK,gBAAiB,CAAE,aAAcqB,EAAQ,aAAa,IAAK,CAAC,CAAI,CAAA,GACvH,EAAAV,EAAA,IAAA,CAACC,EAAD,CAA+B,UAAS,OAAQuB,CAAO,CAAA,GACvD,EAAAxB,EAAA,IAAA,CAACT,EAAD,CAAgB,MAAOF,EAAK,gBAAgB,EAAG,YAAaiC,EAAY,OAAS,EAAIjC,EAAK,cAAc,EAAIA,EAAK,eAAe,EAC7H,SAAAiC,EAAY,OAAS,IACpB,EAAAtB,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,6BACX,SAAAsB,EAAY,IAAK,IAAe,EAAAtB,EAAA,IAAA,CAACgB,EAAD,CAA4C,aAA4B,iBAAgB,UAAWQ,CAAO,EAAzFP,EAAW,EAA8E,CAAC,CAC1I,CAAA,CAEQ,CAAA,CACb,GAET","debugId":"cfcdc546-1e40-4f53-b4f8-3b69b865b217"}
|
package/dist/shell-source-maps/assets/{layout-grid-DJrFC12w.js.map → layout-grid-hoLv1QVh.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-grid-
|
|
1
|
+
{"version":3,"file":"layout-grid-hoLv1QVh.js","names":["n","a","t","createLucideIcon","__iconData","LayoutGrid"],"sources":["../../../../../node_modules/.bun/lucide-react@1.52.0+0ac650c021fb1b59/node_modules/lucide-react/dist/esm/icons/layout-grid.mjs"],"sourcesContent":["/**\n * @license lucide-react v1.52.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"layout-grid\",\n size: 24,\n node: [\n [\"rect\", { width: \"7\", height: \"7\", x: \"3\", y: \"3\", rx: \"1\", key: \"1g98yp\" }],\n [\"rect\", { width: \"7\", height: \"7\", x: \"14\", y: \"3\", rx: \"1\", key: \"6d4xhi\" }],\n [\"rect\", { width: \"7\", height: \"7\", x: \"14\", y: \"14\", rx: \"1\", key: \"nxv5o0\" }],\n [\"rect\", { width: \"7\", height: \"7\", x: \"3\", y: \"14\", rx: \"1\", key: \"1bb6yr\" }]\n ]\n};\n__iconData.node;\nconst LayoutGrid = createLucideIcon(__iconData);\n\nexport { __iconData, LayoutGrid as default };\n//# sourceMappingURL=layout-grid.mjs.map\n"],"ignoreList":[0],"mappings":"8fASA,IAAMI,EAAa,CACjB,KAAM,cACN,KAAM,GACN,KAAM,CACJ,CAAC,OAAQ,CAAE,MAAO,IAAK,OAAQ,IAAK,EAAG,IAAK,EAAG,IAAK,GAAI,IAAK,IAAK,QAAS,CAAC,EAC5E,CAAC,OAAQ,CAAE,MAAO,IAAK,OAAQ,IAAK,EAAG,KAAM,EAAG,IAAK,GAAI,IAAK,IAAK,QAAS,CAAC,EAC7E,CAAC,OAAQ,CAAE,MAAO,IAAK,OAAQ,IAAK,EAAG,KAAM,EAAG,KAAM,GAAI,IAAK,IAAK,QAAS,CAAC,EAC9E,CAAC,OAAQ,CAAE,MAAO,IAAK,OAAQ,IAAK,EAAG,IAAK,EAAG,KAAM,GAAI,IAAK,IAAK,QAAS,CAAC,CAC/E,CACF,EACAA,EAAW,KACX,IAAMC,EAAaF,EAAiBC,CAAU","debugId":"21a0bbf5-4158-4dad-a882-2af03354629c"}
|
package/dist/shell-source-maps/assets/{legend-item-YdN_NHUz.js.map → legend-item-CU6Kt-GZ.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legend-item-
|
|
1
|
+
{"version":3,"file":"legend-item-CU6Kt-GZ.js","names":["_Fragment","n","a","t","__toESM","AppLink","filteredListAddress","import_jsx_runtime","require_jsx_runtime","row","LegendItem","content","color","label","children","filter","view","resource"],"sources":["../../../src/app/charts/legend-item.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { ViewModel } from '@protobase/schema'\nimport { filteredListAddress } from '../list-link'\nimport { AppLink } from '../use-app-address'\n\nconst row = 'flex items-center gap-2 rounded-md px-1 py-0.5'\n\n/**\n * One row of a chart legend: a colour dot and the value's name, with `children` after it. With a `filter` the row links to\n * that value's records; without, as for the rest of a split, it is plain text.\n */\nexport const LegendItem = ({ resource, view, filter, color, label, children }: { resource: string; view: ViewModel | undefined; filter?: string; color: string; label: string; children?: ReactNode }) => {\n const content = (\n <>\n <span className=\"size-2.5 shrink-0 rounded-full\" style={{ background: color }} aria-hidden />\n <span className=\"min-w-0 flex-1 truncate group-hover:text-primary-text\">{label}</span>\n {children}\n </>\n )\n return (\n <li>\n {filter === undefined ? (\n <div className={row}>{content}</div>\n ) : (\n <AppLink to={filteredListAddress(view, resource, filter)} className={`group ${row} hover:bg-muted`}>\n {content}\n </AppLink>\n )}\n </li>\n )\n}\n"],"mappings":"opBAKMS,EAAM,iDAMCC,GAAc,CAAE,WAAU,OAAM,SAAQ,QAAO,QAAO,cAAuI,CACxM,IAAMC,GACJ,EAAAJ,EAAA,KAAA,CAAAP,EAAAA,SAAA,CAAA,SAAA,EACE,EAAAO,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,iCAAiC,MAAO,CAAE,WAAYK,CAAM,EAAG,cAAA,EAAa,CAAA,GAC5F,EAAAL,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,wDAAyD,SAAAM,CAAY,CAAA,EACpFC,CACD,CAAA,CAAA,EAEJ,OACE,EAAAP,EAAA,IAAA,CAAC,KAAD,CAAA,SACGQ,IAAW,IAAA,IACV,EAAAR,EAAA,IAAA,CAAC,MAAD,CAAK,UAAWE,EAAM,SAAAE,CAAa,CAAA,GAEnC,EAAAJ,EAAA,IAAA,CAACF,EAAD,CAAS,GAAIC,EAAoBU,EAAMC,EAAUF,CAAM,EAAG,UAAW,SAASN,EAAI,iBAC/E,SAAAE,CACM,CAAA,CAET,CAAA,CAER","debugId":"94e8ab7e-199f-41d3-ba79-5353b29d4d76"}
|