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
package/src/redux/store.tsx
CHANGED
|
@@ -8,12 +8,14 @@ import { applicationActions, applicationSelector, applicationSlice } from './sli
|
|
|
8
8
|
import { modelActions, modelSelector, modelSlice } from './slice/Model.slice';
|
|
9
9
|
import { toastSlice } from './slice/Toast.slice';
|
|
10
10
|
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
|
|
11
|
+
import { appStateActions, appStateSelector, appStateSlice } from './slice/AppState.slice';
|
|
11
12
|
|
|
12
13
|
export interface JInjectStore extends ReturnType<typeof createStore> {
|
|
13
14
|
asyncReducers: AsyncReducers;
|
|
14
15
|
add: (key: string, asyncReducer: Reducer) => void;
|
|
15
16
|
selectors: any;
|
|
16
17
|
actions: any;
|
|
18
|
+
useAppDispatch: any;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export interface AsyncReducers {
|
|
@@ -28,10 +30,32 @@ const staticReducers = {
|
|
|
28
30
|
users: userSlice.reducer,
|
|
29
31
|
articles: articleSlice.reducer,
|
|
30
32
|
}),
|
|
33
|
+
appState: appStateSlice.reducer,
|
|
31
34
|
form: formReducer,
|
|
32
35
|
toasts: toastSlice.reducer,
|
|
33
36
|
};
|
|
34
37
|
|
|
38
|
+
function createReducer(asyncReducers: AsyncReducers) {
|
|
39
|
+
return combineReducers({
|
|
40
|
+
...staticReducers,
|
|
41
|
+
...asyncReducers,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function createStore(initialAsyncReducers: {}, initialState: any) {
|
|
46
|
+
return configureStore({
|
|
47
|
+
reducer: createReducer(initialAsyncReducers),
|
|
48
|
+
preloadedState: initialState,
|
|
49
|
+
middleware: [thunk, logger],
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type AppDispatch = ReturnType<typeof createStore>['dispatch'];
|
|
54
|
+
export type RootState = ReturnType<ReturnType<typeof createStore>['getState']>;
|
|
55
|
+
|
|
56
|
+
export const useAppDispatch = () => useDispatch<AppDispatch>();
|
|
57
|
+
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
|
58
|
+
|
|
35
59
|
// Configure the store
|
|
36
60
|
export function makeStore(initialState: any) {
|
|
37
61
|
const initialAsyncReducers = {};
|
|
@@ -60,36 +84,18 @@ export function makeStore(initialState: any) {
|
|
|
60
84
|
application: applicationSelector,
|
|
61
85
|
model: modelSelector,
|
|
62
86
|
user: usersSelector,
|
|
87
|
+
appState: appStateSelector,
|
|
63
88
|
},
|
|
64
89
|
actions: {
|
|
90
|
+
appState: appStateActions,
|
|
65
91
|
article: articleActions,
|
|
66
92
|
application: applicationActions,
|
|
67
93
|
model: modelActions,
|
|
68
94
|
user: userActions,
|
|
69
95
|
generic: genericActions,
|
|
70
96
|
},
|
|
97
|
+
useAppDispatch: useAppDispatch,
|
|
71
98
|
};
|
|
72
99
|
|
|
73
100
|
return jStore;
|
|
74
101
|
}
|
|
75
|
-
|
|
76
|
-
function createReducer(asyncReducers: AsyncReducers) {
|
|
77
|
-
return combineReducers({
|
|
78
|
-
...staticReducers,
|
|
79
|
-
...asyncReducers,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function createStore(initialAsyncReducers: {}, initialState: any) {
|
|
84
|
-
return configureStore({
|
|
85
|
-
reducer: createReducer(initialAsyncReducers),
|
|
86
|
-
preloadedState: initialState,
|
|
87
|
-
middleware: [thunk, logger],
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export type AppDispatch = ReturnType<typeof createStore>['dispatch'];
|
|
92
|
-
export type RootState = ReturnType<ReturnType<typeof createStore>['getState']>;
|
|
93
|
-
|
|
94
|
-
export const useAppDispatch = () => useDispatch<AppDispatch>();
|
|
95
|
-
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
|
package/src/utils/types.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
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';
|
|
10
|
+
import { JInjectStore } from '../redux/store';
|
|
9
11
|
|
|
10
|
-
export type
|
|
12
|
+
export type Gabarit =
|
|
11
13
|
| 'core-1-cols'
|
|
12
14
|
| 'core-2-cols'
|
|
13
15
|
| 'core-3-cols'
|
|
@@ -20,7 +22,7 @@ export type gabarit =
|
|
|
20
22
|
|
|
21
23
|
export interface ReactCore {
|
|
22
24
|
extensions: ReactExtensions;
|
|
23
|
-
store:
|
|
25
|
+
store: JInjectStore;
|
|
24
26
|
actions: object;
|
|
25
27
|
registry: ReactRegistry;
|
|
26
28
|
locale?: SupportedLanguages;
|
|
@@ -31,7 +33,7 @@ export interface ReactCore {
|
|
|
31
33
|
extensionAdd: (extensionName: string, load: () => void) => void;
|
|
32
34
|
toasts: typeof toasts;
|
|
33
35
|
|
|
34
|
-
routeAdd: (route: string, extensionName: string, idDiv: string, gabarit?:
|
|
36
|
+
routeAdd: (route: string, extensionName: string, idDiv: string, gabarit?: Gabarit, gabaritOptions?: object) => void;
|
|
35
37
|
transitionTo: (
|
|
36
38
|
stateName: string,
|
|
37
39
|
args: {},
|
|
@@ -118,6 +120,11 @@ export interface WindowJ {
|
|
|
118
120
|
jamespotReactTheme: any;
|
|
119
121
|
applications: Application[];
|
|
120
122
|
models: Model<string>[];
|
|
123
|
+
hook: {
|
|
124
|
+
useTimeout: typeof useTimeout;
|
|
125
|
+
useDebounce: typeof useDebounce;
|
|
126
|
+
useDidMountEffect: typeof useDidMountEffect;
|
|
127
|
+
};
|
|
121
128
|
}
|
|
122
129
|
|
|
123
130
|
export interface Application {
|
|
@@ -166,11 +173,14 @@ export type IsAppActivateProps = {
|
|
|
166
173
|
|
|
167
174
|
export type ReactExtensionProps = {
|
|
168
175
|
extensionName: string;
|
|
176
|
+
moduleName?: string;
|
|
169
177
|
route?: string;
|
|
170
178
|
idAnchor?: string;
|
|
171
179
|
reducerName?: string;
|
|
172
|
-
gabarit?:
|
|
180
|
+
gabarit?: Gabarit;
|
|
173
181
|
apiDependency?: string;
|
|
174
182
|
};
|
|
175
183
|
|
|
184
|
+
export * from '../displayer/types';
|
|
185
|
+
|
|
176
186
|
export { RootState } from '../redux/store';
|