@guillotinaweb/react-gmi 0.29.2 → 0.30.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 (70) hide show
  1. package/README.md +2 -1
  2. package/dist/actions/copy_item.d.ts +2 -2
  3. package/dist/actions/move_item.d.ts +2 -2
  4. package/dist/actions/remove_item.d.ts +2 -2
  5. package/dist/components/behaviors/iattachment.d.ts +4 -2
  6. package/dist/components/behaviors/imultiimageorderedattachment.d.ts +3 -1
  7. package/dist/components/behaviors/iworkflow.d.ts +1 -1
  8. package/dist/components/context_toolbar.d.ts +1 -1
  9. package/dist/components/fields/editComponent.d.ts +5 -4
  10. package/dist/components/fields/editableField.d.ts +4 -2
  11. package/dist/components/fields/renderField.d.ts +8 -5
  12. package/dist/components/flash.d.ts +1 -1
  13. package/dist/components/input/email.d.ts +1 -1
  14. package/dist/components/input/form_builder.d.ts +2 -2
  15. package/dist/components/input/input.d.ts +1 -1
  16. package/dist/components/input/search_input.d.ts +1 -1
  17. package/dist/components/input/search_input_list.d.ts +2 -2
  18. package/dist/components/input/select_vocabulary.d.ts +2 -2
  19. package/dist/components/input/upload.d.ts +1 -2
  20. package/dist/components/pagination.d.ts +1 -1
  21. package/dist/components/panel/permissions.d.ts +1 -1
  22. package/dist/components/panel/permissions_prinperm.d.ts +2 -2
  23. package/dist/components/panel/permissions_prinrole.d.ts +1 -1
  24. package/dist/components/panel/permissions_roleperm.d.ts +1 -1
  25. package/dist/components/path.d.ts +1 -1
  26. package/dist/components/properties_view.d.ts +2 -2
  27. package/dist/components/search_labels.d.ts +1 -1
  28. package/dist/components/search_options_labels.d.ts +1 -1
  29. package/dist/components/search_vocabulary_labels.d.ts +2 -2
  30. package/dist/components/selected_items_actions.d.ts +14 -0
  31. package/dist/components/tabs.d.ts +4 -2
  32. package/dist/components/widgets/tags.d.ts +4 -1
  33. package/dist/contexts/index.d.ts +21 -19
  34. package/dist/forms/required_fields.d.ts +2 -3
  35. package/dist/forms/users.d.ts +1 -1
  36. package/dist/hooks/useClickAway.d.ts +2 -1
  37. package/dist/hooks/useConfig.d.ts +4 -2
  38. package/dist/hooks/useCrudContext.d.ts +11 -10
  39. package/dist/hooks/useInput.d.ts +4 -3
  40. package/dist/hooks/useRegistry.d.ts +29 -29
  41. package/dist/hooks/useSetState.d.ts +6 -1
  42. package/dist/hooks/useVocabulary.d.ts +1 -1
  43. package/dist/lib/auth.d.ts +14 -19
  44. package/dist/lib/client.d.ts +49 -36
  45. package/dist/lib/helpers.d.ts +10 -18
  46. package/dist/lib/processResponse.d.ts +9 -0
  47. package/dist/lib/rest.d.ts +9 -16
  48. package/dist/lib/utils.d.ts +3 -2
  49. package/dist/lib/validators.d.ts +1 -1
  50. package/dist/locales/generic_messages.d.ts +248 -370
  51. package/dist/models/index.d.ts +5 -5
  52. package/dist/models/sharing.d.ts +5 -5
  53. package/dist/react-gmi.esm.js +1182 -905
  54. package/dist/react-gmi.esm.js.map +1 -1
  55. package/dist/react-gmi.js +1181 -905
  56. package/dist/react-gmi.js.map +1 -1
  57. package/dist/react-gmi.modern.js +1155 -852
  58. package/dist/react-gmi.modern.js.map +1 -1
  59. package/dist/react-gmi.umd.js +1181 -905
  60. package/dist/react-gmi.umd.js.map +1 -1
  61. package/dist/reducers/guillotina.d.ts +22 -8
  62. package/dist/types/global.d.ts +9 -0
  63. package/dist/types/guillotina.d.ts +192 -44
  64. package/dist/views/folder.d.ts +1 -1
  65. package/dist/views/groups.d.ts +1 -1
  66. package/dist/views/item.d.ts +1 -1
  67. package/dist/views/users.d.ts +1 -1
  68. package/package.json +3 -2
  69. package/dist/lib/search.test.d.ts +0 -1
  70. package/dist/setupTests.d.ts +0 -1
