@ramesesinc/platform-core 0.1.5 → 0.1.8
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/LookupPage.js +9 -31
- package/dist/components/action/ViewPage.d.ts +2 -0
- package/dist/components/action/ViewPage.js +25 -31
- package/dist/components/common/UIComponent.js +4 -3
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/table/DataList.js +2 -2
- package/dist/components/view/PopupView.d.ts +13 -0
- package/dist/components/view/PopupView.js +25 -20
- package/dist/core/DataContext.d.ts +7 -4
- package/dist/core/DataContext.js +16 -4
- package/dist/core/Page.js +25 -26
- package/dist/core/PageCache.js +16 -3
- package/dist/core/PageContext.js +90 -18
- package/dist/core/PageViewContext.d.ts +13 -1
- package/dist/core/PageViewContext.js +89 -5
- package/dist/core/PopupContext.d.ts +49 -0
- package/dist/core/PopupContext.js +380 -0
- package/dist/core/RowContext.js +1 -1
- package/dist/core/WindowContext.d.ts +15 -0
- package/dist/core/WindowContext.js +28 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/index.css +25 -7
- package/dist/lib/utils/BeanUtils.js +7 -7
- package/dist/templates/DataListTemplate.js +7 -2
- package/dist/templates/ExplorerTemplate.js +1 -1
- package/package.json +5 -5
- package/dist/components/action/AlertMessage.tsx +0 -38
- package/dist/components/action/Button.tsx +0 -230
- package/dist/components/action/CancelEdit.tsx +0 -40
- package/dist/components/action/DeleteData.tsx +0 -73
- package/dist/components/action/Edit.tsx +0 -40
- package/dist/components/action/LookupPage.tsx +0 -113
- package/dist/components/action/ProcessRunner.tsx +0 -337
- package/dist/components/action/Refresh.tsx +0 -35
- package/dist/components/action/SaveData.tsx +0 -74
- package/dist/components/action/SelectData.tsx +0 -47
- package/dist/components/action/Undo.tsx +0 -50
- package/dist/components/action/UpdateContext.tsx +0 -40
- package/dist/components/action/UpdateData.tsx +0 -49
- package/dist/components/action/ViewBackPage.tsx +0 -46
- package/dist/components/action/ViewPage.tsx +0 -141
- package/dist/components/common/UIComponent.tsx +0 -86
- package/dist/components/common/UIInput.tsx +0 -49
- package/dist/components/common/UIMenu.tsx +0 -91
- package/dist/components/index.ts +0 -51
- package/dist/components/input/CodeEditor.tsx +0 -188
- package/dist/components/input/DateField.tsx +0 -274
- package/dist/components/input/DayPicker.tsx +0 -5
- package/dist/components/input/HtmlCode.tsx +0 -203
- package/dist/components/input/JsonCode.tsx +0 -205
- package/dist/components/input/MonthPicker.tsx +0 -5
- package/dist/components/input/ScriptCode.tsx +0 -195
- package/dist/components/input/Select.tsx +0 -78
- package/dist/components/input/SqlCode.tsx +0 -162
- package/dist/components/input/StringDecision.tsx +0 -64
- package/dist/components/input/Text.tsx +0 -57
- package/dist/components/input/YearPicker.tsx +0 -81
- package/dist/components/list/IconMenu.tsx +0 -115
- package/dist/components/list/TabMenu.tsx +0 -127
- package/dist/components/list/TreeMenu.tsx +0 -279
- package/dist/components/list/TxnTaskList.tsx +0 -198
- package/dist/components/output/Label.tsx +0 -50
- package/dist/components/table/DataList.tsx +0 -820
- package/dist/components/table/DataTable.tsx +0 -572
- package/dist/components/table/ListHandler.ts +0 -276
- package/dist/components/table/TableContext.tsx +0 -122
- package/dist/components/view/ComponentView.tsx +0 -102
- package/dist/components/view/FilterView.tsx +0 -21
- package/dist/components/view/HtmlForm.tsx +0 -176
- package/dist/components/view/HtmlView.tsx +0 -98
- package/dist/components/view/IFrameView.tsx +0 -48
- package/dist/components/view/Modal.tsx +0 -72
- package/dist/components/view/PageView.tsx +0 -131
- package/dist/components/view/PopupView.tsx +0 -160
- package/dist/components/view/RootView.tsx +0 -109
- package/dist/components/view/WizardView.tsx +0 -48
- package/dist/lib/layouts/BorderLayout.tsx +0 -31
- package/dist/lib/layouts/CardLayout.tsx +0 -73
- package/dist/lib/layouts/CenterLayout.tsx +0 -20
- package/dist/lib/layouts/GridLayout.tsx +0 -20
- package/dist/lib/layouts/HPanel.tsx +0 -31
- package/dist/lib/layouts/HorizontalLayout.tsx +0 -29
- package/dist/lib/layouts/MainLayout.tsx +0 -16
- package/dist/lib/layouts/PageLayout.tsx +0 -29
- package/dist/lib/layouts/VPanel.tsx +0 -27
- package/dist/lib/layouts/XLayout.tsx +0 -29
- package/dist/lib/layouts/YLayout.tsx +0 -29
- package/dist/lib/layouts/index.ts +0 -13
- /package/dist/components/action/{UpdateContext.d.ts → UpdateState.d.ts} +0 -0
- /package/dist/components/action/{UpdateContext.js → UpdateState.js} +0 -0
package/dist/core/PageContext.js
CHANGED
|
@@ -40,17 +40,29 @@ export const PageProvider = ({ handle, children }) => {
|
|
|
40
40
|
const binding = useBinding();
|
|
41
41
|
// setup the selectedPath from the handle
|
|
42
42
|
useMemo(() => {
|
|
43
|
+
// useLayoutEffect(() => {
|
|
43
44
|
const path = handle === null || handle === void 0 ? void 0 : handle.getSelectedPath();
|
|
44
|
-
binding.set
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
if (binding && typeof binding.set === "function") {
|
|
46
|
+
binding.set("selectedPage", path);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
console.warn("binding.set is not available, skipping selectedPage setup");
|
|
50
|
+
}
|
|
51
|
+
// return path;
|
|
52
|
+
}, [handle, binding]);
|
|
47
53
|
// for DEV purposes only
|
|
48
54
|
useMemo(() => {
|
|
55
|
+
// useLayoutEffect(() => {
|
|
49
56
|
const dependHandler = () => {
|
|
50
57
|
// console.log("selectedPage changed => ", binding.get("selectedPage"));
|
|
51
58
|
};
|
|
52
|
-
binding.dependsTo
|
|
53
|
-
|
|
59
|
+
if (binding && typeof binding.dependsTo === "function") {
|
|
60
|
+
binding.dependsTo("selectedPage", dependHandler);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
console.warn("binding.dependsTo is not available, skipping dependency setup");
|
|
64
|
+
}
|
|
65
|
+
}, [binding]);
|
|
54
66
|
const dataApiHandler = useRef(null);
|
|
55
67
|
const { tenant, module } = useApp();
|
|
56
68
|
const providerRef = {
|
|
@@ -90,14 +102,31 @@ export const PageProvider = ({ handle, children }) => {
|
|
|
90
102
|
};
|
|
91
103
|
/* ------------------ Data ------------------ */
|
|
92
104
|
const getData = () => {
|
|
93
|
-
|
|
105
|
+
if (binding && typeof binding.getData === "function") {
|
|
106
|
+
return binding.getData();
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
console.warn("binding.getData is not available, returning {}");
|
|
110
|
+
return {};
|
|
111
|
+
}
|
|
94
112
|
};
|
|
95
113
|
const setData = (value, mode) => {
|
|
96
|
-
binding
|
|
114
|
+
if (binding && typeof binding.setData === "function") {
|
|
115
|
+
binding.setData(value, mode !== null && mode !== void 0 ? mode : "read");
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
console.warn("binding.setData is not available, skipping data set");
|
|
119
|
+
}
|
|
97
120
|
};
|
|
98
121
|
/* ------------------ Reactive deps ------------------ */
|
|
99
122
|
const dependsTo = (name, callback) => {
|
|
100
|
-
|
|
123
|
+
if (binding && typeof binding.dependsTo === "function") {
|
|
124
|
+
return binding.dependsTo(name, callback);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
console.warn("binding.dependsTo is not available, returning no-op function");
|
|
128
|
+
return () => { };
|
|
129
|
+
}
|
|
101
130
|
};
|
|
102
131
|
const notifyDepends = (name) => {
|
|
103
132
|
binding.notifyDepends(name);
|
|
@@ -110,19 +139,50 @@ export const PageProvider = ({ handle, children }) => {
|
|
|
110
139
|
/* ------------------ Internal props setter ------------------ */
|
|
111
140
|
const set = (name, value) => {
|
|
112
141
|
if (name === "data") {
|
|
113
|
-
binding.setData
|
|
142
|
+
if (binding && typeof binding.setData === "function") {
|
|
143
|
+
binding.setData(value);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
console.warn("binding.setData is not available, skipping data set");
|
|
147
|
+
}
|
|
114
148
|
}
|
|
115
149
|
else {
|
|
116
|
-
binding.set
|
|
150
|
+
if (binding && typeof binding.set === "function") {
|
|
151
|
+
binding.set(name, value);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
console.warn("binding.set is not available, skipping set:", name, value);
|
|
155
|
+
}
|
|
117
156
|
}
|
|
118
157
|
};
|
|
119
158
|
const get = (name) => {
|
|
120
159
|
if (name === "data") {
|
|
121
|
-
|
|
160
|
+
if (binding && typeof binding.getData === "function") {
|
|
161
|
+
return binding.getData();
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
console.warn("binding.getData is not available, returning {}");
|
|
165
|
+
return {};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (name === "pageView" || String(name).startsWith("pageView.")) {
|
|
169
|
+
if (name === "pageView") {
|
|
170
|
+
return pageView.getInfo();
|
|
171
|
+
}
|
|
172
|
+
if (binding && typeof binding.getByPath === "function") {
|
|
173
|
+
return binding.getByPath({ pageView: pageView.getInfo() }, name);
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
if (binding && typeof binding.get === "function") {
|
|
178
|
+
const val = binding.get(name);
|
|
179
|
+
// console.log("page context get", name, val, binding.getData());
|
|
180
|
+
return val;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
console.warn("binding.get is not available, returning undefined for:", name);
|
|
184
|
+
return undefined;
|
|
122
185
|
}
|
|
123
|
-
const val = binding.get(name);
|
|
124
|
-
// console.log("page context get", name, val, binding.getData());
|
|
125
|
-
return val;
|
|
126
186
|
};
|
|
127
187
|
const buildParams = (inputParams, queryParams) => {
|
|
128
188
|
return inputParams;
|
|
@@ -144,10 +204,21 @@ export const PageProvider = ({ handle, children }) => {
|
|
|
144
204
|
return result;
|
|
145
205
|
};
|
|
146
206
|
const setPageParams = (params) => {
|
|
147
|
-
binding.set
|
|
207
|
+
if (binding && typeof binding.set === "function") {
|
|
208
|
+
binding.set("pageParams", params);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
console.warn("binding.set is not available, skipping pageParams set");
|
|
212
|
+
}
|
|
148
213
|
};
|
|
149
214
|
const getPageParams = () => {
|
|
150
|
-
|
|
215
|
+
if (binding && typeof binding.get === "function") {
|
|
216
|
+
return binding.get("pageParams");
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
console.warn("binding.get is not available, returning {} for pageParams");
|
|
220
|
+
return {};
|
|
221
|
+
}
|
|
151
222
|
};
|
|
152
223
|
/* ------------------ Context value ------------------ */
|
|
153
224
|
const values = {
|
|
@@ -170,7 +241,8 @@ export const PageProvider = ({ handle, children }) => {
|
|
|
170
241
|
getMgmt,
|
|
171
242
|
postMgmt,
|
|
172
243
|
getAllData: () => {
|
|
173
|
-
|
|
244
|
+
var _a;
|
|
245
|
+
const allData = Object.assign(Object.assign({}, (binding && typeof binding.getUiData === "function" ? binding.getUiData() : {})), { data: binding && typeof binding.getData === "function" ? binding.getData() : {}, pageParams: (_a = getPageParams()) !== null && _a !== void 0 ? _a : {} });
|
|
174
246
|
return allData;
|
|
175
247
|
},
|
|
176
248
|
setPageParams,
|
|
@@ -192,7 +264,7 @@ export const PageProvider = ({ handle, children }) => {
|
|
|
192
264
|
};
|
|
193
265
|
}, []);
|
|
194
266
|
const contextValue = values;
|
|
195
|
-
const dataBindingValue = Object.assign(Object.assign({}, contextValue), { getBinding: () => binding });
|
|
267
|
+
const dataBindingValue = Object.assign(Object.assign({}, contextValue), { getBinding: () => binding, getType: () => "page" });
|
|
196
268
|
useLayoutEffect(() => {
|
|
197
269
|
if (handle == null)
|
|
198
270
|
return;
|
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { EventHandler } from ".";
|
|
2
|
+
import { ChangeEventHandler, EventHandler, VoidCallback } from ".";
|
|
3
3
|
export type PageOptions = {
|
|
4
4
|
mode?: "window" | "popup";
|
|
5
5
|
[key: string]: any;
|
|
6
6
|
};
|
|
7
|
+
export type PageViewUI = {
|
|
8
|
+
onChange: (handler: ChangeEventHandler) => VoidCallback;
|
|
9
|
+
notifyChange: (name: string | null, value: any) => void;
|
|
10
|
+
set: (name: string, value: any, autoPublish?: boolean) => void;
|
|
11
|
+
get: (name: string | null) => any;
|
|
12
|
+
getTitle: () => string | null;
|
|
13
|
+
setTitle: (value: string | null) => void;
|
|
14
|
+
};
|
|
7
15
|
export type PageViewContextValue = {
|
|
8
16
|
uuid: string;
|
|
9
17
|
parentContext: PageViewContextValue | null;
|
|
10
18
|
stack: PageViewContextValue[];
|
|
11
19
|
paths: string[];
|
|
20
|
+
getInfo: () => Record<string, any>;
|
|
21
|
+
getUI: () => PageViewUI;
|
|
22
|
+
getTitle: () => string | null;
|
|
23
|
+
setTitle: (title: string | null) => void;
|
|
12
24
|
setPage: (page: string | null, options?: PageOptions) => void;
|
|
13
25
|
setSelectedPage: (page: string | null) => void;
|
|
14
26
|
getSelectedPage: () => string | null;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
|
-
import { useApp } from "./AppContext";
|
|
5
4
|
/* ------------------ Global Stack ------------------ */
|
|
6
5
|
const contextStack = [];
|
|
7
6
|
/* ------------------ Context ------------------ */
|
|
@@ -10,6 +9,10 @@ const PageViewContext = createContext({
|
|
|
10
9
|
parentContext: null,
|
|
11
10
|
stack: [],
|
|
12
11
|
paths: [],
|
|
12
|
+
getInfo: () => ({}),
|
|
13
|
+
getUI: () => ({}),
|
|
14
|
+
getTitle: () => null,
|
|
15
|
+
setTitle: () => { },
|
|
13
16
|
setPage: () => { },
|
|
14
17
|
getSelectedPage: () => null,
|
|
15
18
|
pushPage: () => { },
|
|
@@ -22,10 +25,59 @@ const PageViewContext = createContext({
|
|
|
22
25
|
getOriginalLocationInfo: () => null,
|
|
23
26
|
getEventHandler: () => null,
|
|
24
27
|
});
|
|
28
|
+
const usePageViewUI = () => {
|
|
29
|
+
const propsRef = useRef({});
|
|
30
|
+
const changeHandlersRef = useRef([]);
|
|
31
|
+
const onChange = (handler) => {
|
|
32
|
+
if (handler != null && changeHandlersRef.current.indexOf(handler) < 0) {
|
|
33
|
+
changeHandlersRef.current.push(handler);
|
|
34
|
+
}
|
|
35
|
+
return () => {
|
|
36
|
+
if (handler == null)
|
|
37
|
+
return;
|
|
38
|
+
const list = changeHandlersRef.current;
|
|
39
|
+
const index = list.indexOf(handler);
|
|
40
|
+
if (index >= 0)
|
|
41
|
+
list.splice(index, 1);
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const notifyChange = (name, value) => {
|
|
45
|
+
const e = { name, value };
|
|
46
|
+
const list = [...changeHandlersRef.current];
|
|
47
|
+
list.forEach((handler) => {
|
|
48
|
+
try {
|
|
49
|
+
handler(e);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
// do nothing: let the handler handle its own error
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const set = (name, value, autoPublish) => {
|
|
57
|
+
if (name == null)
|
|
58
|
+
return;
|
|
59
|
+
propsRef.current[name] = value;
|
|
60
|
+
if (String(autoPublish) === 'true') {
|
|
61
|
+
notifyChange(name, value);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const get = (name) => {
|
|
65
|
+
var _a;
|
|
66
|
+
const value = name == null ? null : (_a = propsRef.current[name]) !== null && _a !== void 0 ? _a : null;
|
|
67
|
+
return value;
|
|
68
|
+
};
|
|
69
|
+
const getTitle = () => {
|
|
70
|
+
return get("title");
|
|
71
|
+
};
|
|
72
|
+
const setTitle = (value) => {
|
|
73
|
+
set("title", value, false);
|
|
74
|
+
};
|
|
75
|
+
const result = { onChange, notifyChange, set, get, getTitle, setTitle };
|
|
76
|
+
return result;
|
|
77
|
+
};
|
|
25
78
|
export const PageViewProvider = ({ paths, handle, children, prefix = "page", eventHandler = {}, }) => {
|
|
26
79
|
const parentContext = useContext(PageViewContext);
|
|
27
80
|
const [uuid] = useState(() => `${prefix}-${Math.random().toString(36).slice(2)}`);
|
|
28
|
-
const app = useApp();
|
|
29
81
|
const [hasSelectionHandling, setSelectionHandling] = useState(false);
|
|
30
82
|
const isStandalone = useCallback(() => {
|
|
31
83
|
return handle == null ? true : handle.isStandalone();
|
|
@@ -111,6 +163,7 @@ export const PageViewProvider = ({ paths, handle, children, prefix = "page", eve
|
|
|
111
163
|
}
|
|
112
164
|
return result;
|
|
113
165
|
});
|
|
166
|
+
const titleRef = useRef(null);
|
|
114
167
|
const handleRef = useRef(handle);
|
|
115
168
|
useLayoutEffect(() => {
|
|
116
169
|
handleRef.current = handle;
|
|
@@ -143,6 +196,7 @@ export const PageViewProvider = ({ paths, handle, children, prefix = "page", eve
|
|
|
143
196
|
const { current: currentChain, previous: previousChain } = pageChain;
|
|
144
197
|
const newChainInfo = { path: "", base: "", page: "", options: pageOptions };
|
|
145
198
|
const newPageChain = { current: newChainInfo, previous: null };
|
|
199
|
+
// console.log("setPage mode => ", { page, pageOptions });
|
|
146
200
|
if (mode != null && mode === "window") {
|
|
147
201
|
newChainInfo.page = page;
|
|
148
202
|
newChainInfo.base = locInfo.root;
|
|
@@ -156,6 +210,7 @@ export const PageViewProvider = ({ paths, handle, children, prefix = "page", eve
|
|
|
156
210
|
}
|
|
157
211
|
setPageChain((prev) => (Object.assign({}, newPageChain)));
|
|
158
212
|
if (!standalone) {
|
|
213
|
+
// console.log("setPage push state => ", { newChainInfo });
|
|
159
214
|
history.pushState(null, "", newChainInfo.path);
|
|
160
215
|
}
|
|
161
216
|
(_a = handleRef.current) === null || _a === void 0 ? void 0 : _a.renderPage(page);
|
|
@@ -187,7 +242,7 @@ export const PageViewProvider = ({ paths, handle, children, prefix = "page", eve
|
|
|
187
242
|
};
|
|
188
243
|
const popPage = () => {
|
|
189
244
|
var _a, _b, _c;
|
|
190
|
-
// console.log("popPage (pageChain)", uuid, prefix, pageChain);
|
|
245
|
+
// console.log("popPage (pageChain)", uuid, prefix, JSON.stringify(pageChain));
|
|
191
246
|
const { previous: prevChain } = pageChain;
|
|
192
247
|
if (prevChain == null) {
|
|
193
248
|
return;
|
|
@@ -205,15 +260,25 @@ export const PageViewProvider = ({ paths, handle, children, prefix = "page", eve
|
|
|
205
260
|
const idx = newPath.lastIndexOf("/");
|
|
206
261
|
if (idx >= 0) {
|
|
207
262
|
newPath = path.substring(idx + 1);
|
|
263
|
+
// newPath = newPath.substring(idx + 1);
|
|
208
264
|
}
|
|
209
265
|
page = newPath;
|
|
210
|
-
// console.log("popPage 1.
|
|
266
|
+
// console.log("popPage 1.3", uuid, page);
|
|
211
267
|
}
|
|
212
268
|
else {
|
|
213
269
|
const [, ...anchors] = path.split("#");
|
|
214
270
|
page = (_b = anchors.at(-1)) !== null && _b !== void 0 ? _b : "";
|
|
271
|
+
// console.log("popPage 1.4", uuid, "page:", page, "path:", path);
|
|
215
272
|
if (page === "") {
|
|
216
|
-
page = path;
|
|
273
|
+
// page = path;
|
|
274
|
+
const withoutHash = path.split("#")[0];
|
|
275
|
+
const idx = withoutHash.lastIndexOf("/");
|
|
276
|
+
if (idx >= 0) {
|
|
277
|
+
page = withoutHash.substring(idx + 1);
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
page = path;
|
|
281
|
+
}
|
|
217
282
|
}
|
|
218
283
|
}
|
|
219
284
|
const newPageChain = Object.assign({}, prevChain);
|
|
@@ -221,6 +286,7 @@ export const PageViewProvider = ({ paths, handle, children, prefix = "page", eve
|
|
|
221
286
|
if (!standalone) {
|
|
222
287
|
history.pushState(null, "", path);
|
|
223
288
|
}
|
|
289
|
+
// console.log("popPage 2", uuid, page);
|
|
224
290
|
(_c = handleRef.current) === null || _c === void 0 ? void 0 : _c.renderPage(page);
|
|
225
291
|
};
|
|
226
292
|
const hasBackPage = () => {
|
|
@@ -230,11 +296,29 @@ export const PageViewProvider = ({ paths, handle, children, prefix = "page", eve
|
|
|
230
296
|
const { path } = previous.current;
|
|
231
297
|
return path != null && path !== "";
|
|
232
298
|
};
|
|
299
|
+
const getInfo = () => {
|
|
300
|
+
var _a;
|
|
301
|
+
return {
|
|
302
|
+
uuid,
|
|
303
|
+
prefix,
|
|
304
|
+
isStandalone: isStandalone(),
|
|
305
|
+
hasBackPage: hasBackPage(),
|
|
306
|
+
current: pageChain.current,
|
|
307
|
+
previous: (_a = pageChain.previous) === null || _a === void 0 ? void 0 : _a.current,
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
const ui = usePageViewUI();
|
|
233
311
|
const values = {
|
|
234
312
|
parentContext,
|
|
235
313
|
uuid,
|
|
236
314
|
stack: [...((parentContext === null || parentContext === void 0 ? void 0 : parentContext.stack) || [])],
|
|
237
315
|
paths,
|
|
316
|
+
getInfo,
|
|
317
|
+
getUI: () => ui,
|
|
318
|
+
getTitle: () => titleRef.current,
|
|
319
|
+
setTitle: (title) => {
|
|
320
|
+
titleRef.current = title;
|
|
321
|
+
},
|
|
238
322
|
setPage,
|
|
239
323
|
setSelectedPage,
|
|
240
324
|
getSelectedPage: () => {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export type PopupOptions = {
|
|
3
|
+
modal?: boolean;
|
|
4
|
+
draggable?: boolean;
|
|
5
|
+
showCloseButton?: boolean;
|
|
6
|
+
showTitle?: boolean;
|
|
7
|
+
minWidth?: number | string;
|
|
8
|
+
minHeight?: number | string;
|
|
9
|
+
width?: number | string;
|
|
10
|
+
height?: number | string;
|
|
11
|
+
className?: string;
|
|
12
|
+
title?: string | null;
|
|
13
|
+
};
|
|
14
|
+
export type PopupState = PopupOptions & {
|
|
15
|
+
id: string;
|
|
16
|
+
counter: number;
|
|
17
|
+
visible: boolean;
|
|
18
|
+
content: ReactNode | null;
|
|
19
|
+
options: PopupOptions;
|
|
20
|
+
};
|
|
21
|
+
export interface PopupInstance {
|
|
22
|
+
id: string;
|
|
23
|
+
setContent: (content: ReactNode) => void;
|
|
24
|
+
show: () => void;
|
|
25
|
+
hide: () => void;
|
|
26
|
+
close: () => void;
|
|
27
|
+
}
|
|
28
|
+
export interface PopupManager {
|
|
29
|
+
create: (options?: Partial<PopupOptions>) => PopupInstance;
|
|
30
|
+
closeAll: () => void;
|
|
31
|
+
}
|
|
32
|
+
declare const popupMgr: PopupManager;
|
|
33
|
+
export declare function PopupManagerSlot(): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function PopupManagerProvider({ children }: {
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare function usePopupManager(): PopupManager;
|
|
38
|
+
export type PopupSlotContextValue = {
|
|
39
|
+
getId: () => string;
|
|
40
|
+
close: () => void;
|
|
41
|
+
setTitle: (title: string | null) => void;
|
|
42
|
+
};
|
|
43
|
+
export declare function usePopupContext(): PopupSlotContextValue | null;
|
|
44
|
+
type PopupSlotProviderProps = {
|
|
45
|
+
data: PopupState;
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
};
|
|
48
|
+
export declare function PopupSlotProvider(props: PopupSlotProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export { popupMgr };
|