jamespot-react-core 1.1.13 → 1.1.20

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 (54) hide show
  1. package/.github/workflows/deploy-dev-branches.yml +1 -1
  2. package/.github/workflows/increment-npm-version.yml +1 -1
  3. package/.github/workflows/npm-package.yml +1 -1
  4. package/build/App.d.ts +9 -6
  5. package/build/app.bundle.js +255 -236
  6. package/build/app.bundle.js.map +1 -1
  7. package/build/components/NoMatch.component.d.ts +1 -0
  8. package/build/components/types.d.ts +0 -1
  9. package/build/displayer/components/DisplaySingleValue.component.d.ts +0 -1
  10. package/build/displayer/list/formatter.d.ts +10 -112
  11. package/build/displayer/types.d.ts +2 -54
  12. package/build/redux/slice/Application.slice.d.ts +0 -6
  13. package/build/redux/slice/Article.slice.d.ts +1 -7
  14. package/build/redux/slice/Model.slice.d.ts +0 -6
  15. package/build/redux/slice/Toast.slice.d.ts +1 -7
  16. package/build/redux/slice/User.slice.d.ts +1 -7
  17. package/build/redux/store.d.ts +2 -9
  18. package/build/utils/router.d.ts +13 -0
  19. package/build/utils/types.d.ts +7 -14
  20. package/ext-component-list.json +20 -8
  21. package/package.json +8 -7
  22. package/src/App.tsx +41 -54
  23. package/src/components/ExtensionProvider.component.tsx +5 -3
  24. package/src/components/IfAppIsActivated.component.tsx +2 -1
  25. package/src/components/NoMatch.component.tsx +5 -0
  26. package/src/components/types.ts +0 -1
  27. package/src/displayer/DisplayAttribute.component.tsx +4 -2
  28. package/src/displayer/components/DisplaySingleValue.component.tsx +0 -6
  29. package/src/displayer/list/formatter.tsx +14 -182
  30. package/src/displayer/types.ts +2 -60
  31. package/src/displayer/useDisplay.ts +17 -33
  32. package/src/redux/store.tsx +21 -27
  33. package/src/utils/router.tsx +46 -0
  34. package/src/utils/types.ts +7 -15
  35. package/build/294.bundle.js +0 -2
  36. package/build/294.bundle.js.map +0 -1
  37. package/build/715.bundle.js +0 -2
  38. package/build/715.bundle.js.map +0 -1
  39. package/build/76.bundle.js +0 -2
  40. package/build/76.bundle.js.map +0 -1
  41. package/build/862.bundle.js +0 -2
  42. package/build/862.bundle.js.map +0 -1
  43. package/build/955.bundle.js +0 -2
  44. package/build/955.bundle.js.map +0 -1
  45. package/build/components/AppStateLoader.component.d.ts +0 -7
  46. package/build/components/index.d.ts +0 -1
  47. package/build/displayer/DisplayForm.component.d.ts +0 -19
  48. package/build/displayer/Empty.d.ts +0 -1
  49. package/build/redux/slice/AppState.slice.d.ts +0 -29
  50. package/src/components/AppStateLoader.component.tsx +0 -54
  51. package/src/components/index.tsx +0 -31
  52. package/src/displayer/DisplayForm.component.tsx +0 -78
  53. package/src/displayer/Empty.tsx +0 -4
  54. package/src/redux/slice/AppState.slice.ts +0 -25
package/src/App.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Theme, Resources } from 'jamespot-react-components';
2
- import { JInjectStore, makeStore } from './redux/store';
2
+ import { makeStore } from './redux/store';
3
3
  import { ActionCreators } from './redux/actions/actions';
