shadcn-data-views 1.0.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.
@@ -0,0 +1,47 @@
1
+ interface FieldOption {
2
+ id: string;
3
+ name: string;
4
+ color?: string;
5
+ }
6
+ interface FieldSchema {
7
+ id: string;
8
+ name: string;
9
+ type: 'text' | 'number' | 'select' | 'multiSelect' | 'date' | 'checkbox';
10
+ isPrimary?: boolean;
11
+ options?: FieldOption[];
12
+ }
13
+ interface TableSchema {
14
+ id: string;
15
+ name: string;
16
+ icon?: string;
17
+ fields: FieldSchema[];
18
+ }
19
+ declare const tableSchema: TableSchema;
20
+ declare function getSelectField(schema: TableSchema): FieldSchema | undefined;
21
+ declare function getDateField(schema: TableSchema): FieldSchema | undefined;
22
+ declare function getPrimaryField(schema: TableSchema): FieldSchema | undefined;
23
+
24
+ interface IRecord {
25
+ id: string;
26
+ fields: Record<string, any>;
27
+ createdAt: string;
28
+ }
29
+ interface IDataViewsClient {
30
+ getRecords(): Promise<IRecord[]>;
31
+ createRecord(record: Partial<IRecord>): Promise<IRecord>;
32
+ updateRecord(id: string, record: Partial<IRecord>): Promise<IRecord>;
33
+ deleteRecord(id: string): Promise<void>;
34
+ }
35
+
36
+ interface DataViewsConfig {
37
+ defaultView?: 'grid' | 'kanban' | 'gallery' | 'calendar' | 'form';
38
+ }
39
+
40
+ interface DataViewsProps {
41
+ schema: TableSchema;
42
+ dbClient: IDataViewsClient;
43
+ config?: DataViewsConfig;
44
+ }
45
+ declare function DataViews({ schema, dbClient, config }: DataViewsProps): JSX.Element;
46
+
47
+ export { DataViews, type DataViewsConfig, type DataViewsProps, type FieldOption, type FieldSchema, type IDataViewsClient, type IRecord, type TableSchema, getDateField, getPrimaryField, getSelectField, tableSchema };
@@ -0,0 +1,47 @@
1
+ interface FieldOption {
2
+ id: string;
3
+ name: string;
4
+ color?: string;
5
+ }
6
+ interface FieldSchema {
7
+ id: string;
8
+ name: string;
9
+ type: 'text' | 'number' | 'select' | 'multiSelect' | 'date' | 'checkbox';
10
+ isPrimary?: boolean;
11
+ options?: FieldOption[];
12
+ }
13
+ interface TableSchema {
14
+ id: string;
15
+ name: string;
16
+ icon?: string;
17
+ fields: FieldSchema[];
18
+ }
19
+ declare const tableSchema: TableSchema;
20
+ declare function getSelectField(schema: TableSchema): FieldSchema | undefined;
21
+ declare function getDateField(schema: TableSchema): FieldSchema | undefined;
22
+ declare function getPrimaryField(schema: TableSchema): FieldSchema | undefined;
23
+
24
+ interface IRecord {
25
+ id: string;
26
+ fields: Record<string, any>;
27
+ createdAt: string;
28
+ }
29
+ interface IDataViewsClient {
30
+ getRecords(): Promise<IRecord[]>;
31
+ createRecord(record: Partial<IRecord>): Promise<IRecord>;
32
+ updateRecord(id: string, record: Partial<IRecord>): Promise<IRecord>;
33
+ deleteRecord(id: string): Promise<void>;
34
+ }
35
+
36
+ interface DataViewsConfig {
37
+ defaultView?: 'grid' | 'kanban' | 'gallery' | 'calendar' | 'form';
38
+ }
39
+
40
+ interface DataViewsProps {
41
+ schema: TableSchema;
42
+ dbClient: IDataViewsClient;
43
+ config?: DataViewsConfig;
44
+ }
45
+ declare function DataViews({ schema, dbClient, config }: DataViewsProps): JSX.Element;
46
+
47
+ export { DataViews, type DataViewsConfig, type DataViewsProps, type FieldOption, type FieldSchema, type IDataViewsClient, type IRecord, type TableSchema, getDateField, getPrimaryField, getSelectField, tableSchema };