@@ -1,6 +1,6 @@
1
1
  import { GuillotinaVocabulary } from '../types/guillotina';
2
2
  interface State {
3
- data: GuillotinaVocabulary;
3
+ data?: GuillotinaVocabulary;
4
4
  loading: boolean;
5
5
  error: any;
6
6
  }
@@ -4,28 +4,23 @@ export declare class Auth {
4
4
  events: {};
5
5
  url: string;
6
6
  base_url: string;
7
- errors: string;
8
- constructor(url: any);
9
- getUrl(endpoint: any): string;
10
- setAccount(account: any): void;
11
- login(username: any, password: any): Promise<boolean>;
7
+ errors?: string;
8
+ constructor(url: string);
9
+ getUrl(endpoint: string): string;
10
+ setAccount(account: string): void;
11
+ login(username: string, password: string): Promise<boolean>;
12
12
  get isLogged(): boolean;
13
13
  get username(): any;
14
- storeAuth(data: any): void;
14
+ storeAuth(data: {
15
+ token: string;
16
+ exp: number;
17
+ }): void;
15
18
  cleanAuth(): void;
16
19
  logout(): void;
17
20
  refreshToken(): Promise<any>;
18
- willExpire(expiration: any): boolean;
19
- isExpired(expiration: any): boolean;
20
- _getToken(): string[];
21
- getToken(): string;
22
- getHeaders(): {
23
- Accept?: undefined;
24
- 'Content-Type'?: undefined;
25
- Authorization?: undefined;
26
- } | {
27
- Accept: string;
28
- 'Content-Type': string;
29
- Authorization: string;
30
- };
21
+ willExpire(expiration: string): boolean;
22
+ isExpired(expiration: string): boolean;
23
+ _getToken(): (string | null)[];
24
+ getToken(): string | null;
25
+ getHeaders(): HeadersInit;
31
26
  }
@@ -1,59 +1,72 @@
1
1
  import { RestClient } from './rest';
2
- import { LightFile } from '../types/global';
2
+ import { IndexSignature, LightFile } from '../types/global';
3
+ import { ItemModel } from '../models';
4
+ import { Auth } from './auth';
5
+ import { GuillotinaGroup, GuillotinaUser, ReturnSearchCompatible } from '../types/guillotina';
3
6
  export declare class GuillotinaClient {
4
7
  rest: RestClient;
5
8
  pathContainsContainer: boolean;
6
9
  constructor(rest: RestClient, pathContainsContainer: boolean);
7
- getContainerFromPath: (path: any) => string;
8
- clearContainerFromPath: (path: any) => any;
9
- getContext(path: any): Promise<Response>;
10
- get(path: any): Promise<Response>;
11
- getQueryParamsPostresql({ start, pageSize, withDepth }: {
10
+ getContainerFromPath: (path: string) => string;
11
+ clearContainerFromPath: (path: string) => string;
12
+ getContext(path: string): Promise<Response>;
13
+ get(path: string): Promise<Response>;
14
+ getQueryParamsSearchFunction(name: string): ({ start, pageSize, withDepth, }: {
15
+ start?: number | undefined;
16
+ pageSize?: number | undefined;
17
+ path?: string | undefined;
18
+ withDepth?: boolean | undefined;
19
+ }) => string[][];
20
+ getQueryParamsPostresql({ start, pageSize, withDepth, }: {
12
21
  start?: number;
13
22
  pageSize?: number;
23
+ path?: string;
14
24
  withDepth?: boolean;
15
- }): any[];
25
+ }): string[][];
16
26
  getQueryParamsElasticsearch({ start, pageSize, path, withDepth, }: {
17
27
  start?: number;
18
28
  pageSize?: number;
19
- path: any;
29
+ path: string;
20
30
  withDepth?: boolean;
21
- }): any[];
31
+ }): string[][];
22
32
  getItemsColumn(): ({
23
33
  label: string;
24
34
  isSortable: boolean;
25
- child: (m: any) => import("react/jsx-runtime").JSX.Element;
35
+ child: (m: ItemModel) => import("react/jsx-runtime").JSX.Element;
26
36
  key?: undefined;
27
37
  } | {
28
38
  label: string;
29
39
  key: string;
30
40
  isSortable: boolean;
31
- child: (m: any, navigate: any, search: any) => import("react/jsx-runtime").JSX.Element;
41
+ child: (m: ItemModel, _navigate: () => void, search: boolean) => import("react/jsx-runtime").JSX.Element;
32
42
  })[];
