proje-react-panel 1.0.14 → 1.0.15

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.
Files changed (149) hide show
  1. package/.cursor/rules.md +122 -0
  2. package/.cursor/settings.json +57 -0
  3. package/.eslintrc.js +5 -0
  4. package/.eslintrc.json +26 -0
  5. package/.prettierrc +10 -0
  6. package/.vscode/launch.json +17 -0
  7. package/.vscode/settings.json +8 -0
  8. package/PTD.md +234 -0
  9. package/README.md +62 -28
  10. package/dist/api/CrudApi.d.ts +12 -0
  11. package/dist/components/Panel.d.ts +2 -2
  12. package/dist/components/components/Checkbox.d.ts +6 -0
  13. package/dist/components/components/Counter.d.ts +9 -0
  14. package/dist/components/components/FormField.d.ts +12 -0
  15. package/dist/components/components/ImageUploader.d.ts +15 -0
  16. package/dist/components/components/InnerForm.d.ts +12 -0
  17. package/dist/components/components/LoadingScreen.d.ts +2 -0
  18. package/dist/components/components/index.d.ts +8 -0
  19. package/dist/components/layout/Layout.d.ts +2 -1
  20. package/dist/components/layout/SideBar.d.ts +4 -3
  21. package/dist/components/layout/index.d.ts +2 -0
  22. package/dist/components/list/Datagrid.d.ts +8 -0
  23. package/dist/components/list/Pagination.d.ts +11 -0
  24. package/dist/components/list/index.d.ts +0 -0
  25. package/dist/{src/screens → components/pages}/ControllerDetails.d.ts +1 -1
  26. package/dist/components/pages/FormPage.d.ts +11 -0
  27. package/dist/components/pages/ListPage.d.ts +17 -0
  28. package/dist/components/pages/Login.d.ts +13 -0
  29. package/dist/decorators/form/Form.d.ts +6 -0
  30. package/dist/decorators/form/FormOptions.d.ts +7 -0
  31. package/dist/decorators/form/Input.d.ts +13 -0
  32. package/dist/decorators/form/getFormFields.d.ts +3 -0
  33. package/dist/decorators/{Cell.d.ts → list/Cell.d.ts} +2 -2
  34. package/dist/decorators/list/GetCellFields.d.ts +2 -0
  35. package/dist/decorators/list/ImageCell.d.ts +6 -0
  36. package/dist/decorators/list/List.d.ts +5 -0
  37. package/dist/decorators/list/ListData.d.ts +6 -0
  38. package/dist/decorators/list/getListFields.d.ts +2 -0
  39. package/dist/index.cjs.js +1 -1
  40. package/dist/index.d.ts +19 -10
  41. package/dist/index.esm.js +1 -1
  42. package/dist/initPanel.d.ts +2 -2
  43. package/dist/store/store.d.ts +1 -5
  44. package/dist/types/AnyClass.d.ts +1 -0
  45. package/dist/types/ScreenCreatorData.d.ts +5 -3
  46. package/dist/types/initPanelOptions.d.ts +0 -6
  47. package/dist/utils/format.d.ts +1 -0
  48. package/dist/utils/getFields.d.ts +2 -1
  49. package/package.json +5 -4
  50. package/src/api/CrudApi.ts +30 -11
  51. package/src/components/Panel.tsx +11 -11
  52. package/src/components/components/Checkbox.tsx +9 -0
  53. package/src/components/components/Counter.tsx +51 -0
  54. package/src/components/components/FormField.tsx +60 -0
  55. package/src/components/components/ImageUploader.tsx +301 -0
  56. package/src/components/components/InnerForm.tsx +75 -0
  57. package/src/components/components/LoadingScreen.tsx +12 -0
  58. package/src/components/components/index.ts +8 -0
  59. package/src/components/layout/Layout.tsx +8 -1
  60. package/src/components/layout/SideBar.tsx +103 -31
  61. package/src/components/layout/index.ts +2 -0
  62. package/src/components/list/Datagrid.tsx +101 -0
  63. package/src/components/list/Pagination.tsx +110 -0
  64. package/src/components/list/index.ts +1 -0
  65. package/src/components/pages/ControllerDetails.tsx +37 -0
  66. package/src/components/pages/FormPage.tsx +32 -0
  67. package/src/components/pages/ListPage.tsx +85 -0
  68. package/src/components/pages/Login.tsx +79 -0
  69. package/src/decorators/form/Form.ts +18 -0
  70. package/src/decorators/form/FormOptions.ts +8 -0
  71. package/src/decorators/form/Input.ts +52 -0
  72. package/src/decorators/form/getFormFields.ts +13 -0
  73. package/src/decorators/{Cell.ts → list/Cell.ts} +2 -14
  74. package/src/decorators/list/GetCellFields.ts +13 -0
  75. package/src/decorators/list/ImageCell.ts +13 -0
  76. package/src/decorators/list/List.ts +17 -0
  77. package/src/decorators/list/ListData.ts +7 -0
  78. package/src/decorators/list/getListFields.ts +10 -0
  79. package/src/index.ts +23 -10
  80. package/src/initPanel.ts +4 -12
  81. package/src/store/store.ts +23 -28
  82. package/src/styles/_scrollbar.scss +19 -0
  83. package/src/styles/counter.scss +42 -0
  84. package/src/styles/image-uploader.scss +94 -0
  85. package/src/styles/index.scss +30 -7
  86. package/src/styles/layout.scss +1 -6
  87. package/src/styles/list.scss +32 -5
  88. package/src/styles/loading-screen.scss +42 -0
  89. package/src/styles/pagination.scss +66 -0
  90. package/src/styles/sidebar.scss +64 -0
  91. package/src/types/AnyClass.ts +1 -0
  92. package/src/types/ScreenCreatorData.ts +5 -3
  93. package/src/types/initPanelOptions.ts +1 -7
  94. package/src/utils/format.ts +7 -0
  95. package/src/utils/getFields.ts +11 -9
  96. package/dist/api/crudApi.d.ts +0 -17
  97. package/dist/components/Form.d.ts +0 -6
  98. package/dist/components/FormField.d.ts +0 -13
  99. package/dist/components/list/List.d.ts +0 -10
  100. package/dist/components/screens/ControllerCreate.d.ts +0 -5
  101. package/dist/components/screens/ControllerDetails.d.ts +0 -5
  102. package/dist/components/screens/ControllerEdit.d.ts +0 -5
  103. package/dist/components/screens/ControllerList.d.ts +0 -5
  104. package/dist/components/screens/Login.d.ts +0 -2
  105. package/dist/decorators/Input.d.ts +0 -13
  106. package/dist/hooks/useScreens.d.ts +0 -2
  107. package/dist/initPanelOptions.d.ts +0 -8
  108. package/dist/screens/ControllerCreate.d.ts +0 -5
  109. package/dist/screens/ControllerDetails.d.ts +0 -5
  110. package/dist/screens/ControllerEdit.d.ts +0 -5
  111. package/dist/screens/ControllerList.d.ts +0 -5
  112. package/dist/screens/Form.d.ts +0 -6
  113. package/dist/src/api/crudApi.d.ts +0 -6
  114. package/dist/src/components/Panel.d.ts +0 -9
  115. package/dist/src/components/layout/Layout.d.ts +0 -11
  116. package/dist/src/components/layout/SideBar.d.ts +0 -10
  117. package/dist/src/components/list/List.d.ts +0 -10
  118. package/dist/src/decorators/Cell.d.ts +0 -10
  119. package/dist/src/decorators/Crud.d.ts +0 -6
  120. package/dist/src/index.d.ts +0 -8
  121. package/dist/src/screens/ControllerCreate.d.ts +0 -5
  122. package/dist/src/screens/ControllerEdit.d.ts +0 -5
  123. package/dist/src/screens/ControllerList.d.ts +0 -5
  124. package/dist/src/screens/Form.d.ts +0 -6
  125. package/dist/src/store/store.d.ts +0 -19
  126. package/dist/src/types/Screen.d.ts +0 -4
  127. package/dist/src/types/ScreenCreatorData.d.ts +0 -8
  128. package/dist/src/utils/createScreens.d.ts +0 -1
  129. package/dist/src/utils/getFields.d.ts +0 -2
  130. package/dist/src/utils/getScreens.d.ts +0 -2
  131. package/dist/utils/crudScreens.d.ts +0 -2
  132. package/dist/utils/getScreens.d.ts +0 -2
  133. package/src/api/AuthApi.ts +0 -14
  134. package/src/components/Form.tsx +0 -70
  135. package/src/components/FormField.tsx +0 -60
  136. package/src/components/list/List.tsx +0 -81
  137. package/src/components/screens/ControllerCreate.tsx +0 -7
  138. package/src/components/screens/ControllerDetails.tsx +0 -40
  139. package/src/components/screens/ControllerEdit.tsx +0 -35
  140. package/src/components/screens/ControllerList.tsx +0 -45
  141. package/src/components/screens/Login.tsx +0 -68
  142. package/src/decorators/Input.ts +0 -50
  143. package/src/hooks/useScreens.tsx +0 -36
  144. /package/dist/components/{ErrorBoundary.d.ts → components/ErrorBoundary.d.ts} +0 -0
  145. /package/dist/components/{ErrorComponent.d.ts → components/ErrorComponent.d.ts} +0 -0
  146. /package/dist/components/{Label.d.ts → components/Label.d.ts} +0 -0
  147. /package/src/components/{ErrorBoundary.tsx → components/ErrorBoundary.tsx} +0 -0
  148. /package/src/components/{ErrorComponent.tsx → components/ErrorComponent.tsx} +0 -0
  149. /package/src/components/{Label.tsx → components/Label.tsx} +0 -0
