@guillotinaweb/react-gmi 0.33.0 → 0.34.1

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