@ramesesinc/platform-core 0.1.9 → 0.1.11

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.
Files changed (76) hide show
  1. package/dist/components/action/DeleteData.d.ts +1 -0
  2. package/dist/components/action/DeleteData.js +16 -5
  3. package/dist/components/action/LookupPage.d.ts +2 -1
  4. package/dist/components/action/LookupPage.js +4 -3
  5. package/dist/components/action/Play.d.ts +6 -0
  6. package/dist/components/action/Play.js +40 -0
  7. package/dist/components/action/ProgressBar.d.ts +8 -0
  8. package/dist/components/action/ProgressBar.js +146 -0
  9. package/dist/components/action/ViewPage.d.ts +3 -1
  10. package/dist/components/action/ViewPage.js +22 -10
  11. package/dist/components/common/UIMenu.d.ts +1 -0
  12. package/dist/components/common/UIMenu.js +5 -3
  13. package/dist/components/index.d.ts +4 -1
  14. package/dist/components/index.js +4 -1
  15. package/dist/components/input/Combo.d.ts +21 -0
  16. package/dist/components/input/Combo.js +137 -0
  17. package/dist/components/input/DateField.js +7 -14
  18. package/dist/components/input/Text.d.ts +5 -0
  19. package/dist/components/input/Text.js +42 -7
  20. package/dist/components/input/YearPicker.js +3 -2
  21. package/dist/components/list/EditableMenu.d.ts +2 -0
  22. package/dist/components/list/EditableMenu.js +128 -0
  23. package/dist/components/list/TabMenu.js +2 -2
  24. package/dist/components/list/TreeMenu.js +35 -13
  25. package/dist/components/table/DataList.d.ts +1 -1
  26. package/dist/components/table/DataList.js +56 -29
  27. package/dist/components/table/DataTable.d.ts +2 -0
  28. package/dist/components/table/DataTable.js +31 -22
  29. package/dist/components/view/FilterView.js +1 -1
  30. package/dist/components/view/HtmlForm.js +12 -9
  31. package/dist/components/view/HtmlView.js +1 -1
  32. package/dist/components/view/PageView.d.ts +1 -0
  33. package/dist/components/view/PageView.js +38 -11
  34. package/dist/components/view/PopupView.d.ts +1 -0
  35. package/dist/components/view/PopupView.js +4 -4
  36. package/dist/components/view/RootView.d.ts +1 -0
  37. package/dist/components/view/RootView.js +18 -18
  38. package/dist/components/view/WizardView.d.ts +1 -1
  39. package/dist/components/view/WizardView.js +7 -25
  40. package/dist/core/AuthContext.js +1 -1
  41. package/dist/core/DynamicComponent.d.ts +2 -1
  42. package/dist/core/DynamicComponent.js +24 -2
  43. package/dist/core/Page.d.ts +1 -0
  44. package/dist/core/Page.js +6 -5
  45. package/dist/core/PageCache.d.ts +0 -2
  46. package/dist/core/PageCache.js +3 -8
  47. package/dist/core/PageContext.d.ts +1 -0
  48. package/dist/core/PageContext.js +16 -2
  49. package/dist/core/PageViewContext.d.ts +8 -2
  50. package/dist/core/PageViewContext.js +155 -86
  51. package/dist/core/Panel.js +34 -12
  52. package/dist/core/StepHandler.d.ts +1 -1
  53. package/dist/core/StepHandler.js +58 -21
  54. package/dist/index.css +98 -0
  55. package/dist/layouts/CardLayout.d.ts +2 -2
  56. package/dist/layouts/CardLayout.js +3 -4
  57. package/dist/layouts/HPanel.d.ts +2 -2
  58. package/dist/layouts/HPanel.js +1 -2
  59. package/dist/layouts/VPanel.d.ts +2 -2
  60. package/dist/layouts/VPanel.js +1 -2
  61. package/dist/layouts/index.d.ts +2 -3
  62. package/dist/layouts/index.js +2 -3
  63. package/dist/lib/utils/ExprUtil.js +18 -29
  64. package/dist/lib/utils/ResourceLoader.js +19 -7
  65. package/dist/lib/utils/SectionProvider.js +1 -1
  66. package/dist/lib/utils/initResourceLoader.d.ts +2 -0
  67. package/dist/lib/utils/initResourceLoader.js +64 -95
  68. package/dist/lib/utils/nunjucks.d.ts +2 -0
  69. package/dist/lib/utils/nunjucks.js +8 -0
  70. package/dist/templates/CrudFormTemplate.js +2 -3
  71. package/dist/templates/DataListTemplate.js +1 -1
  72. package/dist/templates/WizardTemplate.d.ts +3 -0
  73. package/dist/templates/WizardTemplate.js +17 -10
  74. package/package.json +1 -1
  75. package/dist/components/input/Select.d.ts +0 -14
  76. package/dist/components/input/Select.js +0 -40