@@ -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
@@ -3,6 +3,11 @@ module.exports = {
3
3
  extends: ["eslint:recommended", "plugin:react/recommended"],
4
4
  parser: "@typescript-eslint/parser",
5
5
  plugins: ["@typescript-eslint"],
6
+ settings: {
7
+ react: {
8
+ version: "detect"
9
+ }
10
+ },
6
11
  overrides: [
7
12
  {
8
13
  files: ["*.ts", "*.tsx"],
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,10 @@
1
+ {
2
+ "tabWidth": 2,
3
+ "useTabs": false,
4
+ "printWidth": 100,
5
+ "singleQuote": true,
6
+ "trailingComma": "es5",
7
+ "bracketSpacing": true,
8
+ "arrowParens": "avoid",
9
+ "endOfLine": "lf"
10
+ }
@@ -0,0 +1,17 @@
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
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "editor.fontSize": 13,
3
+ "workbench.fontAliasing": "antialiased",
4
+ "chat.editor.fontSize": 15,
5
+ "debug.console.fontSize": 15,
6
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
7
+ "editor.formatOnSave": true
8
+ }
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
- # React Panel
1
+ # React Panel Library
2
2
 
3
- ## Overview
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
- - **Entity CRUD Operations**: Easily create, read, update, and delete entities through the panel.
9
- - **Sidebar Navigation**: The application includes a sidebar for easy navigation, which is fully customizable.
10
- - **Single Design Template**: Comes with a default design that can be customized to fit your needs.
11
- - **NestJS Integration**: It's designed especially for NestJS applications.
12
- - **Class-validator Support**: If you work with class-validator, you can easily copy-paste entity definitions to create tables and forms based on your entities.
13
- ---
14
-
15
- ## Getting Started
16
- ### Installation
17
- 1. Install dependencies:
18
- ```bash
19
- yarn add
20
- ```
21
-
22
- ### TypeScript Configuration
23
- Add these options to your `tsconfig.json` file:
24
- ```json
25
- {
26
- "compilerOptions": {
27
- "experimentalDecorators": true,
28
- "strictPropertyInitialization": false
29
- // other compiler options...
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 {};
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import { InitPanelOptions } from "../types/initPanelOptions";
1
+ import React from 'react';
2
+ import { InitPanelOptions } from '../types/initPanelOptions';
3
3
  type AppProps = {
4
4
  children: React.ReactNode;
5
5
  init: () => InitPanelOptions;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface CheckboxProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
+ id: string;
4
+ }
5
+ export declare function Checkbox({ id, ...props }: CheckboxProps): React.JSX.Element;
6
+ 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,12 @@
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
+ }
11
+ export declare function FormField({ input, register, error }: FormFieldProps): React.JSX.Element;
12
+ 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
+ redirect?: string;
9
+ getDetailsData?: GetDetailsDataFN<T>;
10
+ }
11
+ export declare function InnerForm<T extends AnyClass>({ formOptions, onSubmit, redirect, getDetailsData, }: InnerFormProps<T>): React.JSX.Element;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare function LoadingScreen(): React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ export { InnerForm } from './InnerForm';
2
+ export { FormField } from './FormField';
3
+ export { LoadingScreen } from './LoadingScreen';
4
+ export { Counter } from './Counter';
5
+ export { ImageUploader } from './ImageUploader';
6
+ export { ErrorComponent } from './ErrorComponent';
7
+ export { Label } from './Label';
8
+ export { ErrorBoundary } from './ErrorBoundary';