@guillotinaweb/react-gmi 0.30.1-alpha.1 → 0.30.1-alpha.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.
@@ -1,12 +1,12 @@
1
+ import { IConfig } from '../hooks/useConfig';
1
2
  import { IRegistry } from '../hooks/useRegistry';
2
3
  import { Auth } from '../lib/auth';
3
- import { IndexSignature } from '../types/global';
4
4
  interface GuillotinaProps {
5
5
  auth: Auth;
6
6
  locale: string;
7
7
  url: string;
8
- config: IndexSignature;
9
- registry: IRegistry;
8
+ config?: Partial<IConfig>;
9
+ registry: Partial<IRegistry>;
10
10
  }
11
11
  export declare function Guillotina({ auth, locale, ...props }: GuillotinaProps): import("react/jsx-runtime").JSX.Element;
12
12
  export {};
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import { IColumn } from '../reducers/guillotina';
3
- import { SearchItem } from '../types/guillotina';
2
+ import { ItemColumn, SearchItem } from '../types/guillotina';
4
3
  interface ItemProps {
5
4
  item: {
6
5
  id: string;
@@ -12,7 +11,7 @@ export declare function Item({ item, icon }: ItemProps): import("react/jsx-runti
12
11
  interface RItemProps {
13
12
  item: SearchItem;
14
13
  search: string;
15
- columns: IColumn[];
14
+ columns: ItemColumn[];
16
15
  }
17
16
  export declare function RItem({ item, search, columns }: RItemProps): import("react/jsx-runtime").JSX.Element;
18
17
  interface ItemTitleProps {
@@ -1,7 +1,3 @@
1
1
  import React from 'react';
2
- export declare function PropertiesButtonView(): React.FunctionComponentElement<{
3
- Ctx: import("../contexts").Traversal;
4
- }> | null;
5
- export declare function PropertiesView(): React.FunctionComponentElement<{
6
- Ctx: import("../contexts").Traversal;
7
- }> | null;
2
+ export declare function PropertiesButtonView(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
3
+ export declare function PropertiesView(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
@@ -4,6 +4,7 @@ import { Auth } from '../lib/auth.js';
4
4
  import { IndexSignature } from '../types/global';
5
5
  import { GuillotinaGlobalState, GuillotinaReducerActionTypes } from '../reducers/guillotina';
6
6
  import { GuillotinaCommonObject } from '../types/guillotina.js';
7
+ import { IManageRegistry } from '../hooks/useRegistry.js';
7
8
  export declare const AuthContext: import("react").Context<{}>;
8
9
  export declare const ClientContext: import("react").Context<GuillotinaClient | null>;
9
10
  interface PropsTraversal {
@@ -14,8 +15,8 @@ interface PropsTraversal {
14
15
  type: GuillotinaReducerActionTypes;
15
16
  payload: IndexSignature;
16
17
  }>;
17
- registry: IndexSignature;
18
- flash: (action: string, result: string) => void;
18
+ registry: IManageRegistry;
19
+ flash?: (action: string, result: string) => void;
19
20
  url: string;
20
21
  children?: React.ReactNode;
21
22
  }
@@ -23,7 +24,7 @@ export declare class Traversal {
23
24
  private dispatch;
24
25
  state: GuillotinaGlobalState;
25
26
  client: GuillotinaClient;
26
- registry: IndexSignature<any>;
27
+ registry: IManageRegistry;
27
28
  url: string;
28
29
  auth: Auth;
29
30
  constructor({ flash, ...props }: PropsTraversal);
@@ -1,4 +1,4 @@
1
- interface Props {
1
+ export interface BaseFormProps {
2
2
  onSubmit: (data: {
3
3
  title: string;
4
4
  id: string;
@@ -7,6 +7,6 @@ interface Props {
7
7
  title?: string;
8
8
  dataTest?: string;
9
9
  loading?: boolean;
10
+ type: string;
10
11
  }
11
- export declare function BaseForm({ onSubmit, actionName, title, dataTest, loading, }: Props): import("react/jsx-runtime").JSX.Element;
12
- export {};
12
+ export declare function BaseForm({ onSubmit, actionName, title, dataTest, loading, }: BaseFormProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { GuillotinaSchemaProperty } from '../types/guillotina';
2
2
  export declare const Permissions: string[];
3
- interface IConfig {
3
+ export interface IConfig {
4
4
  DisabledTypes: string[];
5
5
  PageSize: number;
6
6
  DelayActions: number;
@@ -13,7 +13,7 @@ interface IConfig {
13
13
  properties_default?: string[];
14
14
  properties_ignore_fields?: string[];
15
15
  fieldHaveDeleteButton: (schema: GuillotinaSchemaProperty) => boolean;
16
+ flash?: (message: string, type: string) => void;
16
17
  }
17
18
  export declare const defaultConfig: IConfig;
18
19
  export declare function useConfig(cfg?: {}): IConfig;
19
- export {};
@@ -1,12 +1,23 @@
1
1
  import { FolderCtx } from '../views/folder';
2
+ import { BaseFormProps } from '../forms/base';
2
3
  import React from 'react';
3
4
  import { GuillotinaCommonObject, ItemColumn, RegistrySchema } from '../types/guillotina';
5
+ export interface RegistrySortValue {
6
+ direction: 'asc' | 'des';
7
+ key: string;
8
+ }
9
+ export interface RegistryProperties {
10
+ Buttons: React.ReactElement;
11
+ Panels: React.ReactElement;
12
+ default: string[];
13
+ ignoreField: string[];
14
+ }
4
15
  export interface IRegistry {
5
16
  paths: {
6
17
  [key: string]: React.FC;
7
18
  };
8
19
  views: {
9
- [key: string]: React.FC | React.ComponentType<any>;
20
+ [key: string]: React.ComponentType<any>;
10
21
  };
11
22
  actions: {
12
23
  [key: string]: (props: any) => JSX.Element;
@@ -24,7 +35,7 @@ export interface IRegistry {
24
35
  [key: string]: RegistrySchema;
25
36
  };
26
37
  properties: {
27
- [key: string]: React.FC;
38
+ [key: string]: RegistryProperties;
28
39
  };
29
40
  components: {
30
41
  [key: string]: (props: any) => React.ReactNode | null | undefined;
@@ -35,34 +46,28 @@ export interface IRegistry {
35
46
  fieldsToFilter: {
36
47
  [key: string]: string[];
37
48
  };
49
+ parseSearchQueryParamFunction: {
50
+ [key: string]: (query: string, type: string) => string;
51
+ };
38
52
  defaultSortValue: {
39
- [key: string]: {
40
- direction: 'asc' | 'des';
41
- field: string;
42
- };
53
+ [key: string]: RegistrySortValue;
43
54
  };
44
55
  }
45
- export declare const defaultComponent: (context: GuillotinaCommonObject) => typeof FolderCtx;
46
- export declare function useRegistry(data: IRegistry): {
56
+ export interface IManageRegistry {
47
57
  registry: IRegistry;
48
- get: (key: keyof IRegistry, param: string, fallback?: undefined) => string | React.ComponentClass<any, any> | string[] | React.FC<{}> | RegistrySchema | ((props: any) => JSX.Element | null) | (() => ItemColumn[]) | ((props: any) => React.ReactNode) | {
49
- direction: "des" | "asc";
50
- field: string;
51
- } | undefined;
52
- getForm: (type: string, fallback: React.FC<{}>) => (props: any) => JSX.Element;
53
- getComponent: (context: GuillotinaCommonObject | undefined, path: string, fallback?: undefined) => React.ComponentClass<any, any> | React.FC<{}> | typeof FolderCtx | undefined;
54
- getAction: (type: string, fallback?: React.FC<{}> | undefined) => (props: any) => JSX.Element;
55
- getBehavior: (type: string, fallback: React.FC<{}>) => (props: any) => JSX.Element | null;
56
- getProperties: (type: string) => React.FC<{}>;
58
+ getPathComponent: (context: GuillotinaCommonObject | undefined, path: string, fallback?: React.FC) => React.ComponentType<any>;
59
+ getComponent: (name: string) => React.ComponentType<any>;
60
+ getView: (name: string) => React.ComponentType<any>;
61
+ getForm: (type: string, fallback?: React.FC) => React.FC<BaseFormProps>;
62
+ getAction: (type: string, fallback?: React.FC) => React.FC;
63
+ getBehavior: (type: string, fallback?: React.FC) => React.FC<any>;
64
+ getProperties: (type: string) => RegistryProperties;
57
65
  getItemsColumn: (type: string) => ItemColumn[] | undefined;
58
- getFieldsToFilter: (type: string, fallback?: string[]) => string[];
59
- getDefaultSortValue: (type: string, fallback?: {
60
- key: string;
61
- direction: string;
62
- }) => {
63
- direction: "des" | "asc";
64
- field: string;
65
- };
66
66
  getSchemas: (type: string) => RegistrySchema;
67
- getView: (name: string) => React.ComponentType<any> | React.FC<{}>;
68
- };
67
+ getFieldsToFilter: (type: string, fallback?: string[]) => string[];
68
+ getParsedSearchQueryParam: (query: string, type: string) => string;
69
+ getDefaultSortValue: (type: string, fallback?: RegistrySortValue) => RegistrySortValue;
70
+ getSearchEngineQueryParamsFunction: (type: string) => string;
71
+ }
72
+ export declare const defaultComponent: (context: GuillotinaCommonObject) => typeof FolderCtx;
73
+ export declare function useRegistry(data: Partial<IRegistry>): IManageRegistry;
@@ -1,14 +1,13 @@
1
1
  import { RestClient } from './rest';
2
2
  import { IndexSignature, LightFile } from '../types/global';
3
- import { ItemModel } from '../models';
4
3
  import { Auth } from './auth';
5
- import { GuillotinaGroup, GuillotinaUser, ReturnSearchCompatible } from '../types/guillotina';
4
+ import { GuillotinaGroup, GuillotinaUser, ItemColumn, ReturnSearchCompatible } from '../types/guillotina';
6
5
  export declare class GuillotinaClient {
7
6
  rest: RestClient;
8
7
  pathContainsContainer: boolean;
9
8
  constructor(rest: RestClient, pathContainsContainer: boolean);
10
- getContainerFromPath: (path: string) => string;
11
- clearContainerFromPath: (path: string) => string;
9
+ getContainerFromPath(path: string): string;
10
+ clearContainerFromPath(path: string): string;
12
11
  getContext(path: string): Promise<Response>;
13
12
  get(path: string): Promise<Response>;
14
13
  getQueryParamsSearchFunction(name: string): ({ start, pageSize, withDepth, }: {
@@ -29,17 +28,7 @@ export declare class GuillotinaClient {
29
28
  path: string;
30
29
  withDepth?: boolean;
31
30
  }): string[][];
32
- getItemsColumn(): ({
33
- label: string;
34
- isSortable: boolean;
35
- child: (m: ItemModel) => import("react/jsx-runtime").JSX.Element;
36
- key?: undefined;
37
- } | {
38
- label: string;
39
- key: string;
40
- isSortable: boolean;
41
- child: (m: ItemModel, _navigate: () => void, search: boolean) => import("react/jsx-runtime").JSX.Element;
42
- })[];
31
+ getItemsColumn(): ItemColumn[];
43
32
  applyCompat<T>(data: {
44
33
  items: T[];
45
34
  items_total: number;
@@ -1,2 +1,2 @@
1
- export declare function parser(qs: string, defaultField?: string): string[][];
1
+ export declare function parser(qs: string, defaultField?: string | string[] | undefined): string[][];
2
2
  export declare function buildQs(parsedQuery: string[][]): string;