@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.
Files changed (130) hide show
  1. package/README.md +120 -72
  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 +24141 -14138
  11. package/dist/react-gmi.js.map +1 -1
  12. package/dist/react-gmi.modern.js +24265 -14128
  13. package/dist/react-gmi.modern.js.map +1 -1
  14. package/dist/robots.txt +2 -0
  15. package/package.json +54 -53
  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 -10
  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 -11
  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 -14783
  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 -280
  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,76 +1,93 @@
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
32
-
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'
41
- import { useState } from 'react'
42
- import '@guillotinaweb/react-gmi/dist/css/style.css'
43
-
44
- // guillotina url
45
- let url = 'http://localhost:8080'
46
- const schema = '/'
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
- auth.onLogout = onLogout
67
+ if (clientInstance === undefined) {
68
+ return null
69
+ }
62
70
 
63
71
  return (
64
- <ClientProvider client={client}>
72
+ <ClientProvider client={clientInstance}>
65
73
  <Layout auth={auth} onLogout={onLogout}>
66
- {isLogged && <Guillotina auth={auth} url={schema} />}
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="columns is-half">
70
- <Login
84
+ <div className="column is-half">
85
+ <Login
71
86
  onLogin={onLogin}
72
87
  auth={auth}
73
- currentSchema={schema}
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
- ### To add icons:
103
+ ### Adding Icons
88
104
 
89
- Add the icons to the default public/index.html header
105
+ Add Font Awesome icons to your HTML:
90
106
 
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
- />
107
+ ```html
108
+ <script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
98
109
  ```
99
110
 
100
- - Copy guillotina logo to your public
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
- ```bash
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
- ## Docs?
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
- - [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)
145
+ ## Development
112
146
 
113
- ## Develop
147
+ ### Prerequisites
114
148
 
115
- ```
116
- run a local guillotina
117
- yarn
118
- yarn start
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
  ![](screenshots/screen2.png)
@@ -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