@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
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
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 DeskSurface_exports = {};
|
|
26
|
+
__export(DeskSurface_exports, {
|
|
27
|
+
DeskSurface: () => DeskSurface,
|
|
28
|
+
DeskSurfaceLoading: () => DeskSurfaceLoading
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(DeskSurface_exports);
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_components = require("@multiplatform.one/components");
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
var import_createPrefill = require("../form/createPrefill.native.js");
|
|
35
|
+
var import_DocFormScreen = require("../form/DocFormScreen.native.js");
|
|
36
|
+
var import_DoctypeListScreen = require("../list/DoctypeListScreen.native.js");
|
|
37
|
+
var import_QueryReportScreen = require("../report/QueryReportScreen.native.js");
|
|
38
|
+
var import_HomeRedirect = require("../shell/HomeRedirect.native.js");
|
|
39
|
+
var import_NotFoundScreen = require("../shell/NotFoundScreen.native.js");
|
|
40
|
+
var import_DoctypeViewScreen = require("../views/DoctypeViewScreen.native.js");
|
|
41
|
+
var import_WorkspaceScreen = require("../workspace/WorkspaceScreen.native.js");
|
|
42
|
+
function resolveOverride(overrides, target) {
|
|
43
|
+
var entry = overrides === null || overrides === void 0 ? void 0 : overrides[target.kind];
|
|
44
|
+
if (!entry) return void 0;
|
|
45
|
+
if (typeof entry === "function") return entry;
|
|
46
|
+
var doctype = "doctype" in target ? target.doctype : void 0;
|
|
47
|
+
return doctype ? entry[doctype] : void 0;
|
|
48
|
+
}
|
|
49
|
+
function NewDocSurface(param) {
|
|
50
|
+
var {
|
|
51
|
+
doctype,
|
|
52
|
+
defaults,
|
|
53
|
+
readOnly
|
|
54
|
+
} = param;
|
|
55
|
+
var defaultsKey = JSON.stringify(defaults !== null && defaults !== void 0 ? defaults : null);
|
|
56
|
+
(0, import_react.useMemo)(function () {
|
|
57
|
+
if (defaults && Object.keys(defaults).length > 0) (0, import_createPrefill.setCreatePrefill)(doctype, defaults);
|
|
58
|
+
},
|
|
59
|
+
// oxlint-disable-next-line exhaustive-deps
|
|
60
|
+
[doctype, defaultsKey]);
|
|
61
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_DocFormScreen.DocFormScreen, {
|
|
62
|
+
doctype,
|
|
63
|
+
name: "new",
|
|
64
|
+
readOnly
|
|
65
|
+
}, defaultsKey);
|
|
66
|
+
}
|
|
67
|
+
function DeskSurface(param) {
|
|
68
|
+
var {
|
|
69
|
+
target,
|
|
70
|
+
overrides,
|
|
71
|
+
readOnly,
|
|
72
|
+
initialFilters,
|
|
73
|
+
views
|
|
74
|
+
} = param;
|
|
75
|
+
var Override = resolveOverride(overrides, target);
|
|
76
|
+
if (Override) return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Override, {
|
|
77
|
+
target,
|
|
78
|
+
readOnly
|
|
79
|
+
});
|
|
80
|
+
switch (target.kind) {
|
|
81
|
+
case "home":
|
|
82
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_HomeRedirect.HomeRedirect, {});
|
|
83
|
+
case "workspace":
|
|
84
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_WorkspaceScreen.WorkspaceScreen, {
|
|
85
|
+
workspace: target.workspace
|
|
86
|
+
});
|
|
87
|
+
case "list":
|
|
88
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_DoctypeListScreen.DoctypeListScreen, {
|
|
89
|
+
doctype: target.doctype,
|
|
90
|
+
filtersParam: target.filtersParam,
|
|
91
|
+
sortParam: target.sortParam,
|
|
92
|
+
initialFilters,
|
|
93
|
+
views
|
|
94
|
+
});
|
|
95
|
+
case "view":
|
|
96
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_DoctypeViewScreen.DoctypeViewScreen, {
|
|
97
|
+
doctype: target.doctype,
|
|
98
|
+
view: target.view
|
|
99
|
+
});
|
|
100
|
+
case "new":
|
|
101
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(NewDocSurface, {
|
|
102
|
+
doctype: target.doctype,
|
|
103
|
+
defaults: target.defaults,
|
|
104
|
+
readOnly
|
|
105
|
+
});
|
|
106
|
+
case "form":
|
|
107
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_DocFormScreen.DocFormScreen, {
|
|
108
|
+
doctype: target.doctype,
|
|
109
|
+
name: target.name,
|
|
110
|
+
readOnly
|
|
111
|
+
});
|
|
112
|
+
case "report":
|
|
113
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_QueryReportScreen.QueryReportScreen, {
|
|
114
|
+
reportName: target.reportName
|
|
115
|
+
});
|
|
116
|
+
case "not-found":
|
|
117
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_NotFoundScreen.NotFoundScreen, {});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function DeskSurfaceLoading() {
|
|
121
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.YStack, {
|
|
122
|
+
flex: 1,
|
|
123
|
+
alignItems: "center",
|
|
124
|
+
justifyContent: "center",
|
|
125
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_components.Spinner, {
|
|
126
|
+
size: "large"
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=DeskSurface.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","DeskSurface_exports","DeskSurface","DeskSurfaceLoading","module","exports","import_jsx_runtime","require","import_components","import_react","import_createPrefill","import_DocFormScreen","import_DoctypeListScreen","import_QueryReportScreen","import_HomeRedirect","import_NotFoundScreen","import_DoctypeViewScreen","import_WorkspaceScreen","resolveOverride","overrides","entry","kind","doctype","NewDocSurface","param","defaults","readOnly","defaultsKey","JSON","stringify","useMemo","keys","length","setCreatePrefill","jsx","DocFormScreen","initialFilters","views","Override","HomeRedirect","WorkspaceScreen","workspace","DoctypeListScreen","filtersParam","sortParam","DoctypeViewScreen","view","QueryReportScreen","reportName","NotFoundScreen","YStack","flex","alignItems","justifyContent","children","Spinner","size"],"sources":["DeskSurface.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar DeskSurface_exports = {};\n__export(DeskSurface_exports, {\n DeskSurface: () => DeskSurface,\n DeskSurfaceLoading: () => DeskSurfaceLoading\n});\nmodule.exports = __toCommonJS(DeskSurface_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_components = require(\"@multiplatform.one/components\");\nvar import_react = require(\"react\");\nvar import_createPrefill = require(\"../form/createPrefill\");\nvar import_DocFormScreen = require(\"../form/DocFormScreen\");\nvar import_DoctypeListScreen = require(\"../list/DoctypeListScreen\");\nvar import_QueryReportScreen = require(\"../report/QueryReportScreen\");\nvar import_HomeRedirect = require(\"../shell/HomeRedirect\");\nvar import_NotFoundScreen = require(\"../shell/NotFoundScreen\");\nvar import_DoctypeViewScreen = require(\"../views/DoctypeViewScreen\");\nvar import_WorkspaceScreen = require(\"../workspace/WorkspaceScreen\");\nfunction resolveOverride(overrides, target) {\n var entry = overrides === null || overrides === void 0 ? void 0 : overrides[target.kind];\n if (!entry) return void 0;\n if (typeof entry === \"function\") return entry;\n var doctype = \"doctype\" in target ? target.doctype : void 0;\n return doctype ? entry[doctype] : void 0;\n}\nfunction NewDocSurface(param) {\n var { doctype, defaults, readOnly } = param;\n var defaultsKey = JSON.stringify(defaults !== null && defaults !== void 0 ? defaults : null);\n (0, import_react.useMemo)(\n function() {\n if (defaults && Object.keys(defaults).length > 0) (0, import_createPrefill.setCreatePrefill)(doctype, defaults);\n },\n // oxlint-disable-next-line exhaustive-deps\n [\n doctype,\n defaultsKey\n ]\n );\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DocFormScreen.DocFormScreen, {\n doctype,\n name: \"new\",\n readOnly\n }, defaultsKey);\n}\nfunction DeskSurface(param) {\n var { target, overrides, readOnly, initialFilters, views } = param;\n var Override = resolveOverride(overrides, target);\n if (Override) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Override, {\n target,\n readOnly\n });\n switch (target.kind) {\n case \"home\":\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_HomeRedirect.HomeRedirect, {});\n case \"workspace\":\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_WorkspaceScreen.WorkspaceScreen, {\n workspace: target.workspace\n });\n case \"list\":\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DoctypeListScreen.DoctypeListScreen, {\n doctype: target.doctype,\n filtersParam: target.filtersParam,\n sortParam: target.sortParam,\n initialFilters,\n views\n });\n case \"view\":\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DoctypeViewScreen.DoctypeViewScreen, {\n doctype: target.doctype,\n view: target.view\n });\n case \"new\":\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NewDocSurface, {\n doctype: target.doctype,\n defaults: target.defaults,\n readOnly\n });\n case \"form\":\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DocFormScreen.DocFormScreen, {\n doctype: target.doctype,\n name: target.name,\n readOnly\n });\n case \"report\":\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_QueryReportScreen.QueryReportScreen, {\n reportName: target.reportName\n });\n case \"not-found\":\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_NotFoundScreen.NotFoundScreen, {});\n }\n}\nfunction DeskSurfaceLoading() {\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.YStack, {\n flex: 1,\n alignItems: \"center\",\n justifyContent: \"center\",\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Spinner, {\n size: \"large\"\n })\n });\n}\n//# sourceMappingURL=DeskSurface.js.map\n"],"mappings":"AAAA,YAAY;;AACZ,IAAIA,SAAS,GAAGC,MAAM,CAACC,cAAc;AACrC,IAAIC,gBAAgB,GAAGF,MAAM,CAACG,wBAAwB;AACtD,IAAIC,iBAAiB,GAAGJ,MAAM,CAACK,mBAAmB;AAClD,IAAIC,YAAY,GAAGN,MAAM,CAACO,SAAS,CAACC,cAAc;AAClD,IAAIC,QAAQ,GAAGA,CAACC,MAAM,EAAEC,GAAG,KAAK;EAC9B,KAAK,IAAIC,IAAI,IAAID,GAAG,EAClBZ,SAAS,CAACW,MAAM,EAAEE,IAAI,EAAE;IAAEC,GAAG,EAAEF,GAAG,CAACC,IAAI,CAAC;IAAEE,UAAU,EAAE;EAAK,CAAC,CAAC;AACjE,CAAC;AACD,IAAIC,WAAW,GAAGA,CAACC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,KAAK;EAC5C,IAAIF,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAI,OAAOA,IAAI,KAAK,UAAU,EAAE;IAClE,KAAK,IAAIG,GAAG,IAAIhB,iBAAiB,CAACa,IAAI,CAAC,EACrC,IAAI,CAACX,YAAY,CAACe,IAAI,CAACL,EAAE,EAAEI,GAAG,CAAC,IAAIA,GAAG,KAAKF,MAAM,EAC/CnB,SAAS,CAACiB,EAAE,EAAEI,GAAG,EAAE;MAAEP,GAAG,EAAEA,CAAA,KAAMI,IAAI,CAACG,GAAG,CAAC;MAAEN,UAAU,EAAE,EAAEK,IAAI,GAAGjB,gBAAgB,CAACe,IAAI,EAAEG,GAAG,CAAC,CAAC,IAAID,IAAI,CAACL;IAAW,CAAC,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oBAAoB,CAACwB,aAAa,EAAE;QACrFb,OAAO,EAAEpC,MAAM,CAACoC,OAAO;QACvBlC,IAAI,EAAEF,MAAM,CAACE,IAAI;QACjBsC;MACF,CAAC,CAAC;IACJ,KAAK,QAAQ;MACX,OAAO,eAAgB,CAAC,CAAC,EAAEpB,kBAAkB,CAAC4B,GAAG,EAAErB,wBAAwB,CAACkC,iBAAiB,EAAE;QAC7FC,UAAU,EAAE9D,MAAM,CAAC8D;MACrB,CAAC,CAAC;IACJ,KAAK,WAAW;MACd,OAAO,eAAgB,CAAC,CAAC,EAAE1C,kBAAkB,CAAC4B,GAAG,EAAEnB,qBAAqB,CAACkC,cAAc,EAAE,CAAC,CAAC,CAAC;EAChG;AACF;AACA,SAAS9C,kBAAkBA,CAAA,EAAG;EAC5B,OAAO,eAAgB,CAAC,CAAC,EAAEG,kBAAkB,CAAC4B,GAAG,EAAE1B,iBAAiB,CAAC0C,MAAM,EAAE;IAC3EC,IAAI,EAAE,CAAC;IACPC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,QAAQ,EAAE,eAAgB,CAAC,CAAC,EAAEhD,kBAAkB,CAAC4B,GAAG,EAAE1B,iBAAiB,CAAC+C,OAAO,EAAE;MAC/EC,IAAI,EAAE;IACR,CAAC;EACH,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,118 @@
|
|
|
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 resolveDeskPath_exports = {};
|
|
24
|
+
__export(resolveDeskPath_exports, {
|
|
25
|
+
resolveDeskPath: () => resolveDeskPath
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(resolveDeskPath_exports);
|
|
28
|
+
var import_paths = require("../navigation/paths.cjs");
|
|
29
|
+
function first(value) {
|
|
30
|
+
return typeof value === "string" ? value : value?.[0];
|
|
31
|
+
}
|
|
32
|
+
function decode(segment) {
|
|
33
|
+
try {
|
|
34
|
+
return decodeURIComponent(segment);
|
|
35
|
+
} catch {
|
|
36
|
+
return segment;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function resolveDeskPath(path, basePath = import_paths.BACKOFFICE_BASE, params = {}) {
|
|
40
|
+
const base = basePath.replace(/\/+$/, "") || "/";
|
|
41
|
+
const clean = path.replace(/\/+$/, "") || "/";
|
|
42
|
+
let rest;
|
|
43
|
+
if (base === "/") rest = clean;else if (clean === base) rest = "/";else if (clean.startsWith(`${base}/`)) rest = clean.slice(base.length);else return {
|
|
44
|
+
kind: "not-found",
|
|
45
|
+
path
|
|
46
|
+
};
|
|
47
|
+
const segments = rest.split("/").filter(Boolean).map(decode);
|
|
48
|
+
if (segments.length === 0) return {
|
|
49
|
+
kind: "home"
|
|
50
|
+
};
|
|
51
|
+
if (segments[0] === "query-report") {
|
|
52
|
+
if (segments.length === 2 && segments[1]) {
|
|
53
|
+
return {
|
|
54
|
+
kind: "report",
|
|
55
|
+
reportName: segments[1],
|
|
56
|
+
filtersParam: first(params.filters)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
kind: "not-found",
|
|
61
|
+
path
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const slug = segments[0];
|
|
65
|
+
if (segments.length === 1) {
|
|
66
|
+
return {
|
|
67
|
+
kind: "slug",
|
|
68
|
+
slug,
|
|
69
|
+
filtersParam: first(params.f),
|
|
70
|
+
sortParam: first(params.sort)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (segments.length === 2 && segments[1] === "new") {
|
|
74
|
+
return {
|
|
75
|
+
kind: "slug-new",
|
|
76
|
+
slug,
|
|
77
|
+
defaults: (0, import_paths.parseDocDefaults)(first(params.d))
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (segments.length === 3 && segments[1] === "view" && (0, import_paths.isBackofficeView)(segments[2])) {
|
|
81
|
+
const view = segments[2];
|
|
82
|
+
if (view === "list") {
|
|
83
|
+
return {
|
|
84
|
+
kind: "slug",
|
|
85
|
+
slug,
|
|
86
|
+
filtersParam: first(params.f),
|
|
87
|
+
sortParam: first(params.sort)
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const board = first(params.board);
|
|
91
|
+
const field = first(params.field);
|
|
92
|
+
const filtersParam = first(params.f);
|
|
93
|
+
const viewParams = board || field || filtersParam ? {
|
|
94
|
+
board,
|
|
95
|
+
field,
|
|
96
|
+
filtersParam
|
|
97
|
+
} : void 0;
|
|
98
|
+
return {
|
|
99
|
+
kind: "slug-view",
|
|
100
|
+
slug,
|
|
101
|
+
view,
|
|
102
|
+
...(viewParams && {
|
|
103
|
+
params: viewParams
|
|
104
|
+
})
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (segments.length === 2) {
|
|
108
|
+
return {
|
|
109
|
+
kind: "slug-name",
|
|
110
|
+
slug,
|
|
111
|
+
name: segments[1]
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
kind: "not-found",
|
|
116
|
+
path
|
|
117
|
+
};
|
|
118
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
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 resolveDeskPath_exports = {};
|
|
26
|
+
__export(resolveDeskPath_exports, {
|
|
27
|
+
resolveDeskPath: () => resolveDeskPath
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(resolveDeskPath_exports);
|
|
30
|
+
var import_paths = require("../navigation/paths.native.js");
|
|
31
|
+
function first(value) {
|
|
32
|
+
return typeof value === "string" ? value : value === null || value === void 0 ? void 0 : value[0];
|
|
33
|
+
}
|
|
34
|
+
function decode(segment) {
|
|
35
|
+
try {
|
|
36
|
+
return decodeURIComponent(segment);
|
|
37
|
+
} catch (unused) {
|
|
38
|
+
return segment;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function resolveDeskPath(path) {
|
|
42
|
+
var basePath = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : import_paths.BACKOFFICE_BASE,
|
|
43
|
+
params = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
44
|
+
var base = basePath.replace(/\/+$/, "") || "/";
|
|
45
|
+
var clean = path.replace(/\/+$/, "") || "/";
|
|
46
|
+
var rest;
|
|
47
|
+
if (base === "/") rest = clean;else if (clean === base) rest = "/";else if (clean.startsWith(`${base}/`)) rest = clean.slice(base.length);else return {
|
|
48
|
+
kind: "not-found",
|
|
49
|
+
path
|
|
50
|
+
};
|
|
51
|
+
var segments = rest.split("/").filter(Boolean).map(decode);
|
|
52
|
+
if (segments.length === 0) return {
|
|
53
|
+
kind: "home"
|
|
54
|
+
};
|
|
55
|
+
if (segments[0] === "query-report") {
|
|
56
|
+
if (segments.length === 2 && segments[1]) {
|
|
57
|
+
return {
|
|
58
|
+
kind: "report",
|
|
59
|
+
reportName: segments[1],
|
|
60
|
+
filtersParam: first(params.filters)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
kind: "not-found",
|
|
65
|
+
path
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
var slug = segments[0];
|
|
69
|
+
if (segments.length === 1) {
|
|
70
|
+
return {
|
|
71
|
+
kind: "slug",
|
|
72
|
+
slug,
|
|
73
|
+
filtersParam: first(params.f),
|
|
74
|
+
sortParam: first(params.sort)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (segments.length === 2 && segments[1] === "new") {
|
|
78
|
+
return {
|
|
79
|
+
kind: "slug-new",
|
|
80
|
+
slug,
|
|
81
|
+
defaults: (0, import_paths.parseDocDefaults)(first(params.d))
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (segments.length === 3 && segments[1] === "view" && (0, import_paths.isBackofficeView)(segments[2])) {
|
|
85
|
+
var view = segments[2];
|
|
86
|
+
if (view === "list") {
|
|
87
|
+
return {
|
|
88
|
+
kind: "slug",
|
|
89
|
+
slug,
|
|
90
|
+
filtersParam: first(params.f),
|
|
91
|
+
sortParam: first(params.sort)
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
var board = first(params.board);
|
|
95
|
+
var field = first(params.field);
|
|
96
|
+
var filtersParam = first(params.f);
|
|
97
|
+
var viewParams = board || field || filtersParam ? {
|
|
98
|
+
board,
|
|
99
|
+
field,
|
|
100
|
+
filtersParam
|
|
101
|
+
} : void 0;
|
|
102
|
+
return {
|
|
103
|
+
kind: "slug-view",
|
|
104
|
+
slug,
|
|
105
|
+
view,
|
|
106
|
+
...(viewParams && {
|
|
107
|
+
params: viewParams
|
|
108
|
+
})
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
if (segments.length === 2) {
|
|
112
|
+
return {
|
|
113
|
+
kind: "slug-name",
|
|
114
|
+
slug,
|
|
115
|
+
name: segments[1]
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
kind: "not-found",
|
|
120
|
+
path
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=resolveDeskPath.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","resolveDeskPath_exports","resolveDeskPath","module","exports","import_paths","require","first","decode","segment","decodeURIComponent","unused","path","basePath","arguments","length","BACKOFFICE_BASE","params","base","replace","clean","rest","startsWith","slice","kind","segments","split","filter","Boolean","map","reportName","filtersParam","filters","slug","f","sortParam","sort","defaults","parseDocDefaults","d","isBackofficeView","view","board","field","viewParams"],"sources":["resolveDeskPath.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar resolveDeskPath_exports = {};\n__export(resolveDeskPath_exports, {\n resolveDeskPath: () => resolveDeskPath\n});\nmodule.exports = __toCommonJS(resolveDeskPath_exports);\nvar import_paths = require(\"../navigation/paths\");\nfunction first(value) {\n return typeof value === \"string\" ? value : value === null || value === void 0 ? void 0 : value[0];\n}\nfunction decode(segment) {\n try {\n return decodeURIComponent(segment);\n } catch (unused) {\n return segment;\n }\n}\nfunction resolveDeskPath(path) {\n var basePath = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : import_paths.BACKOFFICE_BASE, params = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};\n var base = basePath.replace(/\\/+$/, \"\") || \"/\";\n var clean = path.replace(/\\/+$/, \"\") || \"/\";\n var rest;\n if (base === \"/\") rest = clean;\n else if (clean === base) rest = \"/\";\n else if (clean.startsWith(`${base}/`)) rest = clean.slice(base.length);\n else return {\n kind: \"not-found\",\n path\n };\n var segments = rest.split(\"/\").filter(Boolean).map(decode);\n if (segments.length === 0) return {\n kind: \"home\"\n };\n if (segments[0] === \"query-report\") {\n if (segments.length === 2 && segments[1]) {\n return {\n kind: \"report\",\n reportName: segments[1],\n filtersParam: first(params.filters)\n };\n }\n return {\n kind: \"not-found\",\n path\n };\n }\n var slug = segments[0];\n if (segments.length === 1) {\n return {\n kind: \"slug\",\n slug,\n filtersParam: first(params.f),\n sortParam: first(params.sort)\n };\n }\n if (segments.length === 2 && segments[1] === \"new\") {\n return {\n kind: \"slug-new\",\n slug,\n defaults: (0, import_paths.parseDocDefaults)(first(params.d))\n };\n }\n if (segments.length === 3 && segments[1] === \"view\" && (0, import_paths.isBackofficeView)(segments[2])) {\n var view = segments[2];\n if (view === \"list\") {\n return {\n kind: \"slug\",\n slug,\n filtersParam: first(params.f),\n sortParam: first(params.sort)\n };\n }\n var board = first(params.board);\n var field = first(params.field);\n var filtersParam = first(params.f);\n var viewParams = board || field || filtersParam ? {\n board,\n field,\n filtersParam\n } : void 0;\n return {\n kind: \"slug-view\",\n slug,\n view,\n ...viewParams && {\n params: viewParams\n }\n };\n }\n if (segments.length === 2) {\n return {\n kind: \"slug-name\",\n slug,\n name: segments[1]\n };\n }\n return {\n kind: \"not-found\",\n path\n };\n}\n//# sourceMappingURL=resolveDeskPath.js.map\n"],"mappings":"AAAA,YAAY;;AACZ,IAAIA,SAAS,GAAGC,MAAM,CAACC,cAAc;AACrC,IAAIC,gBAAgB,GAAGF,MAAM,CAACG,wBAAwB;AACtD,IAAIC,iBAAiB,GAAGJ,MAAM,CAACK,mBAAmB;AAClD,IAAIC,YAAY,GAAGN,MAAM,CAACO,SAAS,CAACC,cAAc;AAClD,IAAIC,QAAQ,GAAGA,CAACC,MAAM,EAAEC,GAAG,KAAK;EAC9B,KAAK,IAAIC,IAAI,IAAID,GAAG,EAClBZ,SAAS,CAACW,MAAM,EAAEE,IAAI,EAAE;IAAEC,GAAG,EAAEF,GAAG,CAACC,IAAI,CAAC;IAAEE,UAAU,EAAE;EAAK,CAAC,CAAC;AACjE,CAAC;AACD,IAAIC,WAAW,GAAGA,CAACC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,KAAK;EAC5C,IAAIF,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAI,OAAOA,IAAI,KAAK,UAAU,EAAE;IAClE,KAA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AK,CAAC;IAC/B,IAAIZ,YAAY,GAAGxB,KAAK,CAACU,MAAM,CAACiB,CAAC,CAAC;IAClC,IAAIU,UAAU,GAAGF,KAAK,IAAIC,KAAK,IAAIZ,YAAY,GAAG;MAChDW,KAAK;MACLC,KAAK;MACLZ;IACF,CAAC,GAAG,KAAK,CAAC;IACV,OAAO;MACLP,IAAI,EAAE,WAAW;MACjBS,IAAI;MACJQ,IAAI;MACJ,IAAGG,UAAU,IAAI;QACf3B,MAAM,EAAE2B;MACV,CAAC;IACH,CAAC;EACH;EACA,IAAInB,QAAQ,CAACV,MAAM,KAAK,CAAC,EAAE;IACzB,OAAO;MACLS,IAAI,EAAE,WAAW;MACjBS,IAAI;MACJ7C,IAAI,EAAEqC,QAAQ,CAAC,CAAC;IAClB,CAAC;EACH;EACA,OAAO;IACLD,IAAI,EAAE,WAAW;IACjBZ;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 scope_exports = {};
|
|
24
|
+
__export(scope_exports, {
|
|
25
|
+
DeskScopeProvider: () => DeskScopeProvider,
|
|
26
|
+
useDeskScope: () => useDeskScope,
|
|
27
|
+
useScopedFilters: () => useScopedFilters
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(scope_exports);
|
|
30
|
+
var import_react = require("react");
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
const EMPTY_SCOPE = [];
|
|
33
|
+
const DeskScopeContext = (0, import_react.createContext)(EMPTY_SCOPE);
|
|
34
|
+
function DeskScopeProvider({
|
|
35
|
+
scope,
|
|
36
|
+
children
|
|
37
|
+
}) {
|
|
38
|
+
const scopeKey = JSON.stringify(scope ?? EMPTY_SCOPE);
|
|
39
|
+
const value = (0, import_react.useMemo)(() => JSON.parse(scopeKey) ?? EMPTY_SCOPE, [scopeKey]);
|
|
40
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(DeskScopeContext.Provider, {
|
|
41
|
+
value,
|
|
42
|
+
children
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function useDeskScope() {
|
|
46
|
+
return (0, import_react.useContext)(DeskScopeContext);
|
|
47
|
+
}
|
|
48
|
+
function useScopedFilters(filters) {
|
|
49
|
+
const scope = useDeskScope();
|
|
50
|
+
return (0, import_react.useMemo)(() => {
|
|
51
|
+
if (scope.length === 0 && (!filters || filters.length === 0)) return void 0;
|
|
52
|
+
return [...scope, ...(filters ?? [])];
|
|
53
|
+
}, [scope, filters]);
|
|
54
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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 scope_exports = {};
|
|
26
|
+
__export(scope_exports, {
|
|
27
|
+
DeskScopeProvider: () => DeskScopeProvider,
|
|
28
|
+
useDeskScope: () => useDeskScope,
|
|
29
|
+
useScopedFilters: () => useScopedFilters
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(scope_exports);
|
|
32
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
var EMPTY_SCOPE = [];
|
|
35
|
+
var DeskScopeContext = /* @__PURE__ */(0, import_react.createContext)(EMPTY_SCOPE);
|
|
36
|
+
function DeskScopeProvider(param) {
|
|
37
|
+
var {
|
|
38
|
+
scope,
|
|
39
|
+
children
|
|
40
|
+
} = param;
|
|
41
|
+
var scopeKey = JSON.stringify(scope !== null && scope !== void 0 ? scope : EMPTY_SCOPE);
|
|
42
|
+
var value = (0, import_react.useMemo)(function () {
|
|
43
|
+
var _JSON_parse;
|
|
44
|
+
return (_JSON_parse = JSON.parse(scopeKey)) !== null && _JSON_parse !== void 0 ? _JSON_parse : EMPTY_SCOPE;
|
|
45
|
+
}, [scopeKey]);
|
|
46
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(DeskScopeContext.Provider, {
|
|
47
|
+
value,
|
|
48
|
+
children
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function useDeskScope() {
|
|
52
|
+
return (0, import_react.useContext)(DeskScopeContext);
|
|
53
|
+
}
|
|
54
|
+
function useScopedFilters(filters) {
|
|
55
|
+
var scope = useDeskScope();
|
|
56
|
+
return (0, import_react.useMemo)(function () {
|
|
57
|
+
if (scope.length === 0 && (!filters || filters.length === 0)) return void 0;
|
|
58
|
+
return [...scope, ...(filters !== null && filters !== void 0 ? filters : [])];
|
|
59
|
+
}, [scope, filters]);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=scope.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","scope_exports","DeskScopeProvider","useDeskScope","useScopedFilters","module","exports","import_jsx_runtime","require","import_react","EMPTY_SCOPE","DeskScopeContext","createContext","param","scope","children","scopeKey","JSON","stringify","useMemo","_JSON_parse","parse","jsx","Provider","useContext","filters","length"],"sources":["scope.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar scope_exports = {};\n__export(scope_exports, {\n DeskScopeProvider: () => DeskScopeProvider,\n useDeskScope: () => useDeskScope,\n useScopedFilters: () => useScopedFilters\n});\nmodule.exports = __toCommonJS(scope_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_react = require(\"react\");\nvar EMPTY_SCOPE = [];\nvar DeskScopeContext = /* @__PURE__ */ (0, import_react.createContext)(EMPTY_SCOPE);\nfunction DeskScopeProvider(param) {\n var { scope, children } = param;\n var scopeKey = JSON.stringify(scope !== null && scope !== void 0 ? scope : EMPTY_SCOPE);\n var value = (0, import_react.useMemo)(function() {\n var _JSON_parse;\n return (_JSON_parse = JSON.parse(scopeKey)) !== null && _JSON_parse !== void 0 ? _JSON_parse : EMPTY_SCOPE;\n }, [\n scopeKey\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DeskScopeContext.Provider, {\n value,\n children\n });\n}\nfunction useDeskScope() {\n return (0, import_react.useContext)(DeskScopeContext);\n}\nfunction useScopedFilters(filters) {\n var scope = useDeskScope();\n return (0, import_react.useMemo)(function() {\n if (scope.length === 0 && (!filters || filters.length === 0)) return void 0;\n return [\n ...scope,\n ...filters !== null && filters !== void 0 ? filters : []\n ];\n }, [\n scope,\n filters\n ]);\n}\n//# sourceMappingURL=scope.js.map\n"],"mappings":"AAAA,YAAY;;AACZ,IAAIA,SAAS,GAAGC,MAAM,CAACC,cAAc;AACrC,IAAIC,gBAAgB,GAAGF,MAAM,CAACG,wBAAwB;AACtD,IAAIC,iBAAiB,GAAGJ,MAAM,CAACK,mBAAmB;AAClD,IAAIC,YAAY,GAAGN,MAAM,CAACO,SAAS,CAACC,cAAc;AAClD,IAAIC,QAAQ,GAAGA,CAACC,MAAM,EAAEC,GAAG,KAAK;EAC9B,KAAK,IAAIC,IAAI,IAAID,GAAG,EAClBZ,SAAS,CAACW,MAAM,EAAEE,IAAI,E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