@shifl-inc/ui 0.3.0 → 0.4.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.
- package/README.md +440 -7
- package/dist/components/grid/GridColumnManager.vue.d.ts +2 -2
- package/dist/components/grid/ShiflGrid.vue.d.ts +1 -1
- package/dist/composables/useGridApi.d.ts +22 -0
- package/dist/composables/useGridColumns.d.ts +25 -25
- package/dist/composables/useGridData.d.ts +36 -3
- package/dist/shifl-ui.js +1027 -666
- package/dist/shifl-ui.umd +7 -7
- package/dist/style.css +1 -1
- package/dist/types/grid.d.ts +56 -12
- package/package.json +1 -1
package/dist/types/grid.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface GridActionColumn {
|
|
|
11
11
|
icon?: string | ((row: Record<string, unknown>) => unknown);
|
|
12
12
|
actions: GridAction[] | ((row: Record<string, unknown>) => GridAction[]);
|
|
13
13
|
width?: string;
|
|
14
|
-
|
|
14
|
+
freeze?: boolean;
|
|
15
15
|
order?: number;
|
|
16
16
|
label?: string;
|
|
17
17
|
}
|
|
@@ -29,22 +29,33 @@ export interface GridColumn {
|
|
|
29
29
|
width?: string;
|
|
30
30
|
height?: string;
|
|
31
31
|
isDefault?: boolean;
|
|
32
|
-
|
|
33
|
-
/** legacy alias */
|
|
34
|
-
fixed?: boolean;
|
|
32
|
+
freeze?: boolean;
|
|
35
33
|
visible?: boolean;
|
|
36
34
|
/** Protected columns are hidden from column editor and cannot be modified */
|
|
37
35
|
protected?: boolean;
|
|
38
|
-
cellMetadata?: {
|
|
39
|
-
format?: string;
|
|
40
|
-
emptyState?: string;
|
|
41
|
-
};
|
|
42
36
|
/** Action column configuration */
|
|
43
37
|
actionColumn?: GridActionColumn;
|
|
44
38
|
/** Smart Tracking column configuration */
|
|
45
39
|
smartTrackingColumn?: SmartTrackingColumn;
|
|
46
|
-
|
|
40
|
+
/** Controls how empty/null/undefined values are displayed */
|
|
41
|
+
blankStyle?: GridBlankStyle;
|
|
42
|
+
/** Cell type configuration */
|
|
43
|
+
cellType?: CompositeGridCellType;
|
|
44
|
+
/** Truncate long text (default: true) */
|
|
45
|
+
truncate?: boolean;
|
|
46
|
+
/** Whether column is filterable (default: false) */
|
|
47
|
+
filterable?: boolean;
|
|
48
|
+
/** Filter type for this column */
|
|
49
|
+
filterType?: CompositeGridFilterType;
|
|
50
|
+
/** Text alignment */
|
|
51
|
+
align?: GridCellAlign;
|
|
47
52
|
}
|
|
53
|
+
export type GridCellAlign = 'left' | 'center' | 'right';
|
|
54
|
+
export type GridBlankStyle = 'dash' | 'empty' | 'zero' | 'na' | 'custom';
|
|
55
|
+
export type GridCellType = 'text' | 'number' | 'date' | 'icon' | 'badge' | 'action' | 'link' | 'status' | 'progress' | 'currency' | 'boolean';
|
|
56
|
+
export type CompositeGridCellType = GridCellType | GridCellType[];
|
|
57
|
+
export type CompositeGridFilterType = GridFilterType | GridFilterType[];
|
|
58
|
+
export type GridFilterType = 'text' | 'number' | 'listReference' | 'datePicker' | 'boolean' | 'range' | 'search';
|
|
48
59
|
export interface GridFilter {
|
|
49
60
|
key: string;
|
|
50
61
|
label: string;
|
|
@@ -72,16 +83,49 @@ export interface PaginationMeta {
|
|
|
72
83
|
total?: number;
|
|
73
84
|
}
|
|
74
85
|
export type SearchMode = 'client' | 'server';
|
|
86
|
+
export interface ApiRequestContext {
|
|
87
|
+
search?: string;
|
|
88
|
+
filters?: GridFilter[];
|
|
89
|
+
sort?: GridSort;
|
|
90
|
+
page?: number;
|
|
91
|
+
perPage?: number;
|
|
92
|
+
extraState?: Record<string, unknown>;
|
|
93
|
+
}
|
|
94
|
+
export interface ApiResponse<T> {
|
|
95
|
+
data: T[];
|
|
96
|
+
meta?: PaginationMeta;
|
|
97
|
+
}
|
|
98
|
+
export interface ApiConfig {
|
|
99
|
+
/** API endpoint URL (required) */
|
|
100
|
+
apiUrl: string;
|
|
101
|
+
/** HTTP method (default: 'GET') */
|
|
102
|
+
method?: 'GET' | 'POST' | 'PUT';
|
|
103
|
+
/** Function to get auth token (optional) */
|
|
104
|
+
getAuthToken?: () => string | undefined;
|
|
105
|
+
/** Additional headers */
|
|
106
|
+
headers?: Record<string, string>;
|
|
107
|
+
/** Additional params (static object or function that receives context) - merged with search/filters/sort/pagination */
|
|
108
|
+
additionalParams?: Record<string, unknown> | ((context: ApiRequestContext) => Record<string, unknown>);
|
|
109
|
+
/** Custom query params builder (overrides default) */
|
|
110
|
+
paramsBuilder?: (context: ApiRequestContext) => URLSearchParams | Record<string, unknown>;
|
|
111
|
+
/** Custom body builder (for POST/PUT requests) */
|
|
112
|
+
bodyBuilder?: (context: ApiRequestContext) => unknown;
|
|
113
|
+
/** Response transformer to extract data and pagination from API response */
|
|
114
|
+
responseTransformer?: <T>(response: unknown) => ApiResponse<T>;
|
|
115
|
+
/** Debounce delay for search queries in milliseconds (default: 300) */
|
|
116
|
+
debounceMs?: number;
|
|
117
|
+
}
|
|
75
118
|
export interface GridConfig<T = Record<string, unknown>> {
|
|
76
119
|
id?: string;
|
|
77
120
|
name?: string;
|
|
78
121
|
customerId?: number;
|
|
79
|
-
|
|
122
|
+
module?: string;
|
|
80
123
|
resourceId?: string | number | null;
|
|
81
124
|
creatorId?: number;
|
|
82
125
|
pageLocation?: string;
|
|
83
126
|
view?: GridViewType;
|
|
84
|
-
|
|
127
|
+
/** API configuration for server-side data fetching. When provided, searchMode is automatically set to 'server' */
|
|
128
|
+
apiConfig?: ApiConfig;
|
|
85
129
|
columns: GridColumn[];
|
|
86
130
|
search?: string[];
|
|
87
131
|
searchMode?: SearchMode;
|
|
@@ -91,7 +135,7 @@ export interface GridConfig<T = Record<string, unknown>> {
|
|
|
91
135
|
rows?: T[];
|
|
92
136
|
}
|
|
93
137
|
export interface NormalizedGridColumn extends GridColumn {
|
|
94
|
-
|
|
138
|
+
freeze: boolean;
|
|
95
139
|
visible: boolean;
|
|
96
140
|
}
|
|
97
141
|
export interface NormalizedGridConfig<T = Record<string, unknown>> extends GridConfig<T> {
|