@objectstack/console 17.5.0 → 17.7.0
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/CHANGELOG.md +806 -0
- package/dist/.objectstack-injection.json +2 -2
- package/dist/.objectui-sha +1 -1
- package/dist/assets/{ActionResultDialog-CLdIyOW6.js → ActionResultDialog-ChYnuROr.js} +3 -3
- package/dist/assets/{AiPendingActionsPage-OKYz66yR.js → AiPendingActionsPage-Dh3-i4BB.js} +1 -1
- package/dist/assets/{ApiConsolePage-CcrKovu8.js → ApiConsolePage-CKYEqlMs.js} +1 -1
- package/dist/assets/AppDocsIndex-B5Tky2xg.js +1 -0
- package/dist/assets/{AppManagementPage-D_xz8cTZ.js → AppManagementPage-ZwyvnHpM.js} +1 -1
- package/dist/assets/ApprovalsInboxPage-DD4fe0Em.js +1 -0
- package/dist/assets/{AuditLogPage-CoghqsZb.js → AuditLogPage-Sed6iMqP.js} +1 -1
- package/dist/assets/BookPage-DYjUsQIc.js +1 -0
- package/dist/assets/{ComponentNavView-BxsixSU9.js → ComponentNavView-DrlxM4SY.js} +1 -1
- package/dist/assets/CreateViewDialog-Cp72x_O7.js +1 -0
- package/dist/assets/DashboardView-juicRxcP.js +1 -0
- package/dist/assets/DocPage-CxJaQ-pC.js +1 -0
- package/dist/assets/{DocsIndex-B2zw_HAp.js → DocsIndex-LALVtIVR.js} +1 -1
- package/dist/assets/{DocsLayout-DezZ8x7_.js → DocsLayout-BAwlJQQf.js} +1 -1
- package/dist/assets/DocsSlug-CkF1E-Zs.js +1 -0
- package/dist/assets/ExpressionProvider-Dr0e99r1.js +1 -0
- package/dist/assets/FlowRunsPage-R3W3t2s4.js +1 -0
- package/dist/assets/{IntegrationsPage-2leVkVDH.js → IntegrationsPage-DIuFLEbF.js} +2 -2
- package/dist/assets/InterfaceListPage-BfoCldGu.js +1 -0
- package/dist/assets/{MarketplaceInstalledPage-EPPHSitW.js → MarketplaceInstalledPage-DyjhcUNB.js} +1 -1
- package/dist/assets/MarketplacePackagePage-BbO27Pgs.js +4 -0
- package/dist/assets/{MarketplacePage-BnQKykgv.js → MarketplacePage-DO2_b64U.js} +1 -1
- package/dist/assets/{MetadataInspector-BWxLkr0O.js → MetadataInspector-BQyu9pOE.js} +1 -1
- package/dist/assets/ObjectDataPage-DIY-yefK.js +1 -0
- package/dist/assets/PageView-C-qWu3Jw.js +1 -0
- package/dist/assets/ProfilePage-Qp8DL8CF.js +1 -0
- package/dist/assets/{PublicFormsPage-DlE6tck_.js → PublicFormsPage-D3AT2EH9.js} +1 -1
- package/dist/assets/RecordDetailView-B3XBEgk2.js +3 -0
- package/dist/assets/RecordFormPage-CcoZfUJ3.js +1 -0
- package/dist/assets/ReportDefaultInspector-DVcWM6sh.js +1 -0
- package/dist/assets/ReportView-pJCFptzp.js +2 -0
- package/dist/assets/RuntimeDraftBar-DObTyFu2.js +1 -0
- package/dist/assets/SchemaForm-BWSWYMLE.js +3 -0
- package/dist/assets/SearchResultsPage-ChVIzFob.js +1 -0
- package/dist/assets/{SettingsHub-BGKIj-Zq.js → SettingsHub-CPP9FDe8.js} +1 -1
- package/dist/assets/SettingsView-CrHAROu9.js +1 -0
- package/dist/assets/{SkeletonDetail-C8fMI-Mu.js → SkeletonDetail-CP-35B8x.js} +1 -1
- package/dist/assets/{af-BfSmLD34.js → af-Bhbso4Pg.js} +1 -1
- package/dist/assets/ai-BAPiCsNk.js +3 -0
- package/dist/assets/app-shell-eager-leaves-D9tgfJOe.js +1 -0
- package/dist/assets/{ar-B9ttrM75.js → ar-DG8TAFtm.js} +1 -1
- package/dist/assets/{ar-DZ-C1rn-cyl.js → ar-DZ-BtSien-d.js} +1 -1
- package/dist/assets/{ar-EG-BaDxKP_o.js → ar-EG-DpXC0zoY.js} +1 -1
- package/dist/assets/{ar-MA-DbxNEcmd.js → ar-MA-D1qVJLyE.js} +1 -1
- package/dist/assets/{ar-SA-DeC5LXcX.js → ar-SA-BIYKNgv8.js} +1 -1
- package/dist/assets/{ar-TN-C9KpTFJz.js → ar-TN-mUR5Mq3s.js} +1 -1
- package/dist/assets/{az-cMerDwRO.js → az-B7IqwHGK.js} +1 -1
- package/dist/assets/{be-ZTSbszQh.js → be-CnZyPaSX.js} +1 -1
- package/dist/assets/{be-tarask-BXZEUrgX.js → be-tarask--uMMCC7l.js} +1 -1
- package/dist/assets/{bg-BDogpmn5.js → bg-CZwuirtY.js} +1 -1
- package/dist/assets/{bn-Cz04uxmh.js → bn-BbOX0r-z.js} +1 -1
- package/dist/assets/{bs-CpFnCl-j.js → bs-B5W75cYR.js} +1 -1
- package/dist/assets/{ca-CHC4M52Z.js → ca-Be69LdIM.js} +1 -1
- package/dist/assets/{ckb-Dxw-RNm8.js → ckb-B-nKM1Vn.js} +1 -1
- package/dist/assets/contracts-DieHW666.js +1 -0
- package/dist/assets/{createDerive-DvA_JGNq.js → createDerive-CynsXU-B.js} +1 -1
- package/dist/assets/{cs-DsFaJ5Z7.js → cs-qHngxH7l.js} +1 -1
- package/dist/assets/{cy-FH4JFDTs.js → cy-DscO2Pgf.js} +1 -1
- package/dist/assets/{da-D1pVjaAq.js → da-vibkaLMF.js} +1 -1
- package/dist/assets/data-adapter-BDsrq0TX.js +2 -0
- package/dist/assets/{de-AT-DUMQCisj.js → de-AT--JneEuBw.js} +1 -1
- package/dist/assets/{de-DKrxSvnP.js → de-BCT78XYW.js} +1 -1
- package/dist/assets/default-inspector-registry-Dktr6x_q.js +1 -0
- package/dist/assets/dist-yh3dYtHt.js +14 -0
- package/dist/assets/drillUrlFilters-N0RngQg6.js +1 -0
- package/dist/assets/{el-l3-bHySV.js → el-Cl0y9T2b.js} +1 -1
- package/dist/assets/en-AU-By42tTB7.js +1 -0
- package/dist/assets/{en-CA-DGH5NF0a.js → en-CA-BqEEoj-Y.js} +1 -1
- package/dist/assets/en-GB-Cx8B9nkB.js +1 -0
- package/dist/assets/en-IE-CX9nv6uO.js +1 -0
- package/dist/assets/en-IN-ByGSBHa4.js +1 -0
- package/dist/assets/en-NZ-BPMwa2ZN.js +1 -0
- package/dist/assets/en-ZA-lj_N4R6c.js +1 -0
- package/dist/assets/{eo-CL6CXHZx.js → eo-oOXROuhF.js} +1 -1
- package/dist/assets/{es-BIJ0rksI.js → es-EudscwjH.js} +1 -1
- package/dist/assets/{et-BGgMzjm1.js → et-CB-5LLh6.js} +1 -1
- package/dist/assets/{eu-CqvAoRrX.js → eu-B4-hcseX.js} +1 -1
- package/dist/assets/{fa-IR-DNz3oA1-.js → fa-IR-CogavcMJ.js} +1 -1
- package/dist/assets/{fi-DNSfKWuW.js → fi-CIBE0mYa.js} +1 -1
- package/dist/assets/{formatLong-CHb9WA3O.js → formatLong-qqgm7lV1.js} +1 -1
- package/dist/assets/{fr-CA-CotiswPx.js → fr-CA-BugXMutW.js} +1 -1
- package/dist/assets/{fr-DYRJCirJ.js → fr-CDReXYWW.js} +1 -1
- package/dist/assets/{fr-CH-CpiEYWpc.js → fr-CH-fiTiB6X1.js} +1 -1
- package/dist/assets/framework-CAuH4h0L.js +35 -0
- package/dist/assets/{fy-B69yM3FE.js → fy-t_GzIAg_.js} +1 -1
- package/dist/assets/{gd-BAy8AsX6.js → gd-CSncIxtN.js} +1 -1
- package/dist/assets/{getIcon-BEVyC4y3.js → getIcon-BDkBRQFw.js} +1 -1
- package/dist/assets/{gl-soLn_weL.js → gl-_138Mj2S.js} +1 -1
- package/dist/assets/{gu-B19Yo9yC.js → gu-COfH-YUT.js} +1 -1
- package/dist/assets/{he-DYTPo33p.js → he-BXL4lOKY.js} +1 -1
- package/dist/assets/{hi-D2dIK7Oy.js → hi-kXuYI0TJ.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CExufvVt.js → highlighted-body-OFNGDK62-CK7x7Gzm.js} +1 -1
- package/dist/assets/{hr-BV-VOPMu.js → hr-DAOsQWzI.js} +1 -1
- package/dist/assets/{ht-C7MM4qkS.js → ht-Ch8SKz8p.js} +1 -1
- package/dist/assets/{hu-Rha1m2Ym.js → hu-q6W_rWPT.js} +1 -1
- package/dist/assets/{hy-CiTNgbdV.js → hy-0M8OmwnM.js} +1 -1
- package/dist/assets/i18n-DTfZonAM.js +17 -0
- package/dist/assets/i18n-locale-ar-O6rs-Cir.js +4 -0
- package/dist/assets/i18n-locale-de-CMc1jk4a.js +4 -0
- package/dist/assets/i18n-locale-en-CbRQO81h.js +4 -0
- package/dist/assets/i18n-locale-es-t47nyoCX.js +4 -0
- package/dist/assets/i18n-locale-fr-E425EqJM.js +4 -0
- package/dist/assets/i18n-locale-ja-y_fk77fz.js +4 -0
- package/dist/assets/i18n-locale-ko-CdnY2uCg.js +4 -0
- package/dist/assets/i18n-locale-pt-BaUOXS6y.js +4 -0
- package/dist/assets/i18n-locale-ru-pFlhX9wg.js +4 -0
- package/dist/assets/i18n-locale-zh-Dkj4ROTN.js +4 -0
- package/dist/assets/i18n-runtime-CdWyaiOD.js +1 -0
- package/dist/assets/{id-Cijsfjt-.js → id-BM_H1_jv.js} +1 -1
- package/dist/assets/index-ocmkyCt6.js +19 -0
- package/dist/assets/index-v2Ijn9Gr.css +2 -0
- package/dist/assets/{infrastructure-BHSync5f.js → infrastructure-CSnL6ntj.js} +2 -2
- package/dist/assets/integration-7NqwVHuJ.js +1 -0
- package/dist/assets/{is-xS1WTyeC.js → is-B_7jXZfS.js} +1 -1
- package/dist/assets/isSameWeek-D90tBsli.js +1 -0
- package/dist/assets/{it-C2i_c9sd.js → it-CBM0J9cD.js} +1 -1
- package/dist/assets/{it-CH-l516ZNXj.js → it-CH-BQltCNsR.js} +1 -1
- package/dist/assets/{ja-D9_ewLny.js → ja-DBjnsx21.js} +1 -1
- package/dist/assets/{ja-Hira-D_6ExgHw.js → ja-Hira-BZfSmj1i.js} +1 -1
- package/dist/assets/{ka-BYHGyees.js → ka-HwpuKgUY.js} +1 -1
- package/dist/assets/{kk-CbTFtuqb.js → kk-DLKA9paj.js} +1 -1
- package/dist/assets/{km-Dr2gwhIn.js → km-BU5kermq.js} +1 -1
- package/dist/assets/{kn-CprH8JD7.js → kn-BNFqbCoi.js} +1 -1
- package/dist/assets/{ko-CsFS2u5i.js → ko-D8n4uMqQ.js} +1 -1
- package/dist/assets/{lb-CbFKN7Ob.js → lb-B1empQ7m.js} +1 -1
- package/dist/assets/{lt-Bq0xkLp0.js → lt-gMukpK3G.js} +1 -1
- package/dist/assets/{lv-Cj6vg6Qo.js → lv-D2O5AnsZ.js} +1 -1
- package/dist/assets/{match-CiPp9BME.js → match-BTF6WqJh.js} +1 -1
- package/dist/assets/{match-C_jFGO9e.js → match-Cyum2eeW.js} +1 -1
- package/dist/assets/{match-Co4ivumx.js → match-ScHH8kYk.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-D4H6EVJQ.js +1 -0
- package/dist/assets/metadata-admin-CEhVmXFv.js +9 -0
- package/dist/assets/{mk-MXFM99YL.js → mk-D-Zl0xVN.js} +1 -1
- package/dist/assets/{mn-D5Q9B6Jt.js → mn-jJbTslgD.js} +1 -1
- package/dist/assets/{ms-CCzPRldx.js → ms-CUuJHLA4.js} +1 -1
- package/dist/assets/{mt-mjJpN6xW.js → mt-yIcbfxKY.js} +1 -1
- package/dist/assets/{nb-BIlNqdEb.js → nb-D9WNypoj.js} +1 -1
- package/dist/assets/{nl-BE-FwXjQsmV.js → nl-BE-B1vKiw2h.js} +1 -1
- package/dist/assets/{nl-D2uBtIxG.js → nl-DC7b5e90.js} +1 -1
- package/dist/assets/{nn-B0loJ7SV.js → nn-uP4yJ9s0.js} +1 -1
- package/dist/assets/{oc-U7-yH1sO.js → oc-DHTqadJI.js} +1 -1
- package/dist/assets/{pl-mTy0JYgi.js → pl-Bxnnizf5.js} +1 -1
- package/dist/assets/plugin-calendar-b7C35ANT.js +1 -0
- package/dist/assets/plugin-charts-b-yVtmdI.js +7 -0
- package/dist/assets/plugin-chatbot-D1KW_oIO.js +122 -0
- package/dist/assets/plugin-dashboard-DTkPoPEb.js +6 -0
- package/dist/assets/plugin-form-UIRm-FpQ.js +1 -0
- package/dist/assets/plugin-gantt-9dtc8zzX.js +63 -0
- package/dist/assets/plugin-grid-Cp4RKtMJ.js +10 -0
- package/dist/assets/plugin-kanban-B2JOPZIJ.js +1 -0
- package/dist/assets/plugin-map-CBJcVJYk.js +1 -0
- package/dist/assets/{plugin-markdown-D1nTQc1T.js → plugin-markdown-CNlDzqP-.js} +1 -1
- package/dist/assets/plugin-report-IZzgQb-Q.js +59 -0
- package/dist/assets/plugin-timeline-DsmtjcJ3.js +1 -0
- package/dist/assets/plugin-tree-DTRPBdhe.js +1 -0
- package/dist/assets/plugin-view-D9ixsNDG.js +1 -0
- package/dist/assets/plugins-views-CnvkdSJK.js +3 -0
- package/dist/assets/{pt-BR-2KtO5Js1.js → pt-BR-D416seHT.js} +1 -1
- package/dist/assets/{pt-Bet5OOQf.js → pt-DwHBy9_c.js} +1 -1
- package/dist/assets/{ro-37U6sgzi.js → ro-DDf1X3Np.js} +1 -1
- package/dist/assets/{ru-CyuAY-5E.js → ru-8eM3mcgK.js} +1 -1
- package/dist/assets/{runtime-metadata-persistence-afAW-MeD.js → runtime-metadata-persistence-DX29lQ62.js} +1 -1
- package/dist/assets/{se-DeJabuC6.js → se-D4JvQeRX.js} +1 -1
- package/dist/assets/{sk-DWEpjfkR.js → sk-DvpgttGI.js} +1 -1
- package/dist/assets/{sl-4oSvNhIR.js → sl-B3gCZ-_a.js} +1 -1
- package/dist/assets/{sq-BjkBCaXW.js → sq-CVaTmL0V.js} +1 -1
- package/dist/assets/{sr-Dxm1DsRS.js → sr-CnH5Ffyz.js} +1 -1
- package/dist/assets/{sr-Latn-Dawg6oP2.js → sr-Latn-Dw9w61q6.js} +1 -1
- package/dist/assets/src-BUry7633.js +2 -0
- package/dist/assets/{src-C8NYjdVm.js → src-DMDT5a27.js} +1 -1
- package/dist/assets/src-ZxH3AOCu.js +16 -0
- package/dist/assets/{studioEntry-nXQP3iL0.js → studioEntry-DAqcBFtr.js} +1 -1
- package/dist/assets/{submitRedirect-jK-cEIbP.js → submitRedirect-iy0oOi7I.js} +1 -1
- package/dist/assets/{sv-CROOGJGz.js → sv-CU7wdxyK.js} +1 -1
- package/dist/assets/{ta-BZnTmFI_.js → ta-DPH6q0HR.js} +1 -1
- package/dist/assets/{te-BN0v0x5t.js → te-BSaThkGV.js} +1 -1
- package/dist/assets/{th-CBjKhp_U.js → th-NXP8_Qb8.js} +1 -1
- package/dist/assets/{tr-x0Ne4N4H.js → tr-DDXoH663.js} +1 -1
- package/dist/assets/types-zod-ChJ30y25.js +1 -0
- package/dist/assets/{ug-sgzNhsKo.js → ug-Guus6pPe.js} +1 -1
- package/dist/assets/ui-components-D8wcRNrt.js +37 -0
- package/dist/assets/ui-layout-BYO3rRIl.js +1 -0
- package/dist/assets/{uk-o_DQ5VHJ.js → uk-uiy4vsp8.js} +1 -1
- package/dist/assets/use-book-data-DFTswcKm.js +1 -0
- package/dist/assets/{useActionModal-CSvbHkQ7.js → useActionModal-h52Z5Pkl.js} +1 -1
- package/dist/assets/useCanAuthorMetadata-TDrVrYGB.js +1 -0
- package/dist/assets/useDatasetCatalog-BOd0Ybr1.js +1 -0
- package/dist/assets/useNavSelDeepLink-67Y4qCNO.js +1 -0
- package/dist/assets/useNavTargetLabel-D8lRdb6O.js +1 -0
- package/dist/assets/useOpenRecordList-C7oqUD3F.js +1 -0
- package/dist/assets/{usePackageL10n-CMx66am-.js → usePackageL10n-Jl2XiF2F.js} +1 -1
- package/dist/assets/{useSettingsLabel-Kkr2q0Oo.js → useSettingsLabel-CSpBDTdy.js} +1 -1
- package/dist/assets/{uz-Cyrl-DbtkQtz_.js → uz-Cyrl-Cmb5bvbf.js} +1 -1
- package/dist/assets/{uz-Be41d4jl.js → uz-DJWxoTz4.js} +1 -1
- package/dist/assets/vendor-objectstack-C4eD5dbT.js +139 -0
- package/dist/assets/{vi-84mZmklk.js → vi-Bb3QoIJC.js} +1 -1
- package/dist/assets/{zh-CN-DD1reegJ.js → zh-CN-C-Hts1ZR.js} +1 -1
- package/dist/assets/{zh-HK-B05u30WI.js → zh-HK-CtBAZ_ZS.js} +1 -1
- package/dist/assets/{zh-TW-Bb-WimPD.js → zh-TW-B7DDahD-.js} +1 -1
- package/dist/chunk-membership.json +116 -104
- package/dist/eager-closure.json +126 -120
- package/dist/index.html +4 -4
- package/dist/sdui.manifest.json +998 -115
- package/package.json +1 -1
- package/dist/assets/AppDocsIndex-F4zDq2zz.js +0 -1
- package/dist/assets/ApprovalsInboxPage-DrEUmaDb.js +0 -1
- package/dist/assets/CreateViewDialog-xyKlpLEW.js +0 -1
- package/dist/assets/DashboardView-CGC-_Om8.js +0 -1
- package/dist/assets/DocPage-CIZE5kdj.js +0 -1
- package/dist/assets/DocsSlug-DXdFdwlS.js +0 -1
- package/dist/assets/ExpressionProvider-DZfMwyMs.js +0 -1
- package/dist/assets/FlowRunsPage-CvY3nJMF.js +0 -1
- package/dist/assets/InterfaceListPage-BdECC_i3.js +0 -1
- package/dist/assets/MarketplacePackagePage-C7NOu2Ir.js +0 -4
- package/dist/assets/ObjectDataPage-BIzp65Mo.js +0 -1
- package/dist/assets/PageView-CVLgCRSF.js +0 -1
- package/dist/assets/ProfilePage-D2qGgxPK.js +0 -1
- package/dist/assets/RecordDetailView-DQKydU7X.js +0 -3
- package/dist/assets/RecordFormPage-BTjwxJIA.js +0 -1
- package/dist/assets/ReportDefaultInspector-DdsQAkd7.js +0 -1
- package/dist/assets/ReportView-GIdKJdOt.js +0 -2
- package/dist/assets/RuntimeDraftBar-BbMdi3Kp.js +0 -1
- package/dist/assets/SchemaForm-C8X1ve4p.js +0 -3
- package/dist/assets/SearchResultsPage-Jwhqsdyo.js +0 -1
- package/dist/assets/SettingsView-D8SMKdrc.js +0 -1
- package/dist/assets/app-shell-eager-leaves-CDVclng4.js +0 -1
- package/dist/assets/appRoute-DbnWDEa1.js +0 -1
- package/dist/assets/data-adapter-DMbe6Njk.js +0 -1
- package/dist/assets/default-inspector-registry-CpL3fFhl.js +0 -1
- package/dist/assets/dist-BXrEV1ag.js +0 -13
- package/dist/assets/drillUrlFilters-hi-2d3DW.js +0 -1
- package/dist/assets/en-AU-C6x7mDhH.js +0 -1
- package/dist/assets/en-GB-0-nho2eK.js +0 -1
- package/dist/assets/en-IE-2fC3BkfV.js +0 -1
- package/dist/assets/en-IN-C1QcFhxn.js +0 -1
- package/dist/assets/en-NZ-C80ptZT7.js +0 -1
- package/dist/assets/en-ZA-ByZDrjeb.js +0 -1
- package/dist/assets/framework-DcWkeiND.js +0 -35
- package/dist/assets/i18n-CEKxYdmD.js +0 -9
- package/dist/assets/i18n-locale-ar-DN7sl3GF.js +0 -4
- package/dist/assets/i18n-locale-de-C40JErvb.js +0 -4
- package/dist/assets/i18n-locale-en-CITPDIHy.js +0 -4
- package/dist/assets/i18n-locale-es-C8DdWN6c.js +0 -4
- package/dist/assets/i18n-locale-fr-COIdEZZl.js +0 -4
- package/dist/assets/i18n-locale-ja-DYF_rU_s.js +0 -4
- package/dist/assets/i18n-locale-ko-B-ODYAtX.js +0 -4
- package/dist/assets/i18n-locale-pt-CK1SyBIm.js +0 -4
- package/dist/assets/i18n-locale-ru-jLzvShMO.js +0 -4
- package/dist/assets/i18n-locale-zh-Bf9Gbbvl.js +0 -4
- package/dist/assets/i18n-runtime-CTgAQF4N.js +0 -1
- package/dist/assets/index-CLyvpiGc.css +0 -2
- package/dist/assets/index-CfnfGw5W.js +0 -20
- package/dist/assets/isSameWeek-DWYeNyh8.js +0 -1
- package/dist/assets/mermaid-GHXKKRXX-DVLc_uym.js +0 -1
- package/dist/assets/metadata-admin-CybaOCdO.js +0 -9
- package/dist/assets/nav-selection-Dzm_mA3C.js +0 -1
- package/dist/assets/plugin-calendar-CKRBcML7.js +0 -1
- package/dist/assets/plugin-charts-DGTJxXCB.js +0 -7
- package/dist/assets/plugin-chatbot-DwtwNA-y.js +0 -122
- package/dist/assets/plugin-dashboard-C1AYKmGX.js +0 -6
- package/dist/assets/plugin-form-CV8ZY04-.js +0 -1
- package/dist/assets/plugin-gantt-BRIb2_8G.js +0 -63
- package/dist/assets/plugin-grid-C9h7mRVv.js +0 -11
- package/dist/assets/plugin-kanban-BcJ0Dhys.js +0 -1
- package/dist/assets/plugin-map-D24ZUOUj.js +0 -1
- package/dist/assets/plugin-report-BfGintAq.js +0 -59
- package/dist/assets/plugin-timeline-CbBRq_qt.js +0 -1
- package/dist/assets/plugin-tree-BNX2A5J5.js +0 -1
- package/dist/assets/plugin-view-DzWQWYyH.js +0 -1
- package/dist/assets/plugins-views-DraK4xz0.js +0 -3
- package/dist/assets/src-B8lv0plz.js +0 -18
- package/dist/assets/src-DoDvT77T.js +0 -1
- package/dist/assets/types-zod-Y2RwUUeJ.js +0 -1
- package/dist/assets/ui-components-BTB1NkUW.js +0 -37
- package/dist/assets/ui-layout-bZfafwJa.js +0 -1
- package/dist/assets/use-book-data-C3eyZJSG.js +0 -1
- package/dist/assets/useOpenRecordList-B5-qaFUx.js +0 -1
- package/dist/assets/vendor-objectstack-XuWC71M9.js +0 -266
- package/dist/assets/vendor-zod-CHLW1iCr.js +0 -64
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{h as n,t as r,v as i}from"./vendor-react-BggL7APJ.js";import{Ct as a,Fr as o,Gr as s,Hn as c,Hr as l,Ir as u,Mr as d,Nr as f,O as p,Pr as m,St as h,Ur as g,Vr as _,Wr as v,Yn as y,bi as b,bt as ee,d as te,et as ne,g as x,ii as S,jr as C,k as w,kn as T,l as re,pt as ie,rt as ae,u as E,xt as D}from"./ui-components-D8wcRNrt.js";import{$i as O,$r as k,At as oe,Fr as A,Ft as j,J as M,Or as se,Qi as N,Rr as ce,Yr as le,Zi as P,_ as ue,_r as F,dt as de,fi as fe,i as pe,jt as me,ni as he,o as ge,pt as _e,q as ve,s as ye,st as be,u as xe,y as Se}from"./framework-CAuH4h0L.js";import{g as Ce,h as I,p as we}from"./i18n-runtime-CdWyaiOD.js";import{r as Te}from"./vendor-ui-utils-DIUdEYii.js";import{t as L}from"./vendor-icon-check-vpu9Zukp.js";import{t as Ee}from"./vendor-icon-chevron-down-BEf_jTEE.js";import{t as R}from"./vendor-icon-file-text-7BKAVNof.js";import{t as z}from"./vendor-icon-plus-BlfcDDsa.js";import{t as B}from"./vendor-icon-x-CcLtgRNL.js";import{_ as V,c as H,d as U,f as W,l as De,m as Oe,o as G,s as K,t as q,v as J,y as ke}from"./vendor-dndkit-CqQIoA27.js";import{c as Ae,o as je}from"./plugin-grid-Cp4RKtMJ.js";var Y=e(i(),1),Me=(0,Y.createContext)(!0);function Ne(){return(0,Y.useContext)(Me)}var Pe=t({default:()=>qe}),X=r(),Z=(...e)=>e.filter(Boolean).join(` `),Q=I({"kanban.addCard":`Add card`,"kanban.noCards":`No cards`,"kanban.cardTitlePlaceholder":`Enter card title…`},`kanban.noCards`),$=`Uncategorized`,Fe=`data-swimlane-scroll-row`,Ie=`px-2 pl-36 sm:pl-44`;function Le(e,t,n,r){return F(e,t,n,r)}function Re({card:e,onCardClick:t,conditionalFormatting:n,objectFields:r}){let{attributes:i,listeners:a,setNodeRef:o,transform:c,transition:u,isDragging:d}=G({id:e.id}),f={transform:ke.Transform.toString(c),transition:u,opacity:d?.5:void 0},p=Le(e,n,j(),r);return(0,X.jsx)(`div`,{ref:o,style:f,...i,...a,role:`listitem`,"aria-label":e.title,onClick:n=>t?.(e,n),children:(0,X.jsxs)(_,{className:`mb-2 cursor-grab active:cursor-grabbing border-border border-l-4 border-l-primary/40 bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group touch-manipulation`,style:p,children:[e.coverImage&&(0,X.jsx)(`div`,{className:`w-full h-32 overflow-hidden rounded-t-lg`,children:(0,X.jsx)(`img`,{src:e.coverImage,alt:``,className:`w-full h-full object-cover`,loading:`lazy`})}),(0,X.jsxs)(v,{className:`p-2 sm:p-4 pb-2`,children:[(0,X.jsx)(s,{className:`text-xs sm:text-sm font-semibold tracking-tight text-foreground group-hover:text-primary transition-colors leading-snug line-clamp-2`,children:e.title}),!(e.cardFieldCells&&e.cardFieldCells.length>0)&&(e.cardSubtitle??e.description)&&(0,X.jsx)(g,{className:`text-xs text-muted-foreground line-clamp-2 sm:line-clamp-none`,children:e.cardSubtitle??e.description})]}),(e.cardFieldCells&&e.cardFieldCells.length>0||e.badges&&e.badges.length>0)&&(0,X.jsxs)(l,{className:`p-2 sm:p-4 pt-0 space-y-1.5`,children:[e.cardFieldCells&&e.cardFieldCells.length>0&&(0,X.jsx)(`dl`,{className:`space-y-1 text-xs`,children:e.cardFieldCells.map(e=>(0,X.jsxs)(`div`,{className:`min-w-0 truncate text-foreground/85`,title:e.label||e.field,children:[(0,X.jsx)(`dt`,{className:`sr-only`,children:e.label||e.field}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate`,children:e.node})]},e.field))}),e.badges&&e.badges.length>0&&(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.badges.map((e,t)=>(0,X.jsx)(S,{variant:e.colorClass?`outline`:e.variant||`default`,className:Z(`text-xs font-normal`,e.colorClass),style:e.colorStyle,children:e.label},t))})]})]})})}function ze({columnId:e,onAdd:t}){let{t:n}=Q(),[r,i]=Y.useState(!1),[a,o]=Y.useState(``),s=Y.useRef(null),c=()=>{let n=a.trim();n&&(t(e,n),o(``)),i(!1)};return r?(0,X.jsx)(`div`,{className:`mt-2 space-y-2`,children:(0,X.jsx)(y,{ref:s,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),c()):e.key===`Escape`&&(o(``),i(!1))},onBlur:c,placeholder:n(`kanban.cardTitlePlaceholder`),className:`text-sm`,autoFocus:!0})}):(0,X.jsxs)(b,{variant:`ghost`,size:`sm`,className:`w-full mt-2 text-muted-foreground hover:text-foreground`,onClick:()=>{i(!0),setTimeout(()=>s.current?.focus(),0)},children:[(0,X.jsx)(z,{className:`h-4 w-4 mr-1`}),n(`kanban.addCard`)]})}function Be(e){return e&&e.width!=null?`shrink-0`:`w-[85vw] sm:w-80 shrink-0`}var Ve=56;function He(e,t){return t?{className:`shrink-0`,style:{...e,width:Ve}}:{className:Be(e),style:e}}function Ue({column:e,collapsed:t,collapsible:n,onToggle:r,className:i}){return n?(0,X.jsxs)(`button`,{type:`button`,className:Z(`inline-flex items-center gap-1 min-w-0 hover:text-foreground transition-colors`,t&&`flex-col`,i),"aria-expanded":!t,onClick:r,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:Z(`text-[10px] transition-transform shrink-0`,t?``:`rotate-90`),children:`▶`}),(0,X.jsx)(`span`,{className:Z(`truncate`,t&&`[writing-mode:vertical-rl] rotate-180`),children:e.title})]}):i?(0,X.jsx)(`span`,{className:i,children:e.title}):(0,X.jsx)(X.Fragment,{children:e.title})}function We(e,t){return t?`${e}+`:String(e)}function Ge({column:e,cards:t,onCardClick:n,quickAdd:r,onQuickAdd:i,conditionalFormatting:a,objectFields:o,columnStyle:s,suppressEmptyPlaceholder:l,countsAreWindowed:u,collapsed:d,onToggleCollapse:f}){let{t:p}=Q(),m=t||[],{setNodeRef:h,isOver:g}=G({id:e.id,data:{type:`column`}}),_=e.limit&&m.length>=e.limit,v=d===!0,y=He(s,v);return(0,X.jsxs)(`div`,{ref:h,role:`group`,"aria-label":e.title,style:y.style,className:Z(`relative flex flex-col rounded-xl border border-border/60 bg-muted/15 snap-start max-h-full min-h-0 transition-all duration-200 shadow-sm hover:shadow-md overflow-hidden`,y.className,g&&`ring-2 ring-primary/60 bg-primary/5`,e.className),children:[(0,X.jsx)(`div`,{className:Z(`border-b border-border/40`,v?`px-1 py-3`:`px-3 sm:px-4 pt-3 pb-2.5`),children:(0,X.jsxs)(`div`,{className:Z(`flex gap-2`,v?`flex-col items-center`:`items-center justify-between`),children:[(0,X.jsx)(`h3`,{id:`kanban-col-${e.id}`,className:Z(`text-xs sm:text-[13px] font-semibold tracking-tight truncate text-foreground/85 uppercase`,v&&`min-w-0`),children:(0,X.jsx)(Ue,{column:e,collapsed:v,collapsible:f!=null,onToggle:()=>f?.()})}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[(0,X.jsxs)(`span`,{className:Z(`inline-flex items-center justify-center min-w-[22px] h-[20px] px-1.5 rounded-md text-[11px] font-medium tabular-nums`,_?`bg-destructive/10 text-destructive ring-1 ring-inset ring-destructive/30`:`bg-muted/70 text-muted-foreground`),children:[We(m.length,u),e.limit&&(0,X.jsx)(`span`,{className:`text-muted-foreground/70 font-normal`,children:` / ${e.limit}`})]}),_&&(0,X.jsx)(S,{variant:`destructive`,className:`text-[10px] h-[20px] px-1.5`,children:`Full`})]})]})}),!v&&(0,X.jsxs)(c,{className:`flex-1 p-4`,children:[(0,X.jsx)(q,{items:m.map(e=>e.id),strategy:K,children:(0,X.jsxs)(`div`,{className:`space-y-2`,role:`list`,"aria-label":`${e.title} cards`,children:[m.length===0&&!l&&(0,X.jsxs)(`div`,{className:Z(`flex flex-col items-center justify-center py-6 rounded-md border-2 border-dashed transition-colors gap-1`,g?`border-primary/60 bg-primary/10 text-primary`:`border-border/40 text-muted-foreground/60`),children:[!g&&r&&i&&(0,X.jsx)(z,{className:`h-3.5 w-3.5 opacity-60`,"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`text-xs`,children:[g?`↓ `:``,p(`kanban.noCards`)]})]}),m.map(e=>(0,X.jsx)(Re,{card:e,onCardClick:n,conditionalFormatting:a,objectFields:o},e.id))]})}),r&&i&&(0,X.jsx)(ze,{columnId:e.id,onAdd:i})]})]})}function Ke({children:e}){let t=ve();return(0,X.jsx)(X.Fragment,{children:e(t)})}function qe({columns:e,onCardMove:t,onCardClick:n,className:r,quickAdd:i,onQuickAdd:a,coverImageField:o,conditionalFormatting:s,objectFields:c,swimlaneField:l,countsAreWindowed:u}){return M()?(0,X.jsx)(Ke,{children:d=>(0,X.jsx)(Je,{columns:e,onCardMove:t,onCardClick:n,className:r,dnd:d,quickAdd:i,onQuickAdd:a,coverImageField:o,conditionalFormatting:s,objectFields:c,swimlaneField:l,countsAreWindowed:u})}):(0,X.jsx)(Je,{columns:e,onCardMove:t,onCardClick:n,className:r,dnd:null,quickAdd:i,onQuickAdd:a,coverImageField:o,conditionalFormatting:s,objectFields:c,swimlaneField:l,countsAreWindowed:u})}function Je({columns:e,onCardMove:t,onCardClick:n,className:r,dnd:i,quickAdd:a,onQuickAdd:o,coverImageField:s,conditionalFormatting:c,objectFields:l,swimlaneField:u,countsAreWindowed:d}){let{t:f}=Q(),[p,m]=Y.useState(null),h=Ne(),g=Y.useRef(null),{width:_}=ae(g),v=Y.useMemo(()=>_?_<480?{width:Math.max(_-32,220)}:_<720?{width:280}:{width:320}:{},[_]),y=u?`objectui:kanban-collapsed:${u}`:null,[b,ee]=Y.useState(()=>{if(!y)return new Set;try{let e=localStorage.getItem(y);if(e){let t=JSON.parse(e);if(Array.isArray(t))return new Set(t.filter(e=>typeof e==`string`))}}catch{}return new Set}),[te,ne]=Y.useState(()=>new Map),x=Y.useCallback(e=>te.get(String(e.id))??e.collapsed===!0,[te]),S=Y.useCallback((e,t)=>{ne(n=>{let r=new Map(n);return r.set(String(e),t),r})},[]),C=Y.useMemo(()=>(e||[]).map(e=>({...e,cards:e.cards||[]})),[e]),[w,T]=Y.useState(C),[re,E]=Y.useState(C);re!==C&&(E(C),T(C));let D=Y.useMemo(()=>{if(!u)return null;let e=w.flatMap(e=>e.cards),t=new Set;return e.forEach(e=>{let n=e[u];t.add(n==null?$:String(n))}),Array.from(t).sort()},[w,u]),O=Y.useCallback(e=>{ee(t=>{let n=new Set(t);if(n.has(e)?n.delete(e):n.add(e),y)try{localStorage.setItem(y,JSON.stringify([...n]))}catch{}return n})},[y]),k=J(V(U,{activationConstraint:{distance:5}}),V(W,{activationConstraint:{delay:200,tolerance:5}})),oe=e=>{let{active:t}=e,n=j(t.id);if(m(n),i&&n){let e=M(n.id);e&&i.startDrag({id:n.id,type:`kanban-card`,data:n,sourceId:e.id})}},A=e=>{let{active:n,over:r}=e;if(m(null),!r){i&&i.endDrag();return}let a=n.id,o=r.id;if(a===o){i&&i.endDrag();return}let s=M(a),c=M(o)||se(o);if(!s||!c){i&&i.endDrag();return}if(s.id!==c.id){let e=[...s.cards],n=[...c.cards],r=e.findIndex(e=>e.id===a),i=o===c.id?n.length:n.findIndex(e=>e.id===o),[l]=e.splice(r,1);n.push(l),T(t=>t.map(t=>t.id===s.id?{...t,cards:e}:t.id===c.id?{...t,cards:n}:t)),t&&t(a,s.id,c.id,i)}i&&i.endDrag(c.id)},j=Y.useCallback(e=>{for(let t of w){let n=t.cards.find(t=>t.id===e);if(n)return n}return null},[w]),M=Y.useCallback(e=>w.find(t=>t.cards.some(t=>t.id===e))||null,[w]),se=Y.useCallback(e=>w.find(t=>t.id===e)||null,[w]),N=Y.useRef(null),[ce,le]=Y.useState(0);Y.useEffect(()=>{let e=N.current;if(!e)return;let t=()=>{let t=e.clientWidth;if(t<=0)return;let n=Math.round(e.scrollLeft/t);le(Math.max(0,Math.min(w.length-1,n)))};return t(),e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},[w.length]);let P=Y.useRef(0),ue=Y.useCallback(e=>{let t=e.currentTarget,n=t.scrollLeft;if(n===P.current)return;P.current=n;let r=g.current;if(r)for(let e of r.querySelectorAll(`[${Fe}]`))e!==t&&e.scrollLeft!==n&&(e.scrollLeft=n)},[]),F=Y.useCallback(e=>{e&&e.scrollLeft!==P.current&&(e.scrollLeft=P.current)},[]);return(0,X.jsxs)(H,{sensors:k,collisionDetection:Oe,onDragStart:oe,onDragEnd:A,children:[(0,X.jsxs)(`div`,{ref:g,className:`flex flex-col min-w-0 min-h-0 h-full`,children:[w.length>1&&(0,X.jsx)(`div`,{className:`flex sm:hidden items-center justify-center gap-1.5 px-3 pb-2`,"aria-hidden":!0,children:w.map((e,t)=>(0,X.jsx)(`span`,{className:Z(`h-1.5 rounded-full transition-all`,t===ce?`w-4 bg-foreground/70`:`w-1.5 bg-muted-foreground/30`)},e.id))}),(()=>{let e=w.reduce((e,t)=>e+(t.cards?.length||0),0)===0;return(0,X.jsxs)(X.Fragment,{children:[e&&h&&(0,X.jsx)(`div`,{className:`px-4 sm:px-6 pt-3`,children:(0,X.jsx)(ie,{role:`status`,"aria-live":`polite`,showIcon:!1,className:`rounded-lg border border-dashed border-border/60 bg-muted/10 py-8 gap-2 [&>h3]:text-sm [&>h3]:font-medium [&>h3]:text-foreground/80`,title:f(`kanban.noCards`)})}),D?(0,X.jsxs)(`div`,{className:Z(`flex flex-col gap-2 px-4 sm:px-6 pb-3 sm:pb-4 min-w-0 overflow-x-hidden overflow-y-auto`,r),role:`region`,"aria-label":`Kanban board with swimlanes`,children:[(0,X.jsx)(`div`,{className:`flex shrink-0 gap-3 sm:gap-4 ${Ie} pt-3 sm:pt-4 overflow-x-auto sticky top-0 z-10 bg-background`,ref:F,onScroll:ue,"data-swimlane-scroll-row":``,children:w.map(e=>{let t=x(e),n=He(v,t);return(0,X.jsxs)(`div`,{style:n.style,className:Z(n.className,`text-center`),children:[(0,X.jsx)(Ue,{column:e,collapsed:t,collapsible:e.collapsed===!0,onToggle:()=>S(e.id,!t),className:` text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase`}),!t&&(0,X.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[`(`,We(e.cards.length,d),`)`]})]},e.id)})}),D.map(e=>{let t=b.has(e),r=w.reduce((t,n)=>t+n.cards.filter(t=>(t[u]==null?$:String(t[u]))===e).length,0);return(0,X.jsxs)(`div`,{className:`border rounded-lg bg-muted/10`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-muted/30 transition-colors`,onClick:()=>O(e),"aria-expanded":!t,children:[(0,X.jsx)(`span`,{className:Z(`transition-transform text-xs`,t?``:`rotate-90`),children:`▶`}),(0,X.jsx)(`span`,{className:` text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:e}),(0,X.jsxs)(`span`,{className:` text-xs text-muted-foreground`,children:[`(`,We(r,d),`)`]})]}),!t&&(0,X.jsx)(`div`,{className:`flex gap-3 sm:gap-4 overflow-x-auto ${Ie} pb-3`,ref:F,onScroll:ue,"data-swimlane-scroll-row":``,children:w.map(t=>{let r=t.cards.filter(t=>(t[u]==null?$:String(t[u]))===e),i=x(t),a=He(v,i);return(0,X.jsx)(`div`,{style:a.style,className:Z(a.className,`min-h-[60px] rounded-md bg-card/20 p-2`),children:!i&&(0,X.jsx)(q,{items:r.map(e=>e.id),strategy:K,children:(0,X.jsx)(`div`,{className:`space-y-2`,role:`list`,"aria-label":`${t.title} - ${e} cards`,children:r.map(e=>(0,X.jsx)(Re,{card:e,onCardClick:n,conditionalFormatting:c,objectFields:l},e.id))})})},t.id)})})]},e)})]}):(0,X.jsx)(`div`,{ref:N,className:Z(`flex gap-3 sm:gap-4 overflow-x-auto snap-x snap-mandatory px-4 sm:px-6 py-3 sm:py-4 [-webkit-overflow-scrolling:touch] min-w-0 min-h-0 h-full`,r),role:`region`,"aria-label":`Kanban board`,children:w.map(t=>(0,X.jsx)(Ge,{column:t,cards:t.cards,onCardClick:n,quickAdd:a,onQuickAdd:o,conditionalFormatting:c,objectFields:l,columnStyle:v,suppressEmptyPlaceholder:e||!h,countsAreWindowed:d,collapsed:x(t),onToggleCollapse:t.collapsed===!0?()=>S(t.id,!x(t)):void 0},t.id))})]})})()]}),(0,X.jsx)(De,{dropAnimation:{duration:200,easing:`cubic-bezier(0.18, 0.67, 0.6, 1.22)`},children:(0,X.jsx)(`div`,{"aria-live":`assertive`,"aria-label":p?`Dragging ${p.title}`:void 0,className:Z(p&&`motion-safe:rotate-2 motion-safe:scale-[1.03] motion-safe:transition-transform shadow-2xl shadow-primary/25 ring-1 ring-primary/40 rounded-xl cursor-grabbing`),children:p?(0,X.jsx)(Re,{card:p,conditionalFormatting:c,objectFields:l}):null})})]})}var Ye=I({"kanban.uncategorized":`Uncategorized`},`kanban.uncategorized`),Xe=Y.lazy(()=>n(()=>Promise.resolve().then(()=>Pe),void 0,import.meta.url)),Ze=({schema:e,objectFields:t,onCardMove:n,quickAdd:r,onQuickAdd:i})=>{let{t:a}=Ye(),o=Y.useMemo(()=>yt(e.columns??[],e.data,e.groupBy,e.coverImageField,a(`kanban.uncategorized`)),[e,a]);return(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(T,{className:`w-full h-[600px]`}),children:(0,X.jsx)(Xe,{columns:o,onCardMove:n,onCardClick:e.onCardClick,className:e.className,quickAdd:r,onQuickAdd:i,coverImageField:e.coverImageField,conditionalFormatting:e.conditionalFormatting,objectFields:t,swimlaneField:e.swimlaneField,countsAreWindowed:e.countsAreWindowed})})};function Qe(e,t,n,r){if(!e||!t)return[];let i={...t,[n]:r},a=[];for(let[r,o]of Object.entries(e)){if(r===n||!o||typeof o!=`object`)continue;let e=o;if(e.requiredWhen==null||!P(t[r]))continue;let s=fe({visibleWhen:e.visibleWhen,readonlyWhen:e.readonlyWhen,requiredWhen:e.requiredWhen},i,{required:e.required===!0,readonly:e.readonly===!0},t,void 0,`field '${r}'`);s.required&&s.visible&&!s.readonly&&w(e.type)&&a.push({name:r,def:{name:r,...e}})}return a}function $e({open:e,fields:t,submitting:n,onCancel:r,onSubmit:i}){let a=Ce(),[s,c]=Y.useState({}),[l,h]=Y.useState(!1),g=t.filter(e=>P(s[e.name]));return(0,X.jsx)(C,{open:e,onOpenChange:e=>{e||r()},children:(0,X.jsxs)(d,{className:`sm:max-w-md`,children:[(0,X.jsxs)(o,{children:[(0,X.jsx)(u,{children:a(`kanban.requiredFieldsTitle`,`Complete required fields`)}),(0,X.jsx)(f,{children:a(`kanban.requiredFieldsDescription`,`This move makes the fields below required. Fill them in to continue.`)})]}),(0,X.jsx)(`div`,{className:`flex flex-col gap-4 py-2`,children:t.map(e=>{let t=P(s[e.name]);return(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`span`,{className:`text-sm font-medium`,children:[e.label,(0,X.jsx)(`span`,{className:`text-destructive ml-0.5`,"aria-hidden":`true`,children:`*`})]}),(0,X.jsx)(p,{field:e.def,value:s[e.name],onChange:t=>c(n=>({...n,[e.name]:t})),readonly:n,error:l&&t?a(`common.required`,`Required`):void 0}),l&&t&&(0,X.jsx)(`span`,{className:`text-xs text-destructive`,children:a(`common.required`,`Required`)})]},e.name)})}),(0,X.jsxs)(m,{children:[(0,X.jsx)(b,{variant:`outline`,onClick:r,disabled:n,children:a(`common.cancel`,`Cancel`)}),(0,X.jsx)(b,{onClick:()=>{if(g.length>0){h(!0);return}i(s)},disabled:n,children:a(`kanban.moveCard`,`Move card`)})]})]})})}var et={"detail.recordDetail":`Record Detail`,"detail.recordDetailWithLabel":`{{label}} Detail`};function tt(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function nt(e,t){return tt(e)?e:t}function rt(e,t){return e==null||tt(e)?null:`[ObjectUI] ObjectKanban fetch batch: ${typeof t==`string`&&t?`object-kanban on ${t}`:`object-kanban`} declared limit: ${String(e)}, which is not a positive integer. A fetch batch must be a positive integer (the spec refuses zero and negative values), so it was ignored and this board fell back to its default fetch batch (100).`}var it=I(et,`detail.recordDetail`);function at(e,t){if(Array.isArray(e)&&e.length>0)return e;let n=t?.highlightFields;return Array.isArray(n)?n.filter(e=>!!t?.fields?.[e]):[]}function ot(e){if(e?.cardTitle)return e.cardTitle;if(e?.titleField)return e.titleField}var st=({schema:e,dataSource:t,className:n,data:r,loading:i,onRowClick:o,onCardClick:s,...c})=>{let l=e,{translateOptions:u,fieldLabel:d}=we(),f=Ce(),{t:p}=it(),m=Array.isArray(r),[g,_]=(0,Y.useState)([]),[v,y]=(0,Y.useState)(!1),b=l.objectName??``,{ready:S,def:C}=Se(b,t),[w,T]=(0,Y.useState)(m?i??!1:!1),[ie,ae]=(0,Y.useState)(null),[O,j]=(0,Y.useState)(0),M=oe(l.bind),N=ne(),[P,F]=(0,Y.useState)(null),fe=!(!m&&!M&&!l.data&&l.objectName&&t&&typeof t.find==`function`)||P!==null&&P.key===b;(0,Y.useEffect)(()=>{if(!m&&t?.onMutation&&l.objectName)return t.onMutation(e=>{e.resource===l.objectName&&j(e=>e+1)})},[t,l.objectName,m]),(0,Y.useEffect)(()=>{m&&i!==void 0&&T(i)},[i,m]),(0,Y.useEffect)(()=>{let e=rt(l.limit,l.objectName);e&&console.warn(e)},[l.limit,l.objectName]);let me=JSON.stringify(l.sort??null),ve=_e(),xe=de(l.filter,ve),I=ue(!m&&!M&&!l.data&&l.objectName||void 0);(0,Y.useEffect)(()=>{if(m||!S)return;let e=!0,n=()=>{e&&F(e=>e!==null&&e.key===b?e:{key:b})};return l.objectName&&!M&&!l.data&&(async()=>{if(!t||typeof t.find!=`function`||!l.objectName){n();return}e&&T(!0);try{let n=le(C?.fields),r=N?.isLoaded?n.filter(e=>N.checkField(l.objectName,e,`read`)):n,i={$filter:xe,$orderby:se(l.sort),$top:nt(l.limit,100),...r.length>0?{$expand:r}:{}},a=await t.find(l.objectName,i),o=he(a);e&&(_(o),y(o.length>=i.$top),ae(null))}catch(t){console.error(`[ObjectKanban] Fetch error:`,t),e&&ae(t)}finally{e&&T(!1),n()}})(),()=>{e=!1}},[l.objectName,b,t,M,l.data,xe,me,l.limit,m,S,C,O,N,I]);let L=(m?r:void 0)||M||l.data||g,Ee=v&&L===g,R=(0,Y.useMemo)(()=>{if(!Array.isArray(L))return[];let e=ot(l),t=ce(C);return L.map(n=>{let r;if(e&&(r=n[e],typeof r==`string`&&(r=r.trim())),!r){let e=A(C,n),t=n.id??n._id;e===`Untitled`||t!=null&&e===`Record #${t}`||(r=e)}let i=e=>e>=1e6?`$${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e}`,a=/^[A-Za-z0-9_-]{12,32}$/,o=e=>{if(typeof e!=`string`||!a.test(e))return!1;let t=/[A-Z]/.test(e),n=/[a-z]/.test(e),r=/[0-9_-]/.test(e);return t&&n||t&&r||n&&r},s=e=>{let t=n[e];if(!k(t)){if(typeof t==`object`){let e=t;for(let t of[`name`,`full_name`,`display_name`,`label`,`title`,`username`]){let n=e[t];if(typeof n==`string`&&n.trim())return n.trim()}return}if(typeof t!=`string`)return String(t);if(!o(t))return t}},c=[],f=at(l.cardFields,C),p=new Set([...e?[e]:[],...t?[t]:[],`name`,`full_name`,`title`,`subject`,`display_name`]),m=[],h=[];if(f.length>0)for(let e of f){if(p.has(e))continue;let t=C?.fields?.[e],r=n[e];if(!k(r)){if(t?.type===`picklist`||t?.type===`multipicklist`||Array.isArray(t?.options)&&t.options.length>0){let n=t?.options?.find(e=>String(e.value).toLowerCase()===String(r).toLowerCase()),i=n?.label||String(r),a=C?.name||l.objectName,o=a?u(a,e,[{value:String(n?.value??r),label:i}])[0]?.label??i:i,s=E(n?.color),c=s?s.className:re(n?.color,r);if(o===``)continue;m.push({label:o,colorClass:c,colorStyle:s?.style})}else{let n=x(t??{type:`text`}),i=te(n),a=(0,X.jsx)(i,{value:r,field:t??{name:e,type:n}});h.push({field:e,label:d(C?.name||l.objectName||``,e,t?.label||e),node:a})}}}else{let e=[`amount`,`value`,`deal_value`,`expected_value`,`opportunity_value`].find(e=>typeof n[e]==`number`);e&&c.push(i(n[e]));let t=[`company`,`company_name`,`account`,`account_name`,`organization`],a;for(let e of t){let t=s(e);if(t){a=t;break}}a&&(!r||!String(r).includes(a))&&c.push(a);let o=[`owner`,`owner_name`,`assignee`,`assignee_name`],l;for(let e of o){let t=s(e);if(t){l=t;break}}l&&c.push(`@${l}`);for(let e of[`priority`,`severity`,`industry`,`rating`]){let t=n[e];if(t!=null&&t!==``){let n=(C?.fields?.[e])?.options?.find(e=>String(e.value).toLowerCase()===String(t).toLowerCase()),r=n?.label||String(t),i=E(n?.color),a=i?i.className:re(n?.color,t);if(r===``)continue;if(m.push({label:r,colorClass:a,colorStyle:i?.style}),m.length>=2)break}}}let g=n.description,_=(k(g)||typeof g==`string`&&o(g))&&c.length>0?c.join(` · `):void 0;return{...n,id:n.id||n._id,title:r||A(C,n),..._?{cardSubtitle:_}:{},...h.length>0?{cardFieldCells:h}:{},...!Array.isArray(n.badges)&&m.length>0?{badges:m}:{}}})},[L,l,C]),z=(0,Y.useMemo)(()=>{let e=e=>{if(!l.objectName||!l.groupBy)return e;let t=u(l.objectName,l.groupBy,[{value:String(e.id),label:e.title}])[0];return t?.label?{...e,title:t.label}:e};if(l.columns&&l.columns.length>0){if(typeof l.columns[0]==`string`){if(!l.groupBy)return l.columns.map(e=>({id:e,title:e}))}else return l.columns.map(e)}if(l.groupBy&&C?.fields?.[l.groupBy]?.options){let e=C.fields[l.groupBy].options.map(e=>({value:e.value,label:e.label}));return(l.objectName?u(l.objectName,l.groupBy,e):e).map(e=>({id:e.value,title:e.label}))}if(l.groupBy&&R.length>0){let e=new Set(R.map(e=>e[l.groupBy]));return Array.from(e).map(e=>({id:String(e),title:String(e)}))}return[]},[l.columns,l.groupBy,l.objectName,R,C,u]),B=l.swimlaneField||l.grouping?.fields?.[0]?.field,V={...l,data:R,columns:z,className:n||l.className,...B?{swimlaneField:B}:{}},H=l.navigation??{mode:`drawer`},U=o??s;!U&&(H.mode===`drawer`||H.mode===`modal`||H.mode===`split`||H.mode);let W=be({navigation:H,objectName:l.objectName,onRowClick:U}),{anchorRef:De,captureAnchor:Oe}=a(),G=l.objectName?p(`detail.recordDetailWithLabel`,{label:l.objectName.charAt(0).toUpperCase()+l.objectName.slice(1).replace(/_/g,` `)}):p(`detail.recordDetail`),K=Y.useCallback(async(e,n,r,i)=>{let a=l.groupBy,o=l.objectName;if(a&&(m||_(t=>t.map(t=>String(t.id??t._id)===String(e)?{...t,[a]:r}:t)),o&&t?.update))try{await t.update(o,String(e),{[a]:r,...i??{}}),i&&!m&&_(t=>t.map(t=>String(t.id??t._id)===String(e)?{...t,...i}:t))}catch(t){console.warn(`[ObjectKanban] Failed to persist card move`,t),Te.error(pe(t)??(ye(t)?f(`errors.unauthorized`,`You are not authorized to perform this action.`):ge(t)??f(`table.saveFailed`,`Save failed`))),_(t=>t.map(t=>String(t.id??t._id)===String(e)?{...t,[a]:n}:t))}},[l.groupBy,l.objectName,t,m,f]),[q,J]=(0,Y.useState)(null),[ke,Ne]=(0,Y.useState)(!1),Pe=Y.useCallback(async(e,t,n,r)=>{let i=l.groupBy;if(!i||t===n||n===`__uncolumned__`)return;let a=(Array.isArray(L)?L:[]).find(t=>String(t?.id??t?._id)===String(e)),o=Qe(C?.fields,a,i,n);if(o.length>0){J({cardId:e,fromColumnId:t,toColumnId:n,fields:o});return}await K(e,t,n)},[l.groupBy,L,C,K]),Z=(0,Y.useMemo)(()=>{if(!q)return[];let e=C?.name||l.objectName||``;return q.fields.map(t=>{let n=t.def.options,r=e&&Array.isArray(n)?u(e,t.name,n):n,i=typeof t.def.label==`string`?t.def.label:``;return{...t,def:{...t.def,...r?{options:r}:{}},label:d(e,t.name,i||t.name)}})},[q,C,l.objectName,u,d]);if(ie)return(0,X.jsxs)(`div`,{className:`p-4 border border-destructive/50 rounded bg-destructive/10 text-destructive`,children:[`Error loading kanban data: `,ie.message]});let Q=e=>{if(!W.isOverlay||!W.isOpen||!W.selectedRecord)return null;let n=l.objectName,r=W.selectedRecord,i=r.id??r._id;if(!n||i==null)return null;let a=ot(l),o=a&&r[a]?String(r[a]):G;return(0,X.jsx)(ee,{...W,title:o,mainContent:e,popoverAnchorRef:De,storageKey:h(n),legacyStorageKey:D(n),width:W.width??`min(960px, 60vw)`,children:()=>(0,X.jsx)(`div`,{className:`px-6 pt-6 pb-6`,children:(0,X.jsx)(Ae,{record:r,objectName:n,recordId:i,dataSource:t,objectSchema:C,onClose:W.close,fullPageHref:je(n,i)??void 0,onFieldSave:async(e,r)=>{t?.update&&(await t.update(n,String(i),{[e]:r}),_(t=>t.map(t=>String(t.id??t._id)===String(i)?{...t,[e]:r}:t)))},onDelete:async()=>{t?.delete&&(await t.delete(n,String(i)),_(e=>e.filter(e=>String(e.id??e._id)!==String(i))))}})})})},$=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Me.Provider,{value:fe,children:(0,X.jsx)(Ze,{objectFields:C?.fields,onCardMove:Pe,schema:{...V,countsAreWindowed:Ee,onCardClick:(e,t)=>{Oe(t),W.handleClick(e,t)}}})}),q&&(0,X.jsx)($e,{open:!0,fields:Z,submitting:ke,onCancel:()=>J(null),onSubmit:async e=>{let t=q;Ne(!0);try{await K(t.cardId,t.fromColumnId,t.toColumnId,e)}finally{Ne(!1),J(null)}}})]});if(W.isOverlay&&W.mode===`split`&&W.isOpen&&W.selectedRecord){let e=Q($);if(e)return(0,X.jsx)(X.Fragment,{children:e})}return(0,X.jsxs)(X.Fragment,{children:[$,Q()]})},ct=(...e)=>e.filter(Boolean).join(` `),lt=({columnId:e,fields:t,onSubmit:n,onCancel:r,defaultValues:i})=>{let[a,o]=Y.useState(()=>{let e={};for(let n of t)e[n.name]=i?.[n.name]??n.defaultValue??``;return e}),s=Y.useRef(null);Y.useEffect(()=>{let e=setTimeout(()=>s.current?.focus(),0);return()=>clearTimeout(e)},[]);let c=Y.useCallback((e,t)=>{o(n=>({...n,[e]:t}))},[]),l=Y.useCallback(()=>{Object.values(a).some(e=>typeof e==`string`?e.trim().length>0:e!=null)&&n(e,a)},[e,a,n]),u=Y.useCallback(e=>{e.key===`Enter`?(e.preventDefault(),l()):e.key===`Escape`&&(e.preventDefault(),r())},[l,r]);return(0,X.jsxs)(`div`,{className:`mt-2 rounded-lg border border-primary/30 bg-card p-3 space-y-2 shadow-sm`,onKeyDown:u,role:`form`,"aria-label":`Quick add card`,children:[t.map((t,n)=>(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`label`,{htmlFor:`qa-${e}-${t.name}`,className:`text-xs text-muted-foreground`,children:t.label??t.name}),ut(t,a[t.name],c,n===0?s:void 0,`qa-${e}-${t.name}`)]},t.name)),(0,X.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,X.jsxs)(b,{type:`button`,size:`sm`,className:`h-7 text-xs gap-1`,onClick:l,children:[(0,X.jsx)(L,{className:`h-3 w-3`}),`Save`]}),(0,X.jsxs)(b,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-xs gap-1`,onClick:r,children:[(0,X.jsx)(B,{className:`h-3 w-3`}),`Cancel`]})]})]})};function ut(e,t,n,r,i){let a=`text-sm h-8`;switch(e.type){case`select`:return(0,X.jsxs)(`select`,{ref:r,id:i,value:t??``,onChange:t=>n(e.name,t.target.value),className:ct(a,`w-full rounded-md border border-input bg-background px-2 py-1 text-sm ring-offset-background`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),children:[(0,X.jsx)(`option`,{value:``,children:e.placeholder??`Select ${e.label??e.name}...`}),(e.options??[]).map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]});case`number`:return(0,X.jsx)(y,{ref:r,id:i,type:`number`,value:t??``,onChange:t=>n(e.name,t.target.value===``?``:Number(t.target.value)),placeholder:e.placeholder??`Enter ${e.label??e.name}...`,className:a});default:return(0,X.jsx)(y,{ref:r,id:i,type:`text`,value:t??``,onChange:t=>n(e.name,t.target.value),placeholder:e.placeholder??`Enter ${e.label??e.name}...`,className:a})}}var dt=(...e)=>e.filter(Boolean).join(` `),ft=({templates:e,onSelect:t,columnId:n})=>{let[r,i]=Y.useState(!1),a=Y.useRef(null);Y.useEffect(()=>{if(!r)return;let e=e=>{a.current&&!a.current.contains(e.target)&&i(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]);let o=Y.useCallback(e=>{e.key===`Escape`&&i(!1)},[]);return(0,X.jsxs)(`div`,{ref:a,className:`relative`,onKeyDown:o,children:[(0,X.jsxs)(b,{variant:`ghost`,size:`sm`,className:`w-full mt-2 text-muted-foreground hover:text-foreground gap-1`,onClick:()=>i(e=>!e),"aria-haspopup":`listbox`,"aria-expanded":r,"aria-label":`Add card to ${n}`,children:[(0,X.jsx)(z,{className:`h-4 w-4`}),`Add Card`,(0,X.jsx)(Ee,{className:dt(`h-3 w-3 transition-transform`,r?`rotate-180`:``)})]}),r&&(0,X.jsxs)(`div`,{className:`absolute z-50 mt-1 w-full rounded-md border border-border bg-popover p-1 shadow-md`,role:`listbox`,"aria-label":`Card templates`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground transition-colors`,role:`option`,"aria-selected":!1,onClick:()=>{t(null),i(!1)},children:[(0,X.jsx)(z,{className:`h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`span`,{className:`font-mono text-xs`,children:`Custom`})]}),e.length>0&&(0,X.jsx)(`div`,{className:`my-1 h-px bg-border`,role:`separator`}),e.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground transition-colors`,role:`option`,"aria-selected":!1,onClick:()=>{t(e),i(!1)},children:[(0,X.jsx)(R,{className:`h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`span`,{className:`font-mono text-xs truncate`,children:e.name})]},e.id))]})]})};function pt({swimlanes:e,onCardMove:t}){let[n,r]=(0,Y.useState)(null),i=(0,Y.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n);return t},[e]),a=(0,Y.useCallback)((e,t)=>{if(e===t)return!0;let n=i.get(t);return n?!n.acceptFrom||n.acceptFrom.includes(e):!1},[i]),o=(0,Y.useCallback)((e,n,i,o)=>a(n,i)?(t?.({cardId:e,fromSwimlane:n,toSwimlane:i,columnId:o}),r(null),!0):!1,[a,t]),s=(0,Y.useCallback)(e=>{r(e)},[]),c=(0,Y.useCallback)(()=>{r(null)},[]);return{handleCrossSwimlaneMove:o,isDraggingAcrossSwimlanes:n!==null,startCrossSwimlaneDrag:s,endCrossSwimlaneDrag:c,canMoveTo:a}}function mt({cards:e,onReorderComplete:t}){let[n,r]=(0,Y.useState)(e),[i,a]=(0,Y.useState)(!1);!ht(n,e)&&!i&&r(e);let o=(0,Y.useCallback)(()=>{r(e),a(!1)},[e]);return{reorderedCards:n,onReorder:(0,Y.useCallback)((e,t)=>{r(n=>{if(e<0||t<0||e>=n.length||t>=n.length)return n;let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r})},[]),isDragging:i,startDrag:(0,Y.useCallback)(()=>{a(!0)},[]),endDrag:(0,Y.useCallback)(()=>{a(!1),r(e=>(t?.(e),e))},[t]),reset:o}}function ht(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n].id!==t[n].id)return!1;return!0}var gt=t({CardTemplates:()=>ft,InlineQuickAdd:()=>lt,KANBAN_UNCOLUMNED_ID:()=>_t,KanbanRenderer:()=>bt,ObjectKanban:()=>st,ObjectKanbanRenderer:()=>wt,bucketCardsIntoColumns:()=>yt,kanbanComponents:()=>xt,useCrossSwimlaneMove:()=>pt,useQuickAddReorder:()=>mt}),_t=`__uncolumned__`;function vt(e,t,n,r){let i=e.filter(e=>e!==``);if(i.length===0)return;let a=e=>typeof e==`string`?JSON.stringify(e):String(e),o=n.map(e=>a(e.id)).join(`, `);for(let e of i)console.warn(`[plugin-kanban] ${t[e].length} record(s) with ${JSON.stringify(r)} = ${JSON.stringify(e)} match no lane id and are shown in the trailing "Uncategorized" lane. Lanes match the stored option value by lane id only, never by lane title (objectui#10069). Available lane ids: [${o}].`)}function yt(e,t,n,r,i){let a=e=>{if(!r)return e;let t=e[r];if(!t)return e;let n=typeof t==`string`?t:t?.url;return n?{...e,coverImage:n}:e};if(!t||!n||!Array.isArray(t))return e.map(e=>({...e,cards:(e.cards||[]).map(a)}));let o=Object.create(null);e.forEach(e=>{e.id&&(o[String(e.id).toLowerCase()]=e.id)});let s=t.reduce((e,t)=>{let r=String(t[n]??``),i=o[r.toLowerCase()]??r;return e[i]||(e[i]=[]),e[i].push(a(t)),e},Object.create(null)),c=e.map(e=>({...e,cards:[...(e.cards||[]).map(a),...s[e.id]||[]]})),l=new Set(e.map(e=>typeof e.id==`symbol`?e.id:String(e.id))),u=Object.keys(s).filter(e=>!l.has(e)),d=u.flatMap(e=>s[e]);return vt(u,s,e,n),d.length>0&&c.push({id:_t,title:i,cards:d}),c}var bt=({schema:e,objectFields:t,onCardMove:n})=>(0,X.jsx)(Ze,{schema:e,objectFields:t,onCardMove:n,quickAdd:e.quickAdd,onQuickAdd:e.onQuickAdd}),xt={"object-kanban":st},St={filter:!0,sort:!0,limit:`limit`},Ct=e=>Array.isArray(e)&&e.some(e=>Array.isArray(e?.cards)),wt=O(({schema:e,...t})=>{let{dataSource:n}=me()||{},r=n??void 0;return(0,X.jsx)(xe,{schema:e,mapping:St,dataSource:r,testId:`object-kanban`,errorTitle:`This board’s data source could not be resolved`,requiresObject:e?.data==null&&e?.bind==null&&!Array.isArray(t.data)&&!Ct(e?.columns),children:e=>(0,X.jsx)(st,{schema:e,dataSource:r,...t})})});N.register(`object-kanban`,wt,{namespace:`plugin-kanban`,label:`Object Kanban`,category:`view`,inputs:[{name:`objectName`,type:`string`,description:"Object this board lists. Not required: the node's `dataSource` binding can name the object instead, and `dataSource.object` lands on this key, outranking an authored value. With neither, and no rows from `data`, `bind` or a parent view, the board shows a hint naming this key instead of an empty board."},{name:`columns`,type:`array`},{name:`filter`,type:`array`,description:"Filter criteria in JSON-rules form, narrowing the records the board fetches. Lowered to `$filter` on the query."},{name:`limit`,type:`number`,description:"Row cap — the most records the board fetches, lowered to the query’s top-level `$top` (renderer default 100). The board renders every fetched record into a lane and offers no pagination, so this is the author’s window on the object rather than a page size. PRECEDENCE: a node-level `dataSource` binding’s own `limit` wins outright; the `pagination.pageSize` of a view that binding names fills this key only when the node leaves it unset."},{name:`groupBy`,type:`string`,description:"Record field whose value buckets cards into lanes. Its picklist options become the lanes when `columns` is absent, and a drag between lanes writes the target lane’s value back to the record. A value matching no lane lands in the trailing “Uncategorized” lane rather than disappearing."},{name:`cardTitle`,type:`string`,description:"Record field rendered as the card title. Read AHEAD of `titleField`, which is the legacy spelling of the same choice; when neither yields a value the shared record-display resolver names the card."},{name:`titleField`,type:`string`,description:"Legacy spelling of `cardTitle` — the record field rendered as the card title. `cardTitle` wins when both are authored."},{name:`swimlaneField`,type:`string`,description:"Record field that splits the board into horizontal swimlanes. When absent the board falls back to `grouping.fields[0].field`."},{name:`coverImageField`,type:`string`,description:"Record field holding a card cover image — a URL string, or a file object carrying a `url`. Any other value leaves the card without a cover."},{name:`data`,type:`array`,description:"Inline records to render instead of fetching. Authoring it SUPPRESSES the board’s own query entirely. Members are records: the board reads `id` (or `_id`) as the card identity, the `groupBy` field’s value as the lane, the card-title field, `coverImageField`, and every `cardFields` entry. Records handed down by a parent view and a `bind` expression both take priority over it."},{name:`cardFields`,type:`array`,description:"Record field NAMES rendered as cells on each card, in the order written. Members are bare names, not entry objects. An explicit list wins over the object’s `highlightFields` role; unlike that fallback it is NOT filtered against the object definition, so a name the object no longer declares simply renders no cell. An empty array reads as omitted."},{name:`grouping`,type:`object`,description:"Only `grouping.fields[0].field` is read, and only as the FALLBACK for `swimlaneField`: it names the record field that splits the board into horizontal swimlanes when no `swimlaneField` is authored. An explicit `swimlaneField` wins. Every other position inside `grouping`, later `fields` entries included, is inert on this board."},{name:`conditionalFormatting`,type:`array`,description:"Per-card style rules, each `{ condition, style }` — a CEL `condition` over the card’s own `record.*` and a CSS `style` map, the rule a list view declares. The first matching rule styles that card alone. A rule comparing a relation field sees the stored foreign key rather than the expanded record. The native `{ field, operator, value }` rule and a colour written beside `condition` instead of inside `style` are retired and refused by name (objectui#11522)."},{name:`navigation`,type:`object`,description:"What a card click opens — the `{ mode, size, openNewTab, preventNavigation }` block a list view declares. With the key ABSENT a click opens the record in a drawer. `mode` is an overlay (`drawer`, `modal`, `split`, `popover`), `new_window`, `page` or `none`, and a block written without `mode` takes the spec’s `page` default. `page` opens the record page through the record navigator the host publishes (the console publishes one on its custom pages, record pages and list views); under a host that publishes none, such as an embedded renderer, there is no record page to open and the click opens nothing. `openNewTab: true` opens the record page in a new tab and outranks every mode except `none`, `preventNavigation: true` opens nothing, and `size` sets the overlay width. A click handler from a parent view outranks the whole key."}]});export{gt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{_ as n,h as r,t as i,v as a}from"./vendor-react-BggL7APJ.js";import{An as o,Si as s,bt as c,et as l}from"./ui-components-D8wcRNrt.js";import{$i as u,Bt as ee,Fr as te,Lr as ne,Or as d,Qi as f,Qn as re,Yr as ie,_ as ae,dt as oe,ei as se,jt as ce,n as le,pt as ue,st as de,ti as fe,u as pe,y as me,zt as he}from"./framework-CAuH4h0L.js";import{t as ge}from"./types-zod-ChJ30y25.js";var p=e(a(),1),_e=p.createContext(null);function m(e,t){let n=Array.isArray(e)?e[0]:e?e.x:0,r=Array.isArray(e)?e[1]:e?e.y:0,i=Array.isArray(t)?t[0]:t?t.x:0,a=Array.isArray(t)?t[1]:t?t.y:0;return n===i&&r===a}function h(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!h(e[n],t[n]))return!1;return!0}if(Array.isArray(t))return!1;if(typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!t.hasOwnProperty(r)||!h(e[r],t[r]))return!1;return!0}return!1}function g(e){return{center:e.getCenter(),zoom:e.getZoom(),bearing:e.getBearing(),pitch:e.getPitch(),elevation:e.getCenterElevation?.()??0,padding:e.getPadding()}}function _(e){return{longitude:e.center.lng,latitude:e.center.lat,zoom:e.zoom,pitch:e.pitch,bearing:e.bearing,padding:e.padding}}function ve(e,t){let n=t.viewState||t,r={};if(`longitude`in n&&`latitude`in n&&(n.longitude!==e.center.lng||n.latitude!==e.center.lat)){let t=e.center.constructor;r.center=new t(n.longitude,n.latitude)}return`zoom`in n&&n.zoom!==e.zoom&&(r.zoom=n.zoom),`bearing`in n&&n.bearing!==e.bearing&&(r.bearing=n.bearing),`pitch`in n&&n.pitch!==e.pitch&&(r.pitch=n.pitch),n.padding&&e.padding&&!h(n.padding,e.padding)&&(r.padding=n.padding),r}function v(e,t,n,r){return e.min===t.min&&e.max===t.max?!1:(e.min>=t.min?(e.max!==t.max&&r(e.max),e.min!==t.min&&n(e.min)):(e.min!==t.min&&n(e.min),e.max!==t.max&&r(e.max)),!0)}function y(e,t,n){return v(t,n,t=>e.setMinZoom(t),t=>e.setMaxZoom(t))}function b(e,t,n){return v(t,n,t=>e.setMinPitch(t),t=>e.setMaxPitch(t))}var ye=[`type`,`source`,`source-layer`,`minzoom`,`maxzoom`,`filter`,`layout`];function x(e){if(!e)return null;if(typeof e==`string`||(`toJS`in e&&(e=e.toJS()),!e.layers))return e;let t={};for(let n of e.layers)t[n.id]=n;let n=e.layers.map(e=>{let n=null;`interactive`in e&&(n=Object.assign({},e),delete n.interactive);let r=t[e.ref];if(r){n||=Object.assign({},e),delete n.ref;for(let e of ye)e in r&&(n[e]=r[e])}return n||e});return{...e,layers:n}}var S={version:8,sources:{},layers:[]},C={minZoom:0,maxZoom:22,minPitch:0,maxPitch:85,maxBounds:[-180,-85.051129,180,85.051129],projection:`mercator`,renderWorldCopies:!0},be={mousedown:`onMouseDown`,mouseup:`onMouseUp`,mouseover:`onMouseOver`,mousemove:`onMouseMove`,click:`onClick`,dblclick:`onDblClick`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,mouseout:`onMouseOut`,contextmenu:`onContextMenu`,touchstart:`onTouchStart`,touchend:`onTouchEnd`,touchmove:`onTouchMove`,touchcancel:`onTouchCancel`},w={movestart:`onMoveStart`,move:`onMove`,moveend:`onMoveEnd`,dragstart:`onDragStart`,drag:`onDrag`,dragend:`onDragEnd`,zoomstart:`onZoomStart`,zoom:`onZoom`,zoomend:`onZoomEnd`,rotatestart:`onRotateStart`,rotate:`onRotate`,rotateend:`onRotateEnd`,pitchstart:`onPitchStart`,pitch:`onPitch`,pitchend:`onPitchEnd`},T={wheel:`onWheel`,boxzoomstart:`onBoxZoomStart`,boxzoomend:`onBoxZoomEnd`,boxzoomcancel:`onBoxZoomCancel`,resize:`onResize`,load:`onLoad`,render:`onRender`,idle:`onIdle`,remove:`onRemove`,data:`onData`,styledata:`onStyleData`,sourcedata:`onSourceData`,error:`onError`},xe=[`maxBounds`,`projection`,`renderWorldCopies`],E=[`scrollZoom`,`boxZoom`,`dragRotate`,`dragPan`,`keyboard`,`doubleClickZoom`,`touchZoomRotate`,`touchPitch`],D=class e{constructor(e,t,n){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=e=>{let t=this.props[T[e.type]];t?t(e):e.type===`error`&&console.error(e.error)},this._onCameraEvent=e=>{if(this._internalUpdate)return;e.viewState=this._propsedCameraUpdate||_(g(this._map));let t=this.props[w[e.type]];t&&t(e)},this._onCameraUpdate=e=>this._internalUpdate?e:(this._propsedCameraUpdate=_(e),ve(e,this.props)),this._onPointerEvent=e=>{(e.type===`mousemove`||e.type===`mouseout`)&&this._updateHover(e);let t=this.props[be[e.type]];t&&(this.props.interactiveLayerIds&&e.type!==`mouseover`&&e.type!==`mouseout`&&(e.features=this._hoveredFeatures||this._queryRenderedFeatures(e.point)),t(e),delete e.features)},this._MapClass=e,this.props=t,this._initialize(n)}get map(){return this._map}setProps(e){let t=this.props;this.props=e;let n=this._updateSettings(e,t),r=this._updateSize(e),i=this._updateViewState(e);this._updateStyle(e,t),this._updateStyleComponents(e),this._updateHandlers(e,t),(n||r||i&&!this._map.isMoving())&&this.redraw()}static reuse(t,n){let r=e.savedMaps.pop();if(!r)return null;let i=r.map,a=i.getContainer();for(n.className=a.className;a.childNodes.length>0;)n.appendChild(a.childNodes[0]);i._container=n;let o=i._resizeObserver;o&&(o.disconnect(),o.observe(n)),r.setProps({...t,styleDiffing:!1}),i.resize();let{initialViewState:s}=t;return s&&(s.bounds?i.fitBounds(s.bounds,{...s.fitBoundsOptions,duration:0}):r._updateViewState(s)),i.isStyleLoaded()?i.fire(`load`):i.once(`style.load`,()=>i.fire(`load`)),i._update(),r}_initialize(e){let{props:t}=this,{mapStyle:n=S}=t,r={...t,...t.initialViewState,container:e,style:x(n)},i=r.initialViewState||r.viewState||r;if(Object.assign(r,{center:[i.longitude||0,i.latitude||0],zoom:i.zoom||0,pitch:i.pitch||0,bearing:i.bearing||0}),t.gl){let e=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=e,t.gl)}let a=new this._MapClass(r);i.padding&&a.setPadding(i.padding),t.cursor&&(a.getCanvas().style.cursor=t.cursor);let o=a;typeof o.setTransformCameraUpdate==`function`?o.setTransformCameraUpdate(this._onCameraUpdate):o.transformCameraUpdate=this._onCameraUpdate,a.on(`style.load`,()=>{this._styleComponents={light:a.getLight(),sky:a.getSky(),projection:a.getProjection?.(),terrain:a.getTerrain()},this._updateStyleComponents(this.props)}),a.on(`sourcedata`,()=>{this._updateStyleComponents(this.props)});for(let e in be)a.on(e,this._onPointerEvent);for(let e in w)a.on(e,this._onCameraEvent);for(let e in T)a.on(e,this._onEvent);this._map=a}recycle(){this.map.getContainer().querySelector(`[mapboxgl-children]`)?.remove(),e.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){let e=this._map;e.style&&(e._frame&&=(e._frame.cancel(),null),e._render())}_updateSize(e){let{viewState:t}=e;if(t){let e=this._map,n=e.getCanvas();if(t.width!==n.clientWidth||t.height!==n.clientHeight)return e.resize(),!0}return!1}_updateViewState(e){let t=this._map,n=g(t);if(!t.isMoving()){let r=ve(n,e);if(Object.keys(r).length>0)return this._internalUpdate=!0,t.jumpTo(r),this._internalUpdate=!1,!0}return!1}_updateConstraints(e,t){let n=y(this._map,{min:e.minZoom??C.minZoom,max:e.maxZoom??C.maxZoom},{min:t.minZoom??C.minZoom,max:t.maxZoom??C.maxZoom}),r=b(this._map,{min:e.minPitch??C.minPitch,max:e.maxPitch??C.maxPitch},{min:t.minPitch??C.minPitch,max:t.maxPitch??C.maxPitch});return n||r}_updateSettings(e,t){let n=this._map,r=!1;for(let i of xe)if((i in e||i in t)&&!h(e[i],t[i])){r=!0;let t=i in e?e[i]:C[i];n[`set${i[0].toUpperCase()}${i.slice(1)}`]?.call(n,t)}let i=this._updateConstraints(e,t);return r||i}_updateStyle(e,t){if(e.cursor!==t.cursor&&(this._map.getCanvas().style.cursor=e.cursor||``),e.mapStyle!==t.mapStyle){let{mapStyle:t=S,styleDiffing:n=!0}=e,r={diff:n};`localIdeographFontFamily`in e&&(r.localIdeographFontFamily=e.localIdeographFontFamily),this._map.setStyle(x(t),r)}}_updateStyleComponents({light:e,projection:t,sky:n,terrain:r}){let i=this._map,a=this._styleComponents;i.style?._loaded&&(e&&!h(e,a.light)&&(a.light=e,i.setLight(e)),t&&!h(t,a.projection)&&t!==a.projection?.type&&(a.projection=typeof t==`string`?{type:t}:t,i.setProjection?.(a.projection)),n&&!h(n,a.sky)&&(a.sky=n,i.setSky(n)),r!==void 0&&!h(r,a.terrain)&&(!r||i.getSource(r.source))&&(a.terrain=r,i.setTerrain(r)))}_updateHandlers(e,t){let n=this._map;for(let r of E){let i=e[r]??!0;h(i,t[r]??!0)||(i?n[r].enable(i):n[r].disable())}}_queryRenderedFeatures(e){let t=this._map,{interactiveLayerIds:n=[]}=this.props;try{return t.queryRenderedFeatures(e,{layers:n.filter(t.getLayer.bind(t))})}catch{return[]}}_updateHover(e){let{props:t}=this;if(t.interactiveLayerIds&&(t.onMouseMove||t.onMouseEnter||t.onMouseLeave)){let t=e.type,n=this._hoveredFeatures?.length>0,r=this._queryRenderedFeatures(e.point),i=r.length>0;!i&&n&&(e.type=`mouseleave`,this._onPointerEvent(e)),this._hoveredFeatures=r,i&&!n&&(e.type=`mouseenter`,this._onPointerEvent(e)),e.type=t}else this._hoveredFeatures=null}};D.savedMaps=[];var Se=[`setMaxBounds`,`setMinZoom`,`setMaxZoom`,`setMinPitch`,`setMaxPitch`,`setRenderWorldCopies`,`setProjection`,`setStyle`,`addSource`,`removeSource`,`addLayer`,`removeLayer`,`setLayerZoomRange`,`setFilter`,`setPaintProperty`,`setLayoutProperty`,`setLight`,`setTerrain`,`setFog`,`remove`];function Ce(e){if(!e)return null;let t=e.map,n={getMap:()=>t};for(let e of we(t))!(e in n)&&!Se.includes(e)&&(n[e]=t[e].bind(t));return n}function we(e){let t=new Set,n=e;for(;n;){for(let r of Object.getOwnPropertyNames(n))r[0]!==`_`&&typeof e[r]==`function`&&r!==`fire`&&r!==`setEventedParent`&&t.add(r);n=Object.getPrototypeOf(n)}return Array.from(t)}var O=typeof document<`u`?p.useLayoutEffect:p.useEffect;function k(e,t){let{RTLTextPlugin:n,maxParallelImageRequests:r,workerCount:i,workerUrl:a}=t;if(n&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()===`unavailable`){let{pluginUrl:t,lazy:r=!0}=typeof n==`string`?{pluginUrl:n}:n;e.setRTLTextPlugin(t,e=>{e&&console.error(e)},r)}r!==void 0&&e.setMaxParallelImageRequests(r),i!==void 0&&e.setWorkerCount(i),a!==void 0&&e.setWorkerUrl(a)}var A=p.createContext(null);function j(e,t){let n=(0,p.useContext)(_e),[i,a]=(0,p.useState)(null),o=(0,p.useRef)(),{current:s}=(0,p.useRef)({mapLib:null,map:null});(0,p.useEffect)(()=>{let t=e.mapLib,i=!0,c;return Promise.resolve(t||r(()=>import(`./maplibre-gl-Dw-skPj7.js`),[],import.meta.url)).then(t=>{if(!i)return;if(!t)throw Error(`Invalid mapLib`);let r=`Map`in t?t:t.default;if(!r.Map)throw Error(`Invalid mapLib`);k(r,e),e.reuseMaps&&(c=D.reuse(e,o.current)),c||=new D(r.Map,e,o.current),s.map=Ce(c),s.mapLib=r,a(c),n?.onMapMount(s.map,e.id)}).catch(t=>{let{onError:n}=e;n?n({type:`error`,target:null,originalEvent:null,error:t}):console.error(t)}),()=>{i=!1,c&&(n?.onMapUnmount(e.id),e.reuseMaps?c.recycle():c.destroy())}},[]),O(()=>{i&&i.setProps(e)}),(0,p.useImperativeHandle)(t,()=>s.map,[i]);let c=(0,p.useMemo)(()=>({position:`relative`,width:`100%`,height:`100%`,...e.style}),[e.style]);return p.createElement(`div`,{id:e.id,ref:o,style:c},i&&p.createElement(A.Provider,{value:s},p.createElement(`div`,{"mapboxgl-children":``,style:{height:`100%`}},e.children)))}var Te=p.forwardRef(j),M=e(n(),1),N=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function P(e,t){if(!e||!t)return;let n=e.style;for(let e in t){let r=t[e];n[e]=Number.isFinite(r)&&!N.test(e)?`${r}px`:r}}function F(e,t){if(e===t)return null;let n=I(e),r=I(t),i=[];for(let e of r)n.has(e)||i.push(e);for(let e of n)r.has(e)||i.push(e);return i.length===0?null:i}function I(e){return new Set(e?e.trim().split(/\s+/):[])}var Ee=(0,p.memo)((0,p.forwardRef)((e,t)=>{let{map:n,mapLib:r}=(0,p.useContext)(A),i=(0,p.useRef)({props:e}),a=(0,p.useMemo)(()=>{let t=!1;p.Children.forEach(e.children,e=>{e&&(t=!0)});let n={...e,element:t?document.createElement(`div`):void 0},o=new r.Marker(n);return o.setLngLat([e.longitude,e.latitude]),o.getElement().addEventListener(`click`,e=>{i.current.props.onClick?.({type:`click`,target:o,originalEvent:e})}),o.on(`dragstart`,e=>{let t=e;t.lngLat=a.getLngLat(),i.current.props.onDragStart?.(t)}),o.on(`drag`,e=>{let t=e;t.lngLat=a.getLngLat(),i.current.props.onDrag?.(t)}),o.on(`dragend`,e=>{let t=e;t.lngLat=a.getLngLat(),i.current.props.onDragEnd?.(t)}),o},[]);(0,p.useEffect)(()=>(a.addTo(n.getMap()),()=>{a.remove()}),[]);let{longitude:o,latitude:s,offset:c,style:l,draggable:u=!1,popup:ee=null,rotation:te=0,rotationAlignment:ne=`auto`,pitchAlignment:d=`auto`}=e;(0,p.useEffect)(()=>{P(a.getElement(),l)},[l]),(0,p.useImperativeHandle)(t,()=>a,[]);let f=i.current.props;(a.getLngLat().lng!==o||a.getLngLat().lat!==s)&&a.setLngLat([o,s]),c&&!m(a.getOffset(),c)&&a.setOffset(c),a.isDraggable()!==u&&a.setDraggable(u),a.getRotation()!==te&&a.setRotation(te),a.getRotationAlignment()!==ne&&a.setRotationAlignment(ne),a.getPitchAlignment()!==d&&a.setPitchAlignment(d),a.getPopup()!==ee&&a.setPopup(ee);let re=F(f.className,e.className);if(re)for(let e of re)a.toggleClassName(e);return i.current.props=e,(0,M.createPortal)(e.children,a.getElement())})),De=(0,p.memo)((0,p.forwardRef)((e,t)=>{let{map:n,mapLib:r}=(0,p.useContext)(A),i=(0,p.useMemo)(()=>document.createElement(`div`),[]),a=(0,p.useRef)({props:e}),o=(0,p.useMemo)(()=>{let t={...e},n=new r.Popup(t);return n.setLngLat([e.longitude,e.latitude]),n.once(`open`,e=>{a.current.props.onOpen?.(e)}),n},[]);if((0,p.useEffect)(()=>{let e=e=>{a.current.props.onClose?.(e)};return o.on(`close`,e),o.setDOMContent(i).addTo(n.getMap()),()=>{o.off(`close`,e),o.isOpen()&&o.remove()}},[]),(0,p.useEffect)(()=>{P(o.getElement(),e.style)},[e.style]),(0,p.useImperativeHandle)(t,()=>o,[]),o.isOpen()){let t=a.current.props;(o.getLngLat().lng!==e.longitude||o.getLngLat().lat!==e.latitude)&&o.setLngLat([e.longitude,e.latitude]),e.offset&&!h(t.offset,e.offset)&&o.setOffset(e.offset),(t.anchor!==e.anchor||t.maxWidth!==e.maxWidth)&&(o.options.anchor=e.anchor,o.setMaxWidth(e.maxWidth));let n=F(t.className,e.className);if(n)for(let e of n)o.toggleClassName(e);a.current.props=e}return(0,M.createPortal)(e.children,i)}));function L(e,t,n,r){let i=(0,p.useContext)(A),a=(0,p.useMemo)(()=>e(i),[]);return(0,p.useEffect)(()=>{let e=r||n||t,o=typeof t==`function`&&typeof n==`function`?t:null,s=typeof n==`function`?n:typeof t==`function`?t:null,{map:c}=i;return c.hasControl(a)||(c.addControl(a,e?.position),o&&o(i)),()=>{s&&s(i),c.hasControl(a)&&c.removeControl(a)}},[]),a}function R(e){let t=L(({mapLib:t})=>new t.AttributionControl(e),{position:e.position});return(0,p.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}(0,p.memo)(R);function z(e){let t=L(({mapLib:t})=>new t.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return(0,p.useEffect)(()=>{P(t._controlContainer,e.style)},[e.style]),null}(0,p.memo)(z);function Oe(e,t){let n=(0,p.useRef)({props:e}),r=L(({mapLib:t})=>{let r=new t.GeolocateControl(e),i=r._setupUI;return r._setupUI=()=>{r._container.hasChildNodes()||i()},r.on(`geolocate`,e=>{n.current.props.onGeolocate?.(e)}),r.on(`error`,e=>{n.current.props.onError?.(e)}),r.on(`outofmaxbounds`,e=>{n.current.props.onOutOfMaxBounds?.(e)}),r.on(`trackuserlocationstart`,e=>{n.current.props.onTrackUserLocationStart?.(e)}),r.on(`trackuserlocationend`,e=>{n.current.props.onTrackUserLocationEnd?.(e)}),r},{position:e.position});return n.current.props=e,(0,p.useImperativeHandle)(t,()=>r,[]),(0,p.useEffect)(()=>{P(r._container,e.style)},[e.style]),null}(0,p.memo)((0,p.forwardRef)(Oe));function ke(e){let t=L(({mapLib:t})=>new t.NavigationControl(e),{position:e.position});return(0,p.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}var Ae=(0,p.memo)(ke);function B(e){let t=L(({mapLib:t})=>new t.ScaleControl(e),{position:e.position}),n=(0,p.useRef)(e),r=n.current;n.current=e;let{style:i}=e;return e.maxWidth!==void 0&&e.maxWidth!==r.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==r.unit&&t.setUnit(e.unit),(0,p.useEffect)(()=>{P(t._container,i)},[i]),null}(0,p.memo)(B);function je(e){let t=L(({mapLib:t})=>new t.TerrainControl(e),{position:e.position});return(0,p.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}(0,p.memo)(je);function V(e){let t=L(({mapLib:t})=>new t.LogoControl(e),{position:e.position});return(0,p.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}(0,p.memo)(V);function H(e){let t=L(({mapLib:t})=>{let n=t.GlobeControl;if(!n)throw Error(`GlobeControl is not supported by this version of MapLibre GL JS`);return new n(e)},{position:e.position});return(0,p.useEffect)(()=>{P(t._container,e.style)},[e.style]),null}(0,p.memo)(H);function U(e){return e>=-180&&e<180?e:((e+180)%360+360)%360-180}var W=e=>Math.min(85,Math.max(-85,e));function Me(e){if(e.length===0)return null;let t=e.map(([e])=>U(e)).sort((e,t)=>e-t),n=e.map(([,e])=>W(e)),r=t.length,i=t[0]+360-t[r-1],a=0;for(let e=1;e<r;e++){let n=t[e]-t[e-1];n>i&&(i=n,a=e)}let o=t[a],s=t[(a+r-1)%r],c=a===0?s:s+360;return[[o,Math.min(...n)],[c,Math.max(...n)]]}function Ne(e){let[[t,n],[r,i]]=e;return{longitude:U((t+r)/2),latitude:(n+i)/2}}var G=i(),Pe=`https://demotiles.maplibre.org/style.json`,K=Object.keys(ge.shape).filter(e=>e!==`style`);function Fe(e){return he(e,`view-data`)}var q=()=>!1,Ie=new Set;function J(e){if(!q())return;let t=e.filter;if(!t||typeof t!=`object`||Array.isArray(t)||!Object.prototype.hasOwnProperty.call(t,`map`))return;let n=t.map;if(!n||typeof n!=`object`)return;let r;try{r=`${e.type??`map`}::${e.objectName??``}::${JSON.stringify(n)}`}catch{r=`${e.type??`map`}::${e.objectName??``}::<unserializable>`}Ie.has(r)||(Ie.add(r),console.warn("[ObjectMap] `filter.map` is no longer read as map configuration, so this map has NO coordinate binding and renders the \"Map configuration required\" refusal (objectui#8169 — the `latitude` / `longitude` / `location` defaults are gone). `filter` is the query filter; the map config belongs under the declared `map` input — move it to `schema.map` (`{ type: 'object-map', map: { latitudeField, longitudeField, titleField } }`). The old spelling was never documented and could not survive a `dataSource` binding, whose merged filter is an `and` node with no `map` key at all (objectstack#7121). If `map` is genuinely a field you are filtering on, ignore this — the filter itself is passed through untouched. objectui#4034."))}var Y=new Set;function Le(e){if(!q())return;let t=e.style;if(typeof t!=`string`||t===``)return;let n=`${e.type??`map`}::${e.objectName??``}::${t}`;Y.has(n)||(Y.add(n),console.warn(`[ObjectMap] A top-level \`style\` is NOT read as a map style, so this map is rendering with the DEFAULT public demo tiles and \`${t}\` was dropped. \`style\` is the base schema's INLINE CSS key (a record of CSS properties), which every node may carry; the map style is \`mapStyle\` — named that way precisely to avoid this collision. Write \`mapStyle: '${t}'\` at the top level, or \`map: { style: '${t}' }\` in the declared config block. On a view, write that same declared \`map: { style: ... }\`: ObjectView / ListView flatten \`options.map\` through a whitelist of the keys \`ObjectMapConfigSchema\` declares, and that whitelist carries \`style\` out under the flat spelling \`mapStyle\` (objectui#9950), so the declared block arrives and is read. \`mapStyle\` is the TOP-LEVEL spelling only — inside the \`map\` block it is undeclared, and the flatten drops it. objectui#5017.`))}var X=new Set;function Z(e){if(!q())return;let t=K.filter(t=>e[t]!==void 0);if(t.length===0)return;let n=`${e.type??`map`}::${e.objectName??``}::${t.join(`,`)}`;X.has(n)||(X.add(n),console.warn(`[ObjectMap] The \`map\` block configures this map, so these top-level keys are IGNORED: ${t.map(e=>`\`${e}\``).join(`, `)}. The \`map\` block is the authoring shape; the flat top-level spelling is the internal form ObjectView/ListView produce when they flatten \`options.map\`, and what the author wrote outranks it. Move anything you still need into \`map\`, or drop the \`map\` block. objectui#5018.`))}function Re(e){J(e),Le(e);let t=e.mapStyle||e.map?.style,n=e.map??null;if(n){let r=ge.safeParse(n);return r.success||console.warn(`[ObjectMap] Invalid map configuration:`,r.error.format()),Z(e),{...n,style:t}}return e.locationField||e.latitudeField?{locationField:e.locationField,latitudeField:e.latitudeField,longitudeField:e.longitudeField,titleField:e.titleField,descriptionField:e.descriptionField,zoom:e.zoom,center:e.center,style:t}:{style:t}}function ze(e){return!!e.locationField||!!(e.latitudeField&&e.longitudeField)}function Be(e,t){if(t.latitudeField&&t.longitudeField){let n=e[t.latitudeField],r=e[t.longitudeField];if(typeof n==`number`&&typeof r==`number`)return[n,r]}if(t.locationField){let n=e[t.locationField];if(typeof n==`object`&&n){let e=n.lat||n.latitude,t=n.lng||n.lon||n.longitude;if(typeof e==`number`&&typeof t==`number`)return[e,t]}if(typeof n==`string`){let e=n.split(`,`).map(e=>parseFloat(e.trim()));if(e.length===2&&!isNaN(e[0])&&!isNaN(e[1]))return[e[0],e[1]]}if(Array.isArray(n)&&n.length===2){let e=parseFloat(n[0]),t=parseFloat(n[1]);if(!isNaN(e)&&!isNaN(t))return[e,t]}}return null}function Ve(e,t,n=50){if(e.length<=1||t>=15)return e.map(e=>({id:e.id,coordinates:e.coordinates,markers:[e],isCluster:!1}));let r=n/2**t,i=new Map;e.forEach(e=>{let t=`${Math.floor(e.coordinates[0]/r)}:${Math.floor(e.coordinates[1]/r)}`;i.has(t)||i.set(t,[]),i.get(t).push(e)});let a=[];return i.forEach((e,t)=>{if(e.length===1)a.push({id:e[0].id,coordinates:e[0].coordinates,markers:e,isCluster:!1});else{let n=e.reduce((e,t)=>e+t.coordinates[0],0)/e.length,r=e.reduce((e,t)=>e+t.coordinates[1],0)/e.length;a.push({id:`cluster-${t}`,coordinates:[n,r],markers:e,isCluster:!0})}}),a}var Q=({schema:e,dataSource:t,className:n,data:r,onMarkerClick:i,onRowClick:a,onEdit:u,onDelete:f,enableClustering:ce,clusterRadius:pe=50})=>{let[he,ge]=(0,p.useState)([]),[_e,m]=(0,p.useState)(!0),[h,g]=(0,p.useState)(null),[_,ve]=(0,p.useState)(null),[v,y]=(0,p.useState)(null),[b,ye]=(0,p.useState)(``),x=o(),S=(0,p.useRef)(null),[C,be]=(0,p.useState)(null),[w,T]=(0,p.useState)(null),[xe,E]=(0,p.useState)(!1),[D,Se]=(0,p.useState)(null),Ce=(0,p.useCallback)(e=>{Se(e?.error?.message||`Failed to load the map style/tiles.`)},[]),we=(0,p.useCallback)(()=>{if(typeof navigator>`u`||!navigator.geolocation){T(`Geolocation is not available in this browser.`);return}E(!0),T(null),navigator.geolocation.getCurrentPosition(e=>{let{longitude:t,latitude:n}=e.coords;be({lng:t,lat:n}),E(!1);try{S.current?.flyTo({center:[t,n],zoom:12,duration:800})}catch{}},e=>{E(!1),T(e.message||`Unable to retrieve location.`)},{enableHighAccuracy:!1,timeout:8e3,maximumAge:6e4})},[]),O=(0,p.useMemo)(()=>Fe(e),[e]),k=(0,p.useMemo)(()=>Re(e),[e]),A=O?.provider===`value`,j=O?.provider,M=O?.provider===`object`?O.object:void 0,N=O?.provider===`value`?O.items:void 0,P=ee(e,O),{ready:F,def:I}=me(P??``,A?void 0:t),L=l(),R=!Array.isArray(r)&&j===`object`,z=ae(R?M:void 0),Oe=(0,p.useRef)(z),ke=(0,p.useRef)(null),B=(0,p.useRef)(0),je=ue(),V=oe(e.filter,je);(0,p.useEffect)(()=>{if(R&&!F){m(!0);return}let n=[r,j,M,N,t,A,V,e.sort,I,L],i=ke.current,a=i!==null&&i.length===n.length&&n.every((e,t)=>Object.is(e,i[t])),o=z!==Oe.current;Oe.current=z;let s=o&&a,c=++B.current,l=()=>B.current===c,u=(e,t)=>{l()&&(ge(e),ve(t),g(null),ke.current=n)};return(async()=>{try{if(s||m(!0),Array.isArray(r)){u(r,null);return}if(A&&j===`value`){let t=await new re({items:N??[]}).find(``,{$filter:V,$orderby:d(e.sort),...fe()}),n=se(t);u(n.rows,n);return}if(!t||typeof t.find!=`function`)throw Error(`DataSource required for object/api providers`);if(j===`object`){let n=M,r=ie(I?.fields),i=L?.isLoaded?r.filter(e=>L.checkField(n,e,`read`)):r,a=await t.find(n,{$filter:V,$orderby:d(e.sort),...fe(),...i.length>0?{$expand:i}:{}}),o=se(a);u(o.rows,o)}else j===`api`&&(console.warn(`API provider not yet implemented for ObjectMap`),u([],null))}catch(e){s?console.error(`[ObjectMap] Failed to refresh data:`,e):l()&&g(e)}finally{l()&&m(!1)}})(),()=>{B.current+=1}},[r,j,M,N,t,A,V,e.sort,F,I,L,z,R]);let{markers:H,invalidCount:U}=(0,p.useMemo)(()=>{let e=0;return{markers:he.map((t,n)=>{let r=Be(t,k);if(!r)return e++,null;let i=te(I,t,{titleField:k.titleField,fallback:`Marker`}),a=ne(t,k.descriptionField),[o,s]=r;return!isFinite(o)||!isFinite(s)||o<-90||o>90||s<-180||s>180?(e++,null):{id:t.id||t._id||`marker-${n}`,title:i,description:a,coordinates:[s,o],data:t}}).filter(e=>e!==null),invalidCount:e}},[he,k,I]),W=(0,p.useMemo)(()=>H.find(e=>e.id===v),[H,v]),[K,q]=(0,p.useState)(k.zoom||3),Ie=(0,p.useCallback)(e=>{try{let t=e?.target?.getZoom?.();typeof t==`number`&&Number.isFinite(t)&&q(Math.round(t))}catch{}},[]),J=de({navigation:e.navigation,objectName:e.objectName,onRowClick:a}),Y=(0,p.useMemo)(()=>{if(!b.trim())return H;let e=b.toLowerCase();return H.filter(t=>t.title?.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[H,b]),Le=(0,p.useMemo)(()=>ce??(e.enableClustering||Y.length>100)?Ve(Y,K,pe):Y.map(e=>({id:e.id,coordinates:e.coordinates,markers:[e],isCluster:!1})),[Y,K,ce,pe,e]),X=(0,p.useMemo)(()=>Me(Y.map(e=>e.coordinates)),[Y]),Z=typeof k.center?.[0]==`number`?k.center[0]:void 0,Q=typeof k.center?.[1]==`number`?k.center[1]:void 0,$=typeof k.zoom==`number`?k.zoom:void 0,He=Z!==void 0||Q!==void 0||$!==void 0,Ue=(0,p.useMemo)(()=>{if(X&&!He)return{bounds:X,fitBoundsOptions:{padding:48,maxZoom:12}};let e=X?Ne(X):{longitude:0,latitude:0};return{longitude:Q??e.longitude,latitude:Z??e.latitude,zoom:$??(X?3:2)}},[X,He,Q,Z,$]);return ze(k)?_e?(0,G.jsx)(`div`,{className:s(`min-w-0 overflow-hidden`,n),children:(0,G.jsx)(`div`,{className:`flex items-center justify-center h-96 bg-muted rounded-lg border`,children:(0,G.jsx)(`div`,{className:`text-muted-foreground`,children:`Loading map...`})})}):h?(0,G.jsx)(`div`,{className:s(`min-w-0 overflow-hidden`,n),children:(0,G.jsx)(`div`,{className:`flex items-center justify-center h-96 bg-muted rounded-lg border`,children:(0,G.jsxs)(`div`,{className:`text-destructive`,children:[`Error: `,h.message]})})}):(0,G.jsxs)(`div`,{className:s(`min-w-0 overflow-hidden`,n),children:[U>0&&(0,G.jsx)(`div`,{className:`mb-2 p-2 text-sm text-yellow-800 bg-yellow-50 border border-yellow-200 rounded`,children:`${U} record${U===1?``:`s`} with missing or invalid coordinates excluded from the map.`}),H.length>0&&(0,G.jsx)(`div`,{className:`mb-2`,children:(0,G.jsx)(`input`,{type:`text`,value:b,onChange:e=>ye(e.target.value),placeholder:`Search locations…`,className:`w-full px-3 py-2 text-sm border rounded-md bg-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring`})}),(0,G.jsxs)(`div`,{className:`relative border rounded-lg overflow-hidden bg-muted h-[300px] sm:h-[400px] md:h-[500px] lg:h-[600px] w-full`,children:[(0,G.jsxs)(Te,{ref:e=>{S.current=e},initialViewState:Ue,style:{width:`100%`,height:`100%`},mapStyle:k.style||Pe,touchZoomRotate:!0,dragRotate:!0,touchPitch:!0,onLoad:Ie,onZoom:e=>q(Math.round(e.viewState.zoom)),onError:Ce,children:[D&&(0,G.jsxs)(`div`,{role:`alert`,className:`absolute inset-x-0 top-0 z-20 p-2 text-sm text-center text-amber-900 bg-amber-50 border-b border-amber-200`,children:[`Map failed to load (`,D,`). Markers below are still listed in the search box;`,` `,k.style?`check the configured map style URL.`:`configure a custom map style for production use.`]}),(0,G.jsx)(Ae,{position:`top-right`,showCompass:!0,showZoom:!0}),(0,G.jsx)(`button`,{type:`button`,onClick:we,disabled:xe,className:`absolute top-2 left-2 z-10 inline-flex items-center justify-center size-9 rounded-md bg-background/95 border shadow-sm hover:bg-background disabled:opacity-50`,"aria-label":`Show my location`,"data-testid":`map-geolocate`,children:(0,G.jsx)(`span`,{"aria-hidden":`true`,children:xe?`⏳`:`🧭`})}),C&&(0,G.jsx)(Ee,{longitude:C.lng,latitude:C.lat,anchor:`center`,children:(0,G.jsx)(`div`,{className:`size-3 rounded-full bg-blue-500 ring-4 ring-blue-500/30 shadow`,"aria-label":`Your location`,"data-testid":`map-user-location`})}),Le.map(e=>e.isCluster?(0,G.jsx)(Ee,{longitude:e.coordinates[0],latitude:e.coordinates[1],anchor:`center`,onClick:t=>{t.originalEvent.stopPropagation();try{let t=Math.min(20,Math.max(K+2,8));S.current?.flyTo({center:[e.coordinates[0],e.coordinates[1]],zoom:t,duration:600})}catch{}},children:(0,G.jsx)(`div`,{className:`flex items-center justify-center rounded-full bg-primary text-primary-foreground font-bold text-xs cursor-pointer hover:scale-110 transition-transform shadow-md`,style:{width:Math.min(48,24+e.markers.length*2),height:Math.min(48,24+e.markers.length*2)},title:`${e.markers.length} markers`,"data-testid":`map-cluster`,children:e.markers.length})},e.id):(0,G.jsx)(Ee,{longitude:e.coordinates[0],latitude:e.coordinates[1],anchor:`bottom`,onClick:t=>{t.originalEvent.stopPropagation();let n=e.markers[0];y(n.id),J.handleClick(n.data),i?.(n.data)},children:(0,G.jsx)(`div`,{className:`text-2xl cursor-pointer hover:scale-110 transition-transform`,children:`📍`})},e.id)),W&&!x&&(0,G.jsx)(De,{longitude:W.coordinates[0],latitude:W.coordinates[1],anchor:`top`,onClose:()=>y(null),closeOnClick:!1,children:(0,G.jsxs)(`div`,{className:`p-2 min-w-[150px] sm:min-w-[200px]`,children:[(0,G.jsx)(`h3`,{className:`font-bold text-sm mb-1`,children:W.title}),W.description&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:W.description}),(0,G.jsxs)(`div`,{className:`mt-2 text-xs flex gap-2`,children:[u&&(0,G.jsx)(`button`,{type:`button`,className:`text-blue-500 hover:underline`,onClick:()=>u(W.data),children:`Edit`}),f&&(0,G.jsx)(`button`,{type:`button`,className:`text-red-500 hover:underline`,onClick:()=>f(W.data),children:`Delete`})]})]})})]}),W&&x&&(0,G.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 z-30 bg-background border-t shadow-lg rounded-t-2xl p-4 pb-[max(env(safe-area-inset-bottom),1rem)]`,role:`dialog`,"aria-label":`Location details`,"data-testid":`map-mobile-record-sheet`,children:[(0,G.jsx)(`div`,{className:`mx-auto mb-2 h-1 w-10 rounded-full bg-muted`,"aria-hidden":`true`}),(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold truncate`,children:W.title}),W.description&&(0,G.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground line-clamp-3`,children:W.description})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>y(null),className:`text-muted-foreground hover:text-foreground text-lg leading-none px-2`,"aria-label":`Close details`,"data-testid":`map-mobile-record-close`,children:`×`})]}),(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-xs`,children:[u&&(0,G.jsx)(`button`,{type:`button`,className:`px-3 py-1.5 rounded-md border bg-card hover:bg-accent`,onClick:()=>u(W.data),children:`Edit`}),f&&(0,G.jsx)(`button`,{type:`button`,className:`px-3 py-1.5 rounded-md border border-destructive/30 text-destructive hover:bg-destructive/10`,onClick:()=>f(W.data),children:`Delete`})]})]}),w&&(0,G.jsx)(`div`,{className:`absolute top-2 left-14 right-2 z-10 text-xs px-3 py-1.5 rounded-md bg-destructive/10 text-destructive border border-destructive/30`,children:w})]}),_&&(0,G.jsx)(le,{result:_}),J.isOverlay&&(0,G.jsx)(c,{...J,title:`Location Details`,children:e=>(0,G.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex flex-col`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,G.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]}):(0,G.jsx)(`div`,{className:s(`min-w-0 overflow-hidden`,n),children:(0,G.jsx)(`div`,{className:`flex items-center justify-center h-96 bg-muted rounded-lg border p-4 text-center`,"data-testid":`map-missing-location-binding`,role:`alert`,children:(0,G.jsxs)(`div`,{className:`text-destructive`,children:[`Map configuration required — declare `,(0,G.jsx)(`code`,{className:`font-mono`,children:`map.locationField`}),` `,`or `,(0,G.jsx)(`code`,{className:`font-mono`,children:`map.latitudeField`}),` +`,` `,(0,G.jsx)(`code`,{className:`font-mono`,children:`map.longitudeField`})]})})})},$=t({ObjectMap:()=>Q,ObjectMapRenderer:()=>Ue}),He={filter:!0,sort:!0},Ue=u(({schema:e,...t})=>{let{dataSource:n}=ce()||{};return(0,G.jsx)(pe,{schema:e,mapping:He,dataSource:n,testId:`object-map`,errorTitle:`This map’s data source could not be resolved`,children:e=>(0,G.jsx)(Q,{schema:e,dataSource:n,...t})})});f.register(`object-map`,Ue,{namespace:`plugin-map`,label:`Object Map`,category:`view`,inputs:[{name:`objectName`,type:`string`,description:"ObjectQL object name. The record source is one of `data`, `staticData` and `objectName`, or the node’s `dataSource` binding; the `object-map` schema refuses a block that declares none of them."},{name:`map`,type:`object`,description:'The field configuration: `latitudeField` / `longitudeField` (or one `locationField` holding a `"lat,lng"` string, a `{ lat, lng }` object or a `[lat, lng]` pair) place each record’s marker, and a record with no readable coordinates is not plotted; `titleField` and `descriptionField` name what the marker popup shows; `zoom` and `center` (`[latitude, longitude]`) set the initial camera, which otherwise fits the markers; `style` is a MapLibre style URL, read after the node’s `mapStyle`.'},{name:`data`,type:`object`,description:"A `{ provider, … }` data-source configuration, read FIRST on the record-source ladder: a map carrying one never reaches `staticData` and never queries `objectName`. `{ provider: 'value', items }` plots those rows and `{ provider: 'object', object }` queries that object, both narrowed by `filter` and ordered by `sort`. The `api` provider is not implemented on the map and plots no markers. A bare array is not this key’s shape and is not a record source: the map falls through to `staticData`, then `objectName`, so inline rows belong under `staticData`."},{name:`staticData`,type:`array`,description:"Inline records, read SECOND on the record-source ladder: a `data` configuration wins and this key is then never reached, while `objectName` is read AFTER it, so a map carrying both plots these rows and never queries that object. `filter` and `sort` narrow and order these rows exactly as they do fetched ones."},{name:`filter`,type:`array`,description:"Base query filter in the rule-array form `[{ field, operator, value }, ...]`, narrowing the markers the map plots — fetched rows and inline (`staticData`, `{ provider: 'value' }`) rows alike. Context tokens such as `{current_user_id}` are resolved first, then the filter is lowered to `$filter` on the query. The MongoDB-style record form is not this key’s shape."},{name:`sort`,type:`array`,description:"Marker order in `[{ field, order }]` form, ordering the rows the map plots. Lowered to `$orderby` on the same query."},{name:`mapStyle`,type:`string`,description:"MapLibre style URL or spec, overriding the public demo tiles. Read before `map.style`; NOT the base node `style`, which is an inline CSS record"},{name:`navigation`,type:`object`,description:"What a marker click opens — the `{ mode, size, openNewTab, preventNavigation }` block a list view declares. With the key ABSENT a click opens nothing: this renderer supplies no drawer default. `mode` is an overlay (`drawer`, `modal`, `split`, `popover`), `new_window`, `page` or `none`, and a block written without `mode` takes the spec’s `page` default. `drawer`, `modal` and `popover` open the marker’s record in that overlay, but `split` opens nothing, because the map hands the split shell no main panel; `new_window` opens the record page in a new tab; `none` opens nothing. `page` opens the record page of the map’s `objectName` through the record navigator the host publishes (the console publishes one on its custom pages, record pages and list views); under a host that publishes none, such as an embedded renderer, or on a map that names no `objectName`, there is no record page to open and the click opens nothing. `preventNavigation: true` opens nothing whatever the mode, `openNewTab: true` opens the record page in a new tab and outranks every mode except `none`, and `size` sets the overlay width. A click handler from a parent view outranks the whole key."},{name:`enableClustering`,type:`boolean`,description:"Group nearby markers into one numbered cluster. Absent, the map clusters only above 100 markers; `false` turns clustering off at any count."}]});export{$ as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{h as n,t as r,v as i}from"./vendor-react-BggL7APJ.js";import{
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{h as n,t as r,v as i}from"./vendor-react-BggL7APJ.js";import{kn as a}from"./ui-components-D8wcRNrt.js";import{Qi as o}from"./framework-CAuH4h0L.js";import{a as s,h as c,i as l,m as u,n as d,o as f,p,r as m,t as h}from"./vendor-markdown-COJFQ_GI.js";var g=e(i(),1),_=r(),v=``,y=``,b=/\uE000(\d+)\uE001/g,x=/[\uE000\uE001]/g,S=/(?<![^\s\p{P}\p{S}])(?<!_)(_+)(?!\s)(.+?)(?<!\s)(_+)(?!_)(?![^\s\p{P}\p{S}])/gu;function C(e){let t=[];return e.replace(x,``).replace(/`([^`]+)`/g,(e,n)=>(t.push(n),`${v}${t.length-1}${y}`)).replace(/!\[[^\]]*\]\([^)]*\)/g,``).replace(/\[([^\]]+)\]\([^)]*\)/g,`$1`).replace(/\*\*(.*?)\*\*/g,`$1`).replace(/\*(.*?)\*/g,`$1`).replace(S,`$2`).replace(/<[^>]+>/g,``).replace(b,(e,n)=>t[Number(n)]).trim()}function w(e,t){let n=t?.minDepth??2,r=t?.maxDepth??3,i=new f,a=[],o=null;for(let t of(e??``).split(/\r?\n/)){let e=t.match(/^\s{0,3}(`{3,}|~{3,})/);if(e){let t=e[1][0];o===null?o=t:t===o&&(o=null);continue}if(o!==null)continue;let s=t.match(/^(#{1,6})\s+(.+?)\s*#*\s*$/);if(!s)continue;let c=s[1].length,l=C(s[2]);if(!l)continue;let u=i.slug(l);c>=n&&c<=r&&a.push({depth:c,text:l,id:u})}return a}var T=null;function E(){return T||=n(()=>import(`./mermaid.core-DigK-8rw.js`).then(e=>e.default),[],import.meta.url),T}var D=0;function O(){return typeof document<`u`&&document.documentElement.classList.contains(`dark`)}function k({chart:e}){let[t,n]=g.useState(``),[r,i]=g.useState(null),[a,o]=g.useState(O);return g.useEffect(()=>{if(typeof document>`u`)return;let e=document.documentElement,t=new MutationObserver(()=>o(O()));return t.observe(e,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},[]),g.useEffect(()=>{let t=!1,r=e.trim();if(!r){n(``),i(null);return}return E().then(async e=>{e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:a?`dark`:`default`});let o=`os-mermaid-${D+=1}`,{svg:s}=await e.render(o,r);t||(n(s),i(null))}).catch(e=>{t||i(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[e,a]),r?(0,_.jsx)(`pre`,{"data-mermaid":!0,"data-mermaid-error":!0,className:`my-4 overflow-auto rounded border border-destructive/40 bg-muted p-3 text-xs`,children:(0,_.jsx)(`code`,{children:e})}):t?(0,_.jsx)(`div`,{"data-mermaid":!0,role:`img`,className:`my-4 flex justify-center overflow-auto [&_svg]:h-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:{__html:t}}):(0,_.jsx)(`div`,{"data-mermaid":!0,"data-mermaid-pending":!0,className:`my-4 text-sm text-muted-foreground`,children:(0,_.jsx)(`pre`,{className:`sr-only`,children:e})})}var A=t({MarkdownRenderer:()=>M,Mermaid:()=>k,extractToc:()=>w,markdownComponents:()=>N}),j=g.lazy(()=>n(()=>Promise.resolve().then(()=>L),void 0,import.meta.url)),M=({schema:e})=>(0,_.jsx)(g.Suspense,{fallback:(0,_.jsx)(a,{className:`w-full h-[200px]`}),children:(0,_.jsx)(j,{content:e.content||``,className:e.className})});o.register(`markdown`,M,{namespace:`plugin-markdown`,label:`Markdown`,category:`plugin`,inputs:[{name:`content`,type:`string`,required:!0},{name:`className`,type:`string`}],defaultProps:{content:`# Hello World
|
|
2
2
|
|
|
3
3
|
This is a **markdown** component with *formatting* support.
|
|
4
4
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{t as n,v as r}from"./vendor-react-BggL7APJ.js";import{Gr as i,Hr as a,Ur as o,Vr as s,Wr as c,bi as l,d as u,g as d,ii as f,kn as p,wi as m}from"./ui-components-D8wcRNrt.js";import{C as h,Di as g,Dn as _,Fn as v,Mn as y,Nn as b,Oi as x,On as S,Ot as C,Pn as w,Qi as T,Rn as E,S as D,Sn as O,Tn as ee,Tr as k,_ as te,_n as ne,an as re,cn as A,gt as j,hn as ie,jn as ae,mt as M,na as oe,on as N,sn as P,wn as se}from"./framework-CAuH4h0L.js";import{g as F,m as I,o as ce,p as L,t as R,w as le}from"./i18n-runtime-CdWyaiOD.js";import{t as z}from"./vendor-icon-download-C3csYSaD.js";import{t as ue}from"./vendor-icon-loader-circle-D3PsuVaD.js";import{t as de}from"./vendor-icon-printer-VcYhF59P.js";import{t as fe}from"./vendor-icon-refresh-cw-BGjSPEfJ.js";import{t as pe}from"./vendor-icon-table-2-DMQ6UahM.js";import{t as me}from"./vendor-icon-triangle-alert-D5n0T3q_.js";var B=e(r(),1),V=n(),he=({schema:e})=>{let{title:t,description:n,data:r,columns:l}=e;e.chart?.type;let u=!!e.chart;return(0,V.jsxs)(s,{className:`h-full flex flex-col ${e.className||``}`,children:[(0,V.jsxs)(c,{children:[t&&(0,V.jsx)(i,{children:t}),n&&(0,V.jsx)(o,{children:n})]}),(0,V.jsxs)(a,{className:`flex-1 overflow-auto space-y-4`,children:[u&&(()=>{let t=e.chart?.type,n=t?T.get(t):null;return n||=T.get(`chart`),n?(0,V.jsx)(`div`,{className:`min-h-[300px] border rounded-lg p-4 bg-background/50`,children:(0,V.jsx)(n,{schema:{...e.chart,data:e.chart.data||r}})}):(0,V.jsxs)(`div`,{className:`min-h-[100px] border rounded-md p-4 bg-muted/20 text-muted-foreground flex items-center justify-center`,children:[`Unknown component type: `,t||`chart`]})})(),r&&r.length>0&&(0,V.jsx)(`div`,{className:`border rounded-lg`,children:(()=>{let e=T.get(`grid`)||T.get(`table`);return e?(0,V.jsx)(e,{schema:{type:`grid`,rowData:r,columnDefs:l,domLayout:`autoHeight`}}):(0,V.jsx)(`div`,{className:`overflow-x-auto`,children:(0,V.jsxs)(`table`,{className:`w-full text-sm text-left`,children:[(0,V.jsx)(`thead`,{className:`text-xs uppercase bg-muted`,children:(0,V.jsx)(`tr`,{children:l?.map(e=>(0,V.jsx)(`th`,{className:`px-6 py-3`,children:e.headerName||e.label||e.field},e.field))})}),(0,V.jsx)(`tbody`,{children:r.map((e,t)=>(0,V.jsx)(`tr`,{className:`bg-background border-b`,children:l?.map(t=>(0,V.jsx)(`td`,{className:`px-6 py-4`,children:e[t.field]},t.field))},t))})]})})})()})]})]})};function H(e,t,n){try{return e.toLocaleString(t,n)}catch{return e.toLocaleString(`en`,n)}}function ge(e,t,n){let r=e.fields||[],i=r.map(e=>e.label||e.name),a=t.map(e=>r.map(t=>{let n=e[t.name];return n=be(n),typeof n==`string`&&(n.includes(`,`)||n.includes(`"`)||n.includes(`
|
|
2
|
+
`))?`"${n.replace(/"/g,`""`)}"`:n??``}));K([...n?.includeHeaders===!1?[]:[i.join(`,`)],...a.map(e=>e.join(`,`))].join(`
|
|
3
|
+
`),n?.filename||`${e.title||`report`}.csv`,`text/csv`)}function _e(e,t,n){let r={title:e.title,description:e.description,generatedAt:new Date().toISOString(),data:t};K(JSON.stringify(r,null,2),n?.filename||`${e.title||`report`}.json`,`application/json`)}function U(e,t,n,r=`en`){let i=e.fields||[],a=Se(n?.orientation),o=xe(n?.pageSize);K(`<!DOCTYPE html>
|
|
4
|
+
<html>
|
|
5
|
+
<head>
|
|
6
|
+
<meta charset="utf-8">
|
|
7
|
+
<title>${G(e.title||`Report`)}</title>
|
|
8
|
+
<style>
|
|
9
|
+
@page { size: ${o} ${a}; margin: 20mm; }
|
|
10
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
|
|
11
|
+
h1 { font-size: 24px; margin-bottom: 8px; }
|
|
12
|
+
.description { color: #666; margin-bottom: 24px; }
|
|
13
|
+
.meta { color: #999; font-size: 12px; margin-bottom: 16px; }
|
|
14
|
+
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
|
|
15
|
+
th { background: #f5f5f5; text-align: left; padding: 8px 12px; border: 1px solid #ddd; font-weight: 600; }
|
|
16
|
+
td { padding: 8px 12px; border: 1px solid #ddd; }
|
|
17
|
+
tr:nth-child(even) { background: #fafafa; }
|
|
18
|
+
</style>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<h1>${G(e.title||`Report`)}</h1>
|
|
22
|
+
${e.description?`<p class="description">${G(e.description)}</p>`:``}
|
|
23
|
+
<p class="meta">Generated: ${new Date().toLocaleString(r)}</p>
|
|
24
|
+
<table>
|
|
25
|
+
<thead><tr>${i.map(e=>`<th>${G(e.label||e.name)}</th>`).join(``)}</tr></thead>
|
|
26
|
+
<tbody>${t.map(e=>`<tr>${i.map(t=>`<td>${G(String(e[t.name]??``))}</td>`).join(``)}</tr>`).join(``)}</tbody>
|
|
27
|
+
</table>
|
|
28
|
+
</body>
|
|
29
|
+
</html>`,n?.filename||`${e.title||`report`}.html`,`text/html`)}function ve(e,t,n,r=`en`){let i=e.fields||[],a=Se(n?.orientation),o=xe(n?.pageSize),s=window.open(``,`_blank`);if(!s){U(e,t,{...n,format:`html`,filename:n?.filename?.replace(/\.pdf$/,`.html`)||`${e.title||`report`}.html`},r);return}s.document.write(`<!DOCTYPE html>
|
|
30
|
+
<html>
|
|
31
|
+
<head>
|
|
32
|
+
<meta charset="utf-8">
|
|
33
|
+
<title>${G(e.title||`Report`)}</title>
|
|
34
|
+
<style>
|
|
35
|
+
@page { size: ${o} ${a}; margin: 20mm; }
|
|
36
|
+
@media print { .no-print { display: none; } }
|
|
37
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #333; }
|
|
38
|
+
h1 { font-size: 24px; margin-bottom: 8px; }
|
|
39
|
+
.description { color: #666; margin-bottom: 24px; }
|
|
40
|
+
.meta { color: #999; font-size: 12px; margin-bottom: 16px; }
|
|
41
|
+
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
|
|
42
|
+
th { background: #f5f5f5; text-align: left; padding: 8px 12px; border: 1px solid #ddd; font-weight: 600; }
|
|
43
|
+
td { padding: 8px 12px; border: 1px solid #ddd; }
|
|
44
|
+
tr:nth-child(even) { background: #fafafa; }
|
|
45
|
+
</style>
|
|
46
|
+
</head>
|
|
47
|
+
<body>
|
|
48
|
+
<h1>${G(e.title||`Report`)}</h1>
|
|
49
|
+
${e.description?`<p class="description">${G(e.description)}</p>`:``}
|
|
50
|
+
<p class="meta">Generated: ${new Date().toLocaleString(r)}</p>
|
|
51
|
+
<table>
|
|
52
|
+
<thead><tr>${i.map(e=>`<th>${G(e.label||e.name)}</th>`).join(``)}</tr></thead>
|
|
53
|
+
<tbody>${t.map(e=>`<tr>${i.map(t=>`<td>${G(String(e[t.name]??``))}</td>`).join(``)}</tr>`).join(``)}</tbody>
|
|
54
|
+
</table>
|
|
55
|
+
</body>
|
|
56
|
+
</html>`),s.document.close(),s.onload=()=>{s.print()}}function ye(e,t,n){let r=e.fields||[],i=r.map(e=>e.label||e.name),a=t.map(e=>r.map(t=>{let n=e[t.name];return n=be(n),typeof n==`string`&&(n.includes(`,`)||n.includes(`"`)||n.includes(`
|
|
57
|
+
`)||n.includes(` `))?`"${n.replace(/"/g,`""`)}"`:n??``}));K(``+[...n?.includeHeaders===!1?[]:[i.join(` `)],...a.map(e=>e.join(` `))].join(`
|
|
58
|
+
`),n?.filename||`${e.title||`report`}.tsv`,`text/tab-separated-values`)}function W(e,t,n,r,i=`en`){switch(e){case`csv`:ge(t,n,r);break;case`json`:_e(t,n,r);break;case`html`:U(t,n,r,i);break;case`pdf`:ve(t,n,r,i);break;case`excel`:ye(t,n,r);break;default:console.warn(`Unsupported export format: ${e}`)}}function G(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function be(e){if(typeof e==`string`&&e.length>0){let t=e.charAt(0);if(t===`=`||t===`+`||t===`-`||t===`@`||t===`|`)return`\t${e}`}return e}function xe(e){return[`A4`,`A3`,`Letter`,`Legal`].includes(e||``)?e:`A4`}function Se(e){return e===`landscape`?`landscape`:`portrait`}function K(e,t,n){let r=new Blob([e],{type:`${n};charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}function q(e,t,n=`en`){if(e==null||e===``)return``;let r=t?.type,i=t?.format;if(r===`date`||i===`date`||Ce(e))return we(e);if(r===`number`||typeof e==`number`){let t=typeof e==`number`?e:Number(e);return isNaN(t)?String(e):i===`currency`||i===`currency_cny`?`¥${H(t,n,{minimumFractionDigits:0,maximumFractionDigits:0})}`:i===`currency_usd`?`$${H(t,n,{minimumFractionDigits:0,maximumFractionDigits:0})}`:i===`percent`?`${H(t,n,{minimumFractionDigits:1,maximumFractionDigits:1})}%`:H(t,n)}return String(e)}function Ce(e){return typeof e==`string`&&/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2})?/.test(e)}function we(e){try{let t=k(e);return isNaN(t.getTime())?String(e):`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}catch{return String(e)}}function Te(e,t){if(!t||t.length===0||!e||e.length===0)return null;let n=t[0],r=n.field,i=new Map;for(let t of e){let e=String(t[r]??`(empty)`);i.has(e)||i.set(e,[]),i.get(e).push(t)}let a=[];for(let[e,t]of i)a.push({key:e,label:`${n.label||r}: ${e}`,rows:t});let o=n.sort===`desc`?-1:1;return a.sort((e,t)=>e.key.localeCompare(t.key)*o),a}function Ee(e,t,n){if(!e)return 0;let r=e.map(e=>Number(e[t])||0);switch(n){case`count`:return e.length;case`sum`:return r.reduce((e,t)=>e+t,0);case`avg`:return r.length>0?(r.reduce((e,t)=>e+t,0)/r.length).toFixed(2):0;case`min`:return r.length>0?Math.min(...r):0;case`max`:return r.length>0?Math.max(...r):0;case`distinct`:return new Set(e.map(e=>e[t])).size;default:return``}}var J=({schema:e,onRefresh:t})=>{let{report:n,data:r,showToolbar:h=!0,allowExport:g=!0,allowPrint:_=!0,loading:v=!1}=e,y=F(),b=R(),x=e=>{if(!n){console.warn(`ReportViewer: Cannot export, no report defined`);return}W(e,n,r||[],n.exportConfigs?.[e],b)},S=y(`common.printDialogHint`,`Opens your browser’s print dialog (not a PDF export)`),C=()=>{window.print()},w=()=>{t?.()},T=(e,t)=>Ee(r,e,t),E=(e,t)=>{let r=n?.conditionalFormatting;if(r&&Array.isArray(r))for(let n of r){if(n.field!==e)continue;let r=String(t??``),i=String(n.value??``),a=!1;switch(n.operator){case`equals`:a=r===i;break;case`not_equals`:a=r!==i;break;case`contains`:a=r.includes(i);break;case`greater_than`:a=Number(t)>Number(n.value);break;case`less_than`:a=Number(t)<Number(n.value)}if(a){let e={};return n.backgroundColor&&(e.backgroundColor=n.backgroundColor),n.textColor&&(e.color=n.textColor),e}}},D=(e,t)=>{if(e==null||e===``)return``;if(t.renderAs===`badge`&&(!t.type||t.type===`string`||t.type===`text`)){let n=t.colorMap?.[String(e)]||``;return(0,V.jsx)(f,{className:n,children:String(e)})}if(t.aggregation)return q(e,t,b);if(t.type){let n={...t};t.colorMap&&!n.options&&(n.options=Object.entries(t.colorMap).map(([e,t])=>({value:e,label:e,color:t})));let r=u(d(n));return(0,V.jsx)(r,{value:e,field:n})}return q(e,t,b)};return n?(0,V.jsxs)(`div`,{className:`space-y-4`,children:[h&&(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2 p-4 bg-card rounded-lg border`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold`,children:n.title}),n.description&&(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,"data-print-hide":!0,children:[n.refreshInterval&&(0,V.jsxs)(l,{variant:`outline`,size:`sm`,onClick:w,children:[(0,V.jsx)(fe,{className:`h-4 w-4 mr-2`}),`Refresh`]}),_&&(0,V.jsxs)(l,{variant:`outline`,size:`sm`,onClick:C,"aria-label":`Print: ${S}`,title:S,children:[(0,V.jsx)(de,{className:`h-4 w-4 mr-2`}),`Print`]}),g&&n.showExportButtons&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>x(`pdf`),children:[(0,V.jsx)(z,{className:`h-4 w-4 mr-2`}),`PDF`]}),(0,V.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>x(`excel`),children:[(0,V.jsx)(z,{className:`h-4 w-4 mr-2`}),`Excel`]}),(0,V.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>x(`csv`),children:[(0,V.jsx)(z,{className:`h-4 w-4 mr-2`}),`CSV`]})]})]})]}),(0,V.jsxs)(s,{children:[(0,V.jsxs)(c,{children:[!h&&n.title&&(0,V.jsx)(i,{children:n.title}),!h&&n.description&&(0,V.jsx)(o,{children:n.description})]}),(0,V.jsxs)(a,{className:`space-y-6`,children:[v&&(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[1,2,3].map(e=>(0,V.jsx)(s,{children:(0,V.jsxs)(a,{className:`p-4 space-y-2`,children:[(0,V.jsx)(p,{className:`h-4 w-20`}),(0,V.jsx)(p,{className:`h-8 w-28`})]})},e))}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(p,{className:`h-10 w-full`}),[1,2,3,4,5].map(e=>(0,V.jsx)(p,{className:`h-8 w-full`},e))]})]}),!v&&n.sections?.map((e,t)=>e.visible===!1?null:(0,V.jsxs)(`div`,{className:`space-y-2`,children:[e.title&&e.type!==`header`&&(0,V.jsx)(`h3`,{className:`text-lg font-semibold border-b pb-2`,children:e.title}),e.type===`header`&&e.title&&(0,V.jsx)(`div`,{className:`text-2xl font-bold py-4`,children:e.title}),e.type===`summary`&&(0,V.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:n.fields?.filter(e=>e.showInSummary).map((e,t)=>(0,V.jsx)(s,{children:(0,V.jsxs)(a,{className:`p-4`,children:[(0,V.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.label||e.name}),(0,V.jsx)(`div`,{className:`text-2xl font-bold`,children:q(T(e.name,e.aggregation),e,b)})]})},t))}),e.type===`table`&&(0,V.jsx)(`div`,{className:`border rounded-lg overflow-x-auto`,children:(0,V.jsxs)(`table`,{className:`w-full text-sm min-w-[600px]`,children:[(0,V.jsx)(`thead`,{className:`bg-muted`,children:(0,V.jsx)(`tr`,{children:e.columns?.map((e,t)=>(0,V.jsx)(`th`,{className:`px-4 py-2 font-medium ${e.type===`number`?`text-right`:`text-left`}`,children:e.label||e.name},t))})}),(0,V.jsx)(`tbody`,{children:(()=>{let t=Te(r||[],n.groupBy||[]);return t?t.map(t=>(0,V.jsxs)(B.Fragment,{children:[(0,V.jsx)(`tr`,{className:`bg-muted/60`,children:(0,V.jsxs)(`td`,{colSpan:e.columns?.length||1,className:`px-4 py-2 font-semibold text-sm`,children:[t.label,` (`,t.rows.length,`)`]})}),t.rows.map((t,n)=>(0,V.jsx)(`tr`,{className:`border-t hover:bg-muted/50 even:bg-muted/20`,children:e.columns?.map((e,n)=>(0,V.jsx)(`td`,{className:`px-4 py-2 ${e.type===`number`?`text-right tabular-nums`:``}`,style:E(e.name,t[e.name]),children:D(t[e.name],e)},n))},n))]},t.key)):r?.map((t,n)=>(0,V.jsx)(`tr`,{className:`border-t hover:bg-muted/50 even:bg-muted/20`,children:e.columns?.map((e,n)=>(0,V.jsx)(`td`,{className:`px-4 py-2 ${e.type===`number`?`text-right tabular-nums`:``}`,style:E(e.name,t[e.name]),children:D(t[e.name],e)},n))},n))})()})]})}),e.type===`text`&&e.text&&(0,V.jsx)(`div`,{className:`prose max-w-none`,children:(0,V.jsx)(`p`,{children:e.text})}),e.type===`page-break`&&(0,V.jsx)(`div`,{className:`border-t-2 border-dashed my-8 print:page-break-after-always`}),Array.isArray(e.content)?e.content.map((e,t)=>(0,V.jsx)(j,{schema:M(e)},t)):m(e.content,e=>(0,V.jsx)(j,{schema:M(e)}))]},t)),!n.sections&&r&&r.length>0&&(0,V.jsx)(`div`,{className:`border rounded-lg overflow-x-auto`,children:(0,V.jsxs)(`table`,{className:`w-full text-sm min-w-[600px]`,children:[(0,V.jsx)(`thead`,{className:`bg-muted`,children:(0,V.jsx)(`tr`,{children:n.fields?.map((e,t)=>(0,V.jsx)(`th`,{className:`px-4 py-2 font-medium ${e.type===`number`?`text-right`:`text-left`}`,children:e.label||e.name},t))})}),(0,V.jsx)(`tbody`,{children:r.map((e,t)=>(0,V.jsx)(`tr`,{className:`border-t hover:bg-muted/50 even:bg-muted/20`,children:n.fields?.map((t,n)=>(0,V.jsx)(`td`,{className:`px-4 py-2 ${t.type===`number`?`text-right tabular-nums`:``}`,style:E(t.name,e[t.name]),children:D(e[t.name],t)},n))},t))})]})})]})]})]}):(0,V.jsx)(s,{children:(0,V.jsx)(a,{className:`p-8 text-center text-muted-foreground`,children:`No report to display`})})};function De(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.dataset==`string`&&t.dataset.length>0||t.type===`joined`&&Array.isArray(t.blocks)&&t.blocks.some(e=>typeof e?.dataset==`string`)}var Oe=new Set,ke=()=>!1;function Ae(e,t){if(!ke())return;let n=e.filter;if(n===void 0)return;let r=`${t}:${n&&typeof n==`object`?Object.keys(n).sort().join(`,`):String(n)}`;Oe.has(r)||(Oe.add(r),console.warn(`[ObjectUI] ${t} carries \`filter\`, which is not an authorable key. Did you mean \`filter\` → \`runtimeFilter\`? NO filter was applied — it renders UNFILTERED, showing rows the report was scoped to exclude. \`ReportSchema\` (\`@objectstack/spec\`) is strict and rejects \`filter\`, so this document did not come through the validated path; the renderer no longer reads it either. Fix the producer: rename \`filter\` to \`runtimeFilter\`. (objectui#5137)`))}function je(e){return`Report \`${e.name??`(unnamed)`}\``}function Me(e,t){return e?typeof e==`string`?e:typeof e==`object`&&typeof e.default==`string`?e.default:t:t}function Y(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&!!e):[]}function Ne(e){if(!Array.isArray(e))return;let t={};for(let n of e){let e=n&&typeof n==`object`?n.by:void 0;typeof e==`string`&&e&&(t[e]=n.direction===`desc`?`desc`:`asc`)}return Object.keys(t).length>0?t:void 0}function Pe(e,t,n){if(!e)return;let r=new Set([...t,...n]),i={};for(let[t,n]of Object.entries(e))r.has(t)&&(i[t]=n);return Object.keys(i).length>0?i:void 0}function X(e,t,n,r,i,a,o){let[s,c]=B.useState({status:`idle`,rows:[]}),l=Pe(o,t,n),u=JSON.stringify(r??null),d=JSON.stringify(a??null),f=JSON.stringify(l??null),p=`${e}|${t.join(`,`)}|${n.join(`,`)}|${u}|${d}|${f}`,[m,h]=B.useState(void 0),g=te(m),_=B.useRef(null);return B.useEffect(()=>{let o=i;if(!o||typeof o.queryDataset!=`function`){_.current=null,h(void 0),c({status:`error`,rows:[],error:`This data source does not support dataset queries.`});return}if(!e||n.length===0){_.current=null,h(void 0),c({status:`idle`,rows:[]});return}let s=!1,u=_.current===p;return _.current=p,u||(h(void 0),c({status:`loading`,rows:[]})),o.queryDataset(e,{dimensions:t,measures:n,...r&&Object.keys(r).length>0?{runtimeFilter:r}:{},...a?{totals:{groupings:a}}:{},...l?{order:l}:{}}).then(e=>{s||(h(typeof e?.object==`string`&&e.object?e.object:void 0),c({status:`ok`,rows:Array.isArray(e?.rows)?e.rows:[],fields:Array.isArray(e?.fields)?e.fields:[],object:e?.object,dimensionFields:e?.dimensionFields,drillRawRows:Array.isArray(e?.drillRawRows)?e.drillRawRows:void 0,drillRanges:Array.isArray(e?.drillRanges)?e.drillRanges:void 0,totals:Array.isArray(e?.totals)?e.totals:void 0}))}).catch(e=>{s||c({status:`error`,rows:[],error:String(e?.message??e)})}),()=>{s=!0}},[p,g]),s}function Fe(...e){try{return re(...e)}catch(e){if(!(e instanceof oe))throw e;return console.warn(`[DatasetReportRenderer] drill-down refused — the drilled list cannot be scoped: ${e.message}`),null}}function Ie({dataset:e}){return(0,V.jsxs)(`div`,{className:`flex items-center justify-center rounded-md border border-dashed bg-muted/20 p-4 text-xs text-muted-foreground`,children:[`This report binds the “`,e,`” dataset — choose at least one measure (values) to render.`]})}function Z({status:e,error:t}){return e===`error`?(0,V.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive`,children:[(0,V.jsx)(me,{className:`h-3.5 w-3.5 mt-0.5 shrink-0`}),(0,V.jsx)(`span`,{className:`break-words`,children:t})]}):(0,V.jsxs)(`div`,{className:`flex items-center gap-2 p-4 text-xs text-muted-foreground`,children:[(0,V.jsx)(ue,{className:`h-4 w-4 animate-spin`}),` Running report…`]})}function Le(){return(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 rounded-md border border-dashed bg-muted/20 p-6 text-xs text-muted-foreground`,children:[(0,V.jsx)(pe,{className:`h-6 w-6`}),` The dataset returned no rows for this report’s scope.`]})}var Re=`cursor-pointer hover:bg-accent/40`;function ze({dataset:e,rows:t,values:n,runtimeFilter:r,dataSource:i,onDrill:a,order:o,withTotals:s}){let c=X(e,t,n,r,i,s&&t.length>0?[[]]:void 0,o),{fieldLabel:l}=L(),u=F(),d=R(),f=D(c.object,c.dimensionFields,t);if(n.length===0)return(0,V.jsx)(Ie,{dataset:e});if(c.status===`loading`||c.status===`idle`)return(0,V.jsx)(Z,{status:c.status});if(c.status===`error`)return(0,V.jsx)(Z,{status:`error`,error:c.error});if(c.rows.length===0)return(0,V.jsx)(Le,{});let p=!!a&&t.length>0,m=c.dimensionFields?t.filter(e=>e in c.dimensionFields):[],h=(n,i)=>{let o={};for(let e of t)o[e]=n[e];let s=c.drillRanges?.[i],l=!!s&&Object.keys(s).length>0,u;if(c.object&&(m.length>0||l)){let e=Fe(c.drillRawRows?.[i],m,c.dimensionFields??{},r,s);if(e===null)return;u=e}a({dataset:e,groupKey:o,runtimeFilter:r,object:c.object,objectFilter:u})},{measureField:g,headerLabel:_}=N(c.fields,c.object,l,I(u)),v=[...t,...n],b=y(c.rows,f),x=s?c.totals?.find(e=>Array.isArray(e.dimensions)&&e.dimensions.length===0)?.rows?.[0]:void 0,S=u(`report.total`,`Total`);return(0,V.jsx)(`div`,{className:`overflow-auto max-h-[70vh] rounded-md border`,children:(0,V.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,V.jsx)(`thead`,{className:`bg-muted/40`,children:(0,V.jsx)(`tr`,{children:v.map(e=>(0,V.jsx)(`th`,{className:`px-2 py-1.5 text-left font-medium whitespace-nowrap`,children:_(e)},e))})}),(0,V.jsxs)(`tbody`,{children:[b.map((e,t)=>(0,V.jsx)(`tr`,{className:`border-t${p?` ${Re}`:``}`,"data-testid":p?`dataset-drill-row`:void 0,onClick:p?()=>h(c.rows[t],t):void 0,children:v.map(t=>(0,V.jsx)(`td`,{className:`px-2 py-1 tabular-nums whitespace-nowrap`,children:n.includes(t)?A(e[t],g(t)?.format,g(t)?.currency,g(t)?.percentScale,d):P(e[t],d)},t))},t)),x&&(0,V.jsxs)(`tr`,{className:`border-t bg-muted/30 font-medium`,"data-testid":`dataset-report-total-row`,children:[t.length>0&&(0,V.jsx)(`td`,{colSpan:t.length,className:`px-2 py-1 whitespace-nowrap`,children:S}),n.map(e=>(0,V.jsx)(`td`,{className:`px-2 py-1 tabular-nums whitespace-nowrap`,children:A(x[e],g(e)?.format,g(e)?.currency,g(e)?.percentScale,d)},e))]})]})]})})}function Be(e){switch(e){case`summary`:return`summary`;case`matrix`:return`matrix`;case`joined`:return`joined`;default:return`tabular`}}function Ve(e){switch(e){case`bar`:case`column`:case`horizontal-bar`:case`line`:case`area`:case`pie`:case`donut`:case`funnel`:case`scatter`:case`treemap`:case`sankey`:case`radar`:case`combo`:return{kind:`series`,chartType:e};case`gauge`:case`solid-gauge`:case`metric`:case`kpi`:case`bullet`:return{kind:`single_value`};case`table`:case`pivot`:return{kind:`tabular`};default:return{kind:`unsupported`,type:String(e)}}}function He(e){let[,t]=B.useReducer(e=>e+1,0);return B.useEffect(()=>{if(T.get(e))return;let n=typeof T.subscribe==`function`?T.subscribe(()=>{T.get(e)&&t()}):void 0,r=T.loadLazy?.(e);return r&&typeof r.then==`function`&&r.then(()=>t()).catch(()=>{}),n},[e]),T.get(e)}function Ue(e,t,n){if(Array.isArray(e)&&t)for(let r of e){if(!r||typeof r!=`object`)continue;let{name:e,label:i}=r;if(e===t)return ce(i,n)||void 0}}function We({dataset:e,chart:t,runtimeFilter:n,dataSource:r,order:i}){let a=typeof t.xAxis==`string`?t.xAxis:``,o=typeof t.yAxis==`string`?t.yAxis:``,s=Ve(t.type),c=s.kind===`series`||s.kind===`single_value`,l=X(e,s.kind===`series`&&a?[a]:[],c&&o?[o]:[],n,r,void 0,i),u=He(`chart`),{fieldLabel:d,fieldOptionLabel:f}=L(),p=F(),m=R(),{language:g}=le(),v=B.useMemo(()=>a?[a]:[],[a]),b=h(l.object,l.dimensionFields,v),{categoryColors:x,dimensionLabels:C,categoryOrder:w}=B.useMemo(()=>{if(!b)return{categoryColors:null,dimensionLabels:null,categoryOrder:null};let{metaByPath:e,relabel:t}=b,n=t[0]?.path,r=n?e[n]:void 0,i=n?ae(r?.options,S(r,f)):void 0;return{categoryColors:ee(i),dimensionLabels:_(e,t,f),categoryOrder:O(i)}},[b,f]),T=ce(t.title,g)||void 0;if(s.kind===`tabular`)return null;if(s.kind===`unsupported`)return(0,V.jsxs)(`div`,{className:`rounded-md border border-dashed bg-muted/20 px-3 py-2 text-xs text-muted-foreground`,"data-testid":`dataset-report-chart-unsupported`,children:[`Chart type “`,s.type,`” is not a spec chart type — the report’s table carries its numbers.`]});if(s.kind===`series`&&!a||!o)return null;if(l.status===`loading`||l.status===`idle`)return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 p-4 text-xs text-muted-foreground`,children:[(0,V.jsx)(ue,{className:`h-4 w-4 animate-spin`}),` Loading chart…`]});if(l.status===`error`||l.rows.length===0)return null;let{measureField:E,headerLabel:D}=N(l.fields,l.object,d,I(p)),k=Ue(t.series,o,g)??D(o);if(s.kind===`single_value`){let e=E(o);return(0,V.jsxs)(`div`,{className:`rounded-md border bg-card p-3`,"data-testid":`dataset-report-metric`,children:[T?(0,V.jsx)(`h3`,{className:`mb-2 text-sm font-semibold`,children:T}):null,(0,V.jsxs)(`div`,{className:`flex flex-col gap-0.5 py-2`,children:[(0,V.jsx)(`span`,{className:`text-2xl font-semibold tabular-nums`,children:A(l.rows[0]?.[o],e?.format,e?.currency,e?.percentScale,m)}),(0,V.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:k})]})]})}if(!u)return null;let{data:te,xAxisKey:re,series:j}=se(y(l.rows,C),[a],[o],l.fields,{nullCategoryLabel:p(`chart.nullCategory`,`(None)`),builtinAggregateLabels:I(p)}),M=ne(j,t.series).map(e=>e.dataKey===o?{...e,label:k}:e),{title:oe,...P}=ie(t,x);return(0,V.jsxs)(`div`,{className:`rounded-md border bg-card p-3`,"data-testid":`dataset-report-chart`,children:[T?(0,V.jsx)(`h3`,{className:`mb-2 text-sm font-semibold`,children:T}):null,(0,V.jsx)(u,{schema:{chartType:s.chartType,data:te,xAxisKey:re,series:M,height:280,isAnimationActive:!1,...P,...w?{categoryOrder:w}:{}}})]})}function Q(e,t){return b(e.map(e=>v(t[e])))}function $(e,t,n){return e.map(e=>P(t[e],n)).join(` / `)}function Ge({dataset:e,rows:t,columnsAcross:n,values:r,runtimeFilter:i,dataSource:a,onDrill:o,order:s}){let c=X(e,[...t,...n],r,i,a,[t,n,[]],s),l=F(),{fieldLabel:u}=L(),d=R(),f=D(c.object,c.dimensionFields,[...t,...n]),p=B.useMemo(()=>{if(c.status!==`ok`)return null;let e=[],r=[],i=new Set,a=new Set,o=new Map;return y(c.rows,f).forEach((s,l)=>{let u=c.rows[l],f=Q(t,s),p=Q(n,s);if(!i.has(f)){i.add(f);let n={},r={};for(let e of t)n[e]=u[e],r[e]=s[e];e.push({id:f,label:$(t,s,d),key:n,display:r})}if(!a.has(p)){a.add(p);let e={},t={};for(let r of n)e[r]=u[r],t[r]=s[r];r.push({id:p,label:$(n,s,d),key:e,display:t})}o.set(w(f,p),{row:u,index:l})}),{rowHeaders:e,colHeaders:r,cells:o}},[c,t,n,f,d]);if(r.length===0)return(0,V.jsx)(Ie,{dataset:e});if(c.status===`loading`||c.status===`idle`)return(0,V.jsx)(Z,{status:c.status});if(c.status===`error`)return(0,V.jsx)(Z,{status:`error`,error:c.error});if(!p||p.rowHeaders.length===0)return(0,V.jsx)(Le,{});let{measureField:m,headerLabel:h}=N(c.fields,c.object,u,I(l)),g=l(`report.total`,`Total`),_=!!o,v=c.dimensionFields?[...t,...n].filter(e=>e in c.dimensionFields):[],b=(t,n,r)=>{let a=c.drillRanges?.[r],s=!!a&&Object.keys(a).length>0,l;if(c.object&&(v.length>0||s)){let e=Fe(c.drillRawRows?.[r],v,c.dimensionFields??{},i,a);if(e===null)return;l=e}o({dataset:e,groupKey:{...t,...n},runtimeFilter:i,object:c.object,objectFilter:l})},x=p.colHeaders.flatMap(e=>r.map(t=>({col:e,measure:t,header:r.length===1?e.label:`${e.label} · ${h(t)}`}))),S=e=>{let t=c.totals?.find(t=>Array.isArray(t.dimensions)&&t.dimensions.join(`,`)===e.join(`,`))?.rows;return t&&y(t,f)},C=new Map;for(let e of S(t)??[])C.set(Q(t,e),e);let T=new Map;for(let e of S(n)??[])T.set(Q(n,e),e);let E=S([])?.[0],O=C.size>0,ee=T.size>0;return(0,V.jsx)(`div`,{className:`overflow-auto max-h-[70vh] rounded-md border`,"data-testid":`dataset-matrix`,children:(0,V.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,V.jsx)(`thead`,{className:`bg-muted/40`,children:(0,V.jsxs)(`tr`,{children:[t.map(e=>(0,V.jsx)(`th`,{className:`px-2 py-1.5 text-left font-medium whitespace-nowrap`,children:h(e)},e)),x.map(e=>(0,V.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium whitespace-nowrap`,children:e.header},`${e.col.id}-${e.measure}`)),O&&r.map(e=>(0,V.jsx)(`th`,{className:`px-2 py-1.5 text-right font-medium whitespace-nowrap`,"data-testid":`matrix-total-col-header`,children:r.length===1?g:`${g} · ${h(e)}`},`total-${e}`))]})}),(0,V.jsxs)(`tbody`,{children:[p.rowHeaders.map(e=>(0,V.jsxs)(`tr`,{className:`border-t`,children:[t.map(t=>(0,V.jsx)(`td`,{className:`px-2 py-1 whitespace-nowrap font-medium`,children:P(e.display[t],d)},t)),x.map(t=>{let n=p.cells.get(w(e.id,t.col.id)),r=n?.row[t.measure],i=_&&n!=null;return(0,V.jsx)(`td`,{className:`px-2 py-1 text-right tabular-nums whitespace-nowrap${i?` ${Re}`:``}`,"data-testid":i?`dataset-drill-cell`:void 0,onClick:i?()=>b(e.key,t.col.key,n.index):void 0,children:A(r,m(t.measure)?.format,m(t.measure)?.currency,m(t.measure)?.percentScale,d)},`${t.col.id}-${t.measure}`)}),O&&r.map(t=>(0,V.jsx)(`td`,{className:`px-2 py-1 text-right tabular-nums whitespace-nowrap font-medium`,"data-testid":`matrix-row-total`,children:A(C.get(e.id)?.[t],m(t)?.format,m(t)?.currency,m(t)?.percentScale,d)},`total-${t}`))]},e.id)),ee&&(0,V.jsxs)(`tr`,{className:`border-t bg-muted/30 font-medium`,"data-testid":`matrix-total-row`,children:[t.length>0&&(0,V.jsx)(`td`,{colSpan:t.length,className:`px-2 py-1 whitespace-nowrap`,children:g}),x.map(e=>(0,V.jsx)(`td`,{className:`px-2 py-1 text-right tabular-nums whitespace-nowrap`,children:A(T.get(e.col.id)?.[e.measure],m(e.measure)?.format,m(e.measure)?.currency,m(e.measure)?.percentScale,d)},`${e.col.id}-${e.measure}`)),O&&r.map(e=>(0,V.jsx)(`td`,{className:`px-2 py-1 text-right tabular-nums whitespace-nowrap`,"data-testid":`matrix-grand-total`,children:A(E?.[e],m(e)?.format,m(e)?.currency,m(e)?.percentScale,d)},`grand-${e}`))]})]})]})})}var Ke=({report:e,dataSource:t,runtimeFilter:n,onDrill:r,className:i})=>{let a=je(e);Ae(e,a);let o=E(e.runtimeFilter,n),s=e.drilldown===!1?void 0:r,c=Be(e.type);if(c===`joined`&&Array.isArray(e.blocks))return(0,V.jsx)(`div`,{className:i,"data-testid":`dataset-joined-report`,"data-report-name":e.name,style:{display:`flex`,flexDirection:`column`,gap:24},children:e.blocks.map((e,n)=>{Ae(e,`${a} block \`${e.name??n}\``);let r=E(o,e.runtimeFilter),i=Y(e.columns),c=Ne(e.order),l=Be(e.type),u=l===`matrix`&&i.length>0?(0,V.jsx)(Ge,{dataset:String(e.dataset??``),rows:Y(e.rows),columnsAcross:i,values:Y(e.values),runtimeFilter:r,dataSource:t,onDrill:s,order:c}):(0,V.jsx)(ze,{dataset:String(e.dataset??``),rows:Y(e.rows),values:Y(e.values),runtimeFilter:r,dataSource:t,onDrill:s,order:c,withTotals:l===`summary`||l===`matrix`});return(0,V.jsxs)(`section`,{"data-testid":`dataset-report-block`,"data-block-id":e.name??`block-${n}`,className:`flex flex-col gap-2 rounded-lg border bg-card p-4`,children:[(0,V.jsxs)(`header`,{className:`flex flex-col gap-0.5`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold`,children:Me(e.label,e.name??`Block ${n+1}`)}),e.description?(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:Me(e.description,``)}):null]}),u]},e.name??`block-${n}`)})});let l=Y(e.columns),u=Ne(e.order),d=c===`matrix`&&l.length>0,f=e.chart&&typeof e.chart==`object`&&e.chart.type?e.chart:null,p=f?(0,V.jsx)(We,{dataset:String(e.dataset??``),chart:f,runtimeFilter:o,dataSource:t,order:u}):null,m=d?(0,V.jsx)(Ge,{dataset:String(e.dataset??``),rows:Y(e.rows),columnsAcross:l,values:Y(e.values),runtimeFilter:o,dataSource:t,onDrill:s,order:u}):(0,V.jsx)(ze,{dataset:String(e.dataset??``),rows:Y(e.rows),values:Y(e.values),runtimeFilter:o,dataSource:t,onDrill:s,order:u,withTotals:c===`summary`||c===`matrix`});return(0,V.jsxs)(`div`,{className:`${i??``} flex flex-col gap-3`,"data-testid":`dataset-report`,"data-report-name":e.name,"data-report-presentation":c,children:[d?m:p,d?p:m]})},qe=e=>{let{dataSource:t,rows:n,runtimeFilter:r,onDrill:i,className:a}=e,o=B.useContext(C),s=t??o?.dataSource,c=e.schema;if(c&&typeof c==`object`&&c.type===`report`&&c.report&&typeof c.report==`object`&&(c=c.report),De(c))return(0,V.jsx)(Ke,{report:c,dataSource:s,runtimeFilter:r,onDrill:i,className:a});if(g(c)){let e={type:`report-viewer`,report:x(c),data:n??[],showToolbar:!1};return(0,V.jsx)(`div`,{className:a,"data-testid":`report-presentation-bridge`,children:(0,V.jsx)(J,{schema:e})})}return(0,V.jsx)(he,{schema:c})};async function Je(e,t){let{dataSource:n,resource:r,queryParams:i,format:a,exportConfig:o,locale:s}=t,c=a||e.defaultExportFormat||`pdf`;try{let t=(await n.find(r,i)).data||[];return W(c,e,t,{format:c,...e.exportConfigs?.[c],...o},s),{success:!0,recordCount:t.length,format:c}}catch(e){return{success:!1,recordCount:0,format:c,error:e.message}}}function Ye(e,t,n={}){let{columns:r,filename:i,includeAggregationRow:a=!1,locale:o=`en`}=n,s=r||(e.fields||[]).map(Ze),c=s.map(e=>e.header),l=t.map((e,t)=>s.map(n=>{if(n.formula)return n.formula.replace(/\{ROW\}/g,String(t+2));let r=e[n.name];return Qe(r,n.numberFormat,o)}));if(a&&t.length>0){let n=s.map((n,r)=>{let i=(e.fields||[]).find(e=>e.name===n.name);if(i?.aggregation){let e=et(r),n=t.length+1;switch(i.aggregation){case`sum`:return`=SUM(${e}2:${e}${n})`;case`avg`:return`=AVERAGE(${e}2:${e}${n})`;case`count`:return`=COUNTA(${e}2:${e}${n})`;case`min`:return`=MIN(${e}2:${e}${n})`;case`max`:return`=MAX(${e}2:${e}${n})`;default:return``}}return``});l.push(n)}nt(``+[c.join(` `),...l.map(e=>e.join(` `))].join(`
|
|
59
|
+
`),i||`${e.title||`report`}.tsv`,`text/tab-separated-values`)}function Xe(e,t,n,r){return async()=>{let i=e.schedule;if(!i?.enabled)return[];let a=i.formats||[e.defaultExportFormat||`pdf`],o=[];for(let r of a){let i=await Je(e,{dataSource:t,resource:n,format:r});o.push(i)}return r(e,i),o}}function Ze(e){return{name:e.name,header:e.label||e.name}}function Qe(e,t,n=`en`){return e==null?``:typeof e==`number`&&t?H(e,n,$e(t)):tt(String(e))}function $e(e){if(e.includes(`%`))return{style:`percent`,minimumFractionDigits:0};let t=(e.match(/0/g)||[]).length;return{minimumFractionDigits:Math.max(0,t-1),maximumFractionDigits:Math.max(0,t-1)}}function et(e){let t=``,n=e;for(;n>=0;)t=String.fromCharCode(n%26+65)+t,n=Math.floor(n/26)-1;return t}function tt(e){if(e.length>0){let t=e.charAt(0);if(t===`=`||t===`+`||t===`-`||t===`@`||t===`|`)return`'${e}`}return e}function nt(e,t,n){let r=new Blob([e],{type:`${n};charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}var rt=t({DatasetReportRenderer:()=>Ke,LegacyReportRenderer:()=>he,ReportRenderer:()=>qe,ReportViewer:()=>J,createScheduleTrigger:()=>Xe,exportAsCSV:()=>ge,exportAsExcel:()=>ye,exportAsHTML:()=>U,exportAsJSON:()=>_e,exportAsPDF:()=>ve,exportExcelWithFormulas:()=>Ye,exportReport:()=>W,exportWithLiveData:()=>Je,formatValue:()=>q,isDatasetReport:()=>De,mergeFilters:()=>E});T.register(`report`,qe,{namespace:`plugin-report`,label:`Report`,category:`Report`,inputs:[{name:`title`,type:`string`},{name:`description`,type:`string`},{name:`chart`,type:`code`},{name:`report`,type:`object`,description:"The report to render, as `@objectstack/spec` declares it (`ReportSchema`: `name`, `label`, `type`, `dataset`, `rows`, `values`, …). When present, the block renders this report and reads none of its own presentation inputs."}]}),T.register(`report-viewer`,J,{namespace:`plugin-report`,label:`Report Viewer`,category:`Report`,inputs:[{name:`report`,type:`code`},{name:`showToolbar`,type:`boolean`}]});export{rt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{t as n,v as r}from"./vendor-react-BggL7APJ.js";import{Na as i,Ra as a,_a as o,ha as s}from"./vendor-objectstack-C4eD5dbT.js";import{Ci as c,Si as l,bt as u,et as d}from"./ui-components-D8wcRNrt.js";import{$i as f,At as p,Er as m,Lr as h,Or as g,Qi as _,Tr as v,Yr as ee,_ as te,ci as y,dt as ne,fn as b,in as re,jt as x,ni as ie,pt as ae,st as oe,u as S,wr as C,y as se}from"./framework-CAuH4h0L.js";import{h as w,p as ce,t as T}from"./i18n-runtime-CdWyaiOD.js";import{i as E}from"./vendor-ui-utils-DIUdEYii.js";import{v as le}from"./plugin-grid-Cp4RKtMJ.js";var D={"timeline.bucket.overdue":`Overdue`,"timeline.bucket.today":`Today`,"timeline.bucket.tomorrow":`Tomorrow`,"timeline.bucket.thisWeek":`This week`,"timeline.bucket.nextWeek":`Next week`,"timeline.bucket.later":`Later`,"timeline.bucket.noDate":`No date`,"timeline.bucket.unassigned":`Unassigned`,"timeline.scale.week":`Week {{n}}`,"timeline.scale.quarter":`Q{{quarter}} {{year}}`,"timeline.gantt.rowLabel":`Items`,"timeline.gantt.unusableRange.malformedDate":`Unusable gantt date range — {{path}} is {{value}}, which is not a valid date. Every gantt date has to parse: the startDate and endDate on every row item, plus any minDate / maxDate pinned on the schema.`,"timeline.gantt.unusableRange.inverted":`Unusable gantt date range — minDate {{minDate}} is after maxDate {{maxDate}}. A pinned minDate / maxDate overrides the range computed from the rows, so this axis has no columns and no bar can be placed on it; swap the two values.`,"timeline.gantt.unusableRange.malformedRow":`Unusable gantt rows — {{path}} is {{value}}, which is not a row shape. A gantt draws items as a list of rows, every row as an object with a label and its own items, and every row's items as a list of bars; a null, a number, a string or a plain object in any of those places cannot be drawn.`,"timeline.unsupported.objectBoundGantt":`Unsupported variant "gantt" — an object-bound timeline renders the feed variants ({{variants}}). Gantt needs literal rows, each with its own nested items, so the gantt axis (scale) has no effect here.`,"timeline.unconfigured.noDateAxis":`Timeline date axis required — this view declares no date field, and an object-bound timeline will not invent one. Declare one of: {{fields}}. The first is the spec spelling; the rest are legacy aliases.`},ue=`timeline.bucket.today`,de=(e,t)=>Object.entries(t??{}).reduce((e,[t,n])=>e.split(`{{${t}}}`).join(String(n)),D[e]||e),fe=w(D,ue),O=e(r(),1),k=n(),A=new Set([`hour`,`day`,`week`,`month`,`quarter`,`year`]);function pe(e){let t=e.scale;return typeof t==`string`&&A.has(t)?t:`month`}function j(e){return typeof e==`string`?v(e):new Date(e)}function M(e){let t=new Date(e);return t.setHours(0,0,0,0),t}var me=36e5,N={floor:e=>{let t=new Date(e);return t.setMinutes(0,0,0),t},step:e=>{e.setTime(e.getTime()+me)},label:(e,t,n)=>e.toLocaleString(n,{month:`short`,day:`numeric`,hour:`numeric`})},P={floor:M,step:e=>{e.setDate(e.getDate()+1)},label:(e,t,n)=>e.toLocaleDateString(n,{month:`short`,day:`numeric`})},F={floor:M,step:e=>{e.setDate(e.getDate()+7)},label:(e,t,n,r)=>r(`timeline.scale.week`,{n:t+1})},he={floor:e=>{let t=M(e);return t.setDate(1),t},step:e=>{e.setMonth(e.getMonth()+1)},label:(e,t,n)=>e.toLocaleDateString(n,{month:`short`,year:`numeric`})},ge={floor:e=>{let t=M(e);return t.setMonth(Math.floor(t.getMonth()/3)*3,1),t},step:e=>{e.setMonth(e.getMonth()+3)},label:(e,t,n,r)=>r(`timeline.scale.quarter`,{quarter:Math.floor(e.getMonth()/3)+1,year:e.getFullYear()})},I={floor:e=>{let t=M(e);return t.setMonth(0,1),t},step:e=>{e.setFullYear(e.getFullYear()+1)},label:e=>String(e.getFullYear())};function L(e){switch(e){case`hour`:return N;case`day`:return P;case`week`:return F;case`quarter`:return ge;case`year`:return I;default:return he}}function R(e){return typeof e==`string`?m(e):j(e)}function _e(e,t,n,r,i,a){let o=j(t).getTime(),s=j(n).getTime();if(Number.isNaN(o)||Number.isNaN(s)||o>s)return;let c=a===void 0?s:Math.max(s,a),l=L(e),u=[],d=l.floor(new Date(o));for(;d.getTime()<=c;){let e=d.getTime(),t=l.label(new Date(e),u.length,r,i);l.step(d),u.push({start:e,end:d.getTime(),label:t})}return{start:u[0].start,end:u[u.length-1].end,units:u}}function ve(e,t,n){let r=e.end-e.start;return{start:(t-e.start)/r*100,width:(n-t)/r*100}}function ye(e,t,n,r=`en`,i=de){let a=_e(e,t,n,r,i);return a?a.units.map(e=>e.label):[]}function be(){let e=b(new Date);return{minDate:e,maxDate:e}}function z(e){if(!Array.isArray(e))return{ok:!1,path:`items`,value:e};let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(typeof r!=`object`||!r||Array.isArray(r))return{ok:!1,path:`items[${n}]`,value:r};let i=r.items;if(i&&!Array.isArray(i))return{ok:!1,path:`items[${n}].items`,value:i};t.push({authored:r,label:r.label,items:i||[]})}return{ok:!0,rows:t}}function B(e){let t=e.flatMap(e=>e.items.flatMap(e=>[e.startDate,e.endDate]));if(t.length===0)return be();let n=Math.min(...t.map(e=>j(e).getTime())),r=Math.max(...t.map(e=>j(e).getTime())),i=Math.max(...e.flatMap(e=>e.items.map(e=>{let t=j(e.startDate).getTime(),n=R(e.endDate).getTime();return n>t?n-1:t})));return{minDate:b(new Date(n)),maxDate:b(new Date(r)),through:i}}var V=e=>{try{return Date.prototype.getTime.call(e),!0}catch{return!1}};function H(e){return typeof e==`string`?JSON.stringify(e):e===void 0?`undefined`:e===null?`null`:typeof e==`symbol`?e.toString():typeof e==`bigint`?`${e}n`:typeof e==`number`||typeof e==`boolean`?String(e):V(e)?Date.prototype.toString.call(e):Array.isArray(e)?`an array`:typeof e==`function`?`a function`:`an object`}var xe=e=>typeof e==`string`||typeof e==`number`&&Number.isFinite(e)||V(e);function Se(e,t,n){let r=e=>!xe(e)||Number.isNaN(j(e).getTime());for(let t=0;t<e.length;t++){let n=e[t].items;for(let e=0;e<n.length;e++)for(let i of[`startDate`,`endDate`]){let a=n[e]?.[i];if(r(a))return{path:`items[${t}].items[${e}].${i}`,value:a}}}for(let[e,i]of[[`minDate`,t],[`maxDate`,n]])if(i&&r(i))return{path:e,value:i}}function Ce(e,t,n){return ve(n,j(e).getTime(),R(t).getTime())}function U(e,t,n){let r=v(e);return t===`short`?r.toLocaleDateString(n):t===`long`?r.toLocaleDateString(n,{year:`numeric`,month:`long`,day:`numeric`}):Number.isNaN(r.getTime())?String(e):C(e)?b(r):r.toISOString().split(`T`)[0]}function we({label:e,color:t}){let n=t?{backgroundColor:`${t}22`,color:t,borderColor:`${t}55`}:void 0;return(0,k.jsx)(`span`,{className:l(`inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium`,!t&&`bg-muted text-muted-foreground border-transparent`),style:n,children:e})}function Te(e){let t=[];for(let n of e){let e=n.group==null?``:String(n.group),r=t[t.length-1];r&&r.key===e?r.items.push(n):t.push({key:e,items:[n]})}return t}var W=({schema:e,className:t,style:n,...r})=>{let{variant:i=`vertical`,items:a=[],dateFormat:o=`short`,onItemClick:s}=e,u=T(),{t:d}=fe();if(i===`vertical`){let e=Te(a),i=e.some(e=>e.key!==``),d=(e,t)=>{let n=e.color?{backgroundColor:`${e.color}33`,borderColor:e.color}:void 0,r=e.time?U(e.time,o,u):e.startDate?U(e.startDate,o,u):``,i=e.endDate&&e.endDate!==e.startDate?U(e.endDate,o,u):``,a=Array.isArray(e.meta)?e.meta:[];return(0,k.jsxs)(Ie,{density:`compact`,className:l(e.className,s&&`cursor-pointer`),onClick:()=>s?.(e),children:[(0,k.jsx)(K,{variant:e.color?`default`:e.variant||`default`,style:n,children:e.icon&&(0,k.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,k.jsxs)(Re,{children:[(r||i)&&(0,k.jsxs)(J,{dateTime:e.time||e.startDate,className:`!mb-1 text-xs`,children:[r,i&&(0,k.jsxs)(`span`,{className:`text-muted-foreground/70`,children:[` → `,i]})]}),e.title&&(0,k.jsx)(q,{className:`text-sm sm:text-base mb-1`,children:e.title}),a.length>0&&(0,k.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-1 mb-1`,children:a.map(e=>(0,k.jsx)(we,{label:e.label,color:e.color},e.key))}),e.description&&(0,k.jsx)(Y,{className:`text-sm text-muted-foreground line-clamp-2 sm:line-clamp-none`,children:e.description}),c(e.content)]})]},t)};return i?(0,k.jsx)(`div`,{...y(r),className:l(`px-4 sm:px-6 py-2`,t),style:n,children:e.map((e,t)=>(0,k.jsxs)(`section`,{className:`mb-4`,children:[(0,k.jsxs)(`header`,{className:`sticky top-0 z-10 -mx-4 sm:-mx-6 px-4 sm:px-6 py-1.5 backdrop-blur bg-background/90 text-xs font-semibold uppercase tracking-wide text-muted-foreground border-b`,children:[(0,k.jsx)(`span`,{children:e.key}),(0,k.jsx)(`span`,{className:`ml-2 text-muted-foreground/60 font-normal normal-case`,children:e.items.length})]}),(0,k.jsx)(G,{className:`mt-3`,children:e.items.map((e,n)=>d(e,`${t}-${n}`))})]},`${e.key}-${t}`))}):(0,k.jsx)(G,{...y(r),className:t,style:n,children:a.map((e,t)=>d(e,t))})}if(i===`horizontal`)return(0,k.jsx)(ze,{...y(r),className:l(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),style:n,children:a.map((e,t)=>(0,k.jsxs)(Be,{className:l(e.className,s&&`cursor-pointer`),onClick:()=>s?.(e),children:[(0,k.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,k.jsx)(K,{variant:e.variant||`default`,children:e.icon&&(0,k.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,k.jsxs)(`div`,{className:`mt-4 text-center`,children:[e.time&&(0,k.jsx)(J,{dateTime:e.time,children:U(e.time,o,u)}),e.title&&(0,k.jsx)(q,{children:e.title}),e.description&&(0,k.jsx)(Y,{className:`text-center line-clamp-2 sm:line-clamp-none`,children:e.description}),c(e.content)]})]}),t<a.length-1&&(0,k.jsx)(`div`,{className:`absolute left-full w-16 border-t-2 border-gray-200 top-3`})]},t))});if(i===`gantt`){let i=z(a);if(!i.ok)return(0,k.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-unusable-date-range`,role:`alert`,children:d(`timeline.gantt.unusableRange.malformedRow`,{path:i.path,value:H(i.value)})});let c=i.rows,f=Se(c,e.minDate,e.maxDate);if(f)return(0,k.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-unusable-date-range`,role:`alert`,children:d(`timeline.gantt.unusableRange.malformedDate`,{path:f.path,value:H(f.value)})});let p=B(c),m=e.minDate||p.minDate,h=e.maxDate||p.maxDate,g=_e(pe(e),m,h,u,d,e.maxDate?void 0:p.through);return g?(0,k.jsxs)(X,{...y(r),className:l(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),style:n,children:[(0,k.jsxs)(Ve,{children:[(0,k.jsx)(Z,{className:`flex items-center px-2 sm:px-4 py-2 sm:py-3`,children:(0,k.jsx)(`span`,{className:`font-semibold text-xs sm:text-sm`,children:e.rowLabel||d(`timeline.gantt.rowLabel`)})}),(0,k.jsx)(Q,{children:(0,k.jsx)(`div`,{className:`flex h-full`,children:g.units.map((e,t)=>(0,k.jsx)(`div`,{className:`shrink-0 min-w-0 overflow-hidden px-1 sm:px-2 py-2 sm:py-3 border-r text-xs font-medium text-center`,style:{width:`${ve(g,e.start,e.end).width}%`},children:e.label},t))})})]}),(0,k.jsx)(`div`,{children:(0,k.jsxs)(`div`,{className:`flex`,children:[(0,k.jsx)(Z,{children:c.map((e,t)=>(0,k.jsx)($,{children:(0,k.jsx)(He,{title:e.label,className:`truncate`,children:e.label})},t))}),(0,k.jsx)(Q,{className:`relative`,children:c.map((e,t)=>(0,k.jsx)($,{className:`relative`,children:e.items.map((n,r)=>{let i=Ce(n.startDate,n.endDate,g);return(0,k.jsx)(Ue,{start:i.start,width:i.width,variant:n.variant||`default`,onClick:()=>s?.(n,e.authored,t,r),title:`${n.title||``}\n${U(n.startDate,o,u)} - ${U(n.endDate,o,u)}`,children:(0,k.jsx)(We,{children:n.title})},r)})},t))})]})})]}):(0,k.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-unusable-date-range`,role:`alert`,children:d(`timeline.gantt.unusableRange.inverted`,{minDate:H(m),maxDate:H(h)})})}return null};_.register(`timeline`,W,{namespace:`plugin-timeline`,skipFallback:!0,label:`Timeline`,category:`data-display`,inputs:[{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`]},{name:`items`,type:`array`,description:`For vertical/horizontal: Array of { time, title, description, variant, icon, content }. For gantt: Array of { label, items: [{ title, startDate, endDate, variant }] }`},{name:`dateFormat`,type:`enum`,enum:[`short`,`long`,`iso`]},{name:`scale`,type:`enum`,enum:[...A]},{name:`rowLabel`,type:`string`},{name:`minDate`,type:`string`,description:`Override auto-calculated min date (YYYY-MM-DD)`},{name:`maxDate`,type:`string`,description:`Override auto-calculated max date (YYYY-MM-DD)`},{name:`className`,type:`string`}],defaultProps:{variant:`vertical`,dateFormat:`short`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`,icon:`🚀`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`,icon:`🎨`},{time:`2024-03-15`,title:`Beta Release`,description:`Released beta version to testers`,variant:`warning`,icon:`⚡`},{time:`2024-04-01`,title:`Launch`,description:`Official product launch`,variant:`success`,icon:`🎉`}]},examples:{vertical:{variant:`vertical`,dateFormat:`long`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`}]},horizontal:{variant:`horizontal`,dateFormat:`short`,items:[{time:`2024-01-01`,title:`Q1`,description:`First quarter`,variant:`default`},{time:`2024-04-01`,title:`Q2`,description:`Second quarter`,variant:`info`},{time:`2024-07-01`,title:`Q3`,description:`Third quarter`,variant:`warning`},{time:`2024-10-01`,title:`Q4`,description:`Fourth quarter`,variant:`success`}]},gantt:{variant:`gantt`,dateFormat:`short`,scale:`month`,rowLabel:`Projects`,items:[{label:`Backend Development`,items:[{title:`API Design`,startDate:`2024-01-01`,endDate:`2024-01-31`,variant:`success`},{title:`Implementation`,startDate:`2024-02-01`,endDate:`2024-03-31`,variant:`info`}]},{label:`Frontend Development`,items:[{title:`UI Design`,startDate:`2024-01-15`,endDate:`2024-02-15`,variant:`warning`},{title:`Component Dev`,startDate:`2024-02-15`,endDate:`2024-04-15`,variant:`default`}]},{label:`Testing`,items:[{title:`QA Phase`,startDate:`2024-03-01`,endDate:`2024-04-30`,variant:`danger`}]}]}}}),s();function Ee(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function De(e,t){return Ee(e)?e:t}function Oe(e,t){return e==null||Ee(e)?null:`[ObjectUI] ObjectTimeline row cap: ${typeof t==`string`&&t?`object-timeline on ${t}`:`object-timeline`} declared limit: ${String(e)}, which is not a positive integer. A row cap must be a positive integer (the spec refuses zero and negative values), so it was ignored and this timeline fell back to its default row cap (100).`}var ke=[`vertical`,`horizontal`],Ae=[`timeline.startDateField`,`timeline.dateField`,`mapping.date`,`startDateField`,`dateField`],je=i({title:a().optional(),date:a().optional(),description:a().optional(),variant:a().optional()}),Me=i({mapping:je.optional(),objectName:a().optional(),titleField:a().optional(),dateField:a().optional(),startDateField:a().optional(),endDateField:a().optional(),descriptionField:a().optional(),groupByField:a().optional(),colorField:a().optional(),scale:o([`hour`,`day`,`week`,`month`,`quarter`,`year`]).optional()}),Ne=({schema:e,dataSource:t,className:n,onRowClick:r,onItemClick:i,...a})=>{let[o,s]=(0,O.useState)([]),[c,l]=(0,O.useState)(()=>{let t=Array.isArray(e.items)&&e.items.length>0,n=Array.isArray(a.data)&&a.data.length>0;return!t&&!n&&!!e.objectName}),[f,m]=(0,O.useState)(null),_=(0,O.useRef)(0),[y,b]=(0,O.useState)(0),x=e.timeline;(0,O.useEffect)(()=>{let t=Me.safeParse(e);t.success||console.warn(`[ObjectTimeline] Invalid timeline configuration:`,t.error.format())},[e]),(0,O.useEffect)(()=>{let t=Oe(e.limit,e.objectName);t&&console.warn(t)},[e.limit,e.objectName]);let S=p(e.bind),{ready:C,def:w}=se(e.objectName??``,t),T=d(),E=ae(),D=ne(e.filter,E),ue=JSON.stringify(D??null),de=JSON.stringify(e.sort??null),A=!!e.objectName&&!S&&!e.items&&!a.data,pe=te(A?e.objectName:void 0);(0,O.useEffect)(()=>{let n=++_.current,r=()=>_.current===n,i=async()=>{if(!t||typeof t.find!=`function`||!e.objectName){l(!1);return}l(!0);try{let n=ee(w?.fields),i=T?.isLoaded?n.filter(t=>T.checkField(e.objectName,t,`read`)):n,a=await t.find(e.objectName,{$filter:D,$orderby:g(e.sort),$top:De(e.limit,100),...i.length>0?{$expand:i}:{}}),o=ie(a);r()&&(s(o),m(null))}catch(e){console.error(e),r()&&m(e)}finally{r()&&l(!1)}};if(A){if(!C)return;i()}else l(!1)},[e.objectName,t,S,e.items,a.data,y,C,w,ue,de,e.limit,T,pe]);let j=a.data||S||o,{t:M}=fe(),{fieldOptionLabel:me}=ce(),N=x?.titleField??e.mapping?.title??e.titleField??`name`,P=x?.startDateField??x?.dateField??e.mapping?.date??e.startDateField??e.dateField,F=x?.endDateField??e.endDateField??P,he=e.mapping?.description??e.descriptionField??`description`,ge=e.mapping?.variant??`variant`,I=x?.groupByField??e.groupByField,L=x?.colorField??e.colorField,R=(0,O.useMemo)(()=>{if(e.items)return e.items;if(!j||!Array.isArray(j)||!P)return[];let t=P,n=F??P,r=w?.fields??{},i=e.objectName||``,a=e=>{if(!e||!r[e]?.options)return{};let t={};for(let n of r[e].options)n&&n.value!=null&&(t[String(n.value)]=n);return t},o=[`status`,`priority`].filter(e=>r[e]),s={};for(let e of o)s[e]=a(e);let c=re(r[L??``]),l=(e,t,n)=>{if(t==null||t===``)return null;let r=n[String(t)];return{label:r?.label?me(i,e,String(t),r.label):String(t),color:r?.color}},u=j.map(e=>{let r=e[t],a=e[n],u=L?e[L]:void 0,d=I?e[I]:void 0,f=[];if(i)for(let t of o){let n=l(t,e[t],s[t]||{});n&&f.push({key:t,label:n.label,color:n.color})}return{title:h(e,N),time:r,startDate:r,endDate:a,description:h(e,he),variant:e[ge]||`default`,color:c(u),group:d,meta:f,_data:e}}),d=e=>{if(!e)return 1/0;let t=v(e).getTime();return Number.isNaN(t)?1/0:t};u.sort((e,t)=>d(e.startDate)-d(t.startDate));let f=new Date,p=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),m=p(f),g=864e5,_=m-(f.getDay()+6)%7*g+7*g,ee=_+7*g,te=e=>{if(!e)return M(`timeline.bucket.noDate`);let t=p(v(e));return Number.isNaN(t)?M(`timeline.bucket.noDate`):t<m?M(`timeline.bucket.overdue`):t===m?M(`timeline.bucket.today`):t===m+g?M(`timeline.bucket.tomorrow`):M(t<_?`timeline.bucket.thisWeek`:t<ee?`timeline.bucket.nextWeek`:`timeline.bucket.later`)};if(I&&!u.every(e=>e.group==null||e.group===``)){let e=a(I);return u.map(t=>{let n=l(I,t.group,e);return{...t,group:n?n.label:t.group!=null&&t.group!==``?String(t.group):M(`timeline.bucket.unassigned`)}})}return u.map(e=>({...e,group:te(e.startDate)}))},[e.items,j,w,e.objectName,N,P,F,he,ge,L,I,M,me]),_e=(0,O.useCallback)(async()=>{b(e=>e+1)},[]),{ref:ve,isRefreshing:ye,pullDistance:be}=le({onRefresh:_e,enabled:!!e.objectName&&!!t}),z=oe({navigation:e.navigation,objectName:e.objectName,onRowClick:r??i}),B=x?.scale??e.scale,V=!!e.items;if(!V&&e.variant===`gantt`)return(0,k.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-unsupported-variant`,role:`alert`,children:M(`timeline.unsupported.objectBoundGantt`,{variants:ke.join(`, `)})});if(!V&&!P)return(0,k.jsx)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-missing-date-axis`,role:`alert`,children:M(`timeline.unconfigured.noDateAxis`,{fields:Ae.join(`, `)})});let H={...e,items:R||[],className:n||e.className,...B?{scale:B}:{},onItemClick:e=>{let t=e._data||e;z.handleClick(t),i?.(t)}};return f?(0,k.jsxs)(`div`,{className:`p-4 text-destructive`,"data-testid":`timeline-error`,role:`alert`,children:[`Error loading timeline: `,f.message]}):c&&(!R||R.length===0)?(0,k.jsxs)(`div`,{className:`flex flex-col h-full min-h-[200px] p-4 gap-3`,"data-testid":`timeline-loading`,role:`status`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,k.jsx)(`span`,{className:`sr-only`,children:`Loading timeline…`}),[0,1,2,3].map(e=>(0,k.jsxs)(`div`,{className:`flex items-start gap-3`,style:{opacity:Math.max(.3,1-e*.18)},children:[(0,k.jsx)(`div`,{className:`h-3 w-3 rounded-full bg-muted/70 animate-pulse mt-1.5 shrink-0`}),(0,k.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,k.jsx)(`div`,{className:`h-4 w-1/3 rounded bg-muted/70 animate-pulse`}),(0,k.jsx)(`div`,{className:`h-3 w-2/3 rounded bg-muted/50 animate-pulse`})]})]},e))]}):(0,k.jsxs)(`div`,{ref:ve,className:`relative overflow-auto h-full min-w-0`,"data-testid":`timeline-canvas`,children:[be>0&&(0,k.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:be},children:ye?`Refreshing…`:`Pull to refresh`}),(0,k.jsx)(W,{schema:H}),z.isOverlay&&(0,k.jsx)(u,{...z,title:`Timeline Item`,children:e=>(0,k.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,k.jsxs)(`div`,{className:`flex flex-col`,children:[(0,k.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,k.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})},Pe=t({ObjectTimeline:()=>Ne,ObjectTimelineRenderer:()=>Ke,TIMELINE_SCALES:()=>A,Timeline:()=>G,TimelineContent:()=>Re,TimelineDescription:()=>Y,TimelineGantt:()=>X,TimelineGanttBar:()=>Ue,TimelineGanttBarContent:()=>We,TimelineGanttGrid:()=>Q,TimelineGanttHeader:()=>Ve,TimelineGanttLabel:()=>He,TimelineGanttRow:()=>$,TimelineGanttRowLabels:()=>Z,TimelineHorizontal:()=>ze,TimelineHorizontalItem:()=>Be,TimelineItem:()=>Ie,TimelineMarker:()=>K,TimelineRenderer:()=>W,TimelineTime:()=>J,TimelineTitle:()=>q,generateTimeScaleHeaders:()=>ye,resolveTimelineScale:()=>pe,timelineItemVariants:()=>Fe,timelineMarkerVariants:()=>Le}),G=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`ol`,{ref:n,className:l(`relative ml-3 border-l border-gray-200`,e),...t}));G.displayName=`Timeline`;var Fe=E(`ml-6`,{variants:{density:{default:`mb-10`,compact:`mb-3`,comfortable:`mb-6`}},defaultVariants:{density:`default`}}),Ie=O.forwardRef(({className:e,density:t,...n},r)=>(0,k.jsx)(`li`,{ref:r,className:l(Fe({density:t}),e),...n}));Ie.displayName=`TimelineItem`;var Le=E(`absolute -left-3 w-6 h-6 rounded-full border-2 flex items-center justify-center`,{variants:{variant:{default:`bg-blue-200 border-blue-400`,success:`bg-emerald-200 border-emerald-500`,warning:`bg-amber-200 border-amber-500`,danger:`bg-red-200 border-red-500`,info:`bg-purple-200 border-purple-500`,todo:`bg-slate-200 border-slate-400`,"in-progress":`bg-blue-200 border-blue-500`,done:`bg-emerald-200 border-emerald-500`}},defaultVariants:{variant:`default`}}),K=O.forwardRef(({className:e,variant:t=`default`,...n},r)=>(0,k.jsx)(`div`,{ref:r,className:l(Le({variant:t}),e),...n}));K.displayName=`TimelineMarker`;var Re=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:e,...t}));Re.displayName=`TimelineContent`;var q=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`h3`,{ref:n,className:l(`font-semibold text-lg mb-1`,e),...t}));q.displayName=`TimelineTitle`;var J=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`time`,{ref:n,className:l(`text-sm font-normal text-gray-500 mb-2 block`,e),...t}));J.displayName=`TimelineTime`;var Y=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`p`,{ref:n,className:l(`text-base text-gray-700`,e),...t}));Y.displayName=`TimelineDescription`;var ze=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:l(`relative flex overflow-x-auto py-8`,e),...t}));ze.displayName=`TimelineHorizontal`;var Be=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:l(`shrink-0 w-64 relative`,e),...t}));Be.displayName=`TimelineHorizontalItem`;var X=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:l(`relative w-full border rounded-lg overflow-hidden`,e),...t}));X.displayName=`TimelineGantt`;var Ve=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:l(`flex border-b bg-gray-50`,e),...t}));Ve.displayName=`TimelineGanttHeader`;var Z=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:l(`w-48 border-r bg-white`,e),...t}));Z.displayName=`TimelineGanttRowLabels`;var Q=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:l(`flex-1 overflow-x-auto`,e),...t}));Q.displayName=`TimelineGanttGrid`;var $=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:l(`flex items-center border-b min-h-12`,e),...t}));$.displayName=`TimelineGanttRow`;var He=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:l(`px-4 py-2 font-medium text-sm truncate`,e),...t}));He.displayName=`TimelineGanttLabel`;var Ue=O.forwardRef(({className:e,start:t=0,width:n=100,variant:r=`default`,...i},a)=>(0,k.jsx)(`div`,{ref:a,className:l(`absolute h-8 rounded-md transition-colors cursor-pointer`,{default:`bg-blue-500 hover:bg-blue-600`,success:`bg-green-500 hover:bg-green-600`,warning:`bg-yellow-500 hover:bg-yellow-600`,danger:`bg-red-500 hover:bg-red-600`,info:`bg-purple-500 hover:bg-purple-600`}[r],e),style:{left:`${t}%`,width:`${n}%`},...i}));Ue.displayName=`TimelineGanttBar`;var We=O.forwardRef(({className:e,...t},n)=>(0,k.jsx)(`div`,{ref:n,className:l(`px-2 py-1 text-white text-xs font-medium truncate`,e),...t}));We.displayName=`TimelineGanttBarContent`;var Ge={filter:!0,sort:!0,limit:`limit`},Ke=f(({schema:e,...t})=>{let{dataSource:n}=x()||{};return(0,k.jsx)(S,{schema:e,mapping:Ge,dataSource:n,testId:`object-timeline`,errorTitle:`This timeline’s data source could not be resolved`,children:e=>(0,k.jsx)(Ne,{schema:e,dataSource:n,...t})})}),qe=[{name:`objectName`,type:`string`,description:"Object this timeline binds to. Optional because the component-level `dataSource` binding can supply the object instead — this block registers through `ElementDataSourceGate`, which lowers the binding onto this key before the renderer sees the node. A timeline drawn from `items`, `data` or a `bind` path issues no query and needs none to draw, but `navigation` still reads it: without it `page` opens nothing and `new_window` / `openNewTab` open no record page."},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`]},{name:`filter`,type:`array`,description:"Base query filter in the rule-array form `[{ field, operator, value }, ...]`, narrowing the records the timeline fetches. Context tokens such as `{current_user_id}` are resolved first, then the filter is lowered to `$filter` on the query. Authored `items` or `data` suppress that query, so the key then narrows nothing. The MongoDB-style record form is not this key’s shape."},{name:`sort`,type:`array`,description:"Order of the records the timeline fetches, in `[{ field, order }]` form, lowered to `$orderby` on the same query. The rail draws entries composed from records by their start date, earliest first, whatever this order. Authored `items` or `data` suppress the query, so the key then orders nothing."},{name:`navigation`,type:`object`,description:"What an entry click opens — the `{ mode, size, openNewTab, preventNavigation }` block a list view declares. With the key ABSENT a click opens nothing: this renderer supplies no drawer default. `mode` is an overlay (`drawer`, `modal`, `split`, `popover`), `new_window`, `page` or `none`, and a block written without `mode` takes the spec’s `page` default. `drawer`, `modal` and `popover` open the entry’s record in that overlay, but `split` opens nothing, because the timeline hands the split shell no main panel; `new_window` opens the record page in a new tab; `none` opens nothing. `page` opens the record page of the timeline’s `objectName` through the record navigator the host publishes (the console publishes one on its custom pages, record pages and list views); under a host that publishes none, such as an embedded renderer, or on a timeline that names no `objectName`, there is no record page to open and the click opens nothing. `preventNavigation: true` opens nothing whatever the mode, `openNewTab: true` opens the record page in a new tab and outranks every mode except `none`, and `size` sets the overlay width. On a timeline that names no `objectName`, `new_window` and `openNewTab` open no record page either: the new tab’s address is a slash and the entry’s `id` alone (its `_id` when it has no `id`, `undefined` when it has neither). A click handler from a parent view outranks the whole key."},{name:`timeline`,type:`object`,description:"Timeline configuration, the author face — the same block `ListViewSchema.timeline` declares: { startDateField, endDateField, titleField, groupByField, colorField, scale }. The flat top-level spellings beside it are the runtime handoff, not a second authoring spelling. On entries composed from records, `startDateField` is the entry’s date, `endDateField` the end printed after it, `titleField` the title, `groupByField` the field whose value heads each group (without it, entries group into date buckets), and `colorField` the field whose option colour, or the value itself when it is a colour literal, paints the marker. Each outranks the flat key of the same binding, and `titleField` / `startDateField` outrank `mapping`’s `title` / `date`. `scale` sets the axis unit of the gantt branch, which on this block draws authored `items` only."},{name:`limit`,type:`number`,description:"Maximum number of records loaded onto the rail (row cap); lowered to the query's top-level `$top` (renderer default 100). A timeline renders one rail with no pagination control, so this is the author's window rather than a page size. A value that is not a positive integer is ignored with a console warning, and the default cap applies."},{name:`data`,type:`array`,description:"Pre-fetched records — read FIRST as the rail's row source, ahead of the data-scope binding and the fetch, and composed into entries through the same `timeline` field bindings a fetched row takes; authoring it suppresses the object query entirely. Distinct from `items`, which is the already-composed entry shape and wins over this key when both are written."},{name:`items`,type:`array`,description:"Static inline entries — read ahead of every record source, `data` above included, and bypasses the object query entirely (the renderer becomes a pass-through). Each element is objectui's declared timeline element, `@object-ui/types`'s `TimelineFeedItem` (`variant` absent / `vertical` / `horizontal`) or `TimelineGanttItem` (`variant: 'gantt'`), the arm this node's `variant` selects. They are drawn as written: the `timeline` block’s field bindings, `mapping` and `descriptionField` do not apply to them."},{name:`dateFormat`,type:`enum`,enum:[`short`,`long`,`iso`],description:"How each entry's date is rendered (renderer default `short`): `short` / `long` are locale-formatted, `iso` is the locale-free machine form."},{name:`rowLabel`,type:`string`,description:"Header label for the gantt row column — read by the gantt branch only, which on this block needs authored `items`. Without it the header shows the default label."},{name:`minDate`,type:`string`,description:"Pin the gantt axis start (ISO `yyyy-mm-dd`) instead of deriving it from the rows; only a non-empty value is honoured. A value that is not a date, or a `minDate` after `maxDate`, refuses the chart with a diagnostic naming it."},{name:`maxDate`,type:`string`,description:"Pin the gantt axis end (ISO `yyyy-mm-dd`) instead of deriving it from the rows; only a non-empty value is honoured. A value that is not a date, or a `maxDate` before `minDate`, refuses the chart with a diagnostic naming it."},{name:`descriptionField`,type:`string`,description:"Field rendered as each entry's description (renderer default `description`). It is declared flat because the `timeline` block has no member for it, and `mapping.description` outranks it when both are written."},{name:`mapping`,type:`object`,description:"Record-to-entry field mapping ({ title, date, description, variant }) — the objectui-side binding record read BETWEEN the `timeline` block and the flat fallbacks. Its `variant` member (the field whose value picks each marker colour, renderer default `variant`) is the only spelling that binding has. On the vertical rail a colour that `timeline.colorField` resolves for an entry outranks that marker colour."}];_.register(`object-timeline`,Ke,{namespace:`plugin-timeline`,label:`Object Timeline`,category:`view`,inputs:[...qe]}),_.register(`timeline`,Ke,{namespace:`view`,label:`Timeline View`,category:`view`,inputs:[...qe]});export{Pe as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{t as n,v as r}from"./vendor-react-BggL7APJ.js";import{Ct as i,Si as a,St as o,bt as ee,et as te,ht as ne,xt as s}from"./ui-components-D8wcRNrt.js";import{Bt as c,Fr as l,Qi as u,Qn as re,Qr as d,Rt as f,Xr as p,Yr as m,_ as h,dt as ie,ei as g,jt as _,n as ae,pt as oe,st as v,ti as y,y as se,zt as ce}from"./framework-CAuH4h0L.js";import{h as b,p as x}from"./i18n-runtime-CdWyaiOD.js";import{t as S}from"./vendor-icon-chevron-down-BEf_jTEE.js";import{t as C}from"./vendor-icon-chevron-right-DbnKwHYQ.js";import{c as w}from"./plugin-grid-Cp4RKtMJ.js";var T=e(r(),1),E=n(),le=b({"detail.recordDetail":`Record Detail`,"grid.refreshing":`Refreshing…`},`detail.recordDetail`),ue=[];function D(e){return d(e)||(e&&typeof e==`object`?e.key:void 0)||void 0}function de(e){let t=e.tree||{},n=Array.isArray(e.fields)?e.fields:Array.isArray(t.fields)?t.fields:[];return{parentField:D(e.parentField??t.parentField),labelField:D(e.labelField??t.labelField)??`name`,fields:n.map(D).filter(e=>!!e),defaultExpandedDepth:e.defaultExpandedDepth??t.defaultExpandedDepth}}function fe(e,t){let n=e?.fields;if(!n||typeof n!=`object`)return;let r;for(let[e,i]of Object.entries(n)){let n=i?.reference;if(i?.type===`tree`&&(n===void 0||t&&n===t))return e;!r&&(i?.type===`lookup`||i?.type===`master_detail`)&&n&&t&&n===t&&(r=e)}return r}function O(e){let t=e?.id??e?._id;return t==null?void 0:String(t)}function k(e,t){if(!t)return;let n=e?.[t];if(n!=null){if(typeof n==`object`){let e=n.id??n._id;return e==null?void 0:String(e)}return String(n)}}function pe(e,t){let n=new Map,r=[];for(let t of e){let e=O(t);e!=null&&(n.set(e,{id:e,record:t,depth:0,children:[]}),r.push(e))}let i=[];for(let e of r){let r=n.get(e),a=k(r.record,t),o=a==null?void 0:n.get(a);o&&o!==r?o.children.push(r):i.push(r)}let a=(e,t)=>{for(let n of e)n.depth=t,a(n.children,t+1)};return a(i,0),i}function me(e,t){let n=[],r=e=>{for(let i of e)n.push(i),i.children.length>0&&t.has(i.id)&&r(i.children)};return r(e),n}function A(e,t){let n=new Set,r=e=>{for(let i of e)i.children.length!==0&&(t==null||i.depth<t)&&(n.add(i.id),r(i.children))};return r(e),n}function j(e,t,n){let r=A(e,t);if(n.size===0)return r;let i=e=>{for(let t of e){let e=n.get(t.id);e===!0?r.add(t.id):e===!1&&r.delete(t.id),i(t.children)}};return i(e),r}function M(e,t){if(e==null)return``;let n=Array.isArray(t?.fieldDef?.options)?t.fieldDef.options:null;if(n&&n.length>0){let r=t.objectName?t.translateOptions(t.objectName,t.fieldName,n):n,i=e=>{let t=r.find(t=>t?.value===e);if(t)return String(t.label??e);let n=String(e).toLowerCase(),i=r.find(e=>String(e?.value).toLowerCase()===n);return i?String(i.label??e):f(String(e))};return Array.isArray(e)?e.filter(e=>e!=null).map(i).join(`, `):i(e)}return typeof e==`object`&&p(t?.fieldDef)?l(void 0,e):String(typeof e==`object`?e.name??e.label??e.id??e._id??``:e)}var N=({schema:e,dataSource:t,className:n,onRowClick:r,...l})=>{let[u,d]=(0,T.useState)(null),[f,p]=(0,T.useState)(null),[_,b]=(0,T.useState)(!0),[D,O]=(0,T.useState)(null),k=(0,T.useMemo)(()=>ce(e,`view-data`),[e]),A=c(e,k)??``,{ready:N,def:P}=se(A,t),F=k?.provider,I=k?.provider===`object`?k.object:void 0,L=k?.provider===`value`?k.items:void 0,R=te(),he=oe(),z=ie(e.filter,he),ge=h(t?I:void 0);(0,T.useEffect)(()=>{let e=!1;return(async()=>{try{if(b(!0),O(null),F===`object`&&t&&typeof t.find==`function`){if(!N)return;let n=m(P?.fields),r=R?.isLoaded?n.filter(e=>R.checkField(I,e,`read`)):n,i=await t.find(I,{$filter:z,...y(),...r.length>0?{$expand:r}:{}}),a=g(i);e||(d({provider:F,object:I,rows:a.rows}),p(a),b(!1));return}let n=l.data;if(Array.isArray(n)){e||(d({provider:F,object:I,rows:n}),p(null),b(!1));return}if(F===`value`){let t=await new re({items:L??[]}).find(``,{$filter:z,...y()}),n=g(t);e||(d({provider:F,object:I,rows:n.rows}),p(n),b(!1));return}e||(d({provider:F,object:I,rows:[]}),b(!1))}catch(t){e||(O(t),b(!1))}})(),()=>{e=!0}},[F,I,L,t,z,P,N,l.data,R,ge]);let B=(0,T.useMemo)(()=>de(e),[e]),V=(0,T.useMemo)(()=>B.parentField??fe(P,e.objectName),[B.parentField,P,e.objectName]),H=u&&u.provider===F&&u.object===I?u.rows:null,U=(0,T.useMemo)(()=>pe(H??ue,V),[H,V]),[W,_e]=(0,T.useState)(()=>new Map),G=(0,T.useMemo)(()=>j(U,B.defaultExpandedDepth,W),[U,B.defaultExpandedDepth,W]),ve=(e,t)=>_e(n=>{let r=new Map(n);return r.set(e,!t),r}),ye=(0,T.useMemo)(()=>me(U,G),[U,G]),K=x(),q=c(e,k)??e.objectName,J=e=>{let t=P?.fields?.[e]?.label||e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase());return q?K.fieldLabel(q,e,t):t},Y=e=>({fieldDef:P?.fields?.[e],fieldName:e,objectName:q,translateOptions:K.translateOptions}),X=v({navigation:e.navigation,objectName:c(e,k)??e.objectName,onRowClick:r}),{anchorRef:be,captureAnchor:xe}=i(),{t:Z}=le();if(D)return(0,E.jsx)(`div`,{className:a(`flex items-center justify-center h-40 text-destructive`,n),children:(0,E.jsxs)(`p`,{children:[`Failed to load tree: `,D.message]})});if(H===null||_&&H.length===0)return(0,E.jsx)(`div`,{className:a(`flex items-center justify-center h-40 text-muted-foreground`,n),children:(0,E.jsx)(`p`,{children:`Loading…`})});if(H.length===0)return(0,E.jsx)(`div`,{className:a(`flex items-center justify-center h-40 text-muted-foreground`,n),children:(0,E.jsx)(`p`,{children:`No records`})});let Q=n=>{if(!X.isOverlay)return null;let r=c(e,k)??e.objectName;return(0,E.jsx)(ee,{...X,title:Z(`detail.recordDetail`),mainContent:n,popoverAnchorRef:be,storageKey:r?o(r):void 0,legacyStorageKey:r?s(r):void 0,width:X.width??`min(960px, 60vw)`,children:e=>{let n=e,i=n.id??n._id,a=!!P?.fields&&Object.keys(P.fields).length>0;return!r||i==null||!a?(0,E.jsx)(`div`,{className:`space-y-3 p-4`,children:Object.entries(n).map(([e,t])=>(0,E.jsxs)(`div`,{className:`flex flex-col`,children:[(0,E.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,E.jsx)(`span`,{className:`text-sm`,children:M(t,Y(e))||`—`})]},e))}):(0,E.jsx)(`div`,{className:`px-6 pt-6 pb-6`,children:(0,E.jsx)(w,{record:n,objectName:r,recordId:i,dataSource:t,objectSchema:P,onClose:X.close})})}})},$=(0,E.jsxs)(`div`,{className:a(`w-full overflow-auto`,n),"data-testid":`object-tree`,children:[(0,E.jsx)(ne,{active:_&&H.length>0,ariaLabel:Z(`grid.refreshing`),className:`sticky -mb-0.5`}),(0,E.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,E.jsx)(`thead`,{children:(0,E.jsxs)(`tr`,{className:`border-b text-left text-muted-foreground`,children:[(0,E.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:J(B.labelField)}),B.fields.filter(e=>e!==B.labelField).map(e=>(0,E.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:J(e)},e))]})}),(0,E.jsx)(`tbody`,{children:ye.map(e=>{let t=e.children.length>0,n=G.has(e.id);return(0,E.jsxs)(`tr`,{className:`border-b hover:bg-accent/50 cursor-pointer`,"data-testid":`object-tree-row`,"data-depth":e.depth,onClick:t=>{xe(t),X.handleClick(e.record,t)},children:[(0,E.jsx)(`td`,{className:`px-3 py-2`,children:(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,style:{paddingLeft:`${e.depth*20}px`},children:[t?(0,E.jsx)(`button`,{type:`button`,"aria-label":n?`Collapse`:`Expand`,className:`flex h-5 w-5 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted`,onClick:t=>{t.stopPropagation(),ve(e.id,n)},children:n?(0,E.jsx)(S,{className:`h-4 w-4`}):(0,E.jsx)(C,{className:`h-4 w-4`})}):(0,E.jsx)(`span`,{className:`inline-block h-5 w-5`}),(0,E.jsx)(`span`,{className:`truncate`,children:M(e.record[B.labelField],Y(B.labelField))||`—`})]})}),B.fields.filter(e=>e!==B.labelField).map(t=>(0,E.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:M(e.record[t],Y(t))},t))]},e.id)})})]}),f&&(0,E.jsx)(ae,{result:f})]});if(X.isOverlay&&X.mode===`split`&&X.isOpen&&X.selectedRecord){let e=Q($);if(e)return(0,E.jsx)(E.Fragment,{children:e})}return(0,E.jsxs)(E.Fragment,{children:[$,Q()]})},P=t({ObjectTree:()=>N,ObjectTreeRenderer:()=>F}),F=({schema:e,...t})=>{let{dataSource:n}=_()||{};return(0,E.jsx)(N,{schema:e,dataSource:n,...t})};u.register(`object-tree`,F,{namespace:`plugin-tree`,label:`Object Tree`,category:`view`,inputs:[{name:`objectName`,type:`string`,description:"ObjectQL object name. The record source is one of `data`, `staticData` and `objectName`, read in that order: a tree on `data` or `staticData` never queries this object. On a tree whose rows are inline it still names the record page a new-tab click opens."},{name:`tree`,type:`object`,description:"The field configuration: `parentField` names the field holding each record’s parent id (auto-detected from the object’s self-referencing field when omitted), `labelField` the field drawn indented in the first column (default `name`), `fields` the further fields drawn as flat columns after it, and `defaultExpandedDepth` how many levels open on first draw (`0` shows roots only; omitted, every level is open)."},{name:`data`,type:`object`,description:"A `{ provider, … }` data-source configuration, read FIRST on the record-source ladder: a tree carrying one never reaches `staticData` and never queries `objectName`. `{ provider: 'value', items }` draws those records and `{ provider: 'object', object }` queries that object, both narrowed by `filter`. The `api` and `schema` providers draw no rows on the tree. A bare array is not this key’s shape and is not a record source: the tree falls through to `staticData`, then `objectName`, so inline rows belong under `staticData`."},{name:`staticData`,type:`array`,description:"Inline records, read SECOND on the record-source ladder: a `data` configuration wins and this key is then never reached, while `objectName` is read AFTER it, so a tree carrying both draws these rows and never queries that object. Each record is placed under the record its `parentField` value names, and one naming no record is drawn as a root. `filter` narrows these rows exactly as it does fetched ones."},{name:`filter`,type:`array`,description:"Base query filter in the rule-array form `[{ field, operator, value }, ...]`, narrowing the records the tree draws — fetched rows and inline (`staticData`, `{ provider: 'value' }`) rows alike. Context tokens such as `{current_user_id}` are resolved first, then the filter is lowered to `$filter` on the query. A record whose parent the filter removed is drawn as a root. The MongoDB-style record form is not this key’s shape."},{name:`navigation`,type:`object`,description:"What a row click opens — the `{ mode, size, openNewTab, preventNavigation }` block a list view declares. With the key ABSENT a click opens nothing: this renderer supplies no drawer default. `mode` is an overlay (`drawer`, `modal`, `split`, `popover`), `new_window`, `page` or `none`, and a block written without `mode` takes the spec’s `page` default. `drawer`, `modal` and `popover` open the row’s record in that overlay, and `split` opens it beside the tree; `new_window` opens the record page in a new tab; `none` opens nothing. `page` opens the record page of `data.object` when `data` is the object provider, else of the tree’s `objectName`, through the record navigator the host publishes (the console publishes one on its custom pages, record pages and list views); under a host that publishes none, such as an embedded renderer, or on a tree that names neither (inline rows with no `objectName`), there is no record page to open and the click opens nothing. `preventNavigation: true` opens nothing whatever the mode, `openNewTab: true` opens the record page in a new tab and outranks every mode except `none`, and `size` sets the overlay width. A click handler from a parent view outranks the whole key."}]});export{P as t};
|