@shifl-inc/ui 0.3.0 → 0.5.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/GridTooltip.vue.d.ts +1 -0
- 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 +37 -3
- package/dist/shifl-ui.js +1124 -724
- package/dist/shifl-ui.umd +7 -7
- package/dist/style.css +1 -1
- package/dist/types/grid.d.ts +57 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,23 +5,25 @@ JSON-driven data grid for Shifl UI, built with Vue 3 + TypeScript. Library-first
|
|
|
5
5
|
## Status
|
|
6
6
|
|
|
7
7
|
- ✅ Minimal grid (column visibility toggle, client-side sorting, global filter)
|
|
8
|
+
- ✅ API integration with server-side data fetching
|
|
9
|
+
- ✅ Pagination, search, filters, and sorting via API
|
|
8
10
|
- 🚧 Everything else scaffolded/stubbed for incremental delivery (editing, virtual scroll, tours, views)
|
|
9
11
|
|
|
10
12
|
## Requirements
|
|
11
13
|
|
|
12
|
-
- Node `>=20.11.0`
|
|
13
|
-
- Peer deps: `vue@^3.4.0
|
|
14
|
+
- Node `>=20.11.0`
|
|
15
|
+
- Peer deps: `vue@^3.4.0`
|
|
14
16
|
|
|
15
17
|
## Install
|
|
16
18
|
|
|
17
19
|
```bash
|
|
18
20
|
npm install @shifl-inc/ui
|
|
19
|
-
# peer deps
|
|
20
|
-
npm install vue pinia
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
|
+
### Setup
|
|
26
|
+
|
|
25
27
|
```ts
|
|
26
28
|
// main.ts
|
|
27
29
|
import { createApp } from 'vue';
|
|
@@ -34,6 +36,10 @@ app.use(ShiflGridPlugin);
|
|
|
34
36
|
app.mount('#app');
|
|
35
37
|
```
|
|
36
38
|
|
|
39
|
+
### Client-Side Mode (Static Data)
|
|
40
|
+
|
|
41
|
+
For static data that doesn't require API calls:
|
|
42
|
+
|
|
37
43
|
```vue
|
|
38
44
|
<script setup lang="ts">
|
|
39
45
|
import { ShiflGrid } from '@shifl-inc/ui';
|
|
@@ -42,7 +48,7 @@ import type { GridConfig } from '@shifl-inc/ui';
|
|
|
42
48
|
const config: GridConfig = {
|
|
43
49
|
name: 'My Preferred Shipments',
|
|
44
50
|
columns: [
|
|
45
|
-
{ key: 'shifl_ref', label: 'Shifl Ref #', sortable: true,
|
|
51
|
+
{ key: 'shifl_ref', label: 'Shifl Ref #', sortable: true, freeze: true },
|
|
46
52
|
{ key: 'company_name', label: 'Customer', sortable: true }
|
|
47
53
|
],
|
|
48
54
|
search: ['shifl_ref', 'company_name'],
|
|
@@ -50,7 +56,80 @@ const config: GridConfig = {
|
|
|
50
56
|
rows: [
|
|
51
57
|
{ shifl_ref: 'SF-1001', company_name: 'GMA Inc' },
|
|
52
58
|
{ shifl_ref: 'SF-1002', company_name: 'Walads Autowash' }
|
|
53
|
-
]
|
|
59
|
+
],
|
|
60
|
+
paginationMeta: {
|
|
61
|
+
show: true,
|
|
62
|
+
currentPage: 1,
|
|
63
|
+
perPage: 20,
|
|
64
|
+
total: 2
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<template>
|
|
70
|
+
<ShiflGrid :config="config" />
|
|
71
|
+
</template>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Server-Side Mode (API Integration)
|
|
75
|
+
|
|
76
|
+
For dynamic data fetched from an API:
|
|
77
|
+
|
|
78
|
+
```vue
|
|
79
|
+
<script setup lang="ts">
|
|
80
|
+
import { ShiflGrid } from '@shifl-inc/ui';
|
|
81
|
+
import type { GridConfig } from '@shifl-inc/ui';
|
|
82
|
+
|
|
83
|
+
const config: GridConfig = {
|
|
84
|
+
name: 'My Preferred Shipments',
|
|
85
|
+
apiConfig: {
|
|
86
|
+
apiUrl: 'https://api.example.com/shipments',
|
|
87
|
+
method: 'GET', // Optional: 'GET' | 'POST' | 'PUT' (default: 'GET')
|
|
88
|
+
getAuthToken: () => localStorage.getItem('token'), // Optional: function to get auth token
|
|
89
|
+
headers: {
|
|
90
|
+
// Optional: additional headers
|
|
91
|
+
'X-Custom-Header': 'value'
|
|
92
|
+
},
|
|
93
|
+
additionalParams: {
|
|
94
|
+
// Optional: extra params to send with requests
|
|
95
|
+
module: 'shipments',
|
|
96
|
+
customerId: 123
|
|
97
|
+
},
|
|
98
|
+
debounceMs: 300, // Optional: debounce search queries (default: 300ms)
|
|
99
|
+
responseTransformer: <T,>(response: unknown) => {
|
|
100
|
+
// Optional: transform API response to expected format
|
|
101
|
+
const res = response as {
|
|
102
|
+
data?: T[];
|
|
103
|
+
meta?: {
|
|
104
|
+
current_page?: number;
|
|
105
|
+
per_page?: number;
|
|
106
|
+
total?: number;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
data: res.data || [],
|
|
111
|
+
meta: res.meta
|
|
112
|
+
? {
|
|
113
|
+
currentPage: res.meta.current_page,
|
|
114
|
+
perPage: res.meta.per_page,
|
|
115
|
+
total: res.meta.total,
|
|
116
|
+
show: true
|
|
117
|
+
}
|
|
118
|
+
: undefined
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
columns: [
|
|
123
|
+
{ key: 'shifl_ref', label: 'Shifl Ref #', sortable: true, freeze: true },
|
|
124
|
+
{ key: 'company_name', label: 'Customer', sortable: true }
|
|
125
|
+
],
|
|
126
|
+
search: ['shifl_ref', 'company_name'],
|
|
127
|
+
paginationMeta: {
|
|
128
|
+
show: true,
|
|
129
|
+
currentPage: 1,
|
|
130
|
+
perPage: 20,
|
|
131
|
+
total: 0 // Will be updated from API response
|
|
132
|
+
}
|
|
54
133
|
};
|
|
55
134
|
</script>
|
|
56
135
|
|
|
@@ -59,6 +138,341 @@ const config: GridConfig = {
|
|
|
59
138
|
</template>
|
|
60
139
|
```
|
|
61
140
|
|
|
141
|
+
## Configuration Options
|
|
142
|
+
|
|
143
|
+
### GridConfig
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
interface GridConfig<T = Record<string, unknown>> {
|
|
147
|
+
id?: string;
|
|
148
|
+
name?: string;
|
|
149
|
+
customerId?: number;
|
|
150
|
+
module?: string;
|
|
151
|
+
resourceId?: string | number | null;
|
|
152
|
+
creatorId?: number;
|
|
153
|
+
pageLocation?: string;
|
|
154
|
+
view?: 'regular' | 'compact' | 'comfortable';
|
|
155
|
+
|
|
156
|
+
// API Configuration (for server-side mode)
|
|
157
|
+
apiConfig?: {
|
|
158
|
+
apiUrl: string; // Required: API endpoint URL
|
|
159
|
+
method?: 'GET' | 'POST' | 'PUT'; // Optional: HTTP method (default: 'GET')
|
|
160
|
+
getAuthToken?: () => string | undefined; // Optional: function to get auth token
|
|
161
|
+
headers?: Record<string, string>; // Optional: additional headers
|
|
162
|
+
additionalParams?: Record<string, unknown> | ((context) => Record<string, unknown>); // Optional: extra params
|
|
163
|
+
paramsBuilder?: (context) => URLSearchParams | Record<string, unknown>; // Optional: custom query params
|
|
164
|
+
bodyBuilder?: (context) => unknown; // Optional: custom request body
|
|
165
|
+
responseTransformer?: <T>(response: unknown) => ApiResponse<T>; // Optional: transform API response
|
|
166
|
+
debounceMs?: number; // Optional: search debounce delay (default: 300ms)
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
columns: GridColumn[];
|
|
170
|
+
search?: string[]; // Searchable column keys (for client-side filtering)
|
|
171
|
+
searchMode?: 'client' | 'server'; // Auto-set to 'server' if apiConfig is provided
|
|
172
|
+
filters?: GridFilter[];
|
|
173
|
+
sort?: GridSort;
|
|
174
|
+
paginationMeta?: PaginationMeta;
|
|
175
|
+
rows?: T[]; // Static data (for client-side mode)
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Client-Side Mode Features
|
|
180
|
+
|
|
181
|
+
- **Sorting**: Client-side only; click column headers to toggle asc/desc
|
|
182
|
+
- **Global filter**: Simple case-insensitive substring search across listed `search` fields
|
|
183
|
+
- **Visibility**: Toggle columns via pills above the grid
|
|
184
|
+
- **Pagination**: Client-side pagination of static data
|
|
185
|
+
|
|
186
|
+
### Server-Side Mode Features
|
|
187
|
+
|
|
188
|
+
- **Sorting**: Server-side; click column headers to sort via API
|
|
189
|
+
- **Search**: Debounced search queries sent to API (default: 300ms delay)
|
|
190
|
+
- **Filters**: Filter values sent as query parameters or in request body
|
|
191
|
+
- **Pagination**: Handled by server; pagination metadata from API response
|
|
192
|
+
- **Authentication**: Optional bearer token via `getAuthToken` function
|
|
193
|
+
- **Custom params**: Use `additionalParams` to send extra parameters
|
|
194
|
+
- **Pagination state**: User's selected page is the source of truth; API's `currentPage` is informational only
|
|
195
|
+
|
|
196
|
+
## API Response Formats
|
|
197
|
+
|
|
198
|
+
### Default Response Format (Recommended)
|
|
199
|
+
|
|
200
|
+
The grid works out-of-the-box with this format:
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"data": [
|
|
205
|
+
{ "id": 1, "name": "Item 1", "status": "active" },
|
|
206
|
+
{ "id": 2, "name": "Item 2", "status": "inactive" }
|
|
207
|
+
],
|
|
208
|
+
"meta": {
|
|
209
|
+
"currentPage": 1,
|
|
210
|
+
"perPage": 20,
|
|
211
|
+
"total": 100,
|
|
212
|
+
"lastPage": 5,
|
|
213
|
+
"from": 1,
|
|
214
|
+
"to": 20,
|
|
215
|
+
"show": true
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Alternative Default Formats
|
|
221
|
+
|
|
222
|
+
The default transformer also supports these formats:
|
|
223
|
+
|
|
224
|
+
#### Format 1: Using `rows` instead of `data`
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"rows": [
|
|
229
|
+
{ "id": 1, "name": "Item 1" },
|
|
230
|
+
{ "id": 2, "name": "Item 2" }
|
|
231
|
+
],
|
|
232
|
+
"meta": {
|
|
233
|
+
"currentPage": 1,
|
|
234
|
+
"perPage": 20,
|
|
235
|
+
"total": 100
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
#### Format 2: Data only (no pagination)
|
|
241
|
+
|
|
242
|
+
```json
|
|
243
|
+
{
|
|
244
|
+
"data": [
|
|
245
|
+
{ "id": 1, "name": "Item 1" },
|
|
246
|
+
{ "id": 2, "name": "Item 2" }
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Required Fields
|
|
252
|
+
|
|
253
|
+
The grid requires these fields in `meta` for proper pagination:
|
|
254
|
+
|
|
255
|
+
- **Required for pagination to work:**
|
|
256
|
+
- `perPage` (or `per_page` in Laravel format) - number of items per page
|
|
257
|
+
- `total` (total number of records) - used to calculate total pages
|
|
258
|
+
|
|
259
|
+
- **Optional but recommended:**
|
|
260
|
+
- `currentPage` (or `current_page` in Laravel format) - **informational only**, does not override user's selected page
|
|
261
|
+
- `lastPage` (or `last_page`) - for better UX
|
|
262
|
+
- `from` - starting record number
|
|
263
|
+
- `to` - ending record number
|
|
264
|
+
- `show` - whether to show pagination (default: `true`)
|
|
265
|
+
|
|
266
|
+
### Important: Pagination State Behavior
|
|
267
|
+
|
|
268
|
+
**The grid uses the user's pagination state as the source of truth.** When a user clicks page 2, the grid will:
|
|
269
|
+
|
|
270
|
+
- Display page 2 as active in the UI
|
|
271
|
+
- Send `page=2` in the API request
|
|
272
|
+
- Show the correct active page even if the API response returns `currentPage: 1`
|
|
273
|
+
|
|
274
|
+
This behavior ensures the pagination UI remains correct even when using mock/dummy APIs that always return `currentPage: 1`. The API's `currentPage` value is only used for informational purposes and does not override the user's selection.
|
|
275
|
+
|
|
276
|
+
## Custom Response Transformers
|
|
277
|
+
|
|
278
|
+
If your API uses a different response format, use the `responseTransformer` option:
|
|
279
|
+
|
|
280
|
+
### Laravel-Style Pagination Format
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
const config: GridConfig = {
|
|
284
|
+
apiConfig: {
|
|
285
|
+
apiUrl: 'https://api.example.com/data',
|
|
286
|
+
getAuthToken: () => localStorage.getItem('token'),
|
|
287
|
+
responseTransformer: <T>(response: unknown) => {
|
|
288
|
+
const res = response as {
|
|
289
|
+
data?: T[];
|
|
290
|
+
meta?: {
|
|
291
|
+
current_page?: number;
|
|
292
|
+
per_page?: number;
|
|
293
|
+
total?: number;
|
|
294
|
+
last_page?: number;
|
|
295
|
+
from?: number;
|
|
296
|
+
to?: number;
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
return {
|
|
301
|
+
data: res.data || [],
|
|
302
|
+
meta: res.meta
|
|
303
|
+
? {
|
|
304
|
+
currentPage: res.meta.current_page,
|
|
305
|
+
perPage: res.meta.per_page,
|
|
306
|
+
total: res.meta.total,
|
|
307
|
+
lastPage: res.meta.last_page,
|
|
308
|
+
from: res.meta.from,
|
|
309
|
+
to: res.meta.to,
|
|
310
|
+
show: true
|
|
311
|
+
}
|
|
312
|
+
: undefined
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// ... rest of config
|
|
317
|
+
};
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Laravel Response Example:**
|
|
321
|
+
|
|
322
|
+
```json
|
|
323
|
+
{
|
|
324
|
+
"data": [{ "id": 1, "name": "Item 1" }],
|
|
325
|
+
"meta": {
|
|
326
|
+
"current_page": 1,
|
|
327
|
+
"per_page": 20,
|
|
328
|
+
"total": 100,
|
|
329
|
+
"last_page": 5,
|
|
330
|
+
"from": 1,
|
|
331
|
+
"to": 20
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### REST API Standard Format
|
|
337
|
+
|
|
338
|
+
```typescript
|
|
339
|
+
const config: GridConfig = {
|
|
340
|
+
apiConfig: {
|
|
341
|
+
apiUrl: 'https://api.example.com/data',
|
|
342
|
+
responseTransformer: <T>(response: unknown) => {
|
|
343
|
+
const res = response as {
|
|
344
|
+
results?: T[];
|
|
345
|
+
items?: T[];
|
|
346
|
+
count?: number;
|
|
347
|
+
page?: number;
|
|
348
|
+
pageSize?: number;
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
return {
|
|
352
|
+
data: res.results || res.items || [],
|
|
353
|
+
meta: {
|
|
354
|
+
currentPage: res.page || 1,
|
|
355
|
+
perPage: res.pageSize || 20,
|
|
356
|
+
total: res.count || 0,
|
|
357
|
+
show: true
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
// ... rest of config
|
|
363
|
+
};
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
**REST Response Example:**
|
|
367
|
+
|
|
368
|
+
```json
|
|
369
|
+
{
|
|
370
|
+
"results": [{ "id": 1, "name": "Item 1" }],
|
|
371
|
+
"count": 100,
|
|
372
|
+
"page": 1,
|
|
373
|
+
"pageSize": 20
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### GraphQL-Style Format
|
|
378
|
+
|
|
379
|
+
```typescript
|
|
380
|
+
const config: GridConfig = {
|
|
381
|
+
apiConfig: {
|
|
382
|
+
apiUrl: 'https://api.example.com/graphql',
|
|
383
|
+
responseTransformer: <T>(response: unknown) => {
|
|
384
|
+
const res = response as {
|
|
385
|
+
data?: {
|
|
386
|
+
items?: T[];
|
|
387
|
+
pagination?: {
|
|
388
|
+
page: number;
|
|
389
|
+
pageSize: number;
|
|
390
|
+
totalCount: number;
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
return {
|
|
396
|
+
data: res.data?.items || [],
|
|
397
|
+
meta: res.data?.pagination
|
|
398
|
+
? {
|
|
399
|
+
currentPage: res.data.pagination.page,
|
|
400
|
+
perPage: res.data.pagination.pageSize,
|
|
401
|
+
total: res.data.pagination.totalCount,
|
|
402
|
+
show: true
|
|
403
|
+
}
|
|
404
|
+
: undefined
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
// ... rest of config
|
|
409
|
+
};
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
**GraphQL Response Example:**
|
|
413
|
+
|
|
414
|
+
```json
|
|
415
|
+
{
|
|
416
|
+
"data": {
|
|
417
|
+
"items": [{ "id": 1, "name": "Item 1" }],
|
|
418
|
+
"pagination": {
|
|
419
|
+
"page": 1,
|
|
420
|
+
"pageSize": 20,
|
|
421
|
+
"totalCount": 100
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
## Request Parameters Sent by Grid
|
|
428
|
+
|
|
429
|
+
The grid automatically sends these parameters:
|
|
430
|
+
|
|
431
|
+
### GET Request (Query Parameters)
|
|
432
|
+
|
|
433
|
+
```
|
|
434
|
+
GET /api/data?search=query&page=1&per_page=20&sort=name&order=asc&filters[status]=active&filters[type][]=type1&filters[type][]=type2
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
### POST/PUT Request (Body)
|
|
438
|
+
|
|
439
|
+
```json
|
|
440
|
+
{
|
|
441
|
+
"search": "query",
|
|
442
|
+
"page": 1,
|
|
443
|
+
"per_page": 20,
|
|
444
|
+
"sort": "name",
|
|
445
|
+
"order": "asc",
|
|
446
|
+
"filters": {
|
|
447
|
+
"status": "active",
|
|
448
|
+
"type": ["type1", "type2"]
|
|
449
|
+
},
|
|
450
|
+
"module": "shipments",
|
|
451
|
+
"customerId": 123
|
|
452
|
+
}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
## Error Handling
|
|
456
|
+
|
|
457
|
+
The grid handles errors gracefully. Your API can return standard HTTP error responses:
|
|
458
|
+
|
|
459
|
+
```json
|
|
460
|
+
{
|
|
461
|
+
"error": "Unauthorized",
|
|
462
|
+
"message": "Invalid authentication token"
|
|
463
|
+
}
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
Or with status codes:
|
|
467
|
+
|
|
468
|
+
- `400` - Bad Request
|
|
469
|
+
- `401` - Unauthorized
|
|
470
|
+
- `403` - Forbidden
|
|
471
|
+
- `404` - Not Found
|
|
472
|
+
- `500` - Internal Server Error
|
|
473
|
+
|
|
474
|
+
The grid will display the error and stop loading.
|
|
475
|
+
|
|
62
476
|
## Scripts
|
|
63
477
|
|
|
64
478
|
- `npm run dev` — Vite dev server
|
|
@@ -80,7 +494,26 @@ const config: GridConfig = {
|
|
|
80
494
|
- `stories/` — Storybook stories
|
|
81
495
|
- `.storybook/` — Storybook configuration
|
|
82
496
|
|
|
497
|
+
## API Integration
|
|
498
|
+
|
|
499
|
+
The grid supports server-side data fetching with automatic API calls for search, filters, sorting, and pagination. When `apiConfig` is provided, the grid automatically:
|
|
500
|
+
|
|
501
|
+
- Fetches data from your API endpoint
|
|
502
|
+
- Sends search, filter, sort, and pagination parameters
|
|
503
|
+
- Handles loading states and errors
|
|
504
|
+
- Updates the grid when parameters change
|
|
505
|
+
- Supports bearer token authentication
|
|
506
|
+
- Debounces search queries to reduce API calls
|
|
507
|
+
- **Uses user's pagination state as source of truth** - the active page displayed is based on user selection, not the API's `currentPage` response
|
|
508
|
+
|
|
509
|
+
See [API Response Formats](./API_RESPONSE_FORMATS.md) for detailed information about:
|
|
510
|
+
|
|
511
|
+
- Expected API response formats
|
|
512
|
+
- Custom response transformers
|
|
513
|
+
- Request parameters sent by the grid
|
|
514
|
+
- Error handling
|
|
515
|
+
- Pagination behavior and requirements
|
|
516
|
+
|
|
83
517
|
## Notes
|
|
84
518
|
|
|
85
|
-
- Config normalization supports both `frozen` and legacy `fixed` flags.
|
|
86
519
|
- Virtual scroll, editing, tours, saved/recommended views, telemetry are intentionally stubbed for later milestones.
|
|
@@ -7,7 +7,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
7
7
|
close: () => any;
|
|
8
8
|
toggle: (key: string) => any;
|
|
9
9
|
move: (fromIndex: number, toIndex: number) => any;
|
|
10
|
-
|
|
10
|
+
toggleFreeze: (key: string) => any;
|
|
11
11
|
selectAll: () => any;
|
|
12
12
|
deselectAll: () => any;
|
|
13
13
|
restoreDefault: () => any;
|
|
@@ -15,7 +15,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
15
15
|
onClose?: (() => any) | undefined;
|
|
16
16
|
onToggle?: ((key: string) => any) | undefined;
|
|
17
17
|
onMove?: ((fromIndex: number, toIndex: number) => any) | undefined;
|
|
18
|
-
|
|
18
|
+
onToggleFreeze?: ((key: string) => any) | undefined;
|
|
19
19
|
onSelectAll?: (() => any) | undefined;
|
|
20
20
|
onDeselectAll?: (() => any) | undefined;
|
|
21
21
|
onRestoreDefault?: (() => any) | undefined;
|
|
@@ -2,6 +2,7 @@ type __VLS_Props = {
|
|
|
2
2
|
content: string;
|
|
3
3
|
visible: boolean;
|
|
4
4
|
triggerElement?: HTMLElement | null;
|
|
5
|
+
isHtml?: boolean;
|
|
5
6
|
};
|
|
6
7
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
7
8
|
tooltipRef: HTMLDivElement;
|
|
@@ -15,5 +15,5 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
15
15
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
16
16
|
'(el) => setTagsRef(col.key, rowIndex, el as HTMLElement)': HTMLDivElement;
|
|
17
17
|
actionMenuRef: HTMLDivElement;
|
|
18
|
-
},
|
|
18
|
+
}, any>;
|
|
19
19
|
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ApiConfig, ApiRequestContext } from '../types/grid';
|
|
2
|
+
export declare function useGridApi<T = Record<string, unknown>>(apiUrl: string, apiConfig?: ApiConfig): {
|
|
3
|
+
loading: import('vue').ComputedRef<boolean>;
|
|
4
|
+
error: import('vue').ComputedRef<Error | null>;
|
|
5
|
+
data: import('vue').ComputedRef<import('@vue/reactivity').UnwrapRefSimple<T>[]>;
|
|
6
|
+
paginationMeta: import('vue').ComputedRef<{
|
|
7
|
+
show?: boolean | undefined;
|
|
8
|
+
currentPage?: number | undefined;
|
|
9
|
+
lastPage?: number | undefined;
|
|
10
|
+
firstPageUrl?: string | undefined;
|
|
11
|
+
lastPageUrl?: string | undefined;
|
|
12
|
+
nextPageUrl?: string | null | undefined;
|
|
13
|
+
prevPageUrl?: string | null | undefined;
|
|
14
|
+
from?: number | undefined;
|
|
15
|
+
to?: number | undefined;
|
|
16
|
+
perPage?: number | undefined;
|
|
17
|
+
total?: number | undefined;
|
|
18
|
+
} | undefined>;
|
|
19
|
+
fetchData: (context: ApiRequestContext) => Promise<void>;
|
|
20
|
+
fetchDataDebounced: (context: ApiRequestContext, immediate?: boolean) => void;
|
|
21
|
+
refresh: (context: ApiRequestContext) => void;
|
|
22
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NormalizedGridColumn } from '../types/grid';
|
|
2
2
|
export declare function useGridColumns(initialColumns: NormalizedGridColumn[]): {
|
|
3
3
|
columns: import('vue').Ref<{
|
|
4
|
-
|
|
4
|
+
freeze: boolean;
|
|
5
5
|
visible: boolean;
|
|
6
6
|
key: string;
|
|
7
7
|
label: string;
|
|
@@ -10,12 +10,7 @@ export declare function useGridColumns(initialColumns: NormalizedGridColumn[]):
|
|
|
10
10
|
width?: string | undefined;
|
|
11
11
|
height?: string | undefined;
|
|
12
12
|
isDefault?: boolean | undefined;
|
|
13
|
-
fixed?: boolean | undefined;
|
|
14
13
|
protected?: boolean | undefined;
|
|
15
|
-
cellMetadata?: {
|
|
16
|
-
format?: string | undefined;
|
|
17
|
-
emptyState?: string | undefined;
|
|
18
|
-
} | undefined;
|
|
19
14
|
actionColumn?: {
|
|
20
15
|
type: "action";
|
|
21
16
|
icon?: string | ((row: Record<string, unknown>) => unknown) | undefined;
|
|
@@ -27,7 +22,7 @@ export declare function useGridColumns(initialColumns: NormalizedGridColumn[]):
|
|
|
27
22
|
show?: ((row: Record<string, unknown>) => boolean) | undefined;
|
|
28
23
|
}[];
|
|
29
24
|
width?: string | undefined;
|
|
30
|
-
|
|
25
|
+
freeze?: boolean | undefined;
|
|
31
26
|
order?: number | undefined;
|
|
32
27
|
label?: string | undefined;
|
|
33
28
|
} | undefined;
|
|
@@ -37,9 +32,14 @@ export declare function useGridColumns(initialColumns: NormalizedGridColumn[]):
|
|
|
37
32
|
icon?: string | (() => unknown) | undefined;
|
|
38
33
|
width?: string | undefined;
|
|
39
34
|
} | undefined;
|
|
40
|
-
|
|
35
|
+
blankStyle?: import('../types/grid').GridBlankStyle | undefined;
|
|
36
|
+
cellType?: import('../types/grid').GridCellType | import('../types/grid').GridCellType[] | undefined;
|
|
37
|
+
truncate?: boolean | undefined;
|
|
38
|
+
filterable?: boolean | undefined;
|
|
39
|
+
filterType?: import('../types/grid').GridFilterType | import('../types/grid').GridFilterType[] | undefined;
|
|
40
|
+
align?: import('../types/grid').GridCellAlign | undefined;
|
|
41
41
|
}[], NormalizedGridColumn[] | {
|
|
42
|
-
|
|
42
|
+
freeze: boolean;
|
|
43
43
|
visible: boolean;
|
|
44
44
|
key: string;
|
|
45
45
|
label: string;
|
|
@@ -48,12 +48,7 @@ export declare function useGridColumns(initialColumns: NormalizedGridColumn[]):
|
|
|
48
48
|
width?: string | undefined;
|
|
49
49
|
height?: string | undefined;
|
|
50
50
|
isDefault?: boolean | undefined;
|
|
51
|
-
fixed?: boolean | undefined;
|
|
52
51
|
protected?: boolean | undefined;
|
|
53
|
-
cellMetadata?: {
|
|
54
|
-
format?: string | undefined;
|
|
55
|
-
emptyState?: string | undefined;
|
|
56
|
-
} | undefined;
|
|
57
52
|
actionColumn?: {
|
|
58
53
|
type: "action";
|
|
59
54
|
icon?: string | ((row: Record<string, unknown>) => unknown) | undefined;
|
|
@@ -65,7 +60,7 @@ export declare function useGridColumns(initialColumns: NormalizedGridColumn[]):
|
|
|
65
60
|
show?: ((row: Record<string, unknown>) => boolean) | undefined;
|
|
66
61
|
}[];
|
|
67
62
|
width?: string | undefined;
|
|
68
|
-
|
|
63
|
+
freeze?: boolean | undefined;
|
|
69
64
|
order?: number | undefined;
|
|
70
65
|
label?: string | undefined;
|
|
71
66
|
} | undefined;
|
|
@@ -75,10 +70,15 @@ export declare function useGridColumns(initialColumns: NormalizedGridColumn[]):
|
|
|
75
70
|
icon?: string | (() => unknown) | undefined;
|
|
76
71
|
width?: string | undefined;
|
|
77
72
|
} | undefined;
|
|
78
|
-
|
|
73
|
+
blankStyle?: import('../types/grid').GridBlankStyle | undefined;
|
|
74
|
+
cellType?: import('../types/grid').GridCellType | import('../types/grid').GridCellType[] | undefined;
|
|
75
|
+
truncate?: boolean | undefined;
|
|
76
|
+
filterable?: boolean | undefined;
|
|
77
|
+
filterType?: import('../types/grid').GridFilterType | import('../types/grid').GridFilterType[] | undefined;
|
|
78
|
+
align?: import('../types/grid').GridCellAlign | undefined;
|
|
79
79
|
}[]>;
|
|
80
80
|
visibleColumns: import('vue').ComputedRef<{
|
|
81
|
-
|
|
81
|
+
freeze: boolean;
|
|
82
82
|
visible: boolean;
|
|
83
83
|
key: string;
|
|
84
84
|
label: string;
|
|
@@ -87,12 +87,7 @@ export declare function useGridColumns(initialColumns: NormalizedGridColumn[]):
|
|
|
87
87
|
width?: string | undefined;
|
|
88
88
|
height?: string | undefined;
|
|
89
89
|
isDefault?: boolean | undefined;
|
|
90
|
-
fixed?: boolean | undefined;
|
|
91
90
|
protected?: boolean | undefined;
|
|
92
|
-
cellMetadata?: {
|
|
93
|
-
format?: string | undefined;
|
|
94
|
-
emptyState?: string | undefined;
|
|
95
|
-
} | undefined;
|
|
96
91
|
actionColumn?: {
|
|
97
92
|
type: "action";
|
|
98
93
|
icon?: string | ((row: Record<string, unknown>) => unknown) | undefined;
|
|
@@ -104,7 +99,7 @@ export declare function useGridColumns(initialColumns: NormalizedGridColumn[]):
|
|
|
104
99
|
show?: ((row: Record<string, unknown>) => boolean) | undefined;
|
|
105
100
|
}[];
|
|
106
101
|
width?: string | undefined;
|
|
107
|
-
|
|
102
|
+
freeze?: boolean | undefined;
|
|
108
103
|
order?: number | undefined;
|
|
109
104
|
label?: string | undefined;
|
|
110
105
|
} | undefined;
|
|
@@ -114,11 +109,16 @@ export declare function useGridColumns(initialColumns: NormalizedGridColumn[]):
|
|
|
114
109
|
icon?: string | (() => unknown) | undefined;
|
|
115
110
|
width?: string | undefined;
|
|
116
111
|
} | undefined;
|
|
117
|
-
|
|
112
|
+
blankStyle?: import('../types/grid').GridBlankStyle | undefined;
|
|
113
|
+
cellType?: import('../types/grid').GridCellType | import('../types/grid').GridCellType[] | undefined;
|
|
114
|
+
truncate?: boolean | undefined;
|
|
115
|
+
filterable?: boolean | undefined;
|
|
116
|
+
filterType?: import('../types/grid').GridFilterType | import('../types/grid').GridFilterType[] | undefined;
|
|
117
|
+
align?: import('../types/grid').GridCellAlign | undefined;
|
|
118
118
|
}[]>;
|
|
119
119
|
toggleColumnVisibility: (key: string) => void;
|
|
120
120
|
setAllVisible: (visible: boolean) => void;
|
|
121
|
-
|
|
121
|
+
toggleFreeze: (key: string) => void;
|
|
122
122
|
moveColumn: (fromIndex: number, toIndex: number) => void;
|
|
123
123
|
resetColumns: () => void;
|
|
124
124
|
};
|