@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.
- package/README.md +2 -1
- package/dist/actions/copy_item.d.ts +2 -2
- package/dist/actions/move_item.d.ts +2 -2
- package/dist/actions/remove_item.d.ts +2 -2
- package/dist/components/behaviors/iattachment.d.ts +4 -2
- package/dist/components/behaviors/imultiimageorderedattachment.d.ts +3 -1
- package/dist/components/behaviors/iworkflow.d.ts +1 -1
- package/dist/components/context_toolbar.d.ts +1 -1
- package/dist/components/fields/editComponent.d.ts +5 -4
- package/dist/components/fields/editableField.d.ts +4 -2
- package/dist/components/fields/renderField.d.ts +8 -5
- package/dist/components/flash.d.ts +1 -1
- package/dist/components/input/email.d.ts +1 -1
- package/dist/components/input/form_builder.d.ts +2 -2
- package/dist/components/input/input.d.ts +1 -1
- package/dist/components/input/search_input.d.ts +1 -1
- package/dist/components/input/search_input_list.d.ts +2 -2
- package/dist/components/input/select_vocabulary.d.ts +2 -2
- package/dist/components/input/upload.d.ts +1 -2
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/panel/permissions.d.ts +1 -1
- package/dist/components/panel/permissions_prinperm.d.ts +2 -2
- package/dist/components/panel/permissions_prinrole.d.ts +1 -1
- package/dist/components/panel/permissions_roleperm.d.ts +1 -1
- package/dist/components/path.d.ts +1 -1
- package/dist/components/properties_view.d.ts +2 -2
- package/dist/components/search_labels.d.ts +1 -1
- package/dist/components/search_options_labels.d.ts +1 -1
- package/dist/components/search_vocabulary_labels.d.ts +2 -2
- package/dist/components/selected_items_actions.d.ts +14 -0
- package/dist/components/tabs.d.ts +4 -2
- package/dist/components/widgets/tags.d.ts +4 -1
- package/dist/contexts/index.d.ts +21 -19
- package/dist/forms/required_fields.d.ts +2 -3
- package/dist/forms/users.d.ts +1 -1
- package/dist/hooks/useClickAway.d.ts +2 -1
- package/dist/hooks/useConfig.d.ts +4 -2
- package/dist/hooks/useCrudContext.d.ts +11 -10
- package/dist/hooks/useInput.d.ts +4 -3
- package/dist/hooks/useRegistry.d.ts +29 -29
- package/dist/hooks/useSetState.d.ts +6 -1
- package/dist/hooks/useVocabulary.d.ts +1 -1
- package/dist/lib/auth.d.ts +14 -19
- package/dist/lib/client.d.ts +49 -36
- package/dist/lib/helpers.d.ts +10 -18
- package/dist/lib/processResponse.d.ts +9 -0
- package/dist/lib/rest.d.ts +9 -16
- package/dist/lib/utils.d.ts +3 -2
- package/dist/lib/validators.d.ts +1 -1
- package/dist/locales/generic_messages.d.ts +248 -370
- package/dist/models/index.d.ts +5 -5
- package/dist/models/sharing.d.ts +5 -5
- package/dist/react-gmi.esm.js +1182 -905
- package/dist/react-gmi.esm.js.map +1 -1
- package/dist/react-gmi.js +1181 -905
- package/dist/react-gmi.js.map +1 -1
- package/dist/react-gmi.modern.js +1155 -852
- package/dist/react-gmi.modern.js.map +1 -1
- package/dist/react-gmi.umd.js +1181 -905
- package/dist/react-gmi.umd.js.map +1 -1
- package/dist/reducers/guillotina.d.ts +22 -8
- package/dist/types/global.d.ts +9 -0
- package/dist/types/guillotina.d.ts +192 -44
- package/dist/views/folder.d.ts +1 -1
- package/dist/views/groups.d.ts +1 -1
- package/dist/views/item.d.ts +1 -1
- package/dist/views/users.d.ts +1 -1
- package/package.json +3 -2
- package/dist/lib/search.test.d.ts +0 -1
- package/dist/setupTests.d.ts +0 -1
package/README.md
CHANGED
|
@@ -141,4 +141,5 @@ This project is sponsored by <a href="https://www.vinissimus.com">Vinissimus Win
|
|
|
141
141
|
[] Add richtext
|
|
142
142
|
[X] Add scales in IImageAttachment
|
|
143
143
|
[] 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
|
|
144
|
-
[] Poder posar per defecte un Panel properties, item properties etc a tots els tipus. Llegir-ho del context
|
|
144
|
+
[] Poder posar per defecte un Panel properties, item properties etc a tots els tipus. Llegir-ho del context
|
|
145
|
+
[] Mirar de fer generic el Traversal, per no haver de fer el "as" i poder dir de quin tipus és el context
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GuillotinaCommonObject } from '../types/guillotina';
|
|
2
2
|
interface Props {
|
|
3
|
-
item:
|
|
3
|
+
item: GuillotinaCommonObject;
|
|
4
4
|
}
|
|
5
5
|
export declare function CopyItem(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GuillotinaCommonObject } from '../types/guillotina';
|
|
2
2
|
interface Props {
|
|
3
|
-
item:
|
|
3
|
+
item: GuillotinaCommonObject;
|
|
4
4
|
}
|
|
5
5
|
export declare function MoveItem(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GuillotinaCommonObject } from '../types/guillotina';
|
|
2
2
|
interface Props {
|
|
3
|
-
item:
|
|
3
|
+
item: GuillotinaCommonObject;
|
|
4
4
|
}
|
|
5
5
|
export declare function RemoveItem(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { GuillotinaFile,
|
|
1
|
+
import { GuillotinaFile, GuillotinaSchemaProperty } from '../../types/guillotina';
|
|
2
2
|
interface Props {
|
|
3
|
-
properties:
|
|
3
|
+
properties: {
|
|
4
|
+
file: GuillotinaSchemaProperty;
|
|
5
|
+
};
|
|
4
6
|
values: {
|
|
5
7
|
file: GuillotinaFile;
|
|
6
8
|
};
|
|
@@ -2,7 +2,9 @@ import { GuillotinaFile, GuillotinaSchemaProperties } from '../../types/guilloti
|
|
|
2
2
|
interface Props {
|
|
3
3
|
properties: GuillotinaSchemaProperties;
|
|
4
4
|
values: {
|
|
5
|
-
images:
|
|
5
|
+
images: {
|
|
6
|
+
[key: string]: GuillotinaFile;
|
|
7
|
+
};
|
|
6
8
|
};
|
|
7
9
|
}
|
|
8
10
|
export declare function IMultiImageOrderedAttachment({ properties, values }: Props): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function IWorkflow(): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare function IWorkflow(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { GuillotinaSchemaProperty } from '../../types/guillotina';
|
|
3
|
+
import { EditableFieldValue } from '../../types/global';
|
|
3
4
|
interface Props {
|
|
4
|
-
schema:
|
|
5
|
-
val:
|
|
6
|
-
setValue: (value:
|
|
5
|
+
schema: GuillotinaSchemaProperty;
|
|
6
|
+
val: EditableFieldValue;
|
|
7
|
+
setValue: (value: EditableFieldValue) => void;
|
|
7
8
|
dataTest?: string;
|
|
8
9
|
className?: string;
|
|
9
10
|
placeholder?: string;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { EditableFieldValue } from '../../types/global';
|
|
2
|
+
import { GuillotinaSchemaProperty } from '../../types/guillotina';
|
|
1
3
|
interface Props {
|
|
2
4
|
field: string;
|
|
3
|
-
value:
|
|
5
|
+
value: EditableFieldValue;
|
|
4
6
|
ns?: string;
|
|
5
|
-
schema?:
|
|
7
|
+
schema?: GuillotinaSchemaProperty;
|
|
6
8
|
modifyContent?: boolean;
|
|
7
9
|
required?: boolean;
|
|
8
10
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GuillotinaSchemaProperty } from '../../types/guillotina';
|
|
3
|
+
import { EditableFieldValue } from '../../types/global';
|
|
4
|
+
type PlainType = string | boolean | number;
|
|
3
5
|
interface RenderFieldProps {
|
|
4
|
-
value:
|
|
6
|
+
value: EditableFieldValue;
|
|
5
7
|
Widget?: React.ComponentType<{
|
|
6
|
-
value:
|
|
7
|
-
schema
|
|
8
|
+
value: EditableFieldValue;
|
|
9
|
+
schema?: GuillotinaSchemaProperty;
|
|
10
|
+
modifyContent?: boolean;
|
|
8
11
|
}>;
|
|
9
12
|
schema?: GuillotinaSchemaProperty;
|
|
10
13
|
}
|
|
11
|
-
export declare function RenderField({ value, Widget, schema }: RenderFieldProps):
|
|
14
|
+
export declare function RenderField({ value, Widget, schema }: RenderFieldProps): import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[] | PlainType;
|
|
12
15
|
interface SearchRenderFieldProps {
|
|
13
16
|
schema: GuillotinaSchemaProperty;
|
|
14
17
|
value: string | string[];
|
|
@@ -24,7 +27,7 @@ export declare const VocabularyRenderField: ({ schema, value, modifyContent, }:
|
|
|
24
27
|
interface RenderFieldComponentProps {
|
|
25
28
|
schema: GuillotinaSchemaProperty;
|
|
26
29
|
field: string;
|
|
27
|
-
val:
|
|
30
|
+
val: EditableFieldValue;
|
|
28
31
|
modifyContent?: boolean;
|
|
29
32
|
}
|
|
30
33
|
export declare function RenderFieldComponent({ schema, field, val, modifyContent, }: RenderFieldComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function Flash(): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare function Flash(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -3,8 +3,8 @@ import { IndexSignature } from '../../types/global';
|
|
|
3
3
|
import { GuillotinaSchema } from '../../types/guillotina';
|
|
4
4
|
interface Props {
|
|
5
5
|
schema: GuillotinaSchema;
|
|
6
|
-
formData?:
|
|
7
|
-
onSubmit: (formData:
|
|
6
|
+
formData?: IndexSignature;
|
|
7
|
+
onSubmit: (formData: IndexSignature, initialData: IndexSignature) => void;
|
|
8
8
|
actionName: string;
|
|
9
9
|
children?: React.ReactNode;
|
|
10
10
|
exclude?: string[];
|
|
@@ -4,9 +4,9 @@ interface Props {
|
|
|
4
4
|
onChange: (value: string[]) => void;
|
|
5
5
|
error?: string;
|
|
6
6
|
errorZoneClassName?: string;
|
|
7
|
-
traversal
|
|
7
|
+
traversal: Traversal;
|
|
8
8
|
path?: string;
|
|
9
|
-
qs?: string[];
|
|
9
|
+
qs?: string[][];
|
|
10
10
|
queryCondition?: string;
|
|
11
11
|
value: string[];
|
|
12
12
|
btnClass?: string;
|
|
@@ -3,10 +3,10 @@ interface Props {
|
|
|
3
3
|
vocabularyName: string;
|
|
4
4
|
className?: string;
|
|
5
5
|
classWrap?: string;
|
|
6
|
-
val?: string;
|
|
6
|
+
val?: string | string[];
|
|
7
7
|
dataTest?: string;
|
|
8
8
|
multiple?: boolean;
|
|
9
|
-
onChange?: (value: string) => void;
|
|
9
|
+
onChange?: (value: string | string[]) => void;
|
|
10
10
|
appendDefault?: boolean;
|
|
11
11
|
id?: string;
|
|
12
12
|
placeholder?: string;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { InputHTMLAttributes } from 'react';
|
|
2
1
|
import { LightFile } from '../../types/global';
|
|
3
2
|
interface Props {
|
|
4
3
|
label?: string;
|
|
5
4
|
dataTest?: string;
|
|
6
5
|
onChange: (file: LightFile) => void;
|
|
7
6
|
}
|
|
8
|
-
export declare function FileUpload({ label, onChange, dataTest
|
|
7
|
+
export declare function FileUpload({ label, onChange, dataTest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
export {};
|
|
@@ -4,5 +4,5 @@ interface Props {
|
|
|
4
4
|
doPaginate: (page: number) => void;
|
|
5
5
|
pager: number;
|
|
6
6
|
}
|
|
7
|
-
export declare function Pagination({ current, total, doPaginate, pager }: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function Pagination({ current, total, doPaginate, pager }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
8
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function Path():
|
|
1
|
+
export declare function Path(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare function PropertiesButtonView(): React.FunctionComponentElement<{
|
|
3
3
|
Ctx: import("../contexts").Traversal;
|
|
4
|
-
}
|
|
4
|
+
}> | null;
|
|
5
5
|
export declare function PropertiesView(): React.FunctionComponentElement<{
|
|
6
6
|
Ctx: import("../contexts").Traversal;
|
|
7
|
-
}
|
|
7
|
+
}> | null;
|
|
@@ -5,5 +5,5 @@ interface Props {
|
|
|
5
5
|
text: string;
|
|
6
6
|
}[];
|
|
7
7
|
}
|
|
8
|
-
export declare function SearchOptionsLabels({ query, options }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function SearchOptionsLabels({ query, options }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
9
9
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface Props {
|
|
2
2
|
query?: string;
|
|
3
|
-
vocabularyName
|
|
3
|
+
vocabularyName: string;
|
|
4
4
|
}
|
|
5
|
-
export declare function SearchVocabularyLabels({ query, vocabularyName }: Props): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function SearchVocabularyLabels({ query, vocabularyName }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
6
6
|
export {};
|
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SearchItem } from '../types/guillotina';
|
|
3
|
+
/**
|
|
4
|
+
* Actions to apply after select some items
|
|
5
|
+
* Ex: Delete, Move, Copy...
|
|
6
|
+
*/
|
|
3
7
|
interface PropsItemsActionsProvider {
|
|
4
8
|
items: SearchItem[];
|
|
5
9
|
children: React.ReactNode;
|
|
6
10
|
}
|
|
7
11
|
export declare function ItemsActionsProvider({ items, children, }: PropsItemsActionsProvider): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* Checkbox component without props that consume the ItemsActionsContext
|
|
14
|
+
* and it select/unselect all items of the page.
|
|
15
|
+
*/
|
|
8
16
|
export declare function AllItemsCheckbox({ dataTest }: {
|
|
9
17
|
dataTest?: string;
|
|
10
18
|
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* Checkbox component to select ONE item.
|
|
21
|
+
*/
|
|
11
22
|
interface PropsItemCheckbox {
|
|
12
23
|
item: SearchItem;
|
|
13
24
|
dataTest?: string;
|
|
14
25
|
}
|
|
15
26
|
export declare function ItemCheckbox({ item, dataTest }: PropsItemCheckbox): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* Dropdown to choose some action to apply to the selected items.
|
|
29
|
+
*/
|
|
16
30
|
export declare function ItemsActionsDropdown(): import("react/jsx-runtime").JSX.Element;
|
|
17
31
|
export {};
|
|
@@ -2,9 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import { IndexSignature } from '../types/global';
|
|
3
3
|
interface Props {
|
|
4
4
|
tabs: IndexSignature;
|
|
5
|
-
currentTab
|
|
5
|
+
currentTab: string;
|
|
6
6
|
rightToolbar?: React.ReactNode;
|
|
7
|
-
fallback?: React.ComponentType
|
|
7
|
+
fallback?: React.ComponentType<{
|
|
8
|
+
title: string;
|
|
9
|
+
}>;
|
|
8
10
|
}
|
|
9
11
|
export declare function TabsPanel({ tabs, currentTab, rightToolbar, fallback, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export {};
|
package/dist/contexts/index.d.ts
CHANGED
|
@@ -2,45 +2,47 @@ import { Dispatch } from 'react';
|
|
|
2
2
|
import { GuillotinaClient } from '../lib/client.js';
|
|
3
3
|
import { Auth } from '../lib/auth.js';
|
|
4
4
|
import { IndexSignature } from '../types/global';
|
|
5
|
-
import { GuillotinaGlobalState } from '../reducers/guillotina';
|
|
5
|
+
import { GuillotinaGlobalState, GuillotinaReducerActionTypes } from '../reducers/guillotina';
|
|
6
|
+
import { GuillotinaCommonObject } from '../types/guillotina.js';
|
|
6
7
|
export declare const AuthContext: import("react").Context<{}>;
|
|
7
|
-
export declare const ClientContext: import("react").Context<GuillotinaClient>;
|
|
8
|
+
export declare const ClientContext: import("react").Context<GuillotinaClient | null>;
|
|
8
9
|
interface PropsTraversal {
|
|
9
10
|
client: GuillotinaClient;
|
|
10
11
|
auth: Auth;
|
|
11
12
|
state: GuillotinaGlobalState;
|
|
12
13
|
dispatch: Dispatch<{
|
|
13
|
-
type:
|
|
14
|
+
type: GuillotinaReducerActionTypes;
|
|
14
15
|
payload: IndexSignature;
|
|
15
16
|
}>;
|
|
16
17
|
registry: IndexSignature;
|
|
17
18
|
flash: (action: string, result: string) => void;
|
|
18
19
|
url: string;
|
|
20
|
+
children?: React.ReactNode;
|
|
19
21
|
}
|
|
20
22
|
export declare class Traversal {
|
|
21
23
|
private dispatch;
|
|
22
|
-
state:
|
|
23
|
-
client:
|
|
24
|
-
registry: any
|
|
25
|
-
url:
|
|
26
|
-
auth:
|
|
24
|
+
state: GuillotinaGlobalState;
|
|
25
|
+
client: GuillotinaClient;
|
|
26
|
+
registry: IndexSignature<any>;
|
|
27
|
+
url: string;
|
|
28
|
+
auth: Auth;
|
|
27
29
|
constructor({ flash, ...props }: PropsTraversal);
|
|
28
30
|
refresh({ transparent }?: {
|
|
29
|
-
transparent?: boolean;
|
|
31
|
+
transparent?: boolean | undefined;
|
|
30
32
|
}): void;
|
|
31
|
-
get path():
|
|
32
|
-
get pathPrefix():
|
|
33
|
-
get context():
|
|
34
|
-
get containerPath():
|
|
35
|
-
apply(data:
|
|
36
|
-
flash(message:
|
|
33
|
+
get path(): string;
|
|
34
|
+
get pathPrefix(): string;
|
|
35
|
+
get context(): GuillotinaCommonObject;
|
|
36
|
+
get containerPath(): string;
|
|
37
|
+
apply(data: IndexSignature): void;
|
|
38
|
+
flash(message: string, type: string): void;
|
|
37
39
|
clearFlash(): void;
|
|
38
|
-
doAction(action:
|
|
40
|
+
doAction(action: string, params?: {}): void;
|
|
39
41
|
cancelAction(): void;
|
|
40
|
-
hasPerm(permission:
|
|
41
|
-
filterTabs(tabs:
|
|
42
|
+
hasPerm(permission: string): boolean;
|
|
43
|
+
filterTabs(tabs: IndexSignature, tabsPermissions: IndexSignature): IndexSignature<any>;
|
|
42
44
|
}
|
|
43
|
-
export declare const TraversalContext: import("react").Context<Traversal>;
|
|
45
|
+
export declare const TraversalContext: import("react").Context<Traversal | null>;
|
|
44
46
|
export declare function TraversalProvider({ children, ...props }: PropsTraversal & {
|
|
45
47
|
children: React.ReactNode;
|
|
46
48
|
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/forms/users.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export default function useClickAway(ref: React.RefObject<HTMLElement>, onClickAway: (event: Event) => void, events?: string[]): void;
|
|
@@ -7,11 +7,13 @@ interface IConfig {
|
|
|
7
7
|
Permissions: string[];
|
|
8
8
|
SearchEngine: string;
|
|
9
9
|
SizeImages?: string[];
|
|
10
|
-
icons?:
|
|
10
|
+
icons?: {
|
|
11
|
+
[key: string]: string;
|
|
12
|
+
};
|
|
11
13
|
properties_default?: string[];
|
|
12
14
|
properties_ignore_fields?: string[];
|
|
13
15
|
fieldHaveDeleteButton: (schema: GuillotinaSchemaProperty) => boolean;
|
|
14
16
|
}
|
|
15
|
-
export declare const
|
|
17
|
+
export declare const defaultConfig: IConfig;
|
|
16
18
|
export declare function useConfig(cfg?: {}): IConfig;
|
|
17
19
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { Traversal } from '../contexts';
|
|
2
|
+
interface State<T> {
|
|
2
3
|
loading?: boolean;
|
|
3
4
|
isError?: boolean;
|
|
4
5
|
errorMessage?: string;
|
|
@@ -6,15 +7,15 @@ interface State<T = unknown> {
|
|
|
6
7
|
response?: unknown;
|
|
7
8
|
}
|
|
8
9
|
export declare function useCrudContext<T>(): {
|
|
9
|
-
Ctx:
|
|
10
|
-
patch: (data
|
|
11
|
-
del: (data?: {}, endpoint?:
|
|
12
|
-
post: (data
|
|
13
|
-
get: (endpoint?:
|
|
14
|
-
loading?: boolean;
|
|
15
|
-
isError?: boolean;
|
|
16
|
-
errorMessage?: string;
|
|
17
|
-
result?: T;
|
|
10
|
+
Ctx: Traversal;
|
|
11
|
+
patch: (data?: {}, endpoint?: string | undefined, body?: boolean) => Promise<State<T>>;
|
|
12
|
+
del: (data?: {}, endpoint?: string | undefined, body?: boolean) => Promise<State<T>>;
|
|
13
|
+
post: (data?: {}, endpoint?: string | undefined, body?: boolean) => Promise<State<T>>;
|
|
14
|
+
get: (endpoint?: string | undefined) => Promise<State<T>>;
|
|
15
|
+
loading?: boolean | undefined;
|
|
16
|
+
isError?: boolean | undefined;
|
|
17
|
+
errorMessage?: string | undefined;
|
|
18
|
+
result?: T | undefined;
|
|
18
19
|
response?: unknown;
|
|
19
20
|
};
|
|
20
21
|
export {};
|
package/dist/hooks/useInput.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ChangeEvent } from 'react';
|
|
2
|
+
declare const useInput: (onChange: (value: string) => void | undefined, value: string, validators: ((value: string) => boolean)[]) => {
|
|
3
|
+
onChange: (ev: ChangeEvent<HTMLInputElement>) => void;
|
|
3
4
|
onFocus: () => void;
|
|
4
5
|
onBlur: () => void;
|
|
5
6
|
state: {
|
|
6
7
|
hasError: boolean;
|
|
7
|
-
value:
|
|
8
|
+
value: string;
|
|
8
9
|
};
|
|
9
10
|
};
|
|
10
11
|
export default useInput;
|
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
import { FolderCtx } from '../views/folder';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { GuillotinaCommonObject, ItemColumn, RegistrySchema } from '../types/guillotina';
|
|
4
4
|
export interface IRegistry {
|
|
5
5
|
paths: {
|
|
6
6
|
[key: string]: React.FC;
|
|
7
7
|
};
|
|
8
8
|
views: {
|
|
9
|
-
[key: string]: React.FC | React.ComponentType
|
|
9
|
+
[key: string]: React.FC | React.ComponentType<any>;
|
|
10
10
|
};
|
|
11
11
|
actions: {
|
|
12
|
-
[key: string]:
|
|
12
|
+
[key: string]: (props: any) => JSX.Element;
|
|
13
13
|
};
|
|
14
14
|
forms: {
|
|
15
|
-
[key: string]:
|
|
15
|
+
[key: string]: (props: any) => JSX.Element;
|
|
16
16
|
};
|
|
17
17
|
behaviors: {
|
|
18
|
-
[key: string]:
|
|
18
|
+
[key: string]: (props: any | undefined) => JSX.Element | null;
|
|
19
19
|
};
|
|
20
20
|
itemsColumn: {
|
|
21
|
-
[key: string]: () =>
|
|
22
|
-
label: string;
|
|
23
|
-
key: string;
|
|
24
|
-
isSortable?: boolean;
|
|
25
|
-
child: React.ReactNode;
|
|
26
|
-
}[];
|
|
21
|
+
[key: string]: () => ItemColumn[];
|
|
27
22
|
};
|
|
28
23
|
schemas: {
|
|
29
|
-
[key: string]:
|
|
24
|
+
[key: string]: RegistrySchema;
|
|
30
25
|
};
|
|
31
26
|
properties: {
|
|
32
27
|
[key: string]: React.FC;
|
|
33
28
|
};
|
|
34
29
|
components: {
|
|
35
|
-
[key: string]: React.
|
|
30
|
+
[key: string]: (props: any) => React.ReactNode | null | undefined;
|
|
36
31
|
};
|
|
37
32
|
searchEngineQueryParamsFunction: {
|
|
38
33
|
[key: string]: string;
|
|
@@ -47,22 +42,27 @@ export interface IRegistry {
|
|
|
47
42
|
};
|
|
48
43
|
};
|
|
49
44
|
}
|
|
50
|
-
export declare const defaultComponent: (context:
|
|
51
|
-
export declare function useRegistry(data:
|
|
45
|
+
export declare const defaultComponent: (context: GuillotinaCommonObject) => typeof FolderCtx;
|
|
46
|
+
export declare function useRegistry(data: IRegistry): {
|
|
52
47
|
registry: IRegistry;
|
|
53
|
-
get: (key:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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<{}>;
|
|
57
|
+
getItemsColumn: (type: string) => ItemColumn[] | undefined;
|
|
58
|
+
getFieldsToFilter: (type: string, fallback?: string[]) => string[];
|
|
59
|
+
getDefaultSortValue: (type: string, fallback?: {
|
|
61
60
|
key: string;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
getSchemas: (type: string) =>
|
|
61
|
+
direction: string;
|
|
62
|
+
}) => {
|
|
63
|
+
direction: "des" | "asc";
|
|
64
|
+
field: string;
|
|
65
|
+
};
|
|
66
|
+
getSchemas: (type: string) => RegistrySchema;
|
|
67
|
+
getView: (name: string) => React.ComponentType<any> | React.FC<{}>;
|
|
68
68
|
};
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type TSetState<T> = (newPartialState: Partial<T>) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Do setState like react class component.
|
|
4
|
+
*/
|
|
5
|
+
declare function useSetState<T extends object>(initialState: T): [T, TSetState<T>];
|
|
6
|
+
export default useSetState;
|