@guillotinaweb/react-gmi 0.34.0 → 0.34.2
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 +120 -72
- package/dist/css/style.css +336 -334
- package/dist/css/style.css.map +1 -1
- package/dist/favicon.ico +0 -0
- package/dist/index.d.ts +1821 -30
- package/dist/index.html +44 -0
- package/dist/logo.svg +35 -0
- package/dist/logo512.png +0 -0
- package/dist/manifest.json +25 -0
- package/dist/react-gmi.js +24141 -14138
- package/dist/react-gmi.js.map +1 -1
- package/dist/react-gmi.modern.js +24265 -14128
- package/dist/react-gmi.modern.js.map +1 -1
- package/dist/robots.txt +2 -0
- package/package.json +54 -53
- package/dist/actions/add_item.d.ts +0 -5
- package/dist/actions/change_pass.d.ts +0 -1
- package/dist/actions/copy_item.d.ts +0 -6
- package/dist/actions/copy_items.d.ts +0 -8
- package/dist/actions/index.d.ts +0 -2
- package/dist/actions/move_item.d.ts +0 -6
- package/dist/actions/move_items.d.ts +0 -8
- package/dist/actions/remove_item.d.ts +0 -6
- package/dist/actions/remove_items.d.ts +0 -7
- package/dist/components/Link.d.ts +0 -11
- package/dist/components/TdLink.d.ts +0 -11
- package/dist/components/behavior_view.d.ts +0 -8
- package/dist/components/behaviors/iattachment.d.ts +0 -11
- package/dist/components/behaviors/idublincore.d.ts +0 -10
- package/dist/components/behaviors/iimageattachment.d.ts +0 -9
- package/dist/components/behaviors/imultiattachment.d.ts +0 -11
- package/dist/components/behaviors/imultiimageattachment.d.ts +0 -11
- package/dist/components/behaviors/imultiimageorderedattachment.d.ts +0 -11
- package/dist/components/behaviors/iworkflow.d.ts +0 -1
- package/dist/components/context_toolbar.d.ts +0 -7
- package/dist/components/error_boundary.d.ts +0 -6
- package/dist/components/error_zone.d.ts +0 -16
- package/dist/components/fields/downloadField.d.ts +0 -11
- package/dist/components/fields/editComponent.d.ts +0 -15
- package/dist/components/fields/editableField.d.ts +0 -12
- package/dist/components/fields/renderField.d.ts +0 -34
- package/dist/components/flash.d.ts +0 -1
- package/dist/components/guillotina.d.ts +0 -12
- package/dist/components/index.d.ts +0 -56
- package/dist/components/input/button.d.ts +0 -12
- package/dist/components/input/checkbox.d.ts +0 -18
- package/dist/components/input/dropdown.d.ts +0 -15
- package/dist/components/input/email.d.ts +0 -10
- package/dist/components/input/form.d.ts +0 -13
- package/dist/components/input/form_builder.d.ts +0 -15
- package/dist/components/input/index.d.ts +0 -14
- package/dist/components/input/input.d.ts +0 -26
- package/dist/components/input/input_list.d.ts +0 -9
- package/dist/components/input/password.d.ts +0 -11
- package/dist/components/input/search_input.d.ts +0 -21
- package/dist/components/input/search_input_list.d.ts +0 -21
- package/dist/components/input/select.d.ts +0 -25
- package/dist/components/input/select_vocabulary.d.ts +0 -15
- package/dist/components/input/textarea.d.ts +0 -15
- package/dist/components/input/upload.d.ts +0 -8
- package/dist/components/item.d.ts +0 -22
- package/dist/components/layout.d.ts +0 -9
- package/dist/components/login.d.ts +0 -10
- package/dist/components/modal.d.ts +0 -24
- package/dist/components/notallowed.d.ts +0 -1
- package/dist/components/notfound.d.ts +0 -1
- package/dist/components/pagination.d.ts +0 -8
- package/dist/components/panel/actions.d.ts +0 -1
- package/dist/components/panel/addons.d.ts +0 -1
- package/dist/components/panel/behaviors.d.ts +0 -1
- package/dist/components/panel/index.d.ts +0 -4
- package/dist/components/panel/items.d.ts +0 -1
- package/dist/components/panel/permissions.d.ts +0 -7
- package/dist/components/panel/permissions_prinperm.d.ts +0 -17
- package/dist/components/panel/permissions_prinrole.d.ts +0 -17
- package/dist/components/panel/permissions_roleperm.d.ts +0 -17
- package/dist/components/panel/properties.d.ts +0 -1
- package/dist/components/path.d.ts +0 -1
- package/dist/components/properties_view.d.ts +0 -3
- package/dist/components/search_labels.d.ts +0 -5
- package/dist/components/search_options_labels.d.ts +0 -9
- package/dist/components/search_vocabulary_labels.d.ts +0 -6
- package/dist/components/selected_items_actions.d.ts +0 -49
- package/dist/components/tabs.d.ts +0 -13
- package/dist/components/ui/delete.d.ts +0 -8
- package/dist/components/ui/icon.d.ts +0 -7
- package/dist/components/ui/index.d.ts +0 -6
- package/dist/components/ui/loading.d.ts +0 -6
- package/dist/components/ui/notification.d.ts +0 -7
- package/dist/components/ui/table.d.ts +0 -8
- package/dist/components/ui/tag.d.ts +0 -9
- package/dist/components/widgets/index.d.ts +0 -1
- package/dist/components/widgets/tags.d.ts +0 -13
- package/dist/contexts/index.d.ts +0 -57
- package/dist/forms/base.d.ts +0 -12
- package/dist/forms/required_fields.d.ts +0 -11
- package/dist/forms/users.d.ts +0 -13
- package/dist/hooks/useClickAway.d.ts +0 -2
- package/dist/hooks/useConfig.d.ts +0 -19
- package/dist/hooks/useCrudContext.d.ts +0 -21
- package/dist/hooks/useInput.d.ts +0 -11
- package/dist/hooks/useLocation.d.ts +0 -6
- package/dist/hooks/useMountedState.d.ts +0 -1
- package/dist/hooks/useRegistry.d.ts +0 -90
- package/dist/hooks/useRemoteField.d.ts +0 -2
- package/dist/hooks/useSetState.d.ts +0 -6
- package/dist/hooks/useVocabulary.d.ts +0 -8
- package/dist/lib/auth.d.ts +0 -26
- package/dist/lib/client.d.ts +0 -61
- package/dist/lib/helpers.d.ts +0 -16
- package/dist/lib/processResponse.d.ts +0 -9
- package/dist/lib/rest.d.ts +0 -16
- package/dist/lib/search.d.ts +0 -2
- package/dist/lib/utils.d.ts +0 -5
- package/dist/lib/validators.d.ts +0 -12
- package/dist/locales/generic_messages.d.ts +0 -248
- package/dist/models/index.d.ts +0 -17
- package/dist/models/sharing.d.ts +0 -12
- package/dist/react-gmi.umd.js +0 -14783
- package/dist/react-gmi.umd.js.map +0 -1
- package/dist/reducers/guillotina.d.ts +0 -35
- package/dist/types/global.d.ts +0 -17
- package/dist/types/guillotina.d.ts +0 -280
- package/dist/views/application.d.ts +0 -13
- package/dist/views/base.d.ts +0 -5
- package/dist/views/container.d.ts +0 -1
- package/dist/views/folder.d.ts +0 -1
- package/dist/views/groups.d.ts +0 -3
- package/dist/views/item.d.ts +0 -1
- package/dist/views/users.d.ts +0 -3
package/README.md
CHANGED
|
@@ -1,76 +1,93 @@
|
|
|
1
1
|
# 🔌 Guillotina Management Interface
|
|
2
2
|
|
|
3
|
-
It's
|
|
3
|
+
A **framework-first React UI layer** for [Guillotina](https://guillotina.io/), enabling developers to build custom content management interfaces. It's built around the idea of a framework to roll your own GMI.
|
|
4
4
|
|
|
5
5
|
Provides an interface to access all Guillotina content depending on user permissions and allowing you to apply actions like create/modify/remove content, UI interactions like displaying flash messages, etc.
|
|
6
6
|
|
|
7
|
-
All this with the flexibility to build it your way, adding your own content with your forms, your icons, etc. It's
|
|
8
|
-
layer that could be extended from outside.
|
|
7
|
+
All this with the flexibility to build it your way, adding your own content with your forms, your icons, etc. It's built around the idea to act as a framework layer that could be extended from outside via the **registry pattern**.
|
|
9
8
|
|
|
10
9
|
## Prerequisites
|
|
11
10
|
|
|
12
|
-
- React
|
|
11
|
+
- React 16.12+ / 17 / 18 / 19
|
|
12
|
+
- Node.js 20+
|
|
13
|
+
- TypeScript 5.4+
|
|
13
14
|
|
|
14
15
|
## Status
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
Stable version. Actively maintained and used in production.
|
|
17
18
|
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
### With create react app
|
|
19
|
+
## Quick Start
|
|
21
20
|
|
|
22
21
|
```bash
|
|
23
|
-
|
|
24
|
-
npx create-react-app gmi_demo
|
|
22
|
+
npm create vite@latest gmi_demo -- --template react-ts
|
|
25
23
|
cd gmi_demo
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
pnpm install
|
|
25
|
+
pnpm add @guillotinaweb/react-gmi
|
|
29
26
|
```
|
|
30
27
|
|
|
31
|
-
App.
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
import
|
|
35
|
-
import {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
28
|
+
`App.tsx`
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { useState, useEffect } from 'react'
|
|
32
|
+
import {
|
|
33
|
+
Layout,
|
|
34
|
+
Auth,
|
|
35
|
+
Guillotina,
|
|
36
|
+
Login,
|
|
37
|
+
getClient,
|
|
38
|
+
ClientProvider,
|
|
39
|
+
GuillotinaClient,
|
|
40
|
+
} from '@guillotinaweb/react-gmi'
|
|
41
|
+
import '@guillotinaweb/react-gmi/css/style.css'
|
|
42
|
+
|
|
43
|
+
// Guillotina server URL
|
|
44
|
+
const url = 'http://localhost:8080'
|
|
45
|
+
const schemas = ['/db/container/']
|
|
47
46
|
const auth = new Auth(url)
|
|
48
|
-
const client = getClient(url, schema, auth)
|
|
49
47
|
|
|
50
48
|
function App() {
|
|
49
|
+
const [currentSchema, setCurrentSchema] = useState('/db/container/')
|
|
50
|
+
const [clientInstance, setClientInstance] = useState<
|
|
51
|
+
GuillotinaClient | undefined
|
|
52
|
+
>(undefined)
|
|
51
53
|
const [isLogged, setLogged] = useState(auth.isLogged)
|
|
52
54
|
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
setClientInstance(getClient(url, currentSchema, auth))
|
|
57
|
+
}, [currentSchema])
|
|
58
|
+
|
|
53
59
|
const onLogin = () => {
|
|
54
60
|
setLogged(true)
|
|
55
61
|
}
|
|
56
|
-
|
|
62
|
+
|
|
57
63
|
const onLogout = () => {
|
|
58
|
-
setLogged(false)
|
|
59
|
-
}
|
|
64
|
+
setLogged(false)
|
|
65
|
+
}
|
|
60
66
|
|
|
61
|
-
|
|
67
|
+
if (clientInstance === undefined) {
|
|
68
|
+
return null
|
|
69
|
+
}
|
|
62
70
|
|
|
63
71
|
return (
|
|
64
|
-
<ClientProvider client={
|
|
72
|
+
<ClientProvider client={clientInstance}>
|
|
65
73
|
<Layout auth={auth} onLogout={onLogout}>
|
|
66
|
-
{isLogged &&
|
|
74
|
+
{isLogged && (
|
|
75
|
+
<Guillotina
|
|
76
|
+
auth={auth}
|
|
77
|
+
url={currentSchema}
|
|
78
|
+
locale="en"
|
|
79
|
+
registry={{}}
|
|
80
|
+
/>
|
|
81
|
+
)}
|
|
67
82
|
{!isLogged && (
|
|
68
83
|
<div className="columns is-centered">
|
|
69
|
-
<div className="
|
|
70
|
-
|
|
84
|
+
<div className="column is-half">
|
|
85
|
+
<Login
|
|
71
86
|
onLogin={onLogin}
|
|
72
87
|
auth={auth}
|
|
73
|
-
|
|
88
|
+
schemas={schemas}
|
|
89
|
+
currentSchema={currentSchema}
|
|
90
|
+
setCurrentSchema={setCurrentSchema}
|
|
74
91
|
/>
|
|
75
92
|
</div>
|
|
76
93
|
</div>
|
|
@@ -80,45 +97,86 @@ function App() {
|
|
|
80
97
|
)
|
|
81
98
|
}
|
|
82
99
|
|
|
83
|
-
|
|
84
100
|
export default App
|
|
85
101
|
```
|
|
86
102
|
|
|
87
|
-
###
|
|
103
|
+
### Adding Icons
|
|
88
104
|
|
|
89
|
-
Add
|
|
105
|
+
Add Font Awesome icons to your HTML:
|
|
90
106
|
|
|
91
|
-
```
|
|
92
|
-
<
|
|
93
|
-
+ <script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
|
|
94
|
-
<meta
|
|
95
|
-
name="description"
|
|
96
|
-
content="Web site created using create-react-app"
|
|
97
|
-
/>
|
|
107
|
+
```html
|
|
108
|
+
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
|
|
98
109
|
```
|
|
99
110
|
|
|
100
|
-
|
|
111
|
+
### Extending with Registry Pattern
|
|
112
|
+
|
|
113
|
+
The framework uses a registry system that allows you to override views, forms, actions, and behaviors:
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
<Guillotina
|
|
117
|
+
auth={auth}
|
|
118
|
+
url={schema}
|
|
119
|
+
registry={{
|
|
120
|
+
views: {
|
|
121
|
+
MyCustomType: MyCustomView,
|
|
122
|
+
},
|
|
123
|
+
forms: {
|
|
124
|
+
MyCustomType: MyCustomForm,
|
|
125
|
+
},
|
|
126
|
+
actions: {
|
|
127
|
+
myAction: MyActionModal,
|
|
128
|
+
},
|
|
129
|
+
behaviors: {
|
|
130
|
+
'my.behavior.Interface': MyBehaviorPanel,
|
|
131
|
+
},
|
|
132
|
+
}}
|
|
133
|
+
/>
|
|
134
|
+
```
|
|
101
135
|
|
|
102
|
-
|
|
103
|
-
curl https://raw.githubusercontent.com/guillotinaweb/guillotina_react/master/public/logo.svg > public/logo.svg
|
|
136
|
+
See the [Extension Guide](docs/extend.md) for detailed examples.
|
|
104
137
|
|
|
105
|
-
|
|
138
|
+
## Documentation
|
|
106
139
|
|
|
107
|
-
|
|
140
|
+
- [Getting Started - Step by Step](docs/tutorial/tutorial.md) - Complete tutorial
|
|
141
|
+
- [Development Setup](docs/development-setup.md) - Set up your local environment
|
|
142
|
+
- [Extension Guide](docs/extend.md) - How to extend and customize
|
|
143
|
+
- [API Documentation](docs/api.md) - Component and hook reference
|
|
108
144
|
|
|
109
|
-
|
|
110
|
-
- [Narrative Docs](docs/api.md)
|
|
111
|
-
- [Getting Started - Step by Step](docs/tutorial/tutorial.md)
|
|
145
|
+
## Development
|
|
112
146
|
|
|
113
|
-
|
|
147
|
+
### Prerequisites
|
|
114
148
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
149
|
+
- Node.js 20+
|
|
150
|
+
- pnpm 9+ (`npm install -g pnpm`)
|
|
151
|
+
- Docker (for running Guillotina)
|
|
152
|
+
|
|
153
|
+
### Quick Start
|
|
119
154
|
|
|
155
|
+
```bash
|
|
156
|
+
# Clone and install
|
|
157
|
+
git clone git@github.com:guillotinaweb/guillotina_react.git
|
|
158
|
+
cd guillotina_react
|
|
159
|
+
pnpm install
|
|
160
|
+
|
|
161
|
+
# Start Guillotina backend (see docs/development-setup.md for details)
|
|
162
|
+
docker run -d --name postgres -e POSTGRES_DB=guillotina -e POSTGRES_USER=guillotina -e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432 postgres:18
|
|
163
|
+
docker run --rm -it --link=postgres -p 8080:8080 plone/guillotina:latest
|
|
164
|
+
|
|
165
|
+
# Start development server
|
|
166
|
+
pnpm dev
|
|
120
167
|
```
|
|
121
168
|
|
|
169
|
+
### Available Scripts
|
|
170
|
+
|
|
171
|
+
| Command | Description |
|
|
172
|
+
|---------|-------------|
|
|
173
|
+
| `pnpm dev` | Start playground with HMR (Vite) |
|
|
174
|
+
| `pnpm build` | Build the library (JS + CSS) using Vite |
|
|
175
|
+
| `pnpm test` | Run unit tests (Vitest) |
|
|
176
|
+
| `pnpm test:e2e` | Run E2E tests (Playwright) |
|
|
177
|
+
| `pnpm lint` | Run ESLint |
|
|
178
|
+
| `pnpm format` | Format with Prettier |
|
|
179
|
+
|
|
122
180
|
## Screenshots
|
|
123
181
|
|
|
124
182
|

|
|
@@ -131,13 +189,3 @@ This project is sponsored by <a href="https://iskra.cat">Iskra</a>
|
|
|
131
189
|
|
|
132
190
|
<a href="https://iskra.cat"><img src="https://storage.googleapis.com/iskra/iskra-logo.png" /></a>
|
|
133
191
|
|
|
134
|
-
# TODO
|
|
135
|
-
[X] Test workflow
|
|
136
|
-
[X] Filter workflow
|
|
137
|
-
[X] Test multiples fields GMI, all selects, and files behaviors
|
|
138
|
-
[] Render tags and render values in properties form, use vocabulary label instead of vocabulary key
|
|
139
|
-
[] Add richtext
|
|
140
|
-
[X] Add scales in IImageAttachment
|
|
141
|
-
[] Guillotina, no elimina l'info de l'imatge de l'objecte quan es borra, si que elimina l¡imatge, fer test a guillotina de IImageAttachment i @delete
|
|
142
|
-
[] Poder posar per defecte un Panel properties, item properties etc a tots els tipus. Llegir-ho del context
|
|
143
|
-
[] Mirar de fer generic el Traversal, per no haver de fer el "as" i poder dir de quin tipus és el context
|