@ceed/ads 0.0.167-1 → 0.0.168-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.
@@ -1,173 +1,5 @@
1
- import React, { ComponentProps, ReactNode } from "react";
2
- import { Link } from "@mui/joy";
3
- import { Table } from "../Table";
4
- import CurrencyInput from "../CurrencyInput";
5
- import DatePicker from "../DatePicker";
6
- import Input from "../Input";
7
- import Textarea from "../Textarea";
8
- import Autocomplete from "../Autocomplete";
9
- import Select from "../Select";
10
- export type RenderCellHandler<T extends Record<string, V>, V = unknown> = (params: {
11
- row: T;
12
- value?: V;
13
- id: string;
14
- }) => ReactNode;
15
- export type CellEditStartEvent<T extends Record<string, V>, V = unknown> = (params: {
16
- originalRow: T;
17
- row: T;
18
- value?: V;
19
- id: string;
20
- }) => void;
21
- export type CellEditStopEvent<T extends Record<string, V>, V = unknown> = (params: {
22
- originalRow: T;
23
- row: T;
24
- value?: V;
25
- id: string;
26
- }) => void;
27
- type BaseColumnDef<T extends Record<string, V>, V> = {
28
- field: keyof T;
29
- headerName?: string;
30
- width?: string;
31
- minWidth?: string;
32
- maxWidth?: string;
33
- resizable?: boolean;
34
- renderCell?: RenderCellHandler<T, V>;
35
- isCellEditable?: ((params: {
36
- row: T;
37
- value?: V;
38
- id: string;
39
- }) => boolean) | boolean;
40
- required?: boolean;
41
- onCellEditStart?: CellEditStartEvent<T, V>;
42
- onCellEditStop?: CellEditStopEvent<T, V>;
43
- };
44
- type AutocompleteColumnDef<T extends Record<string, string>> = BaseColumnDef<T, string> & {
45
- type: "autocomplete";
46
- componentProps?: ComponentProps<typeof Autocomplete> | ((params: {
47
- row: T;
48
- value?: string;
49
- id: string;
50
- }) => ComponentProps<typeof Autocomplete>);
51
- };
52
- type CurrencyColumnDef<T extends Record<string, number>> = BaseColumnDef<T, number> & {
53
- type: "currency";
54
- componentProps?: ComponentProps<typeof CurrencyInput> | ((params: {
55
- row: T;
56
- value?: number;
57
- id: string;
58
- }) => ComponentProps<typeof CurrencyInput>);
59
- };
60
- type DateColumnDef<T extends Record<string, string>> = BaseColumnDef<T, string> & {
61
- type: "date";
62
- componentProps?: ComponentProps<typeof DatePicker> | ((params: {
63
- row: T;
64
- value?: string;
65
- id: string;
66
- }) => ComponentProps<typeof DatePicker>);
67
- };
68
- type NumberColumnDef<T extends Record<string, number>> = BaseColumnDef<T, number> & {
69
- type: "number";
70
- componentProps?: ComponentProps<typeof Input> | ((params: {
71
- row: T;
72
- value?: number;
73
- id: string;
74
- }) => ComponentProps<typeof Input>);
75
- };
76
- type TextColumnDef<T extends Record<string, string>> = BaseColumnDef<T, string> & {
77
- type: "text";
78
- componentProps?: ComponentProps<typeof Input> | ((params: {
79
- row: T;
80
- value?: string;
81
- id: string;
82
- }) => ComponentProps<typeof Input>);
83
- };
84
- type LongTextColumnDef<T extends Record<string, string>> = BaseColumnDef<T, string> & {
85
- type: "longText";
86
- componentProps?: ComponentProps<typeof Textarea> | ((params: {
87
- row: T;
88
- value?: string;
89
- id: string;
90
- }) => ComponentProps<typeof Textarea>);
91
- };
92
- type SelectColumnDef<T extends Record<string, string>> = BaseColumnDef<T, string> & {
93
- type: "select";
94
- componentProps?: ComponentProps<typeof Select<string, false>> | ((params: {
95
- row: T;
96
- value?: string;
97
- id: string;
98
- }) => ComponentProps<typeof Select<string, false>>);
99
- };
100
- type LinkColumnDef<T extends Record<string, string>, C extends React.ElementType = typeof Link> = BaseColumnDef<T, string> & {
101
- type: "link";
102
- component?: C;
103
- componentProps?: ComponentProps<C> | ((params: {
104
- row: T;
105
- value?: string;
106
- id: string;
107
- }) => ComponentProps<C>);
108
- };
109
- type OtherColumnDef<T extends Record<string, any>> = BaseColumnDef<T, any> & {
110
- type?: "any";
111
- componentProps?: {};
112
- };
113
- export type ColumnDef<T extends Record<string, any>> = AutocompleteColumnDef<T> | CurrencyColumnDef<T> | DateColumnDef<T> | NumberColumnDef<T> | TextColumnDef<T> | LongTextColumnDef<T> | LinkColumnDef<T> | SelectColumnDef<T> | OtherColumnDef<T>;
114
- export type DataTableProps<T extends Record<string, unknown>> = {
115
- rows: T[];
116
- checkboxSelection?: boolean;
117
- columns: ColumnDef<T>[];
118
- editMode?: boolean;
119
- /**
120
- * 체크박스가 있는 경우, 체크박스를 클릭했을 때 선택된 row의 index를 지정한다.
121
- */
122
- selectionModel?: string[];
123
- onSelectionModelChange?: (newSelectionModel: string[],
124
- /**
125
- * Total Select를 클릭한 경우에만 값이 true/false로 들어온다.
126
- * MUI에는 없는 인터페이스지만 Total Select 기능이 추가되었기 때문에 추가해야했다.
127
- */
128
- isTotalSelected?: boolean) => void;
129
- pagination?: boolean;
130
- paginationMode?: "client" | "server";
131
- paginationModel?: {
132
- page: number;
133
- pageSize: number;
134
- };
135
- onPaginationModelChange?: (model: {
136
- page: number;
137
- pageSize: number;
138
- }) => void;
139
- /**
140
- * Rows의 총 갯수를 직접 지정 할 수 있다.
141
- * 기본적으로는 rows.length를 사용하지만, 이 값을 지정하면 rows.length를 사용하지 않는다.
142
- * server mode를 사용할 때 유용하다.
143
- */
144
- rowCount?: number;
145
- loading?: boolean;
146
- getId?: (row: T) => string;
147
- /**
148
- * 기본적으로 Uncontrolled로 작동하지만, Controlled로 작동하게 하고 싶을 때 사용한다.
149
- * 이 값이 true이면, 현재 페이지 이외에도 존재하는 모든 데이터가 선택된것으로 간주하고 동작한다.
150
- */
151
- isTotalSelected?: boolean;
152
- slots?: {
153
- checkbox?: React.ElementType;
154
- toolbar?: React.ElementType;
155
- footer?: React.ElementType;
156
- loadingOverlay?: React.ElementType;
157
- };
158
- slotProps?: {
159
- checkbox?: Partial<{
160
- checked: boolean;
161
- [key: string]: any;
162
- }>;
163
- toolbar?: Partial<{
164
- [key: string]: any;
165
- }>;
166
- background?: Partial<{
167
- [key: string]: any;
168
- }>;
169
- };
170
- } & ComponentProps<typeof Table>;
1
+ import React from "react";
2
+ import { DataTableProps } from "./type";
171
3
  declare function DataTable<T extends Record<string, unknown>>(props: DataTableProps<T>): React.JSX.Element;
