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.
- 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 +17 -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 +12 -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/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 +8 -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 +11 -0
- package/dist/components/pages/ListPage.d.ts +17 -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 +13 -0
- package/dist/decorators/form/getFormFields.d.ts +3 -0
- package/dist/decorators/{Cell.d.ts → list/Cell.d.ts} +2 -2
- 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 +5 -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 +19 -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 +5 -4
- package/src/api/CrudApi.ts +30 -11
- 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 +60 -0
- package/src/components/components/ImageUploader.tsx +301 -0
- package/src/components/components/InnerForm.tsx +75 -0
- package/src/components/components/LoadingScreen.tsx +12 -0
- package/src/components/components/index.ts +8 -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/list/Datagrid.tsx +101 -0
- package/src/components/list/Pagination.tsx +110 -0
- package/src/components/list/index.ts +1 -0
- package/src/components/pages/ControllerDetails.tsx +37 -0
- package/src/components/pages/FormPage.tsx +32 -0
- package/src/components/pages/ListPage.tsx +85 -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 +52 -0
- package/src/decorators/form/getFormFields.ts +13 -0
- package/src/decorators/{Cell.ts → list/Cell.ts} +2 -14
- package/src/decorators/list/GetCellFields.ts +13 -0
- package/src/decorators/list/ImageCell.ts +13 -0
- package/src/decorators/list/List.ts +17 -0
- package/src/decorators/list/ListData.ts +7 -0
- package/src/decorators/list/getListFields.ts +10 -0
- package/src/index.ts +23 -10
- package/src/initPanel.ts +4 -12
- package/src/store/store.ts +23 -28
- package/src/styles/_scrollbar.scss +19 -0
- package/src/styles/counter.scss +42 -0
- package/src/styles/image-uploader.scss +94 -0
- package/src/styles/index.scss +30 -7
- package/src/styles/layout.scss +1 -6
- package/src/styles/list.scss +32 -5
- package/src/styles/loading-screen.scss +42 -0
- package/src/styles/pagination.scss +66 -0
- package/src/styles/sidebar.scss +64 -0
- package/src/types/AnyClass.ts +1 -0
- package/src/types/ScreenCreatorData.ts +5 -3
- package/src/types/initPanelOptions.ts +1 -7
- 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/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/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
@@ -0,0 +1,19 @@
|
|
1
|
+
@mixin custom-scrollbar {
|
2
|
+
&::-webkit-scrollbar {
|
3
|
+
width: 8px;
|
4
|
+
height: 8px;
|
5
|
+
}
|
6
|
+
|
7
|
+
&::-webkit-scrollbar-track {
|
8
|
+
background: #2b2b2b;
|
9
|
+
}
|
10
|
+
|
11
|
+
&::-webkit-scrollbar-thumb {
|
12
|
+
background: #666666;
|
13
|
+
border-radius: 4px;
|
14
|
+
|
15
|
+
&:hover {
|
16
|
+
background: #777777;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
// Variables
|
2
|
+
$primary-color: #007bff;
|
3
|
+
$text-color: #ffffff;
|
4
|
+
$bg-color: #1a1a1a;
|
5
|
+
$shadow-color: rgba(0, 0, 0, 0.3);
|
6
|
+
|
7
|
+
// Mixins
|
8
|
+
@mixin flex-center {
|
9
|
+
display: flex;
|
10
|
+
align-items: center;
|
11
|
+
}
|
12
|
+
|
13
|
+
.counter {
|
14
|
+
&-container {
|
15
|
+
@include flex-center;
|
16
|
+
flex-direction: column;
|
17
|
+
padding: 20px;
|
18
|
+
border-radius: 8px;
|
19
|
+
box-shadow: 0 2px 4px $shadow-color;
|
20
|
+
background-color: $bg-color;
|
21
|
+
max-width: 300px;
|
22
|
+
margin: 20px auto;
|
23
|
+
}
|
24
|
+
|
25
|
+
&-image {
|
26
|
+
margin-bottom: 15px;
|
27
|
+
}
|
28
|
+
|
29
|
+
&-text {
|
30
|
+
font-size: 18px;
|
31
|
+
margin-bottom: 15px;
|
32
|
+
color: $text-color;
|
33
|
+
}
|
34
|
+
|
35
|
+
&-value {
|
36
|
+
font-size: 24px;
|
37
|
+
font-weight: bold;
|
38
|
+
min-width: 40px;
|
39
|
+
text-align: center;
|
40
|
+
color: $text-color;
|
41
|
+
}
|
42
|
+
}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
.multi-image {
|
2
|
+
|
3
|
+
&.hover {
|
4
|
+
.container {
|
5
|
+
border: 2px solid rgb(160,160,160);
|
6
|
+
background-color: rgb(250,250,250);
|
7
|
+
|
8
|
+
.plus {
|
9
|
+
background-color: rgb(240,240,240);
|
10
|
+
}
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
&.after {
|
15
|
+
.container {
|
16
|
+
button.trash {display:block;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
.container {
|
22
|
+
width: 100%;
|
23
|
+
display: grid;
|
24
|
+
grid-column-gap: 50px;
|
25
|
+
grid-template-columns: 1fr 1fr 1fr;
|
26
|
+
align-items: center;
|
27
|
+
border: 2px dashed rgb(160,160,160);
|
28
|
+
background-color: white;
|
29
|
+
min-height: 200px;
|
30
|
+
padding: 10px;
|
31
|
+
position:relative;
|
32
|
+
|
33
|
+
button.trash {
|
34
|
+
display:none;
|
35
|
+
position: absolute;
|
36
|
+
z-index: 1000;
|
37
|
+
right: 0;
|
38
|
+
top: 0;
|
39
|
+
background: none;
|
40
|
+
border: none;
|
41
|
+
cursor: pointer;
|
42
|
+
color: rgb(50,50,50);
|
43
|
+
}
|
44
|
+
|
45
|
+
> div {
|
46
|
+
text-align: center;
|
47
|
+
}
|
48
|
+
|
49
|
+
.image-container {
|
50
|
+
border: 1px solid rgb(245,245,255);
|
51
|
+
padding: 5px;
|
52
|
+
background-color: white;
|
53
|
+
position: relative;
|
54
|
+
|
55
|
+
.image.removed {
|
56
|
+
opacity: 0.3;
|
57
|
+
}
|
58
|
+
|
59
|
+
button {
|
60
|
+
position: absolute;
|
61
|
+
right: 0;
|
62
|
+
top: 0;
|
63
|
+
background: none;
|
64
|
+
border: none;
|
65
|
+
cursor: pointer;
|
66
|
+
|
67
|
+
&.remove {
|
68
|
+
color: red;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
.plus {
|
74
|
+
background-color: rgb(245,245,245);
|
75
|
+
position: relative;
|
76
|
+
height: 180px;
|
77
|
+
width: 200px;
|
78
|
+
|
79
|
+
span {
|
80
|
+
display: block;
|
81
|
+
position: absolute;
|
82
|
+
top: 50%;
|
83
|
+
left: 50%;
|
84
|
+
transform: translate(-50%,-50%);
|
85
|
+
|
86
|
+
> * {
|
87
|
+
display: block;
|
88
|
+
margin: 0 auto;
|
89
|
+
text-align: center;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
package/src/styles/index.scss
CHANGED
@@ -1,11 +1,22 @@
|
|
1
|
-
@
|
2
|
-
@
|
3
|
-
@
|
4
|
-
@
|
5
|
-
@
|
6
|
-
@
|
1
|
+
@forward './sidebar';
|
2
|
+
@forward './form';
|
3
|
+
@forward './layout';
|
4
|
+
@forward './list';
|
5
|
+
@forward './login';
|
6
|
+
@forward './error-boundary';
|
7
|
+
@forward './image-uploader';
|
8
|
+
@forward './counter';
|
9
|
+
@forward './loading-screen';
|
10
|
+
@forward './pagination';
|
7
11
|
|
8
|
-
.layout{
|
12
|
+
.layout {
|
13
|
+
display: flex;
|
14
|
+
max-height: 100vh;
|
15
|
+
height: 100vh;
|
16
|
+
min-height: 100vh;
|
17
|
+
width: 100%;
|
18
|
+
padding: 0;
|
19
|
+
overflow: hidden !important;
|
9
20
|
a {
|
10
21
|
color: white;
|
11
22
|
|
@@ -20,4 +31,16 @@
|
|
20
31
|
*::after {
|
21
32
|
box-sizing: border-box;
|
22
33
|
}
|
34
|
+
|
35
|
+
// Imported styles will be scoped under .layout
|
36
|
+
@import './sidebar';
|
37
|
+
@import './form';
|
38
|
+
@import './list';
|
39
|
+
@import './login';
|
40
|
+
@import './error-boundary';
|
41
|
+
@import './image-uploader';
|
42
|
+
@import './counter';
|
43
|
+
@import './loading-screen';
|
44
|
+
@import './pagination';
|
45
|
+
@import './scrollbar';
|
23
46
|
}
|
package/src/styles/layout.scss
CHANGED
package/src/styles/list.scss
CHANGED
@@ -1,20 +1,47 @@
|
|
1
|
-
|
1
|
+
@import './scrollbar';
|
2
|
+
$header-height: 60px;
|
3
|
+
$footer-height: 60px;
|
4
|
+
$datagrid-height: calc(100vh - ($header-height + $footer-height));
|
5
|
+
.list {
|
2
6
|
width: 100%;
|
3
|
-
padding: 16px;
|
7
|
+
padding: 0 0 0 16px;
|
4
8
|
border-radius: 8px;
|
5
9
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
6
10
|
background-color: #2b2b2b;
|
7
11
|
color: #e0e0e0;
|
12
|
+
max-height: 100vh;
|
13
|
+
height: 100vh;
|
14
|
+
min-height: 100vh;
|
15
|
+
overflow: hidden !important;
|
8
16
|
|
9
|
-
.header {
|
17
|
+
.list-header {
|
18
|
+
height: $header-height;
|
10
19
|
font-size: 24px;
|
11
20
|
font-weight: bold;
|
12
21
|
text-align: center;
|
13
|
-
margin-bottom: 20px;
|
14
22
|
color: #ffffff;
|
15
23
|
}
|
24
|
+
.list-footer {
|
25
|
+
display: flex;
|
26
|
+
justify-content: space-between;
|
27
|
+
align-items: center;
|
28
|
+
height: $footer-height;
|
29
|
+
font-size: 24px;
|
30
|
+
font-weight: bold;
|
31
|
+
text-align: center;
|
32
|
+
color: #ffffff;
|
33
|
+
}
|
34
|
+
.datagrid {
|
35
|
+
height: $datagrid-height;
|
36
|
+
min-height: $datagrid-height;
|
37
|
+
max-height: $datagrid-height;
|
38
|
+
width: 100%;
|
39
|
+
overflow: auto;
|
40
|
+
|
41
|
+
@include custom-scrollbar;
|
42
|
+
}
|
16
43
|
|
17
|
-
.
|
44
|
+
.datagrid-table {
|
18
45
|
width: 100%;
|
19
46
|
border-collapse: collapse;
|
20
47
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
.loading-screen {
|
2
|
+
width: 100%;
|
3
|
+
height: 100%;
|
4
|
+
background-color: #1a1a1a;
|
5
|
+
display: flex;
|
6
|
+
justify-content: center;
|
7
|
+
align-items: center;
|
8
|
+
z-index: 9999;
|
9
|
+
|
10
|
+
.loading-container {
|
11
|
+
display: flex;
|
12
|
+
flex-direction: column;
|
13
|
+
align-items: center;
|
14
|
+
gap: 1.5rem;
|
15
|
+
}
|
16
|
+
|
17
|
+
.loading-spinner {
|
18
|
+
width: 50px;
|
19
|
+
height: 50px;
|
20
|
+
border: 3px solid #2a2a2a;
|
21
|
+
border-top: 3px solid #3498db;
|
22
|
+
border-radius: 50%;
|
23
|
+
animation: spin 1s linear infinite;
|
24
|
+
}
|
25
|
+
|
26
|
+
.loading-text {
|
27
|
+
color: #ffffff;
|
28
|
+
font-size: 1.2rem;
|
29
|
+
font-weight: 500;
|
30
|
+
letter-spacing: 1px;
|
31
|
+
opacity: 0.8;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
@keyframes spin {
|
36
|
+
0% {
|
37
|
+
transform: rotate(0deg);
|
38
|
+
}
|
39
|
+
100% {
|
40
|
+
transform: rotate(360deg);
|
41
|
+
}
|
42
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
$footer-height2: 60px;
|
2
|
+
|
3
|
+
.pagination {
|
4
|
+
display: flex;
|
5
|
+
justify-content: center;
|
6
|
+
align-items: center;
|
7
|
+
gap: 12px;
|
8
|
+
font-family:
|
9
|
+
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
10
|
+
|
11
|
+
&-item {
|
12
|
+
min-width: 40px;
|
13
|
+
height: 40px;
|
14
|
+
display: flex;
|
15
|
+
align-items: center;
|
16
|
+
justify-content: center;
|
17
|
+
border: 1px solid var(--border-color, #e2e8f0);
|
18
|
+
border-radius: 8px;
|
19
|
+
text-decoration: none;
|
20
|
+
color: var(--text-color, #2d3748);
|
21
|
+
background-color: var(--bg-color, #ffffff);
|
22
|
+
font-weight: 500;
|
23
|
+
font-size: 14px;
|
24
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
25
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
26
|
+
cursor: pointer;
|
27
|
+
|
28
|
+
&:hover:not(.disabled) {
|
29
|
+
background-color: var(--hover-bg-color, #f7fafc);
|
30
|
+
transform: translateY(-1px);
|
31
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
32
|
+
border-color: var(--primary-color, #007bff);
|
33
|
+
}
|
34
|
+
|
35
|
+
&.active {
|
36
|
+
background-color: var(--primary-color, #007bff);
|
37
|
+
color: var(--active-text-color, white);
|
38
|
+
border-color: var(--primary-color, #007bff);
|
39
|
+
box-shadow: 0 4px 6px rgba(0, 123, 255, 0.2);
|
40
|
+
font-weight: 600;
|
41
|
+
|
42
|
+
&:hover {
|
43
|
+
transform: translateY(-1px);
|
44
|
+
box-shadow: 0 6px 8px rgba(0, 123, 255, 0.3);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
&.disabled {
|
49
|
+
opacity: 0.5;
|
50
|
+
cursor: not-allowed;
|
51
|
+
pointer-events: none;
|
52
|
+
background-color: var(--disabled-bg-color, #f1f5f9);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
// Dark theme variables
|
58
|
+
[data-theme='dark'] {
|
59
|
+
--border-color: #2d3748;
|
60
|
+
--text-color: #f7fafc;
|
61
|
+
--bg-color: #1a202c;
|
62
|
+
--hover-bg-color: #2d3748;
|
63
|
+
--primary-color: #4299e1;
|
64
|
+
--active-text-color: #ffffff;
|
65
|
+
--disabled-bg-color: #2d3748;
|
66
|
+
}
|
package/src/styles/sidebar.scss
CHANGED
@@ -11,6 +11,17 @@
|
|
11
11
|
&.closed {
|
12
12
|
width: 60px;
|
13
13
|
|
14
|
+
.nav-links a.active {
|
15
|
+
border-radius: 0;
|
16
|
+
&::before {
|
17
|
+
|
18
|
+
background-color: #9b1a1a;
|
19
|
+
}
|
20
|
+
|
21
|
+
}
|
22
|
+
.nav-links a:hover {
|
23
|
+
transform: none !important;
|
24
|
+
}
|
14
25
|
}
|
15
26
|
|
16
27
|
.toggle-button {
|
@@ -48,8 +59,29 @@
|
|
48
59
|
text-decoration: none;
|
49
60
|
border-radius: 4px;
|
50
61
|
font-weight: 500;
|
62
|
+
transition: all 0.2s ease;
|
63
|
+
position: relative;
|
64
|
+
overflow: hidden;
|
65
|
+
|
66
|
+
&:hover {
|
67
|
+
background-color: rgba(233, 236, 239, 0.1);
|
68
|
+
transform: translateX(2px);
|
69
|
+
}
|
70
|
+
|
51
71
|
&.active {
|
52
72
|
background-color: rgba(233, 236, 239, 0.2);
|
73
|
+
color: #fff;
|
74
|
+
font-weight: 600;
|
75
|
+
|
76
|
+
&::before {
|
77
|
+
content: '';
|
78
|
+
position: absolute;
|
79
|
+
left: 0;
|
80
|
+
top: 0;
|
81
|
+
height: 100%;
|
82
|
+
width: 4px;
|
83
|
+
background-color: #fff;
|
84
|
+
}
|
53
85
|
}
|
54
86
|
|
55
87
|
.nav-links-icon {
|
@@ -68,4 +100,36 @@
|
|
68
100
|
}
|
69
101
|
}
|
70
102
|
}
|
103
|
+
|
104
|
+
.sidebar-footer {
|
105
|
+
position: absolute;
|
106
|
+
bottom: 0;
|
107
|
+
width: 100%;
|
108
|
+
padding: 1rem 0;
|
109
|
+
border-top: 1px solid #454d55;
|
110
|
+
|
111
|
+
.logout-button {
|
112
|
+
display: flex;
|
113
|
+
align-items: center;
|
114
|
+
width: 100%;
|
115
|
+
padding: 0.75rem 0;
|
116
|
+
color: #adb5bd;
|
117
|
+
background: none;
|
118
|
+
border: none;
|
119
|
+
cursor: pointer;
|
120
|
+
font-weight: 500;
|
121
|
+
transition: all 0.2s ease;
|
122
|
+
|
123
|
+
&:hover {
|
124
|
+
color: #fff;
|
125
|
+
background-color: rgba(233, 236, 239, 0.1);
|
126
|
+
}
|
127
|
+
|
128
|
+
.nav-links-icon {
|
129
|
+
display: inline-block;
|
130
|
+
width: 60px;
|
131
|
+
text-align: center;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
71
135
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export type AnyClass = abstract new (...args: any[]) => any;
|
@@ -1,12 +1,14 @@
|
|
1
|
-
import { CellOptions } from "../decorators/Cell";
|
1
|
+
import { CellOptions } from "../decorators/list/Cell";
|
2
2
|
import { CrudOptions } from "../decorators/Crud";
|
3
|
-
import { InputOptions } from "../decorators/Input";
|
3
|
+
import { InputOptions } from "../decorators/form/Input";
|
4
|
+
import { ListOptions } from "../decorators/list/List";
|
4
5
|
|
5
6
|
export interface ScreenCreatorData {
|
6
7
|
resolver: any;
|
7
8
|
fields: string[];
|
8
|
-
cells: CellOptions[];
|
9
9
|
inputs: InputOptions[];
|
10
10
|
crud?: CrudOptions;
|
11
11
|
path: string;
|
12
|
+
list?: ListOptions;
|
13
|
+
cells: CellOptions[];
|
12
14
|
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
export const bytesToSize = (bytes: number): string => {
|
2
|
+
if (bytes === 0) return '0 Bytes';
|
3
|
+
const k = 1024;
|
4
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
5
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
6
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
7
|
+
};
|
package/src/utils/getFields.ts
CHANGED
@@ -1,20 +1,22 @@
|
|
1
1
|
import { getMetadataStorage } from "class-validator";
|
2
|
-
import { getClassCrudData } from "../decorators/Crud";
|
3
2
|
import { classValidatorResolver } from "@hookform/resolvers/class-validator";
|
4
|
-
import { getCellFields } from "../decorators/Cell";
|
5
3
|
import { ScreenCreatorData } from "../types/ScreenCreatorData";
|
6
|
-
import { getInputFields } from "../decorators/Input";
|
4
|
+
import { getInputFields } from "../decorators/form/Input";
|
5
|
+
import { getClassListData } from "../decorators/list/List";
|
6
|
+
import { getCellFields } from "../decorators/list/GetCellFields";
|
7
|
+
import { AnyClass } from "../types/AnyClass";
|
7
8
|
|
8
|
-
export function getFields<T>(key: string, entityClass: T): ScreenCreatorData {
|
9
|
+
export function getFields<T extends AnyClass>(key: string, entityClass: T): ScreenCreatorData {
|
9
10
|
const metadataStorage = getMetadataStorage();
|
10
11
|
const targetMetadata = metadataStorage.getTargetValidationMetadatas(entityClass as any, "", false, false);
|
11
|
-
const
|
12
|
+
const listData = getClassListData(entityClass);
|
12
13
|
return {
|
13
14
|
resolver: classValidatorResolver(entityClass as any),
|
14
|
-
fields: Array.from(new Set(targetMetadata.map((meta) => meta.propertyName))),
|
15
|
-
inputs: getInputFields(entityClass),
|
16
15
|
cells: getCellFields(entityClass),
|
17
|
-
|
18
|
-
|
16
|
+
list: listData,
|
17
|
+
fields: Array.from(new Set(targetMetadata.map((meta) => meta.propertyName))),
|
18
|
+
inputs: getInputFields<T>(entityClass),
|
19
|
+
crud: { controller: "" },
|
20
|
+
path: "/" + key,
|
19
21
|
};
|
20
22
|
}
|
package/dist/api/crudApi.d.ts
DELETED
@@ -1,17 +0,0 @@
|
|
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: (fetchSettings: {
|
8
|
-
baseUrl: string;
|
9
|
-
}, api: string, data: any) => Promise<any>;
|
10
|
-
details: (fetchSettings: {
|
11
|
-
baseUrl: string;
|
12
|
-
}, api: string, id: any) => Promise<any>;
|
13
|
-
edit: (fetchSettings: {
|
14
|
-
baseUrl: string;
|
15
|
-
}, api: string, data: any) => Promise<any>;
|
16
|
-
};
|
17
|
-
export {};
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import { InputOptions } from "../decorators/Input";
|
3
|
-
import { UseFormRegister } from "react-hook-form";
|
4
|
-
interface FormFieldProps {
|
5
|
-
input: InputOptions;
|
6
|
-
register: UseFormRegister<any>;
|
7
|
-
isEditForm: boolean;
|
8
|
-
error?: {
|
9
|
-
message?: string;
|
10
|
-
};
|
11
|
-
}
|
12
|
-
export declare function FormField({ input, register, isEditForm, error }: FormFieldProps): React.JSX.Element;
|
13
|
-
export {};
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import { CellOptions } from "../../decorators/Cell";
|
3
|
-
import { Screen } from "../../types/Screen";
|
4
|
-
interface ListProps<T> {
|
5
|
-
data: T[];
|
6
|
-
cells: CellOptions[];
|
7
|
-
screen: Screen;
|
8
|
-
}
|
9
|
-
export declare function List<T>({ data, cells }: ListProps<T>): React.JSX.Element;
|
10
|
-
export {};
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import "reflect-metadata";
|
2
|
-
export interface InputOptions {
|
3
|
-
name?: string;
|
4
|
-
label?: string;
|
5
|
-
placeholder?: string;
|
6
|
-
editable?: boolean;
|
7
|
-
inputType?: "text" | "email" | "tel" | "password" | "number" | "date";
|
8
|
-
type?: "input" | "select" | "textarea";
|
9
|
-
selectOptions?: string[];
|
10
|
-
cancelPasswordValidationOnEdit?: boolean;
|
11
|
-
}
|
12
|
-
export declare function Input(options?: InputOptions): PropertyDecorator;
|
13
|
-
export declare function getInputFields(entityClass: any): InputOptions[];
|