@shifl-inc/ui 0.9.2 → 0.9.3
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.
- package/dist/components/grid/GridEmptyState.vue.d.ts +7 -0
- package/dist/components/icons/ExportIcon.vue.d.ts +7 -0
- package/dist/shifl-ui.js +1217 -988
- package/dist/shifl-ui.umd +59 -7
- package/dist/style.css +1 -1
- package/dist/types/grid.d.ts +23 -0
- package/dist/utils/export.d.ts +40 -0
- package/package.json +1 -1
package/dist/types/grid.d.ts
CHANGED
|
@@ -83,6 +83,18 @@ export interface PaginationMeta {
|
|
|
83
83
|
total?: number;
|
|
84
84
|
}
|
|
85
85
|
export type SearchMode = 'client' | 'server';
|
|
86
|
+
export type ExportSource = 'client' | 'server';
|
|
87
|
+
export type ExportType = 'csv' | 'excel' | 'xlsx';
|
|
88
|
+
export interface ExportConfig {
|
|
89
|
+
/** Show/hide export button */
|
|
90
|
+
show?: boolean;
|
|
91
|
+
/** Export source: client-side or server-side */
|
|
92
|
+
source?: ExportSource;
|
|
93
|
+
/** Export file type */
|
|
94
|
+
exportType?: ExportType;
|
|
95
|
+
/** Export file name (without extension) */
|
|
96
|
+
exportFileName?: string;
|
|
97
|
+
}
|
|
86
98
|
export interface ApiRequestContext {
|
|
87
99
|
search?: string;
|
|
88
100
|
filters?: GridFilter[];
|
|
@@ -116,6 +128,14 @@ export interface ApiConfig {
|
|
|
116
128
|
/** Debounce delay for search queries in milliseconds (default: 300) */
|
|
117
129
|
debounceMs?: number;
|
|
118
130
|
}
|
|
131
|
+
export interface GridEmptyState {
|
|
132
|
+
/** Icon name to display (must match an icon registered in the library) */
|
|
133
|
+
iconName: string;
|
|
134
|
+
/** Title text shown below the icon */
|
|
135
|
+
title: string;
|
|
136
|
+
/** Description text shown below the title */
|
|
137
|
+
description: string;
|
|
138
|
+
}
|
|
119
139
|
export interface GridConfig<T = Record<string, unknown>> {
|
|
120
140
|
id?: string;
|
|
121
141
|
name?: string;
|
|
@@ -134,6 +154,9 @@ export interface GridConfig<T = Record<string, unknown>> {
|
|
|
134
154
|
sort?: GridSort;
|
|
135
155
|
paginationMeta?: PaginationMeta;
|
|
136
156
|
rows?: T[];
|
|
157
|
+
/** Export configuration for data export functionality */
|
|
158
|
+
exportConfig?: ExportConfig;
|
|
159
|
+
emptyState?: GridEmptyState;
|
|
137
160
|
}
|
|
138
161
|
export interface NormalizedGridColumn extends GridColumn {
|
|
139
162
|
freeze: boolean;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ExportConfig, ExportType, GridColumn, GridFilter, GridSort } from '../types/grid';
|
|
2
|
+
export interface ExportData {
|
|
3
|
+
rows: Record<string, unknown>[];
|
|
4
|
+
columns: GridColumn[];
|
|
5
|
+
sort?: GridSort;
|
|
6
|
+
filters?: GridFilter[];
|
|
7
|
+
}
|
|
8
|
+
export interface ExportOptions {
|
|
9
|
+
exportType: ExportType;
|
|
10
|
+
fileName: string;
|
|
11
|
+
data: ExportData;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Export data to CSV format
|
|
15
|
+
*/
|
|
16
|
+
export declare function exportToCSV(data: ExportData, fileName: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* Export data to Excel format (simplified version)
|
|
19
|
+
* Note: For full Excel support, you would need a library like xlsx
|
|
20
|
+
*/
|
|
21
|
+
export declare function exportToExcel(data: ExportData, fileName: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Main export handler function
|
|
24
|
+
*/
|
|
25
|
+
export declare function handleExport(options: ExportOptions): void;
|
|
26
|
+
/**
|
|
27
|
+
* Prepare export data from grid state
|
|
28
|
+
*/
|
|
29
|
+
export declare function prepareExportData(rows: Record<string, unknown>[], columns: GridColumn[], sort?: GridSort, filters?: GridFilter[]): ExportData;
|
|
30
|
+
/**
|
|
31
|
+
* Get file extension based on export type
|
|
32
|
+
*/
|
|
33
|
+
export declare function getFileExtension(exportType: ExportType): string;
|
|
34
|
+
/**
|
|
35
|
+
* Validate export configuration
|
|
36
|
+
*/
|
|
37
|
+
export declare function validateExportConfig(config: ExportConfig): {
|
|
38
|
+
isValid: boolean;
|
|
39
|
+
errors: string[];
|
|
40
|
+
};
|