@thefreshop/tb 1.0.12 → 1.0.14
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/dist/cjs/index.js +26 -24
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/index.d.ts +0 -10
- package/dist/cjs/types/provider.types.d.ts +1 -7
- package/dist/cjs/types/tbframe.types.d.ts +18 -5
- package/dist/esm/index.js +28 -26
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/index.d.ts +0 -10
- package/dist/esm/types/provider.types.d.ts +1 -7
- package/dist/esm/types/tbframe.types.d.ts +18 -5
- package/dist/index.d.ts +19 -22
- package/package.json +1 -1
|
@@ -3,13 +3,3 @@ export * from "./searchbox.type";
|
|
|
3
3
|
export * from "./user.types";
|
|
4
4
|
export * from "./tbframe.types";
|
|
5
5
|
export * from "./provider.types";
|
|
6
|
-
import { tabType } from "./provider.types";
|
|
7
|
-
export interface tbframeType {
|
|
8
|
-
islogin?: boolean;
|
|
9
|
-
isgroup?: boolean;
|
|
10
|
-
isgroupauth?: boolean;
|
|
11
|
-
startpage?: React.ReactNode;
|
|
12
|
-
loginpage?: React.ReactNode;
|
|
13
|
-
logoutComponent?: React.ReactNode;
|
|
14
|
-
globalpages?: tabType[];
|
|
15
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { userType } from "./user.types";
|
|
2
|
-
import { navType } from "./tbframe.types";
|
|
2
|
+
import { navType, tabType } from "./tbframe.types";
|
|
3
3
|
export type ProviderType = {
|
|
4
4
|
topkey: string;
|
|
5
5
|
setTopkey: (value: string) => void;
|
|
@@ -21,12 +21,6 @@ export type ProviderType = {
|
|
|
21
21
|
setMenupages: (value: navType) => void;
|
|
22
22
|
goTabs: (key: string) => void;
|
|
23
23
|
};
|
|
24
|
-
export type tabType = {
|
|
25
|
-
title: string;
|
|
26
|
-
key: string;
|
|
27
|
-
page?: React.ReactNode;
|
|
28
|
-
noremove?: boolean;
|
|
29
|
-
};
|
|
30
24
|
export type ErrMsgType = {
|
|
31
25
|
err?: string;
|
|
32
26
|
errType?: string;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
export interface tbframeType {
|
|
2
|
+
islogin?: boolean;
|
|
3
|
+
isgroup?: boolean;
|
|
4
|
+
isgroupauth?: boolean;
|
|
5
|
+
startpage?: React.ReactNode;
|
|
6
|
+
loginpage?: React.ReactNode;
|
|
7
|
+
logoutComponent?: React.ReactNode;
|
|
8
|
+
globalpages?: tabType[];
|
|
9
|
+
}
|
|
1
10
|
export declare const baseAdminDat: TbFrameType;
|
|
2
11
|
export type TbFrameType = {
|
|
3
12
|
admin_account_id: number;
|
|
@@ -26,21 +35,25 @@ export type topType = {
|
|
|
26
35
|
export type bottomType = {
|
|
27
36
|
bottomRight?: React.ReactNode;
|
|
28
37
|
};
|
|
29
|
-
export type
|
|
38
|
+
export type tabType = {
|
|
30
39
|
title: string;
|
|
31
|
-
icon?: React.ReactElement | JSX.Element;
|
|
32
40
|
key: string;
|
|
33
|
-
children?: menuType[];
|
|
34
41
|
page?: React.ReactNode;
|
|
42
|
+
noremove?: boolean;
|
|
43
|
+
};
|
|
44
|
+
export type menuType = {
|
|
45
|
+
tab: tabType;
|
|
46
|
+
icon?: React.ReactElement | JSX.Element;
|
|
47
|
+
children?: menuType[];
|
|
35
48
|
hasPage?: boolean;
|
|
36
49
|
defalultOpen?: boolean;
|
|
37
50
|
};
|
|
38
51
|
export type navType = {
|
|
39
|
-
menuSet:
|
|
52
|
+
menuSet: menuSetType[];
|
|
40
53
|
openIcon?: React.ReactElement | JSX.Element;
|
|
41
54
|
closeIcon?: React.ReactElement | JSX.Element;
|
|
42
55
|
};
|
|
43
|
-
export type
|
|
56
|
+
export type menuSetType = {
|
|
44
57
|
parentkey?: string;
|
|
45
58
|
menuSetting: menuType[];
|
|
46
59
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { createContext, useState, useEffect, useContext, useCallback, useMemo, useRef, forwardRef, useImperativeHandle, memo } from 'react';
|
|
3
|
-
import { useNavigate, useLocation, Outlet, createHashRouter, createBrowserRouter, RouterProvider } from 'react-router';
|
|
3
|
+
import { useNavigate, useLocation, Outlet, createHashRouter, createBrowserRouter, RouterProvider, Navigate } from 'react-router';
|
|
4
4
|
import Editor from '@monaco-editor/react';
|
|
5
5
|
import { DownOutlined, UpOutlined, DoubleRightOutlined, DoubleLeftOutlined, LoadingOutlined, ReloadOutlined, SearchOutlined, UploadOutlined, ExclamationCircleOutlined, RedoOutlined, TagOutlined } from '@ant-design/icons';
|
|
6
|
-
import { Typography, Row, Col, Space, Button, Input, Tag, Image as Image$1, Tooltip, Upload, Form, Select, DatePicker, Switch, InputNumber, Flex, Modal, Table, List, Card, Checkbox,
|
|
6
|
+
import { Typography, Row, Col, Space, Button, Input, Tag, Image as Image$1, Tooltip, Upload, Form, Select, DatePicker, Switch, InputNumber, Flex, Modal, Table, List, Card, Checkbox, ConfigProvider, Result, Spin } from 'antd';
|
|
7
7
|
import moment$1 from 'moment-timezone';
|
|
8
8
|
import require$$1 from 'react-dom';
|
|
9
9
|
import dayjs from 'dayjs';
|
|
@@ -116,7 +116,7 @@ const TbProvider = ({ children }) => {
|
|
|
116
116
|
menupages?.menuSet.forEach((item) => {
|
|
117
117
|
item.menuSetting.forEach((sub) => {
|
|
118
118
|
sub.children?.forEach((page) => {
|
|
119
|
-
if (page.key === key)
|
|
119
|
+
if (page.tab.key === key)
|
|
120
120
|
gotab = page;
|
|
121
121
|
});
|
|
122
122
|
});
|
|
@@ -194,7 +194,7 @@ var styles$9 = {"main":"frame-module_main__3msGf","mainframe":"frame-module_main
|
|
|
194
194
|
styleInject(css_248z$b);
|
|
195
195
|
|
|
196
196
|
const topbase = {
|
|
197
|
-
title:
|
|
197
|
+
title: "title"};
|
|
198
198
|
|
|
199
199
|
var css_248z$a = ".top-module_topframe__LhKDg{align-items:center;border-bottom:1px solid #aaa;color:#ccc;display:flex;height:80px;justify-content:left;text-align:center}.top-module_top_left__MBLyP{align-items:center;color:#333;display:flex;gap:4px}.top-module_toplogo__lQMPi{background-color:#eee;height:70px}.top-module_top_menu__vOqqG{display:flex;flex-direction:row}.top-module_top_menu_item__pHknH{display:flex;flex-direction:column;width:120px}.top-module_top_menu_item_icon__-Ckvh{font-size:30px}.top-module_top_menu_item_text__SmZnj{font-size:20px}.top-module_menu_nomal__n4Rl-{color:#ccc}.top-module_menu_hover__KmK0A,.top-module_menu_select__w3Jdd{background-color:#fff;color:#333;cursor:pointer}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRvcC5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRCQUdJLGtCQUFtQixDQUVuQiw0QkFBNkIsQ0FFN0IsVUFBVyxDQU5YLFlBQWEsQ0FHYixXQUFZLENBRlosb0JBQXFCLENBSXJCLGlCQUVKLENBRUEsNEJBR0ksa0JBQW1CLENBQ25CLFVBQVcsQ0FIWCxZQUFhLENBQ2IsT0FHSixDQUVBLDJCQUVJLHFCQUFzQixDQUR0QixXQUVKLENBRUEsNEJBQ0ksWUFBYSxDQUNiLGtCQUNKLENBQ0EsaUNBQ0ksWUFBYSxDQUNiLHFCQUFzQixDQUN0QixXQUNKLENBRUEsc0NBQ0ksY0FDSixDQUVBLHNDQUNJLGNBQ0osQ0FFQSw4QkFDSSxVQUNKLENBT0EsNkRBQ0kscUJBQXNCLENBQ3RCLFVBQVcsQ0FDWCxjQUNKIiwiZmlsZSI6InRvcC5tb2R1bGUuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLnRvcGZyYW1lIHtcclxuICAgIGRpc3BsYXk6IGZsZXg7XHJcbiAgICBqdXN0aWZ5LWNvbnRlbnQ6IGxlZnQ7XHJcbiAgICBhbGlnbi1pdGVtczogY2VudGVyO1xyXG4gICAgaGVpZ2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var styles$8 = {"topframe":"top-module_topframe__LhKDg","top_left":"top-module_top_left__MBLyP","toplogo":"top-module_toplogo__lQMPi","top_menu":"top-module_top_menu__vOqqG","top_menu_item":"top-module_top_menu_item__pHknH","top_menu_item_icon":"top-module_top_menu_item_icon__-Ckvh","top_menu_item_text":"top-module_top_menu_item_text__SmZnj","menu_nomal":"top-module_menu_nomal__n4Rl-","menu_hover":"top-module_menu_hover__KmK0A"};
|
|
@@ -260,7 +260,7 @@ const Nav = ({ nav: { menuSet, openIcon, closeIcon }, islogin }) => {
|
|
|
260
260
|
}
|
|
261
261
|
else {
|
|
262
262
|
const userCurrentMenu = currentMenu?.menuSetting.filter((m) => {
|
|
263
|
-
return user?.user_group?.group_menu_auth.includes(m.key);
|
|
263
|
+
return user?.user_group?.group_menu_auth.includes(m.tab.key);
|
|
264
264
|
});
|
|
265
265
|
userCurrentMenu?.forEach((m, index) => {
|
|
266
266
|
usermenutable.push(React__default.createElement(Menu, { key: index, menu_setting: m, openIcon: openIcon, closeIcon: closeIcon, islogin: islogin }));
|
|
@@ -270,7 +270,8 @@ const Nav = ({ nav: { menuSet, openIcon, closeIcon }, islogin }) => {
|
|
|
270
270
|
};
|
|
271
271
|
return React__default.createElement("div", { className: styles$9.naviFrame }, userMenu());
|
|
272
272
|
};
|
|
273
|
-
const Menu = ({ menu_setting: {
|
|
273
|
+
const Menu = ({ menu_setting: { tab, icon, children, hasPage, defalultOpen }, openIcon, closeIcon, islogin, }) => {
|
|
274
|
+
const { title, key, page } = tab;
|
|
274
275
|
const [hover, setHover] = useState(false);
|
|
275
276
|
const [subOpen, setSubOpen] = useState(false);
|
|
276
277
|
const { addTabs, currentTab, user } = useTbState();
|
|
@@ -291,7 +292,7 @@ const Menu = ({ menu_setting: { title, icon, key, children, hasPage, page, defal
|
|
|
291
292
|
}
|
|
292
293
|
else {
|
|
293
294
|
const userCurrentMenu = children?.filter((m) => {
|
|
294
|
-
return user?.user_group?.group_menu_auth.includes(m.key);
|
|
295
|
+
return user?.user_group?.group_menu_auth.includes(m.tab.key);
|
|
295
296
|
});
|
|
296
297
|
userCurrentMenu?.forEach((m, index) => {
|
|
297
298
|
usersubmenutable.push(React__default.createElement(SubMenu, { key: index, menu_setting: m }));
|
|
@@ -321,7 +322,8 @@ const Menu = ({ menu_setting: { title, icon, key, children, hasPage, page, defal
|
|
|
321
322
|
React__default.createElement("div", { className: styles$9.nav_open }, children && (subOpen ? React__default.createElement("div", null, openIcon) : React__default.createElement("div", null, closeIcon)))),
|
|
322
323
|
children && subOpen && userSubMenu()));
|
|
323
324
|
};
|
|
324
|
-
const SubMenu = ({ menu_setting: {
|
|
325
|
+
const SubMenu = ({ menu_setting: { tab, icon, hasPage } }) => {
|
|
326
|
+
const { title, key, page } = tab;
|
|
325
327
|
const [hover, setHover] = useState(false);
|
|
326
328
|
const { addTabs, currentTab } = useTbState();
|
|
327
329
|
const navigate = useNavigate();
|
|
@@ -381,11 +383,11 @@ const Tabs = ({ nav: { menuSet, openIcon, closeIcon } }) => {
|
|
|
381
383
|
// 2-1. 메뉴 페이지에서 찾기
|
|
382
384
|
menuSet.forEach((item) => {
|
|
383
385
|
item.menuSetting.forEach((sub) => {
|
|
384
|
-
if (sub.key === pathKey)
|
|
386
|
+
if (sub.tab.key === pathKey)
|
|
385
387
|
tabInfo = sub;
|
|
386
388
|
else {
|
|
387
389
|
sub.children?.forEach((page) => {
|
|
388
|
-
if (page.key === pathKey)
|
|
390
|
+
if (page.tab.key === pathKey)
|
|
389
391
|
tabInfo = page;
|
|
390
392
|
});
|
|
391
393
|
}
|
|
@@ -403,8 +405,7 @@ const Tabs = ({ nav: { menuSet, openIcon, closeIcon } }) => {
|
|
|
403
405
|
useEffect(() => {
|
|
404
406
|
const pathKey = location.pathname.substring(1); // 맨 앞의 '/' 제거
|
|
405
407
|
findTabs(pathKey);
|
|
406
|
-
|
|
407
|
-
}, []); // 이 효과는 컴포넌트가 처음 마운트될 때 한 번만 실행됩니다.
|
|
408
|
+
}, []);
|
|
408
409
|
return (React__default.createElement("div", { className: styles$6.tabFrame }, tabs?.map((m) => {
|
|
409
410
|
return (React__default.createElement("div", { key: m.key, className: `${styles$6.tab_item} ${currentTab?.key === m.key ? styles$6.tab_select : styles$6.tab_normal}` },
|
|
410
411
|
React__default.createElement("div", { className: styles$6.tab_item_text, onClick: () => {
|
|
@@ -538,16 +539,22 @@ const TbFrame = ({ setting, top, bottom, nav, top_banner, hashmode = false, }) =
|
|
|
538
539
|
}, [errMsg]);
|
|
539
540
|
const route = () => {
|
|
540
541
|
let route = [];
|
|
542
|
+
if (setting?.islogin) {
|
|
543
|
+
route.push({
|
|
544
|
+
path: "/login",
|
|
545
|
+
element: setting?.loginpage ? setting.loginpage : React__default.createElement(LoginPage, null),
|
|
546
|
+
});
|
|
547
|
+
}
|
|
541
548
|
nav.menuSet.forEach((item) => {
|
|
542
549
|
item.menuSetting.forEach((sub) => {
|
|
543
550
|
route.push({
|
|
544
|
-
path: "/" + sub.key,
|
|
545
|
-
element: sub.page,
|
|
551
|
+
path: "/" + sub.tab.key,
|
|
552
|
+
element: sub.tab.page,
|
|
546
553
|
});
|
|
547
554
|
sub.children?.forEach((page) => {
|
|
548
555
|
route.push({
|
|
549
|
-
path: "/" + page.key,
|
|
550
|
-
element: page.page,
|
|
556
|
+
path: "/" + page.tab.key,
|
|
557
|
+
element: page.tab.page,
|
|
551
558
|
});
|
|
552
559
|
});
|
|
553
560
|
});
|
|
@@ -575,11 +582,11 @@ const TbFrame = ({ setting, top, bottom, nav, top_banner, hashmode = false, }) =
|
|
|
575
582
|
},
|
|
576
583
|
]);
|
|
577
584
|
}
|
|
578
|
-
}, [hashmode]);
|
|
585
|
+
}, [hashmode, user]);
|
|
579
586
|
return React__default.createElement(RouterProvider, { router: router });
|
|
580
587
|
};
|
|
581
588
|
const MainLayout = ({ errMsg, startpage, setting, top_banner, nav, user, top, bottom, }) => {
|
|
582
|
-
|
|
589
|
+
useCallback(() => {
|
|
583
590
|
if (startpage)
|
|
584
591
|
return setting?.loginpage ? setting.loginpage : React__default.createElement(LoginPage, null);
|
|
585
592
|
else
|
|
@@ -619,7 +626,9 @@ const MainLayout = ({ errMsg, startpage, setting, top_banner, nav, user, top, bo
|
|
|
619
626
|
fontSize: "10px",
|
|
620
627
|
} }, errMsg?.err))));
|
|
621
628
|
};
|
|
622
|
-
return (React__default.createElement("div", { className: styles$9.main }, errMsg ? (errMsg.isPopup ? (React__default.createElement(ErrWarning, null)) : null) : setting?.islogin && !user ? (React__default.createElement(
|
|
629
|
+
return (React__default.createElement("div", { className: styles$9.main }, errMsg ? (errMsg.isPopup ? (React__default.createElement(ErrWarning, null)) : null) : setting?.islogin && !user ? (React__default.createElement("div", null,
|
|
630
|
+
React__default.createElement(Outlet, null),
|
|
631
|
+
React__default.createElement(Navigate, { to: "/login", replace: true }))) : (React__default.createElement("div", { className: styles$9.mainframe },
|
|
623
632
|
React__default.createElement(Top, { setting: setting, top: top }),
|
|
624
633
|
React__default.createElement(TOPBANNER, null),
|
|
625
634
|
React__default.createElement("div", { className: styles$9.centerFrame, style: top_banner ? { height: "calc(100vh - 120px)" } : { height: "calc(100vh - 80px)" } },
|
|
@@ -24231,16 +24240,9 @@ const InputSearch = ({ title, value, disabled = false, onChange, activeEnter, })
|
|
|
24231
24240
|
const AuthTable = ({ top, menuSetting }) => {
|
|
24232
24241
|
const { user } = useTbState();
|
|
24233
24242
|
const productList = [];
|
|
24234
|
-
const onSelect = (selectedKeys, info) => {
|
|
24235
|
-
console.log("selected", selectedKeys, info);
|
|
24236
|
-
};
|
|
24237
|
-
const onCheck = (checkedKeys, info) => {
|
|
24238
|
-
console.log("onCheck", checkedKeys, info);
|
|
24239
|
-
};
|
|
24240
24243
|
return (React__default.createElement("div", null,
|
|
24241
24244
|
React__default.createElement("div", null, "AuthTable123"),
|
|
24242
24245
|
React__default.createElement("div", null, JSON.stringify(user)),
|
|
24243
|
-
React__default.createElement(Tree, { checkable: true, defaultExpandedKeys: ["0-0-0", "0-0-1"], defaultSelectedKeys: ["0-0-0", "0-0-1"], defaultCheckedKeys: ["0-0-0", "0-0-1"], onSelect: onSelect, onCheck: onCheck, treeData: menuSetting }),
|
|
24244
24246
|
React__default.createElement(AntBaseTable, { rowKey: "base_product_id", rowName: "base_product_id", columns: columns, dataSource: productList })));
|
|
24245
24247
|
};
|
|
24246
24248
|
const columns = [
|