@thefreshop/tb 1.0.2 → 1.0.3
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.d.ts +2 -1
- package/dist/cjs/index.js +17 -15
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/tbframe/index.d.ts +2 -1
- package/dist/cjs/tbframe/layout/nav.d.ts +2 -1
- package/dist/cjs/tbframe/provider/provider.d.ts +0 -1
- package/dist/cjs/tbframe/provider/tbContext.d.ts +3 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +17 -15
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tbframe/index.d.ts +2 -1
- package/dist/esm/tbframe/layout/nav.d.ts +2 -1
- package/dist/esm/tbframe/provider/provider.d.ts +0 -1
- package/dist/esm/tbframe/provider/tbContext.d.ts +3 -0
- package/package.json +6 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { navType } from "../../types";
|
|
3
|
-
declare const Nav: ({ nav: { menuSet, openIcon, closeIcon } }: {
|
|
3
|
+
declare const Nav: ({ nav: { menuSet, openIcon, closeIcon }, islogin }: {
|
|
4
4
|
nav: navType;
|
|
5
|
+
islogin: boolean;
|
|
5
6
|
}) => React.JSX.Element;
|
|
6
7
|
export default Nav;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type * from "./types";
|
|
2
|
-
export {
|
|
2
|
+
export { TbProvider, useTbState } from "./tbframe/provider/provider";
|
|
3
|
+
export { tbContext } from "./tbframe/provider/tbContext";
|
|
3
4
|
export { default as TbFrame } from "./tbframe/layout/frame";
|
|
4
5
|
export * from "./tbpage/component/authTable";
|
|
5
6
|
export { TbpProvider } from "./tbpage/provider/provider";
|
package/dist/esm/index.js
CHANGED
|
@@ -16,8 +16,9 @@ import localeData from 'dayjs/plugin/localeData';
|
|
|
16
16
|
import ko_KR from 'antd/locale/ko_KR';
|
|
17
17
|
import 'dayjs/locale/ko';
|
|
18
18
|
|
|
19
|
+
const tbContext = createContext(undefined);
|
|
20
|
+
|
|
19
21
|
// export const TbBase = createContext<TbBaseProviderType>({})
|
|
20
|
-
const TbContext = createContext(undefined);
|
|
21
22
|
const TbProvider = ({ children }) => {
|
|
22
23
|
const [topkey, setTopkey] = useState("");
|
|
23
24
|
const [currentTab, setCurrentTab] = useState();
|
|
@@ -112,7 +113,7 @@ const TbProvider = ({ children }) => {
|
|
|
112
113
|
addTabs(newtab);
|
|
113
114
|
}
|
|
114
115
|
};
|
|
115
|
-
return (React__default.createElement(
|
|
116
|
+
return (React__default.createElement(tbContext.Provider, { value: {
|
|
116
117
|
topkey,
|
|
117
118
|
setTopkey,
|
|
118
119
|
tabs,
|
|
@@ -136,7 +137,7 @@ const TbProvider = ({ children }) => {
|
|
|
136
137
|
} }, children));
|
|
137
138
|
};
|
|
138
139
|
const useTbState = () => {
|
|
139
|
-
const value = useContext(
|
|
140
|
+
const value = useContext(tbContext);
|
|
140
141
|
if (value === undefined) {
|
|
141
142
|
throw new Error("useTopkeyState should be used within TbProvider");
|
|
142
143
|
}
|
|
@@ -177,7 +178,7 @@ styleInject(css_248z$b);
|
|
|
177
178
|
const topbase = {
|
|
178
179
|
title: 'title'};
|
|
179
180
|
|
|
180
|
-
var css_248z$a = ".top-module_topframe__LhKDg{align-items:center;border-bottom:1px solid #aaa;display:flex;height:80px;justify-content:left;text-align:center}.top-module_top_left__MBLyP{align-items:center;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,
|
|
181
|
+
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRvcC5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRCQUdJLGtCQUFtQixDQUVuQiw0QkFBNkIsQ0FFN0IsVUFBVyxDQU5YLFlBQWEsQ0FHYixXQUFZLENBRlosb0JBQXFCLENBSXJCLGlCQUVKLENBRUEsNEJBR0ksa0JBQW1CLENBQ25CLFVBQVcsQ0FIWCxZQUFhLENBQ2IsT0FHSixDQUVBLDJCQUVJLHFCQUFzQixDQUR0QixXQUVKLENBRUEsNEJBQ0ksWUFBYSxDQUNiLGtCQUNKLENBQ0EsaUNBQ0ksWUFBYSxDQUNiLHFCQUFzQixDQUN0QixXQUNKLENBRUEsc0NBQ0ksY0FDSixDQUVBLHNDQUNJLGNBQ0osQ0FFQSw4QkFDSSxVQUNKLENBT0EsNkRBQ0kscUJBQXNCLENBQ3RCLFVBQVcsQ0FDWCxjQUNKIiwiZmlsZSI6InRvcC5tb2R1bGUuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLnRvcGZyYW1lIHtcclxuICAgIGRpc3BsYXk6IGZsZXg7XHJcbiAgICBqdXN0aWZ5LWNvbnRlbnQ6IGx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clxuICAgIGN1cnNvcjogcG9pbnRlcjtcclxufVxyXG4iXX0= */";
|
|
181
182
|
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"};
|
|
182
183
|
styleInject(css_248z$a);
|
|
183
184
|
|
|
@@ -185,7 +186,7 @@ const Top = ({ setting, top: { title = topbase.title, titleimage, topMenuSetting
|
|
|
185
186
|
const { logout, user, setCurrentTab, startpage } = useTbState();
|
|
186
187
|
const userTop = () => {
|
|
187
188
|
let topmenutable = [];
|
|
188
|
-
if (user?.user_group?.group_key === "master") {
|
|
189
|
+
if (user?.user_group?.group_key === "master" || setting.islogin === false) {
|
|
189
190
|
topMenuSetting.forEach((m, index) => {
|
|
190
191
|
topmenutable.push(React__default.createElement(TopMenu, { key: index, topMenuSetting: m, menuStyle: menuStyle }));
|
|
191
192
|
});
|
|
@@ -211,11 +212,11 @@ const Top = ({ setting, top: { title = topbase.title, titleimage, topMenuSetting
|
|
|
211
212
|
console.log("home");
|
|
212
213
|
} },
|
|
213
214
|
titleimage ? React__default.createElement("img", { src: titleimage, className: styles$8.toplogo, alt: "logo", style: imgstyle }) : null,
|
|
214
|
-
React__default.createElement("div", { style: titleStyle }, title)),
|
|
215
|
+
React__default.createElement("div", { style: { padding: 10, fontWeight: "bold", ...titleStyle } }, title)),
|
|
215
216
|
React__default.createElement("div", { className: styles$8.top_menu }, userTop()),
|
|
216
217
|
topRight ? (topRight) : setting?.islogin && setting?.logoutComponent ? (setting?.logoutComponent) : (React__default.createElement("button", { onClick: () => logout() }, "\uB85C\uADF8\uC544\uC6C3"))));
|
|
217
218
|
};
|
|
218
|
-
const TopMenu = ({ topMenuSetting: { title, icon, key }, menuStyle }) => {
|
|
219
|
+
const TopMenu = ({ topMenuSetting: { title, icon, key }, menuStyle = {} }) => {
|
|
219
220
|
const [hover, setHover] = useState(false);
|
|
220
221
|
const { topkey, setTopkey } = useTbState();
|
|
221
222
|
return (React__default.createElement("div", { className: `${styles$8.top_menu_item} ${hover ? styles$8.menu_hover : styles$8.menu_nomal}`, style: menuStyle.menuWidth ? { width: menuStyle.menuWidth } : {}, onMouseEnter: () => {
|
|
@@ -229,14 +230,15 @@ const TopMenu = ({ topMenuSetting: { title, icon, key }, menuStyle }) => {
|
|
|
229
230
|
React__default.createElement("div", { className: `${styles$8.top_menu_item_text} ${topkey === key ? styles$8.menu_hover : styles$8.menu_nomal}`, style: menuStyle.fontSize ? { fontSize: menuStyle.fontSize } : {} }, title)));
|
|
230
231
|
};
|
|
231
232
|
|
|
232
|
-
const Nav = ({ nav: { menuSet, openIcon, closeIcon } }) => {
|
|
233
|
+
const Nav = ({ nav: { menuSet, openIcon, closeIcon }, islogin }) => {
|
|
233
234
|
const { topkey, user } = useTbState();
|
|
234
235
|
const currentMenu = menuSet.find((m) => m.parentkey === topkey);
|
|
235
236
|
const userMenu = () => {
|
|
236
237
|
let usermenutable = [];
|
|
237
|
-
if (user?.user_group?.group_key === "master") {
|
|
238
|
+
if (user?.user_group?.group_key === "master" || islogin === false) {
|
|
239
|
+
console.log(menuSet);
|
|
238
240
|
currentMenu?.menuSetting.forEach((m, index) => {
|
|
239
|
-
usermenutable.push(React__default.createElement(Menu, { key: index, menu_setting: m, openIcon: openIcon, closeIcon: closeIcon }));
|
|
241
|
+
usermenutable.push(React__default.createElement(Menu, { key: index, menu_setting: m, openIcon: openIcon, closeIcon: closeIcon, islogin: islogin }));
|
|
240
242
|
});
|
|
241
243
|
}
|
|
242
244
|
else {
|
|
@@ -244,14 +246,14 @@ const Nav = ({ nav: { menuSet, openIcon, closeIcon } }) => {
|
|
|
244
246
|
return user?.user_group?.group_menu_auth.includes(m.key);
|
|
245
247
|
});
|
|
246
248
|
userCurrentMenu?.forEach((m, index) => {
|
|
247
|
-
usermenutable.push(React__default.createElement(Menu, { key: index, menu_setting: m, openIcon: openIcon, closeIcon: closeIcon }));
|
|
249
|
+
usermenutable.push(React__default.createElement(Menu, { key: index, menu_setting: m, openIcon: openIcon, closeIcon: closeIcon, islogin: islogin }));
|
|
248
250
|
});
|
|
249
251
|
}
|
|
250
252
|
return usermenutable;
|
|
251
253
|
};
|
|
252
254
|
return React__default.createElement("div", { className: styles$9.naviFrame }, userMenu());
|
|
253
255
|
};
|
|
254
|
-
const Menu = ({ menu_setting: { title, icon, key, children, hasPage, page, defalultOpen }, openIcon, closeIcon, }) => {
|
|
256
|
+
const Menu = ({ menu_setting: { title, icon, key, children, hasPage, page, defalultOpen }, openIcon, closeIcon, islogin, }) => {
|
|
255
257
|
const [hover, setHover] = useState(false);
|
|
256
258
|
const [subOpen, setSubOpen] = useState(false);
|
|
257
259
|
const { addTabs, currentTab, user } = useTbState();
|
|
@@ -264,7 +266,7 @@ const Menu = ({ menu_setting: { title, icon, key, children, hasPage, page, defal
|
|
|
264
266
|
}, [defalultOpen, setSubOpen]); //데이터 빈 화면 깜박임 방지
|
|
265
267
|
const userSubMenu = () => {
|
|
266
268
|
let usersubmenutable = [];
|
|
267
|
-
if (user?.user_group?.group_key === "master") {
|
|
269
|
+
if (user?.user_group?.group_key === "master" || islogin === false) {
|
|
268
270
|
children?.forEach((m, index) => {
|
|
269
271
|
usersubmenutable.push(React__default.createElement(SubMenu, { key: index, menu_setting: m }));
|
|
270
272
|
});
|
|
@@ -520,7 +522,7 @@ const TbFrame = ({ setting, top, bottom, nav, top_banner, }) => {
|
|
|
520
522
|
React__default.createElement(Top, { setting: setting, top: top }),
|
|
521
523
|
isBanner && React__default.createElement(TOPBANNER, null),
|
|
522
524
|
React__default.createElement("div", { className: styles$9.centerFrame, style: isBanner ? { height: "calc(100vh - 120px)" } : { height: "calc(100vh - 80px)" } },
|
|
523
|
-
React__default.createElement(Nav, { nav: nav }),
|
|
525
|
+
React__default.createElement(Nav, { nav: nav, islogin: setting.islogin ?? false }),
|
|
524
526
|
React__default.createElement("div", { className: styles$9.contentsFrame },
|
|
525
527
|
React__default.createElement(Tabs, null),
|
|
526
528
|
React__default.createElement(Main, null))),
|
|
@@ -24058,5 +24060,5 @@ const TitleBox = ({ title, decs }) => {
|
|
|
24058
24060
|
React__default.createElement("div", { className: styles$1.decs }, decs)));
|
|
24059
24061
|
};
|
|
24060
24062
|
|
|
24061
|
-
export { AntBaseModalCreate, AntBaseTable, AuthTable, ContentLayout,
|
|
24063
|
+
export { AntBaseModalCreate, AntBaseTable, AuthTable, ContentLayout, TbFrame, TbProvider, TbpProvider, Tbpage, TbpageMulti, TbpageSm, tbContext, useTbState };
|
|
24062
24064
|
//# sourceMappingURL=index.js.map
|