@dakataa/crud-react 1.0.4 → 1.0.7
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/README.md +71 -20
- package/dist/crud-react.css +1 -1
- package/dist/crud-react.js +2167 -1219
- package/dist/main.d.ts +70 -13
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -1,39 +1,89 @@
|
|
|
1
1
|
# CRUD Dashboard React (Frontend)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
This is a frontend react implementation of CRUD.
|
|
3
|
+
Easy way to create CRUD ADMIN panel / Dashboard for your software.
|
|
4
|
+
|
|
5
|
+
This library depend on [@dakataa/crud](https://github.com/dakataa/crud) which is CRUD REST API; however, it can also be used as a standalone
|
|
6
|
+
if you provide the correct data structure. The components are based on the Bootstrap Framework.
|
|
7
|
+
|
|
8
|
+
### Table of Contents
|
|
9
|
+
1. [Installation](#installation)
|
|
10
|
+
2. [Configuration](#configuration)
|
|
11
|
+
3. [Examples](#examples)
|
|
12
|
+
4. [Components](#components)
|
|
13
|
+
- [Grid](#GridView)
|
|
14
|
+
- [Form](#form)
|
|
15
|
+
- [Templating](#templates)
|
|
16
|
+
- [Dynamic View](#dynamic-view)
|
|
17
|
+
- [Modal](#modal)
|
|
18
|
+
- [Alert](#alert)
|
|
19
|
+
- [Navigation](#navigation)
|
|
20
|
+
5. Layout
|
|
21
|
+
6. [Hooks](#hooks)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Installation
|
|
25
|
+
|
|
26
|
+
#### Using npm:
|
|
27
|
+
```shell
|
|
28
|
+
npm install @dakataa/crud-react
|
|
8
29
|
```
|
|
9
30
|
|
|
31
|
+
#### Using yarn:
|
|
32
|
+
```shell
|
|
33
|
+
yarn add @dakataa/crud-react
|
|
34
|
+
```
|
|
10
35
|
|
|
11
36
|
### Configuration
|
|
12
|
-
Base way to configure and use it.
|
|
13
37
|
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import {CrudConfiguration} from "@dakataa/crud-react";
|
|
41
|
+
|
|
42
|
+
CrudConfiguration({
|
|
43
|
+
connection: {
|
|
44
|
+
baseURL: 'https://crud-rest-api.local'
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Example
|
|
50
|
+
|
|
51
|
+
#### Example with *react-router*
|
|
14
52
|
main.tsx
|
|
53
|
+
|
|
15
54
|
```jsx
|
|
16
55
|
import {StrictMode} from 'react'
|
|
17
56
|
import {createRoot} from 'react-dom/client'
|
|
18
|
-
import {
|
|
19
|
-
|
|
57
|
+
import {Crud, CrudConfiguration, MainLayout, Router, Route, Outlet} from "@dakataa/crud-react";
|
|
58
|
+
|
|
59
|
+
const templates = import.meta.glob('./crud/**');
|
|
20
60
|
|
|
21
|
-
CrudConfiguration(
|
|
61
|
+
CrudConfiguration({
|
|
62
|
+
connection: {
|
|
63
|
+
baseURL: 'https://project.local',
|
|
64
|
+
headers: {
|
|
65
|
+
Accept: 'application/json'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
templates: import.meta.glob('./crud/**')
|
|
69
|
+
});
|
|
22
70
|
|
|
23
71
|
createRoot(document.getElementById('root')!).render(
|
|
24
72
|
<StrictMode>
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
73
|
+
<Crud
|
|
74
|
+
config={{templates, currency: 'BGN', locale: 'bg', env: import.meta.env.CRUD_ENV}}
|
|
75
|
+
errorFallback={<CrudErrorFallback/>}
|
|
76
|
+
>
|
|
77
|
+
<Router>
|
|
78
|
+
<Route element={<MainLayout><Outlet/></MainLayout>}>
|
|
79
|
+
<Route path={"*"} element={<CrudLoader/>}/>
|
|
29
80
|
</Route>
|
|
30
|
-
</
|
|
31
|
-
</
|
|
81
|
+
</Router>
|
|
82
|
+
</Crud>
|
|
32
83
|
</StrictMode>
|
|
33
84
|
)
|
|
34
85
|
```
|
|
35
86
|
|
|
36
|
-
## Overview
|
|
37
87
|
|
|
38
88
|
### Legend
|
|
39
89
|
* Action
|
|
@@ -46,15 +96,16 @@ createRoot(document.getElementById('root')!).render(
|
|
|
46
96
|
## Hooks
|
|
47
97
|
### Data Provider
|
|
48
98
|
|
|
49
|
-
`
|
|
99
|
+
`GetDataByAction` is a Hook that allows you to fetch data based on CRUD action (see section [Actions](#legend)).
|
|
50
100
|
|
|
51
101
|
```js
|
|
52
102
|
const {
|
|
53
103
|
results,
|
|
104
|
+
setAction,
|
|
54
105
|
setParameters,
|
|
55
106
|
setQueryParameters,
|
|
56
107
|
refresh
|
|
57
|
-
} =
|
|
108
|
+
} = GetDataByAction({action});
|
|
58
109
|
```
|
|
59
110
|
|
|
60
111
|
### Actions
|
|
@@ -69,7 +120,7 @@ const {actions, getAction, getActionByPath} = UseActions();
|
|
|
69
120
|
|
|
70
121
|
## Components
|
|
71
122
|
### Dynamic View
|
|
72
|
-
|
|
123
|
+
### Router
|
|
73
124
|
### Templates
|
|
74
125
|
### Modal
|
|
75
126
|
### Dropdown
|
package/dist/crud-react.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.modal-alert{--animation-transform: null;--animation-transition: null;--animation-keyframes: animation-open-default;--animation-keyframes-duration: .3s;--animation-timeout-progress: 1s;--modal-alert-vertical-gutter: 1.5rem;--modal-alert-icon-size: 92px;transition:var(--animation-transition);transform:var(--animation-transform)}.modal-alert.fade{animation:animation-open-fade}.modal-alert.scale,.modal-alert.bounce,.modal-alert.default{animation:var(--animation-keyframes) var(--animation-keyframes-duration) ease-in-out}.modal-alert.show{--animation-transform: none}.modal-alert.close{animation-direction:reverse;animation-duration:calc(var(--animation-keyframes-duration) / 2)}.modal-alert .btn-close{position:absolute;top:1rem;right:1rem}.modal-alert .modal-alert-icon{width:var(--modal-alert-icon-size);height:var(--modal-alert-icon-size);margin-bottom:var(--modal-alert-vertical-gutter)}.modal-alert .modal-alert-title,.modal-alert .modal-alert-text{margin-bottom:var(--modal-alert-vertical-gutter)}.modal-alert .modal-alert-progress{background:var(--bs-primary);animation:animation-progress var(--animation-timeout-progress) linear;height:.25rem;position:absolute;bottom:0}@keyframes animation-progress{0%{width:100%}to{width:0%}}@keyframes animation-open-default{0%{transform:scale(.7);opacity:0}45%{transform:scale(1.05)}80%{transform:scale(.95)}to{transform:scale(1);opacity:1}}@keyframes animation-open-fade{0%{opacity:0}to{opacity:1}}
|
|
1
|
+
.modal-alert{--animation-transform: null;--animation-transition: null;--animation-keyframes: animation-open-default;--animation-keyframes-duration: .3s;--animation-timeout-progress: 1s;--modal-alert-vertical-gutter: 1.5rem;--modal-alert-icon-size: 92px;--bs-modal-zindex: 1150;transition:var(--animation-transition);transform:var(--animation-transform)}.modal-alert+.modal-backdrop{--bs-backdrop-zindex: 1100}.modal-alert.fade{animation:animation-open-fade}.modal-alert.scale,.modal-alert.bounce,.modal-alert.default{animation:var(--animation-keyframes) var(--animation-keyframes-duration) ease-in-out}.modal-alert.show{--animation-transform: none}.modal-alert.close{animation-direction:reverse;animation-duration:calc(var(--animation-keyframes-duration) / 2)}.modal-alert .btn-close{position:absolute;top:1rem;right:1rem}.modal-alert .modal-alert-icon{width:var(--modal-alert-icon-size);height:var(--modal-alert-icon-size);margin-bottom:var(--modal-alert-vertical-gutter)}.modal-alert .modal-alert-title,.modal-alert .modal-alert-text{margin-bottom:var(--modal-alert-vertical-gutter)}.modal-alert .modal-alert-progress{background:var(--bs-primary);animation:animation-progress var(--animation-timeout-progress) linear;height:.25rem;position:absolute;bottom:0}@keyframes animation-progress{0%{width:100%}to{width:0%}}@keyframes animation-open-default{0%{transform:scale(.7);opacity:0}45%{transform:scale(1.05)}80%{transform:scale(.95)}to{transform:scale(1);opacity:1}}@keyframes animation-open-fade{0%{opacity:0}to{opacity:1}}
|