@akanjs/ui 0.0.149 → 0.0.151
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 +38 -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 +32 -0
- package/Signal/Listener.d.ts +9 -0
- package/Signal/Message.d.ts +27 -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 +40 -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 +113 -0
- package/cjs/Button.js +69 -0
- package/cjs/ClientSide.js +26 -0
- package/cjs/Copy.js +37 -0
- package/cjs/CsrImage.js +50 -0
- package/cjs/Data/CardList.js +119 -0
- package/cjs/Data/Dashboard.js +54 -0
- package/cjs/Data/Insight.js +38 -0
- package/cjs/Data/Item.js +204 -0
- package/cjs/Data/ListContainer.js +251 -0
- package/cjs/Data/Pagination.js +64 -0
- package/cjs/Data/QueryMaker.js +304 -0
- package/cjs/Data/TableList.js +139 -0
- package/cjs/Data/index.js +33 -0
- package/cjs/Data/index_.js +49 -0
- package/cjs/DatePicker.js +173 -0
- package/cjs/Dialog/Action.js +32 -0
- package/cjs/Dialog/Close.js +38 -0
- package/cjs/Dialog/Content.js +27 -0
- package/cjs/Dialog/Modal.js +155 -0
- package/cjs/Dialog/Provider.js +46 -0
- package/cjs/Dialog/Title.js +32 -0
- package/cjs/Dialog/Trigger.js +38 -0
- package/cjs/Dialog/context.js +32 -0
- package/cjs/Dialog/index.js +36 -0
- package/cjs/DragAction.js +111 -0
- package/cjs/DraggableList.js +141 -0
- package/cjs/Dropdown.js +64 -0
- package/cjs/Empty.js +50 -0
- package/cjs/Field.js +1109 -0
- package/cjs/FontFace.js +77 -0
- package/cjs/Image.js +61 -0
- package/cjs/InfiniteScroll.js +65 -0
- package/cjs/Input.js +440 -0
- package/cjs/KeyboardAvoiding.js +65 -0
- package/cjs/Layout/BottomAction.js +26 -0
- package/cjs/Layout/BottomInset.js +53 -0
- package/cjs/Layout/BottomTab.js +56 -0
- package/cjs/Layout/Header.js +52 -0
- package/cjs/Layout/LeftSider.js +49 -0
- package/cjs/Layout/Navbar.js +51 -0
- package/cjs/Layout/RightSider.js +52 -0
- package/cjs/Layout/Sider.js +39 -0
- package/cjs/Layout/Template.js +26 -0
- package/cjs/Layout/TopLeftAction.js +39 -0
- package/cjs/Layout/Unit.js +27 -0
- package/cjs/Layout/View.js +26 -0
- package/cjs/Layout/Zone.js +26 -0
- package/cjs/Layout/index.js +48 -0
- package/cjs/Link/Back.js +27 -0
- package/cjs/Link/Close.js +36 -0
- package/cjs/Link/CsrLink.js +49 -0
- package/cjs/Link/NextLink.js +71 -0
- package/cjs/Link/index.js +47 -0
- package/cjs/Link/types.js +15 -0
- package/cjs/Load/Edit.js +42 -0
- package/cjs/Load/Edit_Client.js +93 -0
- package/cjs/Load/Page.js +35 -0
- package/cjs/Load/PageCSR.js +67 -0
- package/cjs/Load/Pagination.js +89 -0
- package/cjs/Load/Units.js +232 -0
- package/cjs/Load/View.js +88 -0
- package/cjs/Load/index.js +42 -0
- package/cjs/Load/index_.js +39 -0
- package/cjs/Loading/Area.js +25 -0
- package/cjs/Loading/Button.js +33 -0
- package/cjs/Loading/Input.js +33 -0
- package/cjs/Loading/ProgressBar.js +29 -0
- package/cjs/Loading/Skeleton.js +27 -0
- package/cjs/Loading/Spin.js +27 -0
- package/cjs/Loading/index.js +29 -0
- package/cjs/Menu.js +215 -0
- package/cjs/Modal.js +75 -0
- package/cjs/Model/Edit.js +61 -0
- package/cjs/Model/EditModal.js +255 -0
- package/cjs/Model/EditWrapper.js +48 -0
- package/cjs/Model/LoadInit.js +27 -0
- package/cjs/Model/New.js +61 -0
- package/cjs/Model/NewWrapper.js +28 -0
- package/cjs/Model/NewWrapper_Client.js +66 -0
- package/cjs/Model/Remove.js +86 -0
- package/cjs/Model/RemoveWrapper.js +48 -0
- package/cjs/Model/SureToRemove.js +109 -0
- package/cjs/Model/View.js +44 -0
- package/cjs/Model/ViewEditModal.js +118 -0
- package/cjs/Model/ViewModal.js +92 -0
- package/cjs/Model/ViewWrapper.js +48 -0
- package/cjs/Model/index.js +38 -0
- package/cjs/Model/index_.js +58 -0
- package/cjs/More.js +67 -0
- package/cjs/ObjectId.js +37 -0
- package/cjs/Pagination.js +110 -0
- package/cjs/Popconfirm.js +116 -0
- package/cjs/Portal.js +27 -0
- package/cjs/Radio.js +53 -0
- package/cjs/RecentTime.js +86 -0
- package/cjs/Refresh.js +45 -0
- package/cjs/ScreenNavigator.js +121 -0
- package/cjs/Select.js +262 -0
- package/cjs/Signal/Arg.js +237 -0
- package/cjs/Signal/Doc.js +181 -0
- package/cjs/Signal/GraphQL.js +177 -0
- package/cjs/Signal/Listener.js +59 -0
- package/cjs/Signal/Message.js +190 -0
- package/cjs/Signal/Object.js +95 -0
- package/cjs/Signal/PubSub.js +191 -0
- package/cjs/Signal/Request.js +38 -0
- package/cjs/Signal/Response.js +53 -0
- package/cjs/Signal/RestApi.js +255 -0
- package/cjs/Signal/WebSocket.js +68 -0
- package/cjs/Signal/index.js +42 -0
- package/cjs/System/CSR.js +376 -0
- package/cjs/System/Client.js +200 -0
- package/cjs/System/Common.js +64 -0
- package/cjs/System/DevModeToggle.js +38 -0
- package/cjs/System/Gtag.js +67 -0
- package/cjs/System/HealthCheck.js +60 -0
- package/cjs/System/Messages.js +170 -0
- package/cjs/System/Reconnect.js +64 -0
- package/cjs/System/Root.js +30 -0
- package/cjs/System/SSR.js +144 -0
- package/cjs/System/SelectLanguage.js +58 -0
- package/cjs/System/ThemeToggle.js +40 -0
- package/cjs/System/index.js +55 -0
- package/cjs/Tab/Menu.js +70 -0
- package/cjs/{src/index.js → Tab/Menus.js} +8 -5
- package/cjs/Tab/Panel.js +42 -0
- package/cjs/Tab/Provider.js +31 -0
- package/cjs/Tab/context.js +30 -0
- package/cjs/Tab/index.js +32 -0
- package/cjs/Table.js +85 -0
- package/cjs/ToggleSelect.js +118 -0
- package/cjs/Unauthorized.js +50 -0
- package/cjs/index.js +88 -2
- package/esm/BottomSheet.js +84 -0
- package/esm/Button.js +40 -0
- package/esm/ClientSide.js +7 -0
- package/esm/Copy.js +18 -0
- package/esm/CsrImage.js +31 -0
- package/esm/Data/CardList.js +90 -0
- package/esm/Data/Dashboard.js +35 -0
- package/esm/Data/Insight.js +19 -0
- package/esm/Data/Item.js +175 -0
- package/esm/Data/ListContainer.js +228 -0
- package/esm/Data/Pagination.js +45 -0
- package/esm/Data/QueryMaker.js +293 -0
- package/esm/Data/TableList.js +110 -0
- package/esm/Data/index.js +14 -0
- package/esm/Data/index_.js +20 -0
- package/esm/DatePicker.js +144 -0
- package/esm/Dialog/Action.js +13 -0
- package/esm/Dialog/Close.js +19 -0
- package/esm/Dialog/Content.js +8 -0
- package/esm/Dialog/Modal.js +126 -0
- package/esm/Dialog/Provider.js +17 -0
- package/esm/Dialog/Title.js +13 -0
- package/esm/Dialog/Trigger.js +19 -0
- package/esm/Dialog/context.js +13 -0
- package/esm/Dialog/index.js +17 -0
- package/esm/DragAction.js +92 -0
- package/esm/DraggableList.js +112 -0
- package/esm/Dropdown.js +45 -0
- package/esm/Empty.js +21 -0
- package/esm/Field.js +1090 -0
- package/esm/FontFace.js +58 -0
- package/esm/Image.js +32 -0
- package/esm/InfiniteScroll.js +46 -0
- package/esm/Input.js +415 -0
- package/esm/KeyboardAvoiding.js +46 -0
- package/esm/Layout/BottomAction.js +7 -0
- package/esm/Layout/BottomInset.js +34 -0
- package/esm/Layout/BottomTab.js +37 -0
- package/esm/Layout/Header.js +33 -0
- package/esm/Layout/LeftSider.js +30 -0
- package/esm/Layout/Navbar.js +22 -0
- package/esm/Layout/RightSider.js +33 -0
- package/esm/Layout/Sider.js +20 -0
- package/esm/Layout/Template.js +7 -0
- package/esm/Layout/TopLeftAction.js +20 -0
- package/esm/Layout/Unit.js +8 -0
- package/esm/Layout/View.js +7 -0
- package/esm/Layout/Zone.js +7 -0
- package/esm/Layout/index.js +29 -0
- package/esm/Link/Back.js +8 -0
- package/esm/Link/Close.js +17 -0
- package/esm/Link/CsrLink.js +30 -0
- package/esm/Link/NextLink.js +42 -0
- package/esm/Link/index.js +18 -0
- package/esm/Link/types.js +0 -0
- package/esm/Load/Edit.js +13 -0
- package/esm/Load/Edit_Client.js +74 -0
- package/esm/Load/Page.js +16 -0
- package/esm/Load/PageCSR.js +48 -0
- package/esm/Load/Pagination.js +70 -0
- package/esm/Load/Units.js +213 -0
- package/esm/Load/View.js +69 -0
- package/esm/Load/index.js +13 -0
- package/esm/Load/index_.js +10 -0
- package/esm/Loading/Area.js +6 -0
- package/esm/Loading/Button.js +14 -0
- package/esm/Loading/Input.js +14 -0
- package/esm/Loading/ProgressBar.js +10 -0
- package/esm/Loading/Skeleton.js +8 -0
- package/esm/Loading/Spin.js +8 -0
- package/esm/Loading/index.js +10 -0
- package/esm/Menu.js +196 -0
- package/esm/Modal.js +46 -0
- package/esm/Model/Edit.js +32 -0
- package/esm/Model/EditModal.js +226 -0
- package/esm/Model/EditWrapper.js +29 -0
- package/esm/Model/LoadInit.js +8 -0
- package/esm/Model/New.js +32 -0
- package/esm/Model/NewWrapper.js +9 -0
- package/esm/Model/NewWrapper_Client.js +47 -0
- package/esm/Model/Remove.js +67 -0
- package/esm/Model/RemoveWrapper.js +29 -0
- package/esm/Model/SureToRemove.js +90 -0
- package/esm/Model/View.js +25 -0
- package/esm/Model/ViewEditModal.js +89 -0
- package/esm/Model/ViewModal.js +63 -0
- package/esm/Model/ViewWrapper.js +29 -0
- package/esm/Model/index.js +33 -0
- package/esm/Model/index_.js +29 -0
- package/esm/More.js +38 -0
- package/esm/ObjectId.js +18 -0
- package/esm/Pagination.js +91 -0
- package/esm/Popconfirm.js +87 -0
- package/esm/Portal.js +8 -0
- package/esm/Radio.js +34 -0
- package/esm/RecentTime.js +57 -0
- package/esm/Refresh.js +16 -0
- package/esm/ScreenNavigator.js +102 -0
- package/esm/Select.js +243 -0
- package/esm/Signal/Arg.js +208 -0
- package/esm/Signal/Doc.js +152 -0
- package/esm/Signal/GraphQL.js +156 -0
- package/esm/Signal/Listener.js +40 -0
- package/esm/Signal/Message.js +161 -0
- package/esm/Signal/Object.js +76 -0
- package/esm/Signal/PubSub.js +162 -0
- package/esm/Signal/Request.js +19 -0
- package/esm/Signal/Response.js +34 -0
- package/esm/Signal/RestApi.js +234 -0
- package/esm/Signal/WebSocket.js +39 -0
- package/esm/Signal/index.js +13 -0
- package/esm/System/CSR.js +357 -0
- package/esm/System/Client.js +191 -0
- package/esm/System/Common.js +45 -0
- package/esm/System/DevModeToggle.js +19 -0
- package/esm/System/Gtag.js +48 -0
- package/esm/System/HealthCheck.js +41 -0
- package/esm/System/Messages.js +156 -0
- package/esm/System/Reconnect.js +45 -0
- package/esm/System/Root.js +11 -0
- package/esm/System/SSR.js +125 -0
- package/esm/System/SelectLanguage.js +39 -0
- package/esm/System/ThemeToggle.js +21 -0
- package/esm/System/index.js +26 -0
- package/esm/Tab/Menu.js +51 -0
- package/esm/Tab/Menus.js +7 -0
- package/esm/Tab/Panel.js +23 -0
- package/esm/Tab/Provider.js +12 -0
- package/esm/Tab/context.js +11 -0
- package/esm/Tab/index.js +13 -0
- package/esm/Table.js +56 -0
- package/esm/ToggleSelect.js +99 -0
- package/esm/Unauthorized.js +21 -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
package/cjs/index.js
CHANGED
|
@@ -2,6 +2,10 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
5
9
|
var __copyProps = (to, from, except, desc) => {
|
|
6
10
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
11
|
for (let key of __getOwnPropNames(from))
|
|
@@ -10,8 +14,90 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
10
14
|
}
|
|
11
15
|
return to;
|
|
12
16
|
};
|
|
13
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
18
|
var ui_exports = {};
|
|
19
|
+
__export(ui_exports, {
|
|
20
|
+
BottomSheet: () => import_BottomSheet.BottomSheet,
|
|
21
|
+
Button: () => import_Button.Button,
|
|
22
|
+
ClientSide: () => import_ClientSide.ClientSide,
|
|
23
|
+
Copy: () => import_Copy.Copy,
|
|
24
|
+
CsrImage: () => import_CsrImage.CsrImage,
|
|
25
|
+
Data: () => import_Data.Data,
|
|
26
|
+
DatePicker: () => import_DatePicker.DatePicker,
|
|
27
|
+
Dialog: () => import_Dialog.Dialog,
|
|
28
|
+
DragAction: () => import_DragAction.DragAction,
|
|
29
|
+
DraggableList: () => import_DraggableList.DraggableList,
|
|
30
|
+
Dropdown: () => import_Dropdown.Dropdown,
|
|
31
|
+
Empty: () => import_Empty.Empty,
|
|
32
|
+
Field: () => import_Field.Field,
|
|
33
|
+
FontFace: () => import_FontFace.FontFace,
|
|
34
|
+
Image: () => import_Image.Image,
|
|
35
|
+
InfiniteScroll: () => import_InfiniteScroll.InfiniteScroll,
|
|
36
|
+
Input: () => import_Input.Input,
|
|
37
|
+
KeyboardAvoiding: () => import_KeyboardAvoiding.KeyboardAvoiding,
|
|
38
|
+
Layout: () => import_Layout.Layout,
|
|
39
|
+
Link: () => import_Link.Link,
|
|
40
|
+
Load: () => import_Load.Load,
|
|
41
|
+
Loading: () => import_Loading.Loading,
|
|
42
|
+
Menu: () => import_Menu.Menu,
|
|
43
|
+
Modal: () => import_Modal.Modal,
|
|
44
|
+
Model: () => import_Model.Model,
|
|
45
|
+
More: () => import_More.More,
|
|
46
|
+
ObjectId: () => import_ObjectId.ObjectId,
|
|
47
|
+
Pagination: () => import_Pagination.Pagination,
|
|
48
|
+
Popconfirm: () => import_Popconfirm.Popconfirm,
|
|
49
|
+
Portal: () => import_Portal.Portal,
|
|
50
|
+
Radio: () => import_Radio.Radio,
|
|
51
|
+
RecentTime: () => import_RecentTime.RecentTime,
|
|
52
|
+
Refresh: () => import_Refresh.Refresh,
|
|
53
|
+
ScreenNavigator: () => import_ScreenNavigator.ScreenNavigator,
|
|
54
|
+
Select: () => import_Select.Select,
|
|
55
|
+
Signal: () => import_Signal.Signal,
|
|
56
|
+
System: () => import_System.System,
|
|
57
|
+
Tab: () => import_Tab.Tab,
|
|
58
|
+
Table: () => import_Table.Table,
|
|
59
|
+
ToggleSelect: () => import_ToggleSelect.ToggleSelect,
|
|
60
|
+
Unauthorized: () => import_Unauthorized.Unauthorized
|
|
61
|
+
});
|
|
16
62
|
module.exports = __toCommonJS(ui_exports);
|
|
17
|
-
|
|
63
|
+
var import_Data = require("./Data");
|
|
64
|
+
var import_Dialog = require("./Dialog");
|
|
65
|
+
var import_Layout = require("./Layout");
|
|
66
|
+
var import_Link = require("./Link");
|
|
67
|
+
var import_Load = require("./Load");
|
|
68
|
+
var import_Loading = require("./Loading");
|
|
69
|
+
var import_Model = require("./Model");
|
|
70
|
+
var import_Signal = require("./Signal");
|
|
71
|
+
var import_System = require("./System");
|
|
72
|
+
var import_Tab = require("./Tab");
|
|
73
|
+
var import_BottomSheet = require("./BottomSheet");
|
|
74
|
+
var import_Button = require("./Button");
|
|
75
|
+
var import_ClientSide = require("./ClientSide");
|
|
76
|
+
var import_Copy = require("./Copy");
|
|
77
|
+
var import_CsrImage = require("./CsrImage");
|
|
78
|
+
var import_DatePicker = require("./DatePicker");
|
|
79
|
+
var import_DragAction = require("./DragAction");
|
|
80
|
+
var import_DraggableList = require("./DraggableList");
|
|
81
|
+
var import_Dropdown = require("./Dropdown");
|
|
82
|
+
var import_Empty = require("./Empty");
|
|
83
|
+
var import_Field = require("./Field");
|
|
84
|
+
var import_FontFace = require("./FontFace");
|
|
85
|
+
var import_Image = require("./Image");
|
|
86
|
+
var import_InfiniteScroll = require("./InfiniteScroll");
|
|
87
|
+
var import_Input = require("./Input");
|
|
88
|
+
var import_KeyboardAvoiding = require("./KeyboardAvoiding");
|
|
89
|
+
var import_Menu = require("./Menu");
|
|
90
|
+
var import_Modal = require("./Modal");
|
|
91
|
+
var import_More = require("./More");
|
|
92
|
+
var import_ObjectId = require("./ObjectId");
|
|
93
|
+
var import_Pagination = require("./Pagination");
|
|
94
|
+
var import_Popconfirm = require("./Popconfirm");
|
|
95
|
+
var import_Portal = require("./Portal");
|
|
96
|
+
var import_Radio = require("./Radio");
|
|
97
|
+
var import_RecentTime = require("./RecentTime");
|
|
98
|
+
var import_Refresh = require("./Refresh");
|
|
99
|
+
var import_ScreenNavigator = require("./ScreenNavigator");
|
|
100
|
+
var import_Select = require("./Select");
|
|
101
|
+
var import_Table = require("./Table");
|
|
102
|
+
var import_ToggleSelect = require("./ToggleSelect");
|
|
103
|
+
var import_Unauthorized = require("./Unauthorized");
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx } from "@akanjs/client";
|
|
3
|
+
import { st } from "@akanjs/store";
|
|
4
|
+
import { useDrag } from "@use-gesture/react";
|
|
5
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
6
|
+
import { BiX } from "react-icons/bi";
|
|
7
|
+
import { a, config, useSpring } from "react-spring";
|
|
8
|
+
const BottomSheet = forwardRef(
|
|
9
|
+
({ open, onCancel, type = "half", children }, bottomSheetRef) => {
|
|
10
|
+
const ref = useRef(null);
|
|
11
|
+
const pageState = st.use.pageState();
|
|
12
|
+
const [{ y, opacity }, api] = useSpring(() => ({ y: window.innerHeight, opacity: 0 }));
|
|
13
|
+
const openModal = async () => {
|
|
14
|
+
await Promise.all(api.start({ y: 0, opacity: 100, immediate: false, config: config.default }));
|
|
15
|
+
};
|
|
16
|
+
const closeModal = async () => {
|
|
17
|
+
await Promise.all(
|
|
18
|
+
api.start({ y: window.innerHeight, opacity: 0, immediate: false, config: { ...config.stiff, velocity: 0 } })
|
|
19
|
+
);
|
|
20
|
+
onCancel();
|
|
21
|
+
};
|
|
22
|
+
const bind = useDrag(
|
|
23
|
+
({ down, velocity: [, vy], direction: [, dy], offset: [, oy], movement: [, my], xy, initial }) => {
|
|
24
|
+
if (down) {
|
|
25
|
+
if (my < 0)
|
|
26
|
+
void api.start({ y: 0, immediate: true });
|
|
27
|
+
else
|
|
28
|
+
void api.start({ y: my, immediate: true });
|
|
29
|
+
} else {
|
|
30
|
+
if (my > window.innerHeight / 3)
|
|
31
|
+
void closeModal();
|
|
32
|
+
else
|
|
33
|
+
void openModal();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
useImperativeHandle(bottomSheetRef, () => ({
|
|
38
|
+
open: openModal,
|
|
39
|
+
close: closeModal
|
|
40
|
+
}));
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (open)
|
|
43
|
+
void openModal();
|
|
44
|
+
else
|
|
45
|
+
void closeModal();
|
|
46
|
+
}, [open]);
|
|
47
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
48
|
+
a.div,
|
|
49
|
+
{
|
|
50
|
+
style: {
|
|
51
|
+
opacity
|
|
52
|
+
},
|
|
53
|
+
onClick: () => void closeModal(),
|
|
54
|
+
className: clsx("fixed top-0 left-0 size-full bg-gray-500/50", {
|
|
55
|
+
"z-50": open,
|
|
56
|
+
"-z-[1]": !open
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
), /* @__PURE__ */ React.createElement(
|
|
60
|
+
a.div,
|
|
61
|
+
{
|
|
62
|
+
ref,
|
|
63
|
+
style: { y, paddingTop: type === "full" ? pageState.topSafeArea : 0 },
|
|
64
|
+
className: clsx("bg-base-100 fixed bottom-0 left-0 z-[101] w-full", {
|
|
65
|
+
"h-[90%] rounded-t-3xl": type === "half",
|
|
66
|
+
"h-[100vh]": type === "full"
|
|
67
|
+
})
|
|
68
|
+
},
|
|
69
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex h-8 w-full items-start justify-center pt-2" }, type === "half" ? /* @__PURE__ */ React.createElement(a.div, { ...bind(), className: "flex h-8 w-full items-start justify-center pt-2" }, /* @__PURE__ */ React.createElement("div", { className: "h-2 w-32 rounded-full bg-gray-300" })) : /* @__PURE__ */ React.createElement(
|
|
70
|
+
"button",
|
|
71
|
+
{
|
|
72
|
+
onClick: () => void closeModal(),
|
|
73
|
+
className: "absolute top-2 right-2 text-4xl",
|
|
74
|
+
style: { paddingTop: pageState.topSafeArea }
|
|
75
|
+
},
|
|
76
|
+
/* @__PURE__ */ React.createElement(BiX, null)
|
|
77
|
+
)),
|
|
78
|
+
/* @__PURE__ */ React.createElement("div", { className: "relative size-full pt-5" }, children)
|
|
79
|
+
));
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
export {
|
|
83
|
+
BottomSheet
|
|
84
|
+
};
|
package/esm/Button.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx } from "@akanjs/client";
|
|
3
|
+
import { usePage } from "@akanjs/next";
|
|
4
|
+
import React, { useState } from "react";
|
|
5
|
+
import { AiOutlineCheckCircle } from "react-icons/ai";
|
|
6
|
+
const Button = ({ className, children, onClick, onSuccess, ...rest }) => {
|
|
7
|
+
const { l } = usePage();
|
|
8
|
+
const [state, setState] = useState({
|
|
9
|
+
mode: "idle",
|
|
10
|
+
error: null,
|
|
11
|
+
times: 0
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
14
|
+
"button",
|
|
15
|
+
{
|
|
16
|
+
className: clsx("btn", className),
|
|
17
|
+
...rest,
|
|
18
|
+
disabled: !!rest.disabled || ["loading", "success"].includes(state.mode),
|
|
19
|
+
onClick: (e) => {
|
|
20
|
+
setState({ mode: "loading", error: null, times: state.times + 1 });
|
|
21
|
+
void (async () => {
|
|
22
|
+
const result = await onClick(e, {
|
|
23
|
+
onError: (error) => {
|
|
24
|
+
setState({ mode: "error", error, times: state.times + 1 });
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
setState({ mode: "success", error: null, times: state.times + 1 });
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
setState({ mode: "idle", error: null, times: state.times + 1 });
|
|
30
|
+
onSuccess?.(result);
|
|
31
|
+
}, 300);
|
|
32
|
+
})();
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
state.mode === "loading" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", { className: "loading loading-bars loading-md" }), " ", l("util.processing")) : state.mode === "success" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(AiOutlineCheckCircle, null), " ", l("util.processed")) : children
|
|
36
|
+
), state.error ? /* @__PURE__ */ React.createElement("div", { className: "text-error h-10 w-full p-2 text-center text-sm" }, state.error ? l(state.error) : " ") : null);
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
Button
|
|
40
|
+
};
|
package/esm/Copy.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { st } from "@akanjs/store";
|
|
3
|
+
import { CopyToClipboard } from "react-copy-to-clipboard";
|
|
4
|
+
const Copy = ({ text, copyMessage, children }) => {
|
|
5
|
+
return /* @__PURE__ */ React.createElement(
|
|
6
|
+
CopyToClipboard,
|
|
7
|
+
{
|
|
8
|
+
text: text ?? "",
|
|
9
|
+
onCopy: () => {
|
|
10
|
+
st.do.showMessage({ content: copyMessage ?? "Copied", type: "success" });
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
children
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
Copy
|
|
18
|
+
};
|
package/esm/CsrImage.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const getNewImage = () => new Image();
|
|
3
|
+
const CsrImage = ({
|
|
4
|
+
src,
|
|
5
|
+
file,
|
|
6
|
+
className,
|
|
7
|
+
abstractData,
|
|
8
|
+
...props
|
|
9
|
+
}) => {
|
|
10
|
+
const url = src ?? file?.url ?? "/empty.png";
|
|
11
|
+
const [width, height] = [props.width ?? file?.imageSize[0], props.height ?? file?.imageSize[1]];
|
|
12
|
+
const defaultAbstractData = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFklEQVR42mN8//HLfwYiAOOoQvoqBABbWyZJf74GZgAAAABJRU5ErkJggg==";
|
|
13
|
+
const blurDataURL = abstractData ?? file?.abstractData ?? defaultAbstractData;
|
|
14
|
+
const { priority, ...csrProps } = props;
|
|
15
|
+
return /* @__PURE__ */ React.createElement(
|
|
16
|
+
"img",
|
|
17
|
+
{
|
|
18
|
+
src: url,
|
|
19
|
+
"data-src": blurDataURL,
|
|
20
|
+
width,
|
|
21
|
+
height,
|
|
22
|
+
className,
|
|
23
|
+
alt: "image",
|
|
24
|
+
placeholder: "blur",
|
|
25
|
+
...csrProps
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
CsrImage
|
|
31
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx } from "@akanjs/client";
|
|
3
|
+
import { capitalize } from "@akanjs/common";
|
|
4
|
+
import { st } from "@akanjs/store";
|
|
5
|
+
import { useEffect } from "react";
|
|
6
|
+
import { Loading } from "../Loading";
|
|
7
|
+
import { Model } from "../Model";
|
|
8
|
+
import DataItem from "./Item";
|
|
9
|
+
import DataPagination from "./Pagination";
|
|
10
|
+
function CardList({
|
|
11
|
+
className,
|
|
12
|
+
cardListClassName = "",
|
|
13
|
+
init,
|
|
14
|
+
sliceName,
|
|
15
|
+
actions,
|
|
16
|
+
columns,
|
|
17
|
+
renderItem,
|
|
18
|
+
renderLoading,
|
|
19
|
+
renderTemplate,
|
|
20
|
+
renderView,
|
|
21
|
+
renderTitle
|
|
22
|
+
}) {
|
|
23
|
+
const storeUse = st.use;
|
|
24
|
+
const storeDo = st.do;
|
|
25
|
+
const storeGet = st.get;
|
|
26
|
+
const refName = st.slice[sliceName].refName;
|
|
27
|
+
const [modelName, modelClassName] = [refName, capitalize(refName)];
|
|
28
|
+
const names = {
|
|
29
|
+
model: modelName,
|
|
30
|
+
modelId: `${modelName}Id`,
|
|
31
|
+
modelList: `${modelName}List`,
|
|
32
|
+
modelListLoading: `${modelName}ListLoading`,
|
|
33
|
+
limitOfModel: `limitOf${modelClassName}`,
|
|
34
|
+
initModel: `init${modelClassName}`
|
|
35
|
+
};
|
|
36
|
+
const namesOfSlice = {
|
|
37
|
+
modelList: sliceName.replace(names.model, names.modelList),
|
|
38
|
+
modelListLoading: sliceName.replace(names.model, names.modelListLoading),
|
|
39
|
+
limitOfModel: sliceName.replace(names.model, names.limitOfModel),
|
|
40
|
+
initModel: sliceName.replace(names.model, names.initModel)
|
|
41
|
+
};
|
|
42
|
+
const modelList = storeUse[namesOfSlice.modelList]();
|
|
43
|
+
const modelListLoading = storeUse[namesOfSlice.modelListLoading]();
|
|
44
|
+
const limitOfModel = storeUse[namesOfSlice.limitOfModel]();
|
|
45
|
+
const RenderItem = renderItem;
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (init)
|
|
48
|
+
void storeDo[namesOfSlice.initModel](init);
|
|
49
|
+
}, []);
|
|
50
|
+
const RenderTemplate = ({ id }) => {
|
|
51
|
+
const Edit = renderTemplate;
|
|
52
|
+
return Edit ? /* @__PURE__ */ React.createElement(Edit, { ...{ [names.modelId]: id } }) : null;
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ React.createElement("div", { className }, modelListLoading ? /* @__PURE__ */ React.createElement("div", { className: clsx("grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4 xl:grid-cols-5", cardListClassName) }, new Array(limitOfModel || 20).fill(0).map((_, idx) => renderLoading ? renderLoading() : /* @__PURE__ */ React.createElement(Loading.Skeleton, { key: idx, active: true }))) : /* @__PURE__ */ React.createElement("div", { className: clsx("grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4 xl:grid-cols-5", cardListClassName) }, modelList.map((model, idx) => {
|
|
55
|
+
return /* @__PURE__ */ React.createElement(
|
|
56
|
+
DataItem,
|
|
57
|
+
{
|
|
58
|
+
key: model.id,
|
|
59
|
+
model,
|
|
60
|
+
sliceName,
|
|
61
|
+
actions: typeof actions === "function" ? actions(model, idx) : actions,
|
|
62
|
+
columns
|
|
63
|
+
},
|
|
64
|
+
/* @__PURE__ */ React.createElement(
|
|
65
|
+
RenderItem,
|
|
66
|
+
{
|
|
67
|
+
...{
|
|
68
|
+
[sliceName]: model,
|
|
69
|
+
sliceName,
|
|
70
|
+
actions: typeof actions === "function" ? actions(model, idx) : actions,
|
|
71
|
+
columns,
|
|
72
|
+
idx
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
);
|
|
77
|
+
})), /* @__PURE__ */ React.createElement(DataPagination, { sliceName }), !modelListLoading ? modelList.map((model) => /* @__PURE__ */ React.createElement("div", { key: model.id }, /* @__PURE__ */ React.createElement(Model.EditModal, { key: model.id, id: model.id, sliceName, renderTitle }, /* @__PURE__ */ React.createElement(RenderTemplate, { id: model.id })), renderView ? /* @__PURE__ */ React.createElement(
|
|
78
|
+
Model.ViewModal,
|
|
79
|
+
{
|
|
80
|
+
key: `${model.id}-view`,
|
|
81
|
+
id: model.id,
|
|
82
|
+
sliceName,
|
|
83
|
+
renderTitle,
|
|
84
|
+
renderView
|
|
85
|
+
}
|
|
86
|
+
) : null)) : null);
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
CardList as default
|
|
90
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx } from "@akanjs/client";
|
|
3
|
+
import { capitalize } from "@akanjs/common";
|
|
4
|
+
import { usePage } from "@akanjs/next";
|
|
5
|
+
import { st } from "@akanjs/store";
|
|
6
|
+
import { Link } from "../Link";
|
|
7
|
+
function Dashboard({
|
|
8
|
+
className,
|
|
9
|
+
summary,
|
|
10
|
+
sliceName,
|
|
11
|
+
queryMap,
|
|
12
|
+
columns,
|
|
13
|
+
presents,
|
|
14
|
+
hidePresents
|
|
15
|
+
}) {
|
|
16
|
+
const { l } = usePage();
|
|
17
|
+
const { filter } = st.use.searchParams();
|
|
18
|
+
const refName = st.slice[sliceName].refName;
|
|
19
|
+
const [modelName, modelClassName] = [refName, capitalize(refName)];
|
|
20
|
+
return /* @__PURE__ */ React.createElement("div", { className: clsx("stats my-2 flex w-full flex-wrap justify-center py-0 shadow-sm", className) }, /* @__PURE__ */ React.createElement("div", { className: "stats" }, columns?.map(
|
|
21
|
+
(column) => summary[column] !== void 0 && queryMap[column] !== void 0 && /* @__PURE__ */ React.createElement(
|
|
22
|
+
"button",
|
|
23
|
+
{
|
|
24
|
+
key: column,
|
|
25
|
+
className: `btn btn-ghost mx-1 h-32 w-48 rounded-none pt-3 hover:border ${filter === column ? "border" : "border-0"}`
|
|
26
|
+
},
|
|
27
|
+
/* @__PURE__ */ React.createElement(Link, { key: column, className: "stat", href: `/admin?topMenu=data&subMenu=${modelName}&filter=${column}` }, /* @__PURE__ */ React.createElement("div", { className: "stat-title" }, l(`summary.${column}`)), /* @__PURE__ */ React.createElement("div", { className: "stat-value text-primary" }, summary[column].toLocaleString()))
|
|
28
|
+
)
|
|
29
|
+
), !hidePresents ? presents?.map(
|
|
30
|
+
(column) => summary[column] !== void 0 && queryMap[column] !== void 0 && /* @__PURE__ */ React.createElement("button", { key: column, className: `btn btn-ghost mx-1 h-32 w-48 rounded-none border-none pt-3` }, /* @__PURE__ */ React.createElement("div", { className: "stat" }, /* @__PURE__ */ React.createElement("div", { className: "stat-title" }, l(`summary.${column}`)), /* @__PURE__ */ React.createElement("div", { className: "stat-value text-primary" }, summary[column])))
|
|
31
|
+
) : null));
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
Dashboard as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx } from "@akanjs/client";
|
|
3
|
+
import { usePage } from "@akanjs/next";
|
|
4
|
+
import { st } from "@akanjs/store";
|
|
5
|
+
function Insight({
|
|
6
|
+
className,
|
|
7
|
+
insight,
|
|
8
|
+
sliceName,
|
|
9
|
+
columns
|
|
10
|
+
}) {
|
|
11
|
+
const { l } = usePage();
|
|
12
|
+
const refName = st.slice[sliceName].refName;
|
|
13
|
+
return /* @__PURE__ */ React.createElement("div", { className: clsx("stats my-2 flex w-full flex-wrap justify-center py-2 shadow-sm", className) }, /* @__PURE__ */ React.createElement("div", { className: "stats" }, columns?.map(
|
|
14
|
+
(column, idx) => insight[column] !== void 0 && /* @__PURE__ */ React.createElement("div", { key: idx, className: "stat mx-1 flex items-center rounded-none" }, /* @__PURE__ */ React.createElement("div", { className: "stat-title" }, l.field(refName, column)), /* @__PURE__ */ React.createElement("div", { className: "stat-value text-xl" }, insight[column].toLocaleString()))
|
|
15
|
+
)));
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
Insight as default
|
|
19
|
+
};
|
package/esm/Data/Item.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx } from "@akanjs/client";
|
|
3
|
+
import { capitalize } from "@akanjs/common";
|
|
4
|
+
import { usePage } from "@akanjs/next";
|
|
5
|
+
import { st } from "@akanjs/store";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { AiOutlineDelete, AiOutlineEdit, AiOutlineEye, AiOutlineMore } from "react-icons/ai";
|
|
8
|
+
import { Dropdown } from "../Dropdown";
|
|
9
|
+
import { ObjectId } from "../ObjectId";
|
|
10
|
+
import { Popconfirm } from "../Popconfirm";
|
|
11
|
+
import { RecentTime } from "../RecentTime";
|
|
12
|
+
const convToAntdColumn = (column) => {
|
|
13
|
+
if (typeof column !== "string")
|
|
14
|
+
return {
|
|
15
|
+
key: column.key,
|
|
16
|
+
dataIndex: column.key,
|
|
17
|
+
title: capitalize(column.key),
|
|
18
|
+
responsive: column.responsive ? ["xs", "sm", "md", "xl"] : void 0,
|
|
19
|
+
render: column.render
|
|
20
|
+
};
|
|
21
|
+
else if ([
|
|
22
|
+
"createdAt",
|
|
23
|
+
"updatedAt",
|
|
24
|
+
"at",
|
|
25
|
+
"At",
|
|
26
|
+
"lastLoginAt",
|
|
27
|
+
"openAt",
|
|
28
|
+
"closeAt",
|
|
29
|
+
"announceAt",
|
|
30
|
+
"startAt",
|
|
31
|
+
"logtime"
|
|
32
|
+
].includes(column))
|
|
33
|
+
return {
|
|
34
|
+
key: column,
|
|
35
|
+
dataIndex: column,
|
|
36
|
+
title: capitalize(column),
|
|
37
|
+
render: (date) => /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(RecentTime, { date }))
|
|
38
|
+
};
|
|
39
|
+
else if (column.includes("status") || column.includes("Status"))
|
|
40
|
+
return {
|
|
41
|
+
key: column,
|
|
42
|
+
dataIndex: column,
|
|
43
|
+
title: capitalize(column),
|
|
44
|
+
render: (status) => /* @__PURE__ */ React.createElement(StatusTag, { status })
|
|
45
|
+
};
|
|
46
|
+
else if (column.includes("role") || column.includes("Role"))
|
|
47
|
+
return {
|
|
48
|
+
key: column,
|
|
49
|
+
dataIndex: column,
|
|
50
|
+
title: capitalize(column),
|
|
51
|
+
render: (role) => /* @__PURE__ */ React.createElement(RoleTags, { role })
|
|
52
|
+
};
|
|
53
|
+
else
|
|
54
|
+
return { key: column, dataIndex: column, title: capitalize(column) };
|
|
55
|
+
};
|
|
56
|
+
function Item({
|
|
57
|
+
className,
|
|
58
|
+
model,
|
|
59
|
+
sliceName,
|
|
60
|
+
onClick,
|
|
61
|
+
title,
|
|
62
|
+
actions = [],
|
|
63
|
+
columns = [],
|
|
64
|
+
children
|
|
65
|
+
}) {
|
|
66
|
+
const { l } = usePage();
|
|
67
|
+
const strActions = actions.filter((action) => typeof action === "string").map((action, idx) => /* @__PURE__ */ React.createElement(Action, { key: idx, action, outline: false, model, sliceName }));
|
|
68
|
+
const customActions = actions.filter((action) => typeof action !== "string").map((action, idx) => ({
|
|
69
|
+
key: idx,
|
|
70
|
+
label: typeof action !== "string" ? action.render() : null
|
|
71
|
+
}));
|
|
72
|
+
const extraCols = columns.filter((column) => {
|
|
73
|
+
const key = typeof column === "string" ? column : column.key;
|
|
74
|
+
return !["id", "status", "createdAt"].includes(key);
|
|
75
|
+
}).map((column, idx) => {
|
|
76
|
+
const key = typeof column === "string" ? column : column.key;
|
|
77
|
+
const title2 = typeof column !== "string" && column.title ? column.title : l.field(sliceName, key);
|
|
78
|
+
const render = convToAntdColumn(column).render ?? ((v, m, i) => JSON.stringify(v, null, 2));
|
|
79
|
+
const modelKeyLength = model[key]?.length;
|
|
80
|
+
if (convToAntdColumn(column).render) {
|
|
81
|
+
return /* @__PURE__ */ React.createElement("div", { key: idx, className: "flex-wrap overflow-hidden text-xs" }, !!modelKeyLength && /* @__PURE__ */ React.createElement("span", { className: "flex items-center gap-3" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold whitespace-nowrap" }, title2), /* @__PURE__ */ React.createElement("span", { className: "text-sm" }, render(model[key], model, idx))));
|
|
82
|
+
}
|
|
83
|
+
return /* @__PURE__ */ React.createElement("div", { key: idx, className: "flex-wrap overflow-hidden text-xs" }, !!modelKeyLength && /* @__PURE__ */ React.createElement("span", { className: "flex items-center gap-3" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold whitespace-nowrap" }, title2), /* @__PURE__ */ React.createElement("span", { className: "text-sm" }, model[key])));
|
|
84
|
+
});
|
|
85
|
+
return /* @__PURE__ */ React.createElement("div", { className: clsx("flex flex-col", className) }, children ? /* @__PURE__ */ React.createElement("div", { className: "flex justify-center" }, /* @__PURE__ */ React.createElement("div", { className: "relative size-full", onClick }, children, /* @__PURE__ */ React.createElement("div", { className: "absolute inset-0" }))) : title ? /* @__PURE__ */ React.createElement("div", { className: "font-bold" }, title) : null, /* @__PURE__ */ React.createElement("div", { className: "bg-primary/5 mt-2 h-full rounded-lg p-2" }, /* @__PURE__ */ React.createElement("div", { className: "mb-2 flex justify-between" }, /* @__PURE__ */ React.createElement("div", { className: "[&_.badge]:badge-xs [&_.badge]:p-2" }, columns.find((c) => c === "id") && /* @__PURE__ */ React.createElement(ObjectId, { id: model.id })), /* @__PURE__ */ React.createElement("div", { className: "flex items-end justify-center gap-2" }, columns.find((c) => c === "createdAt") && /* @__PURE__ */ React.createElement(RecentTime, { date: model.createdAt, className: "text-xs opacity-60" }), columns.find((c) => c === "status") && /* @__PURE__ */ React.createElement(StatusTag, { status: model.status, className: "badge-xs mr-0 p-2" }))), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-1" }, extraCols), /* @__PURE__ */ React.createElement("div", { className: "flex w-full justify-around" }, strActions.map((action, idx) => /* @__PURE__ */ React.createElement("div", { className: "", key: idx }, action)), customActions.length ? /* @__PURE__ */ React.createElement(
|
|
86
|
+
Dropdown,
|
|
87
|
+
{
|
|
88
|
+
buttonClassName: "m-1 text-center btn btn-square btn-ghost btn-sm ",
|
|
89
|
+
value: /* @__PURE__ */ React.createElement(AiOutlineMore, null),
|
|
90
|
+
content: customActions.map((action) => /* @__PURE__ */ React.createElement("div", { key: action.key }, action.label))
|
|
91
|
+
}
|
|
92
|
+
) : null)));
|
|
93
|
+
}
|
|
94
|
+
const Action = ({
|
|
95
|
+
action,
|
|
96
|
+
model,
|
|
97
|
+
sliceName,
|
|
98
|
+
outline = true
|
|
99
|
+
}) => {
|
|
100
|
+
const { l } = usePage();
|
|
101
|
+
const storeDo = st.do;
|
|
102
|
+
const storeGet = st.get;
|
|
103
|
+
const refName = st.slice[sliceName].refName;
|
|
104
|
+
const [modelName, modelClassName] = [refName, capitalize(refName)];
|
|
105
|
+
const names = {
|
|
106
|
+
model: modelName,
|
|
107
|
+
editModel: `edit${modelClassName}`,
|
|
108
|
+
viewModel: `view${modelClassName}`,
|
|
109
|
+
removeModel: `remove${modelClassName}`
|
|
110
|
+
};
|
|
111
|
+
const namesOfSlice = {
|
|
112
|
+
editModel: sliceName.replace(names.model, names.editModel),
|
|
113
|
+
viewModel: sliceName.replace(names.model, names.viewModel),
|
|
114
|
+
removeModel: sliceName.replace(names.model, names.removeModel)
|
|
115
|
+
};
|
|
116
|
+
return action === "edit" ? /* @__PURE__ */ React.createElement(
|
|
117
|
+
"button",
|
|
118
|
+
{
|
|
119
|
+
className: `btn btn-square btn-ghost btn-sm m-1 text-center ${outline && "btn-outline border-dashed"}`,
|
|
120
|
+
onClick: () => void storeDo[namesOfSlice.editModel](model.id)
|
|
121
|
+
},
|
|
122
|
+
/* @__PURE__ */ React.createElement(AiOutlineEdit, { key: action })
|
|
123
|
+
) : action === "view" ? /* @__PURE__ */ React.createElement(
|
|
124
|
+
"button",
|
|
125
|
+
{
|
|
126
|
+
className: `btn btn-square btn-ghost btn-sm m-1 text-center ${outline && "btn-outline border-dashed"}`,
|
|
127
|
+
onClick: () => void storeDo[namesOfSlice.viewModel](model.id)
|
|
128
|
+
},
|
|
129
|
+
/* @__PURE__ */ React.createElement(AiOutlineEye, { key: action })
|
|
130
|
+
) : action === "remove" ? /* @__PURE__ */ React.createElement(
|
|
131
|
+
Popconfirm,
|
|
132
|
+
{
|
|
133
|
+
key: action,
|
|
134
|
+
title: l("shared.removeMsg"),
|
|
135
|
+
onConfirm: () => void storeDo[namesOfSlice.removeModel](model.id)
|
|
136
|
+
},
|
|
137
|
+
/* @__PURE__ */ React.createElement("button", { className: `btn btn-square btn-ghost btn-sm m-1 text-center ${outline && "btn-outline border-dashed"}` }, /* @__PURE__ */ React.createElement(AiOutlineDelete, null))
|
|
138
|
+
) : action.render();
|
|
139
|
+
};
|
|
140
|
+
const statusColors = {
|
|
141
|
+
active: "badge-info badge-outline",
|
|
142
|
+
applied: "badge-warning",
|
|
143
|
+
approved: "badge-success",
|
|
144
|
+
denied: "badge-error badge-outline",
|
|
145
|
+
failed: "badge-error badge-outline",
|
|
146
|
+
restricted: "badge-error",
|
|
147
|
+
paused: "badge-outline",
|
|
148
|
+
running: "badge-warning badge-outline",
|
|
149
|
+
break: "badge-accent badge-outline",
|
|
150
|
+
rejected: "badge-error badge-outline",
|
|
151
|
+
hidden: "badge-outline",
|
|
152
|
+
inProgress: "badge-accent",
|
|
153
|
+
resolved: "badge-success badge-outline",
|
|
154
|
+
finished: "badge-secondary"
|
|
155
|
+
};
|
|
156
|
+
const StatusTag = ({ status, className }) => {
|
|
157
|
+
return /* @__PURE__ */ React.createElement("div", { className: clsx(`badge mr-1 p-3 ${statusColors[status] ?? "badge-outline"}`, className) }, status);
|
|
158
|
+
};
|
|
159
|
+
Item.StatusTag = StatusTag;
|
|
160
|
+
const roleColors = {
|
|
161
|
+
user: "badge-success",
|
|
162
|
+
business: "badge-warning",
|
|
163
|
+
admin: "badge-error badge-outline",
|
|
164
|
+
superAdmin: "badge-error",
|
|
165
|
+
root: "badge-primary"
|
|
166
|
+
};
|
|
167
|
+
const RoleTags = ({ role }) => {
|
|
168
|
+
return Array.isArray(role) ? /* @__PURE__ */ React.createElement(React.Fragment, null, role.map((role2) => /* @__PURE__ */ React.createElement("div", { className: `badge mr-1 ${roleColors[role2]}`, key: role2 }, role2))) : /* @__PURE__ */ React.createElement("div", { className: "badge mr-1", style: { backgroundColor: roleColors[role] } }, role);
|
|
169
|
+
};
|
|
170
|
+
Item.RoleTags = RoleTags;
|
|
171
|
+
export {
|
|
172
|
+
Action,
|
|
173
|
+
convToAntdColumn,
|
|
174
|
+
Item as default
|
|
175
|
+
};
|