@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 CHANGED
@@ -136,7 +136,7 @@ const TbProvider = ({ children }) => {
136
136
  menupages?.menuSet.forEach((item) => {
137
137
  item.menuSetting.forEach((sub) => {
138
138
  sub.children?.forEach((page) => {
139
- if (page.key === key)
139
+ if (page.tab.key === key)
140
140
  gotab = page;
141
141
  });
142
142
  });
@@ -214,7 +214,7 @@ var styles$9 = {"main":"frame-module_main__3msGf","mainframe":"frame-module_main
214
214
  styleInject(css_248z$b);
215
215
 
216
216
  const topbase = {
217
- title: 'title'};
217
+ title: "title"};
218
218
 
219
219
  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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRvcC5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRCQUdJLGtCQUFtQixDQUVuQiw0QkFBNkIsQ0FFN0IsVUFBVyxDQU5YLFlBQWEsQ0FHYixXQUFZLENBRlosb0JBQXFCLENBSXJCLGlCQUVKLENBRUEsNEJBR0ksa0JBQW1CLENBQ25CLFVBQVcsQ0FIWCxZQUFhLENBQ2IsT0FHSixDQUVBLDJCQUV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gIGZvbnQtc2l6ZTogMzBweDtcclxufVxyXG5cclxuLnRvcF9tZW51X2l0ZW1fdGV4dCB7XHJcbiAgICBmb250LXNpemU6IDIwcHg7XHJcbn1cclxuXHJcbi5tZW51X25vbWFsIHtcclxuICAgIGNvbG9yOiAjY2NjO1xyXG59XHJcbi5tZW51X2hvdmVyIHtcclxuICAgIGJhY2tncm91bmQtY29sb3I6ICNmZmY7XHJcbiAgICBjb2xvcjogIzMzMztcclxuICAgIGN1cnNvcjogcG9pbnRlcjtcclxufVxyXG5cclxuLm1lbnVfc2VsZWN0IHtcclxuICAgIGJhY2tncm91bmQtY29sb3I6ICNmZmY7XHJcbiAgICBjb2xvcjogIzMzMztcclxuICAgIGN1cnNvcjogcG9pbnRlcjtcclxufVxyXG4iXX0= */";
220
220
  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"};
@@ -280,7 +280,7 @@ const Nav = ({ nav: { menuSet, openIcon, closeIcon }, islogin }) => {
280
280
  }
281
281
  else {
282
282
  const userCurrentMenu = currentMenu?.menuSetting.filter((m) => {
283
- return user?.user_group?.group_menu_auth.includes(m.key);
283
+ return user?.user_group?.group_menu_auth.includes(m.tab.key);
284
284
  });
285
285
  userCurrentMenu?.forEach((m, index) => {
286
286
  usermenutable.push(React.createElement(Menu, { key: index, menu_setting: m, openIcon: openIcon, closeIcon: closeIcon, islogin: islogin }));
@@ -290,7 +290,8 @@ const Nav = ({ nav: { menuSet, openIcon, closeIcon }, islogin }) => {
290
290
  };
291
291
  return React.createElement("div", { className: styles$9.naviFrame }, userMenu());
292
292
  };
293
- const Menu = ({ menu_setting: { title, icon, key, children, hasPage, page, defalultOpen }, openIcon, closeIcon, islogin, }) => {
293
+ const Menu = ({ menu_setting: { tab, icon, children, hasPage, defalultOpen }, openIcon, closeIcon, islogin, }) => {
294
+ const { title, key, page } = tab;
294
295
  const [hover, setHover] = React.useState(false);
295
296
  const [subOpen, setSubOpen] = React.useState(false);
296
297
  const { addTabs, currentTab, user } = useTbState();
@@ -311,7 +312,7 @@ const Menu = ({ menu_setting: { title, icon, key, children, hasPage, page, defal
311
312
  }
312
313
  else {
313
314
  const userCurrentMenu = children?.filter((m) => {
314
- return user?.user_group?.group_menu_auth.includes(m.key);
315
+ return user?.user_group?.group_menu_auth.includes(m.tab.key);
315
316
  });
316
317
  userCurrentMenu?.forEach((m, index) => {
317
318
  usersubmenutable.push(React.createElement(SubMenu, { key: index, menu_setting: m }));
@@ -341,7 +342,8 @@ const Menu = ({ menu_setting: { title, icon, key, children, hasPage, page, defal
341
342
  React.createElement("div", { className: styles$9.nav_open }, children && (subOpen ? React.createElement("div", null, openIcon) : React.createElement("div", null, closeIcon)))),
342
343
  children && subOpen && userSubMenu()));
343
344
  };
344
- const SubMenu = ({ menu_setting: { title, icon, key, page, hasPage } }) => {
345
+ const SubMenu = ({ menu_setting: { tab, icon, hasPage } }) => {
346
+ const { title, key, page } = tab;
345
347
  const [hover, setHover] = React.useState(false);
346
348
  const { addTabs, currentTab } = useTbState();
347
349
  const navigate = reactRouter.useNavigate();
@@ -401,11 +403,11 @@ const Tabs = ({ nav: { menuSet, openIcon, closeIcon } }) => {
401
403
  // 2-1. 메뉴 페이지에서 찾기
402
404
  menuSet.forEach((item) => {
403
405
  item.menuSetting.forEach((sub) => {
404
- if (sub.key === pathKey)
406
+ if (sub.tab.key === pathKey)
405
407
  tabInfo = sub;
406
408
  else {
407
409
  sub.children?.forEach((page) => {
408
- if (page.key === pathKey)
410
+ if (page.tab.key === pathKey)
409
411
  tabInfo = page;
410
412
  });
411
413
  }
@@ -423,8 +425,7 @@ const Tabs = ({ nav: { menuSet, openIcon, closeIcon } }) => {
423
425
  React.useEffect(() => {
424
426
  const pathKey = location.pathname.substring(1); // 맨 앞의 '/' 제거
425
427
  findTabs(pathKey);
426
- // eslint-disable-next-line react-hooks/exhaustive-deps
427
- }, []); // 이 효과는 컴포넌트가 처음 마운트될 때 한 번만 실행됩니다.
428
+ }, []);
428
429
  return (React.createElement("div", { className: styles$6.tabFrame }, tabs?.map((m) => {
429
430
  return (React.createElement("div", { key: m.key, className: `${styles$6.tab_item} ${currentTab?.key === m.key ? styles$6.tab_select : styles$6.tab_normal}` },
430
431
  React.createElement("div", { className: styles$6.tab_item_text, onClick: () => {
@@ -558,16 +559,22 @@ const TbFrame = ({ setting, top, bottom, nav, top_banner, hashmode = false, }) =
558
559
  }, [errMsg]);
559
560
  const route = () => {
560
561
  let route = [];
562
+ if (setting?.islogin) {
563
+ route.push({
564
+ path: "/login",
565
+ element: setting?.loginpage ? setting.loginpage : React.createElement(LoginPage, null),
566
+ });
567
+ }
561
568
  nav.menuSet.forEach((item) => {
562
569
  item.menuSetting.forEach((sub) => {
563
570
  route.push({
564
- path: "/" + sub.key,
565
- element: sub.page,
571
+ path: "/" + sub.tab.key,
572
+ element: sub.tab.page,
566
573
  });
567
574
  sub.children?.forEach((page) => {
568
575
  route.push({
569
- path: "/" + page.key,
570
- element: page.page,
576
+ path: "/" + page.tab.key,
577
+ element: page.tab.page,
571
578
  });
572
579
  });
573
580
  });
@@ -595,11 +602,11 @@ const TbFrame = ({ setting, top, bottom, nav, top_banner, hashmode = false, }) =
595
602
  },
596
603
  ]);
597
604
  }
598
- }, [hashmode]);
605
+ }, [hashmode, user]);
599
606
  return React.createElement(reactRouter.RouterProvider, { router: router });
600
607
  };
601
608
  const MainLayout = ({ errMsg, startpage, setting, top_banner, nav, user, top, bottom, }) => {
602
- const LOGIN = React.useCallback(() => {
609
+ React.useCallback(() => {
603
610
  if (startpage)
604
611
  return setting?.loginpage ? setting.loginpage : React.createElement(LoginPage, null);
605
612
  else
@@ -639,7 +646,9 @@ const MainLayout = ({ errMsg, startpage, setting, top_banner, nav, user, top, bo
639
646
  fontSize: "10px",
640
647
  } }, errMsg?.err))));
641
648
  };
642
- return (React.createElement("div", { className: styles$9.main }, errMsg ? (errMsg.isPopup ? (React.createElement(ErrWarning, null)) : null) : setting?.islogin && !user ? (React.createElement(LOGIN, null)) : (React.createElement("div", { className: styles$9.mainframe },
649
+ return (React.createElement("div", { className: styles$9.main }, errMsg ? (errMsg.isPopup ? (React.createElement(ErrWarning, null)) : null) : setting?.islogin && !user ? (React.createElement("div", null,
650
+ React.createElement(reactRouter.Outlet, null),
651
+ React.createElement(reactRouter.Navigate, { to: "/login", replace: true }))) : (React.createElement("div", { className: styles$9.mainframe },
643
652
  React.createElement(Top, { setting: setting, top: top }),
644
653
  React.createElement(TOPBANNER, null),
645
654
  React.createElement("div", { className: styles$9.centerFrame, style: top_banner ? { height: "calc(100vh - 120px)" } : { height: "calc(100vh - 80px)" } },
@@ -24251,16 +24260,9 @@ const InputSearch = ({ title, value, disabled = false, onChange, activeEnter, })
24251
24260
  const AuthTable = ({ top, menuSetting }) => {
24252
24261
  const { user } = useTbState();
24253
24262
  const productList = [];
24254
- const onSelect = (selectedKeys, info) => {
24255
- console.log("selected", selectedKeys, info);
24256
- };
24257
- const onCheck = (checkedKeys, info) => {
24258
- console.log("onCheck", checkedKeys, info);
24259
- };
24260
24263
  return (React.createElement("div", null,
24261
24264
  React.createElement("div", null, "AuthTable123"),
24262
24265
  React.createElement("div", null, JSON.stringify(user)),
24263
- React.createElement(antd.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 }),
24264
24266
  React.createElement(AntBaseTable$1, { rowKey: "base_product_id", rowName: "base_product_id", columns: columns, dataSource: productList })));
24265
24267
  };
24266
24268
  const columns = [