@panneau/core 4.0.78 → 4.1.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/dist/contexts.d.ts +266 -168
- package/dist/contexts.js +46 -31
- package/dist/hooks.d.ts +78 -40
- package/dist/hooks.js +780 -338
- package/dist/index.d.ts +299 -201
- package/dist/index.js +23 -29
- package/dist/utils.d.ts +192 -15
- package/dist/utils.js +106 -31
- package/package.json +3 -3
package/dist/contexts.d.ts
CHANGED
|
@@ -1,39 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ElementType, ReactNode, ComponentType } from 'react';
|
|
3
|
-
import { MessageDescriptor } from 'react-intl';
|
|
2
|
+
import { ElementType, ReactNode, ComponentProps, MouseEvent, ComponentType } from 'react';
|
|
3
|
+
import { MessageDescriptor, FormattedMessage } from 'react-intl';
|
|
4
4
|
export { RoutesContext, RoutesProvider, useRoutes, useUrlGenerator } from '@folklore/routes';
|
|
5
5
|
export { TrackingContext } from '@folklore/tracking';
|
|
6
6
|
|
|
7
|
-
declare class ComponentsManager {
|
|
8
|
-
components: Record<string, ElementType>;
|
|
9
|
-
constructor(components?: Record<string, ElementType>);
|
|
10
|
-
addComponent(name: string, component: ElementType, namespace?: string | null): this;
|
|
11
|
-
addComponents(components: Record<string, ElementType>, namespace?: string | null): this;
|
|
12
|
-
merge(manager: ComponentsManager, namespace?: string | null): this;
|
|
13
|
-
addNamespace(namespace: string | null): this;
|
|
14
|
-
getComponent(name: string | ElementType, namespace?: string | null): ElementType | null;
|
|
15
|
-
getComponents(namespace?: string | null): Record<string, ElementType> | null;
|
|
16
|
-
hasComponent(name: string, namespace?: string | null): boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface Definition$1 {
|
|
20
|
-
id: string;
|
|
21
|
-
component?: unknown;
|
|
22
|
-
[key: string]: unknown;
|
|
23
|
-
}
|
|
24
|
-
declare class DefinitionsManager<T extends Definition$1 = Definition$1> {
|
|
25
|
-
definitions: T[];
|
|
26
|
-
constructor(definitions?: T[]);
|
|
27
|
-
addDefinition(definition: T | T[]): this;
|
|
28
|
-
addDefinitions(definitions: T[]): this;
|
|
29
|
-
merge(manager: DefinitionsManager<T>): this;
|
|
30
|
-
getDefinition(id: string | null): T | null;
|
|
31
|
-
getDefinitions(): T[];
|
|
32
|
-
hasDefinition(id: string): boolean;
|
|
33
|
-
getComponent(id: string): unknown;
|
|
34
|
-
getComponents(): Record<string, unknown>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
7
|
/**
|
|
38
8
|
* Core UI Types
|
|
39
9
|
*/
|
|
@@ -42,10 +12,40 @@ declare class DefinitionsManager<T extends Definition$1 = Definition$1> {
|
|
|
42
12
|
* Internationalization message definition
|
|
43
13
|
*/
|
|
44
14
|
type Message = MessageDescriptor;
|
|
15
|
+
/**
|
|
16
|
+
* Values that can be interpolated in an internationalization message
|
|
17
|
+
* (the `values` prop of FormattedMessage)
|
|
18
|
+
*/
|
|
19
|
+
type MessageValues = NonNullable<ComponentProps<typeof FormattedMessage>['values']>;
|
|
20
|
+
type MessageValue = MessageValues[string];
|
|
45
21
|
/**
|
|
46
22
|
* Label can be either a message object or any React node
|
|
47
23
|
*/
|
|
48
24
|
type Label = Message | ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Map of components, can be nested by namespace (ex: { fields: { text: TextField } })
|
|
27
|
+
*/
|
|
28
|
+
interface ComponentsMap {
|
|
29
|
+
[name: string]: ElementType | ComponentsMap;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Menu item definition
|
|
33
|
+
*/
|
|
34
|
+
interface MenuItem {
|
|
35
|
+
id?: number | string;
|
|
36
|
+
label?: Label;
|
|
37
|
+
url?: string;
|
|
38
|
+
href?: string | null;
|
|
39
|
+
external?: boolean;
|
|
40
|
+
active?: boolean;
|
|
41
|
+
type?: string;
|
|
42
|
+
component?: string;
|
|
43
|
+
className?: string | null;
|
|
44
|
+
linkClassName?: string | null;
|
|
45
|
+
onClick?: ((e: MouseEvent) => void) | null;
|
|
46
|
+
items?: MenuItem[] | null;
|
|
47
|
+
dropdown?: MenuItem[] | null;
|
|
48
|
+
}
|
|
49
49
|
/**
|
|
50
50
|
* Form control size
|
|
51
51
|
*/
|
|
@@ -59,7 +59,7 @@ interface Font {
|
|
|
59
59
|
/**
|
|
60
60
|
* Generic definition
|
|
61
61
|
*/
|
|
62
|
-
interface Definition {
|
|
62
|
+
interface Definition$1 {
|
|
63
63
|
id: string;
|
|
64
64
|
component?: string | ElementType;
|
|
65
65
|
[key: string]: unknown;
|
|
@@ -90,7 +90,7 @@ interface Field {
|
|
|
90
90
|
size?: ControlSize;
|
|
91
91
|
[key: string]: unknown;
|
|
92
92
|
}
|
|
93
|
-
interface FieldDefinition extends Omit<Field, 'component'>, Definition {
|
|
93
|
+
interface FieldDefinition extends Omit<Field, 'component'>, Definition$1 {
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* Form definition
|
|
@@ -103,110 +103,9 @@ interface Form {
|
|
|
103
103
|
submitButtonLabel?: Label | null;
|
|
104
104
|
[key: string]: unknown;
|
|
105
105
|
}
|
|
106
|
-
interface FormDefinition extends Form, Definition {
|
|
106
|
+
interface FormDefinition extends Form, Definition$1 {
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
declare class FieldsManager extends DefinitionsManager<FieldDefinition> {
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
declare class FormsManager extends DefinitionsManager<FormDefinition> {
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
declare const MODALS_NAMESPACE = "modals";
|
|
116
|
-
declare const FIELDS_NAMESPACE = "fields";
|
|
117
|
-
declare const FORMS_NAMESPACE = "forms";
|
|
118
|
-
declare const FILTERS_NAMESPACE = "filters";
|
|
119
|
-
declare const LISTS_NAMESPACE = "lists";
|
|
120
|
-
declare const DISPLAYS_NAMESPACE = "displays";
|
|
121
|
-
declare const ACTIONS_NAMESPACE = "actions";
|
|
122
|
-
declare const BUTTONS_NAMESPACE = "buttons";
|
|
123
|
-
declare const PAGES_NAMESPACE = "pages";
|
|
124
|
-
declare const PREVIEWS_NAMESPACE = "previews";
|
|
125
|
-
declare const APP_NAMESPACE = "app";
|
|
126
|
-
declare const ComponentsContext: react.Context<ComponentsManager>;
|
|
127
|
-
/**
|
|
128
|
-
* Hooks
|
|
129
|
-
*/
|
|
130
|
-
declare function useComponentsManager(namespace?: string | null): ComponentsManager;
|
|
131
|
-
declare function useComponents(namespace?: string | null, defaultComponents?: Record<string, ElementType>): Record<string, ElementType>;
|
|
132
|
-
declare function useComponent(name: string | ElementType | null, defaultComponent?: ElementType | null, namespace?: string | null): ElementType | null;
|
|
133
|
-
/**
|
|
134
|
-
* Fields hooks
|
|
135
|
-
*/
|
|
136
|
-
declare function useFieldsComponentsManager(): ComponentsManager;
|
|
137
|
-
declare function useFieldsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
138
|
-
declare function useFieldComponent(name: any, defaultComponent?: any): ElementType;
|
|
139
|
-
/**
|
|
140
|
-
* Forms hooks
|
|
141
|
-
*/
|
|
142
|
-
declare function useFormsComponentsManager(): ComponentsManager;
|
|
143
|
-
declare function useFormsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
144
|
-
declare function useFormComponent(name: any, defaultComponent?: any): ElementType;
|
|
145
|
-
/**
|
|
146
|
-
* Modals hooks
|
|
147
|
-
*/
|
|
148
|
-
declare function useModalsComponentsManager(): ComponentsManager;
|
|
149
|
-
declare function useModalsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
150
|
-
declare function useModalComponent(name: any, defaultComponent?: any): ElementType;
|
|
151
|
-
/**
|
|
152
|
-
* Filters hooks
|
|
153
|
-
*/
|
|
154
|
-
declare function useFiltersComponentsManager(): ComponentsManager;
|
|
155
|
-
declare function useFiltersComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
156
|
-
declare function useFilterComponent(name: any, defaultComponent?: any): ElementType;
|
|
157
|
-
/**
|
|
158
|
-
* Lists hooks
|
|
159
|
-
*/
|
|
160
|
-
declare function useListsComponentsManager(): ComponentsManager;
|
|
161
|
-
declare function useListsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
162
|
-
declare function useListComponent(name: any, defaultComponent?: any): ElementType;
|
|
163
|
-
/**
|
|
164
|
-
* Displays hooks
|
|
165
|
-
*/
|
|
166
|
-
declare function useDisplaysComponentsManager(): ComponentsManager;
|
|
167
|
-
declare function useDisplaysComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
168
|
-
declare function useDisplayComponent(name: any, defaultComponent?: any): ElementType;
|
|
169
|
-
/**
|
|
170
|
-
* Actions hooks
|
|
171
|
-
*/
|
|
172
|
-
declare function useActionsComponentsManager(): ComponentsManager;
|
|
173
|
-
declare function useActionsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
174
|
-
declare function useActionComponent(name: any, defaultComponent?: any): ElementType;
|
|
175
|
-
/**
|
|
176
|
-
* Buttons hooks
|
|
177
|
-
*/
|
|
178
|
-
declare function useButtonsComponentsManager(): ComponentsManager;
|
|
179
|
-
declare function useButtonsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
180
|
-
declare function useButtonComponent(name: any, defaultComponent?: any): ElementType;
|
|
181
|
-
/**
|
|
182
|
-
* Pages hooks
|
|
183
|
-
*/
|
|
184
|
-
declare function usePagesComponentsManager(): ComponentsManager;
|
|
185
|
-
declare function usePagesComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
186
|
-
declare function usePageComponent(name: any, defaultComponent?: any): ElementType;
|
|
187
|
-
/**
|
|
188
|
-
* Previews hooks
|
|
189
|
-
*/
|
|
190
|
-
declare function usePreviewsComponentsManager(): ComponentsManager;
|
|
191
|
-
declare function usePreviewsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
192
|
-
declare function usePreviewComponent(name: any, defaultComponent?: any): ElementType;
|
|
193
|
-
/**
|
|
194
|
-
* App hooks
|
|
195
|
-
*/
|
|
196
|
-
declare function useAppComponentsManager(): ComponentsManager;
|
|
197
|
-
declare function useAppComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
198
|
-
declare function useAppComponent(name: any, defaultComponent?: any): ElementType;
|
|
199
|
-
/**
|
|
200
|
-
* Provider
|
|
201
|
-
*/
|
|
202
|
-
interface ComponentsProviderProps {
|
|
203
|
-
children: ReactNode;
|
|
204
|
-
namespace?: string | null;
|
|
205
|
-
manager?: ComponentsManager | null;
|
|
206
|
-
components?: Record<string, ElementType>;
|
|
207
|
-
}
|
|
208
|
-
declare function ComponentsProvider({ components, manager, namespace, children, }: ComponentsProviderProps): react.JSX.Element;
|
|
209
|
-
|
|
210
109
|
/**
|
|
211
110
|
* Resource Types
|
|
212
111
|
* TypeScript interfaces for resources, items, users, media, and other entities
|
|
@@ -218,6 +117,7 @@ declare function ComponentsProvider({ components, manager, namespace, children,
|
|
|
218
117
|
type TableColumn = string | Column;
|
|
219
118
|
interface Column extends Record<string, unknown> {
|
|
220
119
|
id?: string | null;
|
|
120
|
+
name?: string | null;
|
|
221
121
|
label?: unknown;
|
|
222
122
|
path?: string;
|
|
223
123
|
valueKey?: string;
|
|
@@ -243,7 +143,7 @@ type ActionDefinition = string | Action;
|
|
|
243
143
|
interface ResourceIntlValues {
|
|
244
144
|
a_singular?: string;
|
|
245
145
|
a_plural?: string;
|
|
246
|
-
[key: string]:
|
|
146
|
+
[key: string]: MessageValue;
|
|
247
147
|
}
|
|
248
148
|
/**
|
|
249
149
|
* Internationalization configuration
|
|
@@ -262,6 +162,11 @@ interface ResourceIndex {
|
|
|
262
162
|
fields?: Field[];
|
|
263
163
|
[key: string]: unknown;
|
|
264
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Overrides of the built-in resource pages, ex: `{ show: { component: 'my-page' } }`.
|
|
167
|
+
* Used on a resource (`resource.pages`) and on the panneau definition (`definition.pages`),
|
|
168
|
+
* the resource taking precedence.
|
|
169
|
+
*/
|
|
265
170
|
interface ResourcePages {
|
|
266
171
|
index?: PageDefinition;
|
|
267
172
|
show?: PageDefinition;
|
|
@@ -269,15 +174,49 @@ interface ResourcePages {
|
|
|
269
174
|
edit?: PageDefinition;
|
|
270
175
|
delete?: PageDefinition;
|
|
271
176
|
duplicate?: PageDefinition;
|
|
177
|
+
/** @deprecated Legacy resource keys, use `index`, `show`, `create`, etc. */
|
|
178
|
+
resourceIndexPage?: PageDefinition;
|
|
179
|
+
resourceShowPage?: PageDefinition;
|
|
180
|
+
resourceCreatePage?: PageDefinition;
|
|
181
|
+
resourceEditPage?: PageDefinition;
|
|
182
|
+
resourceDeletePage?: PageDefinition;
|
|
183
|
+
resourceDuplicatePage?: PageDefinition;
|
|
184
|
+
/** @deprecated Legacy panneau keys, use `index`, `show`, `create`, etc. */
|
|
185
|
+
indexPage?: PageDefinition;
|
|
186
|
+
showPage?: PageDefinition;
|
|
187
|
+
createPage?: PageDefinition;
|
|
188
|
+
editPage?: PageDefinition;
|
|
189
|
+
deletePage?: PageDefinition;
|
|
190
|
+
duplicatePage?: PageDefinition;
|
|
272
191
|
[key: string]: PageDefinition | undefined;
|
|
273
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Form definition of a resource (the id is optional, the form is identified by its key)
|
|
195
|
+
*/
|
|
196
|
+
interface ResourceForm extends Form {
|
|
197
|
+
id?: string;
|
|
198
|
+
component?: string | ElementType;
|
|
199
|
+
}
|
|
274
200
|
interface ResourceForms {
|
|
275
|
-
default
|
|
276
|
-
create
|
|
277
|
-
edit
|
|
278
|
-
delete
|
|
279
|
-
|
|
280
|
-
|
|
201
|
+
default?: ResourceForm | null;
|
|
202
|
+
create?: ResourceForm | null;
|
|
203
|
+
edit?: ResourceForm | null;
|
|
204
|
+
delete?: ResourceForm | null;
|
|
205
|
+
duplicate?: ResourceForm | null;
|
|
206
|
+
modal?: ResourceForm | null;
|
|
207
|
+
[key: string]: ResourceForm | null | undefined;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Resource type (sub-type of a resource, ex: page types)
|
|
211
|
+
*/
|
|
212
|
+
interface ResourceType {
|
|
213
|
+
id?: string;
|
|
214
|
+
name?: string;
|
|
215
|
+
fields?: Field[];
|
|
216
|
+
settings?: {
|
|
217
|
+
canCreate?: boolean;
|
|
218
|
+
[key: string]: unknown;
|
|
219
|
+
};
|
|
281
220
|
}
|
|
282
221
|
interface Resource {
|
|
283
222
|
id: string;
|
|
@@ -289,6 +228,7 @@ interface Resource {
|
|
|
289
228
|
settings?: Record<string, unknown>;
|
|
290
229
|
extraRoutes?: RouteDefinition[];
|
|
291
230
|
pages?: ResourcePages;
|
|
231
|
+
types?: ResourceType[];
|
|
292
232
|
}
|
|
293
233
|
/**
|
|
294
234
|
* Filter definition
|
|
@@ -308,17 +248,17 @@ interface Filter {
|
|
|
308
248
|
* Panneau route configuration
|
|
309
249
|
*/
|
|
310
250
|
interface Routes {
|
|
311
|
-
'resources.index'
|
|
312
|
-
'resources.create'
|
|
313
|
-
'resources.store'
|
|
314
|
-
'resources.show'
|
|
315
|
-
'resources.edit'
|
|
316
|
-
'resources.update'
|
|
317
|
-
'resources.delete'
|
|
318
|
-
'resources.destroy'
|
|
319
|
-
'resources.duplicate'
|
|
320
|
-
'resources.clone'
|
|
321
|
-
'resources.restore'
|
|
251
|
+
'resources.index'?: RouteDefinition | string;
|
|
252
|
+
'resources.create'?: RouteDefinition | string;
|
|
253
|
+
'resources.store'?: RouteDefinition | string;
|
|
254
|
+
'resources.show'?: RouteDefinition | string;
|
|
255
|
+
'resources.edit'?: RouteDefinition | string;
|
|
256
|
+
'resources.update'?: RouteDefinition | string;
|
|
257
|
+
'resources.delete'?: RouteDefinition | string;
|
|
258
|
+
'resources.destroy'?: RouteDefinition | string;
|
|
259
|
+
'resources.duplicate'?: RouteDefinition | string;
|
|
260
|
+
'resources.clone'?: RouteDefinition | string;
|
|
261
|
+
'resources.restore'?: RouteDefinition | string;
|
|
322
262
|
[key: string]: RouteDefinition | string;
|
|
323
263
|
}
|
|
324
264
|
interface PanneauTheme {
|
|
@@ -338,6 +278,7 @@ interface PanneauIntl {
|
|
|
338
278
|
locale?: string;
|
|
339
279
|
locales?: string[];
|
|
340
280
|
messages?: Record<string, string>;
|
|
281
|
+
/** @deprecated Not used: set the values of each resource in `resources[].intl.values` */
|
|
341
282
|
values?: PanneauIntlValues;
|
|
342
283
|
}
|
|
343
284
|
interface PanneauPages extends ResourcePages {
|
|
@@ -346,6 +287,26 @@ interface PanneauPages extends ResourcePages {
|
|
|
346
287
|
account?: PageDefinition;
|
|
347
288
|
error?: PageDefinition;
|
|
348
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Menu item in a Panneau menu: a menu item definition or a special item id
|
|
292
|
+
* (ex: 'resources', 'account', 'separator')
|
|
293
|
+
*/
|
|
294
|
+
type PanneauMenuItem = MenuItem | string;
|
|
295
|
+
interface PanneauMenus {
|
|
296
|
+
main?: PanneauMenuItem[] | null;
|
|
297
|
+
guest?: PanneauMenuItem[] | null;
|
|
298
|
+
[key: string]: PanneauMenuItem[] | null | undefined;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Links shown on the login page: `true` for the default url, or the url of the page
|
|
302
|
+
*/
|
|
303
|
+
interface PanneauAuth {
|
|
304
|
+
/** "Forgot your password?" link (default url: /forgot-password) */
|
|
305
|
+
forgotPassword?: boolean | string;
|
|
306
|
+
/** "Create account" link (default url: /register) */
|
|
307
|
+
register?: boolean | string;
|
|
308
|
+
[key: string]: unknown;
|
|
309
|
+
}
|
|
349
310
|
/**
|
|
350
311
|
* Panneau definition (main configuration)
|
|
351
312
|
*/
|
|
@@ -356,20 +317,154 @@ interface PanneauDefinition {
|
|
|
356
317
|
pages?: PanneauPages;
|
|
357
318
|
intl?: PanneauIntl;
|
|
358
319
|
theme?: PanneauTheme;
|
|
320
|
+
/** @deprecated Not used: give the custom components to the `components` prop of the container */
|
|
359
321
|
components?: PanneauComponents;
|
|
360
322
|
settings?: Record<string, unknown>;
|
|
361
323
|
forms?: FormDefinition[];
|
|
362
324
|
fields?: FieldDefinition[];
|
|
325
|
+
menus?: PanneauMenus;
|
|
326
|
+
auth?: PanneauAuth;
|
|
363
327
|
}
|
|
364
328
|
/**
|
|
365
329
|
* Tracking variables
|
|
366
330
|
*/
|
|
367
331
|
type TrackingVariables = Record<string, unknown>;
|
|
368
332
|
|
|
369
|
-
declare
|
|
370
|
-
|
|
333
|
+
declare class ComponentsManager {
|
|
334
|
+
components: Record<string, ElementType>;
|
|
335
|
+
constructor(components?: ComponentsMap);
|
|
336
|
+
addComponent(name: string, component: ElementType, namespace?: string | null): this;
|
|
337
|
+
addComponents(components: Record<string, ElementType>, namespace?: string | null): this;
|
|
338
|
+
merge(manager: ComponentsManager, namespace?: string | null): this;
|
|
339
|
+
addNamespace(namespace: string | null): this;
|
|
340
|
+
getComponent(name: string | ElementType, namespace?: string | null): ElementType | null;
|
|
341
|
+
getComponents(namespace?: string | null): Record<string, ElementType> | null;
|
|
342
|
+
hasComponent(name: string, namespace?: string | null): boolean;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
interface Definition {
|
|
346
|
+
id: string;
|
|
347
|
+
component?: unknown;
|
|
348
|
+
[key: string]: unknown;
|
|
349
|
+
}
|
|
350
|
+
declare class DefinitionsManager<T extends Definition = Definition> {
|
|
351
|
+
definitions: T[];
|
|
352
|
+
constructor(definitions?: T[]);
|
|
353
|
+
addDefinition(definition: T | T[]): this;
|
|
354
|
+
addDefinitions(definitions: T[]): this;
|
|
355
|
+
merge(manager: DefinitionsManager<T>): this;
|
|
356
|
+
getDefinition(id: string | null): T | null;
|
|
357
|
+
getDefinitions(): T[];
|
|
358
|
+
hasDefinition(id: string): boolean;
|
|
359
|
+
getComponent(id: string): unknown;
|
|
360
|
+
getComponents(): Record<string, unknown>;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
declare class FieldsManager extends DefinitionsManager<FieldDefinition> {
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
declare class FormsManager extends DefinitionsManager<FormDefinition> {
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
declare const MODALS_NAMESPACE = "modals";
|
|
370
|
+
declare const FIELDS_NAMESPACE = "fields";
|
|
371
|
+
declare const FORMS_NAMESPACE = "forms";
|
|
372
|
+
declare const FILTERS_NAMESPACE = "filters";
|
|
373
|
+
declare const LISTS_NAMESPACE = "lists";
|
|
374
|
+
declare const DISPLAYS_NAMESPACE = "displays";
|
|
375
|
+
declare const ACTIONS_NAMESPACE = "actions";
|
|
376
|
+
declare const BUTTONS_NAMESPACE = "buttons";
|
|
377
|
+
declare const PAGES_NAMESPACE = "pages";
|
|
378
|
+
declare const PREVIEWS_NAMESPACE = "previews";
|
|
379
|
+
declare const APP_NAMESPACE = "app";
|
|
380
|
+
declare const ComponentsContext: react.Context<ComponentsManager>;
|
|
381
|
+
/**
|
|
382
|
+
* Hooks
|
|
383
|
+
*/
|
|
384
|
+
declare function useComponentsManager(namespace?: string | null): ComponentsManager;
|
|
385
|
+
declare function useComponents(namespace?: string | null, defaultComponents?: Record<string, ElementType>): Record<string, ElementType>;
|
|
386
|
+
declare function useComponent(name: string | ElementType | null, defaultComponent?: ElementType | null, namespace?: string | null): ElementType | null;
|
|
387
|
+
/**
|
|
388
|
+
* Fields hooks
|
|
389
|
+
*/
|
|
390
|
+
declare function useFieldsComponentsManager(): ComponentsManager;
|
|
391
|
+
declare function useFieldsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
392
|
+
declare function useFieldComponent(name: any, defaultComponent?: any): ElementType;
|
|
393
|
+
/**
|
|
394
|
+
* Forms hooks
|
|
395
|
+
*/
|
|
396
|
+
declare function useFormsComponentsManager(): ComponentsManager;
|
|
397
|
+
declare function useFormsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
398
|
+
declare function useFormComponent(name: any, defaultComponent?: any): ElementType;
|
|
399
|
+
/**
|
|
400
|
+
* Modals hooks
|
|
401
|
+
*/
|
|
402
|
+
declare function useModalsComponentsManager(): ComponentsManager;
|
|
403
|
+
declare function useModalsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
404
|
+
declare function useModalComponent(name: any, defaultComponent?: any): ElementType;
|
|
405
|
+
/**
|
|
406
|
+
* Filters hooks
|
|
407
|
+
*/
|
|
408
|
+
declare function useFiltersComponentsManager(): ComponentsManager;
|
|
409
|
+
declare function useFiltersComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
410
|
+
declare function useFilterComponent(name: any, defaultComponent?: any): ElementType;
|
|
411
|
+
/**
|
|
412
|
+
* Lists hooks
|
|
413
|
+
*/
|
|
414
|
+
declare function useListsComponentsManager(): ComponentsManager;
|
|
415
|
+
declare function useListsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
416
|
+
declare function useListComponent(name: any, defaultComponent?: any): ElementType;
|
|
417
|
+
/**
|
|
418
|
+
* Displays hooks
|
|
419
|
+
*/
|
|
420
|
+
declare function useDisplaysComponentsManager(): ComponentsManager;
|
|
421
|
+
declare function useDisplaysComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
422
|
+
declare function useDisplayComponent(name: any, defaultComponent?: any): ElementType;
|
|
423
|
+
/**
|
|
424
|
+
* Actions hooks
|
|
425
|
+
*/
|
|
426
|
+
declare function useActionsComponentsManager(): ComponentsManager;
|
|
427
|
+
declare function useActionsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
428
|
+
declare function useActionComponent(name: any, defaultComponent?: any): ElementType;
|
|
429
|
+
/**
|
|
430
|
+
* Buttons hooks
|
|
431
|
+
*/
|
|
432
|
+
declare function useButtonsComponentsManager(): ComponentsManager;
|
|
433
|
+
declare function useButtonsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
434
|
+
declare function useButtonComponent(name: any, defaultComponent?: any): ElementType;
|
|
435
|
+
/**
|
|
436
|
+
* Pages hooks
|
|
437
|
+
*/
|
|
438
|
+
declare function usePagesComponentsManager(): ComponentsManager;
|
|
439
|
+
declare function usePagesComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
440
|
+
declare function usePageComponent(name: any, defaultComponent?: any): ElementType;
|
|
441
|
+
/**
|
|
442
|
+
* Previews hooks
|
|
443
|
+
*/
|
|
444
|
+
declare function usePreviewsComponentsManager(): ComponentsManager;
|
|
445
|
+
declare function usePreviewsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
446
|
+
declare function usePreviewComponent(name: any, defaultComponent?: any): ElementType;
|
|
447
|
+
/**
|
|
448
|
+
* App hooks
|
|
449
|
+
*/
|
|
450
|
+
declare function useAppComponentsManager(): ComponentsManager;
|
|
451
|
+
declare function useAppComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
452
|
+
declare function useAppComponent(name: any, defaultComponent?: any): ElementType;
|
|
453
|
+
/**
|
|
454
|
+
* Provider
|
|
455
|
+
*/
|
|
456
|
+
interface ComponentsProviderProps {
|
|
457
|
+
children: ReactNode;
|
|
458
|
+
namespace?: string | null;
|
|
459
|
+
manager?: ComponentsManager | null;
|
|
460
|
+
components?: ComponentsMap;
|
|
461
|
+
}
|
|
462
|
+
declare function ComponentsProvider({ components, manager, namespace, children, }: ComponentsProviderProps): react.JSX.Element;
|
|
463
|
+
|
|
464
|
+
declare function useDefinitionContext(): Definition$1 | null;
|
|
465
|
+
declare function useDefinition(): Definition$1 | null;
|
|
371
466
|
interface DefinitionProviderProps {
|
|
372
|
-
definition: Definition;
|
|
467
|
+
definition: Definition$1;
|
|
373
468
|
children: ReactNode;
|
|
374
469
|
}
|
|
375
470
|
declare function DefinitionProvider({ definition, children }: DefinitionProviderProps): react.JSX.Element;
|
|
@@ -386,9 +481,9 @@ interface FieldsProviderProps {
|
|
|
386
481
|
declare function FieldsProvider({ fields, manager, children }: FieldsProviderProps): react.JSX.Element;
|
|
387
482
|
|
|
388
483
|
interface FontsContextValue {
|
|
389
|
-
systemFonts: Font[] | null;
|
|
390
|
-
googleFonts: Font[] | null;
|
|
391
|
-
customFonts: Font[] | null;
|
|
484
|
+
systemFonts: (Font | string)[] | null;
|
|
485
|
+
googleFonts: (Font | string)[] | null;
|
|
486
|
+
customFonts: (Font | string)[] | null;
|
|
392
487
|
setGoogleFonts?: ((fonts: Font[]) => void) | null;
|
|
393
488
|
}
|
|
394
489
|
declare const FontsContext: react.Context<FontsContextValue>;
|
|
@@ -485,10 +580,11 @@ interface ModalData {
|
|
|
485
580
|
withoutBackdrop?: boolean;
|
|
486
581
|
[key: string]: unknown;
|
|
487
582
|
}
|
|
583
|
+
type ModalContainer = Element | DocumentFragment;
|
|
488
584
|
interface ModalContextValue {
|
|
489
585
|
modals: ModalData[];
|
|
490
|
-
container:
|
|
491
|
-
setContainer: (container:
|
|
586
|
+
container: ModalContainer | null;
|
|
587
|
+
setContainer: (container: ModalContainer | null) => void;
|
|
492
588
|
register: (id: string, data?: Record<string, unknown> | null) => void;
|
|
493
589
|
unregister: (id?: string | null) => void;
|
|
494
590
|
closeModal: (id: string) => void;
|
|
@@ -499,7 +595,7 @@ declare const ModalContext: react.Context<ModalContextValue>;
|
|
|
499
595
|
declare function useModal(): ModalContextValue;
|
|
500
596
|
interface ModalProviderProps {
|
|
501
597
|
children: ReactNode;
|
|
502
|
-
container?:
|
|
598
|
+
container?: ModalContainer | null;
|
|
503
599
|
}
|
|
504
600
|
declare function ModalProvider({ children, container: initialContainer }: ModalProviderProps): react.JSX.Element;
|
|
505
601
|
|
|
@@ -531,13 +627,15 @@ declare function usePanneauResources(): Resource[];
|
|
|
531
627
|
declare function usePanneauResource(id: Resource | string | null): Resource | null;
|
|
532
628
|
declare function usePanneauColorScheme(): {
|
|
533
629
|
theme: string;
|
|
534
|
-
background:
|
|
535
|
-
text:
|
|
630
|
+
background: 'light' | 'dark' | null;
|
|
631
|
+
text: 'light' | 'dark' | null;
|
|
536
632
|
sidebarPosition?: string | null;
|
|
537
633
|
};
|
|
634
|
+
/** @deprecated The `components` key of the definition is not supported */
|
|
538
635
|
declare function usePanneauComponents(): Record<string, unknown>;
|
|
636
|
+
/** @deprecated The `components` key of the definition is not supported */
|
|
539
637
|
declare function usePanneauComponent(namespace: string | null, name: string): string | null;
|
|
540
|
-
declare function usePanneauAuth():
|
|
638
|
+
declare function usePanneauAuth(): PanneauAuth;
|
|
541
639
|
declare function usePanneauSettings(): Record<string, unknown>;
|
|
542
640
|
interface PanneauProviderProps {
|
|
543
641
|
definition: PanneauDefinition;
|
|
@@ -555,7 +653,7 @@ declare function ResourceProvider({ resource, children }: ResourceProviderProps)
|
|
|
555
653
|
declare function useRoutePush(): (route: string | {
|
|
556
654
|
pathname?: string | null;
|
|
557
655
|
search?: string | null;
|
|
558
|
-
}, data?: unknown, ...args: unknown[]) => void;
|
|
656
|
+
}, data?: Record<string, unknown> | null, ...args: unknown[]) => void;
|
|
559
657
|
declare function useRouteBack(): () => void;
|
|
560
658
|
|
|
561
659
|
declare function useTracking(): any;
|
|
@@ -566,4 +664,4 @@ interface TrackingProviderProps {
|
|
|
566
664
|
declare function TrackingProvider({ variables, children }: TrackingProviderProps): react.JSX.Element;
|
|
567
665
|
|
|
568
666
|
export { ACTIONS_NAMESPACE, APP_NAMESPACE, BUTTONS_NAMESPACE, ComponentsContext, ComponentsProvider, DISPLAYS_NAMESPACE, DefinitionProvider, FIELDS_NAMESPACE, FILTERS_NAMESPACE, FORMS_NAMESPACE, FieldsContext, FieldsProvider, FontsContext, FontsProvider, FormProvider, FormsContext, FormsProvider, GoogleApiClientContext, GoogleApiClientProvider, GoogleKeysContext, GoogleKeysProvider, GoogleMapsClientContext, GoogleMapsClientProvider, LISTS_NAMESPACE, LocalesContext, LocalesProvider, MODALS_NAMESPACE, ModalContext, ModalProvider, PAGES_NAMESPACE, PREVIEWS_NAMESPACE, PanelsContext, PanelsProvider, PanneauProvider, ResourceProvider, TrackingProvider, useActionComponent, useActionsComponents, useActionsComponentsManager, useAppComponent, useAppComponents, useAppComponentsManager, useButtonComponent, useButtonsComponents, useButtonsComponentsManager, useComponent, useComponents, useComponentsManager, useDefinition, useDefinitionContext, useDisplayComponent, useDisplaysComponents, useDisplaysComponentsManager, useFieldComponent, useFieldDefinition, useFieldDefinitions, useFieldsComponents, useFieldsComponentsManager, useFieldsManager, useFilterComponent, useFiltersComponents, useFiltersComponentsManager, useFonts, useFormComponent, useFormContext, useFormDefinition, useFormDefinitions, useFormSetValue, useFormValue, useFormsComponents, useFormsComponentsManager, useFormsManager, useGoogleApiClient, useGoogleFonts, useGoogleKeys, useGoogleMapsClient, useListComponent, useListsComponents, useListsComponentsManager, useLocales, useLocalesContext, useModal, useModalComponent, useModalsComponents, useModalsComponentsManager, useOtherLocales, usePageComponent, usePagesComponents, usePagesComponentsManager, usePanels, usePanneau, usePanneauAuth, usePanneauColorScheme, usePanneauComponent, usePanneauComponents, usePanneauResource, usePanneauResources, usePanneauSettings, usePreviewComponent, usePreviewsComponents, usePreviewsComponentsManager, useResource, useRouteBack, useRoutePush, useTracking, withGoogleApiClient, withGoogleMapsClient, withPanels };
|
|
569
|
-
export type { ModalContextValue, ModalData };
|
|
667
|
+
export type { ModalContainer, ModalContextValue, ModalData };
|