@akanjs/ui 0.9.42 → 0.9.44
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/Clipboard.d.ts +7 -0
- package/Data/CardList.d.ts +1 -1
- package/Data/Dashboard.d.ts +2 -3
- package/Data/Item.d.ts +4 -4
- package/Data/ListContainer.d.ts +10 -6
- package/Data/TableList.d.ts +1 -1
- package/Model/AdminPanel.d.ts +31 -0
- package/Model/index.d.ts +1 -0
- package/Model/index_.d.ts +1 -0
- package/System/Client.d.ts +8 -2
- package/cjs/Clipboard.js +70 -0
- package/cjs/Data/Item.js +2 -5
- package/cjs/Data/ListContainer.js +7 -14
- package/cjs/Data/QueryMaker.js +4 -11
- package/cjs/Layout/BottomTab.js +8 -1
- package/cjs/Model/AdminPanel.js +46 -0
- package/cjs/Model/index.js +2 -1
- package/cjs/Model/index_.js +2 -0
- package/cjs/Signal/Listener.js +3 -3
- package/cjs/Signal/Message.js +2 -2
- package/cjs/Signal/PubSub.js +4 -7
- package/cjs/System/CSR.js +5 -3
- package/cjs/System/Client.js +6 -2
- package/cjs/System/Common.js +24 -28
- package/cjs/System/Reconnect.js +1 -1
- package/cjs/System/SSR.js +6 -3
- package/cjs/System/ThemeToggle.js +1 -1
- package/cjs/index.js +2 -0
- package/esm/Clipboard.js +51 -0
- package/esm/Data/Item.js +2 -5
- package/esm/Data/ListContainer.js +7 -14
- package/esm/Data/QueryMaker.js +4 -12
- package/esm/Layout/BottomTab.js +8 -1
- package/esm/Model/AdminPanel.js +27 -0
- package/esm/Model/index.js +3 -1
- package/esm/Model/index_.js +2 -0
- package/esm/Signal/Listener.js +3 -3
- package/esm/Signal/Message.js +2 -2
- package/esm/Signal/PubSub.js +4 -7
- package/esm/System/CSR.js +5 -3
- package/esm/System/Client.js +7 -2
- package/esm/System/Common.js +25 -29
- package/esm/System/Reconnect.js +1 -1
- package/esm/System/SSR.js +6 -3
- package/esm/System/ThemeToggle.js +1 -1
- package/esm/index.js +2 -0
- package/index.d.ts +1 -0
- package/package.json +1 -1
package/cjs/System/Common.js
CHANGED
|
@@ -24,7 +24,6 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
24
24
|
var import_ko = require("dayjs/locale/ko");
|
|
25
25
|
var import_client = require("@akanjs/client");
|
|
26
26
|
var import_Load = require("../Load");
|
|
27
|
-
var import_Reconnect = require("./Reconnect");
|
|
28
27
|
const Common = () => {
|
|
29
28
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
30
29
|
};
|
|
@@ -37,32 +36,29 @@ const CommonWrapper = ({
|
|
|
37
36
|
fetchSelf = (props) => fetch.getSelf?.(props)
|
|
38
37
|
}) => {
|
|
39
38
|
const account = (0, import_client.getAccount)();
|
|
40
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
),
|
|
65
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Reconnect.Reconnect, {})
|
|
66
|
-
] });
|
|
39
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
40
|
+
import_Load.Load.Page,
|
|
41
|
+
{
|
|
42
|
+
of: CommonWrapper,
|
|
43
|
+
loader: async () => {
|
|
44
|
+
const mePromise = (async () => {
|
|
45
|
+
try {
|
|
46
|
+
return account.me ? await fetchMe({ crystalize: false }) : null;
|
|
47
|
+
} catch (e) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
})();
|
|
51
|
+
const selfPromise = (async () => {
|
|
52
|
+
try {
|
|
53
|
+
return account.self ? await fetchSelf({ crystalize: false }) : null;
|
|
54
|
+
} catch (e) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
})();
|
|
58
|
+
return Promise.resolve({ mePromise, selfPromise });
|
|
59
|
+
},
|
|
60
|
+
render
|
|
61
|
+
}
|
|
62
|
+
);
|
|
67
63
|
};
|
|
68
64
|
Common.Wrapper = CommonWrapper;
|
package/cjs/System/Reconnect.js
CHANGED
|
@@ -49,7 +49,7 @@ const Reconnect = () => {
|
|
|
49
49
|
setConnectStatus((prev) => prev === "normal" || prev === "initial" ? "disconnected" : prev);
|
|
50
50
|
setTimeout(() => {
|
|
51
51
|
setConnectStatus((prev) => prev === "disconnected" ? "connecting" : prev);
|
|
52
|
-
},
|
|
52
|
+
}, 2e3);
|
|
53
53
|
}, []);
|
|
54
54
|
(0, import_react.useEffect)(() => {
|
|
55
55
|
const io = import_signal.client.getIo();
|
package/cjs/System/SSR.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(SSR_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(SSR_exports);
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_client = require("@akanjs/client");
|
|
26
|
+
var import_dictionary = require("@akanjs/dictionary");
|
|
26
27
|
var import_react = require("react");
|
|
27
28
|
var import_Load = require("../Load");
|
|
28
29
|
var import_Client = require("./Client");
|
|
@@ -54,11 +55,13 @@ const SSRProvider = ({
|
|
|
54
55
|
of,
|
|
55
56
|
loader: async () => {
|
|
56
57
|
const { lang } = await params;
|
|
58
|
+
await import_dictionary.serverTranslator.init(lang);
|
|
57
59
|
if (!import_client.router.isInitialized)
|
|
58
60
|
import_client.router.init({ type: "next", side: "server", lang, prefix });
|
|
59
|
-
|
|
61
|
+
const dictionary = await import_dictionary.serverTranslator.getDictionary(lang);
|
|
62
|
+
return { lang, dictionary };
|
|
60
63
|
},
|
|
61
|
-
render: ({ lang }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
+
render: ({ lang, dictionary }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
62
65
|
import_Common.Common.Wrapper,
|
|
63
66
|
{
|
|
64
67
|
fetch,
|
|
@@ -76,7 +79,7 @@ const SSRProvider = ({
|
|
|
76
79
|
fonts,
|
|
77
80
|
prefix,
|
|
78
81
|
layoutStyle,
|
|
79
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Client.ClientWrapper, { theme, children: [
|
|
82
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Client.ClientWrapper, { theme, lang, dictionary, children: [
|
|
80
83
|
children,
|
|
81
84
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Client.ClientInner, {}) }),
|
|
82
85
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Suspense, { fallback: null, children: [
|
|
@@ -38,7 +38,7 @@ const ThemeToggle = () => {
|
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
40
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "label cursor-pointer", children: [
|
|
41
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "
|
|
41
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-base-content mr-2 text-sm whitespace-nowrap", children: (0, import_common.capitalize)(theme ?? "") }),
|
|
42
42
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "checkbox", className: "toggle toggle-sm", checked: theme === "dark", onChange: handleTheme })
|
|
43
43
|
] }) });
|
|
44
44
|
};
|
package/cjs/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __export(ui_exports, {
|
|
|
20
20
|
BottomSheet: () => import_BottomSheet.BottomSheet,
|
|
21
21
|
Button: () => import_Button.Button,
|
|
22
22
|
ClientSide: () => import_ClientSide.ClientSide,
|
|
23
|
+
Clipboard: () => import_Clipboard.Clipboard,
|
|
23
24
|
Copy: () => import_Copy.Copy,
|
|
24
25
|
CsrImage: () => import_CsrImage.CsrImage,
|
|
25
26
|
Data: () => import_Data.Data,
|
|
@@ -75,6 +76,7 @@ var import_BottomSheet = require("./BottomSheet");
|
|
|
75
76
|
var import_Button = require("./Button");
|
|
76
77
|
var import_ClientSide = require("./ClientSide");
|
|
77
78
|
var import_Copy = require("./Copy");
|
|
79
|
+
var import_Clipboard = require("./Clipboard");
|
|
78
80
|
var import_CsrImage = require("./CsrImage");
|
|
79
81
|
var import_DatePicker = require("./DatePicker");
|
|
80
82
|
var import_DragAction = require("./DragAction");
|
package/esm/Clipboard.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { clsx } from "@akanjs/client";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { FaCheck } from "react-icons/fa";
|
|
6
|
+
import { MdContentCopy } from "react-icons/md";
|
|
7
|
+
const Clipboard = ({ text, className }) => {
|
|
8
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (isCopied) {
|
|
11
|
+
setTimeout(() => {
|
|
12
|
+
setIsCopied(false);
|
|
13
|
+
}, 2e3);
|
|
14
|
+
}
|
|
15
|
+
}, [isCopied]);
|
|
16
|
+
const handleCopy = async () => {
|
|
17
|
+
if (!text)
|
|
18
|
+
return;
|
|
19
|
+
await navigator.clipboard.writeText(text);
|
|
20
|
+
setIsCopied(true);
|
|
21
|
+
};
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
23
|
+
"button",
|
|
24
|
+
{
|
|
25
|
+
onClick: async () => {
|
|
26
|
+
await handleCopy();
|
|
27
|
+
},
|
|
28
|
+
className: clsx(
|
|
29
|
+
"flex h-6 w-6 items-center justify-center rounded-md bg-white/30 text-white transition-all duration-300 hover:bg-white/20",
|
|
30
|
+
className
|
|
31
|
+
),
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
FaCheck,
|
|
35
|
+
{
|
|
36
|
+
className: `absolute h-4 w-4 transition-opacity duration-300 ${isCopied ? "opacity-100" : "opacity-0"}`
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
MdContentCopy,
|
|
41
|
+
{
|
|
42
|
+
className: `absolute h-4 w-4 transition-opacity duration-300 ${isCopied ? "opacity-0" : "opacity-100"}`
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
Clipboard
|
|
51
|
+
};
|
package/esm/Data/Item.js
CHANGED
|
@@ -65,10 +65,7 @@ function Item({
|
|
|
65
65
|
}) {
|
|
66
66
|
const { l } = usePage();
|
|
67
67
|
const strActions = actions.filter((action) => typeof action === "string").map((action, idx) => /* @__PURE__ */ jsx(Action, { action, outline: false, model, sliceName }, idx));
|
|
68
|
-
const customActions = actions.filter((action) => typeof action !== "string").map((action, idx) => ({
|
|
69
|
-
key: idx,
|
|
70
|
-
label: typeof action !== "string" ? action.render() : null
|
|
71
|
-
}));
|
|
68
|
+
const customActions = actions.filter((action) => typeof action !== "string").map((action, idx) => ({ key: idx, label: action }));
|
|
72
69
|
const extraCols = columns.filter((column) => {
|
|
73
70
|
const key = typeof column === "string" ? column : column.key;
|
|
74
71
|
return !["id", "status", "createdAt"].includes(key);
|
|
@@ -160,7 +157,7 @@ const Action = ({
|
|
|
160
157
|
children: /* @__PURE__ */ jsx("button", { className: `btn btn-square btn-ghost btn-sm m-1 text-center ${outline && "btn-outline border-dashed"}`, children: /* @__PURE__ */ jsx(AiOutlineDelete, {}) })
|
|
161
158
|
},
|
|
162
159
|
action
|
|
163
|
-
) : action
|
|
160
|
+
) : action;
|
|
164
161
|
};
|
|
165
162
|
const statusColors = {
|
|
166
163
|
active: "badge-info badge-outline",
|
|
@@ -31,19 +31,12 @@ function ListContainer({
|
|
|
31
31
|
title,
|
|
32
32
|
sort,
|
|
33
33
|
columns = ["id", "createdAt", "updatedAt"],
|
|
34
|
-
actions,
|
|
34
|
+
actions = ["remove", "edit", "view"],
|
|
35
35
|
tools = [],
|
|
36
36
|
renderDashboard,
|
|
37
37
|
renderItem,
|
|
38
38
|
renderTemplate,
|
|
39
|
-
renderTitle
|
|
40
|
-
sliceName,
|
|
41
|
-
" - ",
|
|
42
|
-
model.id
|
|
43
|
-
] }) : /* @__PURE__ */ jsxs("h2", { className: "flex items-center justify-center py-3 text-lg sm:justify-start md:text-2xl", children: [
|
|
44
|
-
"New ",
|
|
45
|
-
sliceName
|
|
46
|
-
] }),
|
|
39
|
+
renderTitle,
|
|
47
40
|
renderView,
|
|
48
41
|
renderQueryMaker = () => /* @__PURE__ */ jsx(Fragment, {}),
|
|
49
42
|
renderInsight,
|
|
@@ -52,7 +45,6 @@ function ListContainer({
|
|
|
52
45
|
const { l } = usePage();
|
|
53
46
|
const storeUse = st.use;
|
|
54
47
|
const storeDo = st.do;
|
|
55
|
-
const storeGet = st.get;
|
|
56
48
|
const refName = st.slice[sliceName].refName;
|
|
57
49
|
const [modelName, modelClassName] = [refName, capitalize(refName)];
|
|
58
50
|
if (refName !== sliceName)
|
|
@@ -85,6 +77,7 @@ function ListContainer({
|
|
|
85
77
|
const cnst = getCnstMeta(sliceName);
|
|
86
78
|
const limitOfModel = storeUse[namesOfSlice.limitOfModel]();
|
|
87
79
|
const sortOfModel = storeUse[namesOfSlice.sortOfModel]();
|
|
80
|
+
const RenderTitle = renderTitle ?? ((model) => `${l(`${refName}.modelName`)} - ${model.id ? model.id : "New"}`);
|
|
88
81
|
const ModelDashboard = () => {
|
|
89
82
|
const summary = storeUse.summary();
|
|
90
83
|
const summaryLoading = storeUse.summaryLoading();
|
|
@@ -234,11 +227,11 @@ ${body}`], { type: "text/csv;charset=utf-8" });
|
|
|
234
227
|
DataCardList,
|
|
235
228
|
{
|
|
236
229
|
sliceName,
|
|
237
|
-
renderItem: renderItem ?? (({ [sliceName]: model }) =>
|
|
230
|
+
renderItem: renderItem ?? (({ [sliceName]: model }) => null),
|
|
238
231
|
renderLoading,
|
|
239
232
|
renderTemplate,
|
|
240
233
|
renderView,
|
|
241
|
-
renderTitle,
|
|
234
|
+
renderTitle: RenderTitle,
|
|
242
235
|
columns,
|
|
243
236
|
actions,
|
|
244
237
|
cardListClassName
|
|
@@ -250,11 +243,11 @@ ${body}`], { type: "text/csv;charset=utf-8" });
|
|
|
250
243
|
sliceName,
|
|
251
244
|
actions,
|
|
252
245
|
renderTemplate,
|
|
253
|
-
renderTitle,
|
|
246
|
+
renderTitle: RenderTitle,
|
|
254
247
|
renderView
|
|
255
248
|
}
|
|
256
249
|
),
|
|
257
|
-
/* @__PURE__ */ jsx(Model.EditModal, { sliceName, renderTitle, children: RenderTemplate ? /* @__PURE__ */ jsx(RenderTemplate, {}) : null })
|
|
250
|
+
/* @__PURE__ */ jsx(Model.EditModal, { sliceName, renderTitle: RenderTitle, children: RenderTemplate ? /* @__PURE__ */ jsx(RenderTemplate, {}) : null })
|
|
258
251
|
] });
|
|
259
252
|
}
|
|
260
253
|
export {
|
package/esm/Data/QueryMaker.js
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
getFilterQuery,
|
|
10
10
|
getFilterQueryMap,
|
|
11
11
|
getGqlTypeStr,
|
|
12
|
-
getQueryMap,
|
|
13
12
|
hasTextField
|
|
14
13
|
} from "@akanjs/constant";
|
|
15
14
|
import { useDebounce, usePage } from "@akanjs/next";
|
|
@@ -27,9 +26,7 @@ function QueryMaker({ className, sliceName, query }) {
|
|
|
27
26
|
const storeDo = st.do;
|
|
28
27
|
const cnst = getCnstMeta(sliceName);
|
|
29
28
|
const isModelSearchable = hasTextField(cnst.Full);
|
|
30
|
-
const summaryRef = cnst.Summary;
|
|
31
29
|
const { subMenu, filter } = st.use.searchParams();
|
|
32
|
-
const summaryQueryMap = getQueryMap(summaryRef);
|
|
33
30
|
const filterRef = cnst.Filter;
|
|
34
31
|
const filterQueryMap = getFilterQueryMap(filterRef);
|
|
35
32
|
const defaultQuerySetting = { ...isModelSearchable ? searchQuerySetting : byStatusQuerySetting, ...query ?? {} };
|
|
@@ -37,12 +34,7 @@ function QueryMaker({ className, sliceName, query }) {
|
|
|
37
34
|
const [querySetting, setQuerySetting] = useState(defaultQuerySetting);
|
|
38
35
|
const getQuery = useCallback(
|
|
39
36
|
(querySetting2) => {
|
|
40
|
-
if (
|
|
41
|
-
const query2 = typeof summaryQueryMap[querySetting2.queryKey] === "function" ? summaryQueryMap[querySetting2.queryKey]() : summaryQueryMap[querySetting2.queryKey] ?? null;
|
|
42
|
-
if (!query2)
|
|
43
|
-
throw new Error(`Query not found`);
|
|
44
|
-
return query2;
|
|
45
|
-
} else if (querySetting2.queryKey === "search") {
|
|
37
|
+
if (querySetting2.queryKey === "search") {
|
|
46
38
|
const query2 = querySetting2.arg;
|
|
47
39
|
return query2;
|
|
48
40
|
} else {
|
|
@@ -77,8 +69,8 @@ function QueryMaker({ className, sliceName, query }) {
|
|
|
77
69
|
Select,
|
|
78
70
|
{
|
|
79
71
|
value: querySetting.queryKey,
|
|
80
|
-
options: Object.keys(
|
|
81
|
-
label: l.
|
|
72
|
+
options: Object.keys(filterQueryMap).map((queryKey) => ({
|
|
73
|
+
label: l.field("summary", queryKey),
|
|
82
74
|
value: queryKey
|
|
83
75
|
})),
|
|
84
76
|
onChange: (queryKey) => {
|
|
@@ -111,7 +103,7 @@ function QueryMaker({ className, sliceName, query }) {
|
|
|
111
103
|
),
|
|
112
104
|
/* @__PURE__ */ jsx(BiSearch, { className: "size-4 opacity-70" })
|
|
113
105
|
] })
|
|
114
|
-
] }) :
|
|
106
|
+
] }) : getFilterArgMetas(filterRef, querySetting.queryKey).map((queryArgMeta, idx) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
115
107
|
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: l.qarg(sliceName, querySetting.queryKey, queryArgMeta.name) }),
|
|
116
108
|
/* @__PURE__ */ jsx(
|
|
117
109
|
QueryArg,
|
package/esm/Layout/BottomTab.js
CHANGED
|
@@ -2,14 +2,21 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { clsx } from "@akanjs/client";
|
|
4
4
|
import { usePage } from "@akanjs/next";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
5
6
|
import { Link } from "../Link";
|
|
6
7
|
import { BottomInset } from "./BottomInset";
|
|
7
8
|
const BottomTab = ({ className, tabs, height = 64 }) => {
|
|
8
|
-
const { lang } = usePage();
|
|
9
|
+
const { lang, path } = usePage();
|
|
10
|
+
const [isRendered, setIsRendered] = useState(false);
|
|
9
11
|
const isActiveTab = (tabHref) => {
|
|
12
|
+
if (!isRendered)
|
|
13
|
+
return false;
|
|
10
14
|
const locationPath = window.location.pathname.startsWith(`/${lang}`) ? window.location.pathname.slice(lang.length + 1) === "" ? "/" : window.location.pathname.slice(lang.length + 1) : window.location.pathname;
|
|
11
15
|
return tabHref === "/" ? locationPath === tabHref : locationPath.startsWith(tabHref);
|
|
12
16
|
};
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
setIsRendered(true);
|
|
19
|
+
}, []);
|
|
13
20
|
return /* @__PURE__ */ jsx(BottomInset, { className: "h-full", children: /* @__PURE__ */ jsx(
|
|
14
21
|
"div",
|
|
15
22
|
{
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Data } from "../Data";
|
|
3
|
+
function AdminPanel({
|
|
4
|
+
sliceName,
|
|
5
|
+
components,
|
|
6
|
+
summaryColumns = ["totalAdmin"],
|
|
7
|
+
insightColumns = ["count"],
|
|
8
|
+
renderInsight = ({ insight }) => /* @__PURE__ */ jsx(Data.Insight, { insight, sliceName, columns: insightColumns }),
|
|
9
|
+
renderDashboard = ({ summary }) => /* @__PURE__ */ jsx(Data.Dashboard, { summary, sliceName, columns: summaryColumns, queryMap: {} }),
|
|
10
|
+
...props
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
Data.ListContainer,
|
|
14
|
+
{
|
|
15
|
+
sliceName,
|
|
16
|
+
renderItem: components.Unit.General,
|
|
17
|
+
renderInsight,
|
|
18
|
+
renderDashboard,
|
|
19
|
+
renderTemplate: components.Template.General,
|
|
20
|
+
renderView: (model) => /* @__PURE__ */ jsx(components.View.General, { ...{ [sliceName]: model } }),
|
|
21
|
+
...props
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
AdminPanel as default
|
|
27
|
+
};
|
package/esm/Model/index.js
CHANGED
package/esm/Model/index_.js
CHANGED
|
@@ -12,7 +12,9 @@ const ViewWrapper = lazy(() => import("./ViewWrapper"));
|
|
|
12
12
|
const ViewEditModal = lazy(() => import("./ViewEditModal"));
|
|
13
13
|
const Edit = lazy(() => import("./Edit"));
|
|
14
14
|
const New = lazy(() => import("./New"));
|
|
15
|
+
const AdminPanel = lazy(() => import("./AdminPanel"));
|
|
15
16
|
export {
|
|
17
|
+
AdminPanel,
|
|
16
18
|
Edit,
|
|
17
19
|
EditModal,
|
|
18
20
|
EditWrapper,
|
package/esm/Signal/Listener.js
CHANGED
|
@@ -10,9 +10,9 @@ const ListenerResult = ({ status, data }) => {
|
|
|
10
10
|
const dataStr = typeof data === "object" ? JSON.stringify(data, null, 2) : data;
|
|
11
11
|
const ref = useRef(null);
|
|
12
12
|
useEffect(() => {
|
|
13
|
-
if (ref.current)
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
if (!ref.current)
|
|
14
|
+
return;
|
|
15
|
+
ref.current.scrollTop = ref.current.scrollHeight;
|
|
16
16
|
}, [dataStr]);
|
|
17
17
|
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
18
18
|
/* @__PURE__ */ jsx(
|
package/esm/Signal/Message.js
CHANGED
|
@@ -136,7 +136,7 @@ const MessageTry = ({ sigRef, gqlMeta, gqlArgMetas, uploadArgMetas }) => {
|
|
|
136
136
|
const [uploadRequest, setUploadRequest] = useState({});
|
|
137
137
|
const [stopListen, setStopListen] = useState(null);
|
|
138
138
|
const [messages, setMessages] = useState("");
|
|
139
|
-
const [response, setResponse] = useState({ status: "ready", data:
|
|
139
|
+
const [response, setResponse] = useState({ status: "ready", data: "" });
|
|
140
140
|
const onSend = async () => {
|
|
141
141
|
const request = { ...JSON.parse(gqlRequest), ...uploadRequest };
|
|
142
142
|
const argData = [...gqlArgMetas, ...uploadArgMetas].sort((a, b) => a.idx - b.idx).map((argMeta) => request[argMeta.name]);
|
|
@@ -148,7 +148,7 @@ const MessageTry = ({ sigRef, gqlMeta, gqlArgMetas, uploadArgMetas }) => {
|
|
|
148
148
|
const request = { ...JSON.parse(gqlRequest), ...uploadRequest };
|
|
149
149
|
const fetchFn = fetch[`listen${capitalize(gqlMeta.key)}`].bind(fetch);
|
|
150
150
|
setResponse({ status: "loading", data: messages });
|
|
151
|
-
const stopListen2 = fetchFn((
|
|
151
|
+
const stopListen2 = fetchFn((data) => {
|
|
152
152
|
setMessages(
|
|
153
153
|
(prev) => typeof data === "boolean" ? data : typeof data === "string" ? `${prev}
|
|
154
154
|
${data}` : typeof data === "object" ? [...prev && prev.length ? [...prev] : [], data] : data
|
package/esm/Signal/PubSub.js
CHANGED
|
@@ -135,18 +135,15 @@ const PubSubTry = ({ sigRef, gqlMeta, gqlArgMetas, uploadArgMetas }) => {
|
|
|
135
135
|
const [gqlRequest, setGqlRequest] = useState(requestExample);
|
|
136
136
|
const [uploadRequest, setUploadRequest] = useState({});
|
|
137
137
|
const [unsubscribe, setUnsubscribe] = useState(null);
|
|
138
|
-
const [messages, setMessages] = useState(
|
|
139
|
-
const [response, setResponse] = useState({
|
|
140
|
-
status: "ready",
|
|
141
|
-
data: null
|
|
142
|
-
});
|
|
138
|
+
const [messages, setMessages] = useState("");
|
|
139
|
+
const [response, setResponse] = useState({ status: "ready", data: "" });
|
|
143
140
|
const onSubscribe = () => {
|
|
144
|
-
setResponse({ status: "loading", data:
|
|
141
|
+
setResponse({ status: "loading", data: "" });
|
|
145
142
|
const request = { ...JSON.parse(gqlRequest), ...uploadRequest };
|
|
146
143
|
const argData = [...gqlArgMetas, ...uploadArgMetas].sort((a, b) => a.idx - b.idx).map((argMeta) => request[argMeta.name]);
|
|
147
144
|
const fetchFn = fetch[`subscribe${capitalize(gqlMeta.key)}`].bind(fetch);
|
|
148
145
|
setResponse({ status: "loading", data: messages });
|
|
149
|
-
const unsubscribe2 = fetchFn(
|
|
146
|
+
const unsubscribe2 = fetchFn(...argData, (data) => {
|
|
150
147
|
setMessages(
|
|
151
148
|
(prev) => typeof data === "boolean" ? data : typeof data === "string" ? `${prev}
|
|
152
149
|
${data}` : typeof data === "object" ? [
|
package/esm/System/CSR.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { clsx, device, getPathInfo, router, useCsr } from "@akanjs/client";
|
|
4
|
+
import { serverTranslator } from "@akanjs/dictionary";
|
|
4
5
|
import { usePushNoti } from "@akanjs/next";
|
|
5
6
|
import { st } from "@akanjs/store";
|
|
6
7
|
import { animated } from "@akanjs/ui";
|
|
@@ -38,10 +39,11 @@ const CSRProvider = ({
|
|
|
38
39
|
of,
|
|
39
40
|
loader: async () => {
|
|
40
41
|
const { lang } = await params;
|
|
41
|
-
|
|
42
|
+
const dictionary = await serverTranslator.getDictionary(lang);
|
|
43
|
+
return { lang, dictionary };
|
|
42
44
|
},
|
|
43
|
-
render: ({ lang }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44
|
-
/* @__PURE__ */ jsx(Client.Wrapper, { theme, children: /* @__PURE__ */ jsx(
|
|
45
|
+
render: ({ lang, dictionary }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
46
|
+
/* @__PURE__ */ jsx(Client.Wrapper, { theme, lang, dictionary, children: /* @__PURE__ */ jsx(
|
|
45
47
|
CSRWrapper,
|
|
46
48
|
{
|
|
47
49
|
className,
|
package/esm/System/Client.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
clsx,
|
|
6
6
|
defaultPageState,
|
|
7
7
|
device,
|
|
8
|
+
dictionaryContext,
|
|
8
9
|
getPathInfo,
|
|
9
10
|
initAuth,
|
|
10
11
|
pathContext,
|
|
@@ -22,14 +23,18 @@ import { ThemeProvider, useTheme } from "next-themes";
|
|
|
22
23
|
import { useEffect, useState } from "react";
|
|
23
24
|
import { Gtag } from "./Gtag";
|
|
24
25
|
import { Messages } from "./Messages";
|
|
26
|
+
import { Reconnect } from "./Reconnect";
|
|
25
27
|
const Client = () => {
|
|
26
28
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
27
29
|
};
|
|
28
|
-
const ClientWrapper = ({ children, theme }) => {
|
|
30
|
+
const ClientWrapper = ({ children, theme, lang = "en", dictionary = {} }) => {
|
|
29
31
|
useEffect(() => {
|
|
30
32
|
Logger.rawLog(logo);
|
|
31
33
|
}, []);
|
|
32
|
-
return /* @__PURE__ */ jsx(ThemeProvider, { defaultTheme: theme, children
|
|
34
|
+
return /* @__PURE__ */ jsx(ThemeProvider, { defaultTheme: theme, children: /* @__PURE__ */ jsxs(dictionaryContext.Provider, { value: dictionary, children: [
|
|
35
|
+
children,
|
|
36
|
+
/* @__PURE__ */ jsx(Reconnect, {})
|
|
37
|
+
] }) });
|
|
33
38
|
};
|
|
34
39
|
Client.Wrapper = ClientWrapper;
|
|
35
40
|
const ClientPathWrapper = ({
|
package/esm/System/Common.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Fragment, jsx
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import "dayjs/locale/ko";
|
|
3
3
|
import { getAccount } from "@akanjs/client";
|
|
4
4
|
import { Load } from "../Load";
|
|
5
|
-
import { Reconnect } from "./Reconnect";
|
|
6
5
|
const Common = () => {
|
|
7
6
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
8
7
|
};
|
|
@@ -15,33 +14,30 @@ const CommonWrapper = ({
|
|
|
15
14
|
fetchSelf = (props) => fetch.getSelf?.(props)
|
|
16
15
|
}) => {
|
|
17
16
|
const account = getAccount();
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
),
|
|
43
|
-
/* @__PURE__ */ jsx(Reconnect, {})
|
|
44
|
-
] });
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
Load.Page,
|
|
19
|
+
{
|
|
20
|
+
of: CommonWrapper,
|
|
21
|
+
loader: async () => {
|
|
22
|
+
const mePromise = (async () => {
|
|
23
|
+
try {
|
|
24
|
+
return account.me ? await fetchMe({ crystalize: false }) : null;
|
|
25
|
+
} catch (e) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
})();
|
|
29
|
+
const selfPromise = (async () => {
|
|
30
|
+
try {
|
|
31
|
+
return account.self ? await fetchSelf({ crystalize: false }) : null;
|
|
32
|
+
} catch (e) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
})();
|
|
36
|
+
return Promise.resolve({ mePromise, selfPromise });
|
|
37
|
+
},
|
|
38
|
+
render
|
|
39
|
+
}
|
|
40
|
+
);
|
|
45
41
|
};
|
|
46
42
|
Common.Wrapper = CommonWrapper;
|
|
47
43
|
export {
|
package/esm/System/Reconnect.js
CHANGED
|
@@ -17,7 +17,7 @@ const Reconnect = () => {
|
|
|
17
17
|
setConnectStatus((prev) => prev === "normal" || prev === "initial" ? "disconnected" : prev);
|
|
18
18
|
setTimeout(() => {
|
|
19
19
|
setConnectStatus((prev) => prev === "disconnected" ? "connecting" : prev);
|
|
20
|
-
},
|
|
20
|
+
}, 2e3);
|
|
21
21
|
}, []);
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
const io = client.getIo();
|
package/esm/System/SSR.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { clsx, router } from "@akanjs/client";
|
|
3
|
+
import { serverTranslator } from "@akanjs/dictionary";
|
|
3
4
|
import { Suspense } from "react";
|
|
4
5
|
import { Load } from "../Load";
|
|
5
6
|
import { ClientBridge, ClientInner, ClientNextBridge, ClientPathWrapper, ClientWrapper } from "./Client";
|
|
@@ -31,11 +32,13 @@ const SSRProvider = ({
|
|
|
31
32
|
of,
|
|
32
33
|
loader: async () => {
|
|
33
34
|
const { lang } = await params;
|
|
35
|
+
await serverTranslator.init(lang);
|
|
34
36
|
if (!router.isInitialized)
|
|
35
37
|
router.init({ type: "next", side: "server", lang, prefix });
|
|
36
|
-
|
|
38
|
+
const dictionary = await serverTranslator.getDictionary(lang);
|
|
39
|
+
return { lang, dictionary };
|
|
37
40
|
},
|
|
38
|
-
render: ({ lang }) => /* @__PURE__ */ jsx(
|
|
41
|
+
render: ({ lang, dictionary }) => /* @__PURE__ */ jsx(
|
|
39
42
|
Common.Wrapper,
|
|
40
43
|
{
|
|
41
44
|
fetch,
|
|
@@ -53,7 +56,7 @@ const SSRProvider = ({
|
|
|
53
56
|
fonts,
|
|
54
57
|
prefix,
|
|
55
58
|
layoutStyle,
|
|
56
|
-
children: /* @__PURE__ */ jsxs(ClientWrapper, { theme, children: [
|
|
59
|
+
children: /* @__PURE__ */ jsxs(ClientWrapper, { theme, lang, dictionary, children: [
|
|
57
60
|
children,
|
|
58
61
|
/* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(ClientInner, {}) }),
|
|
59
62
|
/* @__PURE__ */ jsxs(Suspense, { fallback: null, children: [
|
|
@@ -16,7 +16,7 @@ const ThemeToggle = () => {
|
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
18
|
return /* @__PURE__ */ jsx("div", { className: "form-control", children: /* @__PURE__ */ jsxs("label", { className: "label cursor-pointer", children: [
|
|
19
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
19
|
+
/* @__PURE__ */ jsx("span", { className: "text-base-content mr-2 text-sm whitespace-nowrap", children: capitalize(theme ?? "") }),
|
|
20
20
|
/* @__PURE__ */ jsx("input", { type: "checkbox", className: "toggle toggle-sm", checked: theme === "dark", onChange: handleTheme })
|
|
21
21
|
] }) });
|
|
22
22
|
};
|
package/esm/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { BottomSheet } from "./BottomSheet";
|
|
|
12
12
|
import { Button } from "./Button";
|
|
13
13
|
import { ClientSide } from "./ClientSide";
|
|
14
14
|
import { Copy } from "./Copy";
|
|
15
|
+
import { Clipboard } from "./Clipboard";
|
|
15
16
|
import { CsrImage } from "./CsrImage";
|
|
16
17
|
import { DatePicker } from "./DatePicker";
|
|
17
18
|
import { DragAction } from "./DragAction";
|
|
@@ -44,6 +45,7 @@ export {
|
|
|
44
45
|
BottomSheet,
|
|
45
46
|
Button,
|
|
46
47
|
ClientSide,
|
|
48
|
+
Clipboard,
|
|
47
49
|
Copy,
|
|
48
50
|
CsrImage,
|
|
49
51
|
Data,
|