@akanjs/ui 0.0.150 → 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/Model/New.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var New_exports = {};
|
|
29
|
+
__export(New_exports, {
|
|
30
|
+
default: () => New
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(New_exports);
|
|
33
|
+
var import_client = require("@akanjs/client");
|
|
34
|
+
var import_next = require("@akanjs/next");
|
|
35
|
+
var import_ai = require("react-icons/ai");
|
|
36
|
+
var import_EditModal = __toESM(require("./EditModal"));
|
|
37
|
+
var import_NewWrapper = __toESM(require("./NewWrapper"));
|
|
38
|
+
function New({
|
|
39
|
+
className,
|
|
40
|
+
wrapperClassName,
|
|
41
|
+
type = "button",
|
|
42
|
+
children,
|
|
43
|
+
sliceName,
|
|
44
|
+
modal,
|
|
45
|
+
partial,
|
|
46
|
+
renderTitle
|
|
47
|
+
}) {
|
|
48
|
+
const { l } = (0, import_next.usePage)();
|
|
49
|
+
return /* @__PURE__ */ React.createElement("div", { className: (0, import_client.clsx)("inline", wrapperClassName) }, /* @__PURE__ */ React.createElement(
|
|
50
|
+
import_NewWrapper.default,
|
|
51
|
+
{
|
|
52
|
+
className: (0, import_client.clsx)("flex w-full items-center justify-center gap-2", className),
|
|
53
|
+
sliceName,
|
|
54
|
+
modal,
|
|
55
|
+
partial
|
|
56
|
+
},
|
|
57
|
+
/* @__PURE__ */ React.createElement(import_ai.AiOutlinePlus, null),
|
|
58
|
+
" ",
|
|
59
|
+
type === "button" ? l("shared.new") : null
|
|
60
|
+
), /* @__PURE__ */ React.createElement(import_EditModal.default, { renderTitle, sliceName }, children));
|
|
61
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var NewWrapper_exports = {};
|
|
19
|
+
__export(NewWrapper_exports, {
|
|
20
|
+
default: () => NewWrapper
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(NewWrapper_exports);
|
|
23
|
+
var import_common = require("@akanjs/common");
|
|
24
|
+
var import_NewWrapper_Client = require("./NewWrapper_Client");
|
|
25
|
+
function NewWrapper({ partial = {}, ...props }) {
|
|
26
|
+
const serializedPartial = (0, import_common.deepObjectify)(typeof partial === "function" ? partial() : partial, { serializable: true });
|
|
27
|
+
return /* @__PURE__ */ React.createElement(import_NewWrapper_Client.NewWrapper_Client, { ...props, partial: serializedPartial });
|
|
28
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var NewWrapper_Client_exports = {};
|
|
20
|
+
__export(NewWrapper_Client_exports, {
|
|
21
|
+
NewWrapper_Client: () => NewWrapper_Client
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(NewWrapper_Client_exports);
|
|
24
|
+
var import_client = require("@akanjs/client");
|
|
25
|
+
var import_common = require("@akanjs/common");
|
|
26
|
+
var import_signal = require("@akanjs/signal");
|
|
27
|
+
var import_store = require("@akanjs/store");
|
|
28
|
+
const NewWrapper_Client = ({
|
|
29
|
+
children,
|
|
30
|
+
sliceName,
|
|
31
|
+
partial,
|
|
32
|
+
setDefault,
|
|
33
|
+
className,
|
|
34
|
+
modal,
|
|
35
|
+
resets
|
|
36
|
+
}) => {
|
|
37
|
+
const refName = import_store.st.slice[sliceName].refName;
|
|
38
|
+
const modelName = refName;
|
|
39
|
+
const names = {
|
|
40
|
+
newModel: `new${(0, import_common.capitalize)(modelName)}`,
|
|
41
|
+
crystalizeModel: `crystalize${(0, import_common.capitalize)(modelName)}`,
|
|
42
|
+
modelModal: `${modelName}Modal`
|
|
43
|
+
};
|
|
44
|
+
const storeDo = import_store.st.do;
|
|
45
|
+
const storeUse = import_store.st.use;
|
|
46
|
+
const crystalizeModel = import_signal.fetch[names.crystalizeModel];
|
|
47
|
+
const modelModal = storeUse[names.modelModal]();
|
|
48
|
+
const disabled = modelModal === "edit";
|
|
49
|
+
return /* @__PURE__ */ React.createElement(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
className: (0, import_client.clsx)({ "cursor-pointer": !disabled, "pointer-events-none": disabled }, className),
|
|
53
|
+
onClick: (e) => {
|
|
54
|
+
e.stopPropagation();
|
|
55
|
+
if (disabled)
|
|
56
|
+
return;
|
|
57
|
+
const crystal = crystalizeModel(partial);
|
|
58
|
+
void storeDo[names.newModel](crystal, { modal, setDefault, sliceName });
|
|
59
|
+
resets?.forEach((reset) => {
|
|
60
|
+
void storeDo[`reset${(0, import_common.capitalize)(reset)}`]();
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
children
|
|
65
|
+
);
|
|
66
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Remove_exports = {};
|
|
20
|
+
__export(Remove_exports, {
|
|
21
|
+
default: () => Remove
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Remove_exports);
|
|
24
|
+
var import_client = require("@akanjs/client");
|
|
25
|
+
var import_common = require("@akanjs/common");
|
|
26
|
+
var import_dictionary = require("@akanjs/dictionary");
|
|
27
|
+
var import_next = require("@akanjs/next");
|
|
28
|
+
var import_store = require("@akanjs/store");
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_ai = require("react-icons/ai");
|
|
31
|
+
var import_Button = require("../Button");
|
|
32
|
+
var import_Modal = require("../Modal");
|
|
33
|
+
function Remove({ className, name, modelId, sliceName, modal, redirect }) {
|
|
34
|
+
const { l } = (0, import_next.usePage)();
|
|
35
|
+
const [modalOpen, setModalOpen] = (0, import_react.useState)(false);
|
|
36
|
+
const storeDo = import_store.st.do;
|
|
37
|
+
const refName = import_store.st.slice[sliceName].refName;
|
|
38
|
+
const modelName = refName;
|
|
39
|
+
const names = (0, import_react.useMemo)(
|
|
40
|
+
() => ({
|
|
41
|
+
removeModel: `remove${(0, import_common.capitalize)(modelName)}`
|
|
42
|
+
}),
|
|
43
|
+
[]
|
|
44
|
+
);
|
|
45
|
+
return /* @__PURE__ */ React.createElement("div", { className: "inline size-full" }, /* @__PURE__ */ React.createElement(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
className: (0, import_client.clsx)("btn text-error btn-sm size-full flex-nowrap whitespace-nowrap", className),
|
|
49
|
+
onClick: (e) => {
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
setModalOpen(true);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
/* @__PURE__ */ React.createElement(import_ai.AiOutlineDelete, null),
|
|
55
|
+
" ",
|
|
56
|
+
l("shared.remove")
|
|
57
|
+
), /* @__PURE__ */ React.createElement(
|
|
58
|
+
import_Modal.Modal,
|
|
59
|
+
{
|
|
60
|
+
open: modalOpen,
|
|
61
|
+
onCancel: () => {
|
|
62
|
+
setModalOpen(false);
|
|
63
|
+
},
|
|
64
|
+
title: /* @__PURE__ */ React.createElement("div", { className: "text-error text-lg font-bold" }, l("shared.removeModel", { model: l(`${modelName}.modelName`) })),
|
|
65
|
+
action: /* @__PURE__ */ React.createElement(
|
|
66
|
+
import_Button.Button,
|
|
67
|
+
{
|
|
68
|
+
className: "btn btn-warning w-full",
|
|
69
|
+
onClick: async (e, { onError }) => {
|
|
70
|
+
await storeDo[names.removeModel](modelId, { onError, modal });
|
|
71
|
+
import_dictionary.msg.success("shared.removeSuccess", { data: { model: l(`${modelName}.modelName`) } });
|
|
72
|
+
setModalOpen(false);
|
|
73
|
+
if (!redirect)
|
|
74
|
+
return;
|
|
75
|
+
if (redirect === "back")
|
|
76
|
+
import_client.router.back();
|
|
77
|
+
else
|
|
78
|
+
import_client.router.push(redirect);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
l("shared.yesRemove", { model: l(`${modelName}.modelName`) })
|
|
82
|
+
)
|
|
83
|
+
},
|
|
84
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex w-full items-center justify-center" }, l("shared.sureToRemove", { model: l(`${modelName}.modelName`), name: name ?? "" }))
|
|
85
|
+
));
|
|
86
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var RemoveWrapper_exports = {};
|
|
20
|
+
__export(RemoveWrapper_exports, {
|
|
21
|
+
default: () => RemoveWrapper
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(RemoveWrapper_exports);
|
|
24
|
+
var import_client = require("@akanjs/client");
|
|
25
|
+
var import_common = require("@akanjs/common");
|
|
26
|
+
var import_next = require("@akanjs/next");
|
|
27
|
+
var import_store = require("@akanjs/store");
|
|
28
|
+
var import_Popconfirm = require("../Popconfirm");
|
|
29
|
+
function RemoveWrapper({ children, sliceName, name, modelId, className, modal }) {
|
|
30
|
+
const { l } = (0, import_next.usePage)();
|
|
31
|
+
const refName = import_store.st.slice[sliceName].refName;
|
|
32
|
+
const modelName = refName;
|
|
33
|
+
const names = {
|
|
34
|
+
removeModel: `remove${(0, import_common.capitalize)(modelName)}`
|
|
35
|
+
};
|
|
36
|
+
const storeDo = import_store.st.do;
|
|
37
|
+
return /* @__PURE__ */ React.createElement(
|
|
38
|
+
import_Popconfirm.Popconfirm,
|
|
39
|
+
{
|
|
40
|
+
title: l("shared.removeModel", { model: l(`${modelName}.modelName`) }),
|
|
41
|
+
description: /* @__PURE__ */ React.createElement("div", null, l("shared.sureToRemove", { model: l(`${modelName}.modelName`), name })),
|
|
42
|
+
onConfirm: () => {
|
|
43
|
+
void storeDo[names.removeModel](modelId, { modal });
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
/* @__PURE__ */ React.createElement("div", { className: (0, import_client.clsx)("cursor-pointer", className) }, children)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var SureToRemove_exports = {};
|
|
20
|
+
__export(SureToRemove_exports, {
|
|
21
|
+
default: () => SureToRemove
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(SureToRemove_exports);
|
|
24
|
+
var import_client = require("@akanjs/client");
|
|
25
|
+
var import_common = require("@akanjs/common");
|
|
26
|
+
var import_dictionary = require("@akanjs/dictionary");
|
|
27
|
+
var import_next = require("@akanjs/next");
|
|
28
|
+
var import_store = require("@akanjs/store");
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_ai = require("react-icons/ai");
|
|
31
|
+
var import_Modal = require("../Modal");
|
|
32
|
+
function SureToRemove({
|
|
33
|
+
className,
|
|
34
|
+
modelId,
|
|
35
|
+
name,
|
|
36
|
+
sliceName,
|
|
37
|
+
redirect,
|
|
38
|
+
typeNameToRemove
|
|
39
|
+
}) {
|
|
40
|
+
const { l } = (0, import_next.usePage)();
|
|
41
|
+
const [repeatName, setRepeatName] = (0, import_react.useState)("");
|
|
42
|
+
const [modalOpen, setModalOpen] = (0, import_react.useState)(false);
|
|
43
|
+
const storeDo = import_store.st.do;
|
|
44
|
+
const refName = import_store.st.slice[sliceName].refName;
|
|
45
|
+
const modelName = refName;
|
|
46
|
+
const names = (0, import_react.useMemo)(
|
|
47
|
+
() => ({
|
|
48
|
+
removeModel: `remove${(0, import_common.capitalize)(modelName)}`
|
|
49
|
+
}),
|
|
50
|
+
[]
|
|
51
|
+
);
|
|
52
|
+
return /* @__PURE__ */ React.createElement("div", { className: "inline size-full" }, /* @__PURE__ */ React.createElement(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
className: (0, import_client.clsx)(
|
|
56
|
+
"text-error flex size-full cursor-pointer flex-nowrap items-center justify-center gap-2 whitespace-nowrap",
|
|
57
|
+
className
|
|
58
|
+
),
|
|
59
|
+
onClick: (e) => {
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
setModalOpen(true);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
/* @__PURE__ */ React.createElement(import_ai.AiOutlineDelete, null),
|
|
65
|
+
" ",
|
|
66
|
+
l("shared.remove")
|
|
67
|
+
), /* @__PURE__ */ React.createElement(
|
|
68
|
+
import_Modal.Modal,
|
|
69
|
+
{
|
|
70
|
+
open: modalOpen,
|
|
71
|
+
onCancel: () => {
|
|
72
|
+
setModalOpen(false);
|
|
73
|
+
},
|
|
74
|
+
title: /* @__PURE__ */ React.createElement("div", { className: "text-error text-lg font-bold" }, l("shared.removeModel", { model: l(`${modelName}.modelName`) })),
|
|
75
|
+
bodyClassName: "border-error",
|
|
76
|
+
action: /* @__PURE__ */ React.createElement(
|
|
77
|
+
"button",
|
|
78
|
+
{
|
|
79
|
+
className: "btn btn-error w-full",
|
|
80
|
+
disabled: typeNameToRemove && repeatName !== name,
|
|
81
|
+
onClick: async () => {
|
|
82
|
+
await storeDo[names.removeModel](modelId);
|
|
83
|
+
import_dictionary.msg.success("shared.removeSuccess", { data: { model: l(`${modelName}.modelName`) } });
|
|
84
|
+
setModalOpen(false);
|
|
85
|
+
if (!redirect)
|
|
86
|
+
return;
|
|
87
|
+
if (redirect === "back")
|
|
88
|
+
import_client.router.back();
|
|
89
|
+
else
|
|
90
|
+
import_client.router.push(redirect);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
l("shared.removeModel", { model: l(`${modelName}.modelName`) })
|
|
94
|
+
)
|
|
95
|
+
},
|
|
96
|
+
/* @__PURE__ */ React.createElement("div", { className: "py-4" }, l("shared.sureToRemove", { model: l(`${modelName}.modelName`), name }), /* @__PURE__ */ React.createElement("br", null), l("shared.irreversibleOps"), typeNameToRemove ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("br", null), l("shared.typeNameToRemove", { model: l(`${modelName}.modelName`), name })) : null),
|
|
97
|
+
typeNameToRemove ? /* @__PURE__ */ React.createElement(
|
|
98
|
+
"input",
|
|
99
|
+
{
|
|
100
|
+
className: "input w-full text-center",
|
|
101
|
+
placeholder: `${l(`${modelName}.modelName`)} name`,
|
|
102
|
+
value: repeatName,
|
|
103
|
+
onChange: (e) => {
|
|
104
|
+
setRepeatName(e.target.value);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
) : null
|
|
108
|
+
));
|
|
109
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var View_exports = {};
|
|
20
|
+
__export(View_exports, {
|
|
21
|
+
default: () => View
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(View_exports);
|
|
24
|
+
var import_react = require("react");
|
|
25
|
+
var import_ai = require("react-icons/ai");
|
|
26
|
+
function View({
|
|
27
|
+
className,
|
|
28
|
+
model,
|
|
29
|
+
modelLoading = true,
|
|
30
|
+
render,
|
|
31
|
+
loadingWrapper,
|
|
32
|
+
loading,
|
|
33
|
+
empty
|
|
34
|
+
}) {
|
|
35
|
+
const RenderLoadingWrapper = (0, import_react.useMemo)(
|
|
36
|
+
() => loadingWrapper === null ? ({ children, className: className2 }) => children : loadingWrapper ?? (({ children, className: className2 }) => /* @__PURE__ */ React.createElement(React.Fragment, null, children, modelLoading ? /* @__PURE__ */ React.createElement("div", { className: "absolute inset-0 animate-pulse" }) : null)),
|
|
37
|
+
[modelLoading]
|
|
38
|
+
);
|
|
39
|
+
const RenderModel = (0, import_react.useMemo)(
|
|
40
|
+
() => modelLoading ? loading === null ? () => null : loading ?? (() => /* @__PURE__ */ React.createElement("div", { className: "flex size-full flex-col items-center justify-center gap-3 pt-6 pb-3" }, /* @__PURE__ */ React.createElement("span", { className: "loading loading-dots loading-lg" }), "Loading")) : model ? () => render(model) : empty === null ? () => null : empty ?? (() => /* @__PURE__ */ React.createElement("div", { className: "flex w-full flex-col items-center justify-center gap-3 pt-6 pb-3" }, /* @__PURE__ */ React.createElement(import_ai.AiOutlineMeh, { className: "scale-150 text-4xl" }), " Empty")),
|
|
41
|
+
[model, modelLoading]
|
|
42
|
+
);
|
|
43
|
+
return /* @__PURE__ */ React.createElement(RenderLoadingWrapper, { className }, /* @__PURE__ */ React.createElement(RenderModel, null));
|
|
44
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
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
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var ViewEditModal_exports = {};
|
|
30
|
+
__export(ViewEditModal_exports, {
|
|
31
|
+
default: () => ViewEditModal
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(ViewEditModal_exports);
|
|
34
|
+
var import_common = require("@akanjs/common");
|
|
35
|
+
var import_next = require("@akanjs/next");
|
|
36
|
+
var import_store = require("@akanjs/store");
|
|
37
|
+
var import_ai = require("react-icons/ai");
|
|
38
|
+
var import_bi = require("react-icons/bi");
|
|
39
|
+
var import_Modal = require("../Modal");
|
|
40
|
+
var import_Remove = __toESM(require("./Remove"));
|
|
41
|
+
var import_View = __toESM(require("./View"));
|
|
42
|
+
function ViewEditModal({
|
|
43
|
+
modalClassName,
|
|
44
|
+
viewClassName,
|
|
45
|
+
sliceName,
|
|
46
|
+
renderTitle,
|
|
47
|
+
renderView,
|
|
48
|
+
renderTemplate
|
|
49
|
+
}) {
|
|
50
|
+
const { l } = (0, import_next.usePage)();
|
|
51
|
+
const storeUse = import_store.st.use;
|
|
52
|
+
const storeDo = import_store.st.do;
|
|
53
|
+
const storeSel = import_store.st.sel;
|
|
54
|
+
const refName = import_store.st.slice[sliceName].refName;
|
|
55
|
+
const [modelName, ModelName] = [refName, (0, import_common.capitalize)(refName)];
|
|
56
|
+
const names = {
|
|
57
|
+
model: modelName,
|
|
58
|
+
Model: ModelName,
|
|
59
|
+
viewModel: `view${ModelName}`,
|
|
60
|
+
modelLoading: `${modelName}Loading`,
|
|
61
|
+
modelModal: `${modelName}Modal`,
|
|
62
|
+
resetModel: `reset${ModelName}`,
|
|
63
|
+
editModel: `edit${ModelName}`,
|
|
64
|
+
submitModel: `submit${ModelName}`,
|
|
65
|
+
modelForm: `${modelName}Form`
|
|
66
|
+
};
|
|
67
|
+
const model = storeUse[names.model]();
|
|
68
|
+
const modelModal = storeUse[names.modelModal]();
|
|
69
|
+
const modelLoading = storeUse[names.modelLoading]();
|
|
70
|
+
const modelFormId = storeSel((state) => state[names.modelForm].id);
|
|
71
|
+
const isModalOpen = modelModal === "view" || modelModal === "edit" && !!modelFormId;
|
|
72
|
+
const Title = () => {
|
|
73
|
+
if (!model || modelLoading || !renderTitle)
|
|
74
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
75
|
+
const render = renderTitle(model);
|
|
76
|
+
if (typeof render === "string")
|
|
77
|
+
return /* @__PURE__ */ React.createElement("h2", { className: "flex items-center text-sm md:text-base lg:text-lg xl:text-2xl" }, render);
|
|
78
|
+
else
|
|
79
|
+
return render;
|
|
80
|
+
};
|
|
81
|
+
const Template = renderTemplate;
|
|
82
|
+
return /* @__PURE__ */ React.createElement(
|
|
83
|
+
import_Modal.Modal,
|
|
84
|
+
{
|
|
85
|
+
open: isModalOpen,
|
|
86
|
+
onCancel: () => {
|
|
87
|
+
storeDo[names.resetModel]();
|
|
88
|
+
},
|
|
89
|
+
className: modalClassName,
|
|
90
|
+
title: /* @__PURE__ */ React.createElement("div", { className: "flex w-full items-center justify-between" }, /* @__PURE__ */ React.createElement(Title, null), /* @__PURE__ */ React.createElement("div", { className: "dropdown dropdown-end" }, /* @__PURE__ */ React.createElement("label", { tabIndex: 0, className: "btn btn-square m-1" }, /* @__PURE__ */ React.createElement(import_bi.BiDotsVertical, null)), /* @__PURE__ */ React.createElement("ul", { tabIndex: 0, className: "dropdown-content menu bg-base-100 rounded-box z-[1] p-2 shadow-sm" }, model ? /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement(import_Remove.default, { sliceName, modelId: model.id, modal: null })) : null))),
|
|
91
|
+
action: modelModal === "view" ? /* @__PURE__ */ React.createElement(
|
|
92
|
+
"button",
|
|
93
|
+
{
|
|
94
|
+
className: "btn btn-primary w-full",
|
|
95
|
+
onClick: () => {
|
|
96
|
+
if (model)
|
|
97
|
+
storeDo[names.editModel](model.id);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
/* @__PURE__ */ React.createElement(import_ai.AiOutlineEdit, null),
|
|
101
|
+
" ",
|
|
102
|
+
l("shared.edit")
|
|
103
|
+
) : /* @__PURE__ */ React.createElement(
|
|
104
|
+
"button",
|
|
105
|
+
{
|
|
106
|
+
className: "btn btn-primary w-full",
|
|
107
|
+
onClick: () => {
|
|
108
|
+
storeDo[names.submitModel]({ sliceName, modal: "view" });
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
/* @__PURE__ */ React.createElement(import_ai.AiOutlineSave, null),
|
|
112
|
+
" ",
|
|
113
|
+
l("shared.save")
|
|
114
|
+
)
|
|
115
|
+
},
|
|
116
|
+
modelModal === "view" ? /* @__PURE__ */ React.createElement(import_View.default, { className: viewClassName, model, modelLoading, render: renderView }) : modelModal === "edit" ? /* @__PURE__ */ React.createElement(Template, null) : null
|
|
117
|
+
);
|
|
118
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
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
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var ViewModal_exports = {};
|
|
30
|
+
__export(ViewModal_exports, {
|
|
31
|
+
default: () => ViewModal
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(ViewModal_exports);
|
|
34
|
+
var import_common = require("@akanjs/common");
|
|
35
|
+
var import_store = require("@akanjs/store");
|
|
36
|
+
var import_Modal = require("../Modal");
|
|
37
|
+
var import_View = __toESM(require("./View"));
|
|
38
|
+
function ViewModal({
|
|
39
|
+
id,
|
|
40
|
+
modal,
|
|
41
|
+
modalClassName,
|
|
42
|
+
viewClassName,
|
|
43
|
+
sliceName,
|
|
44
|
+
renderTitle,
|
|
45
|
+
renderAction,
|
|
46
|
+
renderView
|
|
47
|
+
}) {
|
|
48
|
+
const storeUse = import_store.st.use;
|
|
49
|
+
const storeDo = import_store.st.do;
|
|
50
|
+
const refName = import_store.st.slice[sliceName].refName;
|
|
51
|
+
const [modelName, ModelName] = [refName, (0, import_common.capitalize)(refName)];
|
|
52
|
+
const names = {
|
|
53
|
+
model: modelName,
|
|
54
|
+
Model: ModelName,
|
|
55
|
+
viewModel: `view${ModelName}`,
|
|
56
|
+
modelLoading: `${modelName}Loading`,
|
|
57
|
+
modelModal: `${modelName}Modal`,
|
|
58
|
+
resetModel: `reset${ModelName}`
|
|
59
|
+
};
|
|
60
|
+
const model = storeUse[names.model]();
|
|
61
|
+
const modelModal = storeUse[names.modelModal]();
|
|
62
|
+
const modelLoading = storeUse[names.modelLoading]();
|
|
63
|
+
const isModalOpen = modelModal === (modal ?? "view") && (modelLoading === id || model?.id === id);
|
|
64
|
+
const Title = () => {
|
|
65
|
+
if (!model || modelLoading || !renderTitle)
|
|
66
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
67
|
+
const render = renderTitle(model);
|
|
68
|
+
if (typeof render === "string")
|
|
69
|
+
return /* @__PURE__ */ React.createElement("h2", { className: "flex items-center text-2xl" }, render);
|
|
70
|
+
else
|
|
71
|
+
return render;
|
|
72
|
+
};
|
|
73
|
+
const Action = () => {
|
|
74
|
+
if (!model || modelLoading || !renderAction)
|
|
75
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
76
|
+
const render = renderAction(model);
|
|
77
|
+
return render;
|
|
78
|
+
};
|
|
79
|
+
return /* @__PURE__ */ React.createElement(
|
|
80
|
+
import_Modal.Modal,
|
|
81
|
+
{
|
|
82
|
+
open: isModalOpen,
|
|
83
|
+
onCancel: () => {
|
|
84
|
+
storeDo[names.resetModel]();
|
|
85
|
+
},
|
|
86
|
+
className: modalClassName,
|
|
87
|
+
title: /* @__PURE__ */ React.createElement(Title, null),
|
|
88
|
+
action: /* @__PURE__ */ React.createElement(Action, null)
|
|
89
|
+
},
|
|
90
|
+
/* @__PURE__ */ React.createElement(import_View.default, { className: viewClassName, model, modelLoading, render: renderView })
|
|
91
|
+
);
|
|
92
|
+
}
|