@object-ui/plugin-list 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/.turbo/turbo-build.log +18 -0
- package/LICENSE +21 -0
- package/README.md +127 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +53502 -0
- package/dist/index.umd.cjs +95 -0
- package/dist/plugin-list.css +1 -0
- package/dist/src/ListView.d.ts +21 -0
- package/dist/src/ListView.d.ts.map +1 -0
- package/dist/src/ObjectGallery.d.ts +2 -0
- package/dist/src/ObjectGallery.d.ts.map +1 -0
- package/dist/src/ViewSwitcher.d.ts +17 -0
- package/dist/src/ViewSwitcher.d.ts.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/package.json +53 -0
- package/src/ListView.tsx +503 -0
- package/src/ObjectGallery.tsx +111 -0
- package/src/ViewSwitcher.tsx +92 -0
- package/src/__tests__/ListView.test.tsx +215 -0
- package/src/__tests__/ListViewPersistence.test.tsx +126 -0
- package/src/index.tsx +47 -0
- package/src/registration.test.tsx +9 -0
- package/tsconfig.json +18 -0
- package/vite.config.ts +56 -0
- package/vitest.config.ts +13 -0
- package/vitest.setup.ts +1 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
> @object-ui/plugin-list@0.5.0 build /home/runner/work/objectui/objectui/packages/plugin-list
|
|
3
|
+
> vite build
|
|
4
|
+
|
|
5
|
+
[36mvite v7.3.1 [32mbuilding client environment for production...[36m[39m
|
|
6
|
+
transforming...
|
|
7
|
+
[32m✓[39m 3553 modules transformed.
|
|
8
|
+
rendering chunks...
|
|
9
|
+
[32m
|
|
10
|
+
[36m[vite:dts][32m Start generate declaration files...[39m
|
|
11
|
+
computing gzip size...
|
|
12
|
+
[32m[36m[vite:dts][32m Declaration files built in 21552ms.
|
|
13
|
+
[39m
|
|
14
|
+
[2mdist/[22m[35mplugin-list.css [39m[1m[2m 108.36 kB[22m[1m[22m[2m │ gzip: 17.59 kB[22m
|
|
15
|
+
[2mdist/[22m[36mindex.js [39m[1m[33m1,717.24 kB[39m[22m[2m │ gzip: 403.86 kB[22m
|
|
16
|
+
[2mdist/[22m[35mplugin-list.css [39m[1m[2m 108.36 kB[22m[1m[22m[2m │ gzip: 17.59 kB[22m
|
|
17
|
+
[2mdist/[22m[36mindex.umd.cjs [39m[1m[33m1,239.32 kB[39m[22m[2m │ gzip: 342.97 kB[22m
|
|
18
|
+
[32m✓ built in 1m 6s[39m
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ObjectQL
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# @object-ui/plugin-list
|
|
2
|
+
|
|
3
|
+
ListView plugin for ObjectUI - A unified view component with view type switching, filtering, sorting, and view configuration persistence.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **View Type Switching**: Switch between Grid, List, Kanban, Calendar, and Chart views
|
|
8
|
+
- **View Persistence**: Automatically saves user's view preference
|
|
9
|
+
- **Integrated Search**: Full-text search across records
|
|
10
|
+
- **Filtering**: Advanced filter UI (expandable filter panel)
|
|
11
|
+
- **Sorting**: Sort by any field, toggle ascending/descending
|
|
12
|
+
- **Flexible Configuration**: Configure available view types per object
|
|
13
|
+
- **Custom Templates**: Support for custom view options per view type
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add @object-ui/plugin-list
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Basic Example
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { ListView } from '@object-ui/plugin-list';
|
|
27
|
+
|
|
28
|
+
function ContactsView() {
|
|
29
|
+
return (
|
|
30
|
+
<ListView
|
|
31
|
+
schema={{
|
|
32
|
+
type: 'list-view',
|
|
33
|
+
objectName: 'contacts',
|
|
34
|
+
viewType: 'grid',
|
|
35
|
+
fields: ['name', 'email', 'phone', 'company'],
|
|
36
|
+
sort: [{ field: 'name', order: 'asc' }],
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### With Multiple View Types
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
<ListView
|
|
47
|
+
schema={{
|
|
48
|
+
type: 'list-view',
|
|
49
|
+
objectName: 'deals',
|
|
50
|
+
viewType: 'kanban',
|
|
51
|
+
fields: ['name', 'amount', 'stage', 'close_date'],
|
|
52
|
+
options: {
|
|
53
|
+
kanban: {
|
|
54
|
+
groupField: 'stage',
|
|
55
|
+
titleField: 'name',
|
|
56
|
+
},
|
|
57
|
+
calendar: {
|
|
58
|
+
startDateField: 'close_date',
|
|
59
|
+
titleField: 'name',
|
|
60
|
+
},
|
|
61
|
+
chart: {
|
|
62
|
+
chartType: 'bar',
|
|
63
|
+
xAxisField: 'stage',
|
|
64
|
+
yAxisFields: ['amount'],
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### With Callbacks
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
<ListView
|
|
75
|
+
schema={{
|
|
76
|
+
type: 'list-view',
|
|
77
|
+
objectName: 'tasks',
|
|
78
|
+
fields: ['title', 'status', 'priority'],
|
|
79
|
+
}}
|
|
80
|
+
onViewChange={(view) => console.log('View changed to:', view)}
|
|
81
|
+
onSearchChange={(search) => console.log('Search:', search)}
|
|
82
|
+
onSortChange={(sort) => console.log('Sort:', sort)}
|
|
83
|
+
onFilterChange={(filters) => console.log('Filters:', filters)}
|
|
84
|
+
/>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Schema
|
|
88
|
+
|
|
89
|
+
The ListView component accepts a `ListViewSchema`:
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
interface ListViewSchema {
|
|
93
|
+
type: 'list-view';
|
|
94
|
+
objectName: string;
|
|
95
|
+
viewType?: 'grid' | 'kanban' | 'calendar' | 'gantt' | 'map' | 'chart';
|
|
96
|
+
fields?: string[];
|
|
97
|
+
filters?: Array<any[] | string>;
|
|
98
|
+
sort?: Array<{ field: string; order: 'asc' | 'desc' }>;
|
|
99
|
+
options?: {
|
|
100
|
+
grid?: Record<string, any>;
|
|
101
|
+
list?: Record<string, any>;
|
|
102
|
+
kanban?: {
|
|
103
|
+
groupField: string;
|
|
104
|
+
titleField?: string;
|
|
105
|
+
cardFields?: string[];
|
|
106
|
+
};
|
|
107
|
+
calendar?: {
|
|
108
|
+
startDateField: string;
|
|
109
|
+
endDateField?: string;
|
|
110
|
+
titleField: string;
|
|
111
|
+
};
|
|
112
|
+
chart?: {
|
|
113
|
+
chartType: 'bar' | 'line' | 'pie' | 'area';
|
|
114
|
+
xAxisField: string;
|
|
115
|
+
yAxisFields: string[];
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## View Persistence
|
|
122
|
+
|
|
123
|
+
The ListView automatically persists the user's view type preference in localStorage using the key `listview-{objectName}-view`.
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT
|
package/dist/index.d.ts
ADDED