33
- applyCompat(data: any): any;
34
- search(path: string, params: string | string[][], container?: boolean, prepare?: boolean): Promise<any>;
35
- canido(path: any, permissions: any): Promise<Response>;
36
- createObject(path: any, data: any): Promise<Response>;
37
- cleanPath(path: any): string;
38
- delete(path: any, data: any): Promise<Response>;
39
- create(path: any, data: any): Promise<Response>;
40
- post(path: any, data: any): Promise<Response>;
41
- patch(path: any, data: any): Promise<Response>;
42
- upload(path: any, file: any): Promise<Response>;
43
- download(path: any): Promise<Response>;
44
- getTypeSchema(path: any, name: any): Promise<any>;
45
- getAddons(path: any): Promise<Response>;
46
- installAddon(path: any, key: any): Promise<Response>;
47
- removeAddon(path: any, key: any): Promise<Response>;
48
- getGroups(path: any): Promise<Response>;
49
- getUsers(path: any): Promise<Response>;
50
- getPrincipals(path: any): Promise<{
51
- groups: any;
52
- users: any;
43
+ applyCompat<T>(data: {
44
+ items: T[];
45
+ items_total: number;
46
+ }): ReturnSearchCompatible<T>;
47
+ search<T>(path: string, params: string | IndexSignature<string>, container?: boolean, prepare?: boolean, signal?: AbortSignal): Promise<ReturnSearchCompatible<T>>;
48
+ canido(path: string, permissions: string | string[]): Promise<Response>;
49
+ createObject(path: string, data: unknown): Promise<Response>;
50
+ cleanPath(path: string): string;
51
+ delete(path: string, data: unknown): Promise<Response>;
52
+ create(path: string, data: unknown): Promise<Response>;
53
+ post(path: string, data: unknown): Promise<Response>;
54
+ patch(path: string, data: unknown): Promise<Response>;
55
+ upload(path: string, file: LightFile): Promise<Response>;
56
+ download(path: string): Promise<Response>;
57
+ getTypeSchema(path: string, name: string): Promise<any>;
58
+ getAddons(path: string): Promise<Response>;
59
+ installAddon(path: string, key: string): Promise<Response>;
60
+ removeAddon(path: string, key: string): Promise<Response>;
61
+ getGroups(path: string): Promise<Response>;
62
+ getUsers(path: string): Promise<Response>;
63
+ getPrincipals(path: string): Promise<{
64
+ groups: GuillotinaGroup[];
65
+ users: GuillotinaUser[];
53
66
  }>;
54
- getRoles(path: any): Promise<Response>;
55
- getAllPermissions(path: any): Promise<any[]>;
56
- getTypes(path: any): Promise<any>;
67
+ getRoles(path: string): Promise<Response>;
68
+ getAllPermissions(path: string): Promise<string[]>;
69
+ getTypes(path: string): Promise<any>;
57
70
  }
58
- export declare function getClient(url: any, container: any, auth: any): GuillotinaClient;
59
- export declare const lightFileReader: (file: any) => Promise<LightFile>;
71
+ export declare function getClient(url: string, container: string, auth: Auth): GuillotinaClient;
72
+ export declare const lightFileReader: (file: File) => Promise<LightFile>;
@@ -1,23 +1,15 @@
1
- export declare const classnames: (classNames: any) => any;
1
+ import { IntlShape } from 'react-intl';
2
+ import { IndexSignature } from '../types/global';
3
+ export declare const classnames: (classNames: (string | boolean)[]) => string;
2
4
  export declare const noop: () => void;
