jamespot-react-core 1.1.12 → 1.1.13
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/.github/workflows/deploy-dev-branches.yml +1 -1
- package/.github/workflows/increment-npm-version.yml +26 -0
- package/.github/workflows/npm-package.yml +1 -1
- package/.husky/pre-commit +0 -2
- package/build/294.bundle.js +1 -1
- package/build/294.bundle.js.map +1 -1
- package/build/715.bundle.js +1 -1
- package/build/715.bundle.js.map +1 -1
- package/build/76.bundle.js +2 -0
- package/build/76.bundle.js.map +1 -0
- package/build/862.bundle.js +2 -0
- package/build/862.bundle.js.map +1 -0
- package/build/955.bundle.js +2 -0
- package/build/955.bundle.js.map +1 -0
- package/build/App.d.ts +4 -3
- package/build/app.bundle.js +41 -41
- package/build/app.bundle.js.map +1 -1
- package/build/components/AppStateLoader.component.d.ts +7 -0
- package/build/components/types.d.ts +1 -0
- package/build/displayer/DisplayForm.component.d.ts +19 -0
- package/build/displayer/Empty.d.ts +1 -0
- package/build/displayer/components/DisplaySingleValue.component.d.ts +1 -0
- package/build/displayer/list/formatter.d.ts +112 -10
- package/build/displayer/types.d.ts +54 -2
- package/build/redux/slice/AppState.slice.d.ts +29 -0
- package/build/redux/slice/Application.slice.d.ts +6 -0
- package/build/redux/slice/Article.slice.d.ts +6 -0
- package/build/redux/slice/Model.slice.d.ts +6 -0
- package/build/redux/slice/Toast.slice.d.ts +6 -0
- package/build/redux/slice/User.slice.d.ts +6 -0
- package/build/redux/store.d.ts +8 -1
- package/build/utils/types.d.ts +14 -5
- package/package.json +6 -5
- package/src/App.tsx +41 -8
- package/src/components/AppStateLoader.component.tsx +54 -0
- package/src/components/index.tsx +10 -0
- package/src/components/types.ts +1 -0
- package/src/displayer/DisplayAttribute.component.tsx +1 -2
- package/src/displayer/DisplayForm.component.tsx +78 -0
- package/src/displayer/Empty.tsx +4 -0
- package/src/displayer/components/DisplaySingleValue.component.tsx +6 -0
- package/src/displayer/list/formatter.tsx +182 -14
- package/src/displayer/types.ts +60 -2
- package/src/displayer/useDisplay.ts +32 -15
- package/src/redux/slice/AppState.slice.ts +25 -0
- package/src/redux/store.tsx +27 -21
- package/src/utils/types.ts +15 -5
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DisplayFormProps, DisplayFormRef } from './types';
|
|
3
|
+
/****
|
|
4
|
+
* The jamespot model depend on the platform
|
|
5
|
+
* For example a user can have the size attribute only for a given platform
|
|
6
|
+
* The model specifics of a platform are stored in J.model
|
|
7
|
+
*
|
|
8
|
+
* This component display an array of attributes only if this attribute is activated on the platform
|
|
9
|
+
*
|
|
10
|
+
* @param props.object the object to display (ie the user)
|
|
11
|
+
* @param props.attributesName an array of string : the list of attributes we want to display
|
|
12
|
+
* @param props.componentsOverride we can override the default render of the attribute
|
|
13
|
+
* @param props.componentsOverride.render the whole component logic (we override @DisplayList or @DisplaySingleValue for exemple)
|
|
14
|
+
* @param props.componentsOverride.wrapper the attribute is wrapped inside an element. For a list it can be an UL
|
|
15
|
+
* @param props.componentsOverride.element the component just above the element value
|
|
16
|
+
* @param props.componentsOverride.input the component input
|
|
17
|
+
* Note :If we override the "render" you can't override "wrapper" and "element" because the render rewrite everything
|
|
18
|
+
*/
|
|
19
|
+
export declare const DisplayForm: React.ForwardRefExoticComponent<DisplayFormProps & React.RefAttributes<DisplayFormRef>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Empty: () => JSX.Element;
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { FieldConfiguration } from '../types';
|
|
3
|
-
export declare function
|
|
4
|
-
name: T;
|
|
5
|
-
label: string;
|
|
2
|
+
import { DisplayInputComponentProps, FieldConfiguration } from '../types';
|
|
3
|
+
export declare function formatDate<T extends string>(configuration: FieldConfiguration<T>): {
|
|
6
4
|
accessor: T;
|
|
5
|
+
components: {
|
|
6
|
+
render: ({ object, attribute }: import("../types").RenderAttributeProps) => JSX.Element;
|
|
7
|
+
wrapper: ({ children }: {
|
|
8
|
+
children: React.FunctionComponent<any>;
|
|
9
|
+
}) => JSX.Element;
|
|
10
|
+
element: ({ children }: {
|
|
11
|
+
children: React.FunctionComponent<any>;
|
|
12
|
+
}) => JSX.Element;
|
|
13
|
+
input: (props: DisplayInputComponentProps) => JSX.Element;
|
|
14
|
+
};
|
|
15
|
+
label: string;
|
|
16
|
+
description?: string | undefined;
|
|
7
17
|
widget: import("../types").Widget;
|
|
18
|
+
name: T;
|
|
19
|
+
mandatory: boolean;
|
|
20
|
+
};
|
|
21
|
+
export declare function formatString<T extends string>(configuration: FieldConfiguration<T>): {
|
|
22
|
+
accessor: T;
|
|
8
23
|
components: {
|
|
9
24
|
render: (props: import("../types").RenderAttributeProps) => JSX.Element | null;
|
|
10
25
|
wrapper: ({ children }: {
|
|
@@ -13,13 +28,16 @@ export declare function formatString<T extends string>(configuration: FieldConfi
|
|
|
13
28
|
element: ({ children }: {
|
|
14
29
|
children: React.FunctionComponent<any>;
|
|
15
30
|
}) => JSX.Element;
|
|
31
|
+
input: (props: DisplayInputComponentProps) => JSX.Element;
|
|
16
32
|
};
|
|
33
|
+
label: string;
|
|
34
|
+
description?: string | undefined;
|
|
35
|
+
widget: import("../types").Widget;
|
|
36
|
+
name: T;
|
|
37
|
+
mandatory: boolean;
|
|
17
38
|
};
|
|
18
39
|
export declare function formatNumber<T extends string>(configuration: FieldConfiguration<T>): {
|
|
19
|
-
name: T;
|
|
20
|
-
label: string;
|
|
21
40
|
accessor: T;
|
|
22
|
-
widget: import("../types").Widget;
|
|
23
41
|
components: {
|
|
24
42
|
render: (props: import("../types").RenderAttributeProps) => JSX.Element | null;
|
|
25
43
|
wrapper: ({ children }: {
|
|
@@ -28,13 +46,34 @@ export declare function formatNumber<T extends string>(configuration: FieldConfi
|
|
|
28
46
|
element: ({ children }: {
|
|
29
47
|
children: React.FunctionComponent<any>;
|
|
30
48
|
}) => JSX.Element;
|
|
49
|
+
input: (props: DisplayInputComponentProps) => JSX.Element;
|
|
31
50
|
};
|
|
51
|
+
label: string;
|
|
52
|
+
description?: string | undefined;
|
|
53
|
+
widget: import("../types").Widget;
|
|
54
|
+
name: T;
|
|
55
|
+
mandatory: boolean;
|
|
32
56
|
};
|
|
33
57
|
export declare function formatTaxonomy<T extends string>(configuration: FieldConfiguration<T>): {
|
|
34
|
-
name: T;
|
|
35
|
-
label: string;
|
|
36
58
|
accessor: T;
|
|
59
|
+
components: {
|
|
60
|
+
render: (props: import("../types").RenderAttributeProps) => JSX.Element | null;
|
|
61
|
+
wrapper: ({ children }: {
|
|
62
|
+
children: React.FunctionComponent<any>;
|
|
63
|
+
}) => JSX.Element;
|
|
64
|
+
element: ({ children }: {
|
|
65
|
+
children: React.FunctionComponent<any>;
|
|
66
|
+
}) => JSX.Element;
|
|
67
|
+
input: (props: DisplayInputComponentProps) => JSX.Element;
|
|
68
|
+
};
|
|
69
|
+
label: string;
|
|
70
|
+
description?: string | undefined;
|
|
37
71
|
widget: import("../types").Widget;
|
|
72
|
+
name: T;
|
|
73
|
+
mandatory: boolean;
|
|
74
|
+
};
|
|
75
|
+
export declare function formatOrientedlinks<T extends string>(configuration: FieldConfiguration<T>): {
|
|
76
|
+
accessor: T;
|
|
38
77
|
components: {
|
|
39
78
|
render: (props: import("../types").RenderAttributeProps) => JSX.Element | null;
|
|
40
79
|
wrapper: ({ children }: {
|
|
@@ -43,13 +82,70 @@ export declare function formatTaxonomy<T extends string>(configuration: FieldCon
|
|
|
43
82
|
element: ({ children }: {
|
|
44
83
|
children: React.FunctionComponent<any>;
|
|
45
84
|
}) => JSX.Element;
|
|
85
|
+
input: ({ widget, ...props }: DisplayInputComponentProps) => JSX.Element;
|
|
46
86
|
};
|
|
87
|
+
label: string;
|
|
88
|
+
description?: string | undefined;
|
|
89
|
+
widget: import("../types").Widget;
|
|
90
|
+
name: T;
|
|
91
|
+
mandatory: boolean;
|
|
47
92
|
};
|
|
48
|
-
export declare function
|
|
93
|
+
export declare function formatUri<T extends string>(configuration: FieldConfiguration<T>): {
|
|
94
|
+
accessor: T;
|
|
95
|
+
components: {
|
|
96
|
+
render: (props: import("../types").RenderAttributeProps) => JSX.Element | null;
|
|
97
|
+
wrapper: ({ children }: {
|
|
98
|
+
children: React.FunctionComponent<any>;
|
|
99
|
+
}) => JSX.Element;
|
|
100
|
+
element: ({ children }: {
|
|
101
|
+
children: React.FunctionComponent<any>;
|
|
102
|
+
}) => JSX.Element;
|
|
103
|
+
input: ({ widget, ...props }: DisplayInputComponentProps) => JSX.Element;
|
|
104
|
+
};
|
|
105
|
+
label: string;
|
|
106
|
+
description?: string | undefined;
|
|
107
|
+
widget: import("../types").Widget;
|
|
49
108
|
name: T;
|
|
109
|
+
mandatory: boolean;
|
|
110
|
+
};
|
|
111
|
+
export declare function formatRadio<T extends string>(configuration: FieldConfiguration<T>): {
|
|
112
|
+
accessor: T;
|
|
113
|
+
components: {
|
|
114
|
+
render: (props: import("../types").RenderAttributeProps) => JSX.Element | null;
|
|
115
|
+
wrapper: ({ children }: {
|
|
116
|
+
children: React.FunctionComponent<any>;
|
|
117
|
+
}) => JSX.Element;
|
|
118
|
+
element: ({ children }: {
|
|
119
|
+
children: React.FunctionComponent<any>;
|
|
120
|
+
}) => JSX.Element;
|
|
121
|
+
input: ({ widget, ...props }: DisplayInputComponentProps) => JSX.Element;
|
|
122
|
+
};
|
|
50
123
|
label: string;
|
|
124
|
+
description?: string | undefined;
|
|
125
|
+
widget: import("../types").Widget;
|
|
126
|
+
name: T;
|
|
127
|
+
mandatory: boolean;
|
|
128
|
+
};
|
|
129
|
+
export declare function formatCheckbox<T extends string>(configuration: FieldConfiguration<T>): {
|
|
51
130
|
accessor: T;
|
|
131
|
+
components: {
|
|
132
|
+
render: (props: import("../types").RenderAttributeProps) => JSX.Element | null;
|
|
133
|
+
wrapper: ({ children }: {
|
|
134
|
+
children: React.FunctionComponent<any>;
|
|
135
|
+
}) => JSX.Element;
|
|
136
|
+
element: ({ children }: {
|
|
137
|
+
children: React.FunctionComponent<any>;
|
|
138
|
+
}) => JSX.Element;
|
|
139
|
+
input: ({ widget, ...props }: DisplayInputComponentProps) => JSX.Element;
|
|
140
|
+
};
|
|
141
|
+
label: string;
|
|
142
|
+
description?: string | undefined;
|
|
52
143
|
widget: import("../types").Widget;
|
|
144
|
+
name: T;
|
|
145
|
+
mandatory: boolean;
|
|
146
|
+
};
|
|
147
|
+
export declare function formatDefault<T extends string>(configuration: FieldConfiguration<T>): {
|
|
148
|
+
accessor: T;
|
|
53
149
|
components: {
|
|
54
150
|
render: (props: import("../types").RenderAttributeProps) => JSX.Element | null;
|
|
55
151
|
wrapper: ({ children }: {
|
|
@@ -58,5 +154,11 @@ export declare function formatDefault<T extends string>(configuration: FieldConf
|
|
|
58
154
|
element: ({ children }: {
|
|
59
155
|
children: React.FunctionComponent<any>;
|
|
60
156
|
}) => JSX.Element;
|
|
157
|
+
input: (props: DisplayInputComponentProps) => JSX.Element;
|
|
61
158
|
};
|
|
159
|
+
label: string;
|
|
160
|
+
description?: string | undefined;
|
|
161
|
+
widget: import("../types").Widget;
|
|
162
|
+
name: T;
|
|
163
|
+
mandatory: boolean;
|
|
62
164
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { UseFormReset } from 'react-hook-form';
|
|
1
3
|
export declare type JObject<T extends string> = Record<T, any> & {
|
|
2
4
|
title: string;
|
|
3
5
|
id: string;
|
|
@@ -14,6 +16,9 @@ export declare type WidgetDate = {
|
|
|
14
16
|
type: 'date';
|
|
15
17
|
format: string;
|
|
16
18
|
};
|
|
19
|
+
export declare type WidgetDatetime = {
|
|
20
|
+
type: 'datetime';
|
|
21
|
+
};
|
|
17
22
|
export declare type WidgetSelect<U extends string = string> = {
|
|
18
23
|
type: 'select';
|
|
19
24
|
options: Record<U, string>;
|
|
@@ -35,6 +40,10 @@ export declare type WidgetUrl = {
|
|
|
35
40
|
export declare type WidgetRefUser = {
|
|
36
41
|
type: 'refUser';
|
|
37
42
|
};
|
|
43
|
+
export declare type WidgetRadio = {
|
|
44
|
+
type: 'radio';
|
|
45
|
+
options: Record<string, string>;
|
|
46
|
+
};
|
|
38
47
|
export declare type WidgetCheckbox = {
|
|
39
48
|
type: 'checkbox';
|
|
40
49
|
options: Record<string, string>;
|
|
@@ -45,22 +54,51 @@ export declare type WidgetTaxonomy = {
|
|
|
45
54
|
idTaxonomy: string;
|
|
46
55
|
};
|
|
47
56
|
};
|
|
48
|
-
export declare type
|
|
57
|
+
export declare type WidgetOrientedlinks = {
|
|
58
|
+
type: 'orientedlinks';
|
|
59
|
+
params: {
|
|
60
|
+
'jcomplete-multiple': '0' | '1';
|
|
61
|
+
showAdd: '0' | '1';
|
|
62
|
+
supportedTypes: Array<string>;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
export declare type WidgetUri = {
|
|
66
|
+
type: 'uri';
|
|
67
|
+
params: {
|
|
68
|
+
class: string;
|
|
69
|
+
'jcomplete-url': string;
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export declare type Widget = WidgetText | WidgetNumber | WidgetDate | WidgetDatetime | WidgetSelect | WidgetEmail | WidgetUrl | WidgetRefUser | WidgetRadio | WidgetCheckbox | WidgetOrientedlinks | WidgetTaxonomy | WidgetUri;
|
|
49
74
|
export declare type FieldConfiguration<T extends string> = {
|
|
50
75
|
label: string;
|
|
76
|
+
description?: string;
|
|
51
77
|
widget: Widget;
|
|
52
78
|
name: T;
|
|
79
|
+
mandatory: boolean;
|
|
53
80
|
};
|
|
54
81
|
export declare type Configuration<T extends string> = FieldConfiguration<T>;
|
|
82
|
+
export declare type DisplayInputComponentProps = {
|
|
83
|
+
control: any;
|
|
84
|
+
label: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
name: string;
|
|
87
|
+
widget: Widget;
|
|
88
|
+
mandatory: boolean;
|
|
89
|
+
};
|
|
55
90
|
export declare type DisplayElementComponent = {
|
|
56
91
|
render: React.FunctionComponent<RenderAttributeProps>;
|
|
57
92
|
wrapper: React.FunctionComponent<any>;
|
|
58
93
|
element: React.FunctionComponent<any>;
|
|
94
|
+
input: React.FunctionComponent<DisplayInputComponentProps>;
|
|
59
95
|
};
|
|
60
96
|
export declare type DisplayerElement = {
|
|
61
97
|
name: string;
|
|
62
98
|
label: string;
|
|
99
|
+
description?: string;
|
|
63
100
|
accessor: string;
|
|
101
|
+
mandatory: boolean;
|
|
64
102
|
widget: Widget;
|
|
65
103
|
components: DisplayElementComponent;
|
|
66
104
|
};
|
|
@@ -73,6 +111,8 @@ declare type DisplayAttributeComponentOverrideProps = {
|
|
|
73
111
|
wrapper: React.FunctionComponent<any>;
|
|
74
112
|
} | {
|
|
75
113
|
element: React.FunctionComponent<any>;
|
|
114
|
+
} | {
|
|
115
|
+
input: React.FunctionComponent<any>;
|
|
76
116
|
};
|
|
77
117
|
export declare type DisplayAttributesProps = {
|
|
78
118
|
object: any;
|
|
@@ -83,5 +123,17 @@ export declare type RenderAttributeProps = {
|
|
|
83
123
|
object: any;
|
|
84
124
|
attribute: DisplayerElement;
|
|
85
125
|
};
|
|
86
|
-
export declare type
|
|
126
|
+
export declare type DisplayFormProps = {
|
|
127
|
+
object: any;
|
|
128
|
+
componentsOverride?: Record<string, DisplayAttributeComponentOverrideProps>;
|
|
129
|
+
attributesName: string[];
|
|
130
|
+
onSubmit: any;
|
|
131
|
+
};
|
|
132
|
+
export declare type DisplayFormRef = {
|
|
133
|
+
reset: UseFormReset<any>;
|
|
134
|
+
};
|
|
135
|
+
export declare type RenderInputProps = DisplayerElement & {
|
|
136
|
+
control: any;
|
|
137
|
+
};
|
|
138
|
+
export declare type Displayer = Array<DisplayerElement>;
|
|
87
139
|
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
import { RootState } from '../store';
|
|
3
|
+
declare type SliceState = {
|
|
4
|
+
[key: string]: {
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
error?: object;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const appStateSlice: import("@reduxjs/toolkit").Slice<SliceState, {
|
|
10
|
+
setLoading: (state: SliceState, action: PayloadAction<string>) => void;
|
|
11
|
+
setLoaded: (state: SliceState, action: PayloadAction<string>) => void;
|
|
12
|
+
setError: (state: SliceState, action: PayloadAction<{
|
|
13
|
+
app: string;
|
|
14
|
+
error: object;
|
|
15
|
+
}>) => void;
|
|
16
|
+
}, "appState">;
|
|
17
|
+
export declare const appStateSelector: (state: RootState, appName: string) => {
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
error?: object | undefined;
|
|
20
|
+
};
|
|
21
|
+
export declare const appStateActions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
22
|
+
setLoading: (state: SliceState, action: PayloadAction<string>) => void;
|
|
23
|
+
setLoaded: (state: SliceState, action: PayloadAction<string>) => void;
|
|
24
|
+
setError: (state: SliceState, action: PayloadAction<{
|
|
25
|
+
app: string;
|
|
26
|
+
error: object;
|
|
27
|
+
}>) => void;
|
|
28
|
+
}>;
|
|
29
|
+
export {};
|
|
@@ -30,6 +30,12 @@ export declare const applicationSelector: import("@reduxjs/toolkit").EntitySelec
|
|
|
30
30
|
users: import("@reduxjs/toolkit").EntityState<import("./User.slice").User>;
|
|
31
31
|
articles: import("@reduxjs/toolkit").EntityState<import("./Article.slice").Article>;
|
|
32
32
|
}>;
|
|
33
|
+
appState: {
|
|
34
|
+
[key: string]: {
|
|
35
|
+
isLoading: boolean;
|
|
36
|
+
error?: object | undefined;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
33
39
|
form: import("redux-form").FormStateMap;
|
|
34
40
|
toasts: import("@reduxjs/toolkit").EntityState<import("./Toast.slice").ToastEntity>;
|
|
35
41
|
}>>;
|
|
@@ -34,6 +34,12 @@ export declare const articlesSelector: import("@reduxjs/toolkit").EntitySelector
|
|
|
34
34
|
users: import("@reduxjs/toolkit").EntityState<import("./User.slice").User>;
|
|
35
35
|
articles: import("@reduxjs/toolkit").EntityState<Article>;
|
|
36
36
|
}>;
|
|
37
|
+
appState: {
|
|
38
|
+
[key: string]: {
|
|
39
|
+
isLoading: boolean;
|
|
40
|
+
error?: object | undefined;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
37
43
|
form: import("redux-form").FormStateMap;
|
|
38
44
|
toasts: import("@reduxjs/toolkit").EntityState<import("./Toast.slice").ToastEntity>;
|
|
39
45
|
}>>;
|
|
@@ -30,6 +30,12 @@ export declare const modelSelector: import("@reduxjs/toolkit").EntitySelectors<M
|
|
|
30
30
|
users: import("@reduxjs/toolkit").EntityState<import("./User.slice").User>;
|
|
31
31
|
articles: import("@reduxjs/toolkit").EntityState<import("./Article.slice").Article>;
|
|
32
32
|
}>;
|
|
33
|
+
appState: {
|
|
34
|
+
[key: string]: {
|
|
35
|
+
isLoading: boolean;
|
|
36
|
+
error?: object | undefined;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
33
39
|
form: import("redux-form").FormStateMap;
|
|
34
40
|
toasts: import("@reduxjs/toolkit").EntityState<import("./Toast.slice").ToastEntity>;
|
|
35
41
|
}>>;
|
|
@@ -43,6 +43,12 @@ export declare const toastSelector: import("@reduxjs/toolkit").EntitySelectors<T
|
|
|
43
43
|
users: import("@reduxjs/toolkit").EntityState<import("./User.slice").User>;
|
|
44
44
|
articles: import("@reduxjs/toolkit").EntityState<import("./Article.slice").Article>;
|
|
45
45
|
}>;
|
|
46
|
+
appState: {
|
|
47
|
+
[key: string]: {
|
|
48
|
+
isLoading: boolean;
|
|
49
|
+
error?: object | undefined;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
46
52
|
form: import("redux-form").FormStateMap;
|
|
47
53
|
toasts: import("@reduxjs/toolkit").EntityState<ToastEntity>;
|
|
48
54
|
}>>;
|
|
@@ -34,6 +34,12 @@ export declare const usersSelector: import("@reduxjs/toolkit").EntitySelectors<U
|
|
|
34
34
|
users: import("@reduxjs/toolkit").EntityState<User>;
|
|
35
35
|
articles: import("@reduxjs/toolkit").EntityState<import("./Article.slice").Article>;
|
|
36
36
|
}>;
|
|
37
|
+
appState: {
|
|
38
|
+
[key: string]: {
|
|
39
|
+
isLoading: boolean;
|
|
40
|
+
error?: object | undefined;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
37
43
|
form: import("redux-form").FormStateMap;
|
|
38
44
|
toasts: import("@reduxjs/toolkit").EntityState<import("./Toast.slice").ToastEntity>;
|
|
39
45
|
}>>;
|
package/build/redux/store.d.ts
CHANGED
|
@@ -5,11 +5,11 @@ export interface JInjectStore extends ReturnType<typeof createStore> {
|
|
|
5
5
|
add: (key: string, asyncReducer: Reducer) => void;
|
|
6
6
|
selectors: any;
|
|
7
7
|
actions: any;
|
|
8
|
+
useAppDispatch: any;
|
|
8
9
|
}
|
|
9
10
|
export interface AsyncReducers {
|
|
10
11
|
[key: string]: Reducer;
|
|
11
12
|
}
|
|
12
|
-
export declare function makeStore(initialState: any): JInjectStore;
|
|
13
13
|
declare function createStore(initialAsyncReducers: {}, initialState: any): import("@reduxjs/toolkit").EnhancedStore<import("redux").CombinedState<{
|
|
14
14
|
entities: import("redux").CombinedState<{
|
|
15
15
|
applications: import("@reduxjs/toolkit").EntityState<import("../utils/types").Application>;
|
|
@@ -17,6 +17,12 @@ declare function createStore(initialAsyncReducers: {}, initialState: any): impor
|
|
|
17
17
|
users: import("@reduxjs/toolkit").EntityState<import("./slice/User.slice").User>;
|
|
18
18
|
articles: import("@reduxjs/toolkit").EntityState<import("./slice/Article.slice").Article>;
|
|
19
19
|
}>;
|
|
20
|
+
appState: {
|
|
21
|
+
[key: string]: {
|
|
22
|
+
isLoading: boolean;
|
|
23
|
+
error?: object | undefined;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
20
26
|
form: import("redux-form").FormStateMap;
|
|
21
27
|
toasts: import("@reduxjs/toolkit").EntityState<import("./slice/Toast.slice").ToastEntity>;
|
|
22
28
|
}>, import("redux").AnyAction, ((import("redux-thunk").ThunkMiddleware<{}, import("redux").AnyAction, undefined> & {
|
|
@@ -26,4 +32,5 @@ export declare type AppDispatch = ReturnType<typeof createStore>['dispatch'];
|
|
|
26
32
|
export declare type RootState = ReturnType<ReturnType<typeof createStore>['getState']>;
|
|
27
33
|
export declare const useAppDispatch: () => import("redux").Dispatch<import("redux").AnyAction>;
|
|
28
34
|
export declare const useAppSelector: TypedUseSelectorHook<RootState>;
|
|
35
|
+
export declare function makeStore(initialState: any): JInjectStore;
|
|
29
36
|
export {};
|
package/build/utils/types.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ReactRegistry } from './registry';
|
|
3
3
|
import { ReactTranslation, SupportedLanguages, TranslationKeys } from './translation';
|
|
4
|
-
export { Configuration, DisplayAttributesProps } from '../displayer/types';
|
|
4
|
+
export { Configuration, DisplayAttributesProps, DisplayFormProps } from '../displayer/types';
|
|
5
5
|
export * from '../components/types';
|
|
6
6
|
import { useDisplay } from '../displayer/useDisplay';
|
|
7
7
|
import { Configuration } from '../displayer/types';
|
|
8
|
+
import { useDebounce, useDidMountEffect, useTimeout } from 'jamespot-react-components';
|
|
8
9
|
import { toasts } from '../redux/slice/Toast.slice';
|
|
9
|
-
|
|
10
|
+
import { JInjectStore } from '../redux/store';
|
|
11
|
+
export declare type Gabarit = 'core-1-cols' | 'core-2-cols' | 'core-3-cols' | 'content-1-cols' | 'content-2-cols' | 'content-3-cols' | 'app-1-cols' | 'app-2-cols' | 'empty';
|
|
10
12
|
export interface ReactCore {
|
|
11
13
|
extensions: ReactExtensions;
|
|
12
|
-
store:
|
|
14
|
+
store: JInjectStore;
|
|
13
15
|
actions: object;
|
|
14
16
|
registry: ReactRegistry;
|
|
15
17
|
locale?: SupportedLanguages;
|
|
@@ -19,7 +21,7 @@ export interface ReactCore {
|
|
|
19
21
|
require: (extensionName: string, args?: any) => void;
|
|
20
22
|
extensionAdd: (extensionName: string, load: () => void) => void;
|
|
21
23
|
toasts: typeof toasts;
|
|
22
|
-
routeAdd: (route: string, extensionName: string, idDiv: string, gabarit?:
|
|
24
|
+
routeAdd: (route: string, extensionName: string, idDiv: string, gabarit?: Gabarit, gabaritOptions?: object) => void;
|
|
23
25
|
transitionTo: (stateName: string, args: {}, options?: {
|
|
24
26
|
reload: boolean;
|
|
25
27
|
notify?: boolean;
|
|
@@ -96,6 +98,11 @@ export interface WindowJ {
|
|
|
96
98
|
jamespotReactTheme: any;
|
|
97
99
|
applications: Application[];
|
|
98
100
|
models: Model<string>[];
|
|
101
|
+
hook: {
|
|
102
|
+
useTimeout: typeof useTimeout;
|
|
103
|
+
useDebounce: typeof useDebounce;
|
|
104
|
+
useDidMountEffect: typeof useDidMountEffect;
|
|
105
|
+
};
|
|
99
106
|
}
|
|
100
107
|
export interface Application {
|
|
101
108
|
name: string;
|
|
@@ -138,10 +145,12 @@ export declare type IsAppActivateProps = {
|
|
|
138
145
|
};
|
|
139
146
|
export declare type ReactExtensionProps = {
|
|
140
147
|
extensionName: string;
|
|
148
|
+
moduleName?: string;
|
|
141
149
|
route?: string;
|
|
142
150
|
idAnchor?: string;
|
|
143
151
|
reducerName?: string;
|
|
144
|
-
gabarit?:
|
|
152
|
+
gabarit?: Gabarit;
|
|
145
153
|
apiDependency?: string;
|
|
146
154
|
};
|
|
155
|
+
export * from '../displayer/types';
|
|
147
156
|
export { RootState } from '../redux/store';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jamespot-react-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
4
4
|
"description": "Jamespot React Core",
|
|
5
5
|
"types": "./build/utils/types.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"@types/react-test-renderer": "^17.0.1",
|
|
33
33
|
"@types/react-transition-group": "^4.4.1",
|
|
34
34
|
"@types/redux-form": "^8.2.7",
|
|
35
|
-
"@types/styled-components": "^5.1.4",
|
|
36
35
|
"@types/socket.io-client": "^3.0.0",
|
|
36
|
+
"@types/styled-components": "^5.1.4",
|
|
37
37
|
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
38
38
|
"@typescript-eslint/parser": "^5.4.0",
|
|
39
39
|
"babel-jest": "^27.3.1",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"lint-staged": "^12.0.2",
|
|
52
52
|
"mini-css-extract-plugin": "^0.10.0",
|
|
53
53
|
"prettier": "^2.4.1",
|
|
54
|
-
"react-test-renderer": "^
|
|
54
|
+
"react-test-renderer": "^17.0.1",
|
|
55
55
|
"source-map-loader": "^1.0.1",
|
|
56
56
|
"ts-jest": "^27.0.7",
|
|
57
57
|
"ts-loader": "^8.0.2",
|
|
@@ -62,11 +62,12 @@
|
|
|
62
62
|
"worker-loader": "^3.0.8"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"jamespot-react-components": "
|
|
66
|
-
"jamespot-user-api": "
|
|
65
|
+
"jamespot-react-components": "^1.0.1",
|
|
66
|
+
"jamespot-user-api": "^1.0.2",
|
|
67
67
|
"pkg.json": "^2.0.8",
|
|
68
68
|
"react": "^17.0.2",
|
|
69
69
|
"react-dom": "^17.0.2",
|
|
70
|
+
"react-hook-form": "^7.25.0",
|
|
70
71
|
"react-intl": "^5.8.6",
|
|
71
72
|
"react-redux": "^7.2.3",
|
|
72
73
|
"react-select": "^3.2.0",
|
package/src/App.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Theme, Resources } from 'jamespot-react-components';
|
|
2
|
-
import { makeStore } from './redux/store';
|
|
2
|
+
import { JInjectStore, makeStore } from './redux/store';
|
|
3
3
|
import { ActionCreators } from './redux/actions/actions';
|
|
4
4
|
import {
|
|
5
5
|
ReactCore,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
ReactExtensionContainer,
|
|
9
9
|
WindowJ,
|
|
10
10
|
ReactSocket,
|
|
11
|
-
|
|
11
|
+
Gabarit,
|
|
12
12
|
} from './utils/types';
|
|
13
13
|
import { Registry, ReactRegistry } from './utils/registry';
|
|
14
14
|
import './components';
|
|
@@ -23,6 +23,8 @@ import { Toaster } from './enhencers/toast/Toaster';
|
|
|
23
23
|
import { ExtensionProvider } from './components/ExtensionProvider.component';
|
|
24
24
|
import { toasts } from './redux/slice/Toast.slice';
|
|
25
25
|
|
|
26
|
+
import { useTimeout, useDebounce, useDidMountEffect } from 'jamespot-react-components';
|
|
27
|
+
|
|
26
28
|
declare global {
|
|
27
29
|
const J: WindowJ;
|
|
28
30
|
}
|
|
@@ -31,7 +33,7 @@ const store = makeStore({});
|
|
|
31
33
|
|
|
32
34
|
class App implements ReactCore {
|
|
33
35
|
extensions: ReactExtensions = {};
|
|
34
|
-
store:
|
|
36
|
+
store: JInjectStore;
|
|
35
37
|
actions: object;
|
|
36
38
|
registry: ReactRegistry;
|
|
37
39
|
useDisplay: typeof useDisplay;
|
|
@@ -75,17 +77,22 @@ class App implements ReactCore {
|
|
|
75
77
|
this.extensions[extensionName] = load;
|
|
76
78
|
}
|
|
77
79
|
|
|
78
|
-
public routeAdd(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
public routeAdd(
|
|
81
|
+
route: string,
|
|
82
|
+
extensionName: string,
|
|
83
|
+
idDiv: string,
|
|
84
|
+
gabarit: Gabarit = 'app-1-cols',
|
|
85
|
+
gabaritOptions?: object,
|
|
86
|
+
) {
|
|
87
|
+
const jGabarit = gabarit === 'empty' ? '' : gabarit;
|
|
88
|
+
|
|
82
89
|
J.ng.addState(extensionName, {
|
|
83
90
|
abstract: true,
|
|
84
91
|
templateUrl: '/?action=tpl&tpl=content&_=' + J.revision,
|
|
85
92
|
controller: [
|
|
86
93
|
'$jTheme',
|
|
87
94
|
function ($jTheme: any) {
|
|
88
|
-
$jTheme.setGabarit(
|
|
95
|
+
$jTheme.setGabarit(jGabarit, gabaritOptions);
|
|
89
96
|
},
|
|
90
97
|
],
|
|
91
98
|
});
|
|
@@ -160,6 +167,26 @@ Registry.registerLib(
|
|
|
160
167
|
import('./displayer/DisplayAttribute.component'),
|
|
161
168
|
);
|
|
162
169
|
|
|
170
|
+
Registry.registerLib(
|
|
171
|
+
[
|
|
172
|
+
{
|
|
173
|
+
name: 'DisplayForm',
|
|
174
|
+
module: 'DisplayForm',
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
import('./displayer/DisplayForm.component'),
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
Registry.registerLib(
|
|
181
|
+
[
|
|
182
|
+
{
|
|
183
|
+
name: 'Empty',
|
|
184
|
+
module: 'Empty',
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
import('./displayer/Empty'),
|
|
188
|
+
);
|
|
189
|
+
|
|
163
190
|
const AppDefault = new App(store, ActionCreators, Registry);
|
|
164
191
|
|
|
165
192
|
AppDefault.locale = J.locale;
|
|
@@ -175,6 +202,12 @@ if (J.jUserLogged) {
|
|
|
175
202
|
socket.init(J.jUserLogged.id);
|
|
176
203
|
}
|
|
177
204
|
|
|
205
|
+
J.hook = {
|
|
206
|
+
useTimeout,
|
|
207
|
+
useDebounce,
|
|
208
|
+
useDidMountEffect,
|
|
209
|
+
};
|
|
210
|
+
|
|
178
211
|
document.addEventListener('DOMContentLoaded', function () {
|
|
179
212
|
const el = document.getElementById('react-toasts');
|
|
180
213
|
if (el) {
|