172
4
  declare namespace DataTable {
173
5
  var displayName: string;
@@ -0,0 +1,170 @@
1
+ import { ReactNode, ComponentProps } from 'react';
2
+ import { Link } from '@mui/joy';
3
+ import { Table } from "../Table";
4
+ import CurrencyInput from "../CurrencyInput";
5
+ import DatePicker from "../DatePicker";
6
+ import Input from "../Input";
7
+ import Textarea from "../Textarea";
8
+ import Autocomplete from "../Autocomplete";
9
+ import Select from "../Select";
10
+ export type RenderCellHandler<T extends Record<string, V>, V = unknown> = (params: {
11
+ row: T;
12
+ value?: V;
13
+ id: string;
14
+ }) => ReactNode;
15
+ export type CellEditStartEvent<T extends Record<string, V>, V = unknown> = (params: {
16
+ originalRow: T;
17
+ row: T;
18
+ value?: V;
19
+ id: string;
20
+ }) => void;
21
+ export type CellEditStopEvent<T extends Record<string, V>, V = unknown> = (params: {
22
+ originalRow: T;
23
+ row: T;
24
+ value?: V;
25
+ id: string;
26
+ }) => void;
27
+ export type BaseColumnDef<T extends Record<string, V>, V> = {
28
+ field: keyof T;
29
+ headerName?: string;
30
+ width?: string;
31
+ minWidth?: string;
32
+ maxWidth?: string;
33
+ resizable?: boolean;
34
+ renderCell?: RenderCellHandler<T, V>;
35
+ isCellEditable?: ((params: {
36
+ row: T;
37
+ value?: V;
38
+ id: string;
39
+ }) => boolean) | boolean;
40
+ required?: boolean;
41
+ onCellEditStart?: CellEditStartEvent<T, V>;
42
+ onCellEditStop?: CellEditStopEvent<T, V>;
43
+ };
44
+ export type AutocompleteColumnDef<T extends Record<string, string>> = BaseColumnDef<T, string> & {
45
+ type: "autocomplete";
46
+ componentProps?: ComponentProps<typeof Autocomplete> | ((params: {
47
+ row: T;
48
+ value?: string;
49
+ id: string;
50
+ }) => ComponentProps<typeof Autocomplete>);
51
+ };
52
+ export type CurrencyColumnDef<T extends Record<string, number>> = BaseColumnDef<T, number> & {
53
+ type: "currency";
54
+ componentProps?: ComponentProps<typeof CurrencyInput> | ((params: {
55
+ row: T;
56
+ value?: number;
57
+ id: string;
58
+ }) => ComponentProps<typeof CurrencyInput>);
59
+ };
60
+ export type DateColumnDef<T extends Record<string, string>> = BaseColumnDef<T, string> & {
61
+ type: "date";
62
+ componentProps?: ComponentProps<typeof DatePicker> | ((params: {
63
+ row: T;
64
+ value?: string;
65
+ id: string;
66
+ }) => ComponentProps<typeof DatePicker>);
67
+ };
68
+ export type NumberColumnDef<T extends Record<string, number>> = BaseColumnDef<T, number> & {
69
+ type: "number";
70
+ componentProps?: ComponentProps<typeof Input> | ((params: {
71
+ row: T;
72
+ value?: number;
73
+ id: string;
74
+ }) => ComponentProps<typeof Input>);
75
+ };
76
+ export type TextColumnDef<T extends Record<string, string>> = BaseColumnDef<T, string> & {
77
+ type: "text";
78
+ componentProps?: ComponentProps<typeof Input> | ((params: {
79
+ row: T;
80
+ value?: string;
81
+ id: string;
82
+ }) => ComponentProps<typeof Input>);
83
+ };
84
+ export type LongTextColumnDef<T extends Record<string, string>> = BaseColumnDef<T, string> & {
85
+ type: "longText";
86
+ componentProps?: ComponentProps<typeof Textarea> | ((params: {
87
+ row: T;
88
+ value?: string;
89
+ id: string;
90
+ }) => ComponentProps<typeof Textarea>);
91
+ };
92
+ export type SelectColumnDef<T extends Record<string, string>> = BaseColumnDef<T, string> & {
93
+ type: "select";
94
+ componentProps?: ComponentProps<typeof Select<string, false>> | ((params: {
95
+ row: T;
96
+ value?: string;
97
+ id: string;
98
+ }) => ComponentProps<typeof Select<string, false>>);
99
+ };
100
+ export type LinkColumnDef<T extends Record<string, string>, C extends React.ElementType = typeof Link> = BaseColumnDef<T, string> & {
101
+ type: "link";
102
+ component?: C;
103
+ componentProps?: ComponentProps<C> | ((params: {
104
+ row: T;
105
+ value?: string;
106
+ id: string;
107
+ }) => ComponentProps<C>);
108
+ };
109
+ export type OtherColumnDef<T extends Record<string, any>> = BaseColumnDef<T, any> & {
110
+ type?: "any";
111
+ componentProps?: {};
112
+ };
113
+ export type ColumnDef<T extends Record<string, any>> = AutocompleteColumnDef<T> | CurrencyColumnDef<T> | DateColumnDef<T> | NumberColumnDef<T> | TextColumnDef<T> | LongTextColumnDef<T> | LinkColumnDef<T> | SelectColumnDef<T> | OtherColumnDef<T>;
114
+ export type DataTableProps<T extends Record<string, unknown>> = {
115
+ rows: T[];
116
+ checkboxSelection?: boolean;
117
+ columns: ColumnDef<T>[];
118
+ editMode?: boolean;
119
+ /**
120
+ * 체크박스가 있는 경우, 체크박스를 클릭했을 때 선택된 row의 index를 지정한다.
121
+ */
122
+ selectionModel?: string[];
123
+ onSelectionModelChange?: (newSelectionModel: string[],
124
+ /**
125
+ * Total Select를 클릭한 경우에만 값이 true/false로 들어온다.
126
+ * MUI에는 없는 인터페이스지만 Total Select 기능이 추가되었기 때문에 추가해야했다.
127
+ */
128
+ isTotalSelected?: boolean) => void;
129
+ pagination?: boolean;
130
+ paginationMode?: "client" | "server";
131
+ paginationModel?: {
132
+ page: number;
133
+ pageSize: number;
134
+ };
135
+ onPaginationModelChange?: (model: {
136
+ page: number;
137
+ pageSize: number;
138
+ }) => void;
139
+ /**
140
+ * Rows의 총 갯수를 직접 지정 할 수 있다.
141
+ * 기본적으로는 rows.length를 사용하지만, 이 값을 지정하면 rows.length를 사용하지 않는다.
142
+ * server mode를 사용할 때 유용하다.
143
+ */
144
+ rowCount?: number;
145
+ loading?: boolean;
146
+ getId?: (row: T) => string;
147
+ /**
148
+ * 기본적으로 Uncontrolled로 작동하지만, Controlled로 작동하게 하고 싶을 때 사용한다.
149
+ * 이 값이 true이면, 현재 페이지 이외에도 존재하는 모든 데이터가 선택된것으로 간주하고 동작한다.
150
+ */
151
+ isTotalSelected?: boolean;
152
+ slots?: {
153
+ checkbox?: React.ElementType;
154
+ toolbar?: React.ElementType;
155
+ footer?: React.ElementType;
156
+ loadingOverlay?: React.ElementType;
157
+ };
158
+ slotProps?: {
159
+ checkbox?: Partial<{
160
+ checked: boolean;
161
+ [key: string]: any;
162
+ }>;
163
+ toolbar?: Partial<{
164
+ [key: string]: any;
165
+ }>;
166
+ background?: Partial<{
167
+ [key: string]: any;
168
+ }>;
169
+ };
170
+ } & ComponentProps<typeof Table>;