@thefreshop/tb 1.0.7 → 1.0.9

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.
@@ -7,6 +7,7 @@ export { TbpProvider } from "./tbpage/provider/provider";
7
7
  export { ContentLayout } from "./tbpage/component/content_layout";
8
8
  export { Tbpage } from "./tbpage/component/tbpage";
9
9
  export { TbpageSm } from "./tbpage/component/tbpagesm";
10
+ export { Tblist } from "./tbpage/component/tblist";
10
11
  export { TbpageMulti } from "./tbpage/component/tbpageMulti";
11
12
  export { default as AntBaseTable } from "./tbpage/component/modules/antBaseTable";
12
13
  export { default as AntBaseModalCreate } from "./tbpage/component/modules/antBaseModalCreate";
package/dist/cjs/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
+ var reactRouter = require('react-router');
4
5
  var Editor = require('@monaco-editor/react');
5
6
  var icons = require('@ant-design/icons');
6
7
  var antd = require('antd');
@@ -38,16 +39,35 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
38
39
 
39
40
  const tbContext = React.createContext(undefined);
40
41
 
41
- // export const TbBase = createContext<TbBaseProviderType>({})
42
+ const SESSION_STORAGE_KEY = "tbFrameState";
42
43
  const TbProvider = ({ children }) => {
43
44
  const [topkey, setTopkey] = React.useState("");
44
45
  const [currentTab, setCurrentTab] = React.useState();
45
46
  const [user, setloginUser] = React.useState();
46
- const [tabs, setTabs] = React.useState([]);
47
+ // const [tabs, setTabs] = useState<tabType[]>([]);
47
48
  const [startpage, setStartpage] = React.useState();
48
49
  const [errMsg, setErrMsg] = React.useState();
49
50
  const [globalpages, setGlobalpages] = React.useState();
50
51
  const [menupages, setMenupages] = React.useState();
52
+ // 1. 초기 상태를 sessionStorage 불러오도록 수정
53
+ const [tabs, setTabs] = React.useState(() => {
54
+ try {
55
+ const savedState = sessionStorage.getItem(SESSION_STORAGE_KEY);
56
+ return savedState ? JSON.parse(savedState).tabs : [];
57
+ }
58
+ catch (error) {
59
+ console.error("Failed to parse state from sessionStorage", error);
60
+ return [];
61
+ }
62
+ });
63
+ // 2. 상태가 변경될 때마다 sessionStorage 저장하는 useEffect 추가
64
+ React.useEffect(() => {
65
+ const stateToSave = {
66
+ tabs,
67
+ // ... 저장할 다른 상태들 ...
68
+ };
69
+ sessionStorage.setItem(SESSION_STORAGE_KEY, JSON.stringify(stateToSave));
70
+ }, [tabs, currentTab /* ... 다른 상태 의존성 ... */]);
51
71
  const addTabs = (tab) => {
52
72
  setCurrentTab(tab);
53
73
  if (tabs.find((m) => m.key === tab.key) === undefined) {
@@ -148,6 +168,7 @@ const TbProvider = ({ children }) => {
148
168
  SetWarning,
149
169
  errMsg,
150
170
  setGlobalpages,
171
+ globalpages,
151
172
  addGlobalTabs,
152
173
  setMenupages,
153
174
  goTabs,
@@ -273,6 +294,7 @@ const Menu = ({ menu_setting: { title, icon, key, children, hasPage, page, defal
273
294
  const [hover, setHover] = React.useState(false);
274
295
  const [subOpen, setSubOpen] = React.useState(false);
275
296
  const { addTabs, currentTab, user } = useTbState();
297
+ const navigate = reactRouter.useNavigate();
276
298
  React.useEffect(() => {
277
299
  if (defalultOpen) {
278
300
  setSubOpen(true);
@@ -304,12 +326,14 @@ const Menu = ({ menu_setting: { title, icon, key, children, hasPage, page, defal
304
326
  setHover(false);
305
327
  }, onClick: () => {
306
328
  setSubOpen((prev) => !prev);
307
- if (hasPage && currentTab?.key !== key)
329
+ if (hasPage && currentTab?.key !== key) {
308
330
  addTabs({
309
331
  title,
310
332
  key,
311
333
  page,
312
334
  });
335
+ navigate("/" + key);
336
+ }
313
337
  // console.log(tabs)
314
338
  } },
315
339
  React.createElement("div", { className: styles$9.nav_icon }, icon),
@@ -320,6 +344,7 @@ const Menu = ({ menu_setting: { title, icon, key, children, hasPage, page, defal
320
344
  const SubMenu = ({ menu_setting: { title, icon, key, page, hasPage } }) => {
321
345
  const [hover, setHover] = React.useState(false);
322
346
  const { addTabs, currentTab } = useTbState();
347
+ const navigate = reactRouter.useNavigate();
323
348
  return (React.createElement("div", { className: `${styles$9.sub_item} ${currentTab?.key === key ? styles$9.menu_select : hover ? styles$9.menu_hover : styles$9.menu_nomal}`, onMouseEnter: () => {
324
349
  setHover(true);
325
350
  }, onMouseLeave: () => {
@@ -331,6 +356,7 @@ const SubMenu = ({ menu_setting: { title, icon, key, page, hasPage } }) => {
331
356
  key,
332
357
  page,
333
358
  });
359
+ navigate("/" + key);
334
360
  // console.log(tabs)
335
361
  } },
336
362
  React.createElement("div", { className: styles$9.nav_icon }, icon),
@@ -359,12 +385,45 @@ var css_248z$9 = ".tabs-module_tabFrame__qyHsD{background-color:#fff;display:fle
359
385
  var styles$6 = {"tabFrame":"tabs-module_tabFrame__qyHsD","tab_item":"tabs-module_tab_item__dtp6M","tab_item_text":"tabs-module_tab_item_text__w9h73","tab_item_button":"tabs-module_tab_item_button__2CdJE","tab_x_button":"tabs-module_tab_x_button__To6OB","tab_normal":"tabs-module_tab_normal__Ky5vz","tab_select":"tabs-module_tab_select__kEPQi"};
360
386
  styleInject(css_248z$9);
361
387
 
362
- const Tabs = () => {
363
- const { tabs, removeTabs, setCurrentTab, currentTab } = useTbState();
364
- return (React.createElement("div", { className: styles$6.tabFrame }, tabs?.map((m, index) => {
365
- return (React.createElement("div", { key: index, className: `${styles$6.tab_item} ${currentTab?.key === m.key ? styles$6.tab_select : styles$6.tab_normal}` },
388
+ const Tabs = ({ nav: { menuSet, openIcon, closeIcon } }) => {
389
+ const { tabs, removeTabs, setCurrentTab, addTabs, currentTab, globalpages } = useTbState();
390
+ const navigate = reactRouter.useNavigate();
391
+ const location = reactRouter.useLocation();
392
+ const findTabs = React.useCallback((pathKey) => {
393
+ // 1. 현재 열린 탭 중에 있는지 확인
394
+ const existingTab = tabs.find((t) => t.key === pathKey);
395
+ if (existingTab) {
396
+ setCurrentTab(existingTab);
397
+ return;
398
+ }
399
+ // 2. 없다면, 전체 페이지 목록에서 찾아서 추가
400
+ let tabInfo;
401
+ // 2-1. 메뉴 페이지에서 찾기
402
+ menuSet.forEach((item) => {
403
+ item.menuSetting.forEach((sub) => {
404
+ if (sub.key === pathKey)
405
+ tabInfo = sub;
406
+ });
407
+ });
408
+ // 2-2. 전역 페이지에서 찾기 (메뉴에 없으면)
409
+ if (!tabInfo) {
410
+ tabInfo = globalpages?.find((m) => m.key === pathKey);
411
+ }
412
+ if (tabInfo) {
413
+ addTabs(tabInfo);
414
+ }
415
+ }, [tabs, globalpages]);
416
+ // 3. 페이지 로드 시 URL을 기반으로 currentTab을 설정하는 useEffect 추가
417
+ React.useEffect(() => {
418
+ const pathKey = location.pathname.substring(1); // 맨 앞의 '/' 제거
419
+ findTabs(pathKey);
420
+ // eslint-disable-next-line react-hooks/exhaustive-deps
421
+ }, []); // 이 효과는 컴포넌트가 처음 마운트될 때 한 번만 실행됩니다.
422
+ return (React.createElement("div", { className: styles$6.tabFrame }, tabs?.map((m) => {
423
+ return (React.createElement("div", { key: m.key, className: `${styles$6.tab_item} ${currentTab?.key === m.key ? styles$6.tab_select : styles$6.tab_normal}` },
366
424
  React.createElement("div", { className: styles$6.tab_item_text, onClick: () => {
367
425
  setCurrentTab(m);
426
+ navigate("/" + m.key);
368
427
  // console.log('setCurrentTab', m)
369
428
  } }, m.title),
370
429
  !m.noremove && (React.createElement("div", { className: styles$6.tab_item_button },
@@ -376,30 +435,21 @@ var css_248z$8 = ".main-module_mainFrame__Etjvl{height:100%;width:100%}\n/*# sou
376
435
  var styles$5 = {"mainFrame":"main-module_mainFrame__Etjvl"};
377
436
  styleInject(css_248z$8);
378
437
 
379
- var css_248z$7 = ".nullpage-module_nullpage__aLHyg{align-items:center;display:flex;flex-direction:row;height:30vh;justify-content:center;width:100%}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm51bGxwYWdlLm1vZHVsZS5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsaUNBSUUsa0JBQW1CLENBSG5CLFlBQWEsQ0FDYixrQkFBbUIsQ0FJbkIsV0FBWSxDQUhaLHNCQUF1QixDQUV2QixVQUVGIiwiZmlsZSI6Im51bGxwYWdlLm1vZHVsZS5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIubnVsbHBhZ2Uge1xyXG4gIGRpc3BsYXk6IGZsZXg7XHJcbiAgZmxleC1kaXJlY3Rpb246IHJvdztcclxuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcclxuICBhbGlnbi1pdGVtczogY2VudGVyO1xyXG4gIHdpZHRoOiAxMDAlO1xyXG4gIGhlaWdodDogMzB2aDtcclxufVxyXG4iXX0= */";
380
- var styles$4 = {"nullpage":"nullpage-module_nullpage__aLHyg"};
381
- styleInject(css_248z$7);
382
-
383
- const NullPage = () => {
384
- return (React.createElement("div", { className: styles$4.nullpage },
385
- React.createElement("div", null, "\uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.")));
386
- };
387
-
388
438
  const Main = () => {
389
- const { currentTab } = useTbState();
390
- return (React.createElement("div", { className: styles$5.mainFrame }, currentTab?.page ? currentTab.page : React.createElement(NullPage, null)));
439
+ return (React.createElement("div", { className: styles$5.mainFrame },
440
+ React.createElement(reactRouter.Outlet, null)));
391
441
  };
392
442
 
393
- var css_248z$6 = ".loginpage-module_loginpage__TF9Rl{align-items:center;display:flex;flex-direction:column;height:100vh;justify-content:center;width:100%}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxvZ2lucGFnZS5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG1DQUlFLGtCQUFtQixDQUhuQixZQUFhLENBQ2IscUJBQXNCLENBSXRCLFlBQWEsQ0FIYixzQkFBdUIsQ0FFdkIsVUFFRiIsImZpbGUiOiJsb2dpbnBhZ2UubW9kdWxlLmNzcyIsInNvdXJjZXNDb250ZW50IjpbIi5sb2dpbnBhZ2Uge1xyXG4gIGRpc3BsYXk6IGZsZXg7XHJcbiAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjtcclxuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcclxuICBhbGlnbi1pdGVtczogY2VudGVyO1xyXG4gIHdpZHRoOiAxMDAlO1xyXG4gIGhlaWdodDogMTAwdmg7XHJcbn1cclxuIl19 */";
394
- var styles$3 = {"loginpage":"loginpage-module_loginpage__TF9Rl"};
395
- styleInject(css_248z$6);
443
+ var css_248z$7 = ".loginpage-module_loginpage__TF9Rl{align-items:center;display:flex;flex-direction:column;height:100vh;justify-content:center;width:100%}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxvZ2lucGFnZS5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG1DQUlFLGtCQUFtQixDQUhuQixZQUFhLENBQ2IscUJBQXNCLENBSXRCLFlBQWEsQ0FIYixzQkFBdUIsQ0FFdkIsVUFFRiIsImZpbGUiOiJsb2dpbnBhZ2UubW9kdWxlLmNzcyIsInNvdXJjZXNDb250ZW50IjpbIi5sb2dpbnBhZ2Uge1xyXG4gIGRpc3BsYXk6IGZsZXg7XHJcbiAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjtcclxuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcclxuICBhbGlnbi1pdGVtczogY2VudGVyO1xyXG4gIHdpZHRoOiAxMDAlO1xyXG4gIGhlaWdodDogMTAwdmg7XHJcbn1cclxuIl19 */";
444
+ var styles$4 = {"loginpage":"loginpage-module_loginpage__TF9Rl"};
445
+ styleInject(css_248z$7);
396
446
 
397
447
  const LoginPage = () => {
398
448
  const { loginUser } = useTbState();
399
449
  const [user, setUser] = React.useState(defaultuser);
400
450
  const [isTypeCheck, setTypeCheck] = React.useState(true);
401
451
  const [editorValue, setEditorValue] = React.useState(JSON.stringify(defaultuser, null, 2));
402
- return (React.createElement("div", { className: styles$3.loginpage },
452
+ return (React.createElement("div", { className: styles$4.loginpage },
403
453
  React.createElement("div", { style: { display: "flex" } },
404
454
  React.createElement("button", { onClick: () => {
405
455
  setEditorValue(JSON.stringify(alluser, null, 2));
@@ -471,6 +521,15 @@ const testuser = {
471
521
  },
472
522
  };
473
523
 
524
+ var css_248z$6 = ".nullpage-module_nullpage__aLHyg{align-items:center;display:flex;flex-direction:row;height:30vh;justify-content:center;width:100%}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm51bGxwYWdlLm1vZHVsZS5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsaUNBSUUsa0JBQW1CLENBSG5CLFlBQWEsQ0FDYixrQkFBbUIsQ0FJbkIsV0FBWSxDQUhaLHNCQUF1QixDQUV2QixVQUVGIiwiZmlsZSI6Im51bGxwYWdlLm1vZHVsZS5jc3MiLCJzb3VyY2VzQ29udGVudCI6WyIubnVsbHBhZ2Uge1xyXG4gIGRpc3BsYXk6IGZsZXg7XHJcbiAgZmxleC1kaXJlY3Rpb246IHJvdztcclxuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcclxuICBhbGlnbi1pdGVtczogY2VudGVyO1xyXG4gIHdpZHRoOiAxMDAlO1xyXG4gIGhlaWdodDogMzB2aDtcclxufVxyXG4iXX0= */";
525
+ var styles$3 = {"nullpage":"nullpage-module_nullpage__aLHyg"};
526
+ styleInject(css_248z$6);
527
+
528
+ const NullPage = () => {
529
+ return (React.createElement("div", { className: styles$3.nullpage },
530
+ React.createElement("div", null, "\uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.")));
531
+ };
532
+
474
533
  const TbFrame = ({ setting, top, bottom, nav, top_banner, }) => {
475
534
  const { user, startpage, setStartpage, errMsg, setGlobalpages, setMenupages } = useTbState();
476
535
  React.useEffect(() => {
@@ -491,6 +550,29 @@ const TbFrame = ({ setting, top, bottom, nav, top_banner, }) => {
491
550
  React.useEffect(() => {
492
551
  if (!errMsg?.isPopup) ;
493
552
  }, [errMsg]);
553
+ const route = () => {
554
+ let route = [];
555
+ nav.menuSet.forEach((m) => {
556
+ m.menuSetting.forEach((m) => {
557
+ route.push({
558
+ path: "/" + m.key,
559
+ element: m.page,
560
+ });
561
+ });
562
+ });
563
+ return route;
564
+ };
565
+ const router = React.useMemo(() => reactRouter.createBrowserRouter([
566
+ {
567
+ path: "/",
568
+ element: (React.createElement(MainLayout, { errMsg: errMsg, startpage: startpage, setting: setting, top_banner: top_banner, nav: nav, user: user, top: top, bottom: bottom })),
569
+ children: route(),
570
+ errorElement: React.createElement(NullPage, null),
571
+ },
572
+ ]), []);
573
+ return React.createElement(reactRouter.RouterProvider, { router: router });
574
+ };
575
+ const MainLayout = ({ errMsg, startpage, setting, top_banner, nav, user, top, bottom, }) => {
494
576
  const LOGIN = React.useCallback(() => {
495
577
  if (startpage)
496
578
  return setting?.loginpage ? setting.loginpage : React.createElement(LoginPage, null);
@@ -537,7 +619,7 @@ const TbFrame = ({ setting, top, bottom, nav, top_banner, }) => {
537
619
  React.createElement("div", { className: styles$9.centerFrame, style: top_banner ? { height: "calc(100vh - 120px)" } : { height: "calc(100vh - 80px)" } },
538
620
  React.createElement(Nav, { nav: nav, islogin: setting.islogin ?? false }),
539
621
  React.createElement("div", { className: styles$9.contentsFrame },
540
- React.createElement(Tabs, null),
622
+ React.createElement(Tabs, { nav: nav }),
541
623
  React.createElement(Main, null))),
542
624
  React.createElement("div", { className: styles$9.bottomFrame }, bottom && React.createElement(Bottom, { bottom: bottom }))))));
543
625
  };
@@ -22402,10 +22484,11 @@ var Cropper = /** @class */function (_super) {
22402
22484
  }
22403
22485
  };
22404
22486
  _this.recomputeCropPosition = function () {
22487
+ var _a, _b;
22405
22488
  if (!_this.state.cropSize) return;
22406
22489
  var adjustedCrop = _this.props.crop;
22407
22490
  // Only scale if we're initialized and this is a legitimate resize
22408
- if (_this.isInitialized && _this.previousCropSize) {
22491
+ if (_this.isInitialized && ((_a = _this.previousCropSize) === null || _a === void 0 ? void 0 : _a.width) && ((_b = _this.previousCropSize) === null || _b === void 0 ? void 0 : _b.height)) {
22409
22492
  var sizeChanged = Math.abs(_this.previousCropSize.width - _this.state.cropSize.width) > 1e-6 || Math.abs(_this.previousCropSize.height - _this.state.cropSize.height) > 1e-6;
22410
22493
  if (sizeChanged) {
22411
22494
  var scaleX = _this.state.cropSize.width / _this.previousCropSize.width;
@@ -23238,8 +23321,8 @@ const AntBaseModalCreate = ({ modalProps, formProps, props }) => {
23238
23321
  React.createElement(antd.Button, { htmlType: "submit" }, props.buttonName ?? (isModify ? FORM_MODIFY : FORM_CREATE))))));
23239
23322
  };
23240
23323
 
23241
- const { Title } = antd.Typography;
23242
- const { confirm } = antd.Modal;
23324
+ const { Title: Title$1 } = antd.Typography;
23325
+ const { confirm: confirm$1 } = antd.Modal;
23243
23326
  const AntBaseTable = ({ bordered, className, rowKey, rowName, dataSource, initData, customColumn, customValue, columns, expandable, size, onDoubleClick, onClick, selectProps, addProps, modifyProps, deleteProps, removeProps, resetProps, customProps, topProps, bottomProps, upProps, downProps, pageProps, scroll, onRefresh, isCounter, autoRefreshTime, createModalWidth = 1000, onCreateClose, }, ref) => {
23244
23327
  const [selectedRowKeys, setSelectedRowKeys] = React.useState([]);
23245
23328
  const [selectedRow, setSelectedRow] = React.useState();
@@ -23368,7 +23451,7 @@ const AntBaseTable = ({ bordered, className, rowKey, rowName, dataSource, initDa
23368
23451
  : typeof rowKey === "function"
23369
23452
  ? rowKey(selectedRow)
23370
23453
  : selectedRow[rowKey]);
23371
- confirm({
23454
+ confirm$1({
23372
23455
  title: "삭제 하시겠습니까?",
23373
23456
  icon: React.createElement(icons.ExclamationCircleOutlined, null),
23374
23457
  content: content,
@@ -23395,7 +23478,7 @@ const AntBaseTable = ({ bordered, className, rowKey, rowName, dataSource, initDa
23395
23478
  : typeof rowKey === "function"
23396
23479
  ? rowKey(selectedRow)
23397
23480
  : selectedRow[rowKey]);
23398
- confirm({
23481
+ confirm$1({
23399
23482
  title: "복구 하시겠습니까?",
23400
23483
  icon: React.createElement(icons.ExclamationCircleOutlined, null),
23401
23484
  content: content,
@@ -23422,7 +23505,7 @@ const AntBaseTable = ({ bordered, className, rowKey, rowName, dataSource, initDa
23422
23505
  : typeof rowKey === "function"
23423
23506
  ? rowKey(selectedRow)
23424
23507
  : selectedRow[rowKey]);
23425
- confirm({
23508
+ confirm$1({
23426
23509
  title: "완전 삭제 하시겠습니까?",
23427
23510
  icon: React.createElement(icons.ExclamationCircleOutlined, null),
23428
23511
  content: content,
@@ -23557,7 +23640,7 @@ const AntBaseTable = ({ bordered, className, rowKey, rowName, dataSource, initDa
23557
23640
  React.createElement(AntBaseModalCreate, { modalProps: {
23558
23641
  width: createModalWidth,
23559
23642
  title: (React.createElement("div", { style: { marginBottom: 20, marginTop: 10 } },
23560
- React.createElement(Title, { level: 4, style: { margin: 0 } }, popupModify ? "정보 수정" : "신규 등록"))),
23643
+ React.createElement(Title$1, { level: 4, style: { margin: 0 } }, popupModify ? "정보 수정" : "신규 등록"))),
23561
23644
  maskClosable: false,
23562
23645
  open: popupCreate,
23563
23646
  onCancel: () => {
@@ -23602,6 +23685,288 @@ const AntBaseTable = ({ bordered, className, rowKey, rowName, dataSource, initDa
23602
23685
  */
23603
23686
  var AntBaseTable$1 = React.forwardRef(AntBaseTable);
23604
23687
 
23688
+ const { Title } = antd.Typography;
23689
+ const { confirm } = antd.Modal;
23690
+ const AntBaseList = ({ tableProps, render, }, ref) => {
23691
+ const { bordered, className, rowKey, rowName, dataSource, initData, customColumn, customValue, columns, expandable, size, onDoubleClick, onClick, selectProps, addProps, modifyProps, deleteProps, removeProps, resetProps, customProps, topProps, bottomProps, upProps, downProps, pageProps, scroll, onRefresh, isCounter, autoRefreshTime, createModalWidth = 1000, onCreateClose, } = tableProps;
23692
+ const [selectedRowKeys, setSelectedRowKeys] = React.useState([]);
23693
+ const [selectedRow, setSelectedRow] = React.useState();
23694
+ const [popupCreate, setPopupCreate] = React.useState(false);
23695
+ const [popupModify, setPopupModify] = React.useState(false);
23696
+ React.useEffect(() => {
23697
+ setSelectedRow(dataSource?.find((m) => {
23698
+ if (m) {
23699
+ let key = typeof rowKey === "function" ? rowKey(m) : m[rowKey];
23700
+ return key === selectedRowKeys[0];
23701
+ }
23702
+ return false;
23703
+ }));
23704
+ }, [dataSource, rowKey, selectedRowKeys]);
23705
+ //선택 리셋
23706
+ const resetSelection = () => {
23707
+ setSelectedRowKeys([]);
23708
+ setSelectedRow(undefined);
23709
+ };
23710
+ //재 선택??
23711
+ const reSelection = () => {
23712
+ if (selectProps) {
23713
+ if (selectedRowKeys.length !== 0 && dataSource?.length !== 0) {
23714
+ setSelectedRow(dataSource?.find((m) => {
23715
+ if (m) {
23716
+ let key = typeof rowKey === "function" ? rowKey(m) : m[rowKey];
23717
+ return key === selectedRowKeys[0];
23718
+ }
23719
+ return false;
23720
+ }));
23721
+ if (selectProps.onUpdateData) {
23722
+ selectProps.onUpdateData(dataSource?.find((m) => {
23723
+ if (m) {
23724
+ let key = typeof rowKey === "function" ? rowKey(m) : m[rowKey];
23725
+ return key === selectedRowKeys[0];
23726
+ }
23727
+ return false;
23728
+ }));
23729
+ }
23730
+ }
23731
+ }
23732
+ };
23733
+ //ref 함수
23734
+ React.useImperativeHandle(ref, () => ({
23735
+ resetSelection,
23736
+ reSelection,
23737
+ popupCreate,
23738
+ popupModify,
23739
+ selectedRow,
23740
+ }), [selectedRow, popupCreate, popupModify]);
23741
+ // 추가 팝업 on/off
23742
+ const showCreatePopup = (show) => {
23743
+ setPopupCreate(show);
23744
+ setPopupModify(false);
23745
+ };
23746
+ // 추가/수정 완료
23747
+ const onCreate = (value) => {
23748
+ setPopupCreate(false);
23749
+ setPopupModify(false);
23750
+ if (popupModify && modifyProps) {
23751
+ let key = typeof rowKey === "function" ? rowKey(selectedRow) : rowKey;
23752
+ modifyProps.onFun({ [key.toString()]: key, ...value }, selectedRow);
23753
+ // 키 값과 함꼐 전달
23754
+ }
23755
+ else if (addProps) {
23756
+ addProps.onFun(value);
23757
+ }
23758
+ setSelectedRowKeys([]);
23759
+ setSelectedRow(undefined);
23760
+ };
23761
+ // 수정 창 열기전 beforeModify 확인후 수정 작업
23762
+ const showModify = () => {
23763
+ if (modifyProps?.beforeCheck) {
23764
+ modifyProps
23765
+ .beforeCheck(selectedRow)
23766
+ .then((newValue) => {
23767
+ setSelectedRow(newValue);
23768
+ setPopupCreate(true);
23769
+ setPopupModify(true);
23770
+ })
23771
+ .catch();
23772
+ }
23773
+ else {
23774
+ setPopupCreate(true);
23775
+ setPopupModify(true);
23776
+ }
23777
+ };
23778
+ //선택 유무
23779
+ const isSelect = selectedRowKeys.length !== 0;
23780
+ return (React.createElement("div", { className: className, style: {
23781
+ display: "flex",
23782
+ flexDirection: "column",
23783
+ flex: 1,
23784
+ gap: 10,
23785
+ height: "100%",
23786
+ padding: "20px",
23787
+ } },
23788
+ React.createElement(TableTopButtonGroup, { isSelect: isSelect, isCounter: isCounter, onRefresh: onRefresh, autoRefreshTime: autoRefreshTime, addProps: addProps && {
23789
+ ...addProps,
23790
+ onFun: () => {
23791
+ if (addProps.customModal) {
23792
+ addProps.onFun(selectedRow);
23793
+ }
23794
+ else {
23795
+ showCreatePopup(true);
23796
+ }
23797
+ },
23798
+ }, modifyProps: modifyProps && {
23799
+ ...modifyProps,
23800
+ onFun() {
23801
+ if (modifyProps.customModal) {
23802
+ modifyProps.onFun(selectedRow);
23803
+ }
23804
+ else {
23805
+ showModify();
23806
+ }
23807
+ },
23808
+ }, deleteProps: deleteProps && {
23809
+ ...deleteProps,
23810
+ onFun() {
23811
+ if (selectedRow) {
23812
+ let content = (rowName
23813
+ ? typeof rowName === "function"
23814
+ ? rowName(selectedRow)
23815
+ : selectedRow[rowName]
23816
+ : typeof rowKey === "function"
23817
+ ? rowKey(selectedRow)
23818
+ : selectedRow[rowKey]);
23819
+ confirm({
23820
+ title: "삭제 하시겠습니까?",
23821
+ icon: React.createElement(icons.ExclamationCircleOutlined, null),
23822
+ content: content,
23823
+ okText: "Yes",
23824
+ okType: "danger",
23825
+ cancelText: "No",
23826
+ onOk: () => {
23827
+ deleteProps.onFun(selectedRow);
23828
+ },
23829
+ onCancel() {
23830
+ console.log("Cancel");
23831
+ },
23832
+ });
23833
+ }
23834
+ },
23835
+ }, resetProps: resetProps && {
23836
+ ...resetProps,
23837
+ onFun() {
23838
+ if (selectedRow) {
23839
+ let content = (rowName
23840
+ ? typeof rowName === "function"
23841
+ ? rowName(selectedRow)
23842
+ : selectedRow[rowName]
23843
+ : typeof rowKey === "function"
23844
+ ? rowKey(selectedRow)
23845
+ : selectedRow[rowKey]);
23846
+ confirm({
23847
+ title: "복구 하시겠습니까?",
23848
+ icon: React.createElement(icons.ExclamationCircleOutlined, null),
23849
+ content: content,
23850
+ okText: "Yes",
23851
+ okType: "primary",
23852
+ cancelText: "No",
23853
+ onOk: () => {
23854
+ resetProps.onFun(selectedRow);
23855
+ },
23856
+ onCancel() {
23857
+ console.log("Cancel");
23858
+ },
23859
+ });
23860
+ }
23861
+ },
23862
+ }, removeProps: removeProps && {
23863
+ ...removeProps,
23864
+ onFun() {
23865
+ if (selectedRow) {
23866
+ let content = (rowName
23867
+ ? typeof rowName === "function"
23868
+ ? rowName(selectedRow)
23869
+ : selectedRow[rowName]
23870
+ : typeof rowKey === "function"
23871
+ ? rowKey(selectedRow)
23872
+ : selectedRow[rowKey]);
23873
+ confirm({
23874
+ title: "완전 삭제 하시겠습니까?",
23875
+ icon: React.createElement(icons.ExclamationCircleOutlined, null),
23876
+ content: content,
23877
+ okText: "Yes",
23878
+ okType: "danger",
23879
+ cancelText: "No",
23880
+ onOk: () => {
23881
+ removeProps.onFun(selectedRow);
23882
+ },
23883
+ onCancel() {
23884
+ console.log("Cancel");
23885
+ },
23886
+ });
23887
+ }
23888
+ },
23889
+ }, customProps: customProps && {
23890
+ ...customProps,
23891
+ render: () => {
23892
+ if (customProps.render)
23893
+ return customProps.render(isSelect, selectedRow);
23894
+ else
23895
+ return null;
23896
+ },
23897
+ leftRender: () => {
23898
+ if (customProps.leftRender)
23899
+ return customProps.leftRender(isSelect, selectedRow);
23900
+ else
23901
+ return null;
23902
+ },
23903
+ rightRender: () => {
23904
+ if (customProps.rightRender)
23905
+ return customProps.rightRender(isSelect, selectedRow);
23906
+ else
23907
+ return null;
23908
+ },
23909
+ } }),
23910
+ React.createElement(antd.List, { dataSource: dataSource?.map((i) => i), grid: { gutter: 1, column: 1 }, renderItem: (item, index) => (React.createElement(antd.List.Item, null,
23911
+ React.createElement(antd.Card, null, render ? render(item, index) : React.createElement("div", null, JSON.stringify(item))))) }),
23912
+ React.createElement(TableBottomButtonGroup, { isSelect: isSelect, topProps: topProps && {
23913
+ ...topProps,
23914
+ onFun() {
23915
+ if (selectedRow)
23916
+ topProps.onFun(selectedRow);
23917
+ },
23918
+ }, bottomProps: bottomProps && {
23919
+ ...bottomProps,
23920
+ onFun() {
23921
+ if (selectedRow)
23922
+ bottomProps.onFun(selectedRow);
23923
+ },
23924
+ }, upProps: upProps && {
23925
+ ...upProps,
23926
+ onFun() {
23927
+ if (selectedRow)
23928
+ upProps.onFun(selectedRow);
23929
+ },
23930
+ }, downProps: downProps && {
23931
+ ...downProps,
23932
+ onFun() {
23933
+ if (selectedRow)
23934
+ downProps.onFun(selectedRow);
23935
+ },
23936
+ } }),
23937
+ React.createElement(AntBaseModalCreate, { modalProps: {
23938
+ width: createModalWidth,
23939
+ title: (React.createElement("div", { style: { marginBottom: 20, marginTop: 10 } },
23940
+ React.createElement(Title, { level: 4, style: { margin: 0 } }, popupModify ? "정보 수정" : "신규 등록"))),
23941
+ maskClosable: false,
23942
+ open: popupCreate,
23943
+ onCancel: () => {
23944
+ if (onCreateClose)
23945
+ onCreateClose();
23946
+ showCreatePopup(false);
23947
+ },
23948
+ }, formProps: {
23949
+ initialValues: popupModify
23950
+ ? convert2FormData({
23951
+ data: selectedRow,
23952
+ columns: columns,
23953
+ })
23954
+ : initData
23955
+ ? convert2FormData({
23956
+ data: initData,
23957
+ columns: columns,
23958
+ })
23959
+ : {},
23960
+ onFinish: onCreate,
23961
+ }, props: {
23962
+ customColumn,
23963
+ customValue,
23964
+ columns: popupModify ? (modifyProps?.columns ? modifyProps?.columns : columns) : addProps?.columns ? addProps?.columns : columns,
23965
+ isModify: popupModify,
23966
+ } })));
23967
+ };
23968
+ var AntBaseList$1 = React.forwardRef(AntBaseList);
23969
+
23605
23970
  var css_248z$2 = ".searchbox-module_searchboxFrame__VAWWj{background:#f0f8ff;display:flex;flex-direction:row;padding-bottom:25px;padding-top:15px;width:100%}.searchbox-module_searchboxRow__wzY7N{display:flex;flex-direction:column;justify-content:center;line-height:32px;padding-left:20px;width:100%}.searchbox-module_searchboxBtn__d8Bc6{align-items:flex-end;justify-content:center;width:300px}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNlYXJjaGJveC5tb2R1bGUuY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLHdDQU1FLGtCQUFxQixDQUxyQixZQUFhLENBQ2Isa0JBQW1CLENBR25CLG1CQUFvQixDQURwQixnQkFBaUIsQ0FEakIsVUFJRixDQUVBLHNDQUNFLFlBQWEsQ0FDYixxQkFBc0IsQ0FHdEIsc0JBQXVCLENBRHZCLGdCQUFpQixDQUVqQixpQkFBa0IsQ0FIbEIsVUFLRixDQUNBLHNDQUVFLG9CQUFxQixDQUNyQixzQkFBdUIsQ0FGdkIsV0FHRiIsImZpbGUiOiJzZWFyY2hib3gubW9kdWxlLmNzcyIsInNvdXJjZXNDb250ZW50IjpbIi5zZWFyY2hib3hGcmFtZSB7XHJcbiAgZGlzcGxheTogZmxleDtcclxuICBmbGV4LWRpcmVjdGlvbjogcm93O1xyXG4gIHdpZHRoOiAxMDAlO1xyXG4gIHBhZGRpbmctdG9wOiAxNXB4O1xyXG4gIHBhZGRpbmctYm90dG9tOiAyNXB4O1xyXG4gIGJhY2tncm91bmQ6IGFsaWNlYmx1ZTtcclxufVxyXG5cclxuLnNlYXJjaGJveFJvdyB7XHJcbiAgZGlzcGxheTogZmxleDtcclxuICBmbGV4LWRpcmVjdGlvbjogY29sdW1uO1xyXG4gIHdpZHRoOiAxMDAlO1xyXG4gIGxpbmUtaGVpZ2h0OiAzMnB4O1xyXG4gIGp1c3RpZnktY29udGVudDogY2VudGVyO1xyXG4gIHBhZGRpbmctbGVmdDogMjBweDtcclxuXHJcbn1cclxuLnNlYXJjaGJveEJ0biB7XHJcbiAgd2lkdGg6IDMwMHB4O1xyXG4gIGFsaWduLWl0ZW1zOiBmbGV4LWVuZDtcclxuICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcclxufVxyXG4iXX0= */";
23606
23971
  var styles$2 = {"searchboxFrame":"searchbox-module_searchboxFrame__VAWWj","searchboxRow":"searchbox-module_searchboxRow__wzY7N","searchboxBtn":"searchbox-module_searchboxBtn__d8Bc6"};
23607
23972
  styleInject(css_248z$2);
@@ -24019,7 +24384,7 @@ const LoadingLayout = ({ tip, isLoading, error, isError, style, children, classN
24019
24384
  const Tbpage = ({ tableProps, searchOption, searchDisabled = false, onSubmit, isLoading, title, decs, }) => {
24020
24385
  const { user } = useTbState();
24021
24386
  return (React.createElement("div", { className: styles$1.tableFrame },
24022
- title || decs ? React.createElement(TitleBox$1, { title: title, decs: decs }) : null,
24387
+ title || decs ? React.createElement(TitleBox$2, { title: title, decs: decs }) : null,
24023
24388
  searchOption && (React.createElement(SearchBox, { searchOption: searchOption, onSubmit: onSubmit, searchDisabled: searchDisabled, onReset: () => {
24024
24389
  if (onSubmit)
24025
24390
  onSubmit(null, null, true);
@@ -24028,7 +24393,7 @@ const Tbpage = ({ tableProps, searchOption, searchDisabled = false, onSubmit, is
24028
24393
  React.createElement("div", { className: styles$1.multiFrame },
24029
24394
  React.createElement(AntBaseTable$1, { ...tableProps })))));
24030
24395
  };
24031
- const TitleBox$1 = ({ title, decs }) => {
24396
+ const TitleBox$2 = ({ title, decs }) => {
24032
24397
  return (React.createElement("div", { className: styles$1.titleBox },
24033
24398
  React.createElement("div", { className: styles$1.title }, title),
24034
24399
  React.createElement("div", { className: styles$1.decs }, decs)));
@@ -24046,6 +24411,24 @@ const TbpageSm = ({ tableProps, searchOption, onSubmit, isLoading, title, decs,
24046
24411
  React.createElement(AntBaseTable$1, { ...tableProps })))));
24047
24412
  };
24048
24413
 
24414
+ const Tblist = ({ tableProps, searchOption, searchDisabled = false, onSubmit, isLoading, title, decs, render, }) => {
24415
+ const { user } = useTbState();
24416
+ return (React.createElement("div", { className: styles$1.tableFrame },
24417
+ title || decs ? React.createElement(TitleBox$1, { title: title, decs: decs }) : null,
24418
+ searchOption && (React.createElement(SearchBox, { searchOption: searchOption, onSubmit: onSubmit, searchDisabled: searchDisabled, onReset: () => {
24419
+ if (onSubmit)
24420
+ onSubmit(null, null, true);
24421
+ } })),
24422
+ React.createElement(LoadingLayout, { isLoading: isLoading },
24423
+ React.createElement("div", { className: styles$1.multiFrame },
24424
+ React.createElement(AntBaseList$1, { tableProps: tableProps, render: render })))));
24425
+ };
24426
+ const TitleBox$1 = ({ title, decs }) => {
24427
+ return (React.createElement("div", { className: styles$1.titleBox },
24428
+ React.createElement("div", { className: styles$1.title }, title),
24429
+ React.createElement("div", { className: styles$1.decs }, decs)));
24430
+ };
24431
+
24049
24432
  const TbpageMulti = ({ arrtableProps, arrflex, searchOption, searchDisabled = false, onSubmit, isLoading, title, decs, direction, }) => {
24050
24433
  const { user } = useTbState();
24051
24434
  return (React.createElement("div", { className: styles$1.tableFrame, style: direction === "column" ? { flexDirection: "column" } : {} },
@@ -24082,6 +24465,7 @@ exports.AuthTable = AuthTable;
24082
24465
  exports.ContentLayout = ContentLayout;
24083
24466
  exports.TbFrame = TbFrame;
24084
24467
  exports.TbProvider = TbProvider;
24468
+ exports.Tblist = Tblist;
24085
24469
  exports.TbpProvider = TbpProvider;
24086
24470
  exports.Tbpage = Tbpage;
24087
24471
  exports.TbpageMulti = TbpageMulti;