proje-react-panel 1.1.4 → 1.1.5
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/.cursor/rules.md +21 -95
- package/.vscode/settings.json +6 -1
- package/PTD.md +124 -24
- package/dist/components/DetailsPage.d.ts +2 -2
- package/dist/components/Login.d.ts +2 -2
- package/dist/components/Panel.d.ts +2 -2
- package/dist/components/form/FormField.d.ts +1 -5
- package/dist/components/form/FormHeader.d.ts +10 -0
- package/dist/components/form/FormPage.d.ts +12 -1
- package/dist/components/form/Select.d.ts +1 -1
- package/dist/components/form/SelectStyles.d.ts +3 -3
- package/dist/components/list/CellField.d.ts +2 -3
- package/dist/components/list/EmptyList.d.ts +1 -1
- package/dist/decorators/details/Details.d.ts +1 -2
- package/dist/decorators/form/Form.d.ts +3 -5
- package/dist/decorators/form/Input.d.ts +10 -2
- package/dist/decorators/form/inputs/SelectInput.d.ts +8 -7
- package/dist/decorators/list/Cell.d.ts +3 -3
- package/dist/decorators/list/List.d.ts +3 -4
- package/dist/decorators/list/getListPageMeta.d.ts +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/store/store.d.ts +1 -0
- package/dist/utils/decerators.d.ts +3 -3
- package/eslint.config.mjs +60 -0
- package/package.json +6 -3
- package/src/api/CrudApi.ts +59 -53
- package/src/components/DetailsPage.tsx +8 -6
- package/src/components/Login.tsx +11 -4
- package/src/components/Panel.tsx +3 -3
- package/src/components/form/Checkbox.tsx +1 -1
- package/src/components/form/FormField.tsx +13 -9
- package/src/components/form/FormHeader.tsx +18 -0
- package/src/components/form/FormPage.tsx +146 -5
- package/src/components/form/InnerForm.tsx +12 -8
- package/src/components/form/Select.tsx +14 -12
- package/src/components/form/SelectStyles.ts +4 -4
- package/src/components/layout/Layout.tsx +1 -7
- package/src/components/layout/SideBar.tsx +1 -2
- package/src/components/list/CellField.tsx +2 -5
- package/src/components/list/Datagrid.tsx +0 -1
- package/src/components/list/EmptyList.tsx +2 -2
- package/src/components/list/FilterPopup.tsx +4 -2
- package/src/components/list/ListPage.tsx +7 -5
- package/src/components/list/cells/DefaultCell.tsx +2 -0
- package/src/decorators/details/Details.ts +2 -2
- package/src/decorators/details/DetailsItem.ts +2 -0
- package/src/decorators/form/Form.ts +10 -11
- package/src/decorators/form/Input.ts +18 -9
- package/src/decorators/form/inputs/SelectInput.ts +8 -7
- package/src/decorators/list/Cell.ts +6 -4
- package/src/decorators/list/ExtendedCell.ts +1 -9
- package/src/decorators/list/List.ts +8 -4
- package/src/decorators/list/cells/ImageCell.ts +1 -1
- package/src/decorators/list/getListPageMeta.ts +4 -3
- package/src/store/store.ts +3 -1
- package/src/styles/components/form-header.scss +75 -0
- package/src/styles/index.scss +1 -0
- package/src/types/AnyClass.ts +3 -0
- package/src/utils/decerators.ts +3 -2
- package/.eslintrc.js +0 -23
- package/.eslintrc.json +0 -26
- package/src/initPanel.ts +0 -3
- package/src/types/initPanelOptions.ts +0 -1
package/.cursor/rules.md
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
# React Component Development Rules
|
2
2
|
|
3
|
-
## 1. Component
|
3
|
+
## 1. Component Structure
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
### ✅ Correct Way:
|
5
|
+
Use regular function declarations for components:
|
8
6
|
|
9
7
|
```typescript
|
10
8
|
interface ButtonProps {
|
@@ -17,106 +15,34 @@ export function Button({ label, onClick }: ButtonProps) {
|
|
17
15
|
}
|
18
16
|
```
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
```typescript
|
23
|
-
// Don't use React.FC
|
24
|
-
export const Button: React.FC<ButtonProps> = ({ label, onClick }) => {
|
25
|
-
return <button onClick={onClick}>{label}</button>;
|
26
|
-
};
|
27
|
-
|
28
|
-
// Don't use arrow functions
|
29
|
-
export const Button = ({ label, onClick }: ButtonProps) => {
|
30
|
-
return <button onClick={onClick}>{label}</button>;
|
31
|
-
};
|
32
|
-
```
|
33
|
-
|
34
|
-
## 2. Props Typing
|
35
|
-
|
36
|
-
- Type props directly in the function parameters
|
37
|
-
- Use interfaces for complex prop types
|
38
|
-
- Keep prop interfaces close to the component
|
39
|
-
|
40
|
-
### ✅ Good Example:
|
41
|
-
|
42
|
-
```typescript
|
43
|
-
interface UserCardProps {
|
44
|
-
user: {
|
45
|
-
name: string;
|
46
|
-
email: string;
|
47
|
-
avatar?: string;
|
48
|
-
};
|
49
|
-
onSelect: (userId: string) => void;
|
50
|
-
}
|
51
|
-
|
52
|
-
export function UserCard({ user, onSelect }: UserCardProps) {
|
53
|
-
return (
|
54
|
-
<div onClick={() => onSelect(user.id)}>
|
55
|
-
<img src={user.avatar} alt={user.name} />
|
56
|
-
<h3>{user.name}</h3>
|
57
|
-
<p>{user.email}</p>
|
58
|
-
</div>
|
59
|
-
);
|
60
|
-
}
|
61
|
-
```
|
62
|
-
|
63
|
-
## 3. Performance Optimization Guidelines
|
64
|
-
|
65
|
-
### Performance Optimization Hooks Usage
|
66
|
-
|
67
|
-
#### React.memo
|
68
|
-
|
69
|
-
⚠️ **Warning**: Only use `React.memo` when you have identified a specific performance issue through profiling. Common use cases:
|
70
|
-
|
71
|
-
- Components that render frequently with the same props
|
72
|
-
- Components that are expensive to render
|
73
|
-
- Components that are rendered in lists with many items
|
74
|
-
|
75
|
-
#### useCallback
|
76
|
-
|
77
|
-
⚠️ **Warning**: Only use `useCallback` when:
|
78
|
-
|
79
|
-
- You're passing callbacks to optimized child components that rely on reference equality
|
80
|
-
- You have identified a specific performance issue through profiling
|
81
|
-
- The callback is used as a dependency in other hooks
|
82
|
-
|
83
|
-
#### useMemo
|
84
|
-
|
85
|
-
⚠️ **Warning**: Only use `useMemo` when:
|
18
|
+
## 2. Props and Types
|
86
19
|
|
87
|
-
-
|
88
|
-
-
|
89
|
-
-
|
20
|
+
- Type props directly in function parameters
|
21
|
+
- Use interfaces for complex props
|
22
|
+
- Keep interfaces close to components
|
90
23
|
|
91
|
-
|
24
|
+
## 3. Performance Guidelines
|
92
25
|
|
93
|
-
|
94
|
-
2. Use named exports instead of default exports
|
95
|
-
3. Profile your application before adding performance optimizations
|
96
|
-
4. Document why you're using performance optimization hooks when you do use them
|
97
|
-
5. Consider using the React DevTools Profiler to identify actual performance bottlenecks
|
26
|
+
### Only use these when necessary:
|
98
27
|
|
99
|
-
|
28
|
+
- `React.memo`: For frequently rendered components with same props
|
29
|
+
- `useCallback`: For callbacks passed to optimized child components
|
30
|
+
- `useMemo`: For expensive computations or referential equality needs
|
100
31
|
|
101
|
-
|
102
|
-
- Cleaner and more readable code
|
103
|
-
- Easier to maintain and refactor
|
104
|
-
- Follows modern React best practices
|
105
|
-
- Reduces unnecessary type complexity
|
106
|
-
- Better IDE support and autocompletion
|
32
|
+
### Best Practices:
|
107
33
|
|
108
|
-
|
34
|
+
1. Start with functional components
|
35
|
+
2. Use named exports
|
36
|
+
3. Profile before optimizing
|
37
|
+
4. Document optimization reasons
|
109
38
|
|
110
|
-
|
39
|
+
## 4. Styling
|
111
40
|
|
112
|
-
|
113
|
-
- When team consensus prefers a different approach
|
114
|
-
- When specific project requirements dictate otherwise
|
41
|
+
Use SCSS exclusively for styling.
|
115
42
|
|
116
|
-
##
|
43
|
+
## 5. General Rules
|
117
44
|
|
118
45
|
- Keep components focused and single-responsibility
|
119
|
-
- Use meaningful
|
120
|
-
- Document complex props
|
121
|
-
- Export components as named exports
|
46
|
+
- Use meaningful names
|
47
|
+
- Document complex props
|
122
48
|
- Use TypeScript's strict mode
|
package/.vscode/settings.json
CHANGED
@@ -4,5 +4,10 @@
|
|
4
4
|
"chat.editor.fontSize": 15,
|
5
5
|
"debug.console.fontSize": 15,
|
6
6
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
7
|
-
"editor.formatOnSave": true
|
7
|
+
"editor.formatOnSave": true,
|
8
|
+
"folder-customization.folders": [
|
9
|
+
{
|
10
|
+
"path": "test-aletleri/src/client/"
|
11
|
+
}
|
12
|
+
]
|
8
13
|
}
|
package/PTD.md
CHANGED
@@ -1,36 +1,52 @@
|
|
1
1
|
# Project Technical Documentation (PTD)
|
2
2
|
|
3
|
+
> **AI-Generated Content Notice**: This documentation has been automatically generated by artificial intelligence and has not been manually reviewed or verified by human experts. While efforts have been made to ensure accuracy, users should exercise discretion and verify critical information independently. The content may not reflect the most current state of the project and should be used as a reference guide only.
|
4
|
+
|
3
5
|
## Project Structure
|
4
6
|
|
5
7
|
```
|
6
8
|
src/
|
7
|
-
├──
|
8
|
-
|
9
|
+
├── api/ # API integration and services
|
10
|
+
├── assets/ # Static assets (images, fonts, etc.)
|
11
|
+
├── components/ # React components
|
12
|
+
│ ├── pages/ # Page components
|
9
13
|
│ │ ├── ListPage.tsx
|
10
14
|
│ │ ├── FormPage.tsx
|
15
|
+
│ │ ├── DetailsPage.tsx
|
11
16
|
│ │ └── Login.tsx
|
12
|
-
│ ├── layout/
|
17
|
+
│ ├── layout/ # Layout components
|
13
18
|
│ │ └── Layout.tsx
|
14
|
-
│ ├──
|
15
|
-
│
|
16
|
-
|
17
|
-
├── decorators
|
18
|
-
│ ├── list/
|
19
|
+
│ ├── Counter.tsx # Dashboard component
|
20
|
+
│ └── Panel.tsx # Main panel component
|
21
|
+
├── decorators/ # TypeScript decorators
|
22
|
+
│ ├── list/ # List-related decorators
|
19
23
|
│ │ ├── List.ts
|
20
|
-
│ │ ├──
|
24
|
+
│ │ ├── cells/
|
25
|
+
│ │ │ ├── ImageCell.ts
|
26
|
+
│ │ │ └── DownloadCell.ts
|
21
27
|
│ │ └── Cell.ts
|
22
|
-
│ ├── form/
|
23
|
-
│ │
|
24
|
-
│
|
25
|
-
|
28
|
+
│ ├── form/ # Form-related decorators
|
29
|
+
│ │ ├── Form.ts
|
30
|
+
│ │ ├── Input.ts
|
31
|
+
│ │ └── inputs/
|
32
|
+
│ │ └── SelectInput.ts
|
33
|
+
│ └── details/ # Details-related decorators
|
34
|
+
│ ├── Details.ts
|
35
|
+
│ └── DetailsItem.ts
|
36
|
+
├── hooks/ # Custom React hooks
|
37
|
+
├── store/ # State management
|
38
|
+
├── styles/ # Global styles and themes
|
39
|
+
├── types/ # TypeScript type definitions
|
26
40
|
│ ├── initPanelOptions.ts
|
27
41
|
│ └── ScreenCreatorData.ts
|
28
|
-
|
42
|
+
├── utils/ # Utility functions
|
43
|
+
└── index.ts # Main entry point and exports
|
29
44
|
```
|
30
45
|
|
31
46
|
## Core Components
|
32
47
|
|
33
48
|
### Panel Component
|
49
|
+
|
34
50
|
The main entry point of the library that initializes and manages the panel system.
|
35
51
|
|
36
52
|
```typescript
|
@@ -43,22 +59,35 @@ interface InitPanelOptions {
|
|
43
59
|
### Page Components
|
44
60
|
|
45
61
|
#### ListPage
|
62
|
+
|
46
63
|
- Purpose: Displays data in a tabular format
|
47
64
|
- Features:
|
48
65
|
- Customizable columns
|
49
66
|
- Sorting and filtering
|
50
67
|
- Pagination
|
51
|
-
- Image cell support
|
68
|
+
- Image and Download cell support
|
69
|
+
- Type-safe data handling
|
52
70
|
|
53
71
|
#### FormPage
|
72
|
+
|
54
73
|
- Purpose: Handles data input and editing
|
55
74
|
- Features:
|
56
75
|
- Dynamic form generation
|
57
76
|
- Validation
|
58
77
|
- File upload support
|
59
|
-
- Custom field types
|
78
|
+
- Custom field types (Input, Select)
|
79
|
+
- Nested form fields support
|
80
|
+
|
81
|
+
#### DetailsPage
|
82
|
+
|
83
|
+
- Purpose: Displays detailed information about a single item
|
84
|
+
- Features:
|
85
|
+
- Customizable layout
|
86
|
+
- Dynamic content rendering
|
87
|
+
- Nested details support
|
60
88
|
|
61
89
|
#### Login
|
90
|
+
|
62
91
|
- Purpose: Authentication interface
|
63
92
|
- Features:
|
64
93
|
- User authentication
|
@@ -70,6 +99,7 @@ interface InitPanelOptions {
|
|
70
99
|
### List Decorators
|
71
100
|
|
72
101
|
#### @List
|
102
|
+
|
73
103
|
```typescript
|
74
104
|
@List(options: ListOptions)
|
75
105
|
class YourListClass {
|
@@ -78,12 +108,21 @@ class YourListClass {
|
|
78
108
|
```
|
79
109
|
|
80
110
|
#### @ImageCell
|
111
|
+
|
81
112
|
```typescript
|
82
113
|
@ImageCell(options: ImageCellOptions)
|
83
114
|
property: string;
|
84
115
|
```
|
85
116
|
|
117
|
+
#### @DownloadCell
|
118
|
+
|
119
|
+
```typescript
|
120
|
+
@DownloadCell(options: DownloadCellOptions)
|
121
|
+
property: string;
|
122
|
+
```
|
123
|
+
|
86
124
|
#### @Cell
|
125
|
+
|
87
126
|
```typescript
|
88
127
|
@Cell(options: CellOptions)
|
89
128
|
property: any;
|
@@ -91,23 +130,51 @@ property: any;
|
|
91
130
|
|
92
131
|
### Form Decorators
|
93
132
|
|
133
|
+
#### @Form
|
134
|
+
|
135
|
+
```typescript
|
136
|
+
@Form(options: FormOptions)
|
137
|
+
class YourFormClass {
|
138
|
+
// Form implementation
|
139
|
+
}
|
140
|
+
```
|
141
|
+
|
94
142
|
#### @Input
|
143
|
+
|
95
144
|
```typescript
|
96
145
|
@Input(options: InputOptions)
|
97
146
|
property: string;
|
98
147
|
```
|
99
148
|
|
100
|
-
#### @
|
149
|
+
#### @SelectInput
|
150
|
+
|
151
|
+
```typescript
|
152
|
+
@SelectInput(options: SelectInputOptions)
|
153
|
+
property: string;
|
154
|
+
```
|
155
|
+
|
156
|
+
### Details Decorators
|
157
|
+
|
158
|
+
#### @Details
|
159
|
+
|
101
160
|
```typescript
|
102
|
-
@
|
103
|
-
class
|
104
|
-
//
|
161
|
+
@Details(options: DetailsOptions)
|
162
|
+
class YourDetailsClass {
|
163
|
+
// Details implementation
|
105
164
|
}
|
106
165
|
```
|
107
166
|
|
167
|
+
#### @DetailsItem
|
168
|
+
|
169
|
+
```typescript
|
170
|
+
@DetailsItem(options: DetailsItemOptions)
|
171
|
+
property: any;
|
172
|
+
```
|
173
|
+
|
108
174
|
## Type Definitions
|
109
175
|
|
110
176
|
### InitPanelOptions
|
177
|
+
|
111
178
|
```typescript
|
112
179
|
interface InitPanelOptions {
|
113
180
|
// Add specific options
|
@@ -115,6 +182,7 @@ interface InitPanelOptions {
|
|
115
182
|
```
|
116
183
|
|
117
184
|
### ScreenCreatorData
|
185
|
+
|
118
186
|
```typescript
|
119
187
|
interface ScreenCreatorData {
|
120
188
|
// Add specific data structure
|
@@ -124,52 +192,73 @@ interface ScreenCreatorData {
|
|
124
192
|
## Technical Implementation Details
|
125
193
|
|
126
194
|
### State Management
|
195
|
+
|
127
196
|
- Uses React's built-in state management
|
128
197
|
- Supports external state management libraries
|
129
198
|
- Implements context for global state
|
199
|
+
- Store directory for centralized state management
|
130
200
|
|
131
201
|
### Data Flow
|
202
|
+
|
132
203
|
1. Panel initialization
|
133
204
|
2. Component mounting
|
134
|
-
3. Data fetching
|
205
|
+
3. Data fetching (via API services)
|
135
206
|
4. State updates
|
136
207
|
5. UI rendering
|
137
208
|
|
209
|
+
### API Integration
|
210
|
+
|
211
|
+
- Centralized API services
|
212
|
+
- Type-safe API calls
|
213
|
+
- Error handling
|
214
|
+
- Request/Response interceptors
|
215
|
+
|
138
216
|
### Performance Considerations
|
217
|
+
|
139
218
|
- Lazy loading for large lists
|
140
219
|
- Image optimization
|
141
220
|
- Caching strategies
|
142
221
|
- Memory management
|
222
|
+
- Code splitting
|
143
223
|
|
144
224
|
### Security
|
225
|
+
|
145
226
|
- Input sanitization
|
146
227
|
- XSS prevention
|
147
228
|
- CSRF protection
|
148
229
|
- Authentication flow
|
230
|
+
- Secure API communication
|
149
231
|
|
150
232
|
## Development Guidelines
|
151
233
|
|
152
234
|
### Code Style
|
235
|
+
|
153
236
|
- Follow TypeScript best practices
|
154
237
|
- Use functional components with hooks
|
155
238
|
- Implement proper error handling
|
156
239
|
- Write unit tests for components
|
240
|
+
- Follow consistent naming conventions
|
157
241
|
|
158
242
|
### Testing
|
243
|
+
|
159
244
|
- Unit tests for components
|
160
245
|
- Integration tests for decorators
|
161
246
|
- E2E tests for critical flows
|
162
247
|
- Performance testing
|
248
|
+
- API integration testing
|
163
249
|
|
164
250
|
### Documentation
|
251
|
+
|
165
252
|
- JSDoc comments for components
|
166
253
|
- Type definitions
|
167
254
|
- Usage examples
|
168
255
|
- API documentation
|
256
|
+
- Component documentation
|
169
257
|
|
170
258
|
## Build and Deployment
|
171
259
|
|
172
260
|
### Development
|
261
|
+
|
173
262
|
```bash
|
174
263
|
npm run dev
|
175
264
|
# or
|
@@ -177,6 +266,7 @@ yarn dev
|
|
177
266
|
```
|
178
267
|
|
179
268
|
### Production Build
|
269
|
+
|
180
270
|
```bash
|
181
271
|
npm run build
|
182
272
|
# or
|
@@ -184,6 +274,7 @@ yarn build
|
|
184
274
|
```
|
185
275
|
|
186
276
|
### Testing
|
277
|
+
|
187
278
|
```bash
|
188
279
|
npm run test
|
189
280
|
# or
|
@@ -193,24 +284,29 @@ yarn test
|
|
193
284
|
## Dependencies
|
194
285
|
|
195
286
|
### Core Dependencies
|
287
|
+
|
196
288
|
- React
|
197
289
|
- TypeScript
|
198
290
|
- Other essential libraries
|
199
291
|
|
200
292
|
### Development Dependencies
|
293
|
+
|
201
294
|
- Testing frameworks
|
202
295
|
- Build tools
|
203
296
|
- Linting tools
|
297
|
+
- Type checking tools
|
204
298
|
|
205
299
|
## Version Control
|
206
300
|
|
207
301
|
### Branch Strategy
|
302
|
+
|
208
303
|
- main: Production-ready code
|
209
304
|
- develop: Development branch
|
210
|
-
- feature
|
211
|
-
- bugfix
|
305
|
+
- feature/\*: New features
|
306
|
+
- bugfix/\*: Bug fixes
|
212
307
|
|
213
308
|
### Commit Convention
|
309
|
+
|
214
310
|
- feat: New features
|
215
311
|
- fix: Bug fixes
|
216
312
|
- docs: Documentation
|
@@ -222,13 +318,17 @@ yarn test
|
|
222
318
|
## Troubleshooting
|
223
319
|
|
224
320
|
### Common Issues
|
321
|
+
|
225
322
|
1. List rendering performance
|
226
323
|
2. Form validation errors
|
227
324
|
3. Image loading issues
|
228
325
|
4. Authentication problems
|
326
|
+
5. API integration issues
|
229
327
|
|
230
328
|
### Solutions
|
329
|
+
|
231
330
|
- Performance optimization techniques
|
232
331
|
- Debugging strategies
|
233
332
|
- Error handling best practices
|
234
|
-
- Logging and monitoring
|
333
|
+
- Logging and monitoring
|
334
|
+
- API error handling
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { AnyClass } from '../types/AnyClass';
|
2
|
+
import { AnyClass, AnyClassConstructor } from '../types/AnyClass';
|
3
3
|
interface DetailsPageProps<T extends AnyClass> {
|
4
|
-
model:
|
4
|
+
model: AnyClassConstructor<T>;
|
5
5
|
}
|
6
6
|
export declare function DetailsPage<T extends AnyClass>({ model }: DetailsPageProps<T>): React.JSX.Element;
|
7
7
|
export {};
|
@@ -8,10 +8,6 @@ interface FormFieldProps {
|
|
8
8
|
message?: string;
|
9
9
|
};
|
10
10
|
baseName?: string;
|
11
|
-
onSelectPreloader?: (inputOptions: InputConfiguration) => Promise<{
|
12
|
-
label: string;
|
13
|
-
value: string;
|
14
|
-
}[]>;
|
15
11
|
}
|
16
|
-
export declare function FormField({ input, register, error, baseName
|
12
|
+
export declare function FormField({ input, register, error, baseName }: FormFieldProps): React.JSX.Element;
|
17
13
|
export {};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { AnyClass } from '../../types/AnyClass';
|
3
|
+
import { FormUtils } from './FormPage';
|
4
|
+
interface FormHeaderProps<T extends AnyClass> {
|
5
|
+
title?: string;
|
6
|
+
header?: (utils: FormUtils<T>) => React.ReactNode;
|
7
|
+
utils: FormUtils<T>;
|
8
|
+
}
|
9
|
+
export declare function FormHeader<T extends AnyClass>({ utils, header, title }: FormHeaderProps<T>): React.JSX.Element;
|
10
|
+
export {};
|
@@ -1,6 +1,17 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { AnyClass, AnyClassConstructor } from '../../types/AnyClass';
|
3
|
+
export interface FormUtils<T extends AnyClass> {
|
4
|
+
getValues: () => T;
|
5
|
+
setValues: (values: Partial<T>) => void;
|
6
|
+
toJSON: (values: Partial<T>) => string;
|
7
|
+
fromJSON: (json: string) => Partial<T>;
|
8
|
+
export: (data: string, extension: 'txt' | 'json' | 'csv') => void;
|
9
|
+
import: () => Promise<string>;
|
10
|
+
}
|
3
11
|
export interface FormPageProps<T extends AnyClass> {
|
4
12
|
model: AnyClassConstructor<T>;
|
13
|
+
title?: string;
|
14
|
+
documentTitle?: string;
|
15
|
+
header?: (utils: FormUtils<T>) => React.ReactNode;
|
5
16
|
}
|
6
|
-
export declare function FormPage<T extends AnyClass>({ model }: FormPageProps<T>): React.JSX.Element;
|
17
|
+
export declare function FormPage<T extends AnyClass>({ model, title, documentTitle, header, }: FormPageProps<T>): React.JSX.Element;
|
@@ -4,5 +4,5 @@ interface SelectProps {
|
|
4
4
|
input: InputConfiguration;
|
5
5
|
fieldName: string;
|
6
6
|
}
|
7
|
-
export declare function Select({ input, fieldName }: SelectProps): React.JSX.Element;
|
7
|
+
export declare function Select<TValue>({ input, fieldName }: SelectProps): React.JSX.Element;
|
8
8
|
export {};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { StylesConfig } from 'react-select';
|
2
|
-
interface OptionType {
|
2
|
+
interface OptionType<TValue> {
|
3
3
|
label: string;
|
4
|
-
value:
|
4
|
+
value: TValue;
|
5
5
|
}
|
6
|
-
export declare const darkSelectStyles: StylesConfig<OptionType
|
6
|
+
export declare const darkSelectStyles: <TValue>() => StylesConfig<OptionType<TValue>, false>;
|
7
7
|
export {};
|
@@ -3,8 +3,7 @@ import { AnyClass } from '../../types/AnyClass';
|
|
3
3
|
import { CellConfiguration } from '../../decorators/list/Cell';
|
4
4
|
interface CellFieldProps<T extends AnyClass> {
|
5
5
|
configuration: CellConfiguration;
|
6
|
-
|
7
|
-
value: any;
|
6
|
+
value: T[keyof T];
|
8
7
|
}
|
9
|
-
export declare function CellField<T extends AnyClass>({ configuration,
|
8
|
+
export declare function CellField<T extends AnyClass>({ configuration, value, }: CellFieldProps<T>): React.ReactElement;
|
10
9
|
export {};
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
export declare
|
2
|
+
export declare function EmptyList(): React.JSX.Element;
|
@@ -4,8 +4,7 @@ export type GetDetailsDataFN<T> = (param: Record<string, string>) => Promise<T>;
|
|
4
4
|
interface DetailsOptions<T extends AnyClass> {
|
5
5
|
getDetailsData: GetDetailsDataFN<T>;
|
6
6
|
}
|
7
|
-
export
|
8
|
-
}
|
7
|
+
export type DetailsConfiguration<T extends AnyClass> = DetailsOptions<T>;
|
9
8
|
export declare function Details<T extends AnyClass>(options?: DetailsOptions<T>): ClassDecorator;
|
10
9
|
export declare function getDetailsConfiguration<T extends AnyClass>(entityClass: T): DetailsConfiguration<T>;
|
11
10
|
export {};
|
@@ -5,14 +5,12 @@ export type OnSubmitFN<T> = (data: T | FormData) => Promise<T>;
|
|
5
5
|
interface FormOptions<T extends AnyClass> {
|
6
6
|
onSubmit: OnSubmitFN<T>;
|
7
7
|
getDetailsData?: GetDetailsDataFN<T>;
|
8
|
-
/** @deprecated */
|
9
|
-
redirectBackOnSuccess?: boolean;
|
10
8
|
type?: 'json' | 'formData';
|
11
9
|
redirectSuccessUrl?: string;
|
12
10
|
}
|
13
|
-
export interface FormConfiguration<T extends AnyClass>
|
14
|
-
|
15
|
-
|
11
|
+
export interface FormConfiguration<T extends AnyClass> {
|
12
|
+
onSubmit: OnSubmitFN<T>;
|
13
|
+
getDetailsData?: GetDetailsDataFN<T>;
|
16
14
|
type: 'json' | 'formData';
|
17
15
|
redirectSuccessUrl?: string;
|
18
16
|
}
|
@@ -3,19 +3,27 @@ import { AnyClass, AnyClassConstructor } from '../../types/AnyClass';
|
|
3
3
|
export type InputTypes = 'input' | 'textarea' | 'file-upload' | 'checkbox' | 'hidden' | 'nested';
|
4
4
|
export type ExtendedInputTypes = InputTypes | 'select';
|
5
5
|
export interface InputOptions {
|
6
|
+
name?: string;
|
6
7
|
type?: InputTypes;
|
7
8
|
inputType?: 'text' | 'email' | 'tel' | 'password' | 'number' | 'date';
|
8
|
-
name?: string;
|
9
9
|
label?: string;
|
10
10
|
placeholder?: string;
|
11
11
|
nestedFields?: InputConfiguration[];
|
12
|
+
includeInCSV?: boolean;
|
13
|
+
includeInJSON?: boolean;
|
12
14
|
}
|
13
15
|
export interface ExtendedInputOptions extends Omit<InputOptions, 'type'> {
|
14
16
|
type: ExtendedInputTypes;
|
15
17
|
}
|
16
|
-
export interface InputConfiguration
|
18
|
+
export interface InputConfiguration {
|
17
19
|
name: string;
|
18
20
|
type: ExtendedInputTypes;
|
21
|
+
inputType: 'text' | 'email' | 'tel' | 'password' | 'number' | 'date';
|
22
|
+
label?: string;
|
23
|
+
placeholder?: string;
|
24
|
+
nestedFields?: InputConfiguration[];
|
25
|
+
includeInCSV: boolean;
|
26
|
+
includeInJSON: boolean;
|
19
27
|
}
|
20
28
|
export declare function Input(options?: InputOptions): PropertyDecorator;
|
21
29
|
export declare function ExtendedInput(options?: ExtendedInputOptions): PropertyDecorator;
|