@ramesesinc/platform-core 0.1.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/components/action/AlertMessage.d.ts +8 -0
- package/dist/components/action/AlertMessage.js +19 -0
- package/dist/components/action/AlertMessage.tsx +38 -0
- package/dist/components/action/Button.d.ts +21 -0
- package/dist/components/action/Button.js +139 -0
- package/dist/components/action/Button.tsx +230 -0
- package/dist/components/action/CancelEdit.d.ts +9 -0
- package/dist/components/action/CancelEdit.js +21 -0
- package/dist/components/action/CancelEdit.tsx +40 -0
- package/dist/components/action/DeleteData.d.ts +13 -0
- package/dist/components/action/DeleteData.js +43 -0
- package/dist/components/action/DeleteData.tsx +73 -0
- package/dist/components/action/Edit.d.ts +9 -0
- package/dist/components/action/Edit.js +21 -0
- package/dist/components/action/Edit.tsx +40 -0
- package/dist/components/action/LookupPage.d.ts +16 -0
- package/dist/components/action/LookupPage.js +62 -0
- package/dist/components/action/LookupPage.tsx +113 -0
- package/dist/components/action/ProcessRunner.d.ts +62 -0
- package/dist/components/action/ProcessRunner.js +156 -0
- package/dist/components/action/ProcessRunner.tsx +337 -0
- package/dist/components/action/Refresh.d.ts +7 -0
- package/dist/components/action/Refresh.js +17 -0
- package/dist/components/action/Refresh.tsx +35 -0
- package/dist/components/action/SaveData.d.ts +10 -0
- package/dist/components/action/SaveData.js +54 -0
- package/dist/components/action/SaveData.tsx +74 -0
- package/dist/components/action/SelectData.d.ts +8 -0
- package/dist/components/action/SelectData.js +29 -0
- package/dist/components/action/SelectData.tsx +47 -0
- package/dist/components/action/Undo.d.ts +9 -0
- package/dist/components/action/Undo.js +31 -0
- package/dist/components/action/Undo.tsx +50 -0
- package/dist/components/action/UpdateContext.d.ts +9 -0
- package/dist/components/action/UpdateContext.js +21 -0
- package/dist/components/action/UpdateContext.tsx +40 -0
- package/dist/components/action/UpdateData.d.ts +9 -0
- package/dist/components/action/UpdateData.js +33 -0
- package/dist/components/action/UpdateData.tsx +49 -0
- package/dist/components/action/ViewBackPage.d.ts +9 -0
- package/dist/components/action/ViewBackPage.js +19 -0
- package/dist/components/action/ViewBackPage.tsx +46 -0
- package/dist/components/action/ViewPage.d.ts +14 -0
- package/dist/components/action/ViewPage.js +88 -0
- package/dist/components/action/ViewPage.tsx +141 -0
- package/dist/components/common/UIComponent.d.ts +11 -0
- package/dist/components/common/UIComponent.js +52 -0
- package/dist/components/common/UIComponent.tsx +84 -0
- package/dist/components/common/UIInput.d.ts +12 -0
- package/dist/components/common/UIInput.js +37 -0
- package/dist/components/common/UIInput.tsx +49 -0
- package/dist/components/common/UIMenu.d.ts +23 -0
- package/dist/components/common/UIMenu.js +61 -0
- package/dist/components/common/UIMenu.tsx +91 -0
- package/dist/components/index.d.ts +37 -0
- package/dist/components/index.js +44 -0
- package/dist/components/index.ts +51 -0
- package/dist/components/input/CodeEditor.d.ts +12 -0
- package/dist/components/input/CodeEditor.js +132 -0
- package/dist/components/input/CodeEditor.tsx +188 -0
- package/dist/components/input/DateField.d.ts +9 -0
- package/dist/components/input/DateField.js +140 -0
- package/dist/components/input/DateField.tsx +274 -0
- package/dist/components/input/DayPicker.d.ts +2 -0
- package/dist/components/input/DayPicker.js +5 -0
- package/dist/components/input/DayPicker.tsx +5 -0
- package/dist/components/input/HtmlCode.d.ts +8 -0
- package/dist/components/input/HtmlCode.js +157 -0
- package/dist/components/input/HtmlCode.tsx +203 -0
- package/dist/components/input/JsonCode.d.ts +9 -0
- package/dist/components/input/JsonCode.js +159 -0
- package/dist/components/input/JsonCode.tsx +205 -0
- package/dist/components/input/MonthPicker.d.ts +2 -0
- package/dist/components/input/MonthPicker.js +5 -0
- package/dist/components/input/MonthPicker.tsx +5 -0
- package/dist/components/input/ScriptCode.d.ts +8 -0
- package/dist/components/input/ScriptCode.js +153 -0
- package/dist/components/input/ScriptCode.tsx +195 -0
- package/dist/components/input/Select.d.ts +14 -0
- package/dist/components/input/Select.js +40 -0
- package/dist/components/input/Select.tsx +78 -0
- package/dist/components/input/SqlCode.d.ts +8 -0
- package/dist/components/input/SqlCode.js +121 -0
- package/dist/components/input/SqlCode.tsx +162 -0
- package/dist/components/input/StringDecision.d.ts +2 -0
- package/dist/components/input/StringDecision.js +34 -0
- package/dist/components/input/StringDecision.tsx +64 -0
- package/dist/components/input/Text.d.ts +7 -0
- package/dist/components/input/Text.js +39 -0
- package/dist/components/input/Text.tsx +57 -0
- package/dist/components/input/YearPicker.d.ts +8 -0
- package/dist/components/input/YearPicker.js +44 -0
- package/dist/components/input/YearPicker.tsx +81 -0
- package/dist/components/list/IconMenu.d.ts +14 -0
- package/dist/components/list/IconMenu.js +72 -0
- package/dist/components/list/IconMenu.tsx +115 -0
- package/dist/components/list/TabMenu.d.ts +10 -0
- package/dist/components/list/TabMenu.js +72 -0
- package/dist/components/list/TabMenu.tsx +127 -0
- package/dist/components/list/TreeMenu.d.ts +14 -0
- package/dist/components/list/TreeMenu.js +207 -0
- package/dist/components/list/TreeMenu.tsx +279 -0
- package/dist/components/list/TxnTaskList.d.ts +2 -0
- package/dist/components/list/TxnTaskList.js +77 -0
- package/dist/components/list/TxnTaskList.tsx +198 -0
- package/dist/components/output/Label.d.ts +8 -0
- package/dist/components/output/Label.js +33 -0
- package/dist/components/output/Label.tsx +51 -0
- package/dist/components/table/DataList.d.ts +88 -0
- package/dist/components/table/DataList.js +361 -0
- package/dist/components/table/DataList.tsx +782 -0
- package/dist/components/table/DataTable.d.ts +46 -0
- package/dist/components/table/DataTable.js +253 -0
- package/dist/components/table/DataTable.tsx +572 -0
- package/dist/components/table/ListHandler.d.ts +42 -0
- package/dist/components/table/ListHandler.js +197 -0
- package/dist/components/table/ListHandler.ts +276 -0
- package/dist/components/table/TableContext.d.ts +33 -0
- package/dist/components/table/TableContext.js +57 -0
- package/dist/components/table/TableContext.tsx +122 -0
- package/dist/components/view/ComponentView.d.ts +8 -0
- package/dist/components/view/ComponentView.js +78 -0
- package/dist/components/view/ComponentView.tsx +102 -0
- package/dist/components/view/FilterView.d.ts +2 -0
- package/dist/components/view/FilterView.js +14 -0
- package/dist/components/view/FilterView.tsx +21 -0
- package/dist/components/view/HtmlForm.d.ts +7 -0
- package/dist/components/view/HtmlForm.js +145 -0
- package/dist/components/view/HtmlForm.tsx +186 -0
- package/dist/components/view/HtmlView.d.ts +9 -0
- package/dist/components/view/HtmlView.js +85 -0
- package/dist/components/view/HtmlView.tsx +114 -0
- package/dist/components/view/IFrameView.d.ts +2 -0
- package/dist/components/view/IFrameView.js +34 -0
- package/dist/components/view/IFrameView.tsx +48 -0
- package/dist/components/view/Modal.d.ts +14 -0
- package/dist/components/view/Modal.js +28 -0
- package/dist/components/view/Modal.tsx +72 -0
- package/dist/components/view/PageView.d.ts +9 -0
- package/dist/components/view/PageView.js +90 -0
- package/dist/components/view/PageView.tsx +131 -0
- package/dist/components/view/PopupView.d.ts +9 -0
- package/dist/components/view/PopupView.js +91 -0
- package/dist/components/view/PopupView.tsx +160 -0
- package/dist/components/view/RootView.d.ts +8 -0
- package/dist/components/view/RootView.js +75 -0
- package/dist/components/view/RootView.tsx +109 -0
- package/dist/components/view/WizardView.d.ts +6 -0
- package/dist/components/view/WizardView.js +34 -0
- package/dist/components/view/WizardView.tsx +48 -0
- package/dist/core/AppContext.d.ts +25 -0
- package/dist/core/AppContext.js +159 -0
- package/dist/core/AuthContext.d.ts +13 -0
- package/dist/core/AuthContext.js +80 -0
- package/dist/core/ComponentCache.d.ts +15 -0
- package/dist/core/ComponentCache.js +25 -0
- package/dist/core/DataContext.d.ts +20 -0
- package/dist/core/DataContext.js +41 -0
- package/dist/core/DynamicComponent.d.ts +12 -0
- package/dist/core/DynamicComponent.js +30 -0
- package/dist/core/DynamicIcon.d.ts +6 -0
- package/dist/core/DynamicIcon.js +48 -0
- package/dist/core/DynamicTemplate.d.ts +4 -0
- package/dist/core/DynamicTemplate.js +17 -0
- package/dist/core/ErrorMessage.d.ts +5 -0
- package/dist/core/ErrorMessage.js +7 -0
- package/dist/core/EventHandler.d.ts +3 -0
- package/dist/core/EventHandler.js +1 -0
- package/dist/core/HtmlCache.d.ts +6 -0
- package/dist/core/HtmlCache.js +17 -0
- package/dist/core/Page.d.ts +6 -0
- package/dist/core/Page.js +141 -0
- package/dist/core/PageCache.d.ts +15 -0
- package/dist/core/PageCache.js +26 -0
- package/dist/core/PageContext.d.ts +49 -0
- package/dist/core/PageContext.js +207 -0
- package/dist/core/PageRegistry.d.ts +7 -0
- package/dist/core/PageRegistry.js +11 -0
- package/dist/core/PageViewContext.d.ts +45 -0
- package/dist/core/PageViewContext.js +277 -0
- package/dist/core/Panel.d.ts +16 -0
- package/dist/core/Panel.js +39 -0
- package/dist/core/RowContext.d.ts +11 -0
- package/dist/core/RowContext.js +16 -0
- package/dist/core/StepHandler.d.ts +9 -0
- package/dist/core/StepHandler.js +39 -0
- package/dist/core/UIDependHandler.d.ts +6 -0
- package/dist/core/UIDependHandler.js +31 -0
- package/dist/core/auth/index.d.ts +18 -0
- package/dist/core/auth/index.js +187 -0
- package/dist/core/auth/session.d.ts +4 -0
- package/dist/core/auth/session.js +45 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.js +1 -0
- package/dist/core/page-helper.d.ts +27 -0
- package/dist/core/page-helper.js +47 -0
- package/dist/hooks/useUrlParams.d.ts +11 -0
- package/dist/hooks/useUrlParams.js +164 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.js +69 -0
- package/dist/layouts/BorderLayout.d.ts +14 -0
- package/dist/layouts/BorderLayout.js +8 -0
- package/dist/layouts/CardLayout.d.ts +27 -0
- package/dist/layouts/CardLayout.js +36 -0
- package/dist/layouts/CenterLayout.d.ts +8 -0
- package/dist/layouts/CenterLayout.js +6 -0
- package/dist/layouts/GridLayout.d.ts +9 -0
- package/dist/layouts/GridLayout.js +5 -0
- package/dist/layouts/HPanel.d.ts +11 -0
- package/dist/layouts/HPanel.js +8 -0
- package/dist/layouts/HorizontalLayout.d.ts +11 -0
- package/dist/layouts/HorizontalLayout.js +6 -0
- package/dist/layouts/MainLayout.d.ts +6 -0
- package/dist/layouts/MainLayout.js +5 -0
- package/dist/layouts/PageLayout.d.ts +11 -0
- package/dist/layouts/PageLayout.js +6 -0
- package/dist/layouts/VPanel.d.ts +9 -0
- package/dist/layouts/VPanel.js +7 -0
- package/dist/layouts/XLayout.d.ts +10 -0
- package/dist/layouts/XLayout.js +10 -0
- package/dist/layouts/YLayout.d.ts +10 -0
- package/dist/layouts/YLayout.js +10 -0
- package/dist/lib/PlatformRoute.d.ts +5 -0
- package/dist/lib/PlatformRoute.js +288 -0
- package/dist/lib/WebPlatform.d.ts +13 -0
- package/dist/lib/WebPlatform.js +124 -0
- package/dist/lib/components/ActivityBar.d.ts +13 -0
- package/dist/lib/components/ActivityBar.js +39 -0
- package/dist/lib/components/CopyButton.d.ts +8 -0
- package/dist/lib/components/CopyButton.js +50 -0
- package/dist/lib/components/Header.d.ts +2 -0
- package/dist/lib/components/Header.js +74 -0
- package/dist/lib/components/QuickActionMenu.d.ts +18 -0
- package/dist/lib/components/QuickActionMenu.js +50 -0
- package/dist/lib/components/UserButton.d.ts +11 -0
- package/dist/lib/components/UserButton.js +66 -0
- package/dist/lib/layouts/BorderLayout.tsx +31 -0
- package/dist/lib/layouts/CardLayout.tsx +73 -0
- package/dist/lib/layouts/CenterLayout.tsx +20 -0
- package/dist/lib/layouts/GridLayout.tsx +20 -0
- package/dist/lib/layouts/HPanel.tsx +31 -0
- package/dist/lib/layouts/HorizontalLayout.tsx +29 -0
- package/dist/lib/layouts/MainLayout.tsx +16 -0
- package/dist/lib/layouts/PageLayout.tsx +29 -0
- package/dist/lib/layouts/VPanel.tsx +27 -0
- package/dist/lib/layouts/XLayout.tsx +29 -0
- package/dist/lib/layouts/YLayout.tsx +29 -0
- package/dist/lib/utils/BeanUtils.d.ts +3 -0
- package/dist/lib/utils/BeanUtils.js +75 -0
- package/dist/lib/utils/ComponentLoader.d.ts +13 -0
- package/dist/lib/utils/ComponentLoader.js +26 -0
- package/dist/lib/utils/ExprUtil.d.ts +7 -0
- package/dist/lib/utils/ExprUtil.js +44 -0
- package/dist/lib/utils/PageUtils.d.ts +6 -0
- package/dist/lib/utils/PageUtils.js +121 -0
- package/dist/lib/utils/ResourceLoader.d.ts +11 -0
- package/dist/lib/utils/ResourceLoader.js +37 -0
- package/dist/lib/utils/SectionProvider.d.ts +5 -0
- package/dist/lib/utils/SectionProvider.js +39 -0
- package/dist/lib/utils/initResourceLoader.d.ts +0 -0
- package/dist/lib/utils/initResourceLoader.js +95 -0
- package/dist/styles/index.css +38 -0
- package/dist/templates/BasicTemplate.d.ts +2 -0
- package/dist/templates/BasicTemplate.js +14 -0
- package/dist/templates/CrudFormTemplate.d.ts +2 -0
- package/dist/templates/CrudFormTemplate.js +38 -0
- package/dist/templates/DataListTemplate.d.ts +2 -0
- package/dist/templates/DataListTemplate.js +13 -0
- package/dist/templates/ExplorerTemplate.d.ts +10 -0
- package/dist/templates/ExplorerTemplate.js +17 -0
- package/dist/templates/TxnFormTemplate.d.ts +2 -0
- package/dist/templates/TxnFormTemplate.js +66 -0
- package/dist/templates/WizardTemplate.d.ts +9 -0
- package/dist/templates/WizardTemplate.js +37 -0
- package/dist/templates/index.d.ts +5 -0
- package/dist/templates/index.js +5 -0
- package/dist/types/action.d.ts +8 -0
- package/dist/types/action.js +1 -0
- package/dist/types/component.d.ts +18 -0
- package/dist/types/component.js +1 -0
- package/dist/types/list.d.ts +14 -0
- package/dist/types/list.js +1 -0
- package/dist/types/template.d.ts +6 -0
- package/dist/types/template.js +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// lib/context/AuthContext.tsx
|
|
3
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
4
|
+
import * as auth from "../core/auth";
|
|
5
|
+
import { useApp } from "./AppContext";
|
|
6
|
+
export const useAuth = () => {
|
|
7
|
+
const ctx = useContext(AuthContext);
|
|
8
|
+
if (!ctx)
|
|
9
|
+
throw new Error("useAuth must be used within AuthProvider");
|
|
10
|
+
return ctx;
|
|
11
|
+
};
|
|
12
|
+
const AuthContext = createContext(undefined);
|
|
13
|
+
export const AuthProvider = ({ children }) => {
|
|
14
|
+
const app = useApp();
|
|
15
|
+
const [sessionId, setSessionId] = useState(null);
|
|
16
|
+
const [activityId, setActivityId] = useState(null);
|
|
17
|
+
const getSessionId = async () => {
|
|
18
|
+
if (sessionId)
|
|
19
|
+
return sessionId;
|
|
20
|
+
// Only run on client side to prevent SSR issues
|
|
21
|
+
if (typeof window === "undefined")
|
|
22
|
+
return null;
|
|
23
|
+
try {
|
|
24
|
+
const sess_id = await auth.fetchSessionId();
|
|
25
|
+
// console.log({ sess_id});
|
|
26
|
+
setSessionId(sess_id);
|
|
27
|
+
return sess_id;
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
console.error("getSessionId failed:", err);
|
|
31
|
+
setSessionId(null);
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
// Only run on client side to prevent SSR issues
|
|
37
|
+
if (typeof window !== "undefined") {
|
|
38
|
+
getSessionId();
|
|
39
|
+
}
|
|
40
|
+
}, []);
|
|
41
|
+
const signIn = async (username, password) => {
|
|
42
|
+
var _a;
|
|
43
|
+
const data = await auth.signIn(username, password, app.tenant);
|
|
44
|
+
const { SESSIONID, USERID, USER: USERNAME, FULLNAME } = (_a = data === null || data === void 0 ? void 0 : data.SESSION) !== null && _a !== void 0 ? _a : {};
|
|
45
|
+
if (!SESSIONID)
|
|
46
|
+
throw new Error("failed to get SESSIONID upon signIn");
|
|
47
|
+
if (!USERID)
|
|
48
|
+
throw new Error("failed to get USERID upon signIn");
|
|
49
|
+
if (!USERNAME)
|
|
50
|
+
throw new Error("failed to get USERNAME upon signIn");
|
|
51
|
+
if (!FULLNAME)
|
|
52
|
+
throw new Error("failed to get FULLNAME upon signIn");
|
|
53
|
+
const token = await auth.createSessionToken({ SESSIONID, USERID, USERNAME, FULLNAME });
|
|
54
|
+
if (!token)
|
|
55
|
+
throw new Error("failed to create session token");
|
|
56
|
+
setSessionId(token);
|
|
57
|
+
return token;
|
|
58
|
+
};
|
|
59
|
+
const signOut = async () => {
|
|
60
|
+
try {
|
|
61
|
+
const session_id = await getSessionId();
|
|
62
|
+
if (session_id) {
|
|
63
|
+
await auth.signOut(app.tenant);
|
|
64
|
+
}
|
|
65
|
+
setSessionId(null);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error("signOut failed:", error);
|
|
69
|
+
setSessionId(null);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const value_params = {
|
|
73
|
+
activityId,
|
|
74
|
+
sessionId,
|
|
75
|
+
getSessionId,
|
|
76
|
+
signIn,
|
|
77
|
+
signOut,
|
|
78
|
+
};
|
|
79
|
+
return _jsx(AuthContext.Provider, { value: value_params, children: children });
|
|
80
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface CacheFallback {
|
|
3
|
+
getTenant: string | null;
|
|
4
|
+
getModule: string | null;
|
|
5
|
+
}
|
|
6
|
+
export declare const getComponent: (name: string, fallback: CacheFallback) => Promise<{
|
|
7
|
+
template: import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
pageInfo: null;
|
|
9
|
+
info?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
template: React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
12
|
+
info: any;
|
|
13
|
+
pageInfo?: undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { localAPI } from "@ramesesinc/lib/local-api";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { DynamicTemplate } from "./DynamicTemplate";
|
|
6
|
+
// Simple in-memory cache
|
|
7
|
+
const cache = {};
|
|
8
|
+
export const getComponent = async (name, fallback) => {
|
|
9
|
+
if (!cache[name]) {
|
|
10
|
+
const { getTenant: tenant, getModule: module } = fallback;
|
|
11
|
+
const info = await localAPI.useMgmt(tenant, module).get("components", name);
|
|
12
|
+
if (!info) {
|
|
13
|
+
return { template: _jsxs("div", { className: "text-red-500 p-2 border border-red-500", children: ["Component \"", name, "\" not found."] }), pageInfo: null };
|
|
14
|
+
}
|
|
15
|
+
const { template, attr } = info !== null && info !== void 0 ? info : { template: null, attr: {} };
|
|
16
|
+
delete info.template;
|
|
17
|
+
delete info.attr;
|
|
18
|
+
const tmpl = _jsx(DynamicTemplate, { template: template, attr: attr });
|
|
19
|
+
// Store in cache
|
|
20
|
+
cache[name] = { template: tmpl, info };
|
|
21
|
+
}
|
|
22
|
+
const compCache = cache[name];
|
|
23
|
+
const newTemplate = React.cloneElement(compCache.template);
|
|
24
|
+
return { template: newTemplate, info: compCache.info };
|
|
25
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BindingModel } from "@ramesesinc/client";
|
|
2
|
+
type DependCallback = (value?: any) => void;
|
|
3
|
+
export type DataBindingValue = {
|
|
4
|
+
getBinding: () => BindingModel;
|
|
5
|
+
getData: () => Record<string, any>;
|
|
6
|
+
set: (name: string | null, value: any) => void;
|
|
7
|
+
get: (name: string | null) => any;
|
|
8
|
+
dependsTo: (name: string | null, callback: DependCallback) => () => void;
|
|
9
|
+
notifyDepends: (name?: string | null) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const useCreateContextValue: (source: Record<string, any>) => DataBindingValue;
|
|
12
|
+
declare const DataBindingContext: import("react").Context<DataBindingValue | null>;
|
|
13
|
+
export declare const useDataContext: () => DataBindingValue | null;
|
|
14
|
+
type DataBindingProviderProps = {
|
|
15
|
+
data?: Record<string, any>;
|
|
16
|
+
handler?: DataBindingValue;
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export declare const DataBindingProvider: ({ data, handler, children }: DataBindingProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export default DataBindingContext;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useBinding } from "@ramesesinc/client";
|
|
3
|
+
import { createContext, useContext, useMemo } from "react";
|
|
4
|
+
const createDefaultValue = () => ({
|
|
5
|
+
getBinding: () => ({}),
|
|
6
|
+
getData: () => ({}),
|
|
7
|
+
set: () => { },
|
|
8
|
+
get: () => undefined,
|
|
9
|
+
dependsTo: () => () => { },
|
|
10
|
+
notifyDepends: () => { },
|
|
11
|
+
});
|
|
12
|
+
export const useCreateContextValue = (source) => {
|
|
13
|
+
const binding = useBinding(source !== null && source !== void 0 ? source : {});
|
|
14
|
+
return useMemo(() => ({
|
|
15
|
+
getBinding: () => binding,
|
|
16
|
+
getData: () => binding.getData(),
|
|
17
|
+
set: (name, value) => {
|
|
18
|
+
binding.set(name !== null && name !== void 0 ? name : "", value);
|
|
19
|
+
},
|
|
20
|
+
get: (name) => {
|
|
21
|
+
return binding.get(name !== null && name !== void 0 ? name : "");
|
|
22
|
+
},
|
|
23
|
+
dependsTo: (name, callback) => {
|
|
24
|
+
return binding.dependsTo(name, callback);
|
|
25
|
+
},
|
|
26
|
+
notifyDepends: (name) => {
|
|
27
|
+
binding.notifyDepends(name);
|
|
28
|
+
},
|
|
29
|
+
}), [binding, source]);
|
|
30
|
+
};
|
|
31
|
+
const DataBindingContext = createContext(null);
|
|
32
|
+
export const useDataContext = () => {
|
|
33
|
+
const context = useContext(DataBindingContext);
|
|
34
|
+
return context;
|
|
35
|
+
};
|
|
36
|
+
export const DataBindingProvider = ({ data, handler, children }) => {
|
|
37
|
+
const dataWrapper = useCreateContextValue(data !== null && data !== void 0 ? data : {});
|
|
38
|
+
const value = handler !== null && handler !== void 0 ? handler : dataWrapper;
|
|
39
|
+
return _jsx(DataBindingContext.Provider, { value: value, children: children });
|
|
40
|
+
};
|
|
41
|
+
export default DataBindingContext;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface DynamicComponentConfig {
|
|
3
|
+
component: string;
|
|
4
|
+
attr?: Record<string, any>;
|
|
5
|
+
}
|
|
6
|
+
interface DynamicComponentProps {
|
|
7
|
+
config: DynamicComponentConfig;
|
|
8
|
+
fallback?: React.ReactNode;
|
|
9
|
+
onError?: (error: Error) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const DynamicComponent: React.FC<DynamicComponentProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
import { ResourceLoader } from "../lib/utils/ResourceLoader";
|
|
15
|
+
import React from "react";
|
|
16
|
+
export const DynamicComponent = ({ config, fallback = _jsx("div", { style: { color: "red" }, children: "Component not found" }), onError, }) => {
|
|
17
|
+
const { component, attr = {} } = config !== null && config !== void 0 ? config : {};
|
|
18
|
+
const _a = attr !== null && attr !== void 0 ? attr : {}, { key } = _a, restAttr = __rest(_a, ["key"]);
|
|
19
|
+
let Comp;
|
|
20
|
+
try {
|
|
21
|
+
Comp = ResourceLoader.getComponent(component);
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
if (onError)
|
|
25
|
+
onError(err);
|
|
26
|
+
console.error(err);
|
|
27
|
+
return _jsx(_Fragment, { children: fallback });
|
|
28
|
+
}
|
|
29
|
+
return (_jsx(React.Suspense, { fallback: _jsx("div", { children: "Loading component..." }), children: _jsx(Comp, Object.assign({}, restAttr), key) }));
|
|
30
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { CircleDot } from "lucide-react";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
const isBase64 = (str) => str.startsWith("data:image/");
|
|
5
|
+
const isSvg = (str) => str.trimStart().startsWith("<svg");
|
|
6
|
+
const isUrl = (str) => str.startsWith("http://") || str.startsWith("https://") || str.startsWith("/");
|
|
7
|
+
const DynamicIcon = ({ icon, size = 20 }) => {
|
|
8
|
+
const [resolved, setResolved] = useState(_jsx(CircleDot, { size: size }));
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!icon) {
|
|
11
|
+
setResolved(_jsx(CircleDot, { size: size }));
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
// Already a React node
|
|
15
|
+
if (typeof icon !== "string") {
|
|
16
|
+
setResolved(icon);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
// Base64 image
|
|
20
|
+
if (isBase64(icon)) {
|
|
21
|
+
setResolved(_jsx("img", { src: icon, alt: "", className: "object-contain", style: { width: size, height: size } }));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
// Inline SVG string
|
|
25
|
+
if (isSvg(icon)) {
|
|
26
|
+
setResolved(_jsx("div", { style: { width: size, height: size }, className: "flex items-center justify-center", dangerouslySetInnerHTML: { __html: icon } }));
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// Image URL or path
|
|
30
|
+
if (isUrl(icon)) {
|
|
31
|
+
setResolved(_jsx("img", { src: icon, alt: "", className: "object-contain", style: { width: size, height: size } }));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
// Lucide icon name — dynamic import
|
|
35
|
+
import("lucide-react").then((lucide) => {
|
|
36
|
+
const LucideIcon = lucide[icon];
|
|
37
|
+
if (LucideIcon) {
|
|
38
|
+
setResolved(_jsx(LucideIcon, { size: size }));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// Nothing matched — fallback
|
|
42
|
+
setResolved(_jsx(CircleDot, { size: size }));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}, [icon, size]);
|
|
46
|
+
return _jsx(_Fragment, { children: resolved });
|
|
47
|
+
};
|
|
48
|
+
export default DynamicIcon;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { ResourceLoader } from "../lib/utils/ResourceLoader";
|
|
5
|
+
import { SectionProvider } from "../lib/utils/SectionProvider";
|
|
6
|
+
export const DynamicTemplate = ({ template, attr }) => {
|
|
7
|
+
let Tmpl;
|
|
8
|
+
try {
|
|
9
|
+
Tmpl = ResourceLoader.getTemplate(template);
|
|
10
|
+
}
|
|
11
|
+
catch (err) {
|
|
12
|
+
console.error(err);
|
|
13
|
+
return _jsx("div", { children: "Template not found" });
|
|
14
|
+
}
|
|
15
|
+
const sectionProvider = SectionProvider(attr);
|
|
16
|
+
return (_jsx(React.Suspense, { fallback: _jsx("div", { children: "Loading template..." }), children: _jsx(Tmpl, Object.assign({}, attr, { sectionProvider: sectionProvider })) }));
|
|
17
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const ErrorMessage = ({ error }) => {
|
|
3
|
+
if (!error)
|
|
4
|
+
return null;
|
|
5
|
+
return (_jsx("div", { className: "bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-md mb-2 flex items-center justify-between", children: _jsx("span", { className: "ml-2 text-sm", children: error }) }));
|
|
6
|
+
};
|
|
7
|
+
export default ErrorMessage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { localAPI } from "@ramesesinc/lib/local-api";
|
|
3
|
+
// Simple in-memory cache
|
|
4
|
+
const cache = {};
|
|
5
|
+
export const getHtml = async (name, fallback) => {
|
|
6
|
+
if (!cache[name]) {
|
|
7
|
+
const { getTenant: tenant, getModule: module } = fallback;
|
|
8
|
+
const info = await localAPI.useMgmt(tenant, module).get("html_templates", name);
|
|
9
|
+
if (!info) {
|
|
10
|
+
throw new Error(`Component "${name}" not found.`);
|
|
11
|
+
}
|
|
12
|
+
const { htmlCode } = info !== null && info !== void 0 ? info : "no html code";
|
|
13
|
+
// Store in cache
|
|
14
|
+
cache[name] = htmlCode;
|
|
15
|
+
}
|
|
16
|
+
return cache[name];
|
|
17
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
// 1. accepts template and definition
|
|
3
|
+
// 2. init = (params: Record<string, any>) => { // params from url
|
|
4
|
+
// if definition has data call localAPI
|
|
5
|
+
// }
|
|
6
|
+
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { replaceValues } from "../lib/utils/BeanUtils";
|
|
8
|
+
import { getUrlPageParams, parseHashUrl } from "../lib/utils/PageUtils";
|
|
9
|
+
import { useApp } from "./AppContext";
|
|
10
|
+
import { PageProvider } from "./PageContext";
|
|
11
|
+
import { usePageViewContext } from "./PageViewContext";
|
|
12
|
+
const Page = (props) => {
|
|
13
|
+
const { url: finalUrl, fallback = _jsx("div", { children: "Loading page..." }) } = props !== null && props !== void 0 ? props : {};
|
|
14
|
+
const [uuid] = useState(() => Math.random().toString(36).slice(2));
|
|
15
|
+
const [value, setValue] = useState(null);
|
|
16
|
+
const [cache, setCache] = useState({});
|
|
17
|
+
const [template, setTemplate] = useState(null);
|
|
18
|
+
const slotRef = useRef(null); // stable — never changes
|
|
19
|
+
const pageContext = useRef({});
|
|
20
|
+
const mountedRef = useRef(true);
|
|
21
|
+
const { getPageCache } = useApp();
|
|
22
|
+
const pageView = usePageViewContext();
|
|
23
|
+
const originalData = useMemo(() => {
|
|
24
|
+
const result = {
|
|
25
|
+
mainPath: "",
|
|
26
|
+
selectedPath: "",
|
|
27
|
+
};
|
|
28
|
+
if (finalUrl != null && finalUrl !== "") {
|
|
29
|
+
const [mainPath, ...subPaths] = finalUrl.split("#");
|
|
30
|
+
const [selectedPath] = subPaths !== null && subPaths !== void 0 ? subPaths : [];
|
|
31
|
+
result.mainPath = mainPath;
|
|
32
|
+
result.selectedPath = selectedPath;
|
|
33
|
+
}
|
|
34
|
+
setValue(finalUrl !== null && finalUrl !== void 0 ? finalUrl : null);
|
|
35
|
+
return result;
|
|
36
|
+
}, [finalUrl]);
|
|
37
|
+
// useLayoutEffect(() => {
|
|
38
|
+
// setValue(url ?? null);
|
|
39
|
+
// }, [url]);
|
|
40
|
+
useLayoutEffect(() => {
|
|
41
|
+
const loadPageCache = async () => {
|
|
42
|
+
var _a;
|
|
43
|
+
// console.log("Page value changed", uuid, value, originalData);
|
|
44
|
+
const url = value;
|
|
45
|
+
const findPageCache = async (page) => {
|
|
46
|
+
const pageCache = await getPageCache(page);
|
|
47
|
+
const { template, pageInfo, hasSelectionHandling = false } = pageCache !== null && pageCache !== void 0 ? pageCache : {};
|
|
48
|
+
return { template, pageInfo, hasSelectionHandling };
|
|
49
|
+
};
|
|
50
|
+
if (url) {
|
|
51
|
+
const infoCheck = {};
|
|
52
|
+
// Given: main#tasklist
|
|
53
|
+
// First test the main path
|
|
54
|
+
const segments = url.split("#")[0].split("?")[0].split("/");
|
|
55
|
+
infoCheck.page = (_a = segments.at(-1)) !== null && _a !== void 0 ? _a : "";
|
|
56
|
+
const { params } = parseHashUrl(url);
|
|
57
|
+
infoCheck.params = params;
|
|
58
|
+
let pageCache = await findPageCache(infoCheck.page);
|
|
59
|
+
const { hasSelectionHandling } = pageCache !== null && pageCache !== void 0 ? pageCache : {};
|
|
60
|
+
// console.log("page load template 1.1", url, infoCheck, hasSelectionHandling);
|
|
61
|
+
if (hasSelectionHandling !== true) {
|
|
62
|
+
// get the last anchor as page
|
|
63
|
+
const { page } = parseHashUrl(url);
|
|
64
|
+
infoCheck.page = page;
|
|
65
|
+
pageCache = await findPageCache(infoCheck.page);
|
|
66
|
+
}
|
|
67
|
+
const { template, pageInfo } = pageCache !== null && pageCache !== void 0 ? pageCache : {};
|
|
68
|
+
// console.log("page load template 1.2", url, infoCheck);
|
|
69
|
+
const { data } = pageInfo !== null && pageInfo !== void 0 ? pageInfo : {};
|
|
70
|
+
setCache({
|
|
71
|
+
url: url,
|
|
72
|
+
page: pageCache,
|
|
73
|
+
api: data,
|
|
74
|
+
params: infoCheck.params,
|
|
75
|
+
});
|
|
76
|
+
setTemplate(template);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
loadPageCache();
|
|
80
|
+
}, [value]);
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
// console.log("force update", value, cache);
|
|
83
|
+
const loadPage = async () => {
|
|
84
|
+
const result = await fetchData(cache === null || cache === void 0 ? void 0 : cache.api);
|
|
85
|
+
// console.log("fetchData result", uuid, value, result);
|
|
86
|
+
pageContext.current.setData(result !== null && result !== void 0 ? result : {});
|
|
87
|
+
};
|
|
88
|
+
loadPage();
|
|
89
|
+
}, [value, cache]);
|
|
90
|
+
const fetchData = useCallback(async (req) => {
|
|
91
|
+
// console.log("page fetchData", uuid, req);
|
|
92
|
+
let result = null;
|
|
93
|
+
if (req === null || req === void 0 ? void 0 : req.api) {
|
|
94
|
+
// console.log("url", window.location.href);
|
|
95
|
+
let params;
|
|
96
|
+
if (pageView.isStandalone()) {
|
|
97
|
+
const res = parseHashUrl(value !== null && value !== void 0 ? value : "");
|
|
98
|
+
params = res === null || res === void 0 ? void 0 : res.params;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
const res = getUrlPageParams();
|
|
102
|
+
params = res === null || res === void 0 ? void 0 : res.params;
|
|
103
|
+
}
|
|
104
|
+
// console.log({ page, params });
|
|
105
|
+
// const urlParams = pageContext?.getUrlParams();
|
|
106
|
+
// console.log("page fetchData exec service 1.1", req.params, params);
|
|
107
|
+
const resolveParams = replaceValues(req.params, params);
|
|
108
|
+
// console.log("page fetchData exec service 1.2", req.api, resolveParams);
|
|
109
|
+
const resp = await pageContext.current.execService(req.api, resolveParams);
|
|
110
|
+
const { data } = resp !== null && resp !== void 0 ? resp : {};
|
|
111
|
+
result = data !== null && data !== void 0 ? data : resp;
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
// pageContext.current.setData(result ?? {});
|
|
115
|
+
}, [value]);
|
|
116
|
+
// Push dynamic component into the slot — synchronous, no flash
|
|
117
|
+
useLayoutEffect(() => {
|
|
118
|
+
var _a;
|
|
119
|
+
(_a = slotRef.current) === null || _a === void 0 ? void 0 : _a.update(template);
|
|
120
|
+
}, [template]);
|
|
121
|
+
const pageHandle = {
|
|
122
|
+
init: (ref) => {
|
|
123
|
+
pageContext.current = ref;
|
|
124
|
+
},
|
|
125
|
+
getSelectedPath: () => {
|
|
126
|
+
return originalData.selectedPath;
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
return (_jsx(PageProvider, { handle: pageHandle, children: _jsx(ChildrenSlot, { ref: slotRef }) }));
|
|
130
|
+
};
|
|
131
|
+
const ChildrenSlot = memo(forwardRef((_, ref) => {
|
|
132
|
+
const [content, setContent] = useState(null);
|
|
133
|
+
const setContentImpl = (content) => {
|
|
134
|
+
setContent(content);
|
|
135
|
+
};
|
|
136
|
+
useImperativeHandle(ref, () => ({
|
|
137
|
+
update: setContentImpl,
|
|
138
|
+
}), []);
|
|
139
|
+
return _jsx(_Fragment, { children: content == null ? null : content });
|
|
140
|
+
}));
|
|
141
|
+
export default Page;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface CacheFallback {
|
|
3
|
+
getTenant: string | null;
|
|
4
|
+
getModule: string | null;
|
|
5
|
+
}
|
|
6
|
+
export declare const getPage: (name: string, fallback: CacheFallback) => Promise<{
|
|
7
|
+
template: import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
pageInfo: null;
|
|
9
|
+
hasSelectionHandling?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
template: React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
12
|
+
pageInfo: any;
|
|
13
|
+
hasSelectionHandling: any;
|
|
14
|
+
}>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { localAPI } from "@ramesesinc/lib/local-api";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { DynamicTemplate } from "./DynamicTemplate";
|
|
6
|
+
// Simple in-memory cache
|
|
7
|
+
const cache = {};
|
|
8
|
+
export const getPage = async (name, fallback) => {
|
|
9
|
+
const { getTenant: tenant, getModule: module } = fallback;
|
|
10
|
+
const key = `${module}/${name}`; // ✅ unique per module
|
|
11
|
+
if (!cache[key]) {
|
|
12
|
+
const pageInfo = await localAPI.useMgmt(tenant, module).get("pages", name);
|
|
13
|
+
if (!pageInfo) {
|
|
14
|
+
return { template: _jsxs("div", { className: "text-red-500 p-2 border border-red-500", children: ["Page \"", name, "\" not found."] }), pageInfo: null };
|
|
15
|
+
}
|
|
16
|
+
const { template, attr } = pageInfo !== null && pageInfo !== void 0 ? pageInfo : { template: null, attr: {} };
|
|
17
|
+
delete pageInfo.template;
|
|
18
|
+
delete pageInfo.attr;
|
|
19
|
+
const tmpl = _jsx(DynamicTemplate, { template: template, attr: attr });
|
|
20
|
+
const hasSelectionHandling = template === "ExplorerTemplate";
|
|
21
|
+
cache[key] = { template: tmpl, pageInfo, hasSelectionHandling };
|
|
22
|
+
}
|
|
23
|
+
const pageCache = cache[key];
|
|
24
|
+
const newTemplate = React.cloneElement(pageCache.template);
|
|
25
|
+
return { template: newTemplate, pageInfo: pageCache.pageInfo, hasSelectionHandling: pageCache.hasSelectionHandling };
|
|
26
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BindingModel, EntityMode } from "@ramesesinc/client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export type DataApiHandler = {
|
|
4
|
+
exec: (params: Record<string, any>) => Promise<any>;
|
|
5
|
+
getParams: () => Record<string, any>;
|
|
6
|
+
};
|
|
7
|
+
export type Callback = (value: any) => void;
|
|
8
|
+
export type PageContextValue = {
|
|
9
|
+
parentContext: unknown;
|
|
10
|
+
/** page data (form / record / model) */
|
|
11
|
+
getData: () => Record<string, any>;
|
|
12
|
+
setData: (value: Record<string, any>, mode?: EntityMode) => void;
|
|
13
|
+
/** reactive dependency registration */
|
|
14
|
+
dependsTo: (name: string, callback: Callback) => () => void;
|
|
15
|
+
notifyDepends: (name?: string | null) => void;
|
|
16
|
+
/** set arbitrary page prop (internal only) */
|
|
17
|
+
set: (name: string, value: any) => void;
|
|
18
|
+
get: (name: string) => any;
|
|
19
|
+
binding: BindingModel;
|
|
20
|
+
uuid: string;
|
|
21
|
+
stack: PageContextValue[];
|
|
22
|
+
getDataApiHandler: () => DataApiHandler | null;
|
|
23
|
+
setDataApiHandler: (handler: DataApiHandler) => void;
|
|
24
|
+
buildParams: (inputParams: Record<string, any>, queryParams: Record<string, any>) => Record<string, any>;
|
|
25
|
+
execService: (path: string, params: Record<string, any>) => Promise<any>;
|
|
26
|
+
getAllData: () => Record<string, any>;
|
|
27
|
+
getMgmt: (collection: string, action: string) => Promise<any>;
|
|
28
|
+
postMgmt: (collection: string, action: string, params: Record<string, any>) => Promise<any>;
|
|
29
|
+
setPageParams: (params: Record<string, any>) => void;
|
|
30
|
+
getPageParams: () => Record<string, any>;
|
|
31
|
+
getPath: () => string;
|
|
32
|
+
getUrlParams: () => Record<string, any>;
|
|
33
|
+
};
|
|
34
|
+
export type PageHandle = {
|
|
35
|
+
init: (ref: PageContextValue) => void;
|
|
36
|
+
getSelectedPath: () => string | null;
|
|
37
|
+
};
|
|
38
|
+
export type PageProviderRef = {
|
|
39
|
+
set: (name: string, value: any) => void;
|
|
40
|
+
get: (name: string) => any;
|
|
41
|
+
};
|
|
42
|
+
export type RefreshHandler = () => void;
|
|
43
|
+
type PageProviderProps = {
|
|
44
|
+
children: React.ReactNode;
|
|
45
|
+
handle?: PageHandle;
|
|
46
|
+
};
|
|
47
|
+
export declare const PageProvider: React.FC<PageProviderProps>;
|
|
48
|
+
export declare const usePageContext: () => PageContextValue;
|
|
49
|
+
export {};
|