@object-ui/plugin-detail 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 +197 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +53257 -0
- package/dist/index.umd.cjs +95 -0
- package/dist/plugin-detail.css +1 -0
- package/dist/src/DetailSection.d.ts +16 -0
- package/dist/src/DetailSection.d.ts.map +1 -0
- package/dist/src/DetailTabs.d.ts +16 -0
- package/dist/src/DetailTabs.d.ts.map +1 -0
- package/dist/src/DetailView.d.ts +19 -0
- package/dist/src/DetailView.d.ts.map +1 -0
- package/dist/src/RelatedList.d.ts +19 -0
- package/dist/src/RelatedList.d.ts.map +1 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.d.ts.map +1 -0
- package/package.json +53 -0
- package/src/DetailSection.tsx +121 -0
- package/src/DetailTabs.tsx +73 -0
- package/src/DetailView.tsx +212 -0
- package/src/RelatedList.tsx +93 -0
- package/src/__tests__/DetailView.test.tsx +249 -0
- package/src/index.tsx +86 -0
- package/src/registration.test.tsx +18 -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-detail@0.5.0 build /home/runner/work/objectui/objectui/packages/plugin-detail
|
|
3
|
+
> vite build
|
|
4
|
+
|
|
5
|
+
[36mvite v7.3.1 [32mbuilding client environment for production...[36m[39m
|
|
6
|
+
transforming...
|
|
7
|
+
[32m✓[39m 3554 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 21826ms.
|
|
13
|
+
[39m
|
|
14
|
+
[2mdist/[22m[35mplugin-detail.css [39m[1m[2m 105.20 kB[22m[1m[22m[2m │ gzip: 17.28 kB[22m
|
|
15
|
+
[2mdist/[22m[36mindex.js [39m[1m[33m1,708.68 kB[39m[22m[2m │ gzip: 401.70 kB[22m
|
|
16
|
+
[2mdist/[22m[35mplugin-detail.css [39m[1m[2m 105.20 kB[22m[1m[22m[2m │ gzip: 17.28 kB[22m
|
|
17
|
+
[2mdist/[22m[36mindex.umd.cjs [39m[1m[33m1,233.76 kB[39m[22m[2m │ gzip: 341.09 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,197 @@
|
|
|
1
|
+
# @object-ui/plugin-detail
|
|
2
|
+
|
|
3
|
+
DetailView plugin for ObjectUI - A comprehensive detail page component with field grouping, tabs, related lists, and action buttons.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Field Grouping/Sections**: Organize fields into logical sections with titles
|
|
8
|
+
- **Collapsible Sections**: Make sections collapsible to save space
|
|
9
|
+
- **Tab Navigation**: Organize content into tabs for better UX
|
|
10
|
+
- **Related Lists**: Display related records (e.g., contacts for an account)
|
|
11
|
+
- **Action Buttons**: Edit, Delete, and custom action buttons
|
|
12
|
+
- **Readonly/Edit Mode**: Toggle between view and edit modes
|
|
13
|
+
- **Back Navigation**: Built-in back button with customizable behavior
|
|
14
|
+
- **Loading States**: Skeleton loading for async data
|
|
15
|
+
- **Custom Headers/Footers**: Flexible customization options
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm add @object-ui/plugin-detail
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Basic Example
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { DetailView } from '@object-ui/plugin-detail';
|
|
29
|
+
|
|
30
|
+
function ContactDetail() {
|
|
31
|
+
return (
|
|
32
|
+
<DetailView
|
|
33
|
+
schema={{
|
|
34
|
+
type: 'detail-view',
|
|
35
|
+
title: 'Contact Details',
|
|
36
|
+
data: {
|
|
37
|
+
name: 'John Doe',
|
|
38
|
+
email: 'john@example.com',
|
|
39
|
+
phone: '+1234567890',
|
|
40
|
+
company: 'Acme Corp',
|
|
41
|
+
},
|
|
42
|
+
fields: [
|
|
43
|
+
{ name: 'name', label: 'Full Name' },
|
|
44
|
+
{ name: 'email', label: 'Email' },
|
|
45
|
+
{ name: 'phone', label: 'Phone' },
|
|
46
|
+
{ name: 'company', label: 'Company' },
|
|
47
|
+
],
|
|
48
|
+
showBack: true,
|
|
49
|
+
showEdit: true,
|
|
50
|
+
showDelete: true,
|
|
51
|
+
}}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### With Sections
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<DetailView
|
|
61
|
+
schema={{
|
|
62
|
+
type: 'detail-view',
|
|
63
|
+
title: 'Account Details',
|
|
64
|
+
sections: [
|
|
65
|
+
{
|
|
66
|
+
title: 'Basic Information',
|
|
67
|
+
icon: '📋',
|
|
68
|
+
fields: [
|
|
69
|
+
{ name: 'name', label: 'Account Name' },
|
|
70
|
+
{ name: 'industry', label: 'Industry' },
|
|
71
|
+
{ name: 'website', label: 'Website' },
|
|
72
|
+
],
|
|
73
|
+
columns: 2,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
title: 'Address',
|
|
77
|
+
collapsible: true,
|
|
78
|
+
defaultCollapsed: false,
|
|
79
|
+
fields: [
|
|
80
|
+
{ name: 'street', label: 'Street' },
|
|
81
|
+
{ name: 'city', label: 'City' },
|
|
82
|
+
{ name: 'state', label: 'State' },
|
|
83
|
+
{ name: 'zipcode', label: 'Zip Code' },
|
|
84
|
+
],
|
|
85
|
+
columns: 2,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
data: accountData,
|
|
89
|
+
}}
|
|
90
|
+
/>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### With Tabs and Related Lists
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<DetailView
|
|
97
|
+
schema={{
|
|
98
|
+
type: 'detail-view',
|
|
99
|
+
title: 'Account: Acme Corp',
|
|
100
|
+
objectName: 'accounts',
|
|
101
|
+
resourceId: '12345',
|
|
102
|
+
fields: [
|
|
103
|
+
{ name: 'name', label: 'Account Name' },
|
|
104
|
+
{ name: 'industry', label: 'Industry' },
|
|
105
|
+
],
|
|
106
|
+
tabs: [
|
|
107
|
+
{
|
|
108
|
+
key: 'details',
|
|
109
|
+
label: 'Details',
|
|
110
|
+
icon: '📄',
|
|
111
|
+
content: {
|
|
112
|
+
type: 'detail-section',
|
|
113
|
+
fields: [
|
|
114
|
+
{ name: 'description', label: 'Description' },
|
|
115
|
+
{ name: 'employees', label: 'Employee Count' },
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
key: 'activity',
|
|
121
|
+
label: 'Activity',
|
|
122
|
+
badge: '12',
|
|
123
|
+
content: {
|
|
124
|
+
type: 'activity-timeline',
|
|
125
|
+
data: activityData,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
related: [
|
|
130
|
+
{
|
|
131
|
+
title: 'Contacts',
|
|
132
|
+
type: 'table',
|
|
133
|
+
api: '/api/accounts/12345/contacts',
|
|
134
|
+
columns: ['name', 'email', 'phone', 'title'],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
title: 'Opportunities',
|
|
138
|
+
type: 'table',
|
|
139
|
+
api: '/api/accounts/12345/opportunities',
|
|
140
|
+
columns: ['name', 'amount', 'stage', 'close_date'],
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
showEdit: true,
|
|
144
|
+
showDelete: true,
|
|
145
|
+
}}
|
|
146
|
+
onEdit={() => navigate('/accounts/12345/edit')}
|
|
147
|
+
onDelete={() => deleteAccount('12345')}
|
|
148
|
+
onBack={() => navigate('/accounts')}
|
|
149
|
+
/>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Schema
|
|
153
|
+
|
|
154
|
+
The DetailView component accepts a `DetailViewSchema`:
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
interface DetailViewSchema {
|
|
158
|
+
type: 'detail-view';
|
|
159
|
+
title?: string;
|
|
160
|
+
objectName?: string;
|
|
161
|
+
resourceId?: string | number;
|
|
162
|
+
api?: string;
|
|
163
|
+
data?: any;
|
|
164
|
+
sections?: DetailViewSection[];
|
|
165
|
+
fields?: DetailViewField[];
|
|
166
|
+
tabs?: DetailViewTab[];
|
|
167
|
+
related?: RelatedList[];
|
|
168
|
+
actions?: ActionSchema[];
|
|
169
|
+
showBack?: boolean;
|
|
170
|
+
showEdit?: boolean;
|
|
171
|
+
showDelete?: boolean;
|
|
172
|
+
backUrl?: string;
|
|
173
|
+
editUrl?: string;
|
|
174
|
+
deleteConfirmation?: string;
|
|
175
|
+
loading?: boolean;
|
|
176
|
+
header?: SchemaNode;
|
|
177
|
+
footer?: SchemaNode;
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Components
|
|
182
|
+
|
|
183
|
+
### DetailSection
|
|
184
|
+
|
|
185
|
+
Renders a group of fields with optional collapsing.
|
|
186
|
+
|
|
187
|
+
### DetailTabs
|
|
188
|
+
|
|
189
|
+
Tab navigation for organizing content into different views.
|
|
190
|
+
|
|
191
|
+
### RelatedList
|
|
192
|
+
|
|
193
|
+
Displays related records in list, grid, or table format.
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
MIT
|
package/dist/index.d.ts
ADDED