@shifl-inc/ui 0.1.0 → 0.2.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.
@@ -1,69 +1,99 @@
1
1
  export type GridViewType = 'regular' | 'compact' | 'comfortable';
2
+ export interface GridAction {
3
+ key: string;
4
+ label: string;
5
+ icon?: string | (() => unknown);
6
+ danger?: boolean;
7
+ show?: (row: Record<string, unknown>) => boolean;
8
+ }
9
+ export interface GridActionColumn {
10
+ type: 'action';
11
+ icon?: string | ((row: Record<string, unknown>) => unknown);
12
+ actions: GridAction[] | ((row: Record<string, unknown>) => GridAction[]);
13
+ width?: string;
14
+ frozen?: boolean;
15
+ order?: number;
16
+ label?: string;
17
+ }
18
+ export interface SmartTrackingColumn {
19
+ type: 'smart-tracking';
20
+ dataKey: string;
21
+ icon?: string | (() => unknown);
22
+ width?: string;
23
+ }
2
24
  export interface GridColumn {
3
- key: string;
4
- label: string;
5
- order?: number;
6
- sortable?: boolean;
7
- width?: string;
8
- height?: string;
9
- isDefault?: boolean;
10
- frozen?: boolean;
11
- /** legacy alias */
12
- fixed?: boolean;
13
- visible?: boolean;
14
- cellMetadata?: {
15
- format?: string;
16
- emptyState?: string;
17
- };
25
+ key: string;
26
+ label: string;
27
+ order?: number;
28
+ sortable?: boolean;
29
+ width?: string;
30
+ height?: string;
31
+ isDefault?: boolean;
32
+ frozen?: boolean;
33
+ /** legacy alias */
34
+ fixed?: boolean;
35
+ visible?: boolean;
36
+ /** Protected columns are hidden from column editor and cannot be modified */
37
+ protected?: boolean;
38
+ cellMetadata?: {
39
+ format?: string;
40
+ emptyState?: string;
41
+ };
42
+ /** Action column configuration */
43
+ actionColumn?: GridActionColumn;
44
+ /** Smart Tracking column configuration */
45
+ smartTrackingColumn?: SmartTrackingColumn;
18
46
  }
19
47
  export interface GridFilter {
20
- key: string;
21
- label: string;
22
- placeholder?: string;
23
- inputType?: string;
24
- dataType?: string;
25
- operator?: string;
26
- value?: unknown;
48
+ key: string;
49
+ label: string;
50
+ placeholder?: string;
51
+ inputType?: string;
52
+ dataType?: string;
53
+ operator?: string;
54
+ value?: unknown;
27
55
  }
28
56
  export interface GridSort {
29
- key: string;
30
- order: 'asc' | 'desc';
57
+ key: string;
58
+ order: 'asc' | 'desc';
31
59
  }
32
60
  export interface PaginationMeta {
33
- show?: boolean;
34
- currentPage?: number;
35
- lastPage?: number;
36
- firstPageUrl?: string;
37
- lastPageUrl?: string;
38
- nextPageUrl?: string | null;
39
- prevPageUrl?: string | null;
40
- from?: number;
41
- to?: number;
42
- perPage?: number;
43
- total?: number;
61
+ show?: boolean;
62
+ currentPage?: number;
63
+ lastPage?: number;
64
+ firstPageUrl?: string;
65
+ lastPageUrl?: string;
66
+ nextPageUrl?: string | null;
67
+ prevPageUrl?: string | null;
68
+ from?: number;
69
+ to?: number;
70
+ perPage?: number;
71
+ total?: number;
44
72
  }
73
+ export type SearchMode = 'client' | 'server';
45
74
  export interface GridConfig<T = Record<string, unknown>> {
46
- id?: string;
47
- name?: string;
48
- customerId?: number;
49
- model?: string;
50
- resourceId?: string | number | null;
51
- creatorId?: number;
52
- pageLocation?: string;
53
- view?: GridViewType;
54
- apiUrl?: string;
55
- columns: GridColumn[];
56
- search?: string[];
57
- filters?: GridFilter[];
58
- sort?: GridSort;
59
- paginationMeta?: PaginationMeta;
60
- rows?: T[];
75
+ id?: string;
76
+ name?: string;
77
+ customerId?: number;
78
+ model?: string;
79
+ resourceId?: string | number | null;
80
+ creatorId?: number;
81
+ pageLocation?: string;
82
+ view?: GridViewType;
83
+ apiUrl?: string;
84
+ columns: GridColumn[];
85
+ search?: string[];
86
+ searchMode?: SearchMode;
87
+ filters?: GridFilter[];
88
+ sort?: GridSort;
89
+ paginationMeta?: PaginationMeta;
90
+ rows?: T[];
61
91
  }
62
92
  export interface NormalizedGridColumn extends GridColumn {
63
- frozen: boolean;
64
- visible: boolean;
93
+ frozen: boolean;
94
+ visible: boolean;
65
95
  }
66
96
  export interface NormalizedGridConfig<T = Record<string, unknown>> extends GridConfig<T> {
67
- columns: NormalizedGridColumn[];
68
- rows: T[];
97
+ columns: NormalizedGridColumn[];
98
+ rows: T[];
69
99
  }
@@ -1,10 +1,10 @@
1
1
  export interface ThemeTokens {
2
- surface: string;
3
- surfaceAlt: string;
4
- border: string;
5
- text: string;
6
- textMuted: string;
7
- accent: string;
8
- accentStrong: string;
9
- focus: string;
2
+ surface: string;
3
+ surfaceAlt: string;
4
+ border: string;
5
+ text: string;
6
+ textMuted: string;
7
+ accent: string;
8
+ accentStrong: string;
9
+ focus: string;
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shifl-inc/ui",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Reusable Vue 3 UI components for Shifl.",
5
5
  "type": "module",
6
6
  "main": "./dist/shifl-ui.umd.cjs",