@akanjs/ui 0.9.48 → 0.9.50
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/Data/CardList.d.ts +1 -1
- package/Data/ListContainer.d.ts +4 -5
- package/Data/QueryMaker.d.ts +1 -1
- package/Data/TableList.d.ts +1 -1
- package/Data/index.d.ts +0 -1
- package/Field.d.ts +1 -1
- package/Layout/Navbar.d.ts +1 -1
- package/Model/AdminPanel.d.ts +2 -3
- package/System/CSR.d.ts +2 -2
- package/System/Client.d.ts +4 -2
- package/System/Common.d.ts +10 -9
- package/System/SSR.d.ts +2 -2
- package/cjs/Button.js +3 -4
- package/cjs/Data/Dashboard.js +1 -2
- package/cjs/Data/Insight.js +1 -2
- package/cjs/Data/Item.js +3 -4
- package/cjs/Data/ListContainer.js +5 -19
- package/cjs/Data/QueryMaker.js +1 -292
- package/cjs/Data/TableList.js +3 -3
- package/cjs/Data/index.js +2 -2
- package/cjs/DatePicker.js +4 -5
- package/cjs/Dialog/Modal.js +2 -3
- package/cjs/Empty.js +2 -3
- package/cjs/Field.js +42 -46
- package/cjs/Input.js +11 -12
- package/cjs/Layout/BottomTab.js +1 -2
- package/cjs/Link/CsrLink.js +1 -2
- package/cjs/Link/NextLink.js +1 -2
- package/cjs/Load/Page.js +1 -2
- package/cjs/Load/Units.js +4 -3
- package/cjs/Load/View.js +3 -2
- package/cjs/Model/Edit.js +2 -3
- package/cjs/Model/EditModal.js +5 -4
- package/cjs/Model/New.js +2 -3
- package/cjs/Model/NewWrapper_Client.js +3 -2
- package/cjs/Model/Remove.js +6 -8
- package/cjs/Model/RemoveWrapper.js +3 -4
- package/cjs/Model/SureToRemove.js +8 -10
- package/cjs/Model/ViewEditModal.js +4 -4
- package/cjs/Popconfirm.js +3 -4
- package/cjs/RecentTime.js +1 -2
- package/cjs/Select.js +2 -2
- package/cjs/Signal/Arg.js +2 -2
- package/cjs/Signal/Doc.js +2 -2
- package/cjs/Signal/GraphQL.js +4 -4
- package/cjs/Signal/Message.js +2 -4
- package/cjs/Signal/Object.js +12 -17
- package/cjs/Signal/PubSub.js +2 -4
- package/cjs/Signal/RestApi.js +2 -2
- package/cjs/System/CSR.js +3 -6
- package/cjs/System/Client.js +18 -7
- package/cjs/System/Common.js +2 -2
- package/cjs/System/Messages.js +2 -4
- package/cjs/System/Reconnect.js +16 -21
- package/cjs/System/Root.js +0 -4
- package/cjs/System/SSR.js +30 -24
- package/cjs/System/SelectLanguage.js +1 -2
- package/cjs/ToggleSelect.js +4 -5
- package/cjs/Unauthorized.js +2 -3
- package/esm/Button.js +3 -4
- package/esm/Data/Dashboard.js +1 -2
- package/esm/Data/Insight.js +1 -2
- package/esm/Data/Item.js +2 -3
- package/esm/Data/ListContainer.js +6 -20
- package/esm/Data/QueryMaker.js +1 -299
- package/esm/Data/TableList.js +2 -2
- package/esm/Data/index.js +3 -3
- package/esm/DatePicker.js +5 -6
- package/esm/Dialog/Modal.js +2 -3
- package/esm/Empty.js +2 -3
- package/esm/Field.js +30 -34
- package/esm/Input.js +7 -8
- package/esm/Layout/BottomTab.js +1 -2
- package/esm/Link/CsrLink.js +1 -2
- package/esm/Link/NextLink.js +1 -2
- package/esm/Load/Page.js +1 -2
- package/esm/Load/Units.js +4 -3
- package/esm/Load/View.js +3 -2
- package/esm/Model/Edit.js +2 -3
- package/esm/Model/EditModal.js +8 -7
- package/esm/Model/New.js +2 -3
- package/esm/Model/NewWrapper_Client.js +3 -2
- package/esm/Model/Remove.js +6 -8
- package/esm/Model/RemoveWrapper.js +3 -4
- package/esm/Model/SureToRemove.js +8 -10
- package/esm/Model/ViewEditModal.js +3 -3
- package/esm/Popconfirm.js +3 -4
- package/esm/RecentTime.js +1 -2
- package/esm/Select.js +3 -3
- package/esm/Signal/Arg.js +1 -1
- package/esm/Signal/Doc.js +1 -1
- package/esm/Signal/GraphQL.js +4 -4
- package/esm/Signal/Message.js +1 -3
- package/esm/Signal/Object.js +13 -18
- package/esm/Signal/PubSub.js +1 -3
- package/esm/Signal/RestApi.js +1 -1
- package/esm/System/CSR.js +3 -6
- package/esm/System/Client.js +22 -12
- package/esm/System/Common.js +2 -2
- package/esm/System/Messages.js +1 -3
- package/esm/System/Reconnect.js +15 -10
- package/esm/System/Root.js +0 -4
- package/esm/System/SSR.js +30 -24
- package/esm/System/SelectLanguage.js +1 -2
- package/esm/ToggleSelect.js +3 -4
- package/esm/Unauthorized.js +2 -3
- package/package.json +1 -1
package/cjs/System/Reconnect.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var Reconnect_exports = {};
|
|
30
20
|
__export(Reconnect_exports, {
|
|
@@ -32,36 +22,41 @@ __export(Reconnect_exports, {
|
|
|
32
22
|
});
|
|
33
23
|
module.exports = __toCommonJS(Reconnect_exports);
|
|
34
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_client = require("@akanjs/client");
|
|
35
26
|
var import_next = require("@akanjs/next");
|
|
36
27
|
var import_signal = require("@akanjs/signal");
|
|
37
|
-
var import_clsx = __toESM(require("clsx"));
|
|
38
28
|
var import_react = require("react");
|
|
39
29
|
var import_tb = require("react-icons/tb");
|
|
40
30
|
const DOTS_LENGTH = 4;
|
|
41
31
|
const Reconnect = () => {
|
|
42
|
-
const { l } = (0,
|
|
32
|
+
const { l } = (0, import_client.usePage)();
|
|
43
33
|
const [dots, setDots] = (0, import_react.useState)(0);
|
|
44
34
|
const [connectStatus, setConnectStatus] = (0, import_react.useState)("initial");
|
|
45
35
|
const handleConnect = (0, import_react.useCallback)(() => {
|
|
46
36
|
setConnectStatus((prev) => prev === "normal" || prev === "initial" ? prev : "connected");
|
|
47
37
|
}, []);
|
|
48
|
-
const handleDisconnect =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
38
|
+
const handleDisconnect = async () => {
|
|
39
|
+
try {
|
|
40
|
+
const ping = await fetch(`/backend/ping`);
|
|
41
|
+
await ping.json();
|
|
42
|
+
} catch (e) {
|
|
43
|
+
setConnectStatus((prev) => prev === "normal" || prev === "initial" ? "disconnected" : prev);
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
setConnectStatus((prev) => prev === "disconnected" ? "connecting" : prev);
|
|
46
|
+
}, 2e3);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
54
49
|
(0, import_react.useEffect)(() => {
|
|
55
50
|
const io = import_signal.client.getIo();
|
|
56
51
|
io.socket.on("connect", handleConnect);
|
|
57
|
-
io.socket.on("disconnect", handleDisconnect);
|
|
52
|
+
io.socket.on("disconnect", () => handleDisconnect());
|
|
58
53
|
setTimeout(() => {
|
|
59
54
|
if (connectStatus !== "initial")
|
|
60
55
|
return;
|
|
61
56
|
if (import_signal.client.getIo().socket.connected)
|
|
62
57
|
setConnectStatus("normal");
|
|
63
58
|
else
|
|
64
|
-
handleDisconnect();
|
|
59
|
+
void handleDisconnect();
|
|
65
60
|
}, 1e3);
|
|
66
61
|
return () => {
|
|
67
62
|
io.socket.off("connect", handleConnect);
|
|
@@ -95,7 +90,7 @@ const Reconnect = () => {
|
|
|
95
90
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
91
|
"div",
|
|
97
92
|
{
|
|
98
|
-
className: (0,
|
|
93
|
+
className: (0, import_client.clsx)(
|
|
99
94
|
"mt-2 text-center text-sm leading-tight text-gray-500",
|
|
100
95
|
connectStatus === "disconnected" || connectStatus === "connecting" ? "visible" : "invisible"
|
|
101
96
|
),
|
package/cjs/System/Root.js
CHANGED
|
@@ -22,10 +22,6 @@ __export(Root_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(Root_exports);
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
var import_base = require("@akanjs/base");
|
|
26
|
-
var import_dictionary = require("@akanjs/dictionary");
|
|
27
25
|
const Root = ({ children, st }) => {
|
|
28
|
-
if (import_base.baseEnv.operationMode === "local")
|
|
29
|
-
(0, import_dictionary.checkDictCoverage)();
|
|
30
26
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
31
27
|
};
|
package/cjs/System/SSR.js
CHANGED
|
@@ -23,7 +23,6 @@ __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");
|
|
27
26
|
var import_react = require("react");
|
|
28
27
|
var import_Load = require("../Load");
|
|
29
28
|
var import_Client = require("./Client");
|
|
@@ -38,7 +37,6 @@ const SSRProvider = ({
|
|
|
38
37
|
head,
|
|
39
38
|
env,
|
|
40
39
|
gaTrackingId,
|
|
41
|
-
fetch,
|
|
42
40
|
children,
|
|
43
41
|
theme,
|
|
44
42
|
prefix,
|
|
@@ -56,13 +54,11 @@ const SSRProvider = ({
|
|
|
56
54
|
of,
|
|
57
55
|
loader: async () => {
|
|
58
56
|
const { lang } = await params;
|
|
59
|
-
await import_dictionary.serverTranslator.init(lang);
|
|
60
57
|
if (!import_client.router.isInitialized)
|
|
61
58
|
import_client.router.init({ type: "next", side: "server", lang, prefix });
|
|
62
|
-
|
|
63
|
-
return { lang, dictionary };
|
|
59
|
+
return { lang };
|
|
64
60
|
},
|
|
65
|
-
render: ({ lang
|
|
61
|
+
render: ({ lang }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
62
|
import_Common.Common.Wrapper,
|
|
67
63
|
{
|
|
68
64
|
fetch,
|
|
@@ -80,24 +76,34 @@ const SSRProvider = ({
|
|
|
80
76
|
fonts,
|
|
81
77
|
prefix,
|
|
82
78
|
layoutStyle,
|
|
83
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
79
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
80
|
+
import_Client.ClientWrapper,
|
|
81
|
+
{
|
|
82
|
+
theme,
|
|
83
|
+
lang,
|
|
84
|
+
dictionary: global.dictionary[lang],
|
|
85
|
+
signals: global.signals,
|
|
86
|
+
reconnect,
|
|
87
|
+
children: [
|
|
88
|
+
children,
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Client.ClientInner, {}) }),
|
|
90
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Suspense, { fallback: null, children: [
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
92
|
+
import_Client.ClientBridge,
|
|
93
|
+
{
|
|
94
|
+
env,
|
|
95
|
+
mePromise,
|
|
96
|
+
selfPromise,
|
|
97
|
+
theme,
|
|
98
|
+
prefix,
|
|
99
|
+
gaTrackingId
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Client.ClientNextBridge, { lang, prefix })
|
|
103
|
+
] })
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
)
|
|
101
107
|
}
|
|
102
108
|
)
|
|
103
109
|
}
|
|
@@ -23,7 +23,6 @@ __export(SelectLanguage_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(SelectLanguage_exports);
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_client = require("@akanjs/client");
|
|
26
|
-
var import_next = require("@akanjs/next");
|
|
27
26
|
var import_react = require("react");
|
|
28
27
|
const languageNames = {
|
|
29
28
|
en: "English",
|
|
@@ -32,7 +31,7 @@ const languageNames = {
|
|
|
32
31
|
zhCht: "\u7E41\u9AD4\u4E2D\u6587"
|
|
33
32
|
};
|
|
34
33
|
const SelectLanguage = ({ className, languages = ["en", "ko"] }) => {
|
|
35
|
-
const { l, lang } = (0,
|
|
34
|
+
const { l, lang } = (0, import_client.usePage)();
|
|
36
35
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
37
36
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative", children: [
|
|
38
37
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
package/cjs/ToggleSelect.js
CHANGED
|
@@ -22,7 +22,6 @@ __export(ToggleSelect_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(ToggleSelect_exports);
|
|
23
23
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
24
|
var import_client = require("@akanjs/client");
|
|
25
|
-
var import_next = require("@akanjs/next");
|
|
26
25
|
const ToggleSelect = ({
|
|
27
26
|
className,
|
|
28
27
|
btnClassName,
|
|
@@ -33,9 +32,9 @@ const ToggleSelect = ({
|
|
|
33
32
|
onChange,
|
|
34
33
|
disabled
|
|
35
34
|
}) => {
|
|
36
|
-
const { l } = (0,
|
|
35
|
+
const { l } = (0, import_client.usePage)();
|
|
37
36
|
const validateResult = value ? validate(value) : false;
|
|
38
|
-
const invalidMessage = value === null || typeof value === "string" && !value.length || validateResult === true ? null : validateResult === false ? l("
|
|
37
|
+
const invalidMessage = value === null || typeof value === "string" && !value.length || validateResult === true ? null : validateResult === false ? l("base.invalidValueError") : validateResult;
|
|
39
38
|
const options = items.map(
|
|
40
39
|
(item) => typeof item === "string" ? { label: item, value: item } : item
|
|
41
40
|
);
|
|
@@ -76,9 +75,9 @@ const ToggleSelect = ({
|
|
|
76
75
|
);
|
|
77
76
|
};
|
|
78
77
|
const Multi = ({ className, btnClassName, items, nullable, validate, value, onChange, disabled }) => {
|
|
79
|
-
const { l } = (0,
|
|
78
|
+
const { l } = (0, import_client.usePage)();
|
|
80
79
|
const validateResult = validate(value);
|
|
81
|
-
const invalidMessage = !value.length || validateResult === true ? null : validateResult === false ? l("
|
|
80
|
+
const invalidMessage = !value.length || validateResult === true ? null : validateResult === false ? l("base.invalidValueError") : validateResult;
|
|
82
81
|
const options = items.map(
|
|
83
82
|
(item) => typeof item === "string" ? { label: item, value: item } : item
|
|
84
83
|
);
|
package/cjs/Unauthorized.js
CHANGED
|
@@ -22,10 +22,9 @@ __export(Unauthorized_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(Unauthorized_exports);
|
|
23
23
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
24
|
var import_client = require("@akanjs/client");
|
|
25
|
-
var import_next = require("@akanjs/next");
|
|
26
25
|
var import_ai = require("react-icons/ai");
|
|
27
26
|
const Unauthorized = ({ className = "", description, children, minHeight = 300 }) => {
|
|
28
|
-
const { l } = (0,
|
|
27
|
+
const { l } = (0, import_client.usePage)();
|
|
29
28
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
30
29
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
31
30
|
"div",
|
|
@@ -36,7 +35,7 @@ const Unauthorized = ({ className = "", description, children, minHeight = 300 }
|
|
|
36
35
|
),
|
|
37
36
|
children: [
|
|
38
37
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ai.AiOutlineBlock, { className: "scale-150 text-4xl" }),
|
|
39
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: description ?? l("
|
|
38
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: description ?? l("base.unauthorized") })
|
|
40
39
|
]
|
|
41
40
|
}
|
|
42
41
|
),
|
package/esm/Button.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { clsx } from "@akanjs/client";
|
|
4
|
-
import { usePage } from "@akanjs/next";
|
|
3
|
+
import { clsx, usePage } from "@akanjs/client";
|
|
5
4
|
import { useState } from "react";
|
|
6
5
|
import { AiOutlineCheckCircle } from "react-icons/ai";
|
|
7
6
|
const Button = ({ className, children, onClick, onSuccess, ...rest }) => {
|
|
@@ -36,11 +35,11 @@ const Button = ({ className, children, onClick, onSuccess, ...rest }) => {
|
|
|
36
35
|
children: state.mode === "loading" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
37
36
|
/* @__PURE__ */ jsx("span", { className: "loading loading-bars loading-md" }),
|
|
38
37
|
" ",
|
|
39
|
-
l("
|
|
38
|
+
l("base.processing")
|
|
40
39
|
] }) : state.mode === "success" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
41
40
|
/* @__PURE__ */ jsx(AiOutlineCheckCircle, {}),
|
|
42
41
|
" ",
|
|
43
|
-
l("
|
|
42
|
+
l("base.processed")
|
|
44
43
|
] }) : children
|
|
45
44
|
}
|
|
46
45
|
),
|
package/esm/Data/Dashboard.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { clsx } from "@akanjs/client";
|
|
3
|
+
import { clsx, usePage } from "@akanjs/client";
|
|
4
4
|
import { capitalize } from "@akanjs/common";
|
|
5
|
-
import { usePage } from "@akanjs/next";
|
|
6
5
|
import { st } from "@akanjs/store";
|
|
7
6
|
import { Link } from "../Link";
|
|
8
7
|
function Dashboard({
|
package/esm/Data/Insight.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { clsx } from "@akanjs/client";
|
|
4
|
-
import { usePage } from "@akanjs/next";
|
|
3
|
+
import { clsx, usePage } from "@akanjs/client";
|
|
5
4
|
import { st } from "@akanjs/store";
|
|
6
5
|
function Insight({
|
|
7
6
|
className,
|
package/esm/Data/Item.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { clsx } from "@akanjs/client";
|
|
3
|
+
import { clsx, usePage } from "@akanjs/client";
|
|
4
4
|
import { capitalize } from "@akanjs/common";
|
|
5
|
-
import { usePage } from "@akanjs/next";
|
|
6
5
|
import { st } from "@akanjs/store";
|
|
7
6
|
import { AiOutlineDelete, AiOutlineEdit, AiOutlineEye, AiOutlineMore } from "react-icons/ai";
|
|
8
7
|
import { Dropdown } from "../Dropdown";
|
|
@@ -152,7 +151,7 @@ const Action = ({
|
|
|
152
151
|
) : action === "remove" ? /* @__PURE__ */ jsx(
|
|
153
152
|
Popconfirm,
|
|
154
153
|
{
|
|
155
|
-
title: l("
|
|
154
|
+
title: l("base.removeMsg"),
|
|
156
155
|
onConfirm: () => void storeDo[namesOfSlice.removeModel](model.id),
|
|
157
156
|
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, {}) })
|
|
158
157
|
},
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { clsx } from "@akanjs/client";
|
|
3
|
+
import { clsx, usePage } from "@akanjs/client";
|
|
4
4
|
import { capitalize, deepObjectify } from "@akanjs/common";
|
|
5
|
-
import {
|
|
6
|
-
import { usePage } from "@akanjs/next";
|
|
5
|
+
import { constantInfo } from "@akanjs/constant";
|
|
7
6
|
import { st } from "@akanjs/store";
|
|
8
7
|
import { saveAs } from "file-saver";
|
|
9
8
|
import {
|
|
@@ -18,7 +17,6 @@ import { Loading } from "../Loading";
|
|
|
18
17
|
import { Model } from "../Model";
|
|
19
18
|
import { Select } from "../Select";
|
|
20
19
|
import DataCardList from "./CardList";
|
|
21
|
-
import QueryMaker from "./QueryMaker";
|
|
22
20
|
import DataTableList from "./TableList";
|
|
23
21
|
function ListContainer({
|
|
24
22
|
className,
|
|
@@ -74,7 +72,7 @@ function ListContainer({
|
|
|
74
72
|
setSortOfModel: sliceName.replace(names.model, names.setSortOfModel),
|
|
75
73
|
setLimitOfModel: sliceName.replace(names.model, names.setLimitOfModel)
|
|
76
74
|
};
|
|
77
|
-
const
|
|
75
|
+
const cnstInfo = constantInfo.getDatabase(sliceName);
|
|
78
76
|
const limitOfModel = storeUse[namesOfSlice.limitOfModel]();
|
|
79
77
|
const sortOfModel = storeUse[namesOfSlice.sortOfModel]();
|
|
80
78
|
const RenderTitle = renderTitle ?? ((model) => `${l(`${refName}.modelName`)} - ${model.id ? model.id : "New"}`);
|
|
@@ -163,18 +161,7 @@ ${body}`], { type: "text/csv;charset=utf-8" });
|
|
|
163
161
|
);
|
|
164
162
|
};
|
|
165
163
|
const RenderSort = () => {
|
|
166
|
-
|
|
167
|
-
return /* @__PURE__ */ jsx(
|
|
168
|
-
Select,
|
|
169
|
-
{
|
|
170
|
-
value: sortOfModel,
|
|
171
|
-
options: Object.keys(sortMap).map((sortKey) => ({
|
|
172
|
-
label: l.field(sliceName, sortKey),
|
|
173
|
-
value: sortKey
|
|
174
|
-
})),
|
|
175
|
-
onChange: (sortKey) => void storeDo[namesOfSlice.setSortOfModel](sortKey)
|
|
176
|
-
}
|
|
177
|
-
);
|
|
164
|
+
return null;
|
|
178
165
|
};
|
|
179
166
|
return /* @__PURE__ */ jsxs("div", { className: clsx("m-4", className), children: [
|
|
180
167
|
/* @__PURE__ */ jsxs("div", { className: "mb-3 flex flex-wrap justify-between", children: [
|
|
@@ -189,7 +176,7 @@ ${body}`], { type: "text/csv;charset=utf-8" });
|
|
|
189
176
|
children: [
|
|
190
177
|
/* @__PURE__ */ jsx(AiOutlinePlus, {}),
|
|
191
178
|
" ",
|
|
192
|
-
l("
|
|
179
|
+
l("base.new")
|
|
193
180
|
]
|
|
194
181
|
}
|
|
195
182
|
) : null,
|
|
@@ -211,7 +198,7 @@ ${body}`], { type: "text/csv;charset=utf-8" });
|
|
|
211
198
|
{
|
|
212
199
|
value: limitOfModel,
|
|
213
200
|
options: [10, 20, 50, 100].map((limit) => ({
|
|
214
|
-
label: `${limit} ${l("
|
|
201
|
+
label: `${limit} ${l("base.perPage")}`,
|
|
215
202
|
value: limit
|
|
216
203
|
})),
|
|
217
204
|
onChange: (limit) => void storeDo[namesOfSlice.setLimitOfModel](limit)
|
|
@@ -220,7 +207,6 @@ ${body}`], { type: "text/csv;charset=utf-8" });
|
|
|
220
207
|
] })
|
|
221
208
|
] }),
|
|
222
209
|
!query && /* @__PURE__ */ jsx(ModelDashboard, {}),
|
|
223
|
-
/* @__PURE__ */ jsx(QueryMaker, { className: "mb-4", sliceName, query }),
|
|
224
210
|
/* @__PURE__ */ jsx(RenderQueryMaker, {}),
|
|
225
211
|
/* @__PURE__ */ jsx(RenderInsight, {}),
|
|
226
212
|
type === "card" ? /* @__PURE__ */ jsx(
|