@xosen/vuetify-grid 0.0.1

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.
@@ -0,0 +1,625 @@
1
+ import { Component } from 'vue';
2
+ import { ComponentOptionsMixin } from 'vue';
3
+ import { ComponentProvideOptions } from 'vue';
4
+ import { ComputedRef } from 'vue';
5
+ import { DefineComponent } from 'vue';
6
+ import { MaybeRefOrGetter } from 'vue';
7
+ import { PublicProps } from 'vue';
8
+ import { Ref } from 'vue';
9
+
10
+ declare const __VLS_component: DefineComponent<Props, {
11
+ reload: () => void;
12
+ refresh: () => void;
13
+ loadData: () => Promise<void>;
14
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
15
+ changed: (args_0: {
16
+ item: any;
17
+ action: ActionConfig;
18
+ response: any;
19
+ }) => any;
20
+ "update:page": (page: number) => any;
21
+ "update:itemsPerPage": (limit: number) => any;
22
+ "update:items": (items: any[]) => any;
23
+ "update:sortBy": (sortBy: any[]) => any;
24
+ }, string, PublicProps, Readonly<Props> & Readonly<{
25
+ onChanged?: (args_0: {
26
+ item: any;
27
+ action: ActionConfig;
28
+ response: any;
29
+ }) => any;
30
+ "onUpdate:page"?: (page: number) => any;
31
+ "onUpdate:itemsPerPage"?: (limit: number) => any;
32
+ "onUpdate:items"?: (items: any[]) => any;
33
+ "onUpdate:sortBy"?: (sortBy: any[]) => any;
34
+ }>, {
35
+ itemsPerPageOptions: number[];
36
+ density: "default" | "comfortable" | "compact";
37
+ searchable: boolean;
38
+ refreshable: boolean;
39
+ filterPersistent: boolean;
40
+ itemsPerPage: number;
41
+ sortable: boolean;
42
+ hover: boolean;
43
+ mobileBreakpoint: number;
44
+ actionsOnHover: boolean;
45
+ paginationTotalVisible: number;
46
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {
47
+ gridContentRef: HTMLDivElement;
48
+ }, HTMLDivElement>;
49
+
50
+ declare const __VLS_component_2: DefineComponent<Props_2, {
51
+ reload: () => void;
52
+ refresh: () => void;
53
+ loadData: () => Promise<void>;
54
+ items: Ref<any[], any[]>;
55
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
56
+ changed: (args_0: {
57
+ item: any;
58
+ action: ActionConfig;
59
+ response: any;
60
+ }) => any;
61
+ "update:search": (search: string) => any;
62
+ "update:page": (page: number) => any;
63
+ "update:itemsPerPage": (limit: number) => any;
64
+ "update:items": (items: any[]) => any;
65
+ }, string, PublicProps, Readonly<Props_2> & Readonly<{
66
+ onChanged?: (args_0: {
67
+ item: any;
68
+ action: ActionConfig;
69
+ response: any;
70
+ }) => any;
71
+ "onUpdate:search"?: (search: string) => any;
72
+ "onUpdate:page"?: (page: number) => any;
73
+ "onUpdate:itemsPerPage"?: (limit: number) => any;
74
+ "onUpdate:items"?: (items: any[]) => any;
75
+ }>, {
76
+ itemsPerPageOptions: number[];
77
+ searchable: boolean;
78
+ refreshable: boolean;
79
+ filterPersistent: boolean;
80
+ itemsPerPage: number;
81
+ actionsOnHover: boolean;
82
+ paginationTotalVisible: number;
83
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {
84
+ listContentRef: HTMLDivElement;
85
+ }, HTMLDivElement>;
86
+
87
+ declare const __VLS_component_3: DefineComponent<XTreeProps, {
88
+ reload: typeof reload;
89
+ selectedItem: Ref<any, any>;
90
+ activeItems: Ref<any[], any[]>;
91
+ openedItems: Ref<any[], any[]>;
92
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
93
+ changed: (event: {
94
+ item: any;
95
+ action: ActionConfig;
96
+ response: any;
97
+ }) => any;
98
+ "update:selected": (value: any) => any;
99
+ "update:opened": (value: any[]) => any;
100
+ }, string, PublicProps, Readonly<XTreeProps> & Readonly<{
101
+ onChanged?: (event: {
102
+ item: any;
103
+ action: ActionConfig;
104
+ response: any;
105
+ }) => any;
106
+ "onUpdate:selected"?: (value: any) => any;
107
+ "onUpdate:opened"?: (value: any[]) => any;
108
+ }>, {
109
+ searchable: boolean;
110
+ refreshable: boolean;
111
+ filterPersistent: boolean;
112
+ itemValue: string;
113
+ itemTitle: string;
114
+ itemChildren: string;
115
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
116
+
117
+ declare const __VLS_component_4: DefineComponent<Props_5, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
118
+ "update:search": (value: string) => any;
119
+ refresh: () => any;
120
+ }, string, PublicProps, Readonly<Props_5> & Readonly<{
121
+ "onUpdate:search"?: (value: string) => any;
122
+ onRefresh?: () => any;
123
+ }>, {
124
+ loading: boolean;
125
+ searchable: boolean;
126
+ refreshable: boolean;
127
+ filterPersistent: boolean;
128
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {
129
+ searchField: unknown;
130
+ }, HTMLDivElement>;
131
+
132
+ declare const __VLS_component_5: DefineComponent<Props_7, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_7> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
133
+
134
+ declare function __VLS_template(): {
135
+ attrs: Partial<{}>;
136
+ slots: any;
137
+ refs: {
138
+ gridContentRef: HTMLDivElement;
139
+ };
140
+ rootEl: HTMLDivElement;
141
+ };
142
+
143
+ declare function __VLS_template_2(): {
144
+ attrs: Partial<{}>;
145
+ slots: {
146
+ title?(_: {}): any;
147
+ 'toolbar-actions'?(_: {}): any;
148
+ filter?(_: {}): any;
149
+ 'header-bottom'?(_: {}): any;
150
+ item?(_: {
151
+ item: any;
152
+ }): any;
153
+ item?(_: {
154
+ item: any;
155
+ }): any;
156
+ 'no-data'?(_: {}): any;
157
+ };
158
+ refs: {
159
+ listContentRef: HTMLDivElement;
160
+ };
161
+ rootEl: HTMLDivElement;
162
+ };
163
+
164
+ declare function __VLS_template_3(): {
165
+ attrs: Partial<{}>;
166
+ slots: any;
167
+ refs: {};
168
+ rootEl: any;
169
+ };
170
+
171
+ declare function __VLS_template_4(): {
172
+ attrs: Partial<{}>;
173
+ slots: {
174
+ title?(_: {}): any;
175
+ actions?(_: {}): any;
176
+ filter?(_: {}): any;
177
+ };
178
+ refs: {
179
+ searchField: unknown;
180
+ };
181
+ rootEl: HTMLDivElement;
182
+ };
183
+
184
+ declare function __VLS_template_5(): {
185
+ attrs: Partial<{}>;
186
+ slots: {
187
+ 'header-bottom'?(_: {}): any;
188
+ item?(_: {
189
+ item: any;
190
+ }): any;
191
+ 'no-data'?(_: {}): any;
192
+ };
193
+ refs: {};
194
+ rootEl: HTMLDivElement;
195
+ };
196
+
197
+ declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
198
+
199
+ declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
200
+
201
+ declare type __VLS_TemplateResult_3 = ReturnType<typeof __VLS_template_3>;
202
+
203
+ declare type __VLS_TemplateResult_4 = ReturnType<typeof __VLS_template_4>;
204
+
205
+ declare type __VLS_TemplateResult_5 = ReturnType<typeof __VLS_template_5>;
206
+
207
+ declare type __VLS_WithTemplateSlots<T, S> = T & {
208
+ new (): {
209
+ $slots: S;
210
+ };
211
+ };
212
+
213
+ declare type __VLS_WithTemplateSlots_2<T, S> = T & {
214
+ new (): {
215
+ $slots: S;
216
+ };
217
+ };
218
+
219
+ declare type __VLS_WithTemplateSlots_3<T, S> = T & {
220
+ new (): {
221
+ $slots: S;
222
+ };
223
+ };
224
+
225
+ declare type __VLS_WithTemplateSlots_4<T, S> = T & {
226
+ new (): {
227
+ $slots: S;
228
+ };
229
+ };
230
+
231
+ declare type __VLS_WithTemplateSlots_5<T, S> = T & {
232
+ new (): {
233
+ $slots: S;
234
+ };
235
+ };
236
+
237
+ export declare interface ActionConfig {
238
+ text?: string | ((item?: any) => string);
239
+ icon?: string;
240
+ type?: 'icon' | 'button';
241
+ color?: string;
242
+ disabled?: boolean | ((item?: any) => boolean);
243
+ visible?: boolean | ((item?: any) => boolean);
244
+ loading?: boolean;
245
+ handler?: (item?: any, action?: ActionConfig) => Promise<any> | any;
246
+ children?: ActionsConfig;
247
+ top?: boolean;
248
+ divider?: boolean;
249
+ fab?: boolean;
250
+ [key: string]: any;
251
+ }
252
+
253
+ export declare type ActionsConfig = Record<string, ActionConfig>;
254
+
255
+ export declare interface CrudGridOptions {
256
+ onLoad?: (params: LoadParams) => Promise<CrudGridResponse> | CrudGridResponse;
257
+ onError?: (error: Error) => void;
258
+ useRouter?: boolean;
259
+ filterPersistent?: boolean;
260
+ requiredFilters?: string[];
261
+ itemsPerPageOptions?: number[];
262
+ initialItemsPerPage?: number;
263
+ initialFilter?: Record<string, any>;
264
+ }
265
+
266
+ export declare interface CrudGridResponse {
267
+ data: any[];
268
+ meta: {
269
+ total: number;
270
+ [key: string]: any;
271
+ };
272
+ }
273
+
274
+ /**
275
+ * Get all default translations
276
+ * Useful for integrating with vue-i18n
277
+ */
278
+ export declare function getDefaultTranslations(): Record<string, string>;
279
+
280
+ /**
281
+ * Grid column definition
282
+ */
283
+ export declare interface GridColumn {
284
+ key: string;
285
+ label: string;
286
+ sortable?: boolean;
287
+ filterable?: boolean;
288
+ width?: string | number;
289
+ align?: 'start' | 'center' | 'end';
290
+ formatter?: (value: any, row: any) => string;
291
+ }
292
+
293
+ /**
294
+ * List schema for creating simple list views without full Vue components
295
+ *
296
+ * @example
297
+ * ```ts
298
+ * export function useProductsList(): ListSchema {
299
+ * const api = useProductsApi();
300
+ * const dialog = useDialog();
301
+ *
302
+ * return {
303
+ * title: 'Products',
304
+ * searchable: true,
305
+ * refreshable: true,
306
+ * itemsPerPage: 25,
307
+ * onLoad: async (params) => {
308
+ * const response = await api.getProducts(params);
309
+ * return { data: response.data, total: response.total };
310
+ * },
311
+ * rowActions: {
312
+ * edit: { icon: 'mdi-pencil', handler: (item) => dialog.show(productDialog, { id: item.id }) },
313
+ * delete: { icon: 'mdi-delete', color: 'error', handler: deleteProduct },
314
+ * },
315
+ * toolbarActions: {
316
+ * create: { text: 'New Product', icon: 'mdi-plus', handler: () => dialog.show(productDialog) },
317
+ * },
318
+ * itemComponent: ProductListItem,
319
+ * noDataText: 'No products found',
320
+ * };
321
+ * }
322
+ * ```
323
+ */
324
+ export declare interface ListSchema<TItem = any> {
325
+ /** List title */
326
+ title: string;
327
+ /** Enable search functionality */
328
+ searchable?: boolean;
329
+ /** Enable refresh button */
330
+ refreshable?: boolean;
331
+ /** Items per page */
332
+ itemsPerPage?: number;
333
+ /** Hide pagination controls */
334
+ hidePagination?: boolean;
335
+ /** Function to load data */
336
+ onLoad: (params: {
337
+ page: number;
338
+ limit: number;
339
+ search?: string;
340
+ }) => Promise<{
341
+ data: TItem[];
342
+ meta: {
343
+ total: number;
344
+ };
345
+ }>;
346
+ /** Row actions configuration */
347
+ rowActions?: ActionsConfig;
348
+ /** Toolbar actions configuration */
349
+ toolbarActions?: ActionsConfig;
350
+ /** Component to render each item */
351
+ itemComponent?: Component;
352
+ /** Props to pass to item component (default: { [itemKey]: item }) */
353
+ itemProps?: string | ((item: TItem) => Record<string, any>);
354
+ /** CSS class(es) to apply to item component */
355
+ itemClass?: string | string[] | Record<string, boolean>;
356
+ /** Render function for each item (alternative to itemComponent) */
357
+ itemRender?: (item: TItem) => any;
358
+ /** No data message */
359
+ noDataText?: string;
360
+ /** Error handler */
361
+ onError?: (error: Error) => void;
362
+ /** Filter object for reactive filtering */
363
+ filter?: Record<string, any>;
364
+ /** Additional XList props */
365
+ listOptions?: Record<string, any>;
366
+ }
367
+
368
+ export declare interface LoadParams {
369
+ page: number;
370
+ limit: number;
371
+ sortBy?: string;
372
+ sortDesc?: boolean;
373
+ search?: string;
374
+ [key: string]: any;
375
+ }
376
+
377
+ declare interface Props {
378
+ title?: string;
379
+ hideToolbar?: boolean;
380
+ searchable?: boolean;
381
+ refreshable?: boolean;
382
+ filterPersistent?: boolean;
383
+ headers?: GridColumn[];
384
+ items?: any[];
385
+ sortable?: boolean;
386
+ hover?: boolean;
387
+ density?: 'default' | 'comfortable' | 'compact';
388
+ mobileBreakpoint?: number;
389
+ rowActions?: Record<string, ActionConfig>;
390
+ toolbarActions?: Record<string, ActionConfig>;
391
+ actionsOnHover?: boolean;
392
+ onLoad?: (params: any) => Promise<{
393
+ data: any[];
394
+ meta: {
395
+ total: number;
396
+ };
397
+ }>;
398
+ onError?: (error: Error) => void;
399
+ filter?: Record<string, any>;
400
+ requiredFilters?: string[];
401
+ itemsPerPage?: number;
402
+ itemsPerPageOptions?: number[];
403
+ paginationTotalVisible?: number;
404
+ hidePagination?: boolean;
405
+ total?: number;
406
+ }
407
+
408
+ declare interface Props_2 {
409
+ title?: string;
410
+ hideToolbar?: boolean;
411
+ searchable?: boolean;
412
+ refreshable?: boolean;
413
+ filterPersistent?: boolean;
414
+ items?: any[];
415
+ rowActions?: Record<string, ActionConfig>;
416
+ toolbarActions?: Record<string, ActionConfig>;
417
+ actionsOnHover?: boolean;
418
+ onLoad?: (params: any) => Promise<{
419
+ data: any[];
420
+ meta: {
421
+ total: number;
422
+ };
423
+ }>;
424
+ onError?: (error: Error) => void;
425
+ filter?: Record<string, any>;
426
+ requiredFilters?: string[];
427
+ itemsPerPage?: number;
428
+ itemsPerPageOptions?: number[];
429
+ paginationTotalVisible?: number;
430
+ hidePagination?: boolean;
431
+ total?: number;
432
+ page?: number;
433
+ search?: string;
434
+ }
435
+
436
+ declare interface Props_3 {
437
+ actions?: Record<string, ActionConfig>;
438
+ item?: any;
439
+ icon?: boolean;
440
+ text?: boolean;
441
+ onError?: (error: Error) => void;
442
+ }
443
+
444
+ declare interface Props_4 {
445
+ actions?: Record<string, ActionConfig>;
446
+ item?: any;
447
+ icon?: string;
448
+ text?: string;
449
+ onError?: (error: Error) => void;
450
+ }
451
+
452
+ declare interface Props_5 {
453
+ title?: string;
454
+ loading?: boolean;
455
+ searchable?: boolean;
456
+ refreshable?: boolean;
457
+ filterPersistent?: boolean;
458
+ search?: string;
459
+ searchLabel?: string;
460
+ }
461
+
462
+ declare interface Props_6 {
463
+ page: number;
464
+ pageCount: number;
465
+ totalVisible?: number;
466
+ itemsPerPage?: number;
467
+ itemsPerPageOptions?: number[];
468
+ total?: number;
469
+ itemsPerPageText?: string;
470
+ itemsRangeTextTemplate?: string;
471
+ }
472
+
473
+ declare interface Props_7 {
474
+ schema: MaybeRefOrGetter<ListSchema>;
475
+ }
476
+
477
+ /**
478
+ * Register custom translations
479
+ * Useful for adding translations without vue-i18n
480
+ *
481
+ * @param translations - Object with translation key-value pairs
482
+ */
483
+ export declare function registerTranslations(translations: Record<string, string>): void;
484
+
485
+ declare function reload(): Promise<void>;
486
+
487
+ export declare const SchemaList: __VLS_WithTemplateSlots_5<typeof __VLS_component_5, __VLS_TemplateResult_5["slots"]>;
488
+
489
+ export declare function useActions(options?: UseActionsOptions): {
490
+ loadingState: Ref<Record<string, boolean>, Record<string, boolean>>;
491
+ getParam: <T>(param: T | ((item?: any) => T) | undefined, item: any, defaultValue: T) => T;
492
+ handleActionClick: (action: ActionConfig, item: any | undefined, key: string) => Promise<void>;
493
+ isActionVisible: (action: ActionConfig, item: any) => boolean;
494
+ isActionDisabled: (action: ActionConfig, item: any) => boolean;
495
+ getActionText: (action: ActionConfig, item: any) => string;
496
+ };
497
+
498
+ export declare interface UseActionsOptions {
499
+ onError?: (error: Error) => void;
500
+ defaultHandler?: (item?: any, action?: ActionConfig) => Promise<any> | any;
501
+ }
502
+
503
+ export declare function useCrudGrid(options?: CrudGridOptions): {
504
+ loading: Ref<boolean, boolean>;
505
+ page: Ref<number, number>;
506
+ limit: Ref<number, number>;
507
+ sortBy: Ref<any[], any[]>;
508
+ sortDesc: Ref<boolean, boolean>;
509
+ searchValue: Ref<string, string>;
510
+ filterValue: Ref<Record<string, any>, Record<string, any>>;
511
+ items: Ref<any[], any[]>;
512
+ total: Ref<number, number>;
513
+ pageCount: ComputedRef<number>;
514
+ loadParams: ComputedRef<LoadParams>;
515
+ itemsPerPageOptions: number[];
516
+ loadData: () => Promise<void>;
517
+ reload: () => void;
518
+ goToFirstPageAndLoad: () => void;
519
+ };
520
+
521
+ export declare function useSearch(props: {
522
+ search?: string;
523
+ }, emit: (event: 'update:search', value: string) => void): {
524
+ searchModel: Ref<string, string>;
525
+ searchMode: Ref<boolean, boolean>;
526
+ searchField: Ref<any, any>;
527
+ clearSearch: () => void;
528
+ hideSearch: () => void;
529
+ showSearch: () => Promise<void>;
530
+ };
531
+
532
+ /**
533
+ * Lightweight i18n composable for vuetify-shared
534
+ *
535
+ * This composable:
536
+ * 1. Checks if vue-i18n is available in the app
537
+ * 2. Falls back to default English translations if not
538
+ * 3. Allows overriding via props
539
+ *
540
+ * Usage:
541
+ * ```ts
542
+ * const { t } = useTranslation();
543
+ * const text = t('vuetify-shared.no-items');
544
+ * ```
545
+ */
546
+ export declare function useTranslation(): {
547
+ t: (key: string, params?: Record<string, any> | string, fallback?: string) => string;
548
+ getLocale: () => string;
549
+ };
550
+
551
+ export declare const version = "0.0.1";
552
+
553
+ export declare const XActions: DefineComponent<Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
554
+ changed: (args_0: {
555
+ item: any;
556
+ action: ActionConfig;
557
+ response: any;
558
+ }) => any;
559
+ }, string, PublicProps, Readonly<Props_3> & Readonly<{
560
+ onChanged?: (args_0: {
561
+ item: any;
562
+ action: ActionConfig;
563
+ response: any;
564
+ }) => any;
565
+ }>, {
566
+ text: boolean;
567
+ icon: boolean;
568
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
569
+
570
+ export declare const XGrid: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
571
+
572
+ export declare const XGridToolbar: __VLS_WithTemplateSlots_4<typeof __VLS_component_4, __VLS_TemplateResult_4["slots"]>;
573
+
574
+ export declare const XList: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
575
+
576
+ export declare const XMenuActions: DefineComponent<Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
577
+ changed: (args_0: {
578
+ item: any;
579
+ action: ActionConfig;
580
+ response: any;
581
+ }) => any;
582
+ }, string, PublicProps, Readonly<Props_4> & Readonly<{
583
+ onChanged?: (args_0: {
584
+ item: any;
585
+ action: ActionConfig;
586
+ response: any;
587
+ }) => any;
588
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
589
+
590
+ export declare const XPagination: DefineComponent<Props_6, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
591
+ "update:page": (page: number) => any;
592
+ "update:itemsPerPage": (limit: number) => any;
593
+ }, string, PublicProps, Readonly<Props_6> & Readonly<{
594
+ "onUpdate:page"?: (page: number) => any;
595
+ "onUpdate:itemsPerPage"?: (limit: number) => any;
596
+ }>, {
597
+ totalVisible: number;
598
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
599
+
600
+ export declare const XTree: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
601
+
602
+ declare interface XTreeProps {
603
+ title?: string;
604
+ items?: any[];
605
+ selected?: any;
606
+ opened?: any[];
607
+ itemTitle?: string;
608
+ itemValue?: string;
609
+ itemChildren?: string;
610
+ toolbarActions?: Record<string, ActionConfig>;
611
+ rowActions?: Record<string, ActionConfig>;
612
+ searchable?: boolean;
613
+ refreshable?: boolean;
614
+ filterPersistent?: boolean;
615
+ onLoad?: (params: any) => Promise<{
616
+ data: any[];
617
+ meta: {
618
+ total: number;
619
+ };
620
+ }>;
621
+ treeProps?: Record<string, any>;
622
+ noDataText?: string;
623
+ }
624
+
625
+ export { }