@thefreshop/tb 1.0.7 → 1.0.8

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
@@ -23238,8 +23238,8 @@ const AntBaseModalCreate = ({ modalProps, formProps, props }) => {
23238
23238
  React.createElement(antd.Button, { htmlType: "submit" }, props.buttonName ?? (isModify ? FORM_MODIFY : FORM_CREATE))))));
23239
23239
  };
23240
23240
 
23241
- const { Title } = antd.Typography;
23242
- const { confirm } = antd.Modal;
23241
+ const { Title: Title$1 } = antd.Typography;
23242
+ const { confirm: confirm$1 } = antd.Modal;
23243
23243
  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
23244
  const [selectedRowKeys, setSelectedRowKeys] = React.useState([]);
23245
23245
  const [selectedRow, setSelectedRow] = React.useState();
@@ -23368,7 +23368,7 @@ const AntBaseTable = ({ bordered, className, rowKey, rowName, dataSource, initDa
23368
23368
  : typeof rowKey === "function"
23369
23369
  ? rowKey(selectedRow)
23370
23370
  : selectedRow[rowKey]);
23371
- confirm({
23371
+ confirm$1({
23372
23372
  title: "삭제 하시겠습니까?",
23373
23373
  icon: React.createElement(icons.ExclamationCircleOutlined, null),
23374
23374
  content: content,
@@ -23395,7 +23395,7 @@ const AntBaseTable = ({ bordered, className, rowKey, rowName, dataSource, initDa
23395
23395
  : typeof rowKey === "function"
23396
23396
  ? rowKey(selectedRow)
23397
23397
  : selectedRow[rowKey]);
23398
- confirm({
23398
+ confirm$1({
23399
23399
  title: "복구 하시겠습니까?",
23400
23400
  icon: React.createElement(icons.ExclamationCircleOutlined, null),
23401
23401
  content: content,
@@ -23422,7 +23422,7 @@ const AntBaseTable = ({ bordered, className, rowKey, rowName, dataSource, initDa
23422
23422
  : typeof rowKey === "function"
23423
23423
  ? rowKey(selectedRow)
23424
23424
  : selectedRow[rowKey]);
23425
- confirm({
23425
+ confirm$1({
23426
23426
  title: "완전 삭제 하시겠습니까?",
23427
23427
  icon: React.createElement(icons.ExclamationCircleOutlined, null),
23428
23428
  content: content,
@@ -23557,7 +23557,7 @@ const AntBaseTable = ({ bordered, className, rowKey, rowName, dataSource, initDa
23557
23557
  React.createElement(AntBaseModalCreate, { modalProps: {
23558
23558
  width: createModalWidth,
23559
23559
  title: (React.createElement("div", { style: { marginBottom: 20, marginTop: 10 } },
23560
- React.createElement(Title, { level: 4, style: { margin: 0 } }, popupModify ? "정보 수정" : "신규 등록"))),
23560
+ React.createElement(Title$1, { level: 4, style: { margin: 0 } }, popupModify ? "정보 수정" : "신규 등록"))),
23561
23561
  maskClosable: false,
23562
23562
  open: popupCreate,
23563
23563
  onCancel: () => {
@@ -23602,6 +23602,288 @@ const AntBaseTable = ({ bordered, className, rowKey, rowName, dataSource, initDa
23602
23602
  */
23603
23603
  var AntBaseTable$1 = React.forwardRef(AntBaseTable);
23604
23604
 
23605
+ const { Title } = antd.Typography;
23606
+ const { confirm } = antd.Modal;
23607
+ const AntBaseList = ({ tableProps, render, }, ref) => {
23608
+ 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;
23609
+ const [selectedRowKeys, setSelectedRowKeys] = React.useState([]);
23610
+ const [selectedRow, setSelectedRow] = React.useState();
23611
+ const [popupCreate, setPopupCreate] = React.useState(false);
23612
+ const [popupModify, setPopupModify] = React.useState(false);
23613
+ React.useEffect(() => {
23614
+ setSelectedRow(dataSource?.find((m) => {
23615
+ if (m) {
23616
+ let key = typeof rowKey === "function" ? rowKey(m) : m[rowKey];
23617
+ return key === selectedRowKeys[0];
23618
+ }
23619
+ return false;
23620
+ }));
23621
+ }, [dataSource, rowKey, selectedRowKeys]);
23622
+ //선택 리셋
23623
+ const resetSelection = () => {
23624
+ setSelectedRowKeys([]);
23625
+ setSelectedRow(undefined);
23626
+ };
23627
+ //재 선택??
23628
+ const reSelection = () => {
23629
+ if (selectProps) {
23630
+ if (selectedRowKeys.length !== 0 && dataSource?.length !== 0) {
23631
+ setSelectedRow(dataSource?.find((m) => {
23632
+ if (m) {
23633
+ let key = typeof rowKey === "function" ? rowKey(m) : m[rowKey];
23634
+ return key === selectedRowKeys[0];
23635
+ }
23636
+ return false;
23637
+ }));
23638
+ if (selectProps.onUpdateData) {
23639
+ selectProps.onUpdateData(dataSource?.find((m) => {
23640
+ if (m) {
23641
+ let key = typeof rowKey === "function" ? rowKey(m) : m[rowKey];
23642
+ return key === selectedRowKeys[0];
23643
+ }
23644
+ return false;
23645
+ }));
23646
+ }
23647
+ }
23648
+ }
23649
+ };
23650
+ //ref 함수
23651
+ React.useImperativeHandle(ref, () => ({
23652
+ resetSelection,
23653
+ reSelection,
23654
+ popupCreate,
23655
+ popupModify,
23656
+ selectedRow,
23657
+ }), [selectedRow, popupCreate, popupModify]);
23658
+ // 추가 팝업 on/off
23659
+ const showCreatePopup = (show) => {
23660
+ setPopupCreate(show);
23661
+ setPopupModify(false);
23662
+ };
23663
+ // 추가/수정 완료
23664
+ const onCreate = (value) => {
23665
+ setPopupCreate(false);
23666
+ setPopupModify(false);
23667
+ if (popupModify && modifyProps) {
23668
+ let key = typeof rowKey === "function" ? rowKey(selectedRow) : rowKey;
23669
+ modifyProps.onFun({ [key.toString()]: key, ...value }, selectedRow);
23670
+ // 키 값과 함꼐 전달
23671
+ }
23672
+ else if (addProps) {
23673
+ addProps.onFun(value);
23674
+ }
23675
+ setSelectedRowKeys([]);
23676
+ setSelectedRow(undefined);
23677
+ };
23678
+ // 수정 창 열기전 beforeModify 확인후 수정 작업
23679
+ const showModify = () => {
23680
+ if (modifyProps?.beforeCheck) {
23681
+ modifyProps
23682
+ .beforeCheck(selectedRow)
23683
+ .then((newValue) => {
23684
+ setSelectedRow(newValue);
23685
+ setPopupCreate(true);
23686
+ setPopupModify(true);
23687
+ })
23688
+ .catch();
23689
+ }
23690
+ else {
23691
+ setPopupCreate(true);
23692
+ setPopupModify(true);
23693
+ }
23694
+ };
23695
+ //선택 유무
23696
+ const isSelect = selectedRowKeys.length !== 0;
23697
+ return (React.createElement("div", { className: className, style: {
23698
+ display: "flex",
23699
+ flexDirection: "column",
23700
+ flex: 1,
23701
+ gap: 10,
23702
+ height: "100%",
23703
+ padding: "20px",
23704
+ } },
23705
+ React.createElement(TableTopButtonGroup, { isSelect: isSelect, isCounter: isCounter, onRefresh: onRefresh, autoRefreshTime: autoRefreshTime, addProps: addProps && {
23706
+ ...addProps,
23707
+ onFun: () => {
23708
+ if (addProps.customModal) {
23709
+ addProps.onFun(selectedRow);
23710
+ }
23711
+ else {
23712
+ showCreatePopup(true);
23713
+ }
23714
+ },
23715
+ }, modifyProps: modifyProps && {
23716
+ ...modifyProps,
23717
+ onFun() {
23718
+ if (modifyProps.customModal) {
23719
+ modifyProps.onFun(selectedRow);
23720
+ }
23721
+ else {
23722
+ showModify();
23723
+ }
23724
+ },
23725
+ }, deleteProps: deleteProps && {
23726
+ ...deleteProps,
23727
+ onFun() {
23728
+ if (selectedRow) {
23729
+ let content = (rowName
23730
+ ? typeof rowName === "function"
23731
+ ? rowName(selectedRow)
23732
+ : selectedRow[rowName]
23733
+ : typeof rowKey === "function"
23734
+ ? rowKey(selectedRow)
23735
+ : selectedRow[rowKey]);
23736
+ confirm({
23737
+ title: "삭제 하시겠습니까?",
23738
+ icon: React.createElement(icons.ExclamationCircleOutlined, null),
23739
+ content: content,
23740
+ okText: "Yes",
23741
+ okType: "danger",
23742
+ cancelText: "No",
23743
+ onOk: () => {
23744
+ deleteProps.onFun(selectedRow);
23745
+ },
23746
+ onCancel() {
23747
+ console.log("Cancel");
23748
+ },
23749
+ });
23750
+ }
23751
+ },
23752
+ }, resetProps: resetProps && {
23753
+ ...resetProps,
23754
+ onFun() {
23755
+ if (selectedRow) {
23756
+ let content = (rowName
23757
+ ? typeof rowName === "function"
23758
+ ? rowName(selectedRow)
23759
+ : selectedRow[rowName]
23760
+ : typeof rowKey === "function"
23761
+ ? rowKey(selectedRow)
23762
+ : selectedRow[rowKey]);
23763
+ confirm({
23764
+ title: "복구 하시겠습니까?",
23765
+ icon: React.createElement(icons.ExclamationCircleOutlined, null),
23766
+ content: content,
23767
+ okText: "Yes",
23768
+ okType: "primary",
23769
+ cancelText: "No",
23770
+ onOk: () => {
23771
+ resetProps.onFun(selectedRow);
23772
+ },
23773
+ onCancel() {
23774
+ console.log("Cancel");
23775
+ },
23776
+ });
23777
+ }
23778
+ },
23779
+ }, removeProps: removeProps && {
23780
+ ...removeProps,
23781
+ onFun() {
23782
+ if (selectedRow) {
23783
+ let content = (rowName
23784
+ ? typeof rowName === "function"
23785
+ ? rowName(selectedRow)
23786
+ : selectedRow[rowName]
23787
+ : typeof rowKey === "function"
23788
+ ? rowKey(selectedRow)
23789
+ : selectedRow[rowKey]);
23790
+ confirm({
23791
+ title: "완전 삭제 하시겠습니까?",
23792
+ icon: React.createElement(icons.ExclamationCircleOutlined, null),
23793
+ content: content,
23794
+ okText: "Yes",
23795
+ okType: "danger",
23796
+ cancelText: "No",
23797
+ onOk: () => {
23798
+ removeProps.onFun(selectedRow);
23799
+ },
23800
+ onCancel() {
23801
+ console.log("Cancel");
23802
+ },
23803
+ });
23804
+ }
23805
+ },
23806
+ }, customProps: customProps && {
23807
+ ...customProps,
23808
+ render: () => {
23809
+ if (customProps.render)
23810
+ return customProps.render(isSelect, selectedRow);
23811
+ else
23812
+ return null;
23813
+ },
23814
+ leftRender: () => {
23815
+ if (customProps.leftRender)
23816
+ return customProps.leftRender(isSelect, selectedRow);
23817
+ else
23818
+ return null;
23819
+ },
23820
+ rightRender: () => {
23821
+ if (customProps.rightRender)
23822
+ return customProps.rightRender(isSelect, selectedRow);
23823
+ else
23824
+ return null;
23825
+ },
23826
+ } }),
23827
+ React.createElement(antd.List, { dataSource: dataSource?.map((i) => i), grid: { gutter: 1, column: 1 }, renderItem: (item, index) => (React.createElement(antd.List.Item, null,
23828
+ React.createElement(antd.Card, null, render ? render(item, index) : React.createElement("div", null, JSON.stringify(item))))) }),
23829
+ React.createElement(TableBottomButtonGroup, { isSelect: isSelect, topProps: topProps && {
23830
+ ...topProps,
23831
+ onFun() {
23832
+ if (selectedRow)
23833
+ topProps.onFun(selectedRow);
23834
+ },
23835
+ }, bottomProps: bottomProps && {
23836
+ ...bottomProps,
23837
+ onFun() {
23838
+ if (selectedRow)
23839
+ bottomProps.onFun(selectedRow);
23840
+ },
23841
+ }, upProps: upProps && {
23842
+ ...upProps,
23843
+ onFun() {
23844
+ if (selectedRow)
23845
+ upProps.onFun(selectedRow);
23846
+ },
23847
+ }, downProps: downProps && {
23848
+ ...downProps,
23849
+ onFun() {
23850
+ if (selectedRow)
23851
+ downProps.onFun(selectedRow);
23852
+ },
23853
+ } }),
23854
+ React.createElement(AntBaseModalCreate, { modalProps: {
23855
+ width: createModalWidth,
23856
+ title: (React.createElement("div", { style: { marginBottom: 20, marginTop: 10 } },
23857
+ React.createElement(Title, { level: 4, style: { margin: 0 } }, popupModify ? "정보 수정" : "신규 등록"))),
23858
+ maskClosable: false,
23859
+ open: popupCreate,
23860
+ onCancel: () => {
23861
+ if (onCreateClose)
23862
+ onCreateClose();
23863
+ showCreatePopup(false);
23864
+ },
23865
+ }, formProps: {
23866
+ initialValues: popupModify
23867
+ ? convert2FormData({
23868
+ data: selectedRow,
23869
+ columns: columns,
23870
+ })
23871
+ : initData
23872
+ ? convert2FormData({
23873
+ data: initData,
23874
+ columns: columns,
23875
+ })
23876
+ : {},
23877
+ onFinish: onCreate,
23878
+ }, props: {
23879
+ customColumn,
23880
+ customValue,
23881
+ columns: popupModify ? (modifyProps?.columns ? modifyProps?.columns : columns) : addProps?.columns ? addProps?.columns : columns,
23882
+ isModify: popupModify,
23883
+ } })));
23884
+ };
23885
+ var AntBaseList$1 = React.forwardRef(AntBaseList);
23886
+
23605
23887
  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
23888
  var styles$2 = {"searchboxFrame":"searchbox-module_searchboxFrame__VAWWj","searchboxRow":"searchbox-module_searchboxRow__wzY7N","searchboxBtn":"searchbox-module_searchboxBtn__d8Bc6"};
23607
23889
  styleInject(css_248z$2);
@@ -24019,7 +24301,7 @@ const LoadingLayout = ({ tip, isLoading, error, isError, style, children, classN
24019
24301
  const Tbpage = ({ tableProps, searchOption, searchDisabled = false, onSubmit, isLoading, title, decs, }) => {
24020
24302
  const { user } = useTbState();
24021
24303
  return (React.createElement("div", { className: styles$1.tableFrame },
24022
- title || decs ? React.createElement(TitleBox$1, { title: title, decs: decs }) : null,
24304
+ title || decs ? React.createElement(TitleBox$2, { title: title, decs: decs }) : null,
24023
24305
  searchOption && (React.createElement(SearchBox, { searchOption: searchOption, onSubmit: onSubmit, searchDisabled: searchDisabled, onReset: () => {
24024
24306
  if (onSubmit)
24025
24307
  onSubmit(null, null, true);
@@ -24028,7 +24310,7 @@ const Tbpage = ({ tableProps, searchOption, searchDisabled = false, onSubmit, is
24028
24310
  React.createElement("div", { className: styles$1.multiFrame },
24029
24311
  React.createElement(AntBaseTable$1, { ...tableProps })))));
24030
24312
  };
24031
- const TitleBox$1 = ({ title, decs }) => {
24313
+ const TitleBox$2 = ({ title, decs }) => {
24032
24314
  return (React.createElement("div", { className: styles$1.titleBox },
24033
24315
  React.createElement("div", { className: styles$1.title }, title),
24034
24316
  React.createElement("div", { className: styles$1.decs }, decs)));
@@ -24046,6 +24328,24 @@ const TbpageSm = ({ tableProps, searchOption, onSubmit, isLoading, title, decs,
24046
24328
  React.createElement(AntBaseTable$1, { ...tableProps })))));
24047
24329
  };
24048
24330
 
24331
+ const Tblist = ({ tableProps, searchOption, searchDisabled = false, onSubmit, isLoading, title, decs, render, }) => {
24332
+ const { user } = useTbState();
24333
+ return (React.createElement("div", { className: styles$1.tableFrame },
24334
+ title || decs ? React.createElement(TitleBox$1, { title: title, decs: decs }) : null,
24335
+ searchOption && (React.createElement(SearchBox, { searchOption: searchOption, onSubmit: onSubmit, searchDisabled: searchDisabled, onReset: () => {
24336
+ if (onSubmit)
24337
+ onSubmit(null, null, true);
24338
+ } })),
24339
+ React.createElement(LoadingLayout, { isLoading: isLoading },
24340
+ React.createElement("div", { className: styles$1.multiFrame },
24341
+ React.createElement(AntBaseList$1, { tableProps: tableProps, render: render })))));
24342
+ };
24343
+ const TitleBox$1 = ({ title, decs }) => {
24344
+ return (React.createElement("div", { className: styles$1.titleBox },
24345
+ React.createElement("div", { className: styles$1.title }, title),
24346
+ React.createElement("div", { className: styles$1.decs }, decs)));
24347
+ };
24348
+
24049
24349
  const TbpageMulti = ({ arrtableProps, arrflex, searchOption, searchDisabled = false, onSubmit, isLoading, title, decs, direction, }) => {
24050
24350
  const { user } = useTbState();
24051
24351
  return (React.createElement("div", { className: styles$1.tableFrame, style: direction === "column" ? { flexDirection: "column" } : {} },
@@ -24082,6 +24382,7 @@ exports.AuthTable = AuthTable;
24082
24382
  exports.ContentLayout = ContentLayout;
24083
24383
  exports.TbFrame = TbFrame;
24084
24384
  exports.TbProvider = TbProvider;
24385
+ exports.Tblist = Tblist;
24085
24386
  exports.TbpProvider = TbpProvider;
24086
24387
  exports.Tbpage = Tbpage;
24087
24388
  exports.TbpageMulti = TbpageMulti;