3
5
  export declare const generateUID: (prefix?: string) => string;
4
- export declare const toQueryString: (params: string[][]) => string;
5
- export declare function base64ToArrayBuffer(base64: any): Uint8Array;
6
- export declare function stringToSlug(str: any): any;
7
- export declare function sleep(ms: any): Promise<void>;
8
- export declare const getActionsObject: (intl: any, multiple?: boolean) => {
9
- DELETE: {
10
- text: any;
11
- perms: string[];
12
- action: string;
13
- };
14
- MOVE: {
15
- text: any;
16
- perms: string[];
17
- action: string;
18
- };
19
- COPY: {
20
- text: any;
6
+ export declare const toQueryString: (params: IndexSignature<string>) => string;
7
+ export declare function base64ToArrayBuffer(base64: string): Uint8Array;
8
+ export declare function stringToSlug(str: string): string;
9
+ export declare function sleep(ms: number): Promise<void>;
10
+ export declare const getActionsObject: (intl: IntlShape, multiple?: boolean) => {
11
+ [key: string]: {
12
+ text: string;
21
13
  perms: string[];
22
14
  action: string;
23
15
  };
@@ -0,0 +1,9 @@
1
+ interface IResponse<T = unknown> {
2
+ loading?: boolean;
3
+ isError: boolean;
4
+ errorMessage?: string;
5
+ result?: T;
6
+ response?: unknown;
7
+ }
8
+ export declare function processResponse<T>(res: Response, ready_body?: boolean): Promise<IResponse<T>>;
9
+ export {};
@@ -1,23 +1,16 @@
1
+ import { LightFile } from '../types/global';
1
2
  import { Auth } from './auth';
2
3
  export declare class RestClient {
3
4
  url: string;
4
5
  container: string;
5
6
  auth: Auth;
6
7
  constructor(url: string, container: string, auth: Auth);
7
- request(path: any, data?: any, headers?: any): Promise<Response>;
8
- getHeaders(): {
9
- Accept?: undefined;
10
- 'Content-Type'?: undefined;
11
- Authorization?: undefined;
12
- } | {
13
- Accept: string;
14
- 'Content-Type': string;
15
- Authorization: string;
16
- };
17
- post(path: any, data: any): Promise<Response>;
18
- get(path: any): Promise<Response>;
19
- put(path: any, data: any): Promise<Response>;
20
- patch(path: any, data: any): Promise<Response>;
21
- upload(path: any, data: any): Promise<Response>;
22
- delete(path: any, data?: any): Promise<Response>;
8
+ request(path: string, data?: RequestInit, headers?: HeadersInit, signal?: AbortSignal): Promise<Response>;
9
+ getHeaders(): HeadersInit;
10
+ post(path: string, data: unknown): Promise<Response>;
11
+ get(path: string, signal?: AbortSignal): Promise<Response>;
12
+ put(path: string, data: unknown): Promise<Response>;
13
+ patch(path: string, data: unknown): Promise<Response>;
14
+ upload(path: string, data: LightFile): Promise<Response>;
15
+ delete(path: string, data: unknown): Promise<Response>;
23
16
  }
@@ -1,4 +1,5 @@
1
1
  import { IndexSignature } from '../types/global';
2
2
  export declare const formatDate: (str: string) => string;
3
- export declare const get: <T>(obj: IndexSignature, path: string | string[], defValue: any) => T;
4
- export declare function getNewId(id?: string): any;
3
+ export declare const get: <T>(obj: IndexSignature, path: string | string[], defValue: T) => T;
4
+ export declare function getNewId(id?: string): string;
5
+ export declare function debounce<T extends unknown[], U>(callback: (...args: T) => PromiseLike<U> | U, wait: number): (...args: T) => Promise<U>;
@@ -9,4 +9,4 @@ export declare const isEmail: (value?: string) => boolean;
9
9
  export declare const isURL: (value?: string) => boolean;
10
10
  export declare const isHexColor: (value?: string) => boolean;
11
11
  export declare const isNumber: (value?: string) => boolean;
12
- export declare const notEmpty: (value: any) => boolean;
12
+ export declare const notEmpty: (value: string) => boolean;