proje-react-panel 1.0.14 → 1.0.16
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 +122 -0
- package/.cursor/settings.json +57 -0
- package/.eslintrc.js +5 -0
- package/.eslintrc.json +26 -0
- package/.prettierrc +10 -0
- package/.vscode/launch.json +27 -0
- package/.vscode/settings.json +8 -0
- package/PTD.md +234 -0
- package/README.md +62 -28
- package/dist/api/CrudApi.d.ts +12 -0
- package/dist/components/Panel.d.ts +2 -2
- package/dist/components/components/Checkbox.d.ts +6 -0
- package/dist/components/components/Counter.d.ts +9 -0
- package/dist/components/components/FormField.d.ts +13 -0
- package/dist/components/components/ImageUploader.d.ts +15 -0
- package/dist/components/components/InnerForm.d.ts +12 -0
- package/dist/components/components/LoadingScreen.d.ts +2 -0
- package/dist/components/components/index.d.ts +8 -0
- package/dist/components/components/list/Datagrid.d.ts +13 -0
- package/dist/components/components/list/EmptyList.d.ts +2 -0
- package/dist/components/components/list/FilterPopup.d.ts +11 -0
- package/dist/components/components/list/ListPage.d.ts +22 -0
- package/dist/components/components/list/Pagination.d.ts +11 -0
- package/dist/components/components/list/index.d.ts +0 -0
- package/dist/components/layout/Layout.d.ts +2 -1
- package/dist/components/layout/SideBar.d.ts +4 -3
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/list/Datagrid.d.ts +12 -0
- package/dist/components/list/EmptyList.d.ts +2 -0
- package/dist/components/list/FilterPopup.d.ts +10 -0
- package/dist/components/list/Pagination.d.ts +11 -0
- package/dist/components/list/index.d.ts +0 -0
- package/dist/{src/screens → components/pages}/ControllerDetails.d.ts +1 -1
- package/dist/components/pages/FormPage.d.ts +12 -0
- package/dist/components/pages/ListPage.d.ts +18 -0
- package/dist/components/pages/Login.d.ts +13 -0
- package/dist/decorators/form/Form.d.ts +6 -0
- package/dist/decorators/form/FormOptions.d.ts +7 -0
- package/dist/decorators/form/Input.d.ts +17 -0
- package/dist/decorators/form/getFormFields.d.ts +3 -0
- package/dist/decorators/list/Cell.d.ts +21 -0
- package/dist/decorators/list/GetCellFields.d.ts +2 -0
- package/dist/decorators/list/ImageCell.d.ts +6 -0
- package/dist/decorators/list/List.d.ts +28 -0
- package/dist/decorators/list/ListData.d.ts +6 -0
- package/dist/decorators/list/getListFields.d.ts +2 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +20 -10
- package/dist/index.esm.js +1 -1
- package/dist/initPanel.d.ts +2 -2
- package/dist/store/store.d.ts +1 -5
- package/dist/types/AnyClass.d.ts +1 -0
- package/dist/types/ScreenCreatorData.d.ts +5 -3
- package/dist/types/initPanelOptions.d.ts +0 -6
- package/dist/utils/format.d.ts +1 -0
- package/dist/utils/getFields.d.ts +2 -1
- package/package.json +13 -6
- package/src/api/CrudApi.ts +30 -11
- package/src/assets/icons/svg/create.svg +9 -0
- package/src/assets/icons/svg/filter.svg +3 -0
- package/src/assets/icons/svg/pencil.svg +8 -0
- package/src/assets/icons/svg/search.svg +8 -0
- package/src/assets/icons/svg/trash.svg +8 -0
- package/src/components/Panel.tsx +11 -11
- package/src/components/components/Checkbox.tsx +9 -0
- package/src/components/components/Counter.tsx +51 -0
- package/src/components/components/FormField.tsx +94 -0
- package/src/components/components/ImageUploader.tsx +301 -0
- package/src/components/components/InnerForm.tsx +74 -0
- package/src/components/components/LoadingScreen.tsx +12 -0
- package/src/components/components/index.ts +8 -0
- package/src/components/components/list/Datagrid.tsx +121 -0
- package/src/components/components/list/EmptyList.tsx +26 -0
- package/src/components/components/list/FilterPopup.tsx +202 -0
- package/src/components/components/list/ListPage.tsx +178 -0
- package/src/components/components/list/Pagination.tsx +110 -0
- package/src/components/components/list/index.ts +1 -0
- package/src/components/layout/Layout.tsx +8 -1
- package/src/components/layout/SideBar.tsx +103 -31
- package/src/components/layout/index.ts +2 -0
- package/src/components/pages/ControllerDetails.tsx +37 -0
- package/src/components/pages/FormPage.tsx +34 -0
- package/src/components/pages/Login.tsx +79 -0
- package/src/decorators/form/Form.ts +18 -0
- package/src/decorators/form/FormOptions.ts +8 -0
- package/src/decorators/form/Input.ts +53 -0
- package/src/decorators/form/getFormFields.ts +13 -0
- package/src/decorators/list/Cell.ts +32 -0
- package/src/decorators/list/GetCellFields.ts +13 -0
- package/src/decorators/list/ImageCell.ts +13 -0
- package/src/decorators/list/List.ts +31 -0
- package/src/decorators/list/ListData.ts +7 -0
- package/src/decorators/list/getListFields.ts +10 -0
- package/src/index.ts +28 -10
- package/src/initPanel.ts +4 -12
- package/src/store/store.ts +23 -28
- package/src/styles/counter.scss +42 -0
- package/src/styles/filter-popup.scss +134 -0
- package/src/styles/image-uploader.scss +94 -0
- package/src/styles/index.scss +26 -7
- package/src/styles/layout.scss +1 -6
- package/src/styles/list.scss +175 -7
- package/src/styles/loading-screen.scss +42 -0
- package/src/styles/pagination.scss +66 -0
- package/src/styles/sidebar.scss +64 -0
- package/src/styles/utils/scrollbar.scss +19 -0
- package/src/types/AnyClass.ts +1 -0
- package/src/types/ScreenCreatorData.ts +5 -3
- package/src/types/initPanelOptions.ts +1 -7
- package/src/types/svg.d.ts +5 -0
- package/src/utils/format.ts +7 -0
- package/src/utils/getFields.ts +11 -9
- package/dist/api/crudApi.d.ts +0 -17
- package/dist/components/Form.d.ts +0 -6
- package/dist/components/FormField.d.ts +0 -13
- package/dist/components/list/List.d.ts +0 -10
- package/dist/components/screens/ControllerCreate.d.ts +0 -5
- package/dist/components/screens/ControllerDetails.d.ts +0 -5
- package/dist/components/screens/ControllerEdit.d.ts +0 -5
- package/dist/components/screens/ControllerList.d.ts +0 -5
- package/dist/components/screens/Login.d.ts +0 -2
- package/dist/decorators/Cell.d.ts +0 -9
- package/dist/decorators/Input.d.ts +0 -13
- package/dist/hooks/useScreens.d.ts +0 -2
- package/dist/initPanelOptions.d.ts +0 -8
- package/dist/screens/ControllerCreate.d.ts +0 -5
- package/dist/screens/ControllerDetails.d.ts +0 -5
- package/dist/screens/ControllerEdit.d.ts +0 -5
- package/dist/screens/ControllerList.d.ts +0 -5
- package/dist/screens/Form.d.ts +0 -6
- package/dist/src/api/crudApi.d.ts +0 -6
- package/dist/src/components/Panel.d.ts +0 -9
- package/dist/src/components/layout/Layout.d.ts +0 -11
- package/dist/src/components/layout/SideBar.d.ts +0 -10
- package/dist/src/components/list/List.d.ts +0 -10
- package/dist/src/decorators/Cell.d.ts +0 -10
- package/dist/src/decorators/Crud.d.ts +0 -6
- package/dist/src/index.d.ts +0 -8
- package/dist/src/screens/ControllerCreate.d.ts +0 -5
- package/dist/src/screens/ControllerEdit.d.ts +0 -5
- package/dist/src/screens/ControllerList.d.ts +0 -5
- package/dist/src/screens/Form.d.ts +0 -6
- package/dist/src/store/store.d.ts +0 -19
- package/dist/src/types/Screen.d.ts +0 -4
- package/dist/src/types/ScreenCreatorData.d.ts +0 -8
- package/dist/src/utils/createScreens.d.ts +0 -1
- package/dist/src/utils/getFields.d.ts +0 -2
- package/dist/src/utils/getScreens.d.ts +0 -2
- package/dist/utils/crudScreens.d.ts +0 -2
- package/dist/utils/getScreens.d.ts +0 -2
- package/src/api/AuthApi.ts +0 -14
- package/src/components/Form.tsx +0 -70
- package/src/components/FormField.tsx +0 -60
- package/src/components/list/List.tsx +0 -81
- package/src/components/screens/ControllerCreate.tsx +0 -7
- package/src/components/screens/ControllerDetails.tsx +0 -40
- package/src/components/screens/ControllerEdit.tsx +0 -35
- package/src/components/screens/ControllerList.tsx +0 -45
- package/src/components/screens/Login.tsx +0 -68
- package/src/decorators/Cell.ts +0 -34
- package/src/decorators/Input.ts +0 -50
- package/src/hooks/useScreens.tsx +0 -36
- /package/dist/components/{ErrorBoundary.d.ts → components/ErrorBoundary.d.ts} +0 -0
- /package/dist/components/{ErrorComponent.d.ts → components/ErrorComponent.d.ts} +0 -0
- /package/dist/components/{Label.d.ts → components/Label.d.ts} +0 -0
- /package/src/components/{ErrorBoundary.tsx → components/ErrorBoundary.tsx} +0 -0
- /package/src/components/{ErrorComponent.tsx → components/ErrorComponent.tsx} +0 -0
- /package/src/components/{Label.tsx → components/Label.tsx} +0 -0
package/.cursor/rules.md
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
# React Component Development Rules
|
2
|
+
|
3
|
+
## 1. Component Declaration Style
|
4
|
+
|
5
|
+
Always use regular function declarations for React components instead of arrow functions or React.FC.
|
6
|
+
|
7
|
+
### ✅ Correct Way:
|
8
|
+
|
9
|
+
```typescript
|
10
|
+
interface ButtonProps {
|
11
|
+
label: string;
|
12
|
+
onClick: () => void;
|
13
|
+
}
|
14
|
+
|
15
|
+
export function Button({ label, onClick }: ButtonProps) {
|
16
|
+
return <button onClick={onClick}>{label}</button>;
|
17
|
+
}
|
18
|
+
```
|
19
|
+
|
20
|
+
### ❌ Incorrect Ways:
|
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:
|
86
|
+
|
87
|
+
- You have expensive computations that you want to cache
|
88
|
+
- You need referential equality for dependencies in other hooks
|
89
|
+
- You have identified a specific performance issue through profiling
|
90
|
+
|
91
|
+
### Performance Best Practices
|
92
|
+
|
93
|
+
1. Always start with functional components
|
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
|
98
|
+
|
99
|
+
## 4. Benefits of This Approach
|
100
|
+
|
101
|
+
- Better TypeScript inference
|
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
|
107
|
+
|
108
|
+
## 5. When to Break the Rules
|
109
|
+
|
110
|
+
These rules can be broken in specific cases:
|
111
|
+
|
112
|
+
- When working with legacy code that uses different patterns
|
113
|
+
- When team consensus prefers a different approach
|
114
|
+
- When specific project requirements dictate otherwise
|
115
|
+
|
116
|
+
## 6. Additional Guidelines
|
117
|
+
|
118
|
+
- Keep components focused and single-responsibility
|
119
|
+
- Use meaningful prop and interface names
|
120
|
+
- Document complex props with comments
|
121
|
+
- Export components as named exports
|
122
|
+
- Use TypeScript's strict mode
|
@@ -0,0 +1,57 @@
|
|
1
|
+
{
|
2
|
+
"prompts": {
|
3
|
+
"default": {
|
4
|
+
"system": "You are a powerful agentic AI coding assistant powered by Claude 3.5 Sonnet. You operate exclusively in Cursor, the world's best IDE.",
|
5
|
+
"user": "Please help me with my coding task. I need assistance with:",
|
6
|
+
"assistant": "I'll help you with your coding task. Let me analyze the requirements and provide a solution."
|
7
|
+
},
|
8
|
+
"code_review": {
|
9
|
+
"system": "You are an expert code reviewer focusing on best practices, security, and performance.",
|
10
|
+
"user": "Please review this code and provide feedback on:",
|
11
|
+
"assistant": "I'll review the code and provide detailed feedback on the specified aspects."
|
12
|
+
},
|
13
|
+
"debugging": {
|
14
|
+
"system": "You are a debugging expert specializing in identifying and fixing code issues.",
|
15
|
+
"user": "I'm encountering this error/problem:",
|
16
|
+
"assistant": "Let me help you debug this issue. First, I'll analyze the error and then propose solutions."
|
17
|
+
},
|
18
|
+
"refactoring": {
|
19
|
+
"system": "You are a code refactoring expert focusing on improving code quality and maintainability.",
|
20
|
+
"user": "Please help me refactor this code to:",
|
21
|
+
"assistant": "I'll help you refactor the code according to your requirements while maintaining functionality."
|
22
|
+
},
|
23
|
+
"documentation": {
|
24
|
+
"system": "You are a technical documentation expert specializing in clear and comprehensive documentation.",
|
25
|
+
"user": "Please help me document this code/feature:",
|
26
|
+
"assistant": "I'll help you create clear and comprehensive documentation for your code/feature."
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"editor": {
|
30
|
+
"formatOnSave": true,
|
31
|
+
"tabSize": 2,
|
32
|
+
"insertSpaces": true,
|
33
|
+
"rulers": [80, 100],
|
34
|
+
"wordWrap": "off"
|
35
|
+
},
|
36
|
+
"terminal": {
|
37
|
+
"defaultProfile": "zsh",
|
38
|
+
"fontSize": 14
|
39
|
+
},
|
40
|
+
"git": {
|
41
|
+
"enableSmartCommit": true,
|
42
|
+
"autofetch": true
|
43
|
+
},
|
44
|
+
"files": {
|
45
|
+
"exclude": {
|
46
|
+
"**/.git": true,
|
47
|
+
"**/.svn": true,
|
48
|
+
"**/.hg": true,
|
49
|
+
"**/CVS": true,
|
50
|
+
"**/.DS_Store": true,
|
51
|
+
"**/Thumbs.db": true,
|
52
|
+
"**/node_modules": true,
|
53
|
+
"**/dist": true,
|
54
|
+
"**/build": true
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
package/.eslintrc.js
CHANGED
package/.eslintrc.json
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"extends": [
|
3
|
+
"eslint:recommended",
|
4
|
+
"plugin:react/recommended",
|
5
|
+
"plugin:react-hooks/recommended"
|
6
|
+
],
|
7
|
+
"plugins": ["react", "react-hooks"],
|
8
|
+
"rules": {
|
9
|
+
"react/function-component-definition": [
|
10
|
+
"error",
|
11
|
+
{
|
12
|
+
"namedComponents": "function-declaration",
|
13
|
+
"unnamedComponents": "function-declaration"
|
14
|
+
}
|
15
|
+
],
|
16
|
+
"import/prefer-default-export": "off",
|
17
|
+
"react/prefer-stateless-function": "error",
|
18
|
+
"react/no-this-in-sfc": "error",
|
19
|
+
"react-hooks/exhaustive-deps": "warn"
|
20
|
+
},
|
21
|
+
"settings": {
|
22
|
+
"react": {
|
23
|
+
"version": "detect"
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
package/.prettierrc
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
{
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
3
|
+
// Hover to view descriptions of existing attributes.
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
5
|
+
"version": "0.2.0",
|
6
|
+
"configurations": [
|
7
|
+
{
|
8
|
+
"type": "node",
|
9
|
+
"request": "launch",
|
10
|
+
"name": "Build Project",
|
11
|
+
"runtimeExecutable": "yarn",
|
12
|
+
"runtimeArgs": ["build"],
|
13
|
+
"console": "integratedTerminal",
|
14
|
+
"internalConsoleOptions": "neverOpen"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"type": "node",
|
18
|
+
"request": "launch",
|
19
|
+
"name": "Run Example Dev Server",
|
20
|
+
"runtimeExecutable": "yarn",
|
21
|
+
"runtimeArgs": ["dev"],
|
22
|
+
"cwd": "${workspaceFolder}/examples",
|
23
|
+
"console": "integratedTerminal",
|
24
|
+
"internalConsoleOptions": "neverOpen"
|
25
|
+
}
|
26
|
+
]
|
27
|
+
}
|
package/PTD.md
ADDED
@@ -0,0 +1,234 @@
|
|
1
|
+
# Project Technical Documentation (PTD)
|
2
|
+
|
3
|
+
## Project Structure
|
4
|
+
|
5
|
+
```
|
6
|
+
src/
|
7
|
+
├── components/
|
8
|
+
│ ├── pages/
|
9
|
+
│ │ ├── ListPage.tsx
|
10
|
+
│ │ ├── FormPage.tsx
|
11
|
+
│ │ └── Login.tsx
|
12
|
+
│ ├── layout/
|
13
|
+
│ │ └── Layout.tsx
|
14
|
+
│ ├── components/
|
15
|
+
│ │ └── Counter.tsx
|
16
|
+
│ └── Panel.tsx
|
17
|
+
├── decorators/
|
18
|
+
│ ├── list/
|
19
|
+
│ │ ├── List.ts
|
20
|
+
│ │ ├── ImageCell.ts
|
21
|
+
│ │ └── Cell.ts
|
22
|
+
│ ├── form/
|
23
|
+
│ │ └── Input.ts
|
24
|
+
│ └── Crud.ts
|
25
|
+
├── types/
|
26
|
+
│ ├── initPanelOptions.ts
|
27
|
+
│ └── ScreenCreatorData.ts
|
28
|
+
└── index.ts
|
29
|
+
```
|
30
|
+
|
31
|
+
## Core Components
|
32
|
+
|
33
|
+
### Panel Component
|
34
|
+
The main entry point of the library that initializes and manages the panel system.
|
35
|
+
|
36
|
+
```typescript
|
37
|
+
interface InitPanelOptions {
|
38
|
+
// Panel initialization options
|
39
|
+
// Add specific options here
|
40
|
+
}
|
41
|
+
```
|
42
|
+
|
43
|
+
### Page Components
|
44
|
+
|
45
|
+
#### ListPage
|
46
|
+
- Purpose: Displays data in a tabular format
|
47
|
+
- Features:
|
48
|
+
- Customizable columns
|
49
|
+
- Sorting and filtering
|
50
|
+
- Pagination
|
51
|
+
- Image cell support
|
52
|
+
|
53
|
+
#### FormPage
|
54
|
+
- Purpose: Handles data input and editing
|
55
|
+
- Features:
|
56
|
+
- Dynamic form generation
|
57
|
+
- Validation
|
58
|
+
- File upload support
|
59
|
+
- Custom field types
|
60
|
+
|
61
|
+
#### Login
|
62
|
+
- Purpose: Authentication interface
|
63
|
+
- Features:
|
64
|
+
- User authentication
|
65
|
+
- Session management
|
66
|
+
- Security handling
|
67
|
+
|
68
|
+
## Decorators
|
69
|
+
|
70
|
+
### List Decorators
|
71
|
+
|
72
|
+
#### @List
|
73
|
+
```typescript
|
74
|
+
@List(options: ListOptions)
|
75
|
+
class YourListClass {
|
76
|
+
// List implementation
|
77
|
+
}
|
78
|
+
```
|
79
|
+
|
80
|
+
#### @ImageCell
|
81
|
+
```typescript
|
82
|
+
@ImageCell(options: ImageCellOptions)
|
83
|
+
property: string;
|
84
|
+
```
|
85
|
+
|
86
|
+
#### @Cell
|
87
|
+
```typescript
|
88
|
+
@Cell(options: CellOptions)
|
89
|
+
property: any;
|
90
|
+
```
|
91
|
+
|
92
|
+
### Form Decorators
|
93
|
+
|
94
|
+
#### @Input
|
95
|
+
```typescript
|
96
|
+
@Input(options: InputOptions)
|
97
|
+
property: string;
|
98
|
+
```
|
99
|
+
|
100
|
+
#### @Crud
|
101
|
+
```typescript
|
102
|
+
@Crud(options: CrudOptions)
|
103
|
+
class YourCrudClass {
|
104
|
+
// CRUD implementation
|
105
|
+
}
|
106
|
+
```
|
107
|
+
|
108
|
+
## Type Definitions
|
109
|
+
|
110
|
+
### InitPanelOptions
|
111
|
+
```typescript
|
112
|
+
interface InitPanelOptions {
|
113
|
+
// Add specific options
|
114
|
+
}
|
115
|
+
```
|
116
|
+
|
117
|
+
### ScreenCreatorData
|
118
|
+
```typescript
|
119
|
+
interface ScreenCreatorData {
|
120
|
+
// Add specific data structure
|
121
|
+
}
|
122
|
+
```
|
123
|
+
|
124
|
+
## Technical Implementation Details
|
125
|
+
|
126
|
+
### State Management
|
127
|
+
- Uses React's built-in state management
|
128
|
+
- Supports external state management libraries
|
129
|
+
- Implements context for global state
|
130
|
+
|
131
|
+
### Data Flow
|
132
|
+
1. Panel initialization
|
133
|
+
2. Component mounting
|
134
|
+
3. Data fetching
|
135
|
+
4. State updates
|
136
|
+
5. UI rendering
|
137
|
+
|
138
|
+
### Performance Considerations
|
139
|
+
- Lazy loading for large lists
|
140
|
+
- Image optimization
|
141
|
+
- Caching strategies
|
142
|
+
- Memory management
|
143
|
+
|
144
|
+
### Security
|
145
|
+
- Input sanitization
|
146
|
+
- XSS prevention
|
147
|
+
- CSRF protection
|
148
|
+
- Authentication flow
|
149
|
+
|
150
|
+
## Development Guidelines
|
151
|
+
|
152
|
+
### Code Style
|
153
|
+
- Follow TypeScript best practices
|
154
|
+
- Use functional components with hooks
|
155
|
+
- Implement proper error handling
|
156
|
+
- Write unit tests for components
|
157
|
+
|
158
|
+
### Testing
|
159
|
+
- Unit tests for components
|
160
|
+
- Integration tests for decorators
|
161
|
+
- E2E tests for critical flows
|
162
|
+
- Performance testing
|
163
|
+
|
164
|
+
### Documentation
|
165
|
+
- JSDoc comments for components
|
166
|
+
- Type definitions
|
167
|
+
- Usage examples
|
168
|
+
- API documentation
|
169
|
+
|
170
|
+
## Build and Deployment
|
171
|
+
|
172
|
+
### Development
|
173
|
+
```bash
|
174
|
+
npm run dev
|
175
|
+
# or
|
176
|
+
yarn dev
|
177
|
+
```
|
178
|
+
|
179
|
+
### Production Build
|
180
|
+
```bash
|
181
|
+
npm run build
|
182
|
+
# or
|
183
|
+
yarn build
|
184
|
+
```
|
185
|
+
|
186
|
+
### Testing
|
187
|
+
```bash
|
188
|
+
npm run test
|
189
|
+
# or
|
190
|
+
yarn test
|
191
|
+
```
|
192
|
+
|
193
|
+
## Dependencies
|
194
|
+
|
195
|
+
### Core Dependencies
|
196
|
+
- React
|
197
|
+
- TypeScript
|
198
|
+
- Other essential libraries
|
199
|
+
|
200
|
+
### Development Dependencies
|
201
|
+
- Testing frameworks
|
202
|
+
- Build tools
|
203
|
+
- Linting tools
|
204
|
+
|
205
|
+
## Version Control
|
206
|
+
|
207
|
+
### Branch Strategy
|
208
|
+
- main: Production-ready code
|
209
|
+
- develop: Development branch
|
210
|
+
- feature/*: New features
|
211
|
+
- bugfix/*: Bug fixes
|
212
|
+
|
213
|
+
### Commit Convention
|
214
|
+
- feat: New features
|
215
|
+
- fix: Bug fixes
|
216
|
+
- docs: Documentation
|
217
|
+
- style: Code style
|
218
|
+
- refactor: Code refactoring
|
219
|
+
- test: Testing
|
220
|
+
- chore: Maintenance
|
221
|
+
|
222
|
+
## Troubleshooting
|
223
|
+
|
224
|
+
### Common Issues
|
225
|
+
1. List rendering performance
|
226
|
+
2. Form validation errors
|
227
|
+
3. Image loading issues
|
228
|
+
4. Authentication problems
|
229
|
+
|
230
|
+
### Solutions
|
231
|
+
- Performance optimization techniques
|
232
|
+
- Debugging strategies
|
233
|
+
- Error handling best practices
|
234
|
+
- Logging and monitoring
|
package/README.md
CHANGED
@@ -1,32 +1,66 @@
|
|
1
|
-
#
|
1
|
+
# React Panel Library
|
2
2
|
|
3
|
-
|
4
|
-
React Panel is a web application built using as the backend framework and React for the frontend. It features a customizable sidebar and supports CRUD operations on entities. This project is designed to be a foundational template for building admin panels or other web-based interfaces.
|
3
|
+
A powerful and flexible React-based panel library for building administrative interfaces and data management systems.
|
5
4
|
|
6
|
-
---
|
7
5
|
## Features
|
8
|
-
|
9
|
-
- **
|
10
|
-
- **
|
11
|
-
- **
|
12
|
-
- **
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
6
|
+
|
7
|
+
- **List Page Component**: Built-in list view with customizable cells and image handling
|
8
|
+
- **Form Page Component**: Flexible form creation and management
|
9
|
+
- **Login Component**: Authentication handling
|
10
|
+
- **Layout System**: Consistent layout management
|
11
|
+
- **Panel Component**: Core panel functionality
|
12
|
+
- **Counter Component**: Utility component for counting operations
|
13
|
+
|
14
|
+
## Decorators
|
15
|
+
|
16
|
+
The library provides several decorators for enhanced functionality:
|
17
|
+
|
18
|
+
### List Decorators
|
19
|
+
- `@List`: Main list decorator for creating list views
|
20
|
+
- `@ImageCell`: Specialized cell for handling images in lists
|
21
|
+
- `@Cell`: Base cell decorator for list items
|
22
|
+
|
23
|
+
### Form Decorators
|
24
|
+
- `@Input`: Form input decorator
|
25
|
+
- `@Crud`: CRUD operations decorator
|
26
|
+
|
27
|
+
## Installation
|
28
|
+
|
29
|
+
```bash
|
30
|
+
npm install proje-react-panel
|
31
|
+
# or
|
32
|
+
yarn add proje-react-panel
|
32
33
|
```
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
```typescript
|
38
|
+
import { Panel, ListPage, FormPage, Login, Layout } from 'proje-react-panel';
|
39
|
+
|
40
|
+
// Initialize the panel
|
41
|
+
const panel = new Panel({
|
42
|
+
// configuration options
|
43
|
+
});
|
44
|
+
|
45
|
+
// Use components
|
46
|
+
<Layout>
|
47
|
+
<ListPage />
|
48
|
+
<FormPage />
|
49
|
+
<Login />
|
50
|
+
</Layout>
|
51
|
+
```
|
52
|
+
|
53
|
+
## Type Definitions
|
54
|
+
|
55
|
+
The library includes TypeScript definitions for better development experience:
|
56
|
+
|
57
|
+
- `InitPanelOptions`: Configuration options for panel initialization
|
58
|
+
- `ScreenCreatorData`: Data structure for screen creation
|
59
|
+
|
60
|
+
## Contributing
|
61
|
+
|
62
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
63
|
+
|
64
|
+
## License
|
65
|
+
|
66
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
@@ -0,0 +1,12 @@
|
|
1
|
+
interface FetchOptions {
|
2
|
+
token: string;
|
3
|
+
baseUrl: string;
|
4
|
+
}
|
5
|
+
export declare const CrudApi: {
|
6
|
+
getList: (options: FetchOptions, api: string) => Promise<any>;
|
7
|
+
create: (options: FetchOptions, api: string, data: any) => Promise<any>;
|
8
|
+
details: (options: FetchOptions, api: string, id: any) => Promise<any>;
|
9
|
+
edit: (options: FetchOptions, api: string, data: any) => Promise<any>;
|
10
|
+
delete: (options: FetchOptions, api: string, id: string) => Promise<any>;
|
11
|
+
};
|
12
|
+
export {};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
interface CounterProps {
|
3
|
+
image: React.ReactNode;
|
4
|
+
text: string;
|
5
|
+
targetNumber: number;
|
6
|
+
duration?: number;
|
7
|
+
}
|
8
|
+
export declare function Counter({ image, text, targetNumber, duration }: CounterProps): React.JSX.Element;
|
9
|
+
export {};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { InputOptions } from '../../decorators/form/Input';
|
3
|
+
import { UseFormRegister } from 'react-hook-form';
|
4
|
+
interface FormFieldProps {
|
5
|
+
input: InputOptions;
|
6
|
+
register: UseFormRegister<any>;
|
7
|
+
error?: {
|
8
|
+
message?: string;
|
9
|
+
};
|
10
|
+
baseName?: string;
|
11
|
+
}
|
12
|
+
export declare function FormField({ input, register, error, baseName }: FormFieldProps): React.JSX.Element;
|
13
|
+
export {};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from "react";
|
2
|
+
interface MultipleImageUploaderProps {
|
3
|
+
value?: Array<{
|
4
|
+
file: File;
|
5
|
+
image: string;
|
6
|
+
remove?: boolean;
|
7
|
+
}>;
|
8
|
+
onError?: (error: string | null) => void;
|
9
|
+
onClear?: () => void;
|
10
|
+
reset?: any;
|
11
|
+
onFilesChange?: (files: File[]) => void;
|
12
|
+
}
|
13
|
+
export declare function ImageUploader(): React.JSX.Element;
|
14
|
+
export declare function MultipleImageUploader(props: MultipleImageUploaderProps): React.JSX.Element;
|
15
|
+
export {};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { FormOptions } from '../../decorators/form/FormOptions';
|
3
|
+
import { AnyClass } from '../../types/AnyClass';
|
4
|
+
import { OnSubmitFN, GetDetailsDataFN } from '../pages/FormPage';
|
5
|
+
interface InnerFormProps<T extends AnyClass> {
|
6
|
+
formOptions: FormOptions;
|
7
|
+
onSubmit: OnSubmitFN<T>;
|
8
|
+
getDetailsData?: GetDetailsDataFN<T>;
|
9
|
+
redirectBackOnSuccess?: boolean;
|
10
|
+
}
|
11
|
+
export declare function InnerForm<T extends AnyClass>({ formOptions, onSubmit, getDetailsData, redirectBackOnSuccess, }: InnerFormProps<T>): React.JSX.Element;
|
12
|
+
export {};
|