@akanjs/ui 0.0.150 → 0.0.152
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/BottomSheet.d.ts +13 -0
- package/Button.d.ts +9 -0
- package/ClientSide.d.ts +6 -0
- package/Copy.d.ts +6 -0
- package/CsrImage.d.ts +11 -0
- package/Data/CardList.d.ts +36 -0
- package/Data/Dashboard.d.ts +15 -0
- package/Data/Insight.d.ts +8 -0
- package/Data/Item.d.ts +74 -0
- package/Data/ListContainer.d.ts +38 -0
- package/Data/Pagination.d.ts +6 -0
- package/Data/QueryMaker.d.ts +9 -0
- package/Data/TableList.d.ts +26 -0
- package/Data/index.d.ts +10 -0
- package/Data/index_.d.ts +8 -0
- package/DatePicker.d.ts +37 -0
- package/Dialog/Action.d.ts +5 -0
- package/Dialog/Close.d.ts +5 -0
- package/Dialog/Content.d.ts +6 -0
- package/Dialog/Modal.d.ts +8 -0
- package/Dialog/Provider.d.ts +7 -0
- package/Dialog/Title.d.ts +5 -0
- package/Dialog/Trigger.d.ts +5 -0
- package/Dialog/context.d.ts +10 -0
- package/Dialog/index.d.ts +9 -0
- package/DragAction.d.ts +24 -0
- package/DraggableList.d.ts +25 -0
- package/Dropdown.d.ts +10 -0
- package/Empty.d.ts +9 -0
- package/Field.d.ts +404 -0
- package/FontFace.d.ts +6 -0
- package/Image.d.ts +17 -0
- package/InfiniteScroll.d.ts +10 -0
- package/Input.d.ts +85 -0
- package/KeyboardAvoiding.d.ts +7 -0
- package/Layout/BottomAction.d.ts +5 -0
- package/Layout/BottomInset.d.ts +6 -0
- package/Layout/BottomTab.d.ts +14 -0
- package/Layout/Header.d.ts +7 -0
- package/Layout/LeftSider.d.ts +8 -0
- package/Layout/Navbar.d.ts +11 -0
- package/Layout/RightSider.d.ts +9 -0
- package/Layout/Sider.d.ts +6 -0
- package/Layout/Template.d.ts +5 -0
- package/Layout/TopLeftAction.d.ts +5 -0
- package/Layout/Unit.d.ts +6 -0
- package/Layout/View.d.ts +5 -0
- package/Layout/Zone.d.ts +5 -0
- package/Layout/index.d.ts +14 -0
- package/Link/Back.d.ts +6 -0
- package/Link/Close.d.ts +6 -0
- package/Link/CsrLink.d.ts +2 -0
- package/Link/NextLink.d.ts +2 -0
- package/Link/index.d.ts +8 -0
- package/Link/types.d.ts +22 -0
- package/Load/Edit.d.ts +4 -0
- package/Load/Edit_Client.d.ts +25 -0
- package/Load/Page.d.ts +10 -0
- package/Load/PageCSR.d.ts +11 -0
- package/Load/Pagination.d.ts +8 -0
- package/Load/Units.d.ts +34 -0
- package/Load/View.d.ts +17 -0
- package/Load/index.d.ts +8 -0
- package/Load/index_.d.ts +3 -0
- package/Loading/Area.d.ts +1 -0
- package/Loading/Button.d.ts +7 -0
- package/Loading/Input.d.ts +7 -0
- package/Loading/ProgressBar.d.ts +6 -0
- package/Loading/Skeleton.d.ts +7 -0
- package/Loading/Spin.d.ts +7 -0
- package/Loading/index.d.ts +8 -0
- package/Menu.d.ts +26 -0
- package/Modal.d.ts +23 -0
- package/Model/Edit.d.ts +15 -0
- package/Model/EditModal.d.ts +33 -0
- package/Model/EditWrapper.d.ts +11 -0
- package/Model/LoadInit.d.ts +10 -0
- package/Model/New.d.ts +15 -0
- package/Model/NewWrapper.d.ts +12 -0
- package/Model/NewWrapper_Client.d.ts +12 -0
- package/Model/Remove.d.ts +10 -0
- package/Model/RemoveWrapper.d.ts +11 -0
- package/Model/SureToRemove.d.ts +10 -0
- package/Model/View.d.ts +19 -0
- package/Model/ViewEditModal.d.ts +11 -0
- package/Model/ViewModal.d.ts +13 -0
- package/Model/ViewWrapper.d.ts +11 -0
- package/Model/index.d.ts +15 -0
- package/Model/index_.d.ts +13 -0
- package/More.d.ts +12 -0
- package/ObjectId.d.ts +5 -0
- package/Pagination.d.ts +14 -0
- package/Popconfirm.d.ts +18 -0
- package/Portal.d.ts +6 -0
- package/Radio.d.ts +19 -0
- package/RecentTime.d.ts +7 -0
- package/Refresh.d.ts +7 -0
- package/ScreenNavigator.d.ts +18 -0
- package/Select.d.ts +29 -0
- package/Signal/Arg.d.ts +75 -0
- package/Signal/Doc.d.ts +19 -0
- package/Signal/GraphQL.d.ts +31 -0
- package/Signal/Listener.d.ts +9 -0
- package/Signal/Message.d.ts +26 -0
- package/Signal/Object.d.ts +19 -0
- package/Signal/PubSub.d.ts +26 -0
- package/Signal/Request.d.ts +8 -0
- package/Signal/Response.d.ts +16 -0
- package/Signal/RestApi.d.ts +39 -0
- package/Signal/WebSocket.d.ts +9 -0
- package/Signal/index.d.ts +20 -0
- package/System/CSR.d.ts +31 -0
- package/System/Client.d.ts +48 -0
- package/System/Common.d.ts +66 -0
- package/System/DevModeToggle.d.ts +1 -0
- package/System/Gtag.d.ts +3 -0
- package/System/HealthCheck.d.ts +5 -0
- package/System/Messages.d.ts +1 -0
- package/System/Reconnect.d.ts +6 -0
- package/System/Root.d.ts +5 -0
- package/System/SSR.d.ts +26 -0
- package/System/SelectLanguage.d.ts +5 -0
- package/System/ThemeToggle.d.ts +1 -0
- package/System/index.d.ts +11 -0
- package/Tab/Menu.d.ts +11 -0
- package/Tab/Menus.d.ts +5 -0
- package/Tab/Panel.d.ts +7 -0
- package/Tab/Provider.d.ts +6 -0
- package/Tab/context.d.ts +9 -0
- package/Tab/index.d.ts +7 -0
- package/Table.d.ts +26 -0
- package/ToggleSelect.d.ts +31 -0
- package/Unauthorized.d.ts +9 -0
- package/cjs/BottomSheet.js +109 -0
- package/cjs/Button.js +71 -0
- package/cjs/ClientSide.js +27 -0
- package/cjs/Copy.js +38 -0
- package/cjs/CsrImage.js +51 -0
- package/cjs/Data/CardList.js +127 -0
- package/cjs/Data/Dashboard.js +64 -0
- package/cjs/Data/Insight.js +42 -0
- package/cjs/Data/Item.js +219 -0
- package/cjs/Data/ListContainer.js +285 -0
- package/cjs/Data/Pagination.js +65 -0
- package/cjs/Data/QueryMaker.js +326 -0
- package/cjs/Data/TableList.js +150 -0
- package/cjs/Data/index.js +33 -0
- package/cjs/Data/index_.js +49 -0
- package/cjs/DatePicker.js +178 -0
- package/cjs/Dialog/Action.js +32 -0
- package/cjs/Dialog/Close.js +39 -0
- package/cjs/Dialog/Content.js +28 -0
- package/cjs/Dialog/Modal.js +166 -0
- package/cjs/Dialog/Provider.js +47 -0
- package/cjs/Dialog/Title.js +32 -0
- package/cjs/Dialog/Trigger.js +39 -0
- package/cjs/Dialog/context.js +32 -0
- package/cjs/Dialog/index.js +37 -0
- package/cjs/DragAction.js +112 -0
- package/cjs/DraggableList.js +142 -0
- package/cjs/Dropdown.js +67 -0
- package/cjs/Empty.js +45 -0
- package/cjs/Field.js +1231 -0
- package/cjs/FontFace.js +77 -0
- package/cjs/Image.js +62 -0
- package/cjs/InfiniteScroll.js +70 -0
- package/cjs/Input.js +457 -0
- package/cjs/KeyboardAvoiding.js +66 -0
- package/cjs/Layout/BottomAction.js +27 -0
- package/cjs/Layout/BottomInset.js +54 -0
- package/cjs/Layout/BottomTab.js +62 -0
- package/cjs/Layout/Header.js +56 -0
- package/cjs/Layout/LeftSider.js +52 -0
- package/cjs/Layout/Navbar.js +45 -0
- package/cjs/Layout/RightSider.js +58 -0
- package/cjs/Layout/Sider.js +52 -0
- package/cjs/Layout/Template.js +27 -0
- package/cjs/Layout/TopLeftAction.js +40 -0
- package/cjs/Layout/Unit.js +28 -0
- package/cjs/Layout/View.js +27 -0
- package/cjs/Layout/Zone.js +27 -0
- package/cjs/Layout/index.js +48 -0
- package/cjs/Link/Back.js +28 -0
- package/cjs/Link/Close.js +37 -0
- package/cjs/Link/CsrLink.js +50 -0
- package/cjs/Link/NextLink.js +72 -0
- package/cjs/Link/index.js +48 -0
- package/cjs/{src/index.js → Link/types.js} +2 -10
- package/cjs/Load/Edit.js +43 -0
- package/cjs/Load/Edit_Client.js +94 -0
- package/cjs/Load/Page.js +35 -0
- package/cjs/Load/PageCSR.js +68 -0
- package/cjs/Load/Pagination.js +90 -0
- package/cjs/Load/Units.js +239 -0
- package/cjs/Load/View.js +89 -0
- package/cjs/Load/index.js +42 -0
- package/cjs/Load/index_.js +39 -0
- package/cjs/Loading/Area.js +29 -0
- package/cjs/Loading/Button.js +34 -0
- package/cjs/Loading/Input.js +34 -0
- package/cjs/Loading/ProgressBar.js +30 -0
- package/cjs/Loading/Skeleton.js +33 -0
- package/cjs/Loading/Spin.js +28 -0
- package/cjs/Loading/index.js +29 -0
- package/cjs/Menu.js +231 -0
- package/cjs/Modal.js +88 -0
- package/cjs/Model/Edit.js +67 -0
- package/cjs/Model/EditModal.js +253 -0
- package/cjs/Model/EditWrapper.js +49 -0
- package/cjs/Model/LoadInit.js +28 -0
- package/cjs/Model/New.js +67 -0
- package/cjs/Model/NewWrapper.js +29 -0
- package/cjs/Model/NewWrapper_Client.js +67 -0
- package/cjs/Model/Remove.js +92 -0
- package/cjs/Model/RemoveWrapper.js +49 -0
- package/cjs/Model/SureToRemove.js +125 -0
- package/cjs/Model/View.js +54 -0
- package/cjs/Model/ViewEditModal.js +129 -0
- package/cjs/Model/ViewModal.js +93 -0
- package/cjs/Model/ViewWrapper.js +49 -0
- package/cjs/Model/index.js +38 -0
- package/cjs/Model/index_.js +58 -0
- package/cjs/More.js +71 -0
- package/cjs/ObjectId.js +41 -0
- package/cjs/Pagination.js +115 -0
- package/cjs/Popconfirm.js +124 -0
- package/cjs/Portal.js +27 -0
- package/cjs/Radio.js +57 -0
- package/cjs/RecentTime.js +87 -0
- package/cjs/Refresh.js +46 -0
- package/cjs/ScreenNavigator.js +122 -0
- package/cjs/Select.js +283 -0
- package/cjs/Signal/Arg.js +277 -0
- package/cjs/Signal/Doc.js +258 -0
- package/cjs/Signal/GraphQL.js +261 -0
- package/cjs/Signal/Listener.js +66 -0
- package/cjs/Signal/Message.js +276 -0
- package/cjs/Signal/Object.js +131 -0
- package/cjs/Signal/PubSub.js +273 -0
- package/cjs/Signal/Request.js +45 -0
- package/cjs/Signal/Response.js +66 -0
- package/cjs/Signal/RestApi.js +357 -0
- package/cjs/Signal/WebSocket.js +69 -0
- package/cjs/Signal/index.js +42 -0
- package/cjs/System/CSR.js +395 -0
- package/cjs/System/Client.js +204 -0
- package/cjs/System/Common.js +68 -0
- package/cjs/System/DevModeToggle.js +42 -0
- package/cjs/System/Gtag.js +71 -0
- package/cjs/System/HealthCheck.js +61 -0
- package/cjs/System/Messages.js +173 -0
- package/cjs/System/Reconnect.js +86 -0
- package/cjs/System/Root.js +31 -0
- package/cjs/System/SSR.js +162 -0
- package/cjs/System/SelectLanguage.js +62 -0
- package/cjs/System/ThemeToggle.js +44 -0
- package/cjs/System/index.js +56 -0
- package/cjs/Tab/Menu.js +71 -0
- package/cjs/Tab/Menus.js +27 -0
- package/cjs/Tab/Panel.js +43 -0
- package/cjs/Tab/Provider.js +32 -0
- package/cjs/Tab/context.js +30 -0
- package/cjs/Tab/index.js +33 -0
- package/cjs/Table.js +84 -0
- package/cjs/ToggleSelect.js +123 -0
- package/cjs/Unauthorized.js +45 -0
- package/cjs/index.js +88 -2
- package/esm/BottomSheet.js +90 -0
- package/esm/Button.js +52 -0
- package/esm/ClientSide.js +8 -0
- package/esm/Copy.js +19 -0
- package/esm/CsrImage.js +32 -0
- package/esm/Data/CardList.js +98 -0
- package/esm/Data/Dashboard.js +45 -0
- package/esm/Data/Insight.js +23 -0
- package/esm/Data/Item.js +200 -0
- package/esm/Data/ListContainer.js +262 -0
- package/esm/Data/Pagination.js +46 -0
- package/esm/Data/QueryMaker.js +315 -0
- package/esm/Data/TableList.js +121 -0
- package/esm/Data/index.js +14 -0
- package/esm/Data/index_.js +20 -0
- package/esm/DatePicker.js +149 -0
- package/esm/Dialog/Action.js +13 -0
- package/esm/Dialog/Close.js +20 -0
- package/esm/Dialog/Content.js +9 -0
- package/esm/Dialog/Modal.js +137 -0
- package/esm/Dialog/Provider.js +18 -0
- package/esm/Dialog/Title.js +13 -0
- package/esm/Dialog/Trigger.js +20 -0
- package/esm/Dialog/context.js +13 -0
- package/esm/Dialog/index.js +18 -0
- package/esm/DragAction.js +93 -0
- package/esm/DraggableList.js +113 -0
- package/esm/Dropdown.js +48 -0
- package/esm/Empty.js +26 -0
- package/esm/Field.js +1212 -0
- package/esm/FontFace.js +58 -0
- package/esm/Image.js +33 -0
- package/esm/InfiniteScroll.js +51 -0
- package/esm/Input.js +442 -0
- package/esm/KeyboardAvoiding.js +47 -0
- package/esm/Layout/BottomAction.js +8 -0
- package/esm/Layout/BottomInset.js +35 -0
- package/esm/Layout/BottomTab.js +43 -0
- package/esm/Layout/Header.js +37 -0
- package/esm/Layout/LeftSider.js +33 -0
- package/esm/Layout/Navbar.js +26 -0
- package/esm/Layout/RightSider.js +39 -0
- package/esm/Layout/Sider.js +33 -0
- package/esm/Layout/Template.js +8 -0
- package/esm/Layout/TopLeftAction.js +21 -0
- package/esm/Layout/Unit.js +9 -0
- package/esm/Layout/View.js +8 -0
- package/esm/Layout/Zone.js +8 -0
- package/esm/Layout/index.js +29 -0
- package/esm/Link/Back.js +9 -0
- package/esm/Link/Close.js +18 -0
- package/esm/Link/CsrLink.js +31 -0
- package/esm/Link/NextLink.js +43 -0
- package/esm/Link/index.js +19 -0
- package/esm/Link/types.js +0 -0
- package/esm/Load/Edit.js +14 -0
- package/esm/Load/Edit_Client.js +75 -0
- package/esm/Load/Page.js +16 -0
- package/esm/Load/PageCSR.js +49 -0
- package/esm/Load/Pagination.js +71 -0
- package/esm/Load/Units.js +220 -0
- package/esm/Load/View.js +70 -0
- package/esm/Load/index.js +13 -0
- package/esm/Load/index_.js +10 -0
- package/esm/Loading/Area.js +10 -0
- package/esm/Loading/Button.js +15 -0
- package/esm/Loading/Input.js +15 -0
- package/esm/Loading/ProgressBar.js +11 -0
- package/esm/Loading/Skeleton.js +14 -0
- package/esm/Loading/Spin.js +9 -0
- package/esm/Loading/index.js +10 -0
- package/esm/Menu.js +212 -0
- package/esm/Modal.js +59 -0
- package/esm/Model/Edit.js +38 -0
- package/esm/Model/EditModal.js +234 -0
- package/esm/Model/EditWrapper.js +30 -0
- package/esm/Model/LoadInit.js +9 -0
- package/esm/Model/New.js +38 -0
- package/esm/Model/NewWrapper.js +10 -0
- package/esm/Model/NewWrapper_Client.js +48 -0
- package/esm/Model/Remove.js +73 -0
- package/esm/Model/RemoveWrapper.js +30 -0
- package/esm/Model/SureToRemove.js +106 -0
- package/esm/Model/View.js +35 -0
- package/esm/Model/ViewEditModal.js +100 -0
- package/esm/Model/ViewModal.js +64 -0
- package/esm/Model/ViewWrapper.js +30 -0
- package/esm/Model/index.js +33 -0
- package/esm/Model/index_.js +29 -0
- package/esm/More.js +42 -0
- package/esm/ObjectId.js +22 -0
- package/esm/Pagination.js +96 -0
- package/esm/Popconfirm.js +105 -0
- package/esm/Portal.js +8 -0
- package/esm/Radio.js +38 -0
- package/esm/RecentTime.js +58 -0
- package/esm/Refresh.js +17 -0
- package/esm/ScreenNavigator.js +103 -0
- package/esm/Select.js +264 -0
- package/esm/Signal/Arg.js +248 -0
- package/esm/Signal/Doc.js +229 -0
- package/esm/Signal/GraphQL.js +240 -0
- package/esm/Signal/Listener.js +47 -0
- package/esm/Signal/Message.js +247 -0
- package/esm/Signal/Object.js +112 -0
- package/esm/Signal/PubSub.js +244 -0
- package/esm/Signal/Request.js +26 -0
- package/esm/Signal/Response.js +47 -0
- package/esm/Signal/RestApi.js +336 -0
- package/esm/Signal/WebSocket.js +40 -0
- package/esm/Signal/index.js +13 -0
- package/esm/System/CSR.js +376 -0
- package/esm/System/Client.js +195 -0
- package/esm/System/Common.js +49 -0
- package/esm/System/DevModeToggle.js +23 -0
- package/esm/System/Gtag.js +52 -0
- package/esm/System/HealthCheck.js +42 -0
- package/esm/System/Messages.js +159 -0
- package/esm/System/Reconnect.js +67 -0
- package/esm/System/Root.js +12 -0
- package/esm/System/SSR.js +143 -0
- package/esm/System/SelectLanguage.js +43 -0
- package/esm/System/ThemeToggle.js +25 -0
- package/esm/System/index.js +27 -0
- package/esm/Tab/Menu.js +52 -0
- package/esm/Tab/Menus.js +8 -0
- package/esm/Tab/Panel.js +24 -0
- package/esm/Tab/Provider.js +13 -0
- package/esm/Tab/context.js +11 -0
- package/esm/Tab/index.js +14 -0
- package/esm/Table.js +65 -0
- package/esm/ToggleSelect.js +104 -0
- package/esm/Unauthorized.js +26 -0
- package/esm/index.js +84 -1
- package/index.d.ts +41 -1
- package/package.json +23 -2
- package/esm/src/index.js +0 -4
- package/src/index.d.ts +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { AiOutlineMeh } from "react-icons/ai";
|
|
5
|
+
function View({
|
|
6
|
+
className,
|
|
7
|
+
model,
|
|
8
|
+
modelLoading = true,
|
|
9
|
+
render,
|
|
10
|
+
loadingWrapper,
|
|
11
|
+
loading,
|
|
12
|
+
empty
|
|
13
|
+
}) {
|
|
14
|
+
const RenderLoadingWrapper = useMemo(
|
|
15
|
+
() => loadingWrapper === null ? ({ children, className: className2 }) => children : loadingWrapper ?? (({ children, className: className2 }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16
|
+
children,
|
|
17
|
+
modelLoading ? /* @__PURE__ */ jsx("div", { className: "absolute inset-0 animate-pulse" }) : null
|
|
18
|
+
] })),
|
|
19
|
+
[modelLoading]
|
|
20
|
+
);
|
|
21
|
+
const RenderModel = useMemo(
|
|
22
|
+
() => modelLoading ? loading === null ? () => null : loading ?? (() => /* @__PURE__ */ jsxs("div", { className: "flex size-full flex-col items-center justify-center gap-3 pt-6 pb-3", children: [
|
|
23
|
+
/* @__PURE__ */ jsx("span", { className: "loading loading-dots loading-lg" }),
|
|
24
|
+
"Loading"
|
|
25
|
+
] })) : model ? () => render(model) : empty === null ? () => null : empty ?? (() => /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col items-center justify-center gap-3 pt-6 pb-3", children: [
|
|
26
|
+
/* @__PURE__ */ jsx(AiOutlineMeh, { className: "scale-150 text-4xl" }),
|
|
27
|
+
" Empty"
|
|
28
|
+
] })),
|
|
29
|
+
[model, modelLoading]
|
|
30
|
+
);
|
|
31
|
+
return /* @__PURE__ */ jsx(RenderLoadingWrapper, { className, children: /* @__PURE__ */ jsx(RenderModel, {}) });
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
View as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { capitalize } from "@akanjs/common";
|
|
4
|
+
import { usePage } from "@akanjs/next";
|
|
5
|
+
import { st } from "@akanjs/store";
|
|
6
|
+
import { AiOutlineEdit, AiOutlineSave } from "react-icons/ai";
|
|
7
|
+
import { BiDotsVertical } from "react-icons/bi";
|
|
8
|
+
import { Modal } from "../Modal";
|
|
9
|
+
import Remove from "./Remove";
|
|
10
|
+
import View from "./View";
|
|
11
|
+
function ViewEditModal({
|
|
12
|
+
modalClassName,
|
|
13
|
+
viewClassName,
|
|
14
|
+
sliceName,
|
|
15
|
+
renderTitle,
|
|
16
|
+
renderView,
|
|
17
|
+
renderTemplate
|
|
18
|
+
}) {
|
|
19
|
+
const { l } = usePage();
|
|
20
|
+
const storeUse = st.use;
|
|
21
|
+
const storeDo = st.do;
|
|
22
|
+
const storeSel = st.sel;
|
|
23
|
+
const refName = st.slice[sliceName].refName;
|
|
24
|
+
const [modelName, ModelName] = [refName, capitalize(refName)];
|
|
25
|
+
const names = {
|
|
26
|
+
model: modelName,
|
|
27
|
+
Model: ModelName,
|
|
28
|
+
viewModel: `view${ModelName}`,
|
|
29
|
+
modelLoading: `${modelName}Loading`,
|
|
30
|
+
modelModal: `${modelName}Modal`,
|
|
31
|
+
resetModel: `reset${ModelName}`,
|
|
32
|
+
editModel: `edit${ModelName}`,
|
|
33
|
+
submitModel: `submit${ModelName}`,
|
|
34
|
+
modelForm: `${modelName}Form`
|
|
35
|
+
};
|
|
36
|
+
const model = storeUse[names.model]();
|
|
37
|
+
const modelModal = storeUse[names.modelModal]();
|
|
38
|
+
const modelLoading = storeUse[names.modelLoading]();
|
|
39
|
+
const modelFormId = storeSel((state) => state[names.modelForm].id);
|
|
40
|
+
const isModalOpen = modelModal === "view" || modelModal === "edit" && !!modelFormId;
|
|
41
|
+
const Title = () => {
|
|
42
|
+
if (!model || modelLoading || !renderTitle)
|
|
43
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
44
|
+
const render = renderTitle(model);
|
|
45
|
+
if (typeof render === "string")
|
|
46
|
+
return /* @__PURE__ */ jsx("h2", { className: "flex items-center text-sm md:text-base lg:text-lg xl:text-2xl", children: render });
|
|
47
|
+
else
|
|
48
|
+
return render;
|
|
49
|
+
};
|
|
50
|
+
const Template = renderTemplate;
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
Modal,
|
|
53
|
+
{
|
|
54
|
+
open: isModalOpen,
|
|
55
|
+
onCancel: () => {
|
|
56
|
+
storeDo[names.resetModel]();
|
|
57
|
+
},
|
|
58
|
+
className: modalClassName,
|
|
59
|
+
title: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between", children: [
|
|
60
|
+
/* @__PURE__ */ jsx(Title, {}),
|
|
61
|
+
/* @__PURE__ */ jsxs("div", { className: "dropdown dropdown-end", children: [
|
|
62
|
+
/* @__PURE__ */ jsx("label", { tabIndex: 0, className: "btn btn-square m-1", children: /* @__PURE__ */ jsx(BiDotsVertical, {}) }),
|
|
63
|
+
/* @__PURE__ */ jsx("ul", { tabIndex: 0, className: "dropdown-content menu bg-base-100 rounded-box z-[1] p-2 shadow-sm", children: model ? /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Remove, { sliceName, modelId: model.id, modal: null }) }) : null })
|
|
64
|
+
] })
|
|
65
|
+
] }),
|
|
66
|
+
action: modelModal === "view" ? /* @__PURE__ */ jsxs(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
className: "btn btn-primary w-full",
|
|
70
|
+
onClick: () => {
|
|
71
|
+
if (model)
|
|
72
|
+
storeDo[names.editModel](model.id);
|
|
73
|
+
},
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ jsx(AiOutlineEdit, {}),
|
|
76
|
+
" ",
|
|
77
|
+
l("shared.edit")
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
) : /* @__PURE__ */ jsxs(
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
className: "btn btn-primary w-full",
|
|
84
|
+
onClick: () => {
|
|
85
|
+
storeDo[names.submitModel]({ sliceName, modal: "view" });
|
|
86
|
+
},
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsx(AiOutlineSave, {}),
|
|
89
|
+
" ",
|
|
90
|
+
l("shared.save")
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
children: modelModal === "view" ? /* @__PURE__ */ jsx(View, { className: viewClassName, model, modelLoading, render: renderView }) : modelModal === "edit" ? /* @__PURE__ */ jsx(Template, {}) : null
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
ViewEditModal as default
|
|
100
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { capitalize } from "@akanjs/common";
|
|
4
|
+
import { st } from "@akanjs/store";
|
|
5
|
+
import { Modal } from "../Modal";
|
|
6
|
+
import View from "./View";
|
|
7
|
+
function ViewModal({
|
|
8
|
+
id,
|
|
9
|
+
modal,
|
|
10
|
+
modalClassName,
|
|
11
|
+
viewClassName,
|
|
12
|
+
sliceName,
|
|
13
|
+
renderTitle,
|
|
14
|
+
renderAction,
|
|
15
|
+
renderView
|
|
16
|
+
}) {
|
|
17
|
+
const storeUse = st.use;
|
|
18
|
+
const storeDo = st.do;
|
|
19
|
+
const refName = st.slice[sliceName].refName;
|
|
20
|
+
const [modelName, ModelName] = [refName, capitalize(refName)];
|
|
21
|
+
const names = {
|
|
22
|
+
model: modelName,
|
|
23
|
+
Model: ModelName,
|
|
24
|
+
viewModel: `view${ModelName}`,
|
|
25
|
+
modelLoading: `${modelName}Loading`,
|
|
26
|
+
modelModal: `${modelName}Modal`,
|
|
27
|
+
resetModel: `reset${ModelName}`
|
|
28
|
+
};
|
|
29
|
+
const model = storeUse[names.model]();
|
|
30
|
+
const modelModal = storeUse[names.modelModal]();
|
|
31
|
+
const modelLoading = storeUse[names.modelLoading]();
|
|
32
|
+
const isModalOpen = modelModal === (modal ?? "view") && (modelLoading === id || model?.id === id);
|
|
33
|
+
const Title = () => {
|
|
34
|
+
if (!model || modelLoading || !renderTitle)
|
|
35
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
36
|
+
const render = renderTitle(model);
|
|
37
|
+
if (typeof render === "string")
|
|
38
|
+
return /* @__PURE__ */ jsx("h2", { className: "flex items-center text-2xl", children: render });
|
|
39
|
+
else
|
|
40
|
+
return render;
|
|
41
|
+
};
|
|
42
|
+
const Action = () => {
|
|
43
|
+
if (!model || modelLoading || !renderAction)
|
|
44
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
45
|
+
const render = renderAction(model);
|
|
46
|
+
return render;
|
|
47
|
+
};
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
Modal,
|
|
50
|
+
{
|
|
51
|
+
open: isModalOpen,
|
|
52
|
+
onCancel: () => {
|
|
53
|
+
storeDo[names.resetModel]();
|
|
54
|
+
},
|
|
55
|
+
className: modalClassName,
|
|
56
|
+
title: /* @__PURE__ */ jsx(Title, {}),
|
|
57
|
+
action: /* @__PURE__ */ jsx(Action, {}),
|
|
58
|
+
children: /* @__PURE__ */ jsx(View, { className: viewClassName, model, modelLoading, render: renderView })
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
ViewModal as default
|
|
64
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { clsx } from "@akanjs/client";
|
|
4
|
+
import { capitalize } from "@akanjs/common";
|
|
5
|
+
import { st } from "@akanjs/store";
|
|
6
|
+
function ViewWrapper({ children, sliceName, modelId, className, modal, resets }) {
|
|
7
|
+
const refName = st.slice[sliceName].refName;
|
|
8
|
+
const modelName = refName;
|
|
9
|
+
const names = {
|
|
10
|
+
viewModel: `view${capitalize(modelName)}`
|
|
11
|
+
};
|
|
12
|
+
const storeDo = st.do;
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
className: clsx("cursor-pointer", className),
|
|
17
|
+
onClick: (e) => {
|
|
18
|
+
e.stopPropagation();
|
|
19
|
+
void storeDo[names.viewModel](modelId, { modal });
|
|
20
|
+
resets?.forEach((reset) => {
|
|
21
|
+
void storeDo[`reset${capitalize(reset)}`]();
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
children
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
ViewWrapper as default
|
|
30
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Edit,
|
|
3
|
+
EditModal,
|
|
4
|
+
EditWrapper,
|
|
5
|
+
LoadInit,
|
|
6
|
+
New,
|
|
7
|
+
NewWrapper,
|
|
8
|
+
Remove,
|
|
9
|
+
RemoveWrapper,
|
|
10
|
+
SureToRemove,
|
|
11
|
+
View,
|
|
12
|
+
ViewEditModal,
|
|
13
|
+
ViewModal,
|
|
14
|
+
ViewWrapper
|
|
15
|
+
} from "./index_";
|
|
16
|
+
const Model = {
|
|
17
|
+
ViewModal,
|
|
18
|
+
View,
|
|
19
|
+
EditModal,
|
|
20
|
+
EditWrapper,
|
|
21
|
+
NewWrapper,
|
|
22
|
+
SureToRemove,
|
|
23
|
+
Remove,
|
|
24
|
+
RemoveWrapper,
|
|
25
|
+
LoadInit,
|
|
26
|
+
ViewWrapper,
|
|
27
|
+
ViewEditModal,
|
|
28
|
+
Edit,
|
|
29
|
+
New
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
Model
|
|
33
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { lazy } from "@akanjs/next";
|
|
2
|
+
const ViewModal = lazy(() => import("./ViewModal"));
|
|
3
|
+
const EditModal = lazy(() => import("./EditModal"));
|
|
4
|
+
const View = lazy(() => import("./View"));
|
|
5
|
+
const SureToRemove = lazy(() => import("./SureToRemove"));
|
|
6
|
+
const Remove = lazy(() => import("./Remove"));
|
|
7
|
+
const NewWrapper = lazy(() => import("./NewWrapper"));
|
|
8
|
+
const EditWrapper = lazy(() => import("./EditWrapper"));
|
|
9
|
+
const RemoveWrapper = lazy(() => import("./RemoveWrapper"));
|
|
10
|
+
const LoadInit = lazy(() => import("./LoadInit"));
|
|
11
|
+
const ViewWrapper = lazy(() => import("./ViewWrapper"));
|
|
12
|
+
const ViewEditModal = lazy(() => import("./ViewEditModal"));
|
|
13
|
+
const Edit = lazy(() => import("./Edit"));
|
|
14
|
+
const New = lazy(() => import("./New"));
|
|
15
|
+
export {
|
|
16
|
+
Edit,
|
|
17
|
+
EditModal,
|
|
18
|
+
EditWrapper,
|
|
19
|
+
LoadInit,
|
|
20
|
+
New,
|
|
21
|
+
NewWrapper,
|
|
22
|
+
Remove,
|
|
23
|
+
RemoveWrapper,
|
|
24
|
+
SureToRemove,
|
|
25
|
+
View,
|
|
26
|
+
ViewEditModal,
|
|
27
|
+
ViewModal,
|
|
28
|
+
ViewWrapper
|
|
29
|
+
};
|
package/esm/More.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { clsx } from "@akanjs/client";
|
|
4
|
+
import dynamic from "next/dynamic";
|
|
5
|
+
import { isMobile } from "react-device-detect";
|
|
6
|
+
import { Pagination } from "./Pagination";
|
|
7
|
+
const InfiniteScroll = dynamic(() => import("./InfiniteScroll").then((mod) => mod.InfiniteScroll), { ssr: false });
|
|
8
|
+
const More = ({
|
|
9
|
+
total,
|
|
10
|
+
itemsPerPage,
|
|
11
|
+
currentPage,
|
|
12
|
+
onAddPage,
|
|
13
|
+
onPageSelect,
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
reverse
|
|
17
|
+
}) => {
|
|
18
|
+
if (total <= itemsPerPage) {
|
|
19
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
20
|
+
}
|
|
21
|
+
if (isMobile) {
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
InfiniteScroll,
|
|
24
|
+
{
|
|
25
|
+
total,
|
|
26
|
+
currentPage,
|
|
27
|
+
itemsPerPage,
|
|
28
|
+
onAddPage,
|
|
29
|
+
onPageSelect,
|
|
30
|
+
reverse,
|
|
31
|
+
children
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
|
+
children,
|
|
37
|
+
/* @__PURE__ */ jsx("div", { className: clsx("mt-4 flex w-full flex-wrap justify-center", className), children: /* @__PURE__ */ jsx(Pagination, { currentPage, total, itemsPerPage, onPageSelect }) })
|
|
38
|
+
] });
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
More
|
|
42
|
+
};
|
package/esm/ObjectId.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { AiOutlineCheck, AiOutlineCopy } from "react-icons/ai";
|
|
5
|
+
const ObjectId = ({ id }) => {
|
|
6
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
7
|
+
const shortenedId = `${id.substring(0, 4)}...${id.substring(id.length - 5)}`;
|
|
8
|
+
const handleCopyClick = () => {
|
|
9
|
+
void navigator.clipboard.writeText(id);
|
|
10
|
+
setIsCopied(true);
|
|
11
|
+
setTimeout(() => {
|
|
12
|
+
setIsCopied(false);
|
|
13
|
+
}, 2e3);
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
16
|
+
/* @__PURE__ */ jsx("div", { className: "tooltip tooltip-primary", "data-tip": id, children: /* @__PURE__ */ jsx("div", { className: "text-xs font-semibold", children: shortenedId }) }),
|
|
17
|
+
/* @__PURE__ */ jsx("button", { className: "btn btn-circle btn-xs", onClick: handleCopyClick, children: isCopied ? /* @__PURE__ */ jsx(AiOutlineCheck, {}) : /* @__PURE__ */ jsx(AiOutlineCopy, {}) })
|
|
18
|
+
] });
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
ObjectId
|
|
22
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { clsx } from "@akanjs/client";
|
|
4
|
+
import { BiChevronLeft, BiChevronRight, BiDotsHorizontalRounded } from "react-icons/bi";
|
|
5
|
+
const Pagination = ({
|
|
6
|
+
currentPage,
|
|
7
|
+
total,
|
|
8
|
+
onPageSelect,
|
|
9
|
+
itemsPerPage,
|
|
10
|
+
renderEmpty,
|
|
11
|
+
classNames
|
|
12
|
+
}) => {
|
|
13
|
+
const totalPages = Math.ceil(total / (itemsPerPage || 1));
|
|
14
|
+
const handleLeftClick = () => {
|
|
15
|
+
if (currentPage <= 1)
|
|
16
|
+
return;
|
|
17
|
+
onPageSelect(currentPage - 1);
|
|
18
|
+
};
|
|
19
|
+
const handleRightClick = () => {
|
|
20
|
+
if (currentPage >= totalPages)
|
|
21
|
+
return;
|
|
22
|
+
onPageSelect(currentPage + 1);
|
|
23
|
+
};
|
|
24
|
+
const pageNumbers = new Array(totalPages).fill("").map((_, i) => {
|
|
25
|
+
return String(i + 1);
|
|
26
|
+
});
|
|
27
|
+
let displayNumbers = pageNumbers;
|
|
28
|
+
if (totalPages > 10) {
|
|
29
|
+
if (currentPage < 5) {
|
|
30
|
+
displayNumbers = pageNumbers.slice(0, 5).concat(["...", String(totalPages)]);
|
|
31
|
+
} else if (currentPage >= 5 && currentPage <= totalPages - 4) {
|
|
32
|
+
displayNumbers = [
|
|
33
|
+
"1",
|
|
34
|
+
"...",
|
|
35
|
+
...pageNumbers.slice(Number(currentPage) - 3, Number(currentPage) + 2),
|
|
36
|
+
"...",
|
|
37
|
+
String(totalPages)
|
|
38
|
+
];
|
|
39
|
+
} else {
|
|
40
|
+
displayNumbers = ["1", "...", ...pageNumbers.slice(-5)];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: total > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
className: clsx(
|
|
48
|
+
"btn btn-ghost btn-square duration-200",
|
|
49
|
+
currentPage > 1 ? "opacity-100" : "opacity-0 hover:cursor-default hover:opacity-0"
|
|
50
|
+
),
|
|
51
|
+
onClick: handleLeftClick,
|
|
52
|
+
children: /* @__PURE__ */ jsx(BiChevronLeft, {})
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
displayNumbers.map((pageNum, index) => {
|
|
56
|
+
if (pageNum === "...") {
|
|
57
|
+
return /* @__PURE__ */ jsx("button", { className: "btn btn-ghost btn-square text-primary/40", children: /* @__PURE__ */ jsx(BiDotsHorizontalRounded, {}) }, index);
|
|
58
|
+
}
|
|
59
|
+
if (Number(pageNum) === currentPage) {
|
|
60
|
+
return /* @__PURE__ */ jsx(
|
|
61
|
+
"button",
|
|
62
|
+
{
|
|
63
|
+
className: clsx("btn btn-ghost btn-square text-primary", classNames?.activePageNumClassName),
|
|
64
|
+
children: pageNum
|
|
65
|
+
},
|
|
66
|
+
index
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
70
|
+
"button",
|
|
71
|
+
{
|
|
72
|
+
className: clsx("btn btn-ghost btn-square text-primary/40", classNames?.pageNumClassName),
|
|
73
|
+
onClick: () => {
|
|
74
|
+
onPageSelect(Number(pageNum));
|
|
75
|
+
},
|
|
76
|
+
children: pageNum
|
|
77
|
+
},
|
|
78
|
+
index
|
|
79
|
+
);
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ jsx(
|
|
82
|
+
"button",
|
|
83
|
+
{
|
|
84
|
+
className: clsx(
|
|
85
|
+
"btn btn-ghost btn-square duration-200",
|
|
86
|
+
currentPage < totalPages ? "opacity-100" : "opacity-0 hover:cursor-default hover:opacity-0"
|
|
87
|
+
),
|
|
88
|
+
onClick: handleRightClick,
|
|
89
|
+
children: /* @__PURE__ */ jsx(BiChevronRight, {})
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
] }) });
|
|
93
|
+
};
|
|
94
|
+
export {
|
|
95
|
+
Pagination
|
|
96
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//! 디자인 수정, 테마 적용 안됨
|
|
4
|
+
import { clsx } from "@akanjs/client";
|
|
5
|
+
import { usePage } from "@akanjs/next";
|
|
6
|
+
import { animated, useSpring } from "@react-spring/web";
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import { BiMessageRoundedError } from "react-icons/bi";
|
|
9
|
+
const Popconfirm = ({
|
|
10
|
+
title,
|
|
11
|
+
description,
|
|
12
|
+
onConfirm,
|
|
13
|
+
okButtonProps,
|
|
14
|
+
cancelButtonProps,
|
|
15
|
+
okText,
|
|
16
|
+
cancelText,
|
|
17
|
+
children,
|
|
18
|
+
triggerClassName,
|
|
19
|
+
decoClassName
|
|
20
|
+
}) => {
|
|
21
|
+
const { l } = usePage();
|
|
22
|
+
const [isConfirming, setIsConfirming] = useState(false);
|
|
23
|
+
const popconfirmProps = useSpring({
|
|
24
|
+
opacity: isConfirming ? 1 : 0,
|
|
25
|
+
from: {
|
|
26
|
+
opacity: 0
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const popconfirm = document.querySelector(".popconfirm");
|
|
31
|
+
const popconfirmRect = popconfirm?.getBoundingClientRect();
|
|
32
|
+
const popconfirmDeco = document.querySelector(".popconfirm-deco");
|
|
33
|
+
if (popconfirmRect && popconfirmRect.x < 0) {
|
|
34
|
+
popconfirm?.classList.add("left-0", "right-auto");
|
|
35
|
+
popconfirmDeco?.classList.add("left-10", "left-auto");
|
|
36
|
+
}
|
|
37
|
+
if (popconfirmRect && popconfirmRect.x + popconfirmRect.width > window.innerWidth) {
|
|
38
|
+
popconfirm?.classList.add("left-auto", "right-0");
|
|
39
|
+
}
|
|
40
|
+
}, [isConfirming]);
|
|
41
|
+
const handleConfirm = () => {
|
|
42
|
+
setIsConfirming(false);
|
|
43
|
+
onConfirm?.();
|
|
44
|
+
};
|
|
45
|
+
const handleCancel = () => {
|
|
46
|
+
setIsConfirming(false);
|
|
47
|
+
};
|
|
48
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
49
|
+
/* @__PURE__ */ jsxs("div", { className: "relative inline-block", children: [
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
className: clsx("trigger", triggerClassName),
|
|
54
|
+
onClick: (e) => {
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
setIsConfirming(true);
|
|
57
|
+
},
|
|
58
|
+
children
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
isConfirming && /* @__PURE__ */ jsxs(
|
|
62
|
+
animated.div,
|
|
63
|
+
{
|
|
64
|
+
className: "popconfirm border-base-300 bg-base-100 absolute -right-2 bottom-0 z-10 translate-y-[106%] rounded-lg border p-4 shadow-xl",
|
|
65
|
+
style: popconfirmProps,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsx(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
className: clsx(
|
|
71
|
+
"bg-base-100 border-base-300 popconfirm-deco absolute -top-2 size-4 rotate-45 rounded-sm border-t border-l",
|
|
72
|
+
{ "right-10": !decoClassName },
|
|
73
|
+
decoClassName
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
|
|
78
|
+
/* @__PURE__ */ jsx(BiMessageRoundedError, { className: "text-orange-500" }),
|
|
79
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
80
|
+
/* @__PURE__ */ jsx("p", { className: "mb-2 font-bold whitespace-nowrap", children: title }),
|
|
81
|
+
/* @__PURE__ */ jsx("div", { className: "mb-2 whitespace-nowrap", children: description })
|
|
82
|
+
] })
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
85
|
+
/* @__PURE__ */ jsx("button", { className: "btn btn-xs btn-outline", onClick: handleCancel, ...cancelButtonProps, children: cancelText ?? l("util.cancel") }),
|
|
86
|
+
/* @__PURE__ */ jsx("button", { className: "btn btn-xs", onClick: handleConfirm, ...okButtonProps, children: okText ?? l("util.ok") })
|
|
87
|
+
] })
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
] }),
|
|
92
|
+
isConfirming && /* @__PURE__ */ jsx(
|
|
93
|
+
"div",
|
|
94
|
+
{
|
|
95
|
+
className: "absolute top-0 left-0 h-screen w-full",
|
|
96
|
+
onClick: () => {
|
|
97
|
+
setIsConfirming(false);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
] });
|
|
102
|
+
};
|
|
103
|
+
export {
|
|
104
|
+
Popconfirm
|
|
105
|
+
};
|
package/esm/Portal.js
ADDED
package/esm/Radio.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { clsx } from "@akanjs/client";
|
|
4
|
+
const Radio = ({ value, children, disabled, className, onChange }) => {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", { className: clsx(`flex gap-2`, className), children: children.map((child, idx) => {
|
|
6
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-1", children: [
|
|
7
|
+
/* @__PURE__ */ jsx(
|
|
8
|
+
"input",
|
|
9
|
+
{
|
|
10
|
+
type: "radio",
|
|
11
|
+
disabled,
|
|
12
|
+
className: "radio radio-primary radio-sm",
|
|
13
|
+
checked: value === child.props.value || value === idx,
|
|
14
|
+
onChange: () => {
|
|
15
|
+
onChange(child.props.value, idx);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
),
|
|
19
|
+
/* @__PURE__ */ jsx(
|
|
20
|
+
"button",
|
|
21
|
+
{
|
|
22
|
+
className: "bg-transparent",
|
|
23
|
+
onClick: () => {
|
|
24
|
+
onChange(child.props.value, idx);
|
|
25
|
+
},
|
|
26
|
+
children: child
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
] }, idx);
|
|
30
|
+
}) });
|
|
31
|
+
};
|
|
32
|
+
const Item = ({ value, className, children }) => {
|
|
33
|
+
return /* @__PURE__ */ jsx("div", { className: clsx("", className), children });
|
|
34
|
+
};
|
|
35
|
+
Radio.Item = Item;
|
|
36
|
+
export {
|
|
37
|
+
Radio
|
|
38
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { dayjs } from "@akanjs/base";
|
|
3
|
+
import { clsx } from "@akanjs/client";
|
|
4
|
+
import { usePage } from "@akanjs/next";
|
|
5
|
+
import relativeTime from "dayjs/plugin/relativeTime";
|
|
6
|
+
dayjs.extend(relativeTime);
|
|
7
|
+
const RecentTime = ({
|
|
8
|
+
date,
|
|
9
|
+
breakUnit,
|
|
10
|
+
format = "auto",
|
|
11
|
+
className
|
|
12
|
+
}) => {
|
|
13
|
+
const { lang } = usePage();
|
|
14
|
+
const now = dayjs();
|
|
15
|
+
const datejs = dayjs(date).locale(lang);
|
|
16
|
+
const diff = dayjs().diff(datejs);
|
|
17
|
+
const dateFormat = format === "full" ? "YY-MM-DD HH:mm" : now.year() !== datejs.year() ? "YYYY-MM-DD" : now.month() !== datejs.month() || now.date() !== datejs.date() ? "MM-DD" : "HH:mm";
|
|
18
|
+
const diffSecs = Math.floor(diff / 1e3);
|
|
19
|
+
if (!date)
|
|
20
|
+
return null;
|
|
21
|
+
if (dayjs(0).isSame(date) || dayjs(-1).isSame(date))
|
|
22
|
+
return /* @__PURE__ */ jsx("span", { children: "--:--" });
|
|
23
|
+
if (breakUnit === "second")
|
|
24
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("tooltip", className), "data-tip": datejs.format("YYYY-MM-DD HH:mm:ss"), children: datejs.format(dateFormat) });
|
|
25
|
+
if (Math.abs(diffSecs) < 60)
|
|
26
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("tooltip", className), "data-tip": datejs.format("YYYY-MM-DD HH:mm"), children: datejs.fromNow() });
|
|
27
|
+
else if (breakUnit === "minute")
|
|
28
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("tooltip", className), "data-tip": datejs.format("YYYY-MM-DD HH:mm"), children: datejs.format(dateFormat) });
|
|
29
|
+
const diffMins = Math.floor(diff / (1e3 * 60));
|
|
30
|
+
if (Math.abs(diffMins) < 60)
|
|
31
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("tooltip", className), "data-tip": datejs.format("YYYY-MM-DD HH:mm"), children: datejs.fromNow() });
|
|
32
|
+
else if (breakUnit === "hour")
|
|
33
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("tooltip", className), "data-tip": datejs.format("YYYY-MM-DD HH:mm"), children: datejs.format(dateFormat) });
|
|
34
|
+
const diffHours = Math.floor(diff / (1e3 * 3600));
|
|
35
|
+
if (Math.abs(diffHours) < 24)
|
|
36
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("tooltip", className), "data-tip": datejs.format("YYYY-MM-DD HH:mm"), children: datejs.fromNow() });
|
|
37
|
+
else if (breakUnit === "day")
|
|
38
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("tooltip", className), "data-tip": datejs.format("YYYY-MM-DD HH:mm"), children: datejs.format(dateFormat) });
|
|
39
|
+
const diffDays = Math.floor(diff / (1e3 * 3600 * 24));
|
|
40
|
+
if (Math.abs(diffDays) < 7)
|
|
41
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("tooltip", className), "data-tip": datejs.format("YYYY-MM-DD HH:mm"), children: datejs.fromNow() });
|
|
42
|
+
else if (breakUnit === "week")
|
|
43
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("tooltip", className), "data-tip": datejs.format("YYYY-MM-DD HH:mm"), children: datejs.format(dateFormat) });
|
|
44
|
+
const diffWeeks = Math.floor(diff / (1e3 * 3600 * 24 * 7));
|
|
45
|
+
if (Math.abs(diffWeeks) < 4)
|
|
46
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("tooltip", className), "data-tip": datejs.format("YYYY-MM-DD HH:mm"), children: datejs.fromNow() });
|
|
47
|
+
else if (breakUnit === "month")
|
|
48
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("tooltip", className), "data-tip": datejs.format("YYYY-MM-DD HH:mm"), children: datejs.format(dateFormat) });
|
|
49
|
+
const diffMonths = Math.floor(diff / (1e3 * 3600 * 24 * 30));
|
|
50
|
+
if (Math.abs(diffMonths) < 12)
|
|
51
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("tooltip", className), "data-tip": datejs.format("YYYY-MM-DD HH:mm"), children: datejs.fromNow() });
|
|
52
|
+
else if (breakUnit === "year")
|
|
53
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("tooltip", className), "data-tip": datejs.format("YYYY-MM-DD HH:mm"), children: datejs.format(dateFormat) });
|
|
54
|
+
return /* @__PURE__ */ jsx("span", { className: clsx("tooltip", className), "data-tip": datejs.format("YYYY-MM-DD HH:mm"), children: datejs.fromNow() });
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
RecentTime
|
|
58
|
+
};
|