@withwiz/toolkit 0.2.0 → 0.2.2

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.
Files changed (95) hide show
  1. package/dist/auth/index.js +19 -19
  2. package/dist/chunk-7IY3RQQL.js +151 -0
  3. package/dist/chunk-GSUQE3SZ.js +225 -0
  4. package/dist/chunk-IPXPCBDO.js +127 -0
  5. package/dist/chunk-LJEGM4OO.js +136 -0
  6. package/dist/chunk-MAATEX2R.js +81 -0
  7. package/dist/chunk-NY5QXT33.js +31 -0
  8. package/dist/chunk-TH45RVP7.js +110 -0
  9. package/dist/components/ui/DataTable.d.ts +8 -103
  10. package/dist/components/ui/DataTable.js +17 -602
  11. package/dist/components/ui/data-table/DataTable.d.ts +2 -0
  12. package/dist/components/ui/data-table/DataTable.js +22 -0
  13. package/dist/components/ui/data-table/DataTableBody.d.ts +19 -0
  14. package/dist/components/ui/data-table/DataTableBody.js +10 -0
  15. package/dist/components/ui/data-table/DataTableBulkActions.d.ts +17 -0
  16. package/dist/components/ui/data-table/DataTableBulkActions.js +12 -0
  17. package/dist/components/ui/data-table/DataTableFilters.d.ts +15 -0
  18. package/dist/components/ui/data-table/DataTableFilters.js +13 -0
  19. package/dist/components/ui/data-table/DataTablePagination.d.ts +10 -0
  20. package/dist/components/ui/data-table/DataTablePagination.js +11 -0
  21. package/dist/components/ui/data-table/DataTableSearch.d.ts +24 -0
  22. package/dist/components/ui/data-table/DataTableSearch.js +12 -0
  23. package/dist/components/ui/data-table/index.d.ts +13 -0
  24. package/dist/components/ui/data-table/types.d.ts +115 -0
  25. package/dist/error/index.d.ts +0 -4
  26. package/dist/error/index.js +1 -69
  27. package/dist/geolocation/index.js +4 -4
  28. package/dist/geolocation/providers/index.js +4 -4
  29. package/dist/hooks/useDataTable.d.ts +45 -0
  30. package/dist/hooks/useDataTable.js +13 -11
  31. package/dist/utils/format-number.js +30 -4
  32. package/dist/utils/short-code-generator.js +36 -4
  33. package/dist/utils/url-normalizer.js +194 -10
  34. package/package.json +3 -2
  35. package/dist/chunk-5ATB5D6S.js +0 -40
  36. package/dist/chunk-6C7HQIX4.js +0 -13
  37. package/dist/chunk-7VJNLGAS.js +0 -110
  38. package/dist/chunk-7XFHGAJP.js +0 -0
  39. package/dist/chunk-A6EAAWMK.js +0 -50
  40. package/dist/chunk-COK4ZXNG.js +0 -0
  41. package/dist/chunk-EQYTE7WD.js +0 -139
  42. package/dist/chunk-FW3IEJ7H.js +0 -71
  43. package/dist/chunk-HGC4CCKB.js +0 -29
  44. package/dist/chunk-IAJNC34M.js +0 -102
  45. package/dist/chunk-JS5VI3OW.js +0 -143
  46. package/dist/chunk-MYLGYX4K.js +0 -57
  47. package/dist/chunk-TDZJ6SAI.js +0 -34
  48. package/dist/chunk-TEIYA7U4.js +0 -72
  49. package/dist/chunk-ULF5RDDX.js +0 -0
  50. package/dist/chunk-VWODEQ5C.js +0 -204
  51. package/dist/chunk-Y2TUZFCP.js +0 -0
  52. package/dist/chunk-YJ3TLEW3.js +0 -100
  53. package/dist/chunk-ZHVUK5OY.js +0 -314
  54. package/dist/chunk-ZZIKRBJU.js +0 -96
  55. package/dist/error/components/EmptyState.d.ts +0 -50
  56. package/dist/error/components/ErrorAlert.d.ts +0 -50
  57. package/dist/error/components/ErrorPage.d.ts +0 -39
  58. package/dist/error/components/LoadingState.d.ts +0 -37
  59. package/dist/error/components/index.d.ts +0 -13
  60. package/dist/error/components/index.js +0 -18
  61. package/dist/error/hooks/index.d.ts +0 -7
  62. package/dist/error/hooks/index.js +0 -14
  63. package/dist/error/hooks/useErrorHandler.d.ts +0 -67
  64. package/dist/error/hooks/useErrorHandler.js +0 -14
  65. package/dist/error/logging/error-logger.d.ts +0 -77
  66. package/dist/error/logging/error-logger.js +0 -10
  67. package/dist/error/logging/index.d.ts +0 -9
  68. package/dist/error/logging/index.js +0 -35
  69. package/dist/error/logging/transports/base.d.ts +0 -30
  70. package/dist/error/logging/transports/base.js +0 -7
  71. package/dist/error/logging/transports/console.d.ts +0 -40
  72. package/dist/error/logging/transports/console.js +0 -9
  73. package/dist/error/logging/transports/file.d.ts +0 -49
  74. package/dist/error/logging/transports/file.js +0 -8
  75. package/dist/error/logging/transports/index.d.ts +0 -12
  76. package/dist/error/logging/transports/index.js +0 -25
  77. package/dist/error/logging/transports/sentry.d.ts +0 -44
  78. package/dist/error/logging/transports/sentry.js +0 -9
  79. package/dist/error/logging/transports/slack.d.ts +0 -51
  80. package/dist/error/logging/transports/slack.js +0 -9
  81. package/dist/error/logging/types.d.ts +0 -83
  82. package/dist/error/logging/types.js +0 -7
  83. package/dist/error/recovery/circuit-breaker.d.ts +0 -85
  84. package/dist/error/recovery/circuit-breaker.js +0 -9
  85. package/dist/error/recovery/degradation.d.ts +0 -56
  86. package/dist/error/recovery/degradation.js +0 -7
  87. package/dist/error/recovery/fallback.d.ts +0 -55
  88. package/dist/error/recovery/fallback.js +0 -11
  89. package/dist/error/recovery/index.d.ts +0 -12
  90. package/dist/error/recovery/index.js +0 -26
  91. package/dist/error/recovery/retry.d.ts +0 -44
  92. package/dist/error/recovery/retry.js +0 -7
  93. package/dist/utils/shared-utils.d.ts +0 -25
  94. package/dist/utils/shared-utils.js +0 -43
  95. package/dist/{chunk-S73334QY.js → chunk-QF6FH4GZ.js} +3 -3
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import {
3
+ DataTableBody
4
+ } from "../../../chunk-7IY3RQQL.js";
5
+ import "../../../chunk-34WAGUT5.js";
6
+ import "../../../chunk-62FLBG6B.js";
7
+ import "../../../chunk-ORMEWXMH.js";
8
+ export {
9
+ DataTableBody
10
+ };
@@ -0,0 +1,17 @@
1
+ import type { BulkAction } from "./types";
2
+ export interface DataTableBulkActionsProps {
3
+ bulkActions: BulkAction[];
4
+ localSelectedIds: string[];
5
+ dataLength: number;
6
+ bulkActionLoading: string | null;
7
+ onSelectAll: (checked: boolean) => void;
8
+ onBulkAction: (action: BulkAction) => void;
9
+ labels: {
10
+ selectAll: string;
11
+ selectAllShort: string;
12
+ selected: string;
13
+ processing: string;
14
+ processingItems: string;
15
+ };
16
+ }
17
+ export declare function DataTableBulkActions({ bulkActions, localSelectedIds, dataLength, bulkActionLoading, onSelectAll, onBulkAction, labels, }: DataTableBulkActionsProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import {
3
+ DataTableBulkActions
4
+ } from "../../../chunk-MAATEX2R.js";
5
+ import "../../../chunk-NY5QXT33.js";
6
+ import "../../../chunk-34WAGUT5.js";
7
+ import "../../../chunk-L25BNU3E.js";
8
+ import "../../../chunk-62FLBG6B.js";
9
+ import "../../../chunk-ORMEWXMH.js";
10
+ export {
11
+ DataTableBulkActions
12
+ };
@@ -0,0 +1,15 @@
1
+ import type { FilterConfig } from "./types";
2
+ export interface DataTableFiltersProps {
3
+ filters: FilterConfig[];
4
+ filterValues: Record<string, any>;
5
+ onFilterChange?: (key: string, value: any) => void;
6
+ onClearFilters?: () => void;
7
+ hasActiveFilters: boolean;
8
+ labels: {
9
+ all: string;
10
+ min: string;
11
+ max: string;
12
+ clearFilters: string;
13
+ };
14
+ }
15
+ export declare function DataTableFilters({ filters, filterValues, onFilterChange, onClearFilters, hasActiveFilters, labels, }: DataTableFiltersProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import {
3
+ DataTableFilters
4
+ } from "../../../chunk-LJEGM4OO.js";
5
+ import "../../../chunk-IJEZ7G7S.js";
6
+ import "../../../chunk-WDUFQFDP.js";
7
+ import "../../../chunk-L25BNU3E.js";
8
+ import "../../../chunk-RJUVBBZG.js";
9
+ import "../../../chunk-62FLBG6B.js";
10
+ import "../../../chunk-ORMEWXMH.js";
11
+ export {
12
+ DataTableFilters
13
+ };
@@ -0,0 +1,10 @@
1
+ import type { PaginationConfig } from "./types";
2
+ export interface DataTablePaginationProps {
3
+ pagination: PaginationConfig;
4
+ labels: {
5
+ showing: string;
6
+ previous: string;
7
+ next: string;
8
+ };
9
+ }
10
+ export declare function DataTablePagination({ pagination, labels, }: DataTablePaginationProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import {
3
+ DataTablePagination
4
+ } from "../../../chunk-IPXPCBDO.js";
5
+ import "../../../chunk-NY5QXT33.js";
6
+ import "../../../chunk-YJWLWUFK.js";
7
+ import "../../../chunk-62FLBG6B.js";
8
+ import "../../../chunk-ORMEWXMH.js";
9
+ export {
10
+ DataTablePagination
11
+ };
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from "react";
2
+ import type { PaginationConfig, FilterConfig } from "./types";
3
+ export interface DataTableSearchProps {
4
+ onSearch?: (search: string) => void;
5
+ onSearchValueChange?: (searchValue: string) => void;
6
+ searchValue: string;
7
+ searchPlaceholder: string;
8
+ labels: {
9
+ search: string;
10
+ filter: string;
11
+ filterActive: string;
12
+ perPage: string;
13
+ };
14
+ filters: FilterConfig[];
15
+ onToggleFilters?: (show: boolean) => void;
16
+ showFilters: boolean;
17
+ hasActiveFilters: boolean;
18
+ pagination?: PaginationConfig;
19
+ createButton?: ReactNode | {
20
+ label: string;
21
+ onClick: () => void;
22
+ };
23
+ }
24
+ export declare function DataTableSearch({ onSearch, onSearchValueChange, searchValue, searchPlaceholder, labels, filters, onToggleFilters, showFilters, hasActiveFilters, pagination, createButton, }: DataTableSearchProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import {
3
+ DataTableSearch
4
+ } from "../../../chunk-TH45RVP7.js";
5
+ import "../../../chunk-NY5QXT33.js";
6
+ import "../../../chunk-L25BNU3E.js";
7
+ import "../../../chunk-RJUVBBZG.js";
8
+ import "../../../chunk-62FLBG6B.js";
9
+ import "../../../chunk-ORMEWXMH.js";
10
+ export {
11
+ DataTableSearch
12
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * DataTable
3
+ *
4
+ * Public API - 모든 DataTable 관련 타입과 컴포넌트 export
5
+ */
6
+ export { DataTable } from "./DataTable";
7
+ export { DataTableSearch } from "./DataTableSearch";
8
+ export { DataTableFilters } from "./DataTableFilters";
9
+ export { DataTableBulkActions } from "./DataTableBulkActions";
10
+ export { DataTableBody } from "./DataTableBody";
11
+ export { DataTablePagination } from "./DataTablePagination";
12
+ export type { DataTableLabels, ColumnDef, BulkAction, FilterConfig, PaginationConfig, SortConfig, DataTableProps, } from "./types";
13
+ export { DEFAULT_LABELS, formatLabel } from "./types";
@@ -0,0 +1,115 @@
1
+ /**
2
+ * DataTable Types
3
+ *
4
+ * DataTable 컴포넌트의 모든 타입 정의
5
+ */
6
+ import { ReactNode } from "react";
7
+ export interface DataTableLabels {
8
+ search?: string;
9
+ filter?: string;
10
+ filterActive?: string;
11
+ clearFilters?: string;
12
+ selectAll?: string;
13
+ selectAllShort?: string;
14
+ selected?: string;
15
+ processing?: string;
16
+ processingItems?: string;
17
+ loading?: string;
18
+ perPage?: string;
19
+ all?: string;
20
+ min?: string;
21
+ max?: string;
22
+ previous?: string;
23
+ next?: string;
24
+ showing?: string;
25
+ }
26
+ export declare const DEFAULT_LABELS: Required<DataTableLabels>;
27
+ export declare function formatLabel(template: string, values: Record<string, string | number>): string;
28
+ export interface ColumnDef<T> {
29
+ key: string;
30
+ header: string;
31
+ accessorKey?: keyof T;
32
+ cell?: (item: T) => React.ReactNode;
33
+ sortable?: boolean;
34
+ width?: string;
35
+ className?: string;
36
+ hidden?: boolean;
37
+ responsive?: {
38
+ sm?: boolean;
39
+ md?: boolean;
40
+ lg?: boolean;
41
+ xl?: boolean;
42
+ };
43
+ }
44
+ export interface BulkAction {
45
+ key: string;
46
+ label: string;
47
+ icon?: React.ReactNode;
48
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
49
+ onClick: (selectedIds: string[]) => Promise<void>;
50
+ disabled?: (selectedIds: string[]) => boolean;
51
+ }
52
+ export interface FilterConfig {
53
+ key: string;
54
+ label: string;
55
+ type: 'text' | 'select' | 'date' | 'number' | 'switch' | 'range';
56
+ options?: {
57
+ value: string;
58
+ label: string;
59
+ }[];
60
+ placeholder?: string;
61
+ className?: string;
62
+ inputType?: 'text' | 'number' | 'date';
63
+ minPlaceholder?: string;
64
+ maxPlaceholder?: string;
65
+ /** 필터 모드: 'server'(기본값)는 서버 사이드, 'client'는 클라이언트 사이드 필터링 */
66
+ filterMode?: 'server' | 'client';
67
+ /** 클라이언트 사이드 필터링 함수 (filterMode === 'client'일 때 사용) */
68
+ filterFn?: (item: any, value: any) => boolean;
69
+ }
70
+ export interface PaginationConfig {
71
+ page: number;
72
+ pageSize: number;
73
+ total: number;
74
+ pageSizeOptions?: number[];
75
+ onPageChange: (page: number) => void;
76
+ onPageSizeChange: (pageSize: number) => void;
77
+ }
78
+ export interface SortConfig {
79
+ sort: string;
80
+ order: 'asc' | 'desc';
81
+ onSortChange: (sort: string, order: 'asc' | 'desc') => void;
82
+ }
83
+ export interface DataTableProps<T> {
84
+ data: T[];
85
+ columns: ColumnDef<T>[];
86
+ loading?: boolean;
87
+ error?: string | null;
88
+ pagination?: PaginationConfig;
89
+ sort?: SortConfig;
90
+ bulkActions?: BulkAction[];
91
+ filters?: FilterConfig[];
92
+ filterValues?: Record<string, any>;
93
+ onFilterChange?: (key: string, value: any) => void;
94
+ onClearFilters?: () => void;
95
+ selectable?: boolean;
96
+ onSelectionChange?: (selectedIds: string[]) => void;
97
+ selectedIds?: string[];
98
+ getRowId: (item: T) => string;
99
+ className?: string;
100
+ emptyMessage?: string;
101
+ searchPlaceholder?: string;
102
+ onSearch?: (search: string) => void;
103
+ onSearchValueChange?: (searchValue: string) => void;
104
+ searchValue?: string;
105
+ showFilters?: boolean;
106
+ onToggleFilters?: (show: boolean) => void;
107
+ createButton?: ReactNode | {
108
+ label: string;
109
+ onClick: () => void;
110
+ };
111
+ /** i18n labels - 미제공 시 영어 기본값 사용 */
112
+ labels?: Partial<DataTableLabels>;
113
+ /** URL 쿼리 파라미터와 상태 동기화 (기본값: false) */
114
+ syncWithUrl?: boolean;
115
+ }
@@ -20,7 +20,3 @@ export * from "./error-handler";
20
20
  export { getFriendlyMessage, getErrorDisplayInfo, formatFriendlyError, type IFriendlyMessage, type IErrorDisplay, } from "./friendly-messages-v2";
21
21
  export * from "./error-display";
22
22
  export * from "./ErrorBoundary";
23
- export * from "./components";
24
- export * from "./hooks";
25
- export * from "./logging";
26
- export * from "./recovery";
@@ -1,52 +1,3 @@
1
- import "../chunk-ULF5RDDX.js";
2
- import {
3
- withRetry
4
- } from "../chunk-A6EAAWMK.js";
5
- import {
6
- CircuitBreaker,
7
- ECircuitState
8
- } from "../chunk-7VJNLGAS.js";
9
- import {
10
- FeatureDegradation
11
- } from "../chunk-TEIYA7U4.js";
12
- import {
13
- withFallback,
14
- withFallbackChain,
15
- withFallbackFn
16
- } from "../chunk-MYLGYX4K.js";
17
- import "../chunk-Y2TUZFCP.js";
18
- import {
19
- useErrorHandler
20
- } from "../chunk-IAJNC34M.js";
21
- import {
22
- EmptyState,
23
- ErrorAlert,
24
- ErrorPage,
25
- LoadingState
26
- } from "../chunk-ZHVUK5OY.js";
27
- import "../chunk-7XFHGAJP.js";
28
- import "../chunk-COK4ZXNG.js";
29
- import {
30
- ConsoleTransport
31
- } from "../chunk-FW3IEJ7H.js";
32
- import {
33
- FileTransport
34
- } from "../chunk-YJ3TLEW3.js";
35
- import {
36
- SentryTransport
37
- } from "../chunk-ZZIKRBJU.js";
38
- import {
39
- SlackTransport
40
- } from "../chunk-EQYTE7WD.js";
41
- import {
42
- BaseTransport
43
- } from "../chunk-HGC4CCKB.js";
44
- import {
45
- ErrorLogger
46
- } from "../chunk-JS5VI3OW.js";
47
- import {
48
- ELogLevel
49
- } from "../chunk-6C7HQIX4.js";
50
1
  import {
51
2
  LocaleDetector
52
3
  } from "../chunk-XHZ5L4FO.js";
@@ -234,27 +185,13 @@ function InlineError({
234
185
  }
235
186
  export {
236
187
  AppError,
237
- BaseTransport,
238
- CircuitBreaker,
239
- ConsoleTransport,
240
- ECircuitState,
241
- ELogLevel,
242
188
  ERROR_CODES,
243
- EmptyState,
244
- ErrorAlert,
245
189
  ErrorBoundary,
246
190
  ErrorCard,
247
- ErrorLogger,
248
- ErrorPage,
249
191
  ErrorResponse,
250
- FeatureDegradation,
251
- FileTransport,
252
192
  HTTP_STATUS,
253
193
  InlineError,
254
- LoadingState,
255
194
  LocaleDetector,
256
- SentryTransport,
257
- SlackTransport,
258
195
  errorToResponse,
259
196
  extractErrorInfo,
260
197
  formatErrorMessage,
@@ -280,10 +217,5 @@ export {
280
217
  processError,
281
218
  showFriendlyError,
282
219
  supportedLocales,
283
- useErrorHandler,
284
- withErrorHandler,
285
- withFallback,
286
- withFallbackChain,
287
- withFallbackFn,
288
- withRetry
220
+ withErrorHandler
289
221
  };
@@ -1,9 +1,6 @@
1
1
  import {
2
2
  GeoIPProviderFactory
3
- } from "../chunk-S73334QY.js";
4
- import {
5
- IPApiProvider
6
- } from "../chunk-DEEJBDJE.js";
3
+ } from "../chunk-QF6FH4GZ.js";
7
4
  import {
8
5
  IPApiCoProvider
9
6
  } from "../chunk-VSGKVZB4.js";
@@ -13,6 +10,9 @@ import {
13
10
  import {
14
11
  MaxMindProvider
15
12
  } from "../chunk-4NWJ3WCZ.js";
13
+ import {
14
+ IPApiProvider
15
+ } from "../chunk-DEEJBDJE.js";
16
16
  import {
17
17
  BaseGeoIPProvider,
18
18
  truncateString
@@ -1,9 +1,6 @@
1
1
  import {
2
2
  GeoIPProviderFactory
3
- } from "../../chunk-S73334QY.js";
4
- import {
5
- IPApiProvider
6
- } from "../../chunk-DEEJBDJE.js";
3
+ } from "../../chunk-QF6FH4GZ.js";
7
4
  import {
8
5
  IPApiCoProvider
9
6
  } from "../../chunk-VSGKVZB4.js";
@@ -13,6 +10,9 @@ import {
13
10
  import {
14
11
  MaxMindProvider
15
12
  } from "../../chunk-4NWJ3WCZ.js";
13
+ import {
14
+ IPApiProvider
15
+ } from "../../chunk-DEEJBDJE.js";
16
16
  import {
17
17
  BaseGeoIPProvider,
18
18
  truncateString
@@ -22,6 +22,44 @@ export interface UseDataTableOptions<T> {
22
22
  pagination: DataTablePagination;
23
23
  }) => Promise<void>;
24
24
  }
25
+ export interface UseDataTableState<T> {
26
+ data: T[];
27
+ loading: boolean;
28
+ error: string | null;
29
+ total: number;
30
+ filters: DataTableFilters;
31
+ sort: DataTableSort;
32
+ pagination: DataTablePagination;
33
+ selectedIds: string[];
34
+ }
35
+ export interface UseDataTableDataActions<T> {
36
+ setData: (data: T[]) => void;
37
+ setLoading: (loading: boolean) => void;
38
+ setError: (error: string | null) => void;
39
+ setTotal: (total: number) => void;
40
+ }
41
+ export interface UseDataTableFilterActions {
42
+ setFilters: (filters: DataTableFilters) => void;
43
+ updateFilter: (key: string, value: any) => void;
44
+ clearFilters: () => void;
45
+ }
46
+ export interface UseDataTableSortActions {
47
+ setSort: (sort: string, order?: 'asc' | 'desc') => void;
48
+ }
49
+ export interface UseDataTablePaginationActions {
50
+ setPage: (page: number) => void;
51
+ setPageSize: (pageSize: number) => void;
52
+ }
53
+ export interface UseDataTableSelectionActions {
54
+ setSelectedIds: (ids: string[]) => void;
55
+ toggleSelection: (id: string) => void;
56
+ selectAll: () => void;
57
+ clearSelection: () => void;
58
+ }
59
+ export interface UseDataTableActions {
60
+ refresh: () => Promise<void>;
61
+ bulkAction: (action: (ids: string[]) => Promise<void>) => Promise<void>;
62
+ }
25
63
  export interface UseDataTableReturn<T> {
26
64
  data: T[];
27
65
  loading: boolean;
@@ -47,5 +85,12 @@ export interface UseDataTableReturn<T> {
47
85
  clearSelection: () => void;
48
86
  refresh: () => Promise<void>;
49
87
  bulkAction: (action: (ids: string[]) => Promise<void>) => Promise<void>;
88
+ state: UseDataTableState<T>;
89
+ dataActions: UseDataTableDataActions<T>;
90
+ filterActions: UseDataTableFilterActions;
91
+ sortActions: UseDataTableSortActions;
92
+ paginationActions: UseDataTablePaginationActions;
93
+ selectionActions: UseDataTableSelectionActions;
94
+ actions: UseDataTableActions;
50
95
  }
51
96
  export declare function useDataTable<T>({ initialFilters, initialSort, initialPagination, debounceMs, onDataChange, }: UseDataTableOptions<T>): UseDataTableReturn<T>;
@@ -8,7 +8,7 @@ import {
8
8
  } from "../chunk-ORMEWXMH.js";
9
9
 
10
10
  // src/hooks/useDataTable.ts
11
- import { useState, useCallback, useMemo } from "react";
11
+ import { useState, useCallback, useEffect } from "react";
12
12
  function useDataTable({
13
13
  initialFilters = {},
14
14
  initialSort = { sort: "createdAt", order: "desc" },
@@ -102,16 +102,16 @@ function useDataTable({
102
102
  setLoading(false);
103
103
  }
104
104
  }, [selectedIds, refresh]);
105
- useMemo(() => {
105
+ useEffect(() => {
106
106
  if (debouncedSearch !== filters.search) {
107
107
  setPaginationState((prev) => __spreadProps(__spreadValues({}, prev), { page: 1 }));
108
108
  }
109
109
  }, [debouncedSearch, filters.search]);
110
- useMemo(() => {
110
+ useEffect(() => {
111
111
  refresh();
112
112
  }, [debouncedSearch, sort.sort, sort.order, pagination.page, pagination.pageSize]);
113
113
  return {
114
- // 상태
114
+ // 기존 flat 리턴 (하위 호환)
115
115
  data,
116
116
  loading,
117
117
  error,
@@ -120,28 +120,30 @@ function useDataTable({
120
120
  sort,
121
121
  pagination,
122
122
  selectedIds,
123
- // 데이터 관리
124
123
  setData,
125
124
  setLoading,
126
125
  setError,
127
126
  setTotal,
128
- // 필터 관리
129
127
  setFilters,
130
128
  updateFilter,
131
129
  clearFilters,
132
- // 정렬 관리
133
130
  setSort,
134
- // 페이지네이션 관리
135
131
  setPage,
136
132
  setPageSize,
137
- // 선택 관리
138
133
  setSelectedIds,
139
134
  toggleSelection,
140
135
  selectAll,
141
136
  clearSelection,
142
- // 액션
143
137
  refresh,
144
- bulkAction
138
+ bulkAction,
139
+ // 새 그룹화 리턴
140
+ state: { data, loading, error, total, filters, sort, pagination, selectedIds },
141
+ dataActions: { setData, setLoading, setError, setTotal },
142
+ filterActions: { setFilters, updateFilter, clearFilters },
143
+ sortActions: { setSort },
144
+ paginationActions: { setPage, setPageSize },
145
+ selectionActions: { setSelectedIds, toggleSelection, selectAll, clearSelection },
146
+ actions: { refresh, bulkAction }
145
147
  };
146
148
  }
147
149
  export {
@@ -1,8 +1,34 @@
1
- import {
2
- formatChartNumber,
3
- formatNumber
4
- } from "../chunk-TDZJ6SAI.js";
5
1
  import "../chunk-ORMEWXMH.js";
2
+
3
+ // src/utils/format-number.ts
4
+ function formatNumber(num) {
5
+ if (num === null || num === void 0) {
6
+ return "-";
7
+ }
8
+ const numericValue = typeof num === "string" ? parseFloat(num) : num;
9
+ if (isNaN(numericValue)) {
10
+ return "NaN";
11
+ }
12
+ if (!isFinite(numericValue)) {
13
+ return numericValue > 0 ? "Infinity" : "-Infinity";
14
+ }
15
+ const isNegative = numericValue < 0;
16
+ const absNum = Math.abs(numericValue);
17
+ if (absNum < 1e3) {
18
+ return numericValue.toString();
19
+ }
20
+ if (absNum < 1e6) {
21
+ return numericValue.toLocaleString();
22
+ }
23
+ if (absNum < 1e7) {
24
+ return numericValue.toLocaleString();
25
+ }
26
+ const formatted = (absNum / 1e6).toFixed(1) + "M";
27
+ return isNegative ? "-" + formatted : formatted;
28
+ }
29
+ function formatChartNumber(num) {
30
+ return formatNumber(num);
31
+ }
6
32
  export {
7
33
  formatChartNumber,
8
34
  formatNumber
@@ -1,8 +1,40 @@
1
- import {
2
- generateShortCode,
3
- generateUniqueShortCode
4
- } from "../chunk-5ATB5D6S.js";
5
1
  import "../chunk-ORMEWXMH.js";
2
+
3
+ // src/utils/short-code-generator.ts
4
+ function generateShortCode(length = 8) {
5
+ if (!Number.isInteger(length) || length <= 0) {
6
+ throw new Error("length must be a positive integer");
7
+ }
8
+ const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
9
+ let result = "";
10
+ for (let i = 0; i < length; i++) {
11
+ result += chars.charAt(Math.floor(Math.random() * chars.length));
12
+ }
13
+ return result;
14
+ }
15
+ async function generateUniqueShortCode(options = {}) {
16
+ const {
17
+ length = 8,
18
+ maxAttempts = 100,
19
+ checkDuplicate
20
+ } = options;
21
+ let shortCode;
22
+ let attempts = 0;
23
+ do {
24
+ shortCode = generateShortCode(length);
25
+ attempts++;
26
+ if (checkDuplicate) {
27
+ const isDuplicate = await checkDuplicate(shortCode);
28
+ if (!isDuplicate) break;
29
+ } else {
30
+ break;
31
+ }
32
+ if (attempts >= maxAttempts) {
33
+ throw new Error("Failed to generate unique shortCode after multiple attempts");
34
+ }
35
+ } while (true);
36
+ return shortCode;
37
+ }
6
38
  export {
7
39
  generateShortCode,
8
40
  generateUniqueShortCode