@multiplatform.one/backoffice 6.3.0 → 6.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/chrome/CommandPalette.cjs +20 -9
- package/dist/cjs/chrome/CommandPalette.native.js +18 -10
- package/dist/cjs/chrome/CommandPalette.native.js.map +1 -1
- package/dist/cjs/i18n/en.cjs +21 -0
- package/dist/cjs/i18n/en.native.js +21 -0
- package/dist/cjs/i18n/en.native.js.map +1 -1
- package/dist/cjs/index.cjs +49 -1
- package/dist/cjs/index.native.js +48 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/shared/types.cjs +18 -0
- package/dist/cjs/shared/types.native.js +21 -0
- package/dist/cjs/shared/types.native.js.map +1 -0
- package/dist/cjs/shared/useDocinfo.cjs +116 -0
- package/dist/cjs/shared/useDocinfo.native.js +167 -0
- package/dist/cjs/shared/useDocinfo.native.js.map +1 -0
- package/dist/cjs/shared/useDoctypeMeta.cjs +124 -0
- package/dist/cjs/shared/useDoctypeMeta.native.js +158 -0
- package/dist/cjs/shared/useDoctypeMeta.native.js.map +1 -0
- package/dist/cjs/shared/useRecentVisit.cjs +40 -0
- package/dist/cjs/shared/useRecentVisit.native.js +43 -0
- package/dist/cjs/shared/useRecentVisit.native.js.map +1 -0
- package/dist/cjs/shared/useSessionUserId.cjs +54 -0
- package/dist/cjs/shared/useSessionUserId.native.js +59 -0
- package/dist/cjs/shared/useSessionUserId.native.js.map +1 -0
- package/dist/cjs/shared/useSlugTarget.cjs +138 -0
- package/dist/cjs/shared/useSlugTarget.native.js +166 -0
- package/dist/cjs/shared/useSlugTarget.native.js.map +1 -0
- package/dist/cjs/shared/useUserRoles.cjs +72 -0
- package/dist/cjs/shared/useUserRoles.native.js +79 -0
- package/dist/cjs/shared/useUserRoles.native.js.map +1 -0
- package/dist/cjs/shell/WorkspaceSidebar.cjs +4 -0
- package/dist/cjs/shell/WorkspaceSidebar.native.js +4 -0
- package/dist/cjs/shell/WorkspaceSidebar.native.js.map +1 -1
- package/dist/cjs/workspace/WorkspaceChartBlock.cjs +136 -0
- package/dist/cjs/workspace/WorkspaceChartBlock.native.js +144 -0
- package/dist/cjs/workspace/WorkspaceChartBlock.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceGrid.cjs +91 -0
- package/dist/cjs/workspace/WorkspaceGrid.native.js +126 -0
- package/dist/cjs/workspace/WorkspaceGrid.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceLinkCard.cjs +139 -0
- package/dist/cjs/workspace/WorkspaceLinkCard.native.js +155 -0
- package/dist/cjs/workspace/WorkspaceLinkCard.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceLinkDirectory.cjs +110 -0
- package/dist/cjs/workspace/WorkspaceLinkDirectory.native.js +127 -0
- package/dist/cjs/workspace/WorkspaceLinkDirectory.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceNumberCard.cjs +133 -0
- package/dist/cjs/workspace/WorkspaceNumberCard.native.js +138 -0
- package/dist/cjs/workspace/WorkspaceNumberCard.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceQuickList.cjs +112 -0
- package/dist/cjs/workspace/WorkspaceQuickList.native.js +130 -0
- package/dist/cjs/workspace/WorkspaceQuickList.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceRecents.cjs +116 -0
- package/dist/cjs/workspace/WorkspaceRecents.native.js +132 -0
- package/dist/cjs/workspace/WorkspaceRecents.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceScreen.cjs +291 -0
- package/dist/cjs/workspace/WorkspaceScreen.native.js +323 -0
- package/dist/cjs/workspace/WorkspaceScreen.native.js.map +1 -0
- package/dist/cjs/workspace/WorkspaceShortcut.cjs +185 -0
- package/dist/cjs/workspace/WorkspaceShortcut.native.js +202 -0
- package/dist/cjs/workspace/WorkspaceShortcut.native.js.map +1 -0
- package/dist/cjs/workspace/parseContent.cjs +180 -0
- package/dist/cjs/workspace/parseContent.native.js +299 -0
- package/dist/cjs/workspace/parseContent.native.js.map +1 -0
- package/dist/cjs/workspace/types.cjs +18 -0
- package/dist/cjs/workspace/types.native.js +21 -0
- package/dist/cjs/workspace/types.native.js.map +1 -0
- package/dist/cjs/workspace/useDashboardChart.cjs +96 -0
- package/dist/cjs/workspace/useDashboardChart.native.js +110 -0
- package/dist/cjs/workspace/useDashboardChart.native.js.map +1 -0
- package/dist/cjs/workspace/useWorkspaceDoc.cjs +103 -0
- package/dist/cjs/workspace/useWorkspaceDoc.native.js +120 -0
- package/dist/cjs/workspace/useWorkspaceDoc.native.js.map +1 -0
- package/dist/esm/chrome/CommandPalette.mjs +20 -9
- package/dist/esm/chrome/CommandPalette.mjs.map +1 -1
- package/dist/esm/chrome/CommandPalette.native.js +18 -10
- package/dist/esm/chrome/CommandPalette.native.js.map +1 -1
- package/dist/esm/i18n/en.mjs +21 -0
- package/dist/esm/i18n/en.mjs.map +1 -1
- package/dist/esm/i18n/en.native.js +21 -0
- package/dist/esm/i18n/en.native.js.map +1 -1
- package/dist/esm/index.mjs +19 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +19 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/shared/types.mjs +2 -0
- package/dist/esm/shared/types.mjs.map +1 -0
- package/dist/esm/shared/types.native.js +2 -0
- package/dist/esm/shared/types.native.js.map +1 -0
- package/dist/esm/shared/useDocinfo.mjs +90 -0
- package/dist/esm/shared/useDocinfo.mjs.map +1 -0
- package/dist/esm/shared/useDocinfo.native.js +138 -0
- package/dist/esm/shared/useDocinfo.native.js.map +1 -0
- package/dist/esm/shared/useDoctypeMeta.mjs +99 -0
- package/dist/esm/shared/useDoctypeMeta.mjs.map +1 -0
- package/dist/esm/shared/useDoctypeMeta.native.js +130 -0
- package/dist/esm/shared/useDoctypeMeta.native.js.map +1 -0
- package/dist/esm/shared/useRecentVisit.mjs +15 -0
- package/dist/esm/shared/useRecentVisit.mjs.map +1 -0
- package/dist/esm/shared/useRecentVisit.native.js +15 -0
- package/dist/esm/shared/useRecentVisit.native.js.map +1 -0
- package/dist/esm/shared/useSessionUserId.mjs +29 -0
- package/dist/esm/shared/useSessionUserId.mjs.map +1 -0
- package/dist/esm/shared/useSessionUserId.native.js +31 -0
- package/dist/esm/shared/useSessionUserId.native.js.map +1 -0
- package/dist/esm/shared/useSlugTarget.mjs +113 -0
- package/dist/esm/shared/useSlugTarget.mjs.map +1 -0
- package/dist/esm/shared/useSlugTarget.native.js +138 -0
- package/dist/esm/shared/useSlugTarget.native.js.map +1 -0
- package/dist/esm/shared/useUserRoles.mjs +47 -0
- package/dist/esm/shared/useUserRoles.mjs.map +1 -0
- package/dist/esm/shared/useUserRoles.native.js +51 -0
- package/dist/esm/shared/useUserRoles.native.js.map +1 -0
- package/dist/esm/shell/WorkspaceSidebar.mjs +4 -0
- package/dist/esm/shell/WorkspaceSidebar.mjs.map +1 -1
- package/dist/esm/shell/WorkspaceSidebar.native.js +4 -0
- package/dist/esm/shell/WorkspaceSidebar.native.js.map +1 -1
- package/dist/esm/workspace/WorkspaceChartBlock.mjs +111 -0
- package/dist/esm/workspace/WorkspaceChartBlock.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceChartBlock.native.js +116 -0
- package/dist/esm/workspace/WorkspaceChartBlock.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceGrid.mjs +66 -0
- package/dist/esm/workspace/WorkspaceGrid.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceGrid.native.js +98 -0
- package/dist/esm/workspace/WorkspaceGrid.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceLinkCard.mjs +113 -0
- package/dist/esm/workspace/WorkspaceLinkCard.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceLinkCard.native.js +126 -0
- package/dist/esm/workspace/WorkspaceLinkCard.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceLinkDirectory.mjs +84 -0
- package/dist/esm/workspace/WorkspaceLinkDirectory.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceLinkDirectory.native.js +98 -0
- package/dist/esm/workspace/WorkspaceLinkDirectory.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceNumberCard.mjs +108 -0
- package/dist/esm/workspace/WorkspaceNumberCard.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceNumberCard.native.js +110 -0
- package/dist/esm/workspace/WorkspaceNumberCard.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceQuickList.mjs +87 -0
- package/dist/esm/workspace/WorkspaceQuickList.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceQuickList.native.js +102 -0
- package/dist/esm/workspace/WorkspaceQuickList.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceRecents.mjs +91 -0
- package/dist/esm/workspace/WorkspaceRecents.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceRecents.native.js +104 -0
- package/dist/esm/workspace/WorkspaceRecents.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceScreen.mjs +266 -0
- package/dist/esm/workspace/WorkspaceScreen.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceScreen.native.js +295 -0
- package/dist/esm/workspace/WorkspaceScreen.native.js.map +1 -0
- package/dist/esm/workspace/WorkspaceShortcut.mjs +159 -0
- package/dist/esm/workspace/WorkspaceShortcut.mjs.map +1 -0
- package/dist/esm/workspace/WorkspaceShortcut.native.js +173 -0
- package/dist/esm/workspace/WorkspaceShortcut.native.js.map +1 -0
- package/dist/esm/workspace/parseContent.mjs +148 -0
- package/dist/esm/workspace/parseContent.mjs.map +1 -0
- package/dist/esm/workspace/parseContent.native.js +264 -0
- package/dist/esm/workspace/parseContent.native.js.map +1 -0
- package/dist/esm/workspace/types.mjs +2 -0
- package/dist/esm/workspace/types.mjs.map +1 -0
- package/dist/esm/workspace/types.native.js +2 -0
- package/dist/esm/workspace/types.native.js.map +1 -0
- package/dist/esm/workspace/useDashboardChart.mjs +71 -0
- package/dist/esm/workspace/useDashboardChart.mjs.map +1 -0
- package/dist/esm/workspace/useDashboardChart.native.js +82 -0
- package/dist/esm/workspace/useDashboardChart.native.js.map +1 -0
- package/dist/esm/workspace/useWorkspaceDoc.mjs +77 -0
- package/dist/esm/workspace/useWorkspaceDoc.mjs.map +1 -0
- package/dist/esm/workspace/useWorkspaceDoc.native.js +91 -0
- package/dist/esm/workspace/useWorkspaceDoc.native.js.map +1 -0
- package/dist/jsx/chrome/CommandPalette.mjs +20 -9
- package/dist/jsx/chrome/CommandPalette.mjs.map +1 -1
- package/dist/jsx/chrome/CommandPalette.native.js +18 -10
- package/dist/jsx/chrome/CommandPalette.native.js.map +1 -1
- package/dist/jsx/i18n/en.mjs +21 -0
- package/dist/jsx/i18n/en.mjs.map +1 -1
- package/dist/jsx/i18n/en.native.js +21 -0
- package/dist/jsx/i18n/en.native.js.map +1 -1
- package/dist/jsx/index.js +19 -1
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +19 -1
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +48 -0
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/shared/types.mjs +2 -0
- package/dist/jsx/shared/types.mjs.map +1 -0
- package/dist/jsx/shared/types.native.js +21 -0
- package/dist/jsx/shared/types.native.js.map +1 -0
- package/dist/jsx/shared/useDocinfo.mjs +90 -0
- package/dist/jsx/shared/useDocinfo.mjs.map +1 -0
- package/dist/jsx/shared/useDocinfo.native.js +167 -0
- package/dist/jsx/shared/useDocinfo.native.js.map +1 -0
- package/dist/jsx/shared/useDoctypeMeta.mjs +99 -0
- package/dist/jsx/shared/useDoctypeMeta.mjs.map +1 -0
- package/dist/jsx/shared/useDoctypeMeta.native.js +158 -0
- package/dist/jsx/shared/useDoctypeMeta.native.js.map +1 -0
- package/dist/jsx/shared/useRecentVisit.mjs +15 -0
- package/dist/jsx/shared/useRecentVisit.mjs.map +1 -0
- package/dist/jsx/shared/useRecentVisit.native.js +43 -0
- package/dist/jsx/shared/useRecentVisit.native.js.map +1 -0
- package/dist/jsx/shared/useSessionUserId.mjs +29 -0
- package/dist/jsx/shared/useSessionUserId.mjs.map +1 -0
- package/dist/jsx/shared/useSessionUserId.native.js +59 -0
- package/dist/jsx/shared/useSessionUserId.native.js.map +1 -0
- package/dist/jsx/shared/useSlugTarget.mjs +113 -0
- package/dist/jsx/shared/useSlugTarget.mjs.map +1 -0
- package/dist/jsx/shared/useSlugTarget.native.js +166 -0
- package/dist/jsx/shared/useSlugTarget.native.js.map +1 -0
- package/dist/jsx/shared/useUserRoles.mjs +47 -0
- package/dist/jsx/shared/useUserRoles.mjs.map +1 -0
- package/dist/jsx/shared/useUserRoles.native.js +79 -0
- package/dist/jsx/shared/useUserRoles.native.js.map +1 -0
- package/dist/jsx/shell/WorkspaceSidebar.mjs +4 -0
- package/dist/jsx/shell/WorkspaceSidebar.mjs.map +1 -1
- package/dist/jsx/shell/WorkspaceSidebar.native.js +4 -0
- package/dist/jsx/shell/WorkspaceSidebar.native.js.map +1 -1
- package/dist/jsx/workspace/WorkspaceChartBlock.mjs +111 -0
- package/dist/jsx/workspace/WorkspaceChartBlock.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceChartBlock.native.js +144 -0
- package/dist/jsx/workspace/WorkspaceChartBlock.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceGrid.mjs +66 -0
- package/dist/jsx/workspace/WorkspaceGrid.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceGrid.native.js +126 -0
- package/dist/jsx/workspace/WorkspaceGrid.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceLinkCard.mjs +113 -0
- package/dist/jsx/workspace/WorkspaceLinkCard.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceLinkCard.native.js +155 -0
- package/dist/jsx/workspace/WorkspaceLinkCard.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceLinkDirectory.mjs +84 -0
- package/dist/jsx/workspace/WorkspaceLinkDirectory.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceLinkDirectory.native.js +127 -0
- package/dist/jsx/workspace/WorkspaceLinkDirectory.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceNumberCard.mjs +108 -0
- package/dist/jsx/workspace/WorkspaceNumberCard.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceNumberCard.native.js +138 -0
- package/dist/jsx/workspace/WorkspaceNumberCard.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceQuickList.mjs +87 -0
- package/dist/jsx/workspace/WorkspaceQuickList.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceQuickList.native.js +130 -0
- package/dist/jsx/workspace/WorkspaceQuickList.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceRecents.mjs +91 -0
- package/dist/jsx/workspace/WorkspaceRecents.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceRecents.native.js +132 -0
- package/dist/jsx/workspace/WorkspaceRecents.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceScreen.mjs +266 -0
- package/dist/jsx/workspace/WorkspaceScreen.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceScreen.native.js +323 -0
- package/dist/jsx/workspace/WorkspaceScreen.native.js.map +1 -0
- package/dist/jsx/workspace/WorkspaceShortcut.mjs +159 -0
- package/dist/jsx/workspace/WorkspaceShortcut.mjs.map +1 -0
- package/dist/jsx/workspace/WorkspaceShortcut.native.js +202 -0
- package/dist/jsx/workspace/WorkspaceShortcut.native.js.map +1 -0
- package/dist/jsx/workspace/parseContent.mjs +148 -0
- package/dist/jsx/workspace/parseContent.mjs.map +1 -0
- package/dist/jsx/workspace/parseContent.native.js +299 -0
- package/dist/jsx/workspace/parseContent.native.js.map +1 -0
- package/dist/jsx/workspace/types.mjs +2 -0
- package/dist/jsx/workspace/types.mjs.map +1 -0
- package/dist/jsx/workspace/types.native.js +21 -0
- package/dist/jsx/workspace/types.native.js.map +1 -0
- package/dist/jsx/workspace/useDashboardChart.mjs +71 -0
- package/dist/jsx/workspace/useDashboardChart.mjs.map +1 -0
- package/dist/jsx/workspace/useDashboardChart.native.js +110 -0
- package/dist/jsx/workspace/useDashboardChart.native.js.map +1 -0
- package/dist/jsx/workspace/useWorkspaceDoc.mjs +77 -0
- package/dist/jsx/workspace/useWorkspaceDoc.mjs.map +1 -0
- package/dist/jsx/workspace/useWorkspaceDoc.native.js +120 -0
- package/dist/jsx/workspace/useWorkspaceDoc.native.js.map +1 -0
- package/package.json +12 -12
- package/src/chrome/CommandPalette.tsx +35 -15
- package/src/i18n/en.ts +21 -0
- package/src/index.ts +69 -0
- package/src/shared/types.ts +14 -0
- package/src/shared/useDocinfo.ts +163 -0
- package/src/shared/useDoctypeMeta.ts +243 -0
- package/src/shared/useRecentVisit.ts +33 -0
- package/src/shared/useSessionUserId.ts +42 -0
- package/src/shared/useSlugTarget.ts +143 -0
- package/src/shared/useUserRoles.ts +66 -0
- package/src/shell/WorkspaceSidebar.tsx +3 -0
- package/src/workspace/WorkspaceChartBlock.tsx +115 -0
- package/src/workspace/WorkspaceGrid.tsx +82 -0
- package/src/workspace/WorkspaceLinkCard.tsx +134 -0
- package/src/workspace/WorkspaceLinkDirectory.tsx +126 -0
- package/src/workspace/WorkspaceNumberCard.tsx +126 -0
- package/src/workspace/WorkspaceQuickList.tsx +100 -0
- package/src/workspace/WorkspaceRecents.tsx +100 -0
- package/src/workspace/WorkspaceScreen.tsx +322 -0
- package/src/workspace/WorkspaceShortcut.tsx +223 -0
- package/src/workspace/parseContent.spec.ts +327 -0
- package/src/workspace/parseContent.ts +240 -0
- package/src/workspace/types.ts +135 -0
- package/src/workspace/useDashboardChart.ts +115 -0
- package/src/workspace/useWorkspaceDoc.ts +111 -0
- package/types/chrome/CommandPalette.d.ts.map +1 -1
- package/types/i18n/en.d.ts +19 -0
- package/types/i18n/en.d.ts.map +1 -1
- package/types/index.d.ts +34 -0
- package/types/index.d.ts.map +1 -1
- package/types/shared/types.d.ts +21 -0
- package/types/shared/types.d.ts.map +1 -0
- package/types/shared/useDocinfo.d.ts +61 -0
- package/types/shared/useDocinfo.d.ts.map +1 -0
- package/types/shared/useDoctypeMeta.d.ts +118 -0
- package/types/shared/useDoctypeMeta.d.ts.map +1 -0
- package/types/shared/useRecentVisit.d.ts +10 -0
- package/types/shared/useRecentVisit.d.ts.map +1 -0
- package/types/shared/useSessionUserId.d.ts +6 -0
- package/types/shared/useSessionUserId.d.ts.map +1 -0
- package/types/shared/useSlugTarget.d.ts +18 -0
- package/types/shared/useSlugTarget.d.ts.map +1 -0
- package/types/shared/useUserRoles.d.ts +15 -0
- package/types/shared/useUserRoles.d.ts.map +1 -0
- package/types/shell/WorkspaceSidebar.d.ts.map +1 -1
- package/types/workspace/WorkspaceChartBlock.d.ts +6 -0
- package/types/workspace/WorkspaceChartBlock.d.ts.map +1 -0
- package/types/workspace/WorkspaceGrid.d.ts +23 -0
- package/types/workspace/WorkspaceGrid.d.ts.map +1 -0
- package/types/workspace/WorkspaceLinkCard.d.ts +20 -0
- package/types/workspace/WorkspaceLinkCard.d.ts.map +1 -0
- package/types/workspace/WorkspaceLinkDirectory.d.ts +19 -0
- package/types/workspace/WorkspaceLinkDirectory.d.ts.map +1 -0
- package/types/workspace/WorkspaceNumberCard.d.ts +19 -0
- package/types/workspace/WorkspaceNumberCard.d.ts.map +1 -0
- package/types/workspace/WorkspaceQuickList.d.ts +6 -0
- package/types/workspace/WorkspaceQuickList.d.ts.map +1 -0
- package/types/workspace/WorkspaceRecents.d.ts +2 -0
- package/types/workspace/WorkspaceRecents.d.ts.map +1 -0
- package/types/workspace/WorkspaceScreen.d.ts +24 -0
- package/types/workspace/WorkspaceScreen.d.ts.map +1 -0
- package/types/workspace/WorkspaceShortcut.d.ts +27 -0
- package/types/workspace/WorkspaceShortcut.d.ts.map +1 -0
- package/types/workspace/parseContent.d.ts +77 -0
- package/types/workspace/parseContent.d.ts.map +1 -0
- package/types/workspace/types.d.ts +112 -0
- package/types/workspace/types.d.ts.map +1 -0
- package/types/workspace/useDashboardChart.d.ts +29 -0
- package/types/workspace/useDashboardChart.d.ts.map +1 -0
- package/types/workspace/useWorkspaceDoc.d.ts +18 -0
- package/types/workspace/useWorkspaceDoc.d.ts.map +1 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var useDocinfo_exports = {};
|
|
24
|
+
__export(useDocinfo_exports, {
|
|
25
|
+
invalidateDocinfo: () => invalidateDocinfo,
|
|
26
|
+
useDocinfo: () => useDocinfo
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(useDocinfo_exports);
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_useFrappeApp = require("./useFrappeApp.cjs");
|
|
31
|
+
const docinfoCache = /* @__PURE__ */new Map();
|
|
32
|
+
function cacheKey(doctype, name) {
|
|
33
|
+
return `${doctype}\0${name}`;
|
|
34
|
+
}
|
|
35
|
+
function useDocinfo(doctype, name) {
|
|
36
|
+
const app = (0, import_useFrappeApp.useFrappeApp)();
|
|
37
|
+
const [docinfo, setDocinfo] = (0, import_react.useState)(void 0);
|
|
38
|
+
const [loading, setLoading] = (0, import_react.useState)(Boolean(doctype && name));
|
|
39
|
+
const [error, setError] = (0, import_react.useState)(void 0);
|
|
40
|
+
const [generation, setGeneration] = (0, import_react.useState)(0);
|
|
41
|
+
const isNewDoc = !name || name === "new";
|
|
42
|
+
(0, import_react.useEffect)(() => {
|
|
43
|
+
if (!app || !doctype || !name || isNewDoc) {
|
|
44
|
+
setDocinfo(void 0);
|
|
45
|
+
setLoading(false);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
let cancelled = false;
|
|
49
|
+
const key = cacheKey(doctype, name);
|
|
50
|
+
let entry = docinfoCache.get(key);
|
|
51
|
+
if (!entry) {
|
|
52
|
+
const listeners = /* @__PURE__ */new Set();
|
|
53
|
+
const promise = app.call().get("frappe.desk.form.load.get_docinfo", {
|
|
54
|
+
doctype,
|
|
55
|
+
name
|
|
56
|
+
}).then(res => {
|
|
57
|
+
const info = res.payload?.docinfo ?? res.payload?.message?.docinfo;
|
|
58
|
+
if (!info) throw new Error(`No docinfo returned for ${doctype}/${name}`);
|
|
59
|
+
return info;
|
|
60
|
+
});
|
|
61
|
+
entry = {
|
|
62
|
+
promise,
|
|
63
|
+
listeners
|
|
64
|
+
};
|
|
65
|
+
docinfoCache.set(key, entry);
|
|
66
|
+
promise.then(value => {
|
|
67
|
+
const current = docinfoCache.get(key);
|
|
68
|
+
if (current && current === entry) {
|
|
69
|
+
current.value = value;
|
|
70
|
+
for (const listener of current.listeners) listener();
|
|
71
|
+
}
|
|
72
|
+
}).catch(() => {
|
|
73
|
+
if (docinfoCache.get(key) === entry) docinfoCache.delete(key);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
const currentEntry = entry;
|
|
77
|
+
const sync = () => {
|
|
78
|
+
if (!cancelled && currentEntry.value) {
|
|
79
|
+
setDocinfo(currentEntry.value);
|
|
80
|
+
setLoading(false);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
currentEntry.listeners.add(sync);
|
|
84
|
+
setLoading(!currentEntry.value);
|
|
85
|
+
setError(void 0);
|
|
86
|
+
if (currentEntry.value) setDocinfo(currentEntry.value);
|
|
87
|
+
currentEntry.promise.catch(err => {
|
|
88
|
+
if (!cancelled) {
|
|
89
|
+
setError(err);
|
|
90
|
+
setLoading(false);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return () => {
|
|
94
|
+
cancelled = true;
|
|
95
|
+
currentEntry.listeners.delete(sync);
|
|
96
|
+
};
|
|
97
|
+
}, [app, doctype, name, isNewDoc, generation]);
|
|
98
|
+
const reload = (0, import_react.useCallback)(() => {
|
|
99
|
+
if (doctype && name) {
|
|
100
|
+
const key = cacheKey(doctype, name);
|
|
101
|
+
const entry = docinfoCache.get(key);
|
|
102
|
+
docinfoCache.delete(key);
|
|
103
|
+
if (entry) for (const listener of entry.listeners) listener();
|
|
104
|
+
}
|
|
105
|
+
setGeneration(g => g + 1);
|
|
106
|
+
}, [doctype, name]);
|
|
107
|
+
return (0, import_react.useMemo)(() => ({
|
|
108
|
+
docinfo,
|
|
109
|
+
loading,
|
|
110
|
+
error,
|
|
111
|
+
reload
|
|
112
|
+
}), [docinfo, loading, error, reload]);
|
|
113
|
+
}
|
|
114
|
+
function invalidateDocinfo(doctype, name) {
|
|
115
|
+
docinfoCache.delete(cacheKey(doctype, name));
|
|
116
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var useDocinfo_exports = {};
|
|
26
|
+
__export(useDocinfo_exports, {
|
|
27
|
+
invalidateDocinfo: () => invalidateDocinfo,
|
|
28
|
+
useDocinfo: () => useDocinfo
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(useDocinfo_exports);
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var import_useFrappeApp = require("./useFrappeApp.native.js");
|
|
33
|
+
var docinfoCache = /* @__PURE__ */new Map();
|
|
34
|
+
function cacheKey(doctype, name) {
|
|
35
|
+
return `${doctype}\0${name}`;
|
|
36
|
+
}
|
|
37
|
+
function useDocinfo(doctype, name) {
|
|
38
|
+
var app = (0, import_useFrappeApp.useFrappeApp)();
|
|
39
|
+
var [docinfo, setDocinfo] = (0, import_react.useState)(void 0);
|
|
40
|
+
var [loading, setLoading] = (0, import_react.useState)(Boolean(doctype && name));
|
|
41
|
+
var [error, setError] = (0, import_react.useState)(void 0);
|
|
42
|
+
var [generation, setGeneration] = (0, import_react.useState)(0);
|
|
43
|
+
var isNewDoc = !name || name === "new";
|
|
44
|
+
(0, import_react.useEffect)(function () {
|
|
45
|
+
if (!app || !doctype || !name || isNewDoc) {
|
|
46
|
+
setDocinfo(void 0);
|
|
47
|
+
setLoading(false);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
var cancelled = false;
|
|
51
|
+
var key = cacheKey(doctype, name);
|
|
52
|
+
var entry = docinfoCache.get(key);
|
|
53
|
+
if (!entry) {
|
|
54
|
+
var listeners = /* @__PURE__ */new Set();
|
|
55
|
+
var promise = app.call().get("frappe.desk.form.load.get_docinfo", {
|
|
56
|
+
doctype,
|
|
57
|
+
name
|
|
58
|
+
}).then(function (res) {
|
|
59
|
+
var _ref;
|
|
60
|
+
var _res_payload, _res_payload_message, _res_payload1;
|
|
61
|
+
var info = (_ref = (_res_payload = res.payload) === null || _res_payload === void 0 ? void 0 : _res_payload.docinfo) !== null && _ref !== void 0 ? _ref : (_res_payload1 = res.payload) === null || _res_payload1 === void 0 ? void 0 : (_res_payload_message = _res_payload1.message) === null || _res_payload_message === void 0 ? void 0 : _res_payload_message.docinfo;
|
|
62
|
+
if (!info) throw new Error(`No docinfo returned for ${doctype}/${name}`);
|
|
63
|
+
return info;
|
|
64
|
+
});
|
|
65
|
+
entry = {
|
|
66
|
+
promise,
|
|
67
|
+
listeners
|
|
68
|
+
};
|
|
69
|
+
docinfoCache.set(key, entry);
|
|
70
|
+
promise.then(function (value) {
|
|
71
|
+
var current = docinfoCache.get(key);
|
|
72
|
+
if (current && current === entry) {
|
|
73
|
+
current.value = value;
|
|
74
|
+
var _iteratorNormalCompletion = true,
|
|
75
|
+
_didIteratorError = false,
|
|
76
|
+
_iteratorError = void 0;
|
|
77
|
+
try {
|
|
78
|
+
for (var _iterator = current.listeners[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
79
|
+
var listener = _step.value;
|
|
80
|
+
listener();
|
|
81
|
+
}
|
|
82
|
+
} catch (err) {
|
|
83
|
+
_didIteratorError = true;
|
|
84
|
+
_iteratorError = err;
|
|
85
|
+
} finally {
|
|
86
|
+
try {
|
|
87
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
88
|
+
_iterator.return();
|
|
89
|
+
}
|
|
90
|
+
} finally {
|
|
91
|
+
if (_didIteratorError) {
|
|
92
|
+
throw _iteratorError;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}).catch(function () {
|
|
98
|
+
if (docinfoCache.get(key) === entry) docinfoCache.delete(key);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
var currentEntry = entry;
|
|
102
|
+
var sync = function sync2() {
|
|
103
|
+
if (!cancelled && currentEntry.value) {
|
|
104
|
+
setDocinfo(currentEntry.value);
|
|
105
|
+
setLoading(false);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
currentEntry.listeners.add(sync);
|
|
109
|
+
setLoading(!currentEntry.value);
|
|
110
|
+
setError(void 0);
|
|
111
|
+
if (currentEntry.value) setDocinfo(currentEntry.value);
|
|
112
|
+
currentEntry.promise.catch(function (err) {
|
|
113
|
+
if (!cancelled) {
|
|
114
|
+
setError(err);
|
|
115
|
+
setLoading(false);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
return function () {
|
|
119
|
+
cancelled = true;
|
|
120
|
+
currentEntry.listeners.delete(sync);
|
|
121
|
+
};
|
|
122
|
+
}, [app, doctype, name, isNewDoc, generation]);
|
|
123
|
+
var reload = (0, import_react.useCallback)(function () {
|
|
124
|
+
if (doctype && name) {
|
|
125
|
+
var key = cacheKey(doctype, name);
|
|
126
|
+
var entry = docinfoCache.get(key);
|
|
127
|
+
docinfoCache.delete(key);
|
|
128
|
+
var _iteratorNormalCompletion = true,
|
|
129
|
+
_didIteratorError = false,
|
|
130
|
+
_iteratorError = void 0;
|
|
131
|
+
if (entry) try {
|
|
132
|
+
for (var _iterator = entry.listeners[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
133
|
+
var listener = _step.value;
|
|
134
|
+
listener();
|
|
135
|
+
}
|
|
136
|
+
} catch (err) {
|
|
137
|
+
_didIteratorError = true;
|
|
138
|
+
_iteratorError = err;
|
|
139
|
+
} finally {
|
|
140
|
+
try {
|
|
141
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
142
|
+
_iterator.return();
|
|
143
|
+
}
|
|
144
|
+
} finally {
|
|
145
|
+
if (_didIteratorError) {
|
|
146
|
+
throw _iteratorError;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
setGeneration(function (g) {
|
|
152
|
+
return g + 1;
|
|
153
|
+
});
|
|
154
|
+
}, [doctype, name]);
|
|
155
|
+
return (0, import_react.useMemo)(function () {
|
|
156
|
+
return {
|
|
157
|
+
docinfo,
|
|
158
|
+
loading,
|
|
159
|
+
error,
|
|
160
|
+
reload
|
|
161
|
+
};
|
|
162
|
+
}, [docinfo, loading, error, reload]);
|
|
163
|
+
}
|
|
164
|
+
function invalidateDocinfo(doctype, name) {
|
|
165
|
+
docinfoCache.delete(cacheKey(doctype, name));
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=useDocinfo.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useDocinfo_exports","__export","invalidateDocinfo","useDocinfo","module","exports","import_react","require","import_useFrappeApp","docinfoCache","Map","cacheKey","doctype","name","app","useFrappeApp","docinfo","setDocinfo","useState","loading","setLoading","Boolean","error","setError","generation","setGeneration","isNewDoc","useEffect","cancelled","key","entry","get","listeners","Set","promise","call","then","res","_ref","_res_payload","_res_payload_message","_res_payload1","info","payload","message","Error","set","current","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","listener","err","return","catch","delete","currentEntry","sync","sync2","add"],"sources":["../../../src/shared/useDocinfo.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;A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Q,GAAA;UACzB,UAAkB;YACd;cACJ,IAAa,CAAAV,yBAA8B,IAAAG,SAAA,CAAAQ,MAAA;gBACpCR,SAAW,CAAAQ,MAAA;cACd;YACA,UAAW;cACb,IAAAV,iBAAA;gBACD,MAAAC,cAAA;cACM;YACL;UACA;QACF;MACE,GAAAU,KAAK,aAAe;QAElB,IAAAnD,YAAS,CAAAsB,GAAA,CAAAF,GAAA,MAAAC,KAAA,EAAArB,YAAkB,CAAAoD,MAAA,CAAAhC,GAAA;MAC/B,EAAI;IACF;IACA,IAAAiC,YAAc,GAAAhC,KAAA;IACd,IAAAiC,IAAA,YAAaC,KAAUA,CAAA;MAEvB,IAAI,CAAApC,SAAO,IAAAkC,YAAW,CAAA/D,KAAY;QACpCkB,UAAA,CAAA6C,YAAA,CAAA/D,KAAA;QACAqB,UAAc,CAAC,MAAM;MACnB;IAEJ;IACF0C,YAAA,CAAA9B,SAAA,CAAAiC,GAAA,CAAAF,IAAA;IAGO3C,UAAS,EAAA0C,YAAkB,CAAA/D,KAAA;IAChCwB,QAAA,MAAa;IACf,IAAAuC,YAAA,CAAA/D,KAAA,EAAAkB,UAAA,CAAA6C,YAAA,CAAA/D,KAAA","ignoreList":[]}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var useDoctypeMeta_exports = {};
|
|
24
|
+
__export(useDoctypeMeta_exports, {
|
|
25
|
+
useDoctypeMeta: () => useDoctypeMeta
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(useDoctypeMeta_exports);
|
|
28
|
+
var import_frappe_ui = require("@multiplatform.one/frappe-ui");
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_useFrappeApp = require("./useFrappeApp.cjs");
|
|
31
|
+
const metaCache = /* @__PURE__ */new Map();
|
|
32
|
+
function parseUserSettings(raw) {
|
|
33
|
+
if (!raw) return void 0;
|
|
34
|
+
if (typeof raw !== "string") return raw;
|
|
35
|
+
try {
|
|
36
|
+
return JSON.parse(raw);
|
|
37
|
+
} catch {
|
|
38
|
+
return void 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function loadBundleFromFixtures(fixtures, doctype) {
|
|
42
|
+
const doc = await fixtures.getDoc("DocType", doctype);
|
|
43
|
+
if (!doc) throw new Error(`No fixture meta for DocType "${doctype}"`);
|
|
44
|
+
const raw = doc;
|
|
45
|
+
const meta = {
|
|
46
|
+
...raw,
|
|
47
|
+
fields: raw.fields ?? []
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
meta,
|
|
51
|
+
childMetas: {}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function useDoctypeMeta(doctype) {
|
|
55
|
+
const app = (0, import_useFrappeApp.useFrappeApp)();
|
|
56
|
+
const config = (0, import_frappe_ui.useFrappeConfig)();
|
|
57
|
+
const fixtures = config?.fixtures;
|
|
58
|
+
const [bundle, setBundle] = (0, import_react.useState)(void 0);
|
|
59
|
+
const [loading, setLoading] = (0, import_react.useState)(Boolean(doctype));
|
|
60
|
+
const [error, setError] = (0, import_react.useState)(void 0);
|
|
61
|
+
const [generation, setGeneration] = (0, import_react.useState)(0);
|
|
62
|
+
const cacheKey = doctype ? `${config?.baseURL ?? ""}\0${fixtures ? "fixtures" : "live"}\0${doctype}` : void 0;
|
|
63
|
+
(0, import_react.useEffect)(() => {
|
|
64
|
+
if (!app && !fixtures || !doctype || !cacheKey) {
|
|
65
|
+
setBundle(void 0);
|
|
66
|
+
setLoading(Boolean(doctype));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
let cancelled = false;
|
|
70
|
+
let promise = metaCache.get(cacheKey);
|
|
71
|
+
if (!promise) {
|
|
72
|
+
if (fixtures) {
|
|
73
|
+
promise = loadBundleFromFixtures(fixtures, doctype);
|
|
74
|
+
} else if (app) {
|
|
75
|
+
promise = app.call().get("frappe.desk.form.load.getdoctype", {
|
|
76
|
+
doctype,
|
|
77
|
+
with_parent: 1
|
|
78
|
+
}).then(res => {
|
|
79
|
+
const docs = res.payload?.docs ?? [];
|
|
80
|
+
const meta = docs.find(d => d.name === doctype) ?? docs[0];
|
|
81
|
+
if (!meta) throw new Error(`No meta returned for ${doctype}`);
|
|
82
|
+
const childMetas = {};
|
|
83
|
+
for (const doc of docs) {
|
|
84
|
+
if (doc !== meta) childMetas[doc.name] = doc;
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
meta,
|
|
88
|
+
childMetas,
|
|
89
|
+
userSettings: parseUserSettings(res.payload?.user_settings)
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
} else {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
metaCache.set(cacheKey, promise);
|
|
96
|
+
promise.catch(() => metaCache.delete(cacheKey));
|
|
97
|
+
}
|
|
98
|
+
setLoading(true);
|
|
99
|
+
setError(void 0);
|
|
100
|
+
promise.then(value => {
|
|
101
|
+
if (cancelled) return;
|
|
102
|
+
setBundle(value);
|
|
103
|
+
setLoading(false);
|
|
104
|
+
}).catch(err => {
|
|
105
|
+
if (cancelled) return;
|
|
106
|
+
setError(err);
|
|
107
|
+
setLoading(false);
|
|
108
|
+
});
|
|
109
|
+
return () => {
|
|
110
|
+
cancelled = true;
|
|
111
|
+
};
|
|
112
|
+
}, [app, fixtures, doctype, cacheKey, generation]);
|
|
113
|
+
const reload = (0, import_react.useCallback)(() => {
|
|
114
|
+
if (cacheKey) metaCache.delete(cacheKey);
|
|
115
|
+
setGeneration(g => g + 1);
|
|
116
|
+
}, [cacheKey]);
|
|
117
|
+
return (0, import_react.useMemo)(() => ({
|
|
118
|
+
bundle,
|
|
119
|
+
meta: bundle?.meta,
|
|
120
|
+
loading,
|
|
121
|
+
error,
|
|
122
|
+
reload
|
|
123
|
+
}), [bundle, loading, error, reload]);
|
|
124
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var useDoctypeMeta_exports = {};
|
|
26
|
+
__export(useDoctypeMeta_exports, {
|
|
27
|
+
useDoctypeMeta: () => useDoctypeMeta
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useDoctypeMeta_exports);
|
|
30
|
+
var import_frappe_ui = require("@multiplatform.one/frappe-ui");
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var import_useFrappeApp = require("./useFrappeApp.native.js");
|
|
33
|
+
var metaCache = /* @__PURE__ */new Map();
|
|
34
|
+
function parseUserSettings(raw) {
|
|
35
|
+
if (!raw) return void 0;
|
|
36
|
+
if (typeof raw !== "string") return raw;
|
|
37
|
+
try {
|
|
38
|
+
return JSON.parse(raw);
|
|
39
|
+
} catch (unused) {
|
|
40
|
+
return void 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function loadBundleFromFixtures(fixtures, doctype) {
|
|
44
|
+
var _raw_fields;
|
|
45
|
+
var doc = await fixtures.getDoc("DocType", doctype);
|
|
46
|
+
if (!doc) throw new Error(`No fixture meta for DocType "${doctype}"`);
|
|
47
|
+
var raw = doc;
|
|
48
|
+
var meta = {
|
|
49
|
+
...raw,
|
|
50
|
+
fields: (_raw_fields = raw.fields) !== null && _raw_fields !== void 0 ? _raw_fields : []
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
meta,
|
|
54
|
+
childMetas: {}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function useDoctypeMeta(doctype) {
|
|
58
|
+
var _ref;
|
|
59
|
+
var app = (0, import_useFrappeApp.useFrappeApp)();
|
|
60
|
+
var config = (0, import_frappe_ui.useFrappeConfig)();
|
|
61
|
+
var fixtures = config === null || config === void 0 ? void 0 : config.fixtures;
|
|
62
|
+
var [bundle, setBundle] = (0, import_react.useState)(void 0);
|
|
63
|
+
var [loading, setLoading] = (0, import_react.useState)(Boolean(doctype));
|
|
64
|
+
var [error, setError] = (0, import_react.useState)(void 0);
|
|
65
|
+
var [generation, setGeneration] = (0, import_react.useState)(0);
|
|
66
|
+
var cacheKey = doctype ? `${(_ref = config === null || config === void 0 ? void 0 : config.baseURL) !== null && _ref !== void 0 ? _ref : ""}\0${fixtures ? "fixtures" : "live"}\0${doctype}` : void 0;
|
|
67
|
+
(0, import_react.useEffect)(function () {
|
|
68
|
+
if (!app && !fixtures || !doctype || !cacheKey) {
|
|
69
|
+
setBundle(void 0);
|
|
70
|
+
setLoading(Boolean(doctype));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
var cancelled = false;
|
|
74
|
+
var promise = metaCache.get(cacheKey);
|
|
75
|
+
if (!promise) {
|
|
76
|
+
if (fixtures) {
|
|
77
|
+
promise = loadBundleFromFixtures(fixtures, doctype);
|
|
78
|
+
} else if (app) {
|
|
79
|
+
promise = app.call().get("frappe.desk.form.load.getdoctype", {
|
|
80
|
+
doctype,
|
|
81
|
+
with_parent: 1
|
|
82
|
+
}).then(function (res) {
|
|
83
|
+
var _ref2, _docs_find;
|
|
84
|
+
var _res_payload, _res_payload1;
|
|
85
|
+
var docs = (_ref2 = (_res_payload = res.payload) === null || _res_payload === void 0 ? void 0 : _res_payload.docs) !== null && _ref2 !== void 0 ? _ref2 : [];
|
|
86
|
+
var meta = (_docs_find = docs.find(function (d) {
|
|
87
|
+
return d.name === doctype;
|
|
88
|
+
})) !== null && _docs_find !== void 0 ? _docs_find : docs[0];
|
|
89
|
+
if (!meta) throw new Error(`No meta returned for ${doctype}`);
|
|
90
|
+
var childMetas = {};
|
|
91
|
+
var _iteratorNormalCompletion = true,
|
|
92
|
+
_didIteratorError = false,
|
|
93
|
+
_iteratorError = void 0;
|
|
94
|
+
try {
|
|
95
|
+
for (var _iterator = docs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
96
|
+
var doc = _step.value;
|
|
97
|
+
if (doc !== meta) childMetas[doc.name] = doc;
|
|
98
|
+
}
|
|
99
|
+
} catch (err) {
|
|
100
|
+
_didIteratorError = true;
|
|
101
|
+
_iteratorError = err;
|
|
102
|
+
} finally {
|
|
103
|
+
try {
|
|
104
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
105
|
+
_iterator.return();
|
|
106
|
+
}
|
|
107
|
+
} finally {
|
|
108
|
+
if (_didIteratorError) {
|
|
109
|
+
throw _iteratorError;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
meta,
|
|
115
|
+
childMetas,
|
|
116
|
+
userSettings: parseUserSettings((_res_payload1 = res.payload) === null || _res_payload1 === void 0 ? void 0 : _res_payload1.user_settings)
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
} else {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
metaCache.set(cacheKey, promise);
|
|
123
|
+
promise.catch(function () {
|
|
124
|
+
return metaCache.delete(cacheKey);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
setLoading(true);
|
|
128
|
+
setError(void 0);
|
|
129
|
+
promise.then(function (value) {
|
|
130
|
+
if (cancelled) return;
|
|
131
|
+
setBundle(value);
|
|
132
|
+
setLoading(false);
|
|
133
|
+
}).catch(function (err) {
|
|
134
|
+
if (cancelled) return;
|
|
135
|
+
setError(err);
|
|
136
|
+
setLoading(false);
|
|
137
|
+
});
|
|
138
|
+
return function () {
|
|
139
|
+
cancelled = true;
|
|
140
|
+
};
|
|
141
|
+
}, [app, fixtures, doctype, cacheKey, generation]);
|
|
142
|
+
var reload = (0, import_react.useCallback)(function () {
|
|
143
|
+
if (cacheKey) metaCache.delete(cacheKey);
|
|
144
|
+
setGeneration(function (g) {
|
|
145
|
+
return g + 1;
|
|
146
|
+
});
|
|
147
|
+
}, [cacheKey]);
|
|
148
|
+
return (0, import_react.useMemo)(function () {
|
|
149
|
+
return {
|
|
150
|
+
bundle,
|
|
151
|
+
meta: bundle === null || bundle === void 0 ? void 0 : bundle.meta,
|
|
152
|
+
loading,
|
|
153
|
+
error,
|
|
154
|
+
reload
|
|
155
|
+
};
|
|
156
|
+
}, [bundle, loading, error, reload]);
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=useDoctypeMeta.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useDoctypeMeta_exports","__export","useDoctypeMeta","module","exports","import_frappe_ui","require","import_react","import_useFrappeApp","metaCache","Map","parseUserSettings","raw","JSON","parse","unused","loadBundleFromFixtures","fixtures","doctype","_raw_fields","doc","getDoc","Error","meta","fields","childMetas","_ref","app","useFrappeApp","config","useFrappeConfig","bundle","setBundle","useState","loading","setLoading","Boolean","error","setError","generation","setGeneration","cacheKey","baseURL","useEffect","cancelled","promise","get","call","with_parent","then","res","_ref2","_docs_find","_res_payload","_res_payload1","docs","payload","find","d","name","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","err","return","userSettings","user_settings"],"sources":["../../../src/shared/useDoctypeMeta.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,sBAAA;AAAAC,QAAA,CAAAD,sBAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAA;AAAA;AAOAC,MAAA,CAAAC,OAAA,GAAAT,YAAgC,CAAAK,sBAAA;AAChC,IAAAK,gBAA0D,GAAAC,OAAA;AAC1D,IAAAC,YAAA,GAAAD,OAA6B;AAiH7B,IAAAE,mBAAkB,GAAAF,OAAA,2BAA4C;AAE9D,IAAAG,SAAS,kBAA4D,IAAAC,GAAA;AACnE,SAAKC,iBAAYA,CAAAC,GAAA;EACjB,IAAI,CAAAA,GAAA,SAAO,KAAQ;E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AAAE,UAAA,CAAAL,GAAA,CAAAuC,IAAA,IAAAvC,GAAA;YACX;UACJ,SAAUiD,GAAK;YACfR,iBAAgB;YAEjBC,cAAsB,GAAAO,GAAA;UACjB,UAAW;YACf,IAAS;cACT,IAAW,CAAAT,yBAAK,IAAAG,SAAA,CAAAO,MAAA;gBACjBP,SAAA,CAAAO,MAAA;cACI;YACL,UAAY;cACd,IAAAT,iBAAA;gBACO,MAAUC,cAAS;cAEtB;YACA;UACJ;UACE,OAAS;YAEbvC,IAAO;YACEE,UAAU;YAChB8C,YAAiB,EAAA5D,iBAAa,EAAA2C,aAAA,GAAAJ,GAAA,CAAAM,OAAA,cAAAF,aAAA,uBAAAA,aAAA,CAAAkB,aAAA;UACjC;QACF","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var useRecentVisit_exports = {};
|
|
24
|
+
__export(useRecentVisit_exports, {
|
|
25
|
+
useRecentVisit: () => useRecentVisit
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(useRecentVisit_exports);
|
|
28
|
+
var import_frappe_ui = require("@multiplatform.one/frappe-ui");
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
function useRecentVisit(visit) {
|
|
31
|
+
const label = visit?.label;
|
|
32
|
+
const path = visit?.path;
|
|
33
|
+
(0, import_react.useEffect)(() => {
|
|
34
|
+
if (!label || !path) return;
|
|
35
|
+
(0, import_frappe_ui.addToRecent)({
|
|
36
|
+
label,
|
|
37
|
+
path
|
|
38
|
+
});
|
|
39
|
+
}, [label, path]);
|
|
40
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var useRecentVisit_exports = {};
|
|
26
|
+
__export(useRecentVisit_exports, {
|
|
27
|
+
useRecentVisit: () => useRecentVisit
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useRecentVisit_exports);
|
|
30
|
+
var import_frappe_ui = require("@multiplatform.one/frappe-ui");
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
function useRecentVisit(visit) {
|
|
33
|
+
var label = visit === null || visit === void 0 ? void 0 : visit.label;
|
|
34
|
+
var path = visit === null || visit === void 0 ? void 0 : visit.path;
|
|
35
|
+
(0, import_react.useEffect)(function () {
|
|
36
|
+
if (!label || !path) return;
|
|
37
|
+
(0, import_frappe_ui.addToRecent)({
|
|
38
|
+
label,
|
|
39
|
+
path
|
|
40
|
+
});
|
|
41
|
+
}, [label, path]);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=useRecentVisit.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useRecentVisit_exports","__export","useRecentVisit","module","exports","import_frappe_ui","require","import_react","visit","label","path","useEffect","addToRecent"],"sources":["../../../src/shared/useRecentVisit.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,sBAAA;AAAAC,QAAA,CAAAD,sBAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAA;AAAA;AAaAC,MAAA,CAAAC,OAAA,GAAAT,YAA4B,CAAAK,sBAAA;AAC5B,IAAAK,gBAA0B,GAAAC,OAAA;AAWnB,IAAAC,YAAS,GAAAD,OAAe,QAAsC;AACnE,SAAMJ,cAAeA,CAAAM,KAAA;EACrB,IAAAC,KAAM,GAAAD,KAAO,KAAO,QAAAA,KAAA,uBAAAA,KAAA,CAAAC,KAAA;EACpB,IAAAC,IAAA,GAAAF,KAAA,aAAUA,KAAM,uBAAAA,KAAA,CAAAE,IAAA;EACd,IAAAH,YAAc,CAACI,SAAM;IACrB,KAAAF,KAAA,KAAAC,IAAA;IACF,CAAG,CAAC,EAAAL,gBAAY,CAAAO,WAAA;MAClBH,KAAA","ignoreList":[]}
|