@panneau/core 4.0.38 → 4.0.40-alpha.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 +78 -34
- package/dist/contexts.js +1332 -621
- package/dist/hooks.d.ts +41 -0
- package/dist/hooks.js +1395 -847
- package/dist/index.d.ts +26 -9
- package/dist/index.js +485 -609
- package/dist/utils.d.ts +40 -6
- package/dist/utils.js +232 -354
- package/package.json +3 -3
package/dist/contexts.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode, ComponentType } from 'react';
|
|
3
|
+
import { ElementType, ReactNode, ComponentType } from 'react';
|
|
4
4
|
export { RoutesContext, RoutesProvider, useRoutes, useUrlGenerator } from '@folklore/routes';
|
|
5
5
|
export { TrackingContext } from '@folklore/tracking';
|
|
6
6
|
|
|
7
7
|
declare class ComponentsManager {
|
|
8
|
-
components: Record<string,
|
|
9
|
-
constructor(components?: Record<string,
|
|
10
|
-
addComponent(name: string, component:
|
|
11
|
-
addComponents(components: Record<string,
|
|
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
12
|
merge(manager: ComponentsManager, namespace?: string | null): this;
|
|
13
13
|
addNamespace(namespace: string | null): this;
|
|
14
|
-
getComponent(name: string, namespace?: string | null):
|
|
15
|
-
getComponents(namespace?: string | null): Record<string,
|
|
14
|
+
getComponent(name: string, namespace?: string | null): ElementType | null;
|
|
15
|
+
getComponents(namespace?: string | null): Record<string, ElementType> | null;
|
|
16
16
|
hasComponent(name: string, namespace?: string | null): boolean;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -53,74 +53,74 @@ declare const ComponentsContext: react.Context<ComponentsManager>;
|
|
|
53
53
|
* Hooks
|
|
54
54
|
*/
|
|
55
55
|
declare function useComponentsManager(namespace?: string | null): ComponentsManager;
|
|
56
|
-
declare function useComponents(namespace?: string | null, defaultComponents?: Record<string,
|
|
57
|
-
declare function useComponent(name:
|
|
56
|
+
declare function useComponents(namespace?: string | null, defaultComponents?: Record<string, ElementType>): Record<string, ElementType>;
|
|
57
|
+
declare function useComponent(name: string | ElementType | null, defaultComponent?: ElementType | null, namespace?: string | null): ElementType | null;
|
|
58
58
|
/**
|
|
59
59
|
* Fields hooks
|
|
60
60
|
*/
|
|
61
61
|
declare function useFieldsComponentsManager(): ComponentsManager;
|
|
62
|
-
declare function useFieldsComponents(defaultComponents?:
|
|
63
|
-
declare function useFieldComponent(name:
|
|
62
|
+
declare function useFieldsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
63
|
+
declare function useFieldComponent(name: any, defaultComponent?: any): ElementType;
|
|
64
64
|
/**
|
|
65
65
|
* Forms hooks
|
|
66
66
|
*/
|
|
67
67
|
declare function useFormsComponentsManager(): ComponentsManager;
|
|
68
|
-
declare function useFormsComponents(defaultComponents?:
|
|
69
|
-
declare function useFormComponent(name:
|
|
68
|
+
declare function useFormsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
69
|
+
declare function useFormComponent(name: any, defaultComponent?: any): ElementType;
|
|
70
70
|
/**
|
|
71
71
|
* Modals hooks
|
|
72
72
|
*/
|
|
73
73
|
declare function useModalsComponentsManager(): ComponentsManager;
|
|
74
|
-
declare function useModalsComponents(defaultComponents?:
|
|
75
|
-
declare function useModalComponent(name:
|
|
74
|
+
declare function useModalsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
75
|
+
declare function useModalComponent(name: any, defaultComponent?: any): ElementType;
|
|
76
76
|
/**
|
|
77
77
|
* Filters hooks
|
|
78
78
|
*/
|
|
79
79
|
declare function useFiltersComponentsManager(): ComponentsManager;
|
|
80
|
-
declare function useFiltersComponents(defaultComponents?:
|
|
81
|
-
declare function useFilterComponent(name:
|
|
80
|
+
declare function useFiltersComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
81
|
+
declare function useFilterComponent(name: any, defaultComponent?: any): ElementType;
|
|
82
82
|
/**
|
|
83
83
|
* Lists hooks
|
|
84
84
|
*/
|
|
85
85
|
declare function useListsComponentsManager(): ComponentsManager;
|
|
86
|
-
declare function useListsComponents(defaultComponents?:
|
|
87
|
-
declare function useListComponent(name:
|
|
86
|
+
declare function useListsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
87
|
+
declare function useListComponent(name: any, defaultComponent?: any): ElementType;
|
|
88
88
|
/**
|
|
89
89
|
* Displays hooks
|
|
90
90
|
*/
|
|
91
91
|
declare function useDisplaysComponentsManager(): ComponentsManager;
|
|
92
|
-
declare function useDisplaysComponents(defaultComponents?:
|
|
93
|
-
declare function useDisplayComponent(name:
|
|
92
|
+
declare function useDisplaysComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
93
|
+
declare function useDisplayComponent(name: any, defaultComponent?: any): ElementType;
|
|
94
94
|
/**
|
|
95
95
|
* Actions hooks
|
|
96
96
|
*/
|
|
97
97
|
declare function useActionsComponentsManager(): ComponentsManager;
|
|
98
|
-
declare function useActionsComponents(defaultComponents?:
|
|
99
|
-
declare function useActionComponent(name:
|
|
98
|
+
declare function useActionsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
99
|
+
declare function useActionComponent(name: any, defaultComponent?: any): ElementType;
|
|
100
100
|
/**
|
|
101
101
|
* Buttons hooks
|
|
102
102
|
*/
|
|
103
103
|
declare function useButtonsComponentsManager(): ComponentsManager;
|
|
104
|
-
declare function useButtonsComponents(defaultComponents?:
|
|
105
|
-
declare function useButtonComponent(name:
|
|
104
|
+
declare function useButtonsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
105
|
+
declare function useButtonComponent(name: any, defaultComponent?: any): ElementType;
|
|
106
106
|
/**
|
|
107
107
|
* Pages hooks
|
|
108
108
|
*/
|
|
109
109
|
declare function usePagesComponentsManager(): ComponentsManager;
|
|
110
|
-
declare function usePagesComponents(defaultComponents?:
|
|
111
|
-
declare function usePageComponent(name:
|
|
110
|
+
declare function usePagesComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
111
|
+
declare function usePageComponent(name: any, defaultComponent?: any): ElementType;
|
|
112
112
|
/**
|
|
113
113
|
* Previews hooks
|
|
114
114
|
*/
|
|
115
115
|
declare function usePreviewsComponentsManager(): ComponentsManager;
|
|
116
|
-
declare function usePreviewsComponents(defaultComponents?:
|
|
117
|
-
declare function usePreviewComponent(name:
|
|
116
|
+
declare function usePreviewsComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
117
|
+
declare function usePreviewComponent(name: any, defaultComponent?: any): ElementType;
|
|
118
118
|
/**
|
|
119
119
|
* App hooks
|
|
120
120
|
*/
|
|
121
121
|
declare function useAppComponentsManager(): ComponentsManager;
|
|
122
|
-
declare function useAppComponents(defaultComponents?:
|
|
123
|
-
declare function useAppComponent(name:
|
|
122
|
+
declare function useAppComponents(defaultComponents?: {}): Record<string, ElementType>;
|
|
123
|
+
declare function useAppComponent(name: any, defaultComponent?: any): ElementType;
|
|
124
124
|
/**
|
|
125
125
|
* Provider
|
|
126
126
|
*/
|
|
@@ -128,7 +128,7 @@ interface ComponentsProviderProps {
|
|
|
128
128
|
children: ReactNode;
|
|
129
129
|
namespace?: string | null;
|
|
130
130
|
manager?: ComponentsManager | null;
|
|
131
|
-
components?: Record<string,
|
|
131
|
+
components?: Record<string, ElementType>;
|
|
132
132
|
}
|
|
133
133
|
declare function ComponentsProvider({ components, manager, namespace, children, }: ComponentsProviderProps): react_jsx_runtime.JSX.Element;
|
|
134
134
|
|
|
@@ -161,12 +161,37 @@ interface Field {
|
|
|
161
161
|
component?: string;
|
|
162
162
|
label?: ReactNode;
|
|
163
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Table column definition
|
|
166
|
+
*/
|
|
167
|
+
type TableColumn = string | {
|
|
168
|
+
id?: string;
|
|
169
|
+
component?: string;
|
|
170
|
+
path?: string;
|
|
171
|
+
field?: string;
|
|
172
|
+
columnClassName?: string;
|
|
173
|
+
};
|
|
164
174
|
|
|
165
175
|
/**
|
|
166
176
|
* Resource Types
|
|
167
177
|
* TypeScript interfaces for resources, items, users, media, and other entities
|
|
168
178
|
*/
|
|
169
179
|
|
|
180
|
+
interface Action {
|
|
181
|
+
id?: string;
|
|
182
|
+
component?: string;
|
|
183
|
+
label?: string | null;
|
|
184
|
+
icon?: string | null;
|
|
185
|
+
href?: string | null;
|
|
186
|
+
external?: boolean;
|
|
187
|
+
theme?: string;
|
|
188
|
+
target?: string;
|
|
189
|
+
onClick?: (() => void) | null;
|
|
190
|
+
endpoint?: string | null;
|
|
191
|
+
withConfirmation?: boolean;
|
|
192
|
+
[key: string]: unknown;
|
|
193
|
+
}
|
|
194
|
+
type ActionDefinition = string | Action;
|
|
170
195
|
interface ResourceIntlValues {
|
|
171
196
|
a_singular?: string;
|
|
172
197
|
a_plural?: string;
|
|
@@ -182,15 +207,31 @@ interface ResourceIntl {
|
|
|
182
207
|
/**
|
|
183
208
|
* Resource definition
|
|
184
209
|
*/
|
|
210
|
+
interface ResourceIndex {
|
|
211
|
+
filters?: Filter[];
|
|
212
|
+
columns?: TableColumn[];
|
|
213
|
+
actions?: ActionDefinition[];
|
|
214
|
+
fields?: Field[];
|
|
215
|
+
[key: string]: unknown;
|
|
216
|
+
}
|
|
185
217
|
interface Resource {
|
|
186
218
|
id: string;
|
|
187
219
|
name: string;
|
|
188
220
|
intl?: ResourceIntl;
|
|
189
221
|
fields?: Field[];
|
|
222
|
+
index?: ResourceIndex;
|
|
190
223
|
forms?: Record<string, unknown>;
|
|
191
224
|
shows_in_navbar?: boolean;
|
|
192
225
|
settings?: Record<string, unknown>;
|
|
193
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Filter definition
|
|
229
|
+
*/
|
|
230
|
+
interface Filter {
|
|
231
|
+
id?: string;
|
|
232
|
+
component?: string;
|
|
233
|
+
[key: string]: unknown;
|
|
234
|
+
}
|
|
194
235
|
|
|
195
236
|
/**
|
|
196
237
|
* Panneau Definition Types
|
|
@@ -365,7 +406,8 @@ declare function LocalesProvider({ locales, children }: LocalesProviderProps): r
|
|
|
365
406
|
|
|
366
407
|
interface ModalData {
|
|
367
408
|
id: string;
|
|
368
|
-
|
|
409
|
+
requestClose?: (() => void) | null;
|
|
410
|
+
withoutBackdrop?: boolean;
|
|
369
411
|
[key: string]: unknown;
|
|
370
412
|
}
|
|
371
413
|
interface ModalContextValue {
|
|
@@ -374,6 +416,7 @@ interface ModalContextValue {
|
|
|
374
416
|
setContainer: (container: unknown) => void;
|
|
375
417
|
register: (id: string, data?: Record<string, unknown> | null) => void;
|
|
376
418
|
unregister: (id?: string | null) => void;
|
|
419
|
+
closeModal: (id: string) => void;
|
|
377
420
|
closeLastModal: () => void;
|
|
378
421
|
getModalById: (modalId: string) => ModalData | null;
|
|
379
422
|
}
|
|
@@ -410,7 +453,7 @@ declare function PanelsProvider({ children, container: initialContainer }: Panel
|
|
|
410
453
|
|
|
411
454
|
declare function usePanneau(): PanneauDefinition | null;
|
|
412
455
|
declare function usePanneauResources(): Resource[];
|
|
413
|
-
declare function usePanneauResource(id: string): Resource | null;
|
|
456
|
+
declare function usePanneauResource(id: Resource | string | null): Resource | null;
|
|
414
457
|
declare function usePanneauColorScheme(): {
|
|
415
458
|
theme: string;
|
|
416
459
|
background: string | null;
|
|
@@ -448,3 +491,4 @@ interface TrackingProviderProps {
|
|
|
448
491
|
declare function TrackingProvider({ variables, children }: TrackingProviderProps): react_jsx_runtime.JSX.Element;
|
|
449
492
|
|
|
450
493
|
export { ACTIONS_NAMESPACE, APP_NAMESPACE, BUTTONS_NAMESPACE, ComponentsContext, ComponentsProvider, DISPLAYS_NAMESPACE, DefinitionProvider, FIELDS_NAMESPACE, FILTERS_NAMESPACE, FORMS_NAMESPACE, FieldsContext, FieldsProvider, FontsContext, FontsProvider, FormProvider, 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, useField, useFieldComponent, useFields, useFieldsComponents, useFieldsComponentsManager, useFieldsManager, useFilterComponent, useFiltersComponents, useFiltersComponentsManager, useFonts, useFormComponent, useFormContext, useFormSetValue, useFormValue, useFormsComponents, useFormsComponentsManager, 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 };
|
|
494
|
+
export type { ModalContextValue, ModalData };
|