@@ -8,6 +8,7 @@ interface DeleteDataProps extends AbstractComponent {
8
8
  opt?: Record<string, any>;
9
9
  iconOnly?: boolean;
10
10
  params: Record<string, any>;
11
+ confirmMessage?: string;
11
12
  }
12
13
  declare const DeleteData: (props: DeleteDataProps) => import("react/jsx-runtime").JSX.Element;
13
14
  export default DeleteData;
@@ -1,20 +1,23 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { AlertCircle } from "lucide-react";
4
+ import { useState } from "react";
3
5
  import { usePageContext } from "../../core/PageContext";
4
6
  import { usePageViewContext } from "../../core/PageViewContext";
5
7
  import { useRowContext } from "../../core/RowContext";
6
8
  import { getValue } from "../../lib/utils/BeanUtils";
7
9
  import { getUrlPageParams } from "../../lib/utils/PageUtils";
10
+ const ConfirmDialog = ({ message, onConfirm, onCancel }) => (_jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/40", children: _jsxs("div", { className: "bg-white rounded-xl shadow-xl w-full max-w-sm p-6", children: [_jsxs("div", { className: "flex items-center gap-3 mb-3", children: [_jsx(AlertCircle, { className: "text-red-500 shrink-0", size: 24 }), _jsx("p", { className: "text-base font-semibold text-gray-800", children: "Confirm Deletion" })] }), _jsxs("p", { className: "text-sm mb-6", children: [message, " This cannot be undone."] }), _jsxs("div", { className: "flex justify-end gap-3", children: [_jsx("button", { onClick: onCancel, className: "px-4 py-2 text-sm rounded-md border border-gray-300 text-gray-700 hover:bg-gray-100 transition-colors", children: "Cancel" }), _jsx("button", { onClick: onConfirm, className: "px-4 py-2 text-sm rounded-md bg-red-500 text-white hover:bg-red-600 transition-colors", children: "Delete" })] })] }) }));
8
11
  /* ------------------------------------------------------------------ */
9
12
  /* Component */
10
13
  const DeleteData = (props) => {
11
- const { api, className = "", title, icon, opt = {}, params, iconOnly = false } = props !== null && props !== void 0 ? props : {};
14
+ const { api, className = "", title, icon, opt = {}, params, iconOnly = false, confirmMessage } = props !== null && props !== void 0 ? props : {};
12
15
  const { data = {} } = opt;
13
16
  const rowContext = useRowContext();
14
17
  const pageView = usePageViewContext();
15
18
  const pageContext = usePageContext();
16
- /* ---------------------- Events ---------------------- */
17
- const handleClick = async () => {
19
+ const [showConfirm, setShowConfirm] = useState(false);
20
+ const doDelete = async () => {
18
21
  var _a, _b;
19
22
  try {
20
23
  if (!api)
@@ -31,13 +34,21 @@ const DeleteData = (props) => {
31
34
  const d = getValue(params, Object.assign(Object.assign({}, urlParams === null || urlParams === void 0 ? void 0 : urlParams.params), vdata));
32
35
  await (pageContext === null || pageContext === void 0 ? void 0 : pageContext.execService(api, vdata));
33
36
  }
34
- // pageContext?.refresh();
37
+ pageContext === null || pageContext === void 0 ? void 0 : pageContext.notifyDepends("datalist");
35
38
  }
36
39
  catch (err) {
37
40
  alert(err.message);
38
41
  }
39
42
  };
43
+ const handleClick = () => setShowConfirm(true);
44
+ const handleConfirm = async () => {
45
+ setShowConfirm(false);
46
+ await doDelete();
47
+ };
48
+ const handleCancel = () => setShowConfirm(false);
49
+ const itemLabel = (data === null || data === void 0 ? void 0 : data._id) ? `Delete item ${data._id}?` : "Delete this item?";
50
+ const message = confirmMessage !== null && confirmMessage !== void 0 ? confirmMessage : itemLabel;
40
51
  /* ---------------------- Render ---------------------- */
41
- return (_jsx(_Fragment, { children: iconOnly ? (_jsx("span", { onClick: handleClick, className: `cursor-pointer ${className}`, children: icon })) : (_jsxs("button", { onClick: handleClick, className: `px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors ${className}`, children: [icon && _jsx("span", { className: "dl-action-icon", children: icon }), title || "Remove"] })) }));
52
+ return (_jsxs(_Fragment, { children: [showConfirm && _jsx(ConfirmDialog, { message: message, onConfirm: handleConfirm, onCancel: handleCancel }), iconOnly ? (_jsx("span", { onClick: handleClick, className: `cursor-pointer ${className}`, children: icon })) : (_jsxs("button", { onClick: handleClick, className: `px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors ${className}`, children: [icon && _jsx("span", { className: "dl-action-icon", children: icon }), title || "Remove"] }))] }));
42
53
  };
43
54
  export default DeleteData;
@@ -7,10 +7,11 @@ interface LookupPageProps extends AbstractComponent {
7
7
  children?: React.ReactNode;
8
8
  className?: string;
9
9
  title?: string;
10
- icon?: string;
10
+ icon?: string | React.ReactNode;
11
11
  opt?: Record<string, any>;
12
12
  iconOnly?: boolean;
13
13
  popupClassName?: string;
14
+ variant?: "primary" | "secondary" | "danger" | "text" | "contained" | "outlined";
14
15
  }
15
16
  declare const LookupPage: (props: LookupPageProps) => import("react/jsx-runtime").JSX.Element;
16
17
  export default LookupPage;
@@ -1,5 +1,6 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Button } from "@ramesesinc/client";
3
4
  import { useRef } from "react";
4
5
  import { usePageContext } from "../../core/PageContext";
5
6
  import { getValue, substituteExpr } from "../../lib/utils/BeanUtils";
@@ -7,7 +8,7 @@ import { usePopupView } from "../view/PopupView";
7
8
  /* ------------------------------------------------------------------ */
8
9
  /* Component */
9
10
  const LookupPage = (props) => {
10
- const { url, name = "", result = null, children, className = "", title, icon, opt = {}, popupClassName = "", iconOnly = false } = props !== null && props !== void 0 ? props : {};
11
+ const { url, name = "", result = null, children, className = "", title, icon, opt = {}, popupClassName = "", iconOnly = false, variant = "contained", } = props !== null && props !== void 0 ? props : {};
11
12
  const { data = {} } = opt;
12
13
  const pageContext = usePageContext();
13
14
  const popupView = usePopupView();
@@ -35,6 +36,6 @@ const LookupPage = (props) => {
35
36
  popupRef.current = showPopupRef;
36
37
  };
37
38
  /* ---------------------- Render ---------------------- */
38
- return (_jsx(_Fragment, { children: iconOnly ? (_jsx("span", { onClick: handleClick, className: `cursor-pointer ${className}`, children: icon })) : (_jsxs("button", { onClick: handleClick, className: `px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors ${className}`, children: [icon && _jsx("span", { className: "dl-action-icon", children: icon }), title || "View Page"] })) }));
39
+ return (_jsx(_Fragment, { children: iconOnly ? (_jsx("span", { onClick: handleClick, className: `cursor-pointer ${className}`, children: icon })) : (_jsx(Button, { onClick: handleClick, className: `${className}`, icon: icon, variant: variant, children: title || "Lookup Page" })) }));
39
40
  };
40
41
  export default LookupPage;
@@ -0,0 +1,6 @@
1
+ type PlayProps = {
2
+ name?: string;
3
+ opt?: Record<string, any>;
4
+ };
5
+ declare const Play: (props: PlayProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default Play;
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Pause, Play as PlayIcon, Square } from "lucide-react";
3
+ import { useEffect, useState } from "react";
4
+ import { useDataContext } from "../../core/DataContext";
5
+ const Play = (props) => {
6
+ const { name = "play", opt } = props !== null && props !== void 0 ? props : {};
7
+ const dataContext = useDataContext();
8
+ const [state, setState] = useState("idle");
9
+ const handlePlayPause = () => {
10
+ if (state === "idle") {
11
+ setState("playing");
12
+ dataContext === null || dataContext === void 0 ? void 0 : dataContext.set(name, 100); // ← start
13
+ }
14
+ else if (state === "playing") {
15
+ setState("paused");
16
+ dataContext === null || dataContext === void 0 ? void 0 : dataContext.set(name, -1); // ← pause
17
+ }
18
+ else if (state === "paused") {
19
+ setState("playing");
20
+ dataContext === null || dataContext === void 0 ? void 0 : dataContext.set(name, 100); // ← resume
21
+ }
22
+ };
23
+ const handleStop = () => {
24
+ setState("idle");
25
+ dataContext === null || dataContext === void 0 ? void 0 : dataContext.set(name, 0); // ← stop
26
+ };
27
+ // ← listen to progress finishing
28
+ useEffect(() => {
29
+ if (!name)
30
+ return;
31
+ const unsubscribe = dataContext === null || dataContext === void 0 ? void 0 : dataContext.dependsTo(name, (val) => {
32
+ if (val === 0) {
33
+ setState("idle");
34
+ }
35
+ });
36
+ return () => unsubscribe === null || unsubscribe === void 0 ? void 0 : unsubscribe();
37
+ }, [name]);
38
+ return (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("span", { onClick: handlePlayPause, className: "cursor-pointer hover:opacity-70 transition-opacity", children: state === "playing" ? (_jsx(Pause, { size: 18, className: "text-yellow-500", fill: "currentColor" })) : state === "paused" ? (_jsx(PlayIcon, { size: 18, className: "text-blue-500", fill: "currentColor" })) : (_jsx(PlayIcon, { size: 18, className: "text-green-500", fill: "currentColor" })) }), state === "paused" && (_jsx("span", { onClick: handleStop, className: "cursor-pointer hover:opacity-70 transition-opacity", children: _jsx(Square, { size: 18, className: "text-red-500", fill: "currentColor" }) }))] }));
39
+ };
40
+ export default Play;
@@ -0,0 +1,8 @@
1
+ type ProgressBarProps = {
2
+ value?: number;
3
+ depends?: string;
4
+ caption?: string;
5
+ opt?: Record<string, any>;
6
+ };
7
+ declare const ProgressBar: (props: ProgressBarProps) => import("react/jsx-runtime").JSX.Element;
8
+ export default ProgressBar;
@@ -0,0 +1,146 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { useDataContext } from "../../core/DataContext";
4
+ const ProgressBar = (props) => {
5
+ const { value: propValue, depends, caption, opt } = props !== null && props !== void 0 ? props : {};
6
+ const [animValue, setAnimValue] = useState(0);
7
+ const [active, setActive] = useState(false);
8
+ const dataContext = useDataContext();
9
+ const intervalRef = useRef(null);
10
+ const doneRef = useRef(false);
11
+ const startProgress = () => {
12
+ if (intervalRef.current)
13
+ clearInterval(intervalRef.current);
14
+ setActive(true);
15
+ intervalRef.current = setInterval(() => {
16
+ setAnimValue((prev) => {
17
+ if (prev >= 100) {
18
+ clearInterval(intervalRef.current);
19
+ doneRef.current = true;
20
+ return 100;
21
+ }
22
+ return prev + 2;
23
+ });
24
+ }, 50);
25
+ };
26
+ const pauseProgress = () => {
27
+ if (intervalRef.current)
28
+ clearInterval(intervalRef.current);
29
+ setActive(false);
30
+ };
31
+ const stopProgress = () => {
32
+ if (intervalRef.current)
33
+ clearInterval(intervalRef.current);
34
+ doneRef.current = false;
35
+ setActive(false);
36
+ setAnimValue(0);
37
+ };
38
+ useEffect(() => {
39
+ if (animValue >= 100) {
40
+ setActive(false);
41
+ const timeout = setTimeout(() => {
42
+ dataContext === null || dataContext === void 0 ? void 0 : dataContext.set(depends !== null && depends !== void 0 ? depends : "", 0);
43
+ }, 1500);
44
+ return () => clearTimeout(timeout);
45
+ }
46
+ }, [animValue]);
47
+ useEffect(() => {
48
+ if (!depends)
49
+ return;
50
+ const unsubscribe = dataContext === null || dataContext === void 0 ? void 0 : dataContext.dependsTo(depends, (val) => {
51
+ if (val === 100) {
52
+ startProgress();
53
+ }
54
+ else if (val === -1) {
55
+ pauseProgress();
56
+ }
57
+ else if (val === 0 && !doneRef.current) {
58
+ stopProgress();
59
+ }
60
+ });
61
+ return () => unsubscribe === null || unsubscribe === void 0 ? void 0 : unsubscribe();
62
+ }, [depends]);
63
+ useEffect(() => {
64
+ return () => {
65
+ if (intervalRef.current)
66
+ clearInterval(intervalRef.current);
67
+ };
68
+ }, []);
69
+ const getColor = () => {
70
+ if (animValue < 25)
71
+ return { bar: "#ef4444", glow: "#ff000080" };
72
+ if (animValue < 50)
73
+ return { bar: "#f97316", glow: "#ff6a0080" };
74
+ if (animValue < 75)
75
+ return { bar: "#eab308", glow: "#ffcc0080" };
76
+ return { bar: "#22c55e", glow: "#00ff6680" };
77
+ };
78
+ const { bar, glow } = getColor();
79
+ return (_jsxs("div", { className: "flex flex-col gap-1 w-full", children: [_jsxs("div", { className: "relative w-full rounded-sm overflow-hidden", style: {
80
+ height: "16px",
81
+ background: "#1a1a2e",
82
+ border: "1px solid #333",
83
+ boxShadow: "inset 0 2px 4px rgba(0,0,0,0.5)",
84
+ }, children: [_jsxs("div", { style: {
85
+ width: `${animValue}%`,
86
+ height: "100%",
87
+ background: `linear-gradient(90deg, ${bar}cc, ${bar})`,
88
+ boxShadow: `0 0 8px ${glow}, 0 0 2px ${bar}`,
89
+ transition: "width 0.3s ease",
90
+ position: "relative",
91
+ }, children: [_jsx("div", { style: {
92
+ position: "absolute",
93
+ top: 0,
94
+ left: 0,
95
+ right: 0,
96
+ height: "50%",
97
+ background: "linear-gradient(180deg, rgba(255,255,255,0.2), transparent)",
98
+ } }), _jsx("div", { style: {
99
+ position: "absolute",
100
+ top: 0,
101
+ bottom: 0,
102
+ width: "20px",
103
+ right: 0,
104
+ background: "linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent)",
105
+ animation: active ? "sweep 1s ease-in-out infinite" : "none",
106
+ } })] }), [25, 50, 75].map((seg) => (_jsx("div", { style: {
107
+ position: "absolute",
108
+ top: 0,
109
+ bottom: 0,
110
+ left: `${seg}%`,
111
+ width: "1px",
112
+ background: "rgba(0,0,0,0.4)",
113
+ zIndex: 1,
114
+ } }, seg)))] }), caption && (_jsxs("div", { className: "flex items-center justify-center gap-1", children: [_jsxs("span", { style: {
115
+ fontFamily: "monospace",
116
+ fontSize: "11px",
117
+ fontWeight: "bold",
118
+ color: bar,
119
+ textShadow: `0 0 6px ${glow}`,
120
+ letterSpacing: "0.05em",
121
+ animation: active ? "blink 1s step-end infinite" : "none",
122
+ }, children: [caption.toUpperCase(), active && "..."] }), _jsxs("span", { style: {
123
+ fontFamily: "monospace",
124
+ fontSize: "11px",
125
+ fontWeight: "bold",
126
+ color: bar,
127
+ textShadow: `0 0 6px ${glow}`,
128
+ }, children: [animValue, "%"] })] })), !caption && (_jsx("div", { className: "flex justify-end", children: _jsxs("span", { style: {
129
+ fontFamily: "monospace",
130
+ fontSize: "11px",
131
+ fontWeight: "bold",
132
+ color: bar,
133
+ textShadow: `0 0 6px ${glow}`,
134
+ }, children: [animValue, "%"] }) })), _jsx("style", { children: `
135
+ @keyframes sweep {
136
+ 0% { opacity: 0; transform: translateX(-20px); }
137
+ 50% { opacity: 1; }
138
+ 100% { opacity: 0; transform: translateX(20px); }
139
+ }
140
+ @keyframes blink {
141
+ 0%, 100% { opacity: 1; }
142
+ 50% { opacity: 0.3; }
143
+ }
144
+ ` })] }));
145
+ };
146
+ export default ProgressBar;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { AbstractComponent } from "../../types/component";
3
2
  import { PopupOptions } from "../../core/PopupContext";