4
4
  import {
5
5
  ReactCore,
@@ -8,13 +8,14 @@ import {
8
8
  ReactExtensionContainer,
9
9
  WindowJ,
10
10
  ReactSocket,
11
- Gabarit,
11
+ gabarit,
12
+ ReactExtensionProps,
13
+ Model,
12
14
  } from './utils/types';
13
15
  import { Registry, ReactRegistry } from './utils/registry';
14
- import './components';
15
16
  import { Translation, ReactTranslation, SupportedLanguages } from './utils/translation';
16
17
  import socket from './utils/socket';
17
-
18
+ import JRCore from 'App';
18
19
  import jComponentList from '../ext-component-list.json';
19
20
  import * as React from 'react';
20
21
  import * as ReactDOM from 'react-dom';
@@ -22,8 +23,9 @@ import { useDisplay } from './displayer/useDisplay';
22
23
  import { Toaster } from './enhencers/toast/Toaster';
23
24
  import { ExtensionProvider } from './components/ExtensionProvider.component';
24
25
  import { toasts } from './redux/slice/Toast.slice';
26
+ import { IfAppIsActivated } from 'components/IfAppIsActivated.component';
25
27
 
26
- import { useTimeout, useDebounce, useDidMountEffect } from 'jamespot-react-components';
28
+ import Router, { ReactRouter } from './utils/router';
27
29
 
28
30
  declare global {
29
31
  const J: WindowJ;
@@ -33,7 +35,7 @@ const store = makeStore({});
33
35
 
34
36
  class App implements ReactCore {
35
37
  extensions: ReactExtensions = {};
36
- store: JInjectStore;
38
+ store: any;
37
39
  actions: object;
38
40
  registry: ReactRegistry;
39
41
  useDisplay: typeof useDisplay;
@@ -41,6 +43,7 @@ class App implements ReactCore {
41
43
  translation?: ReactTranslation;
42
44
  theme: any;
43
45
  socket?: ReactSocket;
46
+ router: ReactRouter = Router;
44
47
  toasts: typeof toasts;
45
48
 
46
49
  constructor(store: any, ActionCreators: object, registry: ReactRegistry) {
@@ -51,7 +54,7 @@ class App implements ReactCore {
51
54
  this.toasts = toasts;
52
55
  }
53
56
 
54
- public require = (extensionName: string, args: any) => {
57
+ public require = (extensionName: string, args?: any) => {
55
58
  if (this.extensions[extensionName]) {
56
59
  // eslint-disable-next-line @typescript-eslint/no-this-alias
57
60
  const self = this;
@@ -77,28 +80,24 @@ class App implements ReactCore {
77
80
  this.extensions[extensionName] = load;
78
81
  }
79
82
 
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
-
83
+ public routeAdd(route: string, extensionName: string, idDiv: string, gabarit?: gabarit, gabaritOptions?: object) {
84
+ if (gabarit === undefined) {
85
+ gabarit = 'app-1-cols';
86
+ }
89
87
  J.ng.addState(extensionName, {
90
88
  abstract: true,
91
89
  templateUrl: '/?action=tpl&tpl=content&_=' + J.revision,
92
90
  controller: [
93
91
  '$jTheme',
94
92
  function ($jTheme: any) {
95
- $jTheme.setGabarit(jGabarit, gabaritOptions);
93
+ $jTheme.setGabarit(gabarit, gabaritOptions);
96
94
  },
97
95
  ],
98
96
  });
99
97
  J.ng.addState(extensionName + '.app', {
100
98
  template: '',
101
99
  url: '/r/' + route,
100
+ reloadOnSearch: false,
102
101
  controller: [
103
102
  '$scope',
104
103
  '$rootScope',
@@ -106,7 +105,7 @@ class App implements ReactCore {
106
105
  function ($scope: any, $rootScope: any, $timeout: any) {
107
106
  $scope.appId = idDiv;
108
107
  $timeout(function () {
109
- J.react.require(extensionName);
108
+ JRCore.require(extensionName);
110
109
  });
111
110
 
112
111
  const stateChangeStart = $rootScope.$on('$stateChangeStart', function () {
@@ -157,36 +156,6 @@ if (jComponentList && Array.isArray(jComponentList)) {
157
156
  Registry.registerLib(jComponentList, import('jamespot-react-components'));
158
157
  }
159
158
 
160
- Registry.registerLib(
161
- [
162
- {
163
- name: 'DisplayAttributes',
164
- module: 'DisplayAttributes',
165
- },
166
- ],
167
- import('./displayer/DisplayAttribute.component'),
168
- );
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
-
190
159
  const AppDefault = new App(store, ActionCreators, Registry);
191
160
 
192
161
  AppDefault.locale = J.locale;
@@ -202,12 +171,28 @@ if (J.jUserLogged) {
202
171
  socket.init(J.jUserLogged.id);
203
172
  }
204
173
 
205
- J.hook = {
206
- useTimeout,
207
- useDebounce,
208
- useDidMountEffect,
209
- };
210
-
174
+ J.ng.addState('reactRouter', {
175
+ template: '<div id="app-react" style="width:100%"></div>',
176
+ url: '/rr/*path',
177
+ reloadOnSearch: false,
178
+ controller: [
179
+ '$scope',
180
+ '$rootScope',
181
+ function ($scope: any, $rootScope: any) {
182
+ J.react.router.init('app-react');
183
+
184
+ const stateChangeStart = $rootScope.$on('$stateChangeStart', function () {
185
+ const el = document.getElementById('app-react');
186
+ if (el) {
187
+ ReactDOM.unmountComponentAtNode(el);
188
+ }
189
+ });
190
+ $scope.$on('$destroy', function () {
191
+ stateChangeStart();
192
+ });
193
+ },
194
+ ],
195
+ });
211
196
  document.addEventListener('DOMContentLoaded', function () {
212
197
  const el = document.getElementById('react-toasts');
213
198
  if (el) {
@@ -221,3 +206,5 @@ document.addEventListener('DOMContentLoaded', function () {
221
206
  });
222
207
 
223
208
  export default AppDefault;
209
+
210
+ export { ReactExtension, ReactExtensionProps, ExtensionProvider, WindowJ, IfAppIsActivated, Model };
@@ -3,14 +3,16 @@ import { IntlProvider } from 'react-intl';
3
3
  import { Provider } from 'react-redux';
4
4
  import { JRCThemeProvider } from 'jamespot-react-components';
5
5
 
6
+ import JRCore from 'App';
7
+
6
8
  export type ExtensionProviderProps = {
7
9
  children: React.ReactNode;
8
10
  };
9
11
 
10
12
  export const ExtensionProvider = (props: ExtensionProviderProps) => {
11
- const store = J.react.store;
12
- const locale = J.react.locale ? J.react.locale : 'en';
13
- const messages = J.react.translation ? J.react.translation.get(locale) : {};
13
+ const store = JRCore.store;
14
+ const locale = JRCore.locale ? JRCore.locale : 'en';
15
+ const messages = JRCore.translation ? JRCore.translation.get(locale) : {};
14
16
  return (
15
17
  <Provider store={store}>
16
18
  <IntlProvider locale={locale} messages={messages}>
@@ -1,4 +1,5 @@
1
1
  import { useSelector } from 'react-redux';
2
+ import JRCore from 'App';
2
3
 
3
4
  export type IfAppIsActivatedProps = {
4
5
  dependency: string;
@@ -8,7 +9,7 @@ export type IfAppIsActivatedProps = {
8
9
  export const IfAppIsActivated = (props: IfAppIsActivatedProps) => {
9
10
  const { isDependencyActivated } = useSelector((state: any) => {
10
11
  return {
11
- isDependencyActivated: J.react.store.selectors.application.selectById(state, props.dependency),
12
+ isDependencyActivated: JRCore.store.selectors.application.selectById(state, props.dependency),
12
13
  };
13
14
  });
14
15
  return isDependencyActivated ? props.children : null;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+
3
+ export const NoMatch = () => {
4
+ return <div>404 Page not found</div>;
5
+ };
@@ -1,3 +1,2 @@
1
1
  export { ExtensionProviderProps } from './ExtensionProvider.component';
2
2
  export { IfAppIsActivatedProps } from './IfAppIsActivated.component';
3
- export { AppStateLoaderProps } from './AppStateLoader.component';
@@ -1,12 +1,14 @@
1
1
  import * as React from 'react';
2
+ import { FunctionComponent } from 'react';
2
3
  import { DisplayAttributesProps, RenderAttributeProps } from './types';
4
+ import JRCore from 'App';
3
5
 
4
6
  /***
5
7
  * Choose the component to render according to the type of the object
6
8
  */
7
9
  const RenderAttribute = (props: RenderAttributeProps) => {
8
10
  const { attribute } = props;
9
- const RenderComponent: React.FunctionComponent<RenderAttributeProps> = attribute.components.render;
11
+ const RenderComponent: FunctionComponent<RenderAttributeProps> = attribute.components.render;
10
12
  const WrapperComponent: React.FunctionComponent<any> = attribute.components.wrapper;
11
13
 
12
14
  return (
@@ -33,7 +35,7 @@ const RenderAttribute = (props: RenderAttributeProps) => {
33
35
  */
34
36
  export const DisplayAttributes = (props: DisplayAttributesProps) => {
35
37
  const { attributesName, object, componentsOverride } = props;
36
- const config = J.react.useDisplay(attributesName || [], object.type);
38
+ const config = JRCore.useDisplay(attributesName || [], object.type);
37
39
 
38
40
  return config.map((attributeProps) => {
39
41
  if (!attributeProps) return;
@@ -1,6 +1,5 @@
1
1
  import { RenderAttributeProps } from 'displayer/types';
2
2
  import * as React from 'react';
3
- import { JRCDateProps } from 'jamespot-react-components';
4
3
 
5
4
  export const DisplaySingleValue = (props: RenderAttributeProps) => {
6
5
  const { object, attribute } = props;
@@ -9,8 +8,3 @@ export const DisplaySingleValue = (props: RenderAttributeProps) => {
9
8
 
10
9
  return <ElementComponent>{object[attribute.accessor]}</ElementComponent>;
11
10
  };
12
-
13
- export const DisplayDate = ({ object, attribute }: RenderAttributeProps) => {
14
- const Date = J.react.registry.getLazyComponent<JRCDateProps>('Date');
15
- return <Date date={object[attribute.name]} />;
16
- };
@@ -1,231 +1,63 @@
1
1
  import { DisplayList } from 'displayer/components/DisplayList.component';
2
- import { DisplayDate, DisplaySingleValue } from 'displayer/components/DisplaySingleValue.component';
2
+ import { DisplaySingleValue } from 'displayer/components/DisplaySingleValue.component';
3
3
  import * as React from 'react';
4
- import {
5
- DisplayInputComponentProps,
6
- FieldConfiguration,
7
- WidgetCheckbox,
8
- WidgetOrientedlinks,
9
- WidgetUri,
10
- } from '../types';
11
- import jamespot from 'jamespot-user-api';
12
- import { Model } from '../../utils/types';
13
- import { useSelector } from 'react-redux';
14
- import { JRCAutocompleteProps, JRCInputCheckboxProps, JRCInputFieldProps } from 'jamespot-react-components';
4
+ import { FieldConfiguration } from '../types';
15
5
 
16
6
  const DefaultWrapper = ({ children }: { children: React.FunctionComponent<any> }) => <div>{children}</div>;
17
7
  const DefaultElement = ({ children }: { children: React.FunctionComponent<any> }) => <>{children}</>;
18
8
 
19
- const RadioInput =
20
- (checkboxMode: 'radio' | 'checkbox', options: Array<{ value: string; label: string }>) =>
21
- ({ widget, ...props }: DisplayInputComponentProps) => {
22
- const InputCheckbox = J.react.registry.getLazyComponent<JRCInputCheckboxProps<any>>('InputCheckbox');
23
-
24
- const direction = options.length > 3 ? 'column' : 'row';
25
-
26
- // {/* TODO multiple */}
27
- return (
28
- <>
29
- {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
30
- {/* @ts-ignore */}
31
- <InputCheckbox
32
- {...props}
33
- checkboxMode={checkboxMode}
34
- options={options}
35
- direction={direction}
36
- rules={{ required: props.mandatory }}
37
- />
38
- </>
39
- );
40
- };
41
-
42
- const LinkInput =
43
- (type = 'article') =>
44
- ({ widget, ...props }: DisplayInputComponentProps) => {
45
- const InputAutocomplete = J.react.registry.getLazyComponent<JRCAutocompleteProps<any>>('InputAutocomplete');
46
-
47
- // {/* TODO multiple */}
48
- // const multiple = (widget as WidgetOrientedlinks).params["jcomplete-multiple"] === "1"
49
- const required = props.mandatory;
50
- const model: Model<string> = useSelector((state: any) => J.react.store.selectors.model.selectById(state, type));
51
- const mainType = model?.mainType;
52
-
53
- if (!mainType) return <></>;
54
-
55
- const orientedLinksApis = {
56
- article: (inputValue: string) =>
57
- jamespot.article
58
- .list({
59
- type: (widget as WidgetOrientedlinks).params.supportedTypes[0],
60
- format: 'raw-view',
61
- query: inputValue,
62
- })
63
- .then((res: any) => {
64
- return res?.result?.data;
65
- }),
66
- user: (inputValue: string) =>
67
- jamespot.user
68
- .autocomplete(inputValue)
69
- .then((res: any) => res.map((jUser: any) => ({ ...jUser.record, id: jUser.id }))),
70
- };
71
-
72
- const autocomplete = (inputValue: string) =>
73
- Object.keys(orientedLinksApis).includes(mainType)
74
- ? orientedLinksApis[mainType as 'user' | 'article'](inputValue)
75
- : Promise.resolve([]);
76
-
77
- return (
78
- <InputAutocomplete
79
- label={props.label}
80
- description={props.description}
81
- name={props.name}
82
- control={props.control}
83
- rules={{ required }}
84
- searchable
85
- // multiple={multiple}
86
- asyncPromise={autocomplete}
87
- />
88
- );
89
- };
90
-
91
- const DefaultInput = (props: DisplayInputComponentProps) => {
92
- const InputText = J.react.registry.getLazyComponent<JRCInputFieldProps<any>>('InputText');
93
- return (
94
- <InputText
95
- label={props.label}
96
- description={props.description}
97
- name={props.name}
98
- control={props.control}
99
- rules={{ required: props.mandatory }}
100
- />
101
- );
102
- };
103
-
104
- export function formatDate<T extends string>(configuration: FieldConfiguration<T>) {
105
- return {
106
- ...configuration,
107
- accessor: configuration.name,
108
- components: {
109
- render: DisplayDate,
110
- wrapper: DefaultWrapper,
111
- element: DefaultElement,
112
- input: DefaultInput,
113
- },
114
- };
115
- }
116
-
117
9
  export function formatString<T extends string>(configuration: FieldConfiguration<T>) {
118
10
  return {
119
- ...configuration,
11
+ name: configuration.name,
12
+ label: configuration.label,
120
13
  accessor: configuration.name,
14
+ widget: configuration.widget,
121
15
  components: {
122
16
  render: DisplaySingleValue,
123
17
  wrapper: DefaultWrapper,
124
18
  element: DefaultElement,
125
- input: DefaultInput,
126
19
  },
127
20
  };
128
21
  }
129
22
 
130
23
  export function formatNumber<T extends string>(configuration: FieldConfiguration<T>) {
131
24
  return {
132
- ...configuration,
25
+ name: configuration.name,
26
+ label: configuration.label,
133
27
  accessor: configuration.name,
28
+ widget: configuration.widget,
134
29
  components: {
135
30
  render: DisplaySingleValue,
136
31
  wrapper: DefaultWrapper,
137
32
  element: DefaultElement,
138
- input: DefaultInput,
139
33
  },
140
34
  };
141
35
  }
142
36
 
143
37
  export function formatTaxonomy<T extends string>(configuration: FieldConfiguration<T>) {
144
38
  return {
145
- ...configuration,
146
- accessor: configuration.name,
147
- components: {
148
- render: DisplayList,
149
- wrapper: DefaultWrapper,
150
- element: DefaultElement,
151
- input: DefaultInput,
152
- },
153
- };
154
- }
155
-
156
- export function formatOrientedlinks<T extends string>(configuration: FieldConfiguration<T>) {
157
- return {
158
- ...configuration,
159
- accessor: configuration.name,
160
- components: {
161
- render: DisplayList,
162
- wrapper: DefaultWrapper,
163
- element: DefaultElement,
164
- input: LinkInput((configuration.widget as WidgetOrientedlinks).params.supportedTypes?.[0]),
165
- },
166
- };
167
- }
168
-
169
- export function formatUri<T extends string>(configuration: FieldConfiguration<T>) {
170
- return {
171
- ...configuration,
172
- accessor: configuration.name,
173
- components: {
174
- render: DisplayList,
175
- wrapper: DefaultWrapper,
176
- element: DefaultElement,
177
- input: LinkInput((configuration.widget as WidgetUri).params.type),
178
- },
179
- };
180
- }
181
-
182
- export function formatRadio<T extends string>(configuration: FieldConfiguration<T>) {
183
- return {
184
- ...configuration,
185
- accessor: configuration.name,
186
- components: {
187
- render: DisplayList,
188
- wrapper: DefaultWrapper,
189
- element: DefaultElement,
190
- input: RadioInput(
191
- 'radio',
192
- Object.entries((configuration.widget as WidgetCheckbox).options).map(([k, v]) => ({
193
- label: v,
194
- value: k,
195
- })),
196
- ),
197
- },
198
- };
199
- }
200
-
201
- export function formatCheckbox<T extends string>(configuration: FieldConfiguration<T>) {
202
- return {
203
- ...configuration,
39
+ name: configuration.name,
40
+ label: configuration.label,
204
41
  accessor: configuration.name,
42
+ widget: configuration.widget,
205
43
  components: {
206
44
  render: DisplayList,
207
45
  wrapper: DefaultWrapper,
208
46
  element: DefaultElement,
209
- input: RadioInput(
210
- 'checkbox',
211
- Object.entries((configuration.widget as WidgetCheckbox).options).map(([k, v]) => ({
212
- label: v,
213
- value: k,
214
- })),
215
- ),
216
47
  },
217
48
  };
218
49
  }
219
50
 
220
51
  export function formatDefault<T extends string>(configuration: FieldConfiguration<T>) {
221
52
  return {
222
- ...configuration,
53
+ name: configuration.name,
54
+ label: configuration.label,
223
55
  accessor: configuration.name,
56
+ widget: configuration.widget,
224
57
  components: {
225
58
  render: DisplaySingleValue,
226
59
  wrapper: DefaultWrapper,
227
60
  element: DefaultElement,
228
- input: DefaultInput,
229
61
  },
230
62
  };
231
63
  }
@@ -1,6 +1,3 @@
1
- import * as React from 'react';
2
- import { UseFormReset } from 'react-hook-form';
3
-
4
1
  export type JObject<T extends string> = Record<T, any> & {
5
2
  title: string;
6
3
  id: string;
@@ -14,7 +11,6 @@ export type Fields<T extends string> = ReadonlyArray<T>;
14
11
  export type WidgetText = { type: 'text' };
15
12
  export type WidgetNumber = { type: 'number' };
16
13
  export type WidgetDate = { type: 'date'; format: string };
17
- export type WidgetDatetime = { type: 'datetime' };
18
14
  export type WidgetSelect<U extends string = string> = {
19
15
  type: 'select';
20
16
  options: Record<U, string>;
@@ -23,73 +19,38 @@ export type WidgetSelect<U extends string = string> = {
23
19
  export type WidgetEmail = { type: 'email' };
24
20
  export type WidgetUrl = { type: 'url'; params: { target?: '_blank' } };
25
21
  export type WidgetRefUser = { type: 'refUser' };
26
- export type WidgetRadio = { type: 'radio'; options: Record<string, string> };
27
22
  export type WidgetCheckbox = { type: 'checkbox'; options: Record<string, string> };
28
23
  export type WidgetTaxonomy = { type: 'taxonomy'; params: { idTaxonomy: string } };
29
- export type WidgetOrientedlinks = {
30
- type: 'orientedlinks';
31
- params: {
32
- 'jcomplete-multiple': '0' | '1';
33
- showAdd: '0' | '1';
34
- supportedTypes: Array<string>;
35
- };
36
- };
37
- export type WidgetUri = {
38
- type: 'uri';
39
- params: {
40
- class: string;
41
- 'jcomplete-url': string;
42
- type: string;
43
- };
44
- };
45
24
 
46
25
  export type Widget =
47
26
  | WidgetText
48
27
  | WidgetNumber
49
28
  | WidgetDate
50
- | WidgetDatetime
51
29
  | WidgetSelect
52
30
  | WidgetEmail
53
31
  | WidgetUrl
54
32
  | WidgetRefUser
55
- | WidgetRadio
56
33
  | WidgetCheckbox
57
- | WidgetOrientedlinks
58
- | WidgetTaxonomy
59
- | WidgetUri;
34
+ | WidgetTaxonomy;
60
35
 
61
36
  export type FieldConfiguration<T extends string> = {
62
37
  label: string;
63
- description?: string;
64
38
  widget: Widget;
65
39
  name: T;
66
- mandatory: boolean;
67
40
  };
68
41
 
69
42
  export type Configuration<T extends string> = FieldConfiguration<T>;
70
43
 
71
- export type DisplayInputComponentProps = {
72
- control: any;
73
- label: string;
74
- description?: string;
75
- name: string;
76
- widget: Widget;
77
- mandatory: boolean;
78
- };
79
-
80
44
  export type DisplayElementComponent = {
81
45
  render: React.FunctionComponent<RenderAttributeProps>;
82
46
  wrapper: React.FunctionComponent<any>;
83
47
  element: React.FunctionComponent<any>;
84
- input: React.FunctionComponent<DisplayInputComponentProps>;
85
48
  };
86
49
 
87
50
  export type DisplayerElement = {
88
51
  name: string;
89
52
  label: string;
90
- description?: string;
91
53
  accessor: string;
92
- mandatory: boolean;
93
54
  widget: Widget;
94
55
  components: DisplayElementComponent;
95
56
  };
@@ -109,10 +70,6 @@ type DisplayAttributeComponentOverrideProps =
109
70
  | {
110
71
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
111
72
  element: React.FunctionComponent<any>;
112
- }
113
- | {
114
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
115
- input: React.FunctionComponent<any>;
116
73
  };
117
74
 
118
75
  export type DisplayAttributesProps = {
@@ -126,19 +83,4 @@ export type RenderAttributeProps = {
126
83
  attribute: DisplayerElement;
127
84
  };
128
85
 
129
- export type DisplayFormProps = {
130
- object: any;
131
- componentsOverride?: Record<string, DisplayAttributeComponentOverrideProps>;
132
- attributesName: string[];
133
- onSubmit: any;
134
- };
135
-
136
- export type DisplayFormRef = {
137
- reset: UseFormReset<any>;
138
- };
139
-
140
- export type RenderInputProps = DisplayerElement & {
141
- control: any;
142
- };
143
-
144
- export type Displayer = Array<DisplayerElement>;
86
+ export type Displayer = Array<DisplayerElement | undefined>;