@owp/core 1.5.1 → 1.6.0

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.
@@ -0,0 +1,16 @@
1
+ import { CommonCode } from '@/utils/CommonCodeUtils';
2
+ import { FormControlProps, RadioGroupProps } from '@mui/material';
3
+ export type OwpCommonCodeRadioGroupProps = FormControlProps & RadioGroupProps & {
4
+ codeId: string;
5
+ description?: string;
6
+ useValueKeyDescription?: boolean;
7
+ label?: string;
8
+ helperText?: string;
9
+ filterOptions?: (commonCode: CommonCode) => boolean;
10
+ };
11
+ /**
12
+ * 공통코드 목록을 기반으로 라디오 그룹을 렌더링합니다.
13
+ * @param props 공통코드 라디오 그룹 props
14
+ */
15
+ export declare const OwpCommonCodeRadioGroup: ({ codeId, description, label, fullWidth, defaultValue, useValueKeyDescription, required, error, helperText, filterOptions, ...commonCodeProps }: OwpCommonCodeRadioGroupProps) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const CommonCodeRadioGroup: ({ codeId, description, label, fullWidth, defaultValue, useValueKeyDescription, required, error, helperText, filterOptions, ...commonCodeProps }: OwpCommonCodeRadioGroupProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { CommonCode } from '@/utils/CommonCodeUtils';
2
+ import { SelectProps } from '@mui/material';
3
+ export type OwpCommonCodeSelectorProps = SelectProps<string> & {
4
+ codeId: string;
5
+ description?: string;
6
+ useValueKeyDescription?: boolean;
7
+ disableAllValueItem?: boolean;
8
+ helperText?: string;
9
+ filterOptions?: (commonCode: CommonCode) => boolean;
10
+ };
11
+ /**
12
+ * 공통코드 목록을 기반으로 단일/다중 선택 Select를 제공합니다.
13
+ * @param props 공통코드 선택기 props
14
+ */
15
+ export declare const OwpCommonCodeSelector: (props: OwpCommonCodeSelectorProps) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const CommonCodeSelector: (props: OwpCommonCodeSelectorProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export { OwpCommonCodeSelector, CommonCodeSelector } from './OwpCommonCodeSelector';
2
+ export type { OwpCommonCodeSelectorProps } from './OwpCommonCodeSelector';
3
+ export { OwpCommonCodeRadioGroup, CommonCodeRadioGroup } from './OwpCommonCodeRadioGroup';
4
+ export type { OwpCommonCodeRadioGroupProps } from './OwpCommonCodeRadioGroup';
@@ -1,10 +1,11 @@
1
1
  import { LoadingButtonProps } from '@mui/lab/LoadingButton';
2
- import { ChangeEvent } from 'react';
3
- interface OwpFileUploadButtonProps {
2
+ import { type ChangeEvent, type ReactNode } from 'react';
3
+ export interface OwpFileUploadButtonOwnProps {
4
4
  multiple?: boolean;
5
5
  accept?: string;
6
- title?: string;
6
+ title?: ReactNode;
7
7
  onChange?: (evt: ChangeEvent<HTMLInputElement>) => void;
8
+ onCancel?: (evt: Event) => void;
8
9
  }
9
- export declare function OwpFileUploadButton({ title, multiple, onChange, accept, ...restProps }: OwpFileUploadButtonProps & LoadingButtonProps): import("react/jsx-runtime").JSX.Element;
10
- export {};
10
+ export type OwpFileUploadButtonProps = OwpFileUploadButtonOwnProps & Omit<LoadingButtonProps, 'title'>;
11
+ export declare function OwpFileUploadButton({ title, multiple, onChange, onCancel, accept, ...restProps }: OwpFileUploadButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,13 @@
1
1
  import type { IconButtonProps } from '@mui/material/IconButton';
2
2
  import type { SxProps, Theme } from '@mui/material/styles';
3
3
  import type { ReactNode } from 'react';
4
+ import { exportTreeGridToExcelById } from '../../utils/treeGridUtil';
5
+ import { type OwpFileUploadButtonProps } from '../OwpFileUploadButton/OwpFileUploadButton';
4
6
  export type OwpMoreButtonActionColor = NonNullable<IconButtonProps['color']> | string;
5
- export type OwpMoreButtonAction = {
7
+ type OwpMoreButtonActionBase = {
6
8
  icon?: ReactNode;
7
9
  color?: OwpMoreButtonActionColor;
8
- label: ReactNode;
9
- onClick: (args: {
10
- close: () => void;
11
- }) => void;
10
+ label?: ReactNode;
12
11
  labelProps?: {
13
12
  className?: string;
14
13
  sx?: SxProps<Theme>;
@@ -18,6 +17,24 @@ export type OwpMoreButtonAction = {
18
17
  sx?: SxProps<Theme>;
19
18
  };
20
19
  };
20
+ export type OwpMoreButtonClickAction = OwpMoreButtonActionBase & {
21
+ type?: 'button';
22
+ onClick: (args: {
23
+ close: () => void;
24
+ }) => void;
25
+ };
26
+ export type OwpMoreButtonFileUploadAction = OwpMoreButtonActionBase & {
27
+ type: 'fileUpload';
28
+ fileUploadProps?: Omit<OwpFileUploadButtonProps, 'title' | 'onChange' | 'onCancel'> & {
29
+ onChange?: OwpFileUploadButtonProps['onChange'];
30
+ onCancel?: OwpFileUploadButtonProps['onCancel'];
31
+ };
32
+ };
33
+ export type OwpMoreButtonTreeGridExportExcelAction = OwpMoreButtonActionBase & {
34
+ type: 'treeGridExportExcel';
35
+ exportExcelArgs: Parameters<typeof exportTreeGridToExcelById>;
36
+ };
37
+ export type OwpMoreButtonAction = OwpMoreButtonClickAction | OwpMoreButtonFileUploadAction | OwpMoreButtonTreeGridExportExcelAction;
21
38
  export type OwpMoreActionsButtonProps = {
22
39
  actions: OwpMoreButtonAction[];
23
40
  open?: boolean;
@@ -29,3 +46,4 @@ export type OwpMoreActionsButtonProps = {
29
46
  actionsSx?: SxProps<Theme>;
30
47
  };
31
48
  export declare const OwpMoreActionsButton: ({ actions, open: openProp, defaultOpen, onOpenChange, disabled, className, containerSx, actionsSx, }: OwpMoreActionsButtonProps) => import("react/jsx-runtime").JSX.Element;
49
+ export {};
@@ -382,10 +382,17 @@ export declare const defaultThemeOptions: {
382
382
  fontSize: string;
383
383
  transform: string;
384
384
  '&.Mui-focused': {};
385
- '&.MuiInputLabel-shrink': {
386
- backgroundColor: string;
387
- padding: string;
385
+ '&.MuiInputLabel-outlined.MuiInputLabel-shrink': {
388
386
  lineHeight: number;
387
+ zIndex: number;
388
+ '&::before': {
389
+ content: string;
390
+ position: string;
391
+ inset: string;
392
+ backgroundColor: string;
393
+ borderRadius: number;
394
+ zIndex: number;
395
+ };
389
396
  };
390
397
  };
391
398
  };
@@ -502,9 +509,13 @@ export declare const defaultThemeOptions: {
502
509
  MuiFormControl: {
503
510
  styleOverrides: {
504
511
  root: {
505
- '& .MuiInputLabel-shrink + .MuiInputBase-root .MuiOutlinedInput-notchedOutline legend': {
512
+ '& .MuiInputLabel-outlined.MuiInputLabel-shrink:not(:empty) + .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline legend': {
513
+ fontSize: string;
506
514
  maxWidth: string;
507
- padding: string;
515
+ };
516
+ '& .MuiInputLabel-outlined.MuiInputLabel-shrink:not(:empty) + .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline legend > span:not(.notranslate)': {
517
+ paddingLeft: string;
518
+ paddingRight: string;
508
519
  };
509
520
  };
510
521
  };
@@ -22,6 +22,7 @@ export * from './utils/barcodeUtil';
22
22
  export * from './utils/CommonCodeUtils';
23
23
  export * from './utils/ErrorBoundary';
24
24
  export * from './utils/excelUtil';
25
+ export * from './utils/getFormDefaultValues';
25
26
  export * from './utils/OwpUtils';
26
27
  export * from './utils/qrCodeUtil';
27
28
  export * from './utils/treeGridExportExcelUtil';
@@ -35,6 +36,7 @@ export * from './components/OwpBarcodeInput/OwpBarcodeInputField';
35
36
  export * from './components/OwpButtonDelete';
36
37
  export * from './components/OwpButtonSave';
37
38
  export * from './components/OwpCommonDialog';
39
+ export * from './components/OwpCommonCode';
38
40
  export * from './components/OwpDialog';
39
41
  export * from './components/OwpExportExcelButton/OwpExportExcelButton';
40
42
  export * from './components/OwpFileUploadButton/OwpFileUploadButton';
@@ -11,7 +11,17 @@ export interface CommonCode {
11
11
  export interface CommonCodeRes {
12
12
  resultData?: Array<CommonCode>;
13
13
  }
14
- export declare const transformGridEnumByCommonCodeList: (commonCodeListData?: Array<CommonCode> | undefined, fieldKey?: string) => {
15
- [x: string]: string;
16
- };
14
+ type TreeGridEnumAttributeMap = Record<string, string>;
15
+ /**
16
+ * 공통코드 목록을 TreeGrid Enum 속성 객체로 변환합니다.
17
+ * @param commonCodeListData 공통코드 목록
18
+ * @param fieldKey TreeGrid 컬럼 필드 키
19
+ */
20
+ export declare const transformGridEnumByCommonCodeList: (commonCodeListData?: Array<CommonCode> | undefined, fieldKey?: string) => TreeGridEnumAttributeMap;
21
+ /**
22
+ * 공통코드 목록을 그룹 ID 기준으로 묶습니다.
23
+ * @param commonCodeList 공통코드 목록
24
+ */
17
25
  export declare const transformCommonCodeBasedOnGroupId: (commonCodeList: Array<CommonCode>) => Record<string, CommonCode[]>;
26
+ export declare const buildTreeGridEnumAttributesByCommonCodeList: (commonCodeListData?: Array<CommonCode> | undefined, fieldKey?: string) => TreeGridEnumAttributeMap;
27
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 초기값 객체에서 폼 기본값 키와 일치하는 값만 추려 병합합니다.
3
+ * @param defaultValues 폼 기본값
4
+ * @param initialValues 서버/외부에서 전달된 초기값
5
+ */
6
+ export declare const getFormDefaultValues: <T extends Record<string, unknown>>(defaultValues: T, initialValues?: object) => T;
@@ -1,36 +1,127 @@
1
+ type TreeGridInsertPosition = 'above' | 'below' | 'top' | 'last';
2
+ type TreeGridAddRowOptions<T> = {
3
+ canSelect?: boolean;
4
+ insertPosition?: TreeGridInsertPosition;
5
+ parent?: TRow & T;
6
+ anchorRow?: TRow & T;
7
+ initialValues?: T;
8
+ };
9
+ type TreeGridColumnVisibilityOptions = {
10
+ targetKey: string;
11
+ canVisible: boolean;
12
+ };
13
+ type TreeGridHighlightTargetOption = {
14
+ row: TRow;
15
+ col: string;
16
+ };
1
17
  export declare const TREEGRID_WARNING_CELL_COLOR = "#f44336";
2
18
  export declare const TREEGRID_INPUT_CELL_COLOR = "#ffd6a8";
3
19
  export declare const TREEGRID_CELL_HIGHLIGHT_CLASS = "text-white text-xl font-semibold";
4
20
  export declare const TREEGRID_CELL_HIGHLIGHT_COLOR = "#ff8904";
21
+ /**
22
+ * TreeGrid 인스턴스를 ID로 조회합니다.
23
+ * @param gridId TreeGrid 인스턴스 ID
24
+ */
5
25
  export declare const getGridById: (gridId: string) => TTGrid;
6
- export declare const getDataRowsById: <T>(gridId: string) => any[] | T;
7
- export declare const reloadBodyById: (gridId: string, rows: any) => void;
26
+ /**
27
+ * TreeGrid의 데이터 목록을 조회합니다.
28
+ * @param gridId TreeGrid 인스턴스 ID
29
+ */
30
+ export declare const getDataRowsById: <T>(gridId: string) => T;
31
+ /**
32
+ * TreeGrid Body 데이터를 교체한 뒤 다시 로드합니다.
33
+ * @param gridId TreeGrid 인스턴스 ID
34
+ * @param rows 새로 반영할 행 데이터
35
+ */
36
+ export declare const reloadBodyById: (gridId: string, rows: unknown) => void;
8
37
  /**
9
38
  * 행을 특정 위치에 추가
10
39
  * @param gridId TreeGrid 인스턴스 ID
11
- * @param options.canSelect 행 삽입 위치
12
- * @param options.parent
13
- * @param options.anchorRow above/below용 기준 row
40
+ * @param options.canSelect 행 선택 가능 여부
41
+ * @param options.parent 부모 행
42
+ * @param options.anchorRow above/below용 기준
14
43
  * @param options.insertPosition 행 삽입 위치
15
44
  * @param options.initialValues 신규 행 초기값
16
45
  */
17
- export declare const addRowById: <T>(gridId: string, options?: {
18
- canSelect?: boolean;
19
- insertPosition?: "above" | "below" | "top" | "last";
20
- parent?: TRow & T;
21
- anchorRow?: TRow & T;
22
- initialValues?: T;
23
- }) => void;
46
+ export declare const addRowById: <T>(gridId: string, options?: TreeGridAddRowOptions<T>) => void;
47
+ /**
48
+ * TreeGrid의 추가/수정된 데이터 행을 조회합니다.
49
+ * @param gridId TreeGrid 인스턴스 ID
50
+ */
24
51
  export declare const getChangedDataRowsById: <T>(gridId: string) => {
25
- [k: string]: Partial<{}>[];
52
+ added: T[];
53
+ changed: T[];
26
54
  };
55
+ /**
56
+ * TreeGrid 데이터를 엑셀로 내보냅니다.
57
+ * @param gridId TreeGrid 인스턴스 ID
58
+ * @param title 다운로드 파일명
59
+ */
27
60
  export declare const exportExcelById: (gridId: string, title?: string) => void;
61
+ /**
62
+ * TreeGrid에서 현재 선택된 행 목록을 조회합니다.
63
+ * @param gridId TreeGrid 인스턴스 ID
64
+ */
28
65
  export declare const getSelectedRowsById: <T>(gridId: string) => any[] | T;
29
- export declare const changeVisibleCellByGridId: (gridId: string, options: {
30
- targetKey: string;
31
- canVisible: boolean;
32
- }) => void;
33
- export declare const setHighlightTargetCellByGridId: (gridId: string, targetOption: {
34
- row: TRow;
35
- col: string;
36
- }) => void;
66
+ /**
67
+ * TreeGrid 컬럼의 표시 여부를 변경합니다.
68
+ * @param gridId TreeGrid 인스턴스 ID
69
+ * @param options.targetKey 표시 상태를 변경할 컬럼 키
70
+ * @param options.canVisible 컬럼 표시 여부
71
+ */
72
+ export declare const changeVisibleCellByGridId: (gridId: string, options: TreeGridColumnVisibilityOptions) => void;
73
+ /**
74
+ * 특정 셀에 강조 스타일을 적용합니다.
75
+ * @param gridId TreeGrid 인스턴스 ID
76
+ * @param targetOption.row 강조할 대상 행
77
+ * @param targetOption.col 강조할 대상 컬럼
78
+ */
79
+ export declare const setHighlightTargetCellByGridId: (gridId: string, targetOption: TreeGridHighlightTargetOption) => void;
80
+ /**
81
+ * TreeGrid의 현재 선택 상태를 모두 해제합니다.
82
+ * @param gridId TreeGrid 인스턴스 ID
83
+ */
84
+ export declare const resetGridSelection: (gridId: string) => void;
85
+ /**
86
+ * 여러 TreeGrid의 선택 상태를 모두 해제합니다.
87
+ * @param gridIds TreeGrid 인스턴스 ID 목록
88
+ */
89
+ export declare const resetGridsSelection: (gridIds: string[]) => void;
90
+ /**
91
+ * TreeGrid의 변경 사항과 선택 상태를 모두 초기화합니다.
92
+ * @param gridId TreeGrid 인스턴스 ID
93
+ */
94
+ export declare const resetGridChanges: (gridId: string) => void;
95
+ /**
96
+ * 여러 TreeGrid의 변경 사항과 선택 상태를 모두 초기화합니다.
97
+ * @param gridIds TreeGrid 인스턴스 ID 목록
98
+ */
99
+ export declare const resetGridsChanges: (gridIds: string[]) => void;
100
+ /**
101
+ * TreeGrid 컬럼을 Enum 타입으로 설정하고 옵션 목록을 반영합니다.
102
+ * @param gridId TreeGrid 인스턴스 ID
103
+ * @param columnName Enum을 적용할 컬럼명
104
+ * @param options Enum 옵션 목록
105
+ * @param valueKey Enum 값으로 사용할 필드명
106
+ * @param labelKeys Enum 라벨로 사용할 필드 우선순위 목록
107
+ */
108
+ export declare const setGridEnum: <T extends object>(gridId: string, columnName: string, options: T[] | undefined, valueKey: keyof T & string, labelKeys: Array<keyof T & string>) => void;
109
+ /** 권장 네이밍 별칭 */
110
+ export declare const getTreeGridById: (gridId: string) => TTGrid;
111
+ export declare const getTreeGridDataRowsById: <T>(gridId: string) => T;
112
+ export declare const reloadTreeGridBodyById: (gridId: string, rows: unknown) => void;
113
+ export declare const addTreeGridRowById: <T>(gridId: string, options?: TreeGridAddRowOptions<T>) => void;
114
+ export declare const getTreeGridRowChangesById: <T>(gridId: string) => {
115
+ added: T[];
116
+ changed: T[];
117
+ };
118
+ export declare const exportTreeGridToExcelById: (gridId: string, title?: string) => void;
119
+ export declare const getTreeGridSelectedRowsById: <T>(gridId: string) => any[] | T;
120
+ export declare const setTreeGridColumnVisibilityById: (gridId: string, options: TreeGridColumnVisibilityOptions) => void;
121
+ export declare const highlightTreeGridCellById: (gridId: string, targetOption: TreeGridHighlightTargetOption) => void;
122
+ export declare const resetTreeGridSelectionById: (gridId: string) => void;
123
+ export declare const resetTreeGridSelectionsByIds: (gridIds: string[]) => void;
124
+ export declare const resetTreeGridChangesById: (gridId: string) => void;
125
+ export declare const resetTreeGridChangesByIds: (gridIds: string[]) => void;
126
+ export declare const setTreeGridColumnEnumOptionsById: <T extends object>(gridId: string, columnName: string, options: T[] | undefined, valueKey: keyof T & string, labelKeys: Array<keyof T & string>) => void;
127
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@owp/core",
3
3
  "private": false,
4
- "version": "1.5.1",
4
+ "version": "1.6.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",