@multiplatform.one/backoffice 7.2.2 → 7.4.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
|
@@ -98,15 +98,6 @@ function BackofficeProvider({
|
|
|
98
98
|
(0, import_i18n.registerBackofficeTranslations)(i18nInstance);
|
|
99
99
|
return true;
|
|
100
100
|
});
|
|
101
|
-
const appliedFields = (0, import_react.useRef)({});
|
|
102
|
-
if (fields) {
|
|
103
|
-
for (const [fieldtype, component] of Object.entries(fields)) {
|
|
104
|
-
if (appliedFields.current[fieldtype] !== component) {
|
|
105
|
-
(0, import_frappe_ui.registerField)(fieldtype, component);
|
|
106
|
-
appliedFields.current[fieldtype] = component;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
101
|
const onEventRef = (0, import_react.useRef)(onEvent);
|
|
111
102
|
onEventRef.current = onEvent;
|
|
112
103
|
const emitEvent = (0, import_react.useMemo)(() => event => {
|
|
@@ -171,7 +162,10 @@ function BackofficeProvider({
|
|
|
171
162
|
syncOptions: frappe.syncOptions,
|
|
172
163
|
socketOptions: frappe.socketOptions,
|
|
173
164
|
fixtures: frappe.fixtures,
|
|
174
|
-
children
|
|
165
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_frappe_ui.FieldOverridesProvider, {
|
|
166
|
+
fields,
|
|
167
|
+
children
|
|
168
|
+
})
|
|
175
169
|
})
|
|
176
170
|
});
|
|
177
171
|
}
|
|
@@ -118,34 +118,6 @@ function BackofficeProvider(param) {
|
|
|
118
118
|
(0, import_i18n.registerBackofficeTranslations)(i18nInstance);
|
|
119
119
|
return true;
|
|
120
120
|
});
|
|
121
|
-
var appliedFields = (0, import_react.useRef)({});
|
|
122
|
-
if (fields) {
|
|
123
|
-
var _iteratorNormalCompletion = true,
|
|
124
|
-
_didIteratorError = false,
|
|
125
|
-
_iteratorError = void 0;
|
|
126
|
-
try {
|
|
127
|
-
for (var _iterator = Object.entries(fields)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
128
|
-
var [fieldtype, component] = _step.value;
|
|
129
|
-
if (appliedFields.current[fieldtype] !== component) {
|
|
130
|
-
(0, import_frappe_ui.registerField)(fieldtype, component);
|
|
131
|
-
appliedFields.current[fieldtype] = component;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
} catch (err) {
|
|
135
|
-
_didIteratorError = true;
|
|
136
|
-
_iteratorError = err;
|
|
137
|
-
} finally {
|
|
138
|
-
try {
|
|
139
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
140
|
-
_iterator.return();
|
|
141
|
-
}
|
|
142
|
-
} finally {
|
|
143
|
-
if (_didIteratorError) {
|
|
144
|
-
throw _iteratorError;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
121
|
var onEventRef = (0, import_react.useRef)(onEvent);
|
|
150
122
|
onEventRef.current = onEvent;
|
|
151
123
|
var emitEvent2 = (0, import_react.useMemo)(function () {
|
|
@@ -228,7 +200,15 @@ function BackofficeProvider(param) {
|
|
|
228
200
|
syncOptions: frappe.syncOptions,
|
|
229
201
|
socketOptions: frappe.socketOptions,
|
|
230
202
|
fixtures: frappe.fixtures,
|
|
231
|
-
children
|
|
203
|
+
children: (
|
|
204
|
+
/* Context-scoped field overrides (GL-4): per-provider, never the
|
|
205
|
+
module-global registry — two providers with different `fields` on
|
|
206
|
+
one page must not clobber each other. */
|
|
207
|
+
/* @__PURE__ */
|
|
208
|
+
(0, import_jsx_runtime.jsx)(import_frappe_ui.FieldOverridesProvider, {
|
|
209
|
+
fields,
|
|
210
|
+
children
|
|
211
|
+
}))
|
|
232
212
|
})
|
|
233
213
|
});
|
|
234
214
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["to","__toESM","mod","isNodeMode","target","__create","__getProtoOf","__copyProps","__esModule","__defProp","value","enumerable","__toCommonJS","BackofficeProvider_exports","__export","BackofficeProvider","actionsForDoctype","useBackofficeCapabilities","useBackofficeConfig","useBackofficeLocation","useBackofficeNavigator","useBackofficePaths","useBackofficeSlots","useIsDoctypeAllowed","module","exports","import_jsx_runtime","require","import_frappe_ui","import_react","import_react2","import_i18n","import_navigator","import_paths","import_capabilities","actions","doctype","filter","action","doctypes","includes","DEFAULT_CONFIG","navigation","createNoopNavigator","BACKOFFICE_BASE","basePath","paths","createBackofficePaths","capabilities","resolveCapabilities","slots","emitEvent","BackofficeConfigContext","createContext","useContext","navigator","useSyncExternalStore","subscribe","getLocation","useMemo","isDoctypeAllowed","param","children","frappe","fields","appearance","integrations","onEvent","i18nInstance","useState","registerBackofficeTranslations","
|
|
1
|
+
{"version":3,"names":["to","__toESM","mod","isNodeMode","target","__create","__getProtoOf","__copyProps","__esModule","__defProp","value","enumerable","__toCommonJS","BackofficeProvider_exports","__export","BackofficeProvider","actionsForDoctype","useBackofficeCapabilities","useBackofficeConfig","useBackofficeLocation","useBackofficeNavigator","useBackofficePaths","useBackofficeSlots","useIsDoctypeAllowed","module","exports","import_jsx_runtime","require","import_frappe_ui","import_react","import_react2","import_i18n","import_navigator","import_paths","import_capabilities","actions","doctype","filter","action","doctypes","includes","DEFAULT_CONFIG","navigation","createNoopNavigator","BACKOFFICE_BASE","basePath","paths","createBackofficePaths","capabilities","resolveCapabilities","slots","emitEvent","BackofficeConfigContext","createContext","useContext","navigator","useSyncExternalStore","subscribe","getLocation","useMemo","isDoctypeAllowed","param","children","frappe","fields","appearance","integrations","onEvent","i18nInstance","useState","registerBackofficeTranslations","onEventRef","useRef","current","emitEvent2","event","_onEventRef_current","call","wrappedNavigation","navigate","path","type","mode","replace","back","setParams","params","_navigation_setParams","listener","resolvedCapabilities","config"],"sources":["../../../src/config/Backoffice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
|
+
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 Desk_exports = {};
|
|
24
|
+
__export(Desk_exports, {
|
|
25
|
+
Desk: () => Desk
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(Desk_exports);
|
|
28
|
+
var import_components = require("@multiplatform.one/components");
|
|
29
|
+
var import_frappe_ui = require("@multiplatform.one/frappe-ui");
|
|
30
|
+
var import_react = require("react");
|
|
31
|
+
var import_BackofficeProvider = require("../config/BackofficeProvider.cjs");
|
|
32
|
+
var import_navigator = require("../navigation/navigator.cjs");
|
|
33
|
+
var import_paths = require("../navigation/paths.cjs");
|
|
34
|
+
var import_BackofficeShell = require("../shell/BackofficeShell.cjs");
|
|
35
|
+
var import_DeskSurface = require("./DeskSurface.cjs");
|
|
36
|
+
var import_scope = require("./scope.cjs");
|
|
37
|
+
var import_target = require("./target.cjs");
|
|
38
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
|
+
function pinnedPath(pins, basePath) {
|
|
40
|
+
const paths = (0, import_paths.createBackofficePaths)(basePath);
|
|
41
|
+
if (pins.path) {
|
|
42
|
+
const prefix = basePath === "/" ? "" : basePath.replace(/\/+$/, "");
|
|
43
|
+
return `${prefix}${pins.path}`;
|
|
44
|
+
}
|
|
45
|
+
if (pins.doctype) {
|
|
46
|
+
if (pins.name === "new") return paths.newDoc(pins.doctype);
|
|
47
|
+
if (pins.name) return paths.form(pins.doctype, pins.name);
|
|
48
|
+
if (pins.view && pins.view !== "list") return paths.view(pins.doctype, pins.view);
|
|
49
|
+
return paths.list(pins.doctype);
|
|
50
|
+
}
|
|
51
|
+
if (pins.workspace) return paths.workspace(pins.workspace);
|
|
52
|
+
if (pins.report) return paths.queryReport(pins.report);
|
|
53
|
+
return paths.home();
|
|
54
|
+
}
|
|
55
|
+
function Desk(props) {
|
|
56
|
+
const {
|
|
57
|
+
doctype,
|
|
58
|
+
name,
|
|
59
|
+
view,
|
|
60
|
+
workspace,
|
|
61
|
+
report,
|
|
62
|
+
path,
|
|
63
|
+
basePath = import_paths.BACKOFFICE_BASE,
|
|
64
|
+
chrome: chromeProp,
|
|
65
|
+
embedded,
|
|
66
|
+
onNavigate
|
|
67
|
+
} = props;
|
|
68
|
+
const pins = (0, import_react.useMemo)(() => ({
|
|
69
|
+
doctype,
|
|
70
|
+
name,
|
|
71
|
+
view,
|
|
72
|
+
workspace,
|
|
73
|
+
report,
|
|
74
|
+
path
|
|
75
|
+
}), [doctype, name, view, workspace, report, path]);
|
|
76
|
+
const ambient = (0, import_frappe_ui.useFrappeConfig)();
|
|
77
|
+
const warned = (0, import_react.useRef)(false);
|
|
78
|
+
if (ambient && props.frappe && !warned.current) {
|
|
79
|
+
warned.current = true;
|
|
80
|
+
console.warn("[backoffice] <Desk frappe> is ignored: an ambient FrappeProvider exists and the SyncModule is cached per baseURL.");
|
|
81
|
+
}
|
|
82
|
+
const frappe = (0, import_react.useMemo)(() => {
|
|
83
|
+
if (ambient) {
|
|
84
|
+
return {
|
|
85
|
+
baseURL: ambient.baseURL,
|
|
86
|
+
auth: ambient.auth,
|
|
87
|
+
fixtures: ambient.fixtures
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return props.frappe ?? {
|
|
91
|
+
baseURL: ""
|
|
92
|
+
};
|
|
93
|
+
}, [ambient, props.frappe]);
|
|
94
|
+
const memoryNavigator = (0, import_react.useMemo)(() => props.navigation ? void 0 : (0, import_navigator.createMemoryNavigator)(pinnedPath(pins, basePath)),
|
|
95
|
+
// The seed is the ENTRY; later pin changes re-enter through useDeskTarget.
|
|
96
|
+
// oxlint-disable-next-line exhaustive-deps
|
|
97
|
+
[props.navigation ? "host" : "memory"]);
|
|
98
|
+
const baseNavigation = props.navigation ?? memoryNavigator;
|
|
99
|
+
const onNavigateRef = (0, import_react.useRef)(onNavigate);
|
|
100
|
+
onNavigateRef.current = onNavigate;
|
|
101
|
+
const navigation = (0, import_react.useMemo)(() => {
|
|
102
|
+
const intercept = path2 => onNavigateRef.current?.((0, import_target.guessDeskTarget)(path2, basePath), path2) !== false;
|
|
103
|
+
return {
|
|
104
|
+
...baseNavigation,
|
|
105
|
+
navigate: path2 => {
|
|
106
|
+
if (intercept(path2)) baseNavigation.navigate(path2);
|
|
107
|
+
},
|
|
108
|
+
replace: path2 => {
|
|
109
|
+
if (intercept(path2)) baseNavigation.replace(path2);
|
|
110
|
+
},
|
|
111
|
+
back: () => baseNavigation.back(),
|
|
112
|
+
getLocation: () => baseNavigation.getLocation(),
|
|
113
|
+
subscribe: listener => baseNavigation.subscribe(listener),
|
|
114
|
+
...(baseNavigation.setParams ? {
|
|
115
|
+
setParams: params => baseNavigation.setParams?.(params)
|
|
116
|
+
} : {})
|
|
117
|
+
};
|
|
118
|
+
}, [baseNavigation, basePath]);
|
|
119
|
+
const chrome = chromeProp ?? (embedded || (0, import_target.hasDeskPin)(pins) ? "content" : "full");
|
|
120
|
+
const doctypes = props.doctypes ?? (doctype ? {
|
|
121
|
+
allow: [doctype]
|
|
122
|
+
} : void 0);
|
|
123
|
+
const capabilities = (0, import_react.useMemo)(() => chrome === "bare" ? {
|
|
124
|
+
...props.capabilities,
|
|
125
|
+
sidebar: false
|
|
126
|
+
} : props.capabilities, [chrome, props.capabilities]);
|
|
127
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_BackofficeProvider.BackofficeProvider, {
|
|
128
|
+
frappe,
|
|
129
|
+
navigation,
|
|
130
|
+
basePath,
|
|
131
|
+
capabilities,
|
|
132
|
+
doctypes,
|
|
133
|
+
fields: props.fields,
|
|
134
|
+
actions: props.actions,
|
|
135
|
+
slots: props.slots,
|
|
136
|
+
appearance: props.appearance,
|
|
137
|
+
integrations: props.integrations,
|
|
138
|
+
onEvent: props.onEvent,
|
|
139
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_scope.DeskScopeProvider, {
|
|
140
|
+
scope: props.scope,
|
|
141
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(DeskBody, {
|
|
142
|
+
pins,
|
|
143
|
+
chrome,
|
|
144
|
+
readOnly: props.readOnly,
|
|
145
|
+
surfaces: props.surfaces,
|
|
146
|
+
initialFilters: props.filters,
|
|
147
|
+
views: props.views,
|
|
148
|
+
onTargetChange: props.onTargetChange
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function DeskBody({
|
|
154
|
+
pins,
|
|
155
|
+
chrome,
|
|
156
|
+
readOnly,
|
|
157
|
+
surfaces,
|
|
158
|
+
initialFilters,
|
|
159
|
+
views,
|
|
160
|
+
onTargetChange
|
|
161
|
+
}) {
|
|
162
|
+
const target = (0, import_target.useDeskTarget)(pins);
|
|
163
|
+
const onTargetChangeRef = (0, import_react.useRef)(onTargetChange);
|
|
164
|
+
onTargetChangeRef.current = onTargetChange;
|
|
165
|
+
const targetKey = target ? JSON.stringify(target) : void 0;
|
|
166
|
+
(0, import_react.useEffect)(() => {
|
|
167
|
+
if (target) onTargetChangeRef.current?.(target);
|
|
168
|
+
}, [targetKey]);
|
|
169
|
+
const surface = target ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_DeskSurface.DeskSurface, {
|
|
170
|
+
target,
|
|
171
|
+
overrides: surfaces,
|
|
172
|
+
readOnly,
|
|
173
|
+
initialFilters,
|
|
174
|
+
views
|
|
175
|
+
}) : /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_DeskSurface.DeskSurfaceLoading, {});
|
|
176
|
+
if (chrome === "content") {
|
|
177
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.YStack, {
|
|
178
|
+
flex: 1,
|
|
179
|
+
minHeight: 0,
|
|
180
|
+
minWidth: 0,
|
|
181
|
+
children: surface
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_BackofficeShell.BackofficeShell, {
|
|
185
|
+
children: surface
|
|
186
|
+
});
|
|
187
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
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 Desk_exports = {};
|
|
26
|
+
__export(Desk_exports, {
|
|
27
|
+
Desk: () => Desk
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(Desk_exports);
|
|
30
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
+
var import_components = require("@multiplatform.one/components");
|
|
32
|
+
var import_frappe_ui = require("@multiplatform.one/frappe-ui");
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
var import_BackofficeProvider = require("../config/BackofficeProvider.native.js");
|
|
35
|
+
var import_navigator = require("../navigation/navigator.native.js");
|
|
36
|
+
var import_paths = require("../navigation/paths.native.js");
|
|
37
|
+
var import_BackofficeShell = require("../shell/BackofficeShell.native.js");
|
|
38
|
+
var import_DeskSurface = require("./DeskSurface.native.js");
|
|
39
|
+
var import_scope = require("./scope.native.js");
|
|
40
|
+
var import_target = require("./target.native.js");
|
|
41
|
+
function pinnedPath(pins, basePath) {
|
|
42
|
+
var paths = (0, import_paths.createBackofficePaths)(basePath);
|
|
43
|
+
if (pins.path) {
|
|
44
|
+
var prefix = basePath === "/" ? "" : basePath.replace(/\/+$/, "");
|
|
45
|
+
return `${prefix}${pins.path}`;
|
|
46
|
+
}
|
|
47
|
+
if (pins.doctype) {
|
|
48
|
+
if (pins.name === "new") return paths.newDoc(pins.doctype);
|
|
49
|
+
if (pins.name) return paths.form(pins.doctype, pins.name);
|
|
50
|
+
if (pins.view && pins.view !== "list") return paths.view(pins.doctype, pins.view);
|
|
51
|
+
return paths.list(pins.doctype);
|
|
52
|
+
}
|
|
53
|
+
if (pins.workspace) return paths.workspace(pins.workspace);
|
|
54
|
+
if (pins.report) return paths.queryReport(pins.report);
|
|
55
|
+
return paths.home();
|
|
56
|
+
}
|
|
57
|
+
function Desk(props) {
|
|
58
|
+
var _props_navigation, _props_doctypes;
|
|
59
|
+
var {
|
|
60
|
+
doctype,
|
|
61
|
+
name,
|
|
62
|
+
view,
|
|
63
|
+
workspace,
|
|
64
|
+
report,
|
|
65
|
+
path,
|
|
66
|
+
basePath = import_paths.BACKOFFICE_BASE,
|
|
67
|
+
chrome: chromeProp,
|
|
68
|
+
embedded,
|
|
69
|
+
onNavigate
|
|
70
|
+
} = props;
|
|
71
|
+
var pins = (0, import_react.useMemo)(function () {
|
|
72
|
+
return {
|
|
73
|
+
doctype,
|
|
74
|
+
name,
|
|
75
|
+
view,
|
|
76
|
+
workspace,
|
|
77
|
+
report,
|
|
78
|
+
path
|
|
79
|
+
};
|
|
80
|
+
}, [doctype, name, view, workspace, report, path]);
|
|
81
|
+
var ambient = (0, import_frappe_ui.useFrappeConfig)();
|
|
82
|
+
var warned = (0, import_react.useRef)(false);
|
|
83
|
+
if (ambient && props.frappe && !warned.current) {
|
|
84
|
+
warned.current = true;
|
|
85
|
+
console.warn("[backoffice] <Desk frappe> is ignored: an ambient FrappeProvider exists and the SyncModule is cached per baseURL.");
|
|
86
|
+
}
|
|
87
|
+
var frappe = (0, import_react.useMemo)(function () {
|
|
88
|
+
var _props_frappe;
|
|
89
|
+
if (ambient) {
|
|
90
|
+
return {
|
|
91
|
+
baseURL: ambient.baseURL,
|
|
92
|
+
auth: ambient.auth,
|
|
93
|
+
fixtures: ambient.fixtures
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return (_props_frappe = props.frappe) !== null && _props_frappe !== void 0 ? _props_frappe : {
|
|
97
|
+
baseURL: ""
|
|
98
|
+
};
|
|
99
|
+
}, [ambient, props.frappe]);
|
|
100
|
+
var memoryNavigator = (0, import_react.useMemo)(function () {
|
|
101
|
+
return props.navigation ? void 0 : (0, import_navigator.createMemoryNavigator)(pinnedPath(pins, basePath));
|
|
102
|
+
},
|
|
103
|
+
// The seed is the ENTRY; later pin changes re-enter through useDeskTarget.
|
|
104
|
+
// oxlint-disable-next-line exhaustive-deps
|
|
105
|
+
[props.navigation ? "host" : "memory"]);
|
|
106
|
+
var baseNavigation = (_props_navigation = props.navigation) !== null && _props_navigation !== void 0 ? _props_navigation : memoryNavigator;
|
|
107
|
+
var onNavigateRef = (0, import_react.useRef)(onNavigate);
|
|
108
|
+
onNavigateRef.current = onNavigate;
|
|
109
|
+
var navigation = (0, import_react.useMemo)(function () {
|
|
110
|
+
var intercept = function intercept2(path2) {
|
|
111
|
+
var _onNavigateRef_current;
|
|
112
|
+
return ((_onNavigateRef_current = onNavigateRef.current) === null || _onNavigateRef_current === void 0 ? void 0 : _onNavigateRef_current.call(onNavigateRef, (0, import_target.guessDeskTarget)(path2, basePath), path2)) !== false;
|
|
113
|
+
};
|
|
114
|
+
return {
|
|
115
|
+
...baseNavigation,
|
|
116
|
+
navigate: function navigate(path2) {
|
|
117
|
+
if (intercept(path2)) baseNavigation.navigate(path2);
|
|
118
|
+
},
|
|
119
|
+
replace: function replace(path2) {
|
|
120
|
+
if (intercept(path2)) baseNavigation.replace(path2);
|
|
121
|
+
},
|
|
122
|
+
back: function back() {
|
|
123
|
+
return baseNavigation.back();
|
|
124
|
+
},
|
|
125
|
+
getLocation: function getLocation() {
|
|
126
|
+
return baseNavigation.getLocation();
|
|
127
|
+
},
|
|
128
|
+
subscribe: function subscribe(listener) {
|
|
129
|
+
return baseNavigation.subscribe(listener);
|
|
130
|
+
},
|
|
131
|
+
...(baseNavigation.setParams ? {
|
|
132
|
+
setParams: function setParams(params) {
|
|
133
|
+
var _baseNavigation_setParams;
|
|
134
|
+
return (_baseNavigation_setParams = baseNavigation.setParams) === null || _baseNavigation_setParams === void 0 ? void 0 : _baseNavigation_setParams.call(baseNavigation, params);
|
|
135
|
+
}
|
|
136
|
+
} : {})
|
|
137
|
+
};
|
|
138
|
+
}, [baseNavigation, basePath]);
|
|
139
|
+
var chrome = chromeProp !== null && chromeProp !== void 0 ? chromeProp : embedded || (0, import_target.hasDeskPin)(pins) ? "content" : "full";
|
|
140
|
+
var doctypes = (_props_doctypes = props.doctypes) !== null && _props_doctypes !== void 0 ? _props_doctypes : doctype ? {
|
|
141
|
+
allow: [doctype]
|
|
142
|
+
} : void 0;
|
|
143
|
+
var capabilities = (0, import_react.useMemo)(function () {
|
|
144
|
+
return chrome === "bare" ? {
|
|
145
|
+
...props.capabilities,
|
|
146
|
+
sidebar: false
|
|
147
|
+
} : props.capabilities;
|
|
148
|
+
}, [chrome, props.capabilities]);
|
|
149
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_BackofficeProvider.BackofficeProvider, {
|
|
150
|
+
frappe,
|
|
151
|
+
navigation,
|
|
152
|
+
basePath,
|
|
153
|
+
capabilities,
|
|
154
|
+
doctypes,
|
|
155
|
+
fields: props.fields,
|
|
156
|
+
actions: props.actions,
|
|
157
|
+
slots: props.slots,
|
|
158
|
+
appearance: props.appearance,
|
|
159
|
+
integrations: props.integrations,
|
|
160
|
+
onEvent: props.onEvent,
|
|
161
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_scope.DeskScopeProvider, {
|
|
162
|
+
scope: props.scope,
|
|
163
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(DeskBody, {
|
|
164
|
+
pins,
|
|
165
|
+
chrome,
|
|
166
|
+
readOnly: props.readOnly,
|
|
167
|
+
surfaces: props.surfaces,
|
|
168
|
+
initialFilters: props.filters,
|
|
169
|
+
views: props.views,
|
|
170
|
+
onTargetChange: props.onTargetChange
|
|
171
|
+
})
|
|
172
|
+
})
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function DeskBody(param) {
|
|
176
|
+
var {
|
|
177
|
+
pins,
|
|
178
|
+
chrome,
|
|
179
|
+
readOnly,
|
|
180
|
+
surfaces,
|
|
181
|
+
initialFilters,
|
|
182
|
+
views,
|
|
183
|
+
onTargetChange
|
|
184
|
+
} = param;
|
|
185
|
+
var target = (0, import_target.useDeskTarget)(pins);
|
|
186
|
+
var onTargetChangeRef = (0, import_react.useRef)(onTargetChange);
|
|
187
|
+
onTargetChangeRef.current = onTargetChange;
|
|
188
|
+
var targetKey = target ? JSON.stringify(target) : void 0;
|
|
189
|
+
(0, import_react.useEffect)(function () {
|
|
190
|
+
var _onTargetChangeRef_current;
|
|
191
|
+
if (target) (_onTargetChangeRef_current = onTargetChangeRef.current) === null || _onTargetChangeRef_current === void 0 ? void 0 : _onTargetChangeRef_current.call(onTargetChangeRef, target);
|
|
192
|
+
},
|
|
193
|
+
// oxlint-disable-next-line exhaustive-deps
|
|
194
|
+
[targetKey]);
|
|
195
|
+
var surface = target ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_DeskSurface.DeskSurface, {
|
|
196
|
+
target,
|
|
197
|
+
overrides: surfaces,
|
|
198
|
+
readOnly,
|
|
199
|
+
initialFilters,
|
|
200
|
+
views
|
|
201
|
+
}) : /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_DeskSurface.DeskSurfaceLoading, {});
|
|
202
|
+
if (chrome === "content") {
|
|
203
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.YStack, {
|
|
204
|
+
flex: 1,
|
|
205
|
+
minHeight: 0,
|
|
206
|
+
minWidth: 0,
|
|
207
|
+
children: surface
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_BackofficeShell.BackofficeShell, {
|
|
211
|
+
children: surface
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=Desk.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","Desk_exports","__export","Desk","module","exports","import_jsx_runtime","require","import_components","import_frappe_ui","import_react","import_BackofficeProvider","import_navigator","import_paths","import_BackofficeShell","import_DeskSurface","import_scope","import_target","pinnedPath","pins","basePath","paths","createBackofficePaths","path","prefix","replace","doctype","name","newDoc","form","view","list","workspace","report","queryReport","home","props","_props_navigation","_props_doctypes","BACKOFFICE_BASE","chrome","chromeProp","embedded","onNavigate","useMemo","ambient","useFrappeConfig","warned","useRef","frappe","current","console","warn","_props_frappe","baseURL","auth","fixtures","memoryNavigator","navigation","createMemoryNavigator","baseNavigation","onNavigateRef","intercept","intercept2","path2","_onNavigateRef_current","call","guessDeskTarget","navigate","back","getLocation","subscribe","listener","setParams","params","_baseNavigation_setParams","hasDeskPin","doctypes","allow","capabilities","sidebar","jsx","BackofficeProvider","fields","actions","slots","appearance","integrations","onEvent","children","DeskScopeProvider","scope","DeskBody","readOnly","surfaces","initialFilters","filters"],"sources":["../../../src/desk/Desk.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,YAAA;AAAAC,QAAA,CAAAD,YAAA;EAAAE,IAAA,EAAAA,CAAA,KAAAA;AAAA;AAYAC,MAAA,CAAAC,OAAA,GAAAT,YAAuB,CAAAK,YAAA;AACvB,IAAAK,kBAAA,GAAuDC,OAAA;AAEvD,IAAAC,iBAA2C,GAAAD,OAAA;AAC3C,IAAAE,gBAAA,GAAAF,OAAA,+BAMO;AAIP,IAAAG,YAAA,GAAAH,OAAgE;AAChE,IAAAI,yBAA4E,GAAAJ,OAAA;AAE5E,IAAAK,gBAAA,GAAAL,OAAgC;AAChC,IAAAM,YAAA,GAAAN,OAA2E;AAC3E,IAAAO,sBAAkC,GAAAP,OAAA;AAClC,IAAAQ,kBAMO,GAAAR,OAAA;AA6MC,IAAAS,YAAA,GAAAT,OAAA;AA7GR,IAAAU,aAAS,GAAWV,OAAgB,qBAA0B;AAC5D,SAAMW,WAAQC,IAAA,EAAAC,QAAA;EACd,IAAIC,KAAK,OAAMR,YAAA,CAAAS,qBAAA,EAAAF,QAAA;EACb,IAAAD,IAAM,CAAAI,IAAA;IACN,IAAAC,MAAU,GAAAJ,QAAS,KAAK,GAAI,QAAAA,QAAA,CAAAK,OAAA;IAC9B,UAAAD,MAAA,GAAAL,IAAA,CAAAI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M,CAAA2C,YAAS,CAEf;EACA,sBAAkB,IAAAzE,kBAAU,CAAA2E,GAAA,EAAAtE,yBAAA,CAAAuE,kBAAA;IAC5BjC,MAAM;IACNS,UAAA;IACEtC,QAAI;IAEN2D,YAAc;IAEdF,QAAM;IACHM,MAAA,EAAA/C,KAAA,CAAA+C,MAAA;IAAAC,OAAA,EAAAhD,KAAA,CAAAgD,OAAA;IAAAC,KACC,EAAAjD,KAAA,CAAAiD,KAAA;IAAAC,UACA,EAAAlD,KAAW,CAAAkD,UAAA;IAAAC,YACX,EAAAnD,KAAA,CAAAmD,YAAA;IAAAC,OACA,EAAApD,KAAA,CAAAoD,OAAA;IAAAC,QACA,qBAAAnF,kBAAA,CAAA2E,GAAA,EAAAjE,YAAA,CAAA0E,iBAAA;MAAAC,KAAA,EAAAvD,KAAA,CAAAuD,KAAA;MAGFF,QAAA,qBAAAnF,kBAAC,CAAA2E,GAAA,EAAAW,QAAA;QAGCzE,IAAA;QACFqB,MACE;QAIJqD,QAAA,EAAAzD,KAAA,CAAAyD,QAAA;QACAC,QAAO,EAAA1D,KAAA,CAAA0D,QAAA;QACTC,cAAA,EAAA3D,KAAA,CAAA4D,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,123 @@
|
|
|
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 DeskSurface_exports = {};
|
|
24
|
+
__export(DeskSurface_exports, {
|
|
25
|
+
DeskSurface: () => DeskSurface,
|
|
26
|
+
DeskSurfaceLoading: () => DeskSurfaceLoading
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(DeskSurface_exports);
|
|
29
|
+
var import_components = require("@multiplatform.one/components");
|
|
30
|
+
var import_react = require("react");
|
|
31
|
+
var import_createPrefill = require("../form/createPrefill.cjs");
|
|
32
|
+
var import_DocFormScreen = require("../form/DocFormScreen.cjs");
|
|
33
|
+
var import_DoctypeListScreen = require("../list/DoctypeListScreen.cjs");
|
|
34
|
+
var import_QueryReportScreen = require("../report/QueryReportScreen.cjs");
|
|
35
|
+
var import_HomeRedirect = require("../shell/HomeRedirect.cjs");
|
|
36
|
+
var import_NotFoundScreen = require("../shell/NotFoundScreen.cjs");
|
|
37
|
+
var import_DoctypeViewScreen = require("../views/DoctypeViewScreen.cjs");
|
|
38
|
+
var import_WorkspaceScreen = require("../workspace/WorkspaceScreen.cjs");
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
function resolveOverride(overrides, target) {
|
|
41
|
+
const entry = overrides?.[target.kind];
|
|
42
|
+
if (!entry) return void 0;
|
|
43
|
+
if (typeof entry === "function") return entry;
|
|
44
|
+
const doctype = "doctype" in target ? target.doctype : void 0;
|
|
45
|
+
return doctype ? entry[doctype] : void 0;
|
|
46
|
+
}
|
|
47
|
+
function NewDocSurface({
|
|
48
|
+
doctype,
|
|
49
|
+
defaults,
|
|
50
|
+
readOnly
|
|
51
|
+
}) {
|
|
52
|
+
const defaultsKey = JSON.stringify(defaults ?? null);
|
|
53
|
+
(0, import_react.useMemo)(() => {
|
|
54
|
+
if (defaults && Object.keys(defaults).length > 0) (0, import_createPrefill.setCreatePrefill)(doctype, defaults);
|
|
55
|
+
}, [doctype, defaultsKey]);
|
|
56
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_DocFormScreen.DocFormScreen, {
|
|
57
|
+
doctype,
|
|
58
|
+
name: "new",
|
|
59
|
+
readOnly
|
|
60
|
+
}, defaultsKey);
|
|
61
|
+
}
|
|
62
|
+
function DeskSurface({
|
|
63
|
+
target,
|
|
64
|
+
overrides,
|
|
65
|
+
readOnly,
|
|
66
|
+
initialFilters,
|
|
67
|
+
views
|
|
68
|
+
}) {
|
|
69
|
+
const Override = resolveOverride(overrides, target);
|
|
70
|
+
if (Override) return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Override, {
|
|
71
|
+
target,
|
|
72
|
+
readOnly
|
|
73
|
+
});
|
|
74
|
+
switch (target.kind) {
|
|
75
|
+
case "home":
|
|
76
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_HomeRedirect.HomeRedirect, {});
|
|
77
|
+
case "workspace":
|
|
78
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_WorkspaceScreen.WorkspaceScreen, {
|
|
79
|
+
workspace: target.workspace
|
|
80
|
+
});
|
|
81
|
+
case "list":
|
|
82
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_DoctypeListScreen.DoctypeListScreen, {
|
|
83
|
+
doctype: target.doctype,
|
|
84
|
+
filtersParam: target.filtersParam,
|
|
85
|
+
sortParam: target.sortParam,
|
|
86
|
+
initialFilters,
|
|
87
|
+
views
|
|
88
|
+
});
|
|
89
|
+
case "view":
|
|
90
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_DoctypeViewScreen.DoctypeViewScreen, {
|
|
91
|
+
doctype: target.doctype,
|
|
92
|
+
view: target.view
|
|
93
|
+
});
|
|
94
|
+
case "new":
|
|
95
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(NewDocSurface, {
|
|
96
|
+
doctype: target.doctype,
|
|
97
|
+
defaults: target.defaults,
|
|
98
|
+
readOnly
|
|
99
|
+
});
|
|
100
|
+
case "form":
|
|
101
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_DocFormScreen.DocFormScreen, {
|
|
102
|
+
doctype: target.doctype,
|
|
103
|
+
name: target.name,
|
|
104
|
+
readOnly
|
|
105
|
+
});
|
|
106
|
+
case "report":
|
|
107
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_QueryReportScreen.QueryReportScreen, {
|
|
108
|
+
reportName: target.reportName
|
|
109
|
+
});
|
|
110
|
+
case "not-found":
|
|
111
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_NotFoundScreen.NotFoundScreen, {});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function DeskSurfaceLoading() {
|
|
115
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.YStack, {
|
|
116
|
+
flex: 1,
|
|
117
|
+
alignItems: "center",
|
|
118
|
+
justifyContent: "center",
|
|
119
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.Spinner, {
|
|
120
|
+
size: "large"
|
|
121
|
+
})
|
|
122
|
+
});
|
|
123
|
+
}
|