3
+ import { AbstractComponent } from "../../types/component";
4
4
  interface ViewPageProps extends AbstractComponent {
5
5
  url: string;
6
6
  mode?: "popup" | "window";
@@ -10,7 +10,9 @@ interface ViewPageProps extends AbstractComponent {
10
10
  opt?: Record<string, any>;
11
11
  iconOnly?: boolean;
12
12
  popupClassName?: string;
13
+ variant?: "primary" | "secondary" | "danger" | "text" | "contained" | "outlined";
13
14
  popupOptions?: PopupOptions;
15
+ action?: "read" | "create" | "edit";
14
16
  }
15
17
  declare const ViewPage: (props: ViewPageProps) => import("react/jsx-runtime").JSX.Element;
16
18
  export default ViewPage;
@@ -1,5 +1,6 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Button } from "@ramesesinc/client";
3
4
  import { useRef } from "react";
4
5
  import { useDataContext } from "../../core/DataContext";
5
6
  import { usePageContext } from "../../core/PageContext";
@@ -10,7 +11,7 @@ import { usePopupView } from "../view/PopupView";
10
11
  /* ------------------------------------------------------------------ */
11
12
  /* Component */
12
13
  const ViewPage = (props) => {
13
- const { url, mode, className = "", title, icon, iconOnly = false, opt = {}, popupClassName = "", popupOptions = {} } = props !== null && props !== void 0 ? props : {};
14
+ const { url, mode, className = "", title, icon, iconOnly = false, opt = {}, popupClassName = "", popupOptions = {}, variant, action } = props !== null && props !== void 0 ? props : {};
14
15
  const { data = {} } = opt;
15
16
  const dataContext = useDataContext();
16
17
  const pageView = usePageViewContext();
@@ -22,8 +23,8 @@ const ViewPage = (props) => {
22
23
  var _a;
23
24
  (_a = popupShowRef.current) === null || _a === void 0 ? void 0 : _a.close();
24
25
  };
25
- const handleClick = (e) => {
26
- e.preventDefault();
26
+ const handleClick = () => {
27
+ // e.preventDefault();
27
28
  if (!url)
28
29
  return;
29
30
  const getUrlParams = () => {
@@ -47,9 +48,9 @@ const ViewPage = (props) => {
47
48
  const urlData = getUrlData();
48
49
  const surl = substituteExpr(url, Object.assign(Object.assign({}, urlParams), urlData));
49
50
  let preferredMode = mode;
50
- if ((preferredMode == null || preferredMode.trim() === '') && dataContext.getType() === 'row') {
51
- preferredMode = "window";
52
- }
51
+ // if ((preferredMode == null || preferredMode.trim() === "") && dataContext.getType() === "row") {
52
+ // preferredMode = "window";
53
+ // }
53
54
  if (preferredMode === "popup") {
54
55
  const handler = {
55
56
  onSave: (itm) => {
@@ -61,10 +62,12 @@ const ViewPage = (props) => {
61
62
  },
62
63
  };
63
64
  const showPopupOptions = Object.assign({}, popupOptions);
64
- if (popupClassName != null && popupClassName.trim() !== '') {
65
+ if (popupClassName != null && popupClassName.trim() !== "") {
65
66
  showPopupOptions.className = popupClassName;
66
67
  }
67
- const showPopupRef = popupView.create({ url: surl, onClose: onClose, eventHandler: handler }).show(showPopupOptions);
68
+ const showPopupRef = popupView
69
+ .create({ url: surl, onClose: onClose, eventHandler: handler, options: { action: "create" } })
70
+ .show(showPopupOptions);
68
71
  popupShowRef.current = showPopupRef;
69
72
  }
70
73
  else if (preferredMode === "window") {
@@ -73,10 +76,19 @@ const ViewPage = (props) => {
73
76
  }
74
77
  else {
75
78
  popupShowRef.current = null;
79
+ // store page context params in chain before navigating
80
+ const chainInfo = pageView.getPageChainInfo();
81
+ const allData = pageContext.getAllData();
82
+ chainInfo.params = Object.assign(Object.assign({}, chainInfo.params), allData);
76
83
  pageView.pushPage(surl);
77
84
  }
78
85
  };
79
86
  /* ---------------------- Render ---------------------- */
80
- return (_jsx(_Fragment, { children: iconOnly ? (_jsx("span", { onClick: handleClick, className: `cursor-pointer ${className}`, children: icon })) : (_jsxs("button", { onClick: handleClick, className: `px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors ${className}`, children: [icon && _jsx("span", { className: "dl-action-icon", children: icon }), title || "View Page"] })) }));
87
+ return (_jsx(_Fragment, { children: iconOnly ? (_jsx("span", { onClick: handleClick, className: `cursor-pointer ${className}`, children: icon })) : (
88
+ // <button onClick={handleClick} className={`px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors ${className}`}>
89
+ // {icon && <span className="dl-action-icon">{icon}</span>}
90
+ // {title || "View Page"}
91
+ // </button>
92
+ _jsx(Button, { onClick: handleClick, className: `${className}`, icon: icon, variant: variant, children: title || "View Page" })) }));
81
93
  };
82
94
  export default ViewPage;
@@ -7,6 +7,7 @@ export type MenuItem = {
7
7
  export type MenuGroup = {
8
8
  title: string;
9
9
  icon?: React.ReactNode | string;
10
+ hidden?: boolean;
10
11
  items: MenuItem[];
11
12
  };
12
13
  export type UIMenuProps = {
@@ -20,14 +20,15 @@ const useUIMenu = (props) => {
20
20
  return;
21
21
  }
22
22
  const fetchMenus = async () => {
23
- var _a, _b;
23
+ var _a, _b, _c;
24
24
  setLoading(true);
25
25
  setError(null);
26
26
  try {
27
27
  // 2️⃣ Custom API
28
28
  if (data === null || data === void 0 ? void 0 : data.api) {
29
29
  const res = await (pageContext === null || pageContext === void 0 ? void 0 : pageContext.execService(data.api, (_a = data.params) !== null && _a !== void 0 ? _a : {}));
30
- setMenus(Array.isArray(res) ? res : []);
30
+ const newData = (_b = res.data) !== null && _b !== void 0 ? _b : res;
31
+ setMenus(Array.isArray(newData) ? newData : newData ? [newData] : []);
31
32
  return;
32
33
  }
33
34
  // 3️⃣ Menugroup — fetch categories + items, map to MenuGroup[]
@@ -42,13 +43,14 @@ const useUIMenu = (props) => {
42
43
  const mappedItems = categories.map((cat) => ({
43
44
  title: cat.title,
44
45
  icon: cat.icon,
46
+ hidden: cat.hidden,
45
47
  items: sorted.filter((m) => m.category === cat.id),
46
48
  }));
47
49
  setMenus(mappedItems);
48
50
  }
49
51
  }
50
52
  catch (err) {
51
- setError((_b = err === null || err === void 0 ? void 0 : err.message) !== null && _b !== void 0 ? _b : "Failed to load menus");
53
+ setError((_c = err === null || err === void 0 ? void 0 : err.message) !== null && _c !== void 0 ? _c : "Failed to load menus");
52
54
  }
53
55
  finally {
54
56
  setLoading(false);
@@ -1,8 +1,8 @@
1
1
  export { default as Button } from "./action/Button";
2
2
  export { default as DateField } from "./input/DateField";
3
3
  export { default as DayPicker } from "./input/DayPicker";
4
+ export { default as Combo } from "./input/Combo";
4
5
  export { default as MonthPicker } from "./input/MonthPicker";
5
- export { default as Select } from "./input/Select";
6
6
  export { default as Text } from "./input/Text";
7
7
  export { default as YearPicker } from "./input/YearPicker";
8
8
  export { default as HtmlCode } from "./input/HtmlCode";
@@ -10,6 +10,7 @@ export { default as JsonCode } from "./input/JsonCode";
10
10
  export { default as ScriptCode } from "./input/ScriptCode";
11
11
  export { default as SqlCode } from "./input/SqlCode";
12
12
  export { default as StringDecision } from "./input/StringDecision";
13
+ export { default as EditableMenu } from "./list/EditableMenu";
13
14
  export { default as TabMenu } from "./list/TabMenu";
14
15
  export { default as TreeMenu } from "./list/TreeMenu";
15
16
  export { default as Label } from "./output/Label";
@@ -27,7 +28,9 @@ export type { ShowPopupViewRef, CreatePopupViewRef, UsePopupViewResult } from ".
27
28
  export { default as AlertMessage } from "./action/AlertMessage";
28
29
  export { default as DeleteData } from "./action/DeleteData";
29
30
  export { default as Edit } from "./action/Edit";
31
+ export { default as Play } from "./action/Play";
30
32
  export { default as ProcessRunner } from "./action/ProcessRunner";
33
+ export { default as ProgressBar } from "./action/ProgressBar";
31
34
  export { default as Refresh } from "./action/Refresh";
32
35
  export { default as SaveData } from "./action/SaveData";
33
36
  export { default as SelectData } from "./action/SelectData";
@@ -2,8 +2,8 @@ export { default as Button } from "./action/Button";
2
2
  //inputs
3
3
  export { default as DateField } from "./input/DateField";
4
4
  export { default as DayPicker } from "./input/DayPicker";
5
+ export { default as Combo } from "./input/Combo";
5
6
  export { default as MonthPicker } from "./input/MonthPicker";
6
- export { default as Select } from "./input/Select";
7
7
  export { default as Text } from "./input/Text";
8
8
  export { default as YearPicker } from "./input/YearPicker";
9
9
  //codes
@@ -14,6 +14,7 @@ export { default as SqlCode } from "./input/SqlCode";
14
14
  //conditions
15
15
  export { default as StringDecision } from "./input/StringDecision";
16
16
  //export { default as YearPicker } from "./input/YearPicker";
17
+ export { default as EditableMenu } from "./list/EditableMenu";
17
18
  export { default as TabMenu } from "./list/TabMenu";
18
19
  export { default as TreeMenu } from "./list/TreeMenu";
19
20
  export { default as Label } from "./output/Label";
@@ -31,7 +32,9 @@ export { default as PopupView } from "./view/PopupView";
31
32
  export { default as AlertMessage } from "./action/AlertMessage";
32
33
  export { default as DeleteData } from "./action/DeleteData";
33
34
  export { default as Edit } from "./action/Edit";
35
+ export { default as Play } from "./action/Play";
34
36
  export { default as ProcessRunner } from "./action/ProcessRunner";
37
+ export { default as ProgressBar } from "./action/ProgressBar";
35
38
  export { default as Refresh } from "./action/Refresh";
36
39
  export { default as SaveData } from "./action/SaveData";
37
40
  export { default as SelectData } from "./action/SelectData";
@@ -0,0 +1,21 @@
1
+ import { UIInputProps } from "../common/UIInput";
2
+ type SelectOption = {
3
+ label: string;
4
+ value: string;
5
+ };
6
+ type ComboProps = UIInputProps & {
7
+ name?: string;
8
+ depends?: string;
9
+ required?: boolean;
10
+ immediate?: boolean;
11
+ items?: SelectOption[];
12
+ data?: Record<string, any>;
13
+ placeholder?: string;
14
+ onChange?: (value: string) => void;
15
+ variant?: "primary" | "secondary" | "danger" | "text" | "contained" | "outlined";
16
+ radius?: "none" | "md" | "lg" | "xl" | "2xl" | "3xl" | "full";
17
+ size?: "sm" | "md" | "lg";
18
+ className?: string;
19
+ };
20
+ declare const Combo: (props: ComboProps) => import("react/jsx-runtime").JSX.Element;
21
+ export default Combo;