@thefreshop/tb 1.1.3 → 1.1.4

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.
@@ -1,3 +1,5 @@
1
1
  import React from "react";
2
- declare const Main: () => React.JSX.Element;
2
+ declare const Main: ({ style }: {
3
+ style?: React.CSSProperties;
4
+ }) => React.JSX.Element;
3
5
  export default Main;
@@ -17,7 +17,7 @@ import { btnReturnFType, customBtnReturnFType } from "../../../../types";
17
17
 
18
18
  * @todo
19
19
  */
20
- export declare const TableTopButtonGroup: ({ isSelect, onRefresh, isCounter, autoRefreshTime, addProps, modifyProps, deleteProps, removeProps, resetProps, customProps, }: {
20
+ export declare const TableTopButtonGroup: ({ isSelect, onRefresh, isCounter, autoRefreshTime, addProps, modifyProps, deleteProps, removeProps, resetProps, customProps, isInSearch, onInSearch, }: {
21
21
  isSelect: boolean;
22
22
  onRefresh?: () => void;
23
23
  isCounter?: boolean;
@@ -28,6 +28,8 @@ export declare const TableTopButtonGroup: ({ isSelect, onRefresh, isCounter, aut
28
28
  removeProps?: btnReturnFType;
29
29
  resetProps?: btnReturnFType;
30
30
  customProps?: customBtnReturnFType;
31
+ isInSearch?: boolean;
32
+ onInSearch?: (value: string) => void;
31
33
  }) => React.JSX.Element | null;
32
34
  export declare const TableBottomButtonGroup: ({ isSelect, topProps, bottomProps, upProps, downProps, }: {
33
35
  isSelect: boolean;
@@ -45,6 +45,7 @@ export type antBasePropsType<T = AnyObject, K = string | GetRowKey<T>> = {
45
45
  autoRefreshTime?: number;
46
46
  createModalWidth?: React.CSSProperties["width"];
47
47
  onCreateClose?: () => void;
48
+ isInSearch?: boolean;
48
49
  };
49
50
  export type antBaseColumnType = {
50
51
  tableProps: (ColumnType<AnyObject> | ColumnGroupType<AnyObject>) & {
@@ -12,6 +12,7 @@ export type FrameStyleType = {
12
12
  mainframe?: React.CSSProperties;
13
13
  centerFrame?: React.CSSProperties;
14
14
  contentsFrame?: React.CSSProperties;
15
+ contentsMainFrame?: React.CSSProperties;
15
16
  bottomFrame?: React.CSSProperties;
16
17
  naviFrame?: React.CSSProperties;
17
18
  nav_item?: React.CSSProperties;
package/dist/esm/index.js CHANGED
@@ -383,11 +383,11 @@ var css_248z$7 = ".main-module_mainFrame__Etjvl{height:100%;width:100%}.main-mod
383
383
  var styles$5 = {"mainFrame":"main-module_mainFrame__Etjvl","mainFrameFullscreen":"main-module_mainFrameFullscreen__oEwV8"};
384
384
  styleInject(css_248z$7);
385
385
 
386
- const Main = () => {
386
+ const Main = ({ style }) => {
387
387
  const [sp] = useSearchParams();
388
388
  const isFs = sp.get("fs") === "1" || sp.get("fullscreen") === "1";
389
389
  // console.log("Main render, isFs:", isFs);
390
- return (React__default.createElement("div", { className: isFs ? styles$5.mainFrameFullscreen : styles$5.mainFrame },
390
+ return (React__default.createElement("div", { className: isFs ? styles$5.mainFrameFullscreen : styles$5.mainFrame, style: style },
391
391
  React__default.createElement(Outlet, null)));
392
392
  };
393
393
 
@@ -616,7 +616,7 @@ const MainLayout = ({ errMsg, setting, top_banner, nav, user, top, bottom, frame
616
616
  React__default.createElement(Nav, { nav: nav, islogin: setting.islogin ?? false, frameStyle: frameStyle }),
617
617
  React__default.createElement("div", { className: styles$9.contentsFrame, style: frameStyle?.contentsFrame },
618
618
  React__default.createElement(Tabs, { nav: nav, frameStyle: frameStyle }),
619
- React__default.createElement(Main, null))),
619
+ React__default.createElement(Main, { style: frameStyle?.contentsMainFrame }))),
620
620
  React__default.createElement("div", { className: styles$9.bottomFrame, style: frameStyle?.bottomFrame }, bottom && React__default.createElement(Bottom, { bottom: bottom, frameStyle: frameStyle }))))));
621
621
  };
622
622
 
@@ -685,7 +685,7 @@ const FORM_CREATE = "등록";
685
685
 
686
686
  * @todo
687
687
  */
688
- const TableTopButtonGroup = ({ isSelect, onRefresh, isCounter, autoRefreshTime, addProps, modifyProps, deleteProps, removeProps, resetProps, customProps, }) => {
688
+ const TableTopButtonGroup = ({ isSelect, onRefresh, isCounter, autoRefreshTime, addProps, modifyProps, deleteProps, removeProps, resetProps, customProps, isInSearch = false, onInSearch, }) => {
689
689
  if (!addProps && !modifyProps && !deleteProps && !removeProps && !resetProps && !customProps && !onRefresh) {
690
690
  return null;
691
691
  }
@@ -732,7 +732,8 @@ const TableTopButtonGroup = ({ isSelect, onRefresh, isCounter, autoRefreshTime,
732
732
  deleteProps ? (React__default.createElement(Button, { danger: true, disabled: !isSelect || deleteProps.disable, onClick: deleteProps.onFun }, deleteProps.title ? deleteProps.title : TABLE_DELETE)) : null,
733
733
  resetProps ? (React__default.createElement(Button, { disabled: !isSelect || resetProps.disable, onClick: resetProps.onFun }, resetProps.title ? resetProps.title : TABLE_RESET)) : null,
734
734
  removeProps ? (React__default.createElement(Button, { danger: true, type: "primary", disabled: !isSelect || removeProps.disable, onClick: removeProps.onFun }, removeProps.title ? removeProps.title : TABLE_REMOVE)) : null,
735
- customProps?.rightRender && customProps?.rightRender()))));
735
+ customProps?.rightRender && customProps?.rightRender(),
736
+ isInSearch && onInSearch ? React__default.createElement(InSearchForm, { onInSearch: onInSearch }) : null))));
736
737
  };
737
738
  const TableBottomButtonGroup = ({ isSelect, topProps, bottomProps, upProps, downProps, }) => {
738
739
  return (React__default.createElement(Row, { justify: "space-between" },
@@ -746,6 +747,22 @@ const TableBottomButtonGroup = ({ isSelect, topProps, bottomProps, upProps, down
746
747
  downProps ? (React__default.createElement(Button, { disabled: !isSelect || downProps.disable, onClick: downProps.onFun }, TABLE_DOWN)) : null,
747
748
  bottomProps ? (React__default.createElement(Button, { disabled: !isSelect || bottomProps.disable, onClick: bottomProps.onFun }, TABLE_BOTTOM)) : null))));
748
749
  };
750
+ const InSearchForm = ({ onInSearch }) => {
751
+ const [inputSearch, setInputSearch] = useState("");
752
+ const SearchClick = () => {
753
+ onInSearch(inputSearch);
754
+ };
755
+ const activeEnter = (e) => {
756
+ if (e.key === "Enter") {
757
+ SearchClick();
758
+ }
759
+ };
760
+ return (React__default.createElement(Space.Compact, null,
761
+ React__default.createElement(Input, { style: { width: "150px" }, onChange: (e) => {
762
+ setInputSearch(e.target.value);
763
+ }, value: inputSearch, onKeyDown: (e) => activeEnter(e) }),
764
+ React__default.createElement(Button, { onClick: SearchClick }, "\uAC80\uC0C9")));
765
+ };
749
766
 
750
767
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
751
768
 
@@ -23323,11 +23340,24 @@ const AntBaseModalCreate = ({ modalProps, formProps, props }) => {
23323
23340
 
23324
23341
  const { Title: Title$1 } = Typography;
23325
23342
  const { confirm: confirm$1 } = Modal;
23326
- const AntBaseTable$1 = ({ 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) => {
23343
+ const AntBaseTable$1 = ({ 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, isInSearch = false, }, ref) => {
23327
23344
  const [selectedRowKeys, setSelectedRowKeys] = useState([]);
23328
23345
  const [selectedRow, setSelectedRow] = useState();
23329
23346
  const [popupCreate, setPopupCreate] = useState(false);
23330
23347
  const [popupModify, setPopupModify] = useState(false);
23348
+ const [viewData, setViewData] = useState(dataSource);
23349
+ const onInSearch = (value) => {
23350
+ const search = value.trim().toLowerCase();
23351
+ if (!search) {
23352
+ setViewData(dataSource);
23353
+ return;
23354
+ }
23355
+ setViewData(dataSource.filter((item) => Object.values(item).some((itemValue) => {
23356
+ if (itemValue == null)
23357
+ return false;
23358
+ return String(itemValue).toLowerCase().includes(search);
23359
+ })));
23360
+ };
23331
23361
  useEffect(() => {
23332
23362
  setSelectedRow(dataSource?.find((m) => {
23333
23363
  if (m) {
@@ -23420,7 +23450,7 @@ const AntBaseTable$1 = ({ bordered, className, rowKey, rowName, dataSource, init
23420
23450
  height: "100%",
23421
23451
  padding: "20px",
23422
23452
  } },
23423
- React__default.createElement(TableTopButtonGroup, { isSelect: isSelect, isCounter: isCounter, onRefresh: onRefresh, autoRefreshTime: autoRefreshTime, addProps: addProps && {
23453
+ React__default.createElement(TableTopButtonGroup, { isInSearch: isInSearch, onInSearch: onInSearch, isSelect: isSelect, isCounter: isCounter, onRefresh: onRefresh, autoRefreshTime: autoRefreshTime, addProps: addProps && {
23424
23454
  ...addProps,
23425
23455
  onFun: () => {
23426
23456
  if (addProps.customModal) {
@@ -23601,7 +23631,7 @@ const AntBaseTable$1 = ({ bordered, className, rowKey, rowName, dataSource, init
23601
23631
  return {
23602
23632
  onClick: () => { }, // click header row
23603
23633
  };
23604
- }, dataSource: dataSource?.map((i) => i),
23634
+ }, dataSource: viewData?.map((i) => i),
23605
23635
  // columns={tableColumns(
23606
23636
  // columns.concat(
23607
23637
  // deleteCol({