@guillotinaweb/react-gmi 0.22.0 → 0.22.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ 0.22.3
2
+ ------
3
+ - fix: remove items path #167
4
+ - feat: select principals show id if fullname not exist
5
+ - chore: update dependences
6
+
7
+ 0.22.2
8
+ ------
9
+ - chore: update dependences
10
+
11
+ 0.22.1
12
+ ------
13
+ - Fix export
14
+
1
15
  0.22.0
2
16
  ------
3
17
  - Refactor get current context in client and rest utilities. #118
package/README.md CHANGED
@@ -42,32 +42,36 @@ import { useState } from 'react'
42
42
  import '@guillotinaweb/react-gmi/dist/css/style.css'
43
43
 
44
44
  // guillotina url
45
- let url = 'http://localhost:8080/'
46
-
45
+ let url = 'http://localhost:8080'
46
+ const schema = '/'
47
47
  const auth = new Auth(url)
48
- const client = getClient(url, auth)
48
+ const client = getClient(url, schema, auth)
49
49
 
50
50
  function App() {
51
51
  const [isLogged, setLogged] = useState(auth.isLogged)
52
52
 
53
- // You can do whatever you want on login, this includes,
54
- // if you have a router, move it to it's user home folder,
55
- // or the root...
56
53
  const onLogin = () => {
57
54
  setLogged(true)
58
55
  }
59
- const onLogout = () => setLogged(false)
56
+
57
+ const onLogout = () => {
58
+ setLogged(false);
59
+ };
60
60
 
61
61
  auth.onLogout = onLogout
62
62
 
63
63
  return (
64
64
  <ClientProvider client={client}>
65
65
  <Layout auth={auth} onLogout={onLogout}>
66
- {isLogged && <Guillotina auth={auth} url={url} />}
66
+ {isLogged && <Guillotina auth={auth} url={schema} />}
67
67
  {!isLogged && (
68
68
  <div className="columns is-centered">
69
69
  <div className="columns is-half">
70
- <Login onLogin={onLogin} auth={auth} />
70
+ <Login
71
+ onLogin={onLogin}
72
+ auth={auth}
73
+ currentSchema={schema}
74
+ />
71
75
  </div>
72
76
  </div>
73
77
  )}
@@ -76,6 +80,7 @@ function App() {
76
80
  )
77
81
  }
78
82
 
83
+
79
84
  export default App
80
85
  ```
81
86
 
@@ -103,6 +108,7 @@ curl https://raw.githubusercontent.com/guillotinaweb/guillotina_react/master/pub
103
108
 
104
109
  - [Howto Extend Guillotina React form outside?](docs/extend.md)
105
110
  - [Narrative Docs](docs/api.md)
111
+ - [Getting Started - Step by Step](docs/tutorial/tutorial.md)
106
112
 
107
113
  ## Develop
108
114
 
@@ -121,6 +127,8 @@ yarn start
121
127
 
122
128
  ## Sponsors
123
129
 
124
- This project is sponsored by <a href="https://www.vinissimus.com">Vinissimus Wine Shop</a>
130
+ This project is sponsored by <a href="https://www.vinissimus.com">Vinissimus Wine Shop</a> and <a href="https://iskra.cat">Iskra</a>
125
131
 
126
132
  <a href="https://www.vinissimus.com"><img src="https://cdn.vinissimus.com/front/static/images/vinissimus-logo.svg" /></a>
133
+ <br/>
134
+ <a href="https://iskra.cat"><img src="https://storage.googleapis.com/iskra/iskra-logo.png" /></a>
@@ -1,3 +1,7 @@
1
+ export function RenderField({ value, Widget }: {
2
+ value: any;
3
+ Widget: any;
4
+ }): any;
1
5
  export function RenderFieldComponent({ schema, field, val, modifyContent }: {
2
6
  schema: any;
3
7
  field: any;
@@ -762,14 +762,6 @@ function useConfig(cfg) {
762
762
  return calculated;
763
763
  }
764
764
 
765
- var getId = function getId(item) {
766
- if (item['@id']) {
767
- return item['@id'];
768
- }
769
-
770
- return item['@absolute_url'];
771
- };
772
-
773
765
  function RemoveItems(props) {
774
766
  var removeItems = function removeItems() {
775
767
  try {
@@ -777,8 +769,7 @@ function RemoveItems(props) {
777
769
  setLoading(true);
778
770
  var actions = items.map(function (item) {
779
771
  try {
780
- console.log(item);
781
- return Promise.resolve(Ctx.client.delete(getId(item))).then(function (res) {
772
+ return Promise.resolve(Ctx.client.delete("" + Ctx.path + item['@name'])).then(function (res) {
782
773
  var _temp = function () {
783
774
  if (!res.ok) {
784
775
  return Promise.resolve(res.json()).then(function (err) {
@@ -3118,7 +3109,6 @@ var DownloadField = function DownloadField(_ref) {
3118
3109
  };
3119
3110
 
3120
3111
  var plain = ['string', 'number', 'boolean'];
3121
-
3122
3112
  function RenderField(_ref) {
3123
3113
  var value = _ref.value,
3124
3114
  Widget = _ref.Widget;
@@ -4991,7 +4981,7 @@ function AddPermission(_ref) {
4991
4981
  });
4992
4982
  var users = principalsData.users.map(function (user) {
4993
4983
  return {
4994
- text: user.fullname,
4984
+ text: user.fullname || user.id,
4995
4985
  value: user.id
4996
4986
  };
4997
4987
  });
@@ -7611,5 +7601,5 @@ var Auth = /*#__PURE__*/function () {
7611
7601
  return Auth;
7612
7602
  }();
7613
7603
 
7614
- export { ACTIONS_OBJECT, AddItem, AddPermission, AllItemsCheckbox, ApplicationCtx, Auth, AuthContext, BaseForm, BehaviorNotImplemented, BehaviorsView, Button, Checkbox, ClientContext, ClientProvider, Config, Confirm, ContainerCtx, ContextToolbar, CreateButton, CreateContainer, DEFAULT_VALUE_EDITABLE_FIELD, DEFAULT_VALUE_NO_EDITABLE_FIELD, DatabaseCtx, Delete, DownloadField, EditableField, EmailInput, FileUpload, Flash, FolderCtx, Form, FormBuilder, GroupCtx, GroupToolbar, GroupsCtx, Guillotina, GuillotinaClient, IAttachment, IDublinCore, IMultiAttachment, Icon, Input, InputList, Item, ItemCheckbox, ItemCtx, ItemModel, ItemTitle, ItemsActionsDropdown, ItemsActionsProvider, Layout, Link, Loading, Login, Modal, NotAllowed, Notification, Pagination, PanelActions, PanelAddons, PanelBehaviors, PanelItems, PanelNotImplemented, PanelPermissions, PanelProperties, PasswordInput, Path, PathTree, PermissionPrinperm, PermissionPrinrole, PermissionRoleperm, Permissions, PropertiesButtonView, PropertiesView, REGEX_EMAIL, REGEX_HEX_COLOR, REGEX_NUMBER, REGEX_URL, RItem, RemoveItems, RenderFieldComponent, RequiredFieldsForm, RestClient, SearchInput, SearchLabels, Select, Sharing, Table, TabsPanel, Tag, TagsWidget, TdLink, Textarea, TraversalContext, TraversalProvider, UserCtx, UserForm, UsersCtx, UsersToolbar, actions, base64ToArrayBuffer, buildQs, classnames, defaultComponent, formatDate, generateUID, get$1 as get, getClient, getNewId, isEmail, isEmpty, isHexColor, isNumber, isURL, lightFileReader, maxLength, minLength, noop, notEmpty, parser, sleep, stringToSlug, toQueryString, useConfig, useCrudContext, useGuillotinaClient, useLocation, useRegistry, useRemoteField, useTraversal };
7604
+ export { ACTIONS_OBJECT, AddItem, AddPermission, AllItemsCheckbox, ApplicationCtx, Auth, AuthContext, BaseForm, BehaviorNotImplemented, BehaviorsView, Button, Checkbox, ClientContext, ClientProvider, Config, Confirm, ContainerCtx, ContextToolbar, CreateButton, CreateContainer, DEFAULT_VALUE_EDITABLE_FIELD, DEFAULT_VALUE_NO_EDITABLE_FIELD, DatabaseCtx, Delete, DownloadField, EditableField, EmailInput, FileUpload, Flash, FolderCtx, Form, FormBuilder, GroupCtx, GroupToolbar, GroupsCtx, Guillotina, GuillotinaClient, IAttachment, IDublinCore, IMultiAttachment, Icon, Input, InputList, Item, ItemCheckbox, ItemCtx, ItemModel, ItemTitle, ItemsActionsDropdown, ItemsActionsProvider, Layout, Link, Loading, Login, Modal, NotAllowed, Notification, Pagination, PanelActions, PanelAddons, PanelBehaviors, PanelItems, PanelNotImplemented, PanelPermissions, PanelProperties, PasswordInput, Path, PathTree, PermissionPrinperm, PermissionPrinrole, PermissionRoleperm, Permissions, PropertiesButtonView, PropertiesView, REGEX_EMAIL, REGEX_HEX_COLOR, REGEX_NUMBER, REGEX_URL, RItem, RemoveItems, RenderField, RenderFieldComponent, RequiredFieldsForm, RestClient, SearchInput, SearchLabels, Select, Sharing, Table, TabsPanel, Tag, TagsWidget, TdLink, Textarea, TraversalContext, TraversalProvider, UserCtx, UserForm, UsersCtx, UsersToolbar, actions, base64ToArrayBuffer, buildQs, classnames, defaultComponent, formatDate, generateUID, get$1 as get, getClient, getNewId, isEmail, isEmpty, isHexColor, isNumber, isURL, lightFileReader, maxLength, minLength, noop, notEmpty, parser, sleep, stringToSlug, toQueryString, useConfig, useCrudContext, useGuillotinaClient, useLocation, useRegistry, useRemoteField, useTraversal };
7615
7605
  //# sourceMappingURL=react-gmi.esm.js.map