@multiplatform.one/backoffice 7.2.1 → 7.3.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/dist/cjs/config/BackofficeProvider.cjs +4 -10
- package/dist/cjs/config/BackofficeProvider.native.js +9 -29
- package/dist/cjs/config/BackofficeProvider.native.js.map +1 -1
- package/dist/cjs/desk/Desk.cjs +187 -0
- package/dist/cjs/desk/Desk.native.js +214 -0
- package/dist/cjs/desk/Desk.native.js.map +1 -0
- package/dist/cjs/desk/DeskSurface.cjs +123 -0
- package/dist/cjs/desk/DeskSurface.native.js +130 -0
- package/dist/cjs/desk/DeskSurface.native.js.map +1 -0
- package/dist/cjs/desk/resolveDeskPath.cjs +118 -0
- package/dist/cjs/desk/resolveDeskPath.native.js +123 -0
- package/dist/cjs/desk/resolveDeskPath.native.js.map +1 -0
- package/dist/cjs/desk/scope.cjs +54 -0
- package/dist/cjs/desk/scope.native.js +61 -0
- package/dist/cjs/desk/scope.native.js.map +1 -0
- package/dist/cjs/desk/target.cjs +174 -0
- package/dist/cjs/desk/target.native.js +178 -0
- package/dist/cjs/desk/target.native.js.map +1 -0
- package/dist/cjs/index.cjs +13 -0
- package/dist/cjs/index.native.js +13 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/list/DoctypeListScreen.cjs +3 -1
- package/dist/cjs/list/DoctypeListScreen.native.js +3 -1
- package/dist/cjs/list/DoctypeListScreen.native.js.map +1 -1
- package/dist/cjs/report/DoctypeReportView.cjs +3 -1
- package/dist/cjs/report/DoctypeReportView.native.js +4 -2
- package/dist/cjs/report/DoctypeReportView.native.js.map +1 -1
- package/dist/cjs/views/CalendarView.cjs +5 -0
- package/dist/cjs/views/CalendarView.native.js +5 -0
- package/dist/cjs/views/CalendarView.native.js.map +1 -1
- package/dist/cjs/views/DashboardView.cjs +5 -3
- package/dist/cjs/views/DashboardView.native.js +5 -3
- package/dist/cjs/views/DashboardView.native.js.map +1 -1
- package/dist/cjs/views/ImageView.cjs +5 -0
- package/dist/cjs/views/ImageView.native.js +5 -0
- package/dist/cjs/views/ImageView.native.js.map +1 -1
- package/dist/cjs/views/KanbanView.cjs +5 -2
- package/dist/cjs/views/KanbanView.native.js +5 -2
- package/dist/cjs/views/KanbanView.native.js.map +1 -1
- package/dist/cjs/views/TreeView.cjs +5 -0
- package/dist/cjs/views/TreeView.native.js +5 -0
- package/dist/cjs/views/TreeView.native.js.map +1 -1
- package/dist/esm/config/BackofficeProvider.mjs +5 -11
- package/dist/esm/config/BackofficeProvider.mjs.map +1 -1
- package/dist/esm/config/BackofficeProvider.native.js +10 -30
- package/dist/esm/config/BackofficeProvider.native.js.map +1 -1
- package/dist/esm/desk/Desk.mjs +162 -0
- package/dist/esm/desk/Desk.mjs.map +1 -0
- package/dist/esm/desk/Desk.native.js +186 -0
- package/dist/esm/desk/Desk.native.js.map +1 -0
- package/dist/esm/desk/DeskSurface.mjs +97 -0
- package/dist/esm/desk/DeskSurface.mjs.map +1 -0
- package/dist/esm/desk/DeskSurface.native.js +101 -0
- package/dist/esm/desk/DeskSurface.native.js.map +1 -0
- package/dist/esm/desk/resolveDeskPath.mjs +93 -0
- package/dist/esm/desk/resolveDeskPath.mjs.map +1 -0
- package/dist/esm/desk/resolveDeskPath.native.js +95 -0
- package/dist/esm/desk/resolveDeskPath.native.js.map +1 -0
- package/dist/esm/desk/scope.mjs +27 -0
- package/dist/esm/desk/scope.mjs.map +1 -0
- package/dist/esm/desk/scope.native.js +31 -0
- package/dist/esm/desk/scope.native.js.map +1 -0
- package/dist/esm/desk/target.mjs +147 -0
- package/dist/esm/desk/target.mjs.map +1 -0
- package/dist/esm/desk/target.native.js +148 -0
- package/dist/esm/desk/target.native.js.map +1 -0
- package/dist/esm/index.mjs +6 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +6 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/list/DoctypeListScreen.mjs +3 -1
- package/dist/esm/list/DoctypeListScreen.mjs.map +1 -1
- package/dist/esm/list/DoctypeListScreen.native.js +3 -1
- package/dist/esm/list/DoctypeListScreen.native.js.map +1 -1
- package/dist/esm/report/DoctypeReportView.mjs +3 -1
- package/dist/esm/report/DoctypeReportView.mjs.map +1 -1
- package/dist/esm/report/DoctypeReportView.native.js +4 -2
- package/dist/esm/report/DoctypeReportView.native.js.map +1 -1
- package/dist/esm/views/CalendarView.mjs +5 -0
- package/dist/esm/views/CalendarView.mjs.map +1 -1
- package/dist/esm/views/CalendarView.native.js +5 -0
- package/dist/esm/views/CalendarView.native.js.map +1 -1
- package/dist/esm/views/DashboardView.mjs +5 -3
- package/dist/esm/views/DashboardView.mjs.map +1 -1
- package/dist/esm/views/DashboardView.native.js +5 -3
- package/dist/esm/views/DashboardView.native.js.map +1 -1
- package/dist/esm/views/ImageView.mjs +5 -0
- package/dist/esm/views/ImageView.mjs.map +1 -1
- package/dist/esm/views/ImageView.native.js +5 -0
- package/dist/esm/views/ImageView.native.js.map +1 -1
- package/dist/esm/views/KanbanView.mjs +5 -2
- package/dist/esm/views/KanbanView.mjs.map +1 -1
- package/dist/esm/views/KanbanView.native.js +5 -2
- package/dist/esm/views/KanbanView.native.js.map +1 -1
- package/dist/esm/views/TreeView.mjs +5 -0
- package/dist/esm/views/TreeView.mjs.map +1 -1
- package/dist/esm/views/TreeView.native.js +5 -0
- package/dist/esm/views/TreeView.native.js.map +1 -1
- package/dist/jsx/config/BackofficeProvider.mjs +5 -11
- package/dist/jsx/config/BackofficeProvider.mjs.map +1 -1
- package/dist/jsx/config/BackofficeProvider.native.js +9 -29
- package/dist/jsx/config/BackofficeProvider.native.js.map +1 -1
- package/dist/jsx/desk/Desk.mjs +162 -0
- package/dist/jsx/desk/Desk.mjs.map +1 -0
- package/dist/jsx/desk/Desk.native.js +214 -0
- package/dist/jsx/desk/Desk.native.js.map +1 -0
- package/dist/jsx/desk/DeskSurface.mjs +97 -0
- package/dist/jsx/desk/DeskSurface.mjs.map +1 -0
- package/dist/jsx/desk/DeskSurface.native.js +130 -0
- package/dist/jsx/desk/DeskSurface.native.js.map +1 -0
- package/dist/jsx/desk/resolveDeskPath.mjs +93 -0
- package/dist/jsx/desk/resolveDeskPath.mjs.map +1 -0
- package/dist/jsx/desk/resolveDeskPath.native.js +123 -0
- package/dist/jsx/desk/resolveDeskPath.native.js.map +1 -0
- package/dist/jsx/desk/scope.mjs +27 -0
- package/dist/jsx/desk/scope.mjs.map +1 -0
- package/dist/jsx/desk/scope.native.js +61 -0
- package/dist/jsx/desk/scope.native.js.map +1 -0
- package/dist/jsx/desk/target.mjs +147 -0
- package/dist/jsx/desk/target.mjs.map +1 -0
- package/dist/jsx/desk/target.native.js +178 -0
- package/dist/jsx/desk/target.native.js.map +1 -0
- package/dist/jsx/index.js +6 -1
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +6 -1
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +13 -0
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/list/DoctypeListScreen.mjs +3 -1
- package/dist/jsx/list/DoctypeListScreen.mjs.map +1 -1
- package/dist/jsx/list/DoctypeListScreen.native.js +3 -1
- package/dist/jsx/list/DoctypeListScreen.native.js.map +1 -1
- package/dist/jsx/report/DoctypeReportView.mjs +3 -1
- package/dist/jsx/report/DoctypeReportView.mjs.map +1 -1
- package/dist/jsx/report/DoctypeReportView.native.js +4 -2
- package/dist/jsx/report/DoctypeReportView.native.js.map +1 -1
- package/dist/jsx/views/CalendarView.mjs +5 -0
- package/dist/jsx/views/CalendarView.mjs.map +1 -1
- package/dist/jsx/views/CalendarView.native.js +5 -0
- package/dist/jsx/views/CalendarView.native.js.map +1 -1
- package/dist/jsx/views/DashboardView.mjs +5 -3
- package/dist/jsx/views/DashboardView.mjs.map +1 -1
- package/dist/jsx/views/DashboardView.native.js +5 -3
- package/dist/jsx/views/DashboardView.native.js.map +1 -1
- package/dist/jsx/views/ImageView.mjs +5 -0
- package/dist/jsx/views/ImageView.mjs.map +1 -1
- package/dist/jsx/views/ImageView.native.js +5 -0
- package/dist/jsx/views/ImageView.native.js.map +1 -1
- package/dist/jsx/views/KanbanView.mjs +5 -2
- package/dist/jsx/views/KanbanView.mjs.map +1 -1
- package/dist/jsx/views/KanbanView.native.js +5 -2
- package/dist/jsx/views/KanbanView.native.js.map +1 -1
- package/dist/jsx/views/TreeView.mjs +5 -0
- package/dist/jsx/views/TreeView.mjs.map +1 -1
- package/dist/jsx/views/TreeView.native.js +5 -0
- package/dist/jsx/views/TreeView.native.js.map +1 -1
- package/package.json +12 -12
- package/src/config/BackofficeProvider.tsx +11 -18
- package/src/desk/Desk.spec.tsx +287 -0
- package/src/desk/Desk.tsx +308 -0
- package/src/desk/DeskSurface.tsx +132 -0
- package/src/desk/doctrine.spec.ts +48 -0
- package/src/desk/resolveDeskPath.spec.ts +174 -0
- package/src/desk/resolveDeskPath.ts +111 -0
- package/src/desk/scope.tsx +52 -0
- package/src/desk/target.ts +169 -0
- package/src/index.ts +17 -0
- package/src/list/DoctypeListScreen.tsx +4 -1
- package/src/report/DoctypeReportView.tsx +6 -2
- package/src/views/CalendarView.tsx +3 -0
- package/src/views/DashboardView.tsx +5 -3
- package/src/views/ImageView.tsx +3 -0
- package/src/views/KanbanView.tsx +5 -1
- package/src/views/TreeView.tsx +3 -0
- package/types/config/BackofficeProvider.d.ts +6 -4
- package/types/config/BackofficeProvider.d.ts.map +1 -1
- package/types/desk/Desk.d.ts +91 -0
- package/types/desk/Desk.d.ts.map +1 -0
- package/types/desk/DeskSurface.d.ts +24 -0
- package/types/desk/DeskSurface.d.ts.map +1 -0
- package/types/desk/resolveDeskPath.d.ts +60 -0
- package/types/desk/resolveDeskPath.d.ts.map +1 -0
- package/types/desk/scope.d.ts +31 -0
- package/types/desk/scope.d.ts.map +1 -0
- package/types/desk/target.d.ts +57 -0
- package/types/desk/target.d.ts.map +1 -0
- package/types/index.d.ts +10 -0
- package/types/index.d.ts.map +1 -1
- package/types/list/DoctypeListScreen.d.ts.map +1 -1
- package/types/report/DoctypeReportView.d.ts.map +1 -1
- package/types/views/CalendarView.d.ts.map +1 -1
- package/types/views/DashboardView.d.ts.map +1 -1
- package/types/views/ImageView.d.ts.map +1 -1
- package/types/views/KanbanView.d.ts.map +1 -1
- package/types/views/TreeView.d.ts.map +1 -1
package/src/index.ts
CHANGED
|
@@ -42,6 +42,23 @@ export type {
|
|
|
42
42
|
export type { BackofficeEvent, BackofficeEventHandler } from "./config/events";
|
|
43
43
|
export type { BackofficeSlots } from "./config/slots";
|
|
44
44
|
|
|
45
|
+
// Desk — the whole desk as one importable component (spec 09)
|
|
46
|
+
export { Desk } from "./desk/Desk";
|
|
47
|
+
export type { DeskChrome, DeskProps } from "./desk/Desk";
|
|
48
|
+
export { DeskSurface } from "./desk/DeskSurface";
|
|
49
|
+
export type {
|
|
50
|
+
DeskSurfaceKind,
|
|
51
|
+
DeskSurfaceOverride,
|
|
52
|
+
DeskSurfaceOverrides,
|
|
53
|
+
DeskSurfaceProps,
|
|
54
|
+
} from "./desk/DeskSurface";
|
|
55
|
+
export { resolveDeskPath } from "./desk/resolveDeskPath";
|
|
56
|
+
export type { DeskAddress, DeskViewParams } from "./desk/resolveDeskPath";
|
|
57
|
+
export { guessDeskTarget, useDeskTarget } from "./desk/target";
|
|
58
|
+
export type { DeskPins, DeskTarget } from "./desk/target";
|
|
59
|
+
export { DeskScopeProvider, useDeskScope, useScopedFilters } from "./desk/scope";
|
|
60
|
+
export type { DeskScopeProviderProps } from "./desk/scope";
|
|
61
|
+
|
|
45
62
|
// Navigation seam
|
|
46
63
|
export {
|
|
47
64
|
ControlledNavigator,
|
|
@@ -96,6 +96,7 @@ import {
|
|
|
96
96
|
type ListSortState,
|
|
97
97
|
} from "./listUrlState";
|
|
98
98
|
import { useSessionUserId as useSessionUser } from "../shared/useSessionUserId";
|
|
99
|
+
import { useDeskScope } from "../desk/scope";
|
|
99
100
|
|
|
100
101
|
export interface DoctypeListScreenProps {
|
|
101
102
|
/** Proper-cased doctype name (e.g. "ToDo", "Sales Order") */
|
|
@@ -257,7 +258,9 @@ export function DoctypeListScreen({
|
|
|
257
258
|
// Always-ANDed host filters: joined into every query (table injection,
|
|
258
259
|
// live count, facet stats) but invisible to the user filter chrome —
|
|
259
260
|
// value-keyed so unstable array literals from the host don't churn.
|
|
260
|
-
|
|
261
|
+
// The ambient desk scope (GL-5, the tenant seam) joins the same channel.
|
|
262
|
+
const deskScope = useDeskScope();
|
|
263
|
+
const fixedFiltersKey = JSON.stringify([...deskScope, ...(fixedFilters ?? [])]);
|
|
261
264
|
const fixedTuples = useMemo(
|
|
262
265
|
() => JSON.parse(fixedFiltersKey) as FrappeFilters,
|
|
263
266
|
[fixedFiltersKey],
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
useBackofficePaths,
|
|
35
35
|
} from "../config/BackofficeProvider";
|
|
36
36
|
import { BACKOFFICE_I18N_NAMESPACE } from "../i18n";
|
|
37
|
+
import { useDeskScope } from "../desk/scope";
|
|
37
38
|
import type { FrappeFilters } from "../shared/types";
|
|
38
39
|
import { useDoctypeMeta } from "../shared/useDoctypeMeta";
|
|
39
40
|
import { useViewConnection } from "../views/connection";
|
|
@@ -105,6 +106,7 @@ export function DoctypeReportView({
|
|
|
105
106
|
initialFilters,
|
|
106
107
|
}: DoctypeReportViewProps) {
|
|
107
108
|
const { t } = useTranslation(BACKOFFICE_I18N_NAMESPACE);
|
|
109
|
+
const deskScope = useDeskScope();
|
|
108
110
|
const navigator = useBackofficeNavigator();
|
|
109
111
|
const paths = useBackofficePaths();
|
|
110
112
|
const { params } = useBackofficeLocation();
|
|
@@ -173,9 +175,11 @@ export function DoctypeReportView({
|
|
|
173
175
|
() => columnFilterTuples(selectedColumns, committedFilters),
|
|
174
176
|
[selectedColumns, committedFilters],
|
|
175
177
|
);
|
|
178
|
+
// Desk scope (GL-5) ANDs into every report query, invisible to the
|
|
179
|
+
// filter chrome and not clearable by the user.
|
|
176
180
|
const effectiveFilters = useMemo(
|
|
177
|
-
() => [...baseFilters, ...columnTuples],
|
|
178
|
-
[baseFilters, columnTuples],
|
|
181
|
+
() => [...deskScope, ...baseFilters, ...columnTuples],
|
|
182
|
+
[deskScope, baseFilters, columnTuples],
|
|
179
183
|
);
|
|
180
184
|
|
|
181
185
|
// ── Sort / group / paging ───────────────────────────────────
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
useBackofficePaths,
|
|
20
20
|
} from "../config/BackofficeProvider";
|
|
21
21
|
import { BACKOFFICE_I18N_NAMESPACE } from "../i18n";
|
|
22
|
+
import { useDeskScope } from "../desk/scope";
|
|
22
23
|
import { CalendarFieldSelector, calendarDateFieldCandidates } from "./calendar-field-selector";
|
|
23
24
|
import { useViewConnection } from "./connection";
|
|
24
25
|
import { useCalendarViewSettings } from "./deskViewConfigs";
|
|
@@ -64,6 +65,7 @@ export function CalendarView({
|
|
|
64
65
|
onSlotCreate,
|
|
65
66
|
}: CalendarViewProps) {
|
|
66
67
|
const { t } = useTranslation(BACKOFFICE_I18N_NAMESPACE);
|
|
68
|
+
const deskScope = useDeskScope();
|
|
67
69
|
const navigator = useBackofficeNavigator();
|
|
68
70
|
const paths = useBackofficePaths();
|
|
69
71
|
const { newDoc } = useBackofficeCapabilities();
|
|
@@ -157,6 +159,7 @@ export function CalendarView({
|
|
|
157
159
|
// date field in its field list (no stale rows missing the column).
|
|
158
160
|
key={dateField}
|
|
159
161
|
doctype={doctype}
|
|
162
|
+
{...(deskScope.length > 0 && { filters: deskScope })}
|
|
160
163
|
dateField={dateField}
|
|
161
164
|
endDateField={endDateField}
|
|
162
165
|
titleField={titleField}
|
|
@@ -23,6 +23,7 @@ import { useState } from "react";
|
|
|
23
23
|
import { useTranslation } from "react-i18next";
|
|
24
24
|
import { useBackofficeNavigator, useBackofficePaths } from "../config/BackofficeProvider";
|
|
25
25
|
import { BACKOFFICE_I18N_NAMESPACE } from "../i18n";
|
|
26
|
+
import { useDeskScope } from "../desk/scope";
|
|
26
27
|
import { useViewConnection } from "./connection";
|
|
27
28
|
import {
|
|
28
29
|
MAX_STATUS_KPI_CARDS,
|
|
@@ -55,6 +56,7 @@ export interface DashboardViewProps {
|
|
|
55
56
|
|
|
56
57
|
export function DashboardView({ doctype }: DashboardViewProps) {
|
|
57
58
|
const { t } = useTranslation(BACKOFFICE_I18N_NAMESPACE);
|
|
59
|
+
const deskScope = useDeskScope();
|
|
58
60
|
const { knobProps } = useResolvedKnobs();
|
|
59
61
|
const navigator = useBackofficeNavigator();
|
|
60
62
|
const paths = useBackofficePaths();
|
|
@@ -101,7 +103,7 @@ export function DashboardView({ doctype }: DashboardViewProps) {
|
|
|
101
103
|
}}
|
|
102
104
|
dataSource={{
|
|
103
105
|
doctype,
|
|
104
|
-
filters: [["creation", ">=", anchors.createdSince]],
|
|
106
|
+
filters: [...deskScope, ["creation", ">=", anchors.createdSince]],
|
|
105
107
|
}}
|
|
106
108
|
/>
|
|
107
109
|
</YStack>
|
|
@@ -115,7 +117,7 @@ export function DashboardView({ doctype }: DashboardViewProps) {
|
|
|
115
117
|
}}
|
|
116
118
|
dataSource={{
|
|
117
119
|
doctype,
|
|
118
|
-
filters: [["modified", ">=", anchors.modifiedSince]],
|
|
120
|
+
filters: [...deskScope, ["modified", ">=", anchors.modifiedSince]],
|
|
119
121
|
}}
|
|
120
122
|
/>
|
|
121
123
|
</YStack>
|
|
@@ -138,7 +140,7 @@ export function DashboardView({ doctype }: DashboardViewProps) {
|
|
|
138
140
|
}}
|
|
139
141
|
dataSource={{
|
|
140
142
|
doctype,
|
|
141
|
-
filters: [[statusField.fieldname, "=", option]],
|
|
143
|
+
filters: [...deskScope, [statusField.fieldname, "=", option]],
|
|
142
144
|
}}
|
|
143
145
|
/>
|
|
144
146
|
</YStack>
|
package/src/views/ImageView.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import type { ReactElement } from "react";
|
|
|
7
7
|
import { useTranslation } from "react-i18next";
|
|
8
8
|
import { useBackofficeNavigator, useBackofficePaths } from "../config/BackofficeProvider";
|
|
9
9
|
import { BACKOFFICE_I18N_NAMESPACE } from "../i18n";
|
|
10
|
+
import { useDeskScope } from "../desk/scope";
|
|
10
11
|
import { detectCardFields, detectImageField, useViewMeta, type AnyDoc } from "./viewMeta";
|
|
11
12
|
import { ViewError, ViewLoading, ViewUnsupported } from "./ViewStates";
|
|
12
13
|
|
|
@@ -20,6 +21,7 @@ export interface ImageViewProps {
|
|
|
20
21
|
|
|
21
22
|
export function ImageView({ doctype }: ImageViewProps) {
|
|
22
23
|
const { t } = useTranslation(BACKOFFICE_I18N_NAMESPACE);
|
|
24
|
+
const deskScope = useDeskScope();
|
|
23
25
|
const navigator = useBackofficeNavigator();
|
|
24
26
|
const paths = useBackofficePaths();
|
|
25
27
|
const { meta, isLoading: isMetaLoading, error: metaError } = useViewMeta(doctype);
|
|
@@ -47,6 +49,7 @@ export function ImageView({ doctype }: ImageViewProps) {
|
|
|
47
49
|
<YStack flex={1}>
|
|
48
50
|
<ImageGridOfDoc
|
|
49
51
|
doctype={doctype}
|
|
52
|
+
{...(deskScope.length > 0 && { filters: deskScope })}
|
|
50
53
|
imageField={imageField}
|
|
51
54
|
titleField={titleField}
|
|
52
55
|
subtitleField={extraFields[0]}
|
package/src/views/KanbanView.tsx
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
useBackofficePaths,
|
|
30
30
|
} from "../config/BackofficeProvider";
|
|
31
31
|
import { BACKOFFICE_I18N_NAMESPACE } from "../i18n";
|
|
32
|
+
import { useDeskScope } from "../desk/scope";
|
|
32
33
|
import { useViewConnection } from "./connection";
|
|
33
34
|
import { useKanbanBoard, type KanbanBoardDoc } from "./deskViewConfigs";
|
|
34
35
|
import {
|
|
@@ -112,6 +113,7 @@ export function KanbanView({
|
|
|
112
113
|
const paths = useBackofficePaths();
|
|
113
114
|
const { newDoc } = useBackofficeCapabilities();
|
|
114
115
|
const { knobProps } = useResolvedKnobs();
|
|
116
|
+
const deskScope = useDeskScope();
|
|
115
117
|
const connection = useViewConnection();
|
|
116
118
|
const { meta, isLoading: isMetaLoading, error: metaError } = useViewMeta(doctype);
|
|
117
119
|
const boards = useKanbanBoard(connection, doctype, boardOverride);
|
|
@@ -290,6 +292,8 @@ export function KanbanView({
|
|
|
290
292
|
) as readonly (keyof AnyDoc & string)[];
|
|
291
293
|
|
|
292
294
|
const boardFilters = boardGoverns ? parseBoardFilters(board?.filters) : [];
|
|
295
|
+
// Desk scope (GL-5) ANDs into the card query alongside board filters.
|
|
296
|
+
const cardFilters = [...deskScope, ...boardFilters];
|
|
293
297
|
const manageBoard = boardGoverns && !readOnly && Boolean(board);
|
|
294
298
|
const archivedColumns = (board?.columns ?? []).filter(
|
|
295
299
|
(column) => column.status === "Archived" && column.column_name,
|
|
@@ -353,7 +357,7 @@ export function KanbanView({
|
|
|
353
357
|
statusField={statusField}
|
|
354
358
|
titleField={titleField}
|
|
355
359
|
fields={fields}
|
|
356
|
-
{...(
|
|
360
|
+
{...(cardFilters && { filters: cardFilters })}
|
|
357
361
|
renderCard={(item) => (
|
|
358
362
|
<YStack {...knobProps.panelPadding} gap="$1">
|
|
359
363
|
<Text fontWeight="500" fontSize={knobProps.sizeToken} numberOfLines={3}>
|
package/src/views/TreeView.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import type { ReactElement } from "react";
|
|
|
8
8
|
import { useTranslation } from "react-i18next";
|
|
9
9
|
import { useBackofficeNavigator, useBackofficePaths } from "../config/BackofficeProvider";
|
|
10
10
|
import { BACKOFFICE_I18N_NAMESPACE } from "../i18n";
|
|
11
|
+
import { useDeskScope } from "../desk/scope";
|
|
11
12
|
import { useViewMeta, type AnyDoc } from "./viewMeta";
|
|
12
13
|
import { ViewError, ViewLoading, ViewUnsupported } from "./ViewStates";
|
|
13
14
|
|
|
@@ -21,6 +22,7 @@ export interface TreeViewProps {
|
|
|
21
22
|
|
|
22
23
|
export function TreeView({ doctype }: TreeViewProps) {
|
|
23
24
|
const { t } = useTranslation(BACKOFFICE_I18N_NAMESPACE);
|
|
25
|
+
const deskScope = useDeskScope();
|
|
24
26
|
const navigator = useBackofficeNavigator();
|
|
25
27
|
const paths = useBackofficePaths();
|
|
26
28
|
const { meta, isLoading: isMetaLoading, error: metaError } = useViewMeta(doctype);
|
|
@@ -46,6 +48,7 @@ export function TreeView({ doctype }: TreeViewProps) {
|
|
|
46
48
|
<YStack flex={1}>
|
|
47
49
|
<TreeOfDoc
|
|
48
50
|
doctype={doctype}
|
|
51
|
+
{...(deskScope.length > 0 && { filters: deskScope })}
|
|
49
52
|
titleField={meta?.title_field}
|
|
50
53
|
onNodeClick={(doc) => {
|
|
51
54
|
if (doc.name) navigator.navigate(paths.form(doctype, doc.name));
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* It composes @multiplatform.one/frappe-ui's FrappeProvider internally (the
|
|
6
6
|
* `frappe` prop), publishes the navigation seam + capability flags + slots +
|
|
7
7
|
* event bus through BackofficeConfigContext (consumed by every backoffice
|
|
8
|
-
* surface), registers the package's "backoffice" i18n namespace, and
|
|
9
|
-
* host field
|
|
8
|
+
* surface), registers the package's "backoffice" i18n namespace, and scopes
|
|
9
|
+
* host field overrides to this subtree via FieldOverridesProvider (never the
|
|
10
|
+
* module-global registry — GL-4).
|
|
10
11
|
*
|
|
11
12
|
* Surfaces render without a provider too (stories/tests): the context
|
|
12
13
|
* default is a fully-enabled config with an inert navigator.
|
|
@@ -119,8 +120,9 @@ export interface BackofficeProviderProps {
|
|
|
119
120
|
/** Restrict which doctypes are reachable (awesomebar, lists, links). */
|
|
120
121
|
doctypes?: BackofficeDoctypeScope;
|
|
121
122
|
/**
|
|
122
|
-
* Field-renderer overrides
|
|
123
|
-
*
|
|
123
|
+
* Field-renderer overrides (fieldtype → component), e.g.
|
|
124
|
+
* `{ Rating: MyRating }` — context-scoped to this provider, so two
|
|
125
|
+
* providers with different overrides coexist on one page.
|
|
124
126
|
*/
|
|
125
127
|
fields?: Record<string, ComponentType<FieldRenderProps>>;
|
|
126
128
|
/** Host-injected custom actions (form/list toolbars). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeProvider.d.ts","sourceRoot":"","sources":["../../src/config/BackofficeProvider.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"BackofficeProvider.d.ts","sourceRoot":"","sources":["../../src/config/BackofficeProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAItD,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAA0C,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EACpC,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAM/C,sEAAsE;AACtE,MAAM,WAAW,sBAAsB;IACrC,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACnC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,mBAAmB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CAAC;IACvB,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,oEAAoE;IACpE,SAAS,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CAC7C;AAkBD;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,CAEtD;AAED,wBAAgB,yBAAyB,IAAI,8BAA8B,CAE1E;AAED,wBAAgB,sBAAsB,IAAI,mBAAmB,CAE5D;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD;AAED,0EAA0E;AAC1E,wBAAgB,qBAAqB,IAAI,kBAAkB,CAG1D;AAED,iEAAiE;AACjE,wBAAgB,mBAAmB,IAAI,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAGlE;AAMD,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,MAAM,EACN,UAAU,EACV,QAA0B,EAC1B,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,OAAO,EACP,KAAK,EACL,UAAU,EACV,YAAY,EACZ,OAAO,EACP,YAAY,GACb,EAAE,uBAAuB,2CAyGzB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { type FieldRenderProps } from "@multiplatform.one/frappe-ui";
|
|
2
|
+
import type { ComponentType } from "react";
|
|
3
|
+
import { type BackofficeActions, type BackofficeAppearance, type BackofficeFrappeConfig, type BackofficeIntegrations } from "../config/BackofficeProvider";
|
|
4
|
+
import type { BackofficeEventHandler } from "../config/events";
|
|
5
|
+
import type { BackofficeCapabilities, BackofficeDoctypeScope } from "../config/capabilities";
|
|
6
|
+
import type { BackofficeSlots } from "../config/slots";
|
|
7
|
+
import { type BackofficeNavigator } from "../navigation/navigator";
|
|
8
|
+
import { type BackofficeView } from "../navigation/paths";
|
|
9
|
+
import type { FrappeFilters } from "../shared/types";
|
|
10
|
+
import { type DeskSurfaceOverrides } from "./DeskSurface";
|
|
11
|
+
import { type DeskTarget } from "./target";
|
|
12
|
+
export type DeskChrome = "full" | "bare" | "content";
|
|
13
|
+
export interface DeskProps {
|
|
14
|
+
/**
|
|
15
|
+
* Frappe connection. Omit to inherit an ambient FrappeProvider (or
|
|
16
|
+
* BackofficeProvider). IGNORED when an ambient provider exists — Desk
|
|
17
|
+
* warns once, because the SyncModule is cached per baseURL and a second
|
|
18
|
+
* config for the same server silently loses to the first.
|
|
19
|
+
*/
|
|
20
|
+
frappe?: BackofficeFrappeConfig;
|
|
21
|
+
/** Pin the desk to one doctype. Sets the initial target AND the scope. */
|
|
22
|
+
doctype?: string;
|
|
23
|
+
/** With `doctype`: a document name, or "new". Renders the form. */
|
|
24
|
+
name?: string;
|
|
25
|
+
/** With `doctype`: which view. Default "list". */
|
|
26
|
+
view?: BackofficeView;
|
|
27
|
+
/** Pin the desk to one workspace page. */
|
|
28
|
+
workspace?: string;
|
|
29
|
+
/** Pin the desk to one Query/Script Report. */
|
|
30
|
+
report?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Explicit surface address relative to `basePath` (e.g.
|
|
33
|
+
* "/sales-order/SO-0001"). Wins over every pin — the escape hatch for a
|
|
34
|
+
* host with its own address scheme.
|
|
35
|
+
*/
|
|
36
|
+
path?: string;
|
|
37
|
+
/** Seed the user-visible filter channel; the user can change or clear. */
|
|
38
|
+
filters?: FrappeFilters;
|
|
39
|
+
/**
|
|
40
|
+
* ALWAYS ANDed into every doctype-homed query, invisible to the filter
|
|
41
|
+
* chrome, not removable — the tenant seam (DeskScopeProvider).
|
|
42
|
+
*/
|
|
43
|
+
scope?: FrappeFilters;
|
|
44
|
+
/** Doctype reachability. A `doctype` pin defaults this to that doctype. */
|
|
45
|
+
doctypes?: BackofficeDoctypeScope;
|
|
46
|
+
/** Feature flags, everything defaults on (config/capabilities.ts). */
|
|
47
|
+
capabilities?: BackofficeCapabilities;
|
|
48
|
+
/** View-switcher allowlist, intersected with capabilities.views.allow. */
|
|
49
|
+
views?: readonly BackofficeView[];
|
|
50
|
+
/** Force every form read-only regardless of permissions. */
|
|
51
|
+
readOnly?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* "full" banner + workspace rail; "bare" banner only; "content" no
|
|
54
|
+
* chrome. Default: "content" when any pin is set, "full" otherwise.
|
|
55
|
+
*/
|
|
56
|
+
chrome?: DeskChrome;
|
|
57
|
+
/** Sugar for chrome="content". */
|
|
58
|
+
embedded?: boolean;
|
|
59
|
+
/** Render-prop chrome replacements (config/slots.ts). */
|
|
60
|
+
slots?: BackofficeSlots;
|
|
61
|
+
/** Color-scheme adapter for the user menu's "Toggle Theme". */
|
|
62
|
+
appearance?: BackofficeAppearance;
|
|
63
|
+
/** Router-integration hooks (navigation blocker, …). */
|
|
64
|
+
integrations?: BackofficeIntegrations;
|
|
65
|
+
/**
|
|
66
|
+
* Host router adapter. Supply it and Desk owns URLs; omit it and Desk
|
|
67
|
+
* navigates internally over a MemoryNavigator seeded from the pins.
|
|
68
|
+
*/
|
|
69
|
+
navigation?: BackofficeNavigator;
|
|
70
|
+
/** URL prefix Desk is mounted under. Default "/backoffice". */
|
|
71
|
+
basePath?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Intercept push/replace navigations before they happen; return false to
|
|
74
|
+
* cancel (host renders the target itself, e.g. in a drawer). The target
|
|
75
|
+
* is resolved best-effort: an ambiguous slug degrades to a title-cased
|
|
76
|
+
* doctype guess, the same degrade the slug index applies offline.
|
|
77
|
+
*/
|
|
78
|
+
onNavigate?: (target: DeskTarget, path: string) => boolean | void;
|
|
79
|
+
/** Fires whenever the resolved surface changes (host breadcrumbs/titles). */
|
|
80
|
+
onTargetChange?: (target: DeskTarget) => void;
|
|
81
|
+
/** Replace a whole surface, per kind or per doctype under a kind. */
|
|
82
|
+
surfaces?: DeskSurfaceOverrides;
|
|
83
|
+
/** Replace a field control by fieldtype — context-scoped per Desk. */
|
|
84
|
+
fields?: Record<string, ComponentType<FieldRenderProps>>;
|
|
85
|
+
/** Host actions on form and list toolbars, optionally per-doctype. */
|
|
86
|
+
actions?: BackofficeActions;
|
|
87
|
+
/** Every notable desk action lands here (config/events.ts). */
|
|
88
|
+
onEvent?: BackofficeEventHandler;
|
|
89
|
+
}
|
|
90
|
+
export declare function Desk(props: DeskProps): import("react/jsx-runtime").JSX.Element;
|
|
91
|
+
//# sourceMappingURL=Desk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Desk.d.ts","sourceRoot":"","sources":["../../src/desk/Desk.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAyB,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAA0C,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAmC,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE3F,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAErD,MAAM,WAAW,SAAS;IAExB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAGhC,0EAA0E;IAC1E,OAAO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,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACzD,sEAAsE;IACtE,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,sBAAsB,CAAC;CAClC;AAoBD,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,2CAwGpC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ComponentType } from "react";
|
|
2
|
+
import type { BackofficeView } from "../navigation/paths";
|
|
3
|
+
import type { FrappeFilters } from "../shared/types";
|
|
4
|
+
import type { DeskTarget } from "./target";
|
|
5
|
+
export type DeskSurfaceKind = DeskTarget["kind"];
|
|
6
|
+
/** The whole contract an override receives — thin enough to wrap the built-in. */
|
|
7
|
+
export interface DeskSurfaceProps {
|
|
8
|
+
target: DeskTarget;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** A component per kind, or per doctype under that kind. */
|
|
12
|
+
export type DeskSurfaceOverride = ComponentType<DeskSurfaceProps> | Record<string, ComponentType<DeskSurfaceProps>>;
|
|
13
|
+
export type DeskSurfaceOverrides = Partial<Record<DeskSurfaceKind, DeskSurfaceOverride>>;
|
|
14
|
+
export interface DeskSurfaceHostProps extends DeskSurfaceProps {
|
|
15
|
+
overrides?: DeskSurfaceOverrides;
|
|
16
|
+
/** Seed for the list surface's user-editable filter channel. */
|
|
17
|
+
initialFilters?: FrappeFilters;
|
|
18
|
+
/** View-switcher allowlist forwarded to the list surface. */
|
|
19
|
+
views?: readonly BackofficeView[];
|
|
20
|
+
}
|
|
21
|
+
export declare function DeskSurface({ target, overrides, readOnly, initialFilters, views, }: DeskSurfaceHostProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
/** The resolving state — same presentation as the slug route's spinner. */
|
|
23
|
+
export declare function DeskSurfaceLoading(): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=DeskSurface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeskSurface.d.ts","sourceRoot":"","sources":["../../src/desk/DeskSurface.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAIpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;AAEjD,kFAAkF;AAClF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,4DAA4D;AAC5D,MAAM,MAAM,mBAAmB,GAC3B,aAAa,CAAC,gBAAgB,CAAC,GAC/B,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAEpD,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC,CAAC;AAoCzF,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,gEAAgE;IAChE,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,6DAA6D;IAC7D,KAAK,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CACnC;AAED,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,SAAS,EACT,QAAQ,EACR,cAAc,EACd,KAAK,GACN,EAAE,oBAAoB,2CAoCtB;AAED,2EAA2E;AAC3E,wBAAgB,kBAAkB,4CAMjC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* resolveDeskPath — the pure path→surface resolver (MPO-14 / gap GL-1,
|
|
3
|
+
* spec 09 §DM-1, §4.3).
|
|
4
|
+
*
|
|
5
|
+
* One inverse for every builder in `createBackofficePaths`, so dispatch
|
|
6
|
+
* lives in the package once instead of being re-derived per host route
|
|
7
|
+
* file. Pure: no network, no React. The slug half of an address stays
|
|
8
|
+
* AMBIGUOUS here (workspace vs doctype is data, resolved by
|
|
9
|
+
* `useSlugTarget`); `useDeskTarget` composes the two.
|
|
10
|
+
*/
|
|
11
|
+
import type { BackofficeParams } from "../navigation/navigator";
|
|
12
|
+
import { type BackofficeView } from "../navigation/paths";
|
|
13
|
+
/** View search params the view surface reads (board/field/f — spec §2.2). */
|
|
14
|
+
export interface DeskViewParams {
|
|
15
|
+
/** `?board=` kanban board selection. */
|
|
16
|
+
board?: string;
|
|
17
|
+
/** `?field=` calendar date field. */
|
|
18
|
+
field?: string;
|
|
19
|
+
/** `?f=` report base filters (raw urlencoded JSON). */
|
|
20
|
+
filtersParam?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A resolved desk address: the shape of the URL, before slug disambiguation.
|
|
24
|
+
* `slug` kinds still need the runtime workspace/doctype index.
|
|
25
|
+
*/
|
|
26
|
+
export type DeskAddress = {
|
|
27
|
+
kind: "home";
|
|
28
|
+
} | {
|
|
29
|
+
kind: "slug";
|
|
30
|
+
slug: string;
|
|
31
|
+
filtersParam?: string;
|
|
32
|
+
sortParam?: string;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "slug-view";
|
|
35
|
+
slug: string;
|
|
36
|
+
view: Exclude<BackofficeView, "list">;
|
|
37
|
+
params?: DeskViewParams;
|
|
38
|
+
} | {
|
|
39
|
+
kind: "slug-new";
|
|
40
|
+
slug: string;
|
|
41
|
+
defaults?: Record<string, unknown>;
|
|
42
|
+
} | {
|
|
43
|
+
kind: "slug-name";
|
|
44
|
+
slug: string;
|
|
45
|
+
name: string;
|
|
46
|
+
} | {
|
|
47
|
+
kind: "report";
|
|
48
|
+
reportName: string;
|
|
49
|
+
filtersParam?: string;
|
|
50
|
+
} | {
|
|
51
|
+
kind: "not-found";
|
|
52
|
+
path: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Resolve `path` (no query string; query lives in `params`, One-router
|
|
56
|
+
* semantics) against the six route shapes `createBackofficePaths` writes.
|
|
57
|
+
* Paths outside `basePath` resolve to `not-found`.
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveDeskPath(path: string, basePath?: string, params?: BackofficeParams): DeskAddress;
|
|
60
|
+
//# sourceMappingURL=resolveDeskPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveDeskPath.d.ts","sourceRoot":"","sources":["../../src/desk/resolveDeskPath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAE7B,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACzE;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,GACD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GACtE;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAcxC;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,MAAwB,EAClC,MAAM,GAAE,gBAAqB,GAC5B,WAAW,CA2Cb"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Desk scope — the tenant seam (MPO-14 / gap GL-5, spec 09 §DM-4).
|
|
3
|
+
*
|
|
4
|
+
* `scope` filters are ALWAYS ANDed into every doctype-homed query, invisible
|
|
5
|
+
* to the filter chrome and not removable by the user. Before this context
|
|
6
|
+
* existed the seam reached exactly one surface (DoctypeListScreen's
|
|
7
|
+
* `fixedFilters`), so a scoped desk leaked rows the moment the user switched
|
|
8
|
+
* to kanban. Surfaces read the context themselves; hosts set it once via
|
|
9
|
+
* `<Desk scope={…} />` (or `DeskScopeProvider` directly).
|
|
10
|
+
*
|
|
11
|
+
* Scope applies to doctype-homed surfaces (list, kanban, calendar, tree,
|
|
12
|
+
* image, dashboard, report view). Query/Script reports run server-side SQL
|
|
13
|
+
* and the awesomebar searches across doctypes, so field-tuple scope cannot
|
|
14
|
+
* soundly AND into either; restrict those with `capabilities` instead.
|
|
15
|
+
*/
|
|
16
|
+
import type { ReactNode } from "react";
|
|
17
|
+
import type { FrappeFilters } from "../shared/types";
|
|
18
|
+
export interface DeskScopeProviderProps {
|
|
19
|
+
/** Filter tuples ANDed into every doctype-homed query in the subtree. */
|
|
20
|
+
scope?: FrappeFilters;
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export declare function DeskScopeProvider({ scope, children }: DeskScopeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
/** The ambient desk scope; `[]` outside any DeskScopeProvider. */
|
|
25
|
+
export declare function useDeskScope(): FrappeFilters;
|
|
26
|
+
/**
|
|
27
|
+
* AND the ambient scope into `filters`. Returns `undefined` when there is
|
|
28
|
+
* nothing to apply, so callers can spread-conditionally into leaf props.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useScopedFilters(filters?: FrappeFilters): FrappeFilters | undefined;
|
|
31
|
+
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/desk/scope.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAMrD,MAAM,WAAW,sBAAsB;IACrC,yEAAyE;IACzE,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,sBAAsB,2CAK5E;AAED,kEAAkE;AAClE,wBAAgB,YAAY,IAAI,aAAa,CAE5C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,SAAS,CAMnF"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type BackofficeView } from "../navigation/paths";
|
|
2
|
+
import { type DeskViewParams } from "./resolveDeskPath";
|
|
3
|
+
export type DeskTarget = {
|
|
4
|
+
kind: "home";
|
|
5
|
+
} | {
|
|
6
|
+
kind: "workspace";
|
|
7
|
+
workspace: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: "list";
|
|
10
|
+
doctype: string;
|
|
11
|
+
filtersParam?: string;
|
|
12
|
+
sortParam?: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: "view";
|
|
15
|
+
doctype: string;
|
|
16
|
+
view: Exclude<BackofficeView, "list">;
|
|
17
|
+
params?: DeskViewParams;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "new";
|
|
20
|
+
doctype: string;
|
|
21
|
+
defaults?: Record<string, unknown>;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "form";
|
|
24
|
+
doctype: string;
|
|
25
|
+
name: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: "report";
|
|
28
|
+
reportName: string;
|
|
29
|
+
filtersParam?: string;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "not-found";
|
|
32
|
+
slug?: string;
|
|
33
|
+
};
|
|
34
|
+
/** The surface pins a host sets on `<Desk />` (spec §2, "what it shows"). */
|
|
35
|
+
export interface DeskPins {
|
|
36
|
+
doctype?: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
view?: BackofficeView;
|
|
39
|
+
workspace?: string;
|
|
40
|
+
report?: string;
|
|
41
|
+
path?: string;
|
|
42
|
+
}
|
|
43
|
+
export declare function hasDeskPin(pins: DeskPins): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Pure, best-effort address→target for pre-navigation interception
|
|
46
|
+
* (`onNavigate`): the slug degrades to a title-cased doctype guess, the same
|
|
47
|
+
* degrade `useSlugTarget` applies when the index is unavailable.
|
|
48
|
+
*/
|
|
49
|
+
export declare function guessDeskTarget(path: string, basePath: string): DeskTarget;
|
|
50
|
+
/**
|
|
51
|
+
* The desk's current target. `undefined` while an ambiguous slug is still
|
|
52
|
+
* resolving against the once-per-session index. Must be called under
|
|
53
|
+
* BackofficeProvider (it reads the navigator location and the frappe
|
|
54
|
+
* connection from context).
|
|
55
|
+
*/
|
|
56
|
+
export declare function useDeskTarget(pins: DeskPins): DeskTarget | undefined;
|
|
57
|
+
//# sourceMappingURL=target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../src/desk/target.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE7E,OAAO,EAAqC,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE3F,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5E;IACE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,GACD;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GACpE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC,6EAA6E;AAC7E,MAAM,WAAW,QAAQ;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAElD;AA4DD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAK1E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CA2CpE"}
|
package/types/index.d.ts
CHANGED
|
@@ -14,6 +14,16 @@ export { isDoctypeAllowed, resolveCapabilities } from "./config/capabilities";
|
|
|
14
14
|
export type { BackofficeCapabilities, BackofficeDoctypeScope, CapabilityInput, ResolvedBackofficeCapabilities, ResolvedCapability, ResolvedExitToSite, } from "./config/capabilities";
|
|
15
15
|
export type { BackofficeEvent, BackofficeEventHandler } from "./config/events";
|
|
16
16
|
export type { BackofficeSlots } from "./config/slots";
|
|
17
|
+
export { Desk } from "./desk/Desk";
|
|
18
|
+
export type { DeskChrome, DeskProps } from "./desk/Desk";
|
|
19
|
+
export { DeskSurface } from "./desk/DeskSurface";
|
|
20
|
+
export type { DeskSurfaceKind, DeskSurfaceOverride, DeskSurfaceOverrides, DeskSurfaceProps, } from "./desk/DeskSurface";
|
|
21
|
+
export { resolveDeskPath } from "./desk/resolveDeskPath";
|
|
22
|
+
export type { DeskAddress, DeskViewParams } from "./desk/resolveDeskPath";
|
|
23
|
+
export { guessDeskTarget, useDeskTarget } from "./desk/target";
|
|
24
|
+
export type { DeskPins, DeskTarget } from "./desk/target";
|
|
25
|
+
export { DeskScopeProvider, useDeskScope, useScopedFilters } from "./desk/scope";
|
|
26
|
+
export type { DeskScopeProviderProps } from "./desk/scope";
|
|
17
27
|
export { ControlledNavigator, MemoryNavigator, createMemoryNavigator, createNoopNavigator, parseBackofficeHref, } from "./navigation/navigator";
|
|
18
28
|
export type { BackofficeLocation, BackofficeNavigator, BackofficeParams, ControlledNavigatorHandlers, } from "./navigation/navigator";
|
|
19
29
|
export { BACKOFFICE_BASE, BACKOFFICE_VIEWS, createBackofficePaths, formPath, homePath, isBackofficeView, listPath, newDocPath, parseDocDefaults, QUERY_REPORT_BASE, queryReportPath, slugToDisplayName, toSlug, viewPath, workspacePath, } from "./navigation/paths";
|