@thefreshop/tb 1.0.23 → 1.0.25

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,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { tbframeType, topType } from "../../types";
3
- declare const Top: ({ setting, top: { title, titleimage, topMenuSetting, menuStyle, imgstyle, titleStyle, topRight, defalultTopKey }, }: {
3
+ declare const Top: ({ setting, top: { title, titleimage, topMenuSetting, menuStyle, imgstyle, titleStyle, topRight }, }: {
4
4
  setting: tbframeType;
5
5
  top: topType;
6
6
  }) => React.JSX.Element;
@@ -1,6 +1,6 @@
1
- import type { AnyObject } from 'antd/es/_util/type';
2
- import type { ExpandableConfig, GetRowKey, TablePaginationConfig, TableRowSelection } from 'antd/es/table/interface';
3
- import type { ColumnGroupType, ColumnType, TableProps } from 'antd/es/table';
1
+ import type { AnyObject } from "antd/es/_util/type";
2
+ import type { ExpandableConfig, GetRowKey, TablePaginationConfig, TableRowSelection } from "antd/es/table/interface";
3
+ import type { ColumnGroupType, ColumnType, TableProps } from "antd/es/table";
4
4
  export interface AntBaseTableRefProps<ItemType> {
5
5
  resetSelection: () => void;
6
6
  reSelection: () => void;
@@ -19,7 +19,7 @@ export type antBasePropsType<T = AnyObject, K = string | GetRowKey<T>> = {
19
19
  customValue?: (data: any) => any;
20
20
  columns: antBaseColumnType[];
21
21
  expandable?: ExpandableConfig<AnyObject>;
22
- size?: 'large' | 'middle' | 'small';
22
+ size?: "large" | "middle" | "small";
23
23
  onClick?: (record: T, index?: number) => void;
24
24
  onDoubleClick?: (record: T, index?: number) => void;
25
25
  selectProps?: selectType<T>;
@@ -39,11 +39,11 @@ export type antBasePropsType<T = AnyObject, K = string | GetRowKey<T>> = {
39
39
  upProps?: btnReturnTType<T>;
40
40
  downProps?: btnReturnTType<T>;
41
41
  pageProps?: TablePaginationConfig | false;
42
- scroll?: TableProps<AnyObject>['scroll'];
42
+ scroll?: TableProps<AnyObject>["scroll"];
43
43
  onRefresh?: () => void;
44
44
  isCounter?: boolean;
45
45
  autoRefreshTime?: number;
46
- createModalWidth?: React.CSSProperties['width'];
46
+ createModalWidth?: React.CSSProperties["width"];
47
47
  onCreateClose?: () => void;
48
48
  };
49
49
  export type antBaseColumnType = {
@@ -52,9 +52,9 @@ export type antBaseColumnType = {
52
52
  };
53
53
  formatProps?: {
54
54
  hidden?: boolean;
55
- type: 'tag' | 'json_tags' | 'tagarr' | 'switch' | 'price' | 'length' | 'tel' | 'file' | 'files' | 'copy' | 'email' | 'image' | 'images' | 'addcount' | 'tostring' | 'jsonarr' | 'arr' | 'sleeptime' | 'sleeptimes' | 'compute' | 'answer' | 'number' | 'select' | 'DateTime' | 'imageCrop' | 'password' | 'code' | 'textEditer' | 'string' | 'custom' | 'remainingtime';
55
+ type: "tag" | "json_tags" | "tagarr" | "switch" | "price" | "length" | "tel" | "file" | "files" | "copy" | "email" | "image" | "images" | "addcount" | "tostring" | "jsonarr" | "arr" | "sleeptime" | "sleeptimes" | "compute" | "answer" | "number" | "select" | "DateTime" | "imageCrop" | "password" | "code" | "textEditer" | "string" | "custom" | "remainingtime";
56
56
  formatter?: {
57
- text: 'default' | string | undefined | null;
57
+ text: "default" | string | undefined | null;
58
58
  asText: string;
59
59
  color: string;
60
60
  }[];
@@ -68,8 +68,8 @@ export type antBaseColumnType = {
68
68
  title: any;
69
69
  onChange: (data: any) => void;
70
70
  }) => any;
71
- image_width?: React.CSSProperties['width'];
72
- image_height?: React.CSSProperties['height'];
71
+ image_width?: React.CSSProperties["width"];
72
+ image_height?: React.CSSProperties["height"];
73
73
  imagesId?: string;
74
74
  };
75
75
  sort?: boolean;
@@ -80,7 +80,7 @@ export type antBaseColumnType = {
80
80
  countIndex?: string;
81
81
  tooltip?: any;
82
82
  placeholder?: any;
83
- defaultValue?: any;
83
+ initialValues?: any;
84
84
  rules?: any[];
85
85
  };
86
86
  export type btnReturnTType<T> = {
@@ -105,8 +105,8 @@ export type customBtnReturnFType = {
105
105
  rightRender?: () => React.ReactNode;
106
106
  };
107
107
  export type selectType<T> = {
108
- type: 'radio' | 'checkbox';
108
+ type: "radio" | "checkbox";
109
109
  onFun?: (key: T | React.Key[]) => void;
110
- checkboxProps?: TableRowSelection<AnyObject>['getCheckboxProps'];
110
+ checkboxProps?: TableRowSelection<AnyObject>["getCheckboxProps"];
111
111
  onUpdateData?: (data?: T) => void;
112
112
  };
@@ -23,7 +23,6 @@ export type topMenuType = {
23
23
  };
24
24
  export declare const topbase: topType;
25
25
  export type topType = {
26
- defalultTopKey?: string;
27
26
  title?: string;
28
27
  titleimage?: string;
29
28
  topMenuSetting: topMenuType[];
package/dist/esm/index.js CHANGED
@@ -170,14 +170,14 @@ var css_248z$a = ".top-module_topframe__LhKDg{align-items:center;border-bottom:1
170
170
  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"};
171
171
  styleInject(css_248z$a);
172
172
 
173
- const Top = ({ setting, top: { title = topbase.title, titleimage, topMenuSetting, menuStyle, imgstyle, titleStyle, topRight, defalultTopKey }, }) => {
173
+ const Top = ({ setting, top: { title = topbase.title, titleimage, topMenuSetting, menuStyle, imgstyle, titleStyle, topRight }, }) => {
174
174
  const { logout, user, addTabKey, setCurrentTabKey } = useTbState();
175
175
  const navigate = useNavigate();
176
176
  const userTop = () => {
177
177
  let topmenutable = [];
178
178
  if (user?.user_group?.group_key === "master" || setting.islogin === false) {
179
179
  topMenuSetting.forEach((m, index) => {
180
- topmenutable.push(React__default.createElement(TopMenu, { key: index, topMenuSetting: m, menuStyle: menuStyle, defalultTopKey: defalultTopKey }));
180
+ topmenutable.push(React__default.createElement(TopMenu, { key: index, topMenuSetting: m, menuStyle: menuStyle }));
181
181
  });
182
182
  }
183
183
  else {
@@ -185,7 +185,7 @@ const Top = ({ setting, top: { title = topbase.title, titleimage, topMenuSetting
185
185
  return user?.user_group?.group_section_auth.includes(m.key);
186
186
  });
187
187
  userSection.forEach((m, index) => {
188
- topmenutable.push(React__default.createElement(TopMenu, { key: index, topMenuSetting: m, menuStyle: menuStyle, defalultTopKey: defalultTopKey }));
188
+ topmenutable.push(React__default.createElement(TopMenu, { key: index, topMenuSetting: m, menuStyle: menuStyle }));
189
189
  });
190
190
  }
191
191
  return topmenutable;
@@ -204,15 +204,9 @@ const Top = ({ setting, top: { title = topbase.title, titleimage, topMenuSetting
204
204
  React__default.createElement("div", { className: styles$8.top_menu }, userTop()),
205
205
  topRight ? (topRight) : !setting?.islogin ? null : setting?.logoutComponent ? (setting?.logoutComponent) : (React__default.createElement("button", { onClick: () => logout() }, "\uB85C\uADF8\uC544\uC6C3"))));
206
206
  };
207
- const TopMenu = ({ topMenuSetting: { title, icon, key }, menuStyle = {}, defalultTopKey, }) => {
207
+ const TopMenu = ({ topMenuSetting: { title, icon, key }, menuStyle = {} }) => {
208
208
  const [hover, setHover] = useState(false);
209
209
  const { topkey, setTopkey } = useTbState();
210
- useEffect(() => {
211
- if (defalultTopKey) {
212
- console.log(defalultTopKey);
213
- setTopkey(defalultTopKey);
214
- }
215
- }, [defalultTopKey]);
216
210
  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: () => {
217
211
  setHover(true);
218
212
  }, onMouseLeave: () => {
@@ -23070,7 +23064,7 @@ const useFormColumns = ({ isModify, columns, onChange, }) => {
23070
23064
  }
23071
23065
  else if (i.formatProps.type === "code") {
23072
23066
  ant_form.push(React__default.createElement(Form.Item, { key: i.tableProps.dataIndex, name: i.tableProps.dataIndex, label: i.tableProps.title, tooltip: i.tooltip, rules: i.rules, hidden: i.formatProps.hidden },
23073
- React__default.createElement(Input, { ...i.formatProps.itemProps, placeholder: i.placeholder, defaultValue: moment$1().format("X") })));
23067
+ React__default.createElement(Input, { ...i.formatProps.itemProps, placeholder: i.placeholder, initialValues: moment$1().format("X") })));
23074
23068
  }
23075
23069
  else if (i.formatProps.type === "switch") {
23076
23070
  ant_form.push(React__default.createElement(Form.Item, { key: i.tableProps.dataIndex, name: i.tableProps.dataIndex, label: i.tableProps.title, tooltip: i.tooltip, rules: i.rules, hidden: i.formatProps.hidden },
@@ -23208,7 +23202,7 @@ const useFormColumns = ({ isModify, columns, onChange, }) => {
23208
23202
  * @author 송영내
23209
23203
  */
23210
23204
  const UploadImage = (props) => {
23211
- const { onChange, value } = props;
23205
+ const { onChange, value, maxWidth = 500, maxHeight = 500, compressFormat = "PNG", quality = 100, outputType = "blob" } = props;
23212
23206
  // const readfileData = (file: any) => {
23213
23207
  // return new Promise<string>((resolve, reject) => {
23214
23208
  // if (file) {
@@ -23223,17 +23217,17 @@ const UploadImage = (props) => {
23223
23217
  // })
23224
23218
  // }
23225
23219
  const resizeFile = (file) => new Promise((resolve) => {
23226
- Resizer.imageFileResizer(file, 500, 500, "PNG", 100, 0, (uri) => {
23220
+ Resizer.imageFileResizer(file, maxWidth, maxHeight, compressFormat, quality, 0, (uri) => {
23227
23221
  resolve(uri);
23228
- }, "base64");
23222
+ }, outputType);
23229
23223
  });
23230
23224
  return (React__default.createElement(Flex, { style: { padding: 2, alignItems: "center" }, gap: 3 },
23231
23225
  React__default.createElement(Image$1, { src: value ?? baseImage, width: 50, height: 50 }),
23232
- React__default.createElement(ImgCrop, { showGrid: true, modalWidth: 800, zoomSlider: true, quality: 1, modalClassName: "ImgCropModal", modalProps: { style: { height: 1000 } }, cropperProps: {
23233
- cropSize: { width: 500, height: 500 },
23226
+ React__default.createElement(ImgCrop, { showGrid: true, modalWidth: 800, zoomSlider: true, quality: 1, minZoom: 0.1, modalClassName: "ImgCropModal", modalProps: { style: { height: 600 } }, cropperProps: {
23227
+ cropSize: { width: maxWidth, height: maxHeight },
23234
23228
  style: {},
23235
23229
  mediaProps: {},
23236
- zoomSpeed: 1,
23230
+ zoomSpeed: 0.1,
23237
23231
  restrictPosition: false,
23238
23232
  keyboardStep: 1,
23239
23233
  } },