@panneau/core 4.0.73 → 4.0.75
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 +144 -77
- package/dist/contexts.js +113 -10
- package/dist/hooks.d.ts +68 -7
- package/dist/index.d.ts +233 -188
- package/dist/index.js +12 -8
- package/dist/utils.d.ts +55 -24
- package/dist/utils.js +3 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElementType, ReactNode, MouseEvent } from 'react';
|
|
2
2
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
3
|
-
import { Tracking as Tracking$1 } from '@folklore/tracking';
|
|
4
3
|
import { MessageDescriptor } from 'react-intl';
|
|
4
|
+
import { Tracking as Tracking$1 } from '@folklore/tracking';
|
|
5
5
|
|
|
6
6
|
declare class ComponentsManager {
|
|
7
7
|
components: Record<string, ElementType>;
|
|
@@ -10,7 +10,7 @@ declare class ComponentsManager {
|
|
|
10
10
|
addComponents(components: Record<string, ElementType>, namespace?: string | null): this;
|
|
11
11
|
merge(manager: ComponentsManager, namespace?: string | null): this;
|
|
12
12
|
addNamespace(namespace: string | null): this;
|
|
13
|
-
getComponent(name: string, namespace?: string | null): ElementType | null;
|
|
13
|
+
getComponent(name: string | ElementType, namespace?: string | null): ElementType | null;
|
|
14
14
|
getComponents(namespace?: string | null): Record<string, ElementType> | null;
|
|
15
15
|
hasComponent(name: string, namespace?: string | null): boolean;
|
|
16
16
|
}
|
|
@@ -20,14 +20,14 @@ interface Definition$1 {
|
|
|
20
20
|
component?: unknown;
|
|
21
21
|
[key: string]: unknown;
|
|
22
22
|
}
|
|
23
|
-
declare class DefinitionsManager {
|
|
24
|
-
definitions:
|
|
25
|
-
constructor(definitions?:
|
|
26
|
-
addDefinition(definition:
|
|
27
|
-
addDefinitions(definitions:
|
|
28
|
-
merge(manager: DefinitionsManager): this;
|
|
29
|
-
getDefinition(id: string | null):
|
|
30
|
-
getDefinitions():
|
|
23
|
+
declare class DefinitionsManager<T extends Definition$1 = Definition$1> {
|
|
24
|
+
definitions: T[];
|
|
25
|
+
constructor(definitions?: T[]);
|
|
26
|
+
addDefinition(definition: T | T[]): this;
|
|
27
|
+
addDefinitions(definitions: T[]): this;
|
|
28
|
+
merge(manager: DefinitionsManager<T>): this;
|
|
29
|
+
getDefinition(id: string | null): T | null;
|
|
30
|
+
getDefinitions(): T[];
|
|
31
31
|
hasDefinition(id: string): boolean;
|
|
32
32
|
getComponent(id: string): unknown;
|
|
33
33
|
getComponents(): Record<string, unknown>;
|
|
@@ -45,140 +45,6 @@ declare class EventsManager extends EventEmitter {
|
|
|
45
45
|
removeEventListener(event: string): void;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
declare class FieldsManager extends DefinitionsManager {
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
interface Manager$1 {
|
|
52
|
-
getDefinition: (type: string) => Record<string, unknown> | null;
|
|
53
|
-
}
|
|
54
|
-
interface FontsParserOptions {
|
|
55
|
-
fieldsManager: Manager$1;
|
|
56
|
-
screensManager: Manager$1;
|
|
57
|
-
}
|
|
58
|
-
interface Font$1 {
|
|
59
|
-
name?: string;
|
|
60
|
-
type?: string;
|
|
61
|
-
[key: string]: unknown;
|
|
62
|
-
}
|
|
63
|
-
interface Field$2 {
|
|
64
|
-
id?: string | null;
|
|
65
|
-
name?: string | null;
|
|
66
|
-
type?: string | null;
|
|
67
|
-
fields?: Field$2[];
|
|
68
|
-
itemsField?: Field$2 | null;
|
|
69
|
-
settings?: Field$2[];
|
|
70
|
-
[key: string]: unknown;
|
|
71
|
-
}
|
|
72
|
-
interface Screen$2 {
|
|
73
|
-
type: string;
|
|
74
|
-
[key: string]: unknown;
|
|
75
|
-
}
|
|
76
|
-
interface Story$1 {
|
|
77
|
-
theme?: Story$1 | null;
|
|
78
|
-
components?: Screen$2[];
|
|
79
|
-
fonts?: Font$1[];
|
|
80
|
-
[key: string]: unknown;
|
|
81
|
-
}
|
|
82
|
-
declare class FontsParser {
|
|
83
|
-
fieldsManager: Manager$1;
|
|
84
|
-
screensManager: Manager$1;
|
|
85
|
-
constructor({ fieldsManager, screensManager }: FontsParserOptions);
|
|
86
|
-
parse(story: Story$1 | null): Story$1 | null;
|
|
87
|
-
getFieldsPattern(fields: Field$2[], namePrefix?: string | null): RegExp[];
|
|
88
|
-
static fieldIsFontFamily({ id }: Field$2): boolean;
|
|
89
|
-
static valueIsFont({ type }: Record<string, unknown>): boolean;
|
|
90
|
-
static extractFontsWithPaths(data: unknown, patterns: RegExp[], keyPrefix?: string | null): Font$1[];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
declare class FormsManager extends ComponentsManager {
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
interface Manager {
|
|
97
|
-
getDefinition: (type: string) => Record<string, unknown> | null;
|
|
98
|
-
}
|
|
99
|
-
interface MediasParserOptions {
|
|
100
|
-
fieldsManager: Manager;
|
|
101
|
-
screensManager: Manager;
|
|
102
|
-
}
|
|
103
|
-
interface Media$2 {
|
|
104
|
-
id?: string | null;
|
|
105
|
-
[key: string]: unknown;
|
|
106
|
-
}
|
|
107
|
-
interface Field$1 {
|
|
108
|
-
id?: string | null;
|
|
109
|
-
name?: string | null;
|
|
110
|
-
type?: string | null;
|
|
111
|
-
media?: boolean;
|
|
112
|
-
fields?: Field$1[];
|
|
113
|
-
itemsField?: Field$1 | null;
|
|
114
|
-
settings?: Field$1[];
|
|
115
|
-
[key: string]: unknown;
|
|
116
|
-
}
|
|
117
|
-
interface Screen$1 {
|
|
118
|
-
type: string;
|
|
119
|
-
[key: string]: unknown;
|
|
120
|
-
}
|
|
121
|
-
interface Story {
|
|
122
|
-
theme?: Story | null;
|
|
123
|
-
components?: Screen$1[];
|
|
124
|
-
medias?: Record<string, Media$2> | null;
|
|
125
|
-
[key: string]: unknown;
|
|
126
|
-
}
|
|
127
|
-
declare class MediasParser {
|
|
128
|
-
fieldsManager: Manager;
|
|
129
|
-
screensManager: Manager;
|
|
130
|
-
constructor({ fieldsManager, screensManager }: MediasParserOptions);
|
|
131
|
-
toPath(story: Story | null): Story | null;
|
|
132
|
-
fromPath(story: Story | null, defaultMedias?: Record<string, Media$2> | null): Story | null;
|
|
133
|
-
getMediaFieldsPattern(fields: Field$1[], namePrefix?: string | null): RegExp[];
|
|
134
|
-
static fieldIsMedia({ media }: Field$1): boolean;
|
|
135
|
-
static fieldIsFontFamily({ id }: Field$1): boolean;
|
|
136
|
-
static replacePathsWithMedias(data: unknown, medias: Record<string, Media$2>, patterns: RegExp[], keyPrefix?: string | null): unknown;
|
|
137
|
-
static getMediaPath({ id }: Media$2): string | null;
|
|
138
|
-
static replaceMediasWithPaths(data: unknown, patterns: RegExp[], medias?: Record<string, Media$2> | null, keyPrefix?: string | null): {
|
|
139
|
-
data: unknown;
|
|
140
|
-
medias: Record<string, Media$2> | null;
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
interface TrackingOptions {
|
|
145
|
-
variables?: Record<string, unknown> | null;
|
|
146
|
-
[key: string]: unknown;
|
|
147
|
-
}
|
|
148
|
-
interface Screen {
|
|
149
|
-
id?: string | null;
|
|
150
|
-
type?: string | null;
|
|
151
|
-
[key: string]: unknown;
|
|
152
|
-
}
|
|
153
|
-
interface Media$1 {
|
|
154
|
-
id?: string | null;
|
|
155
|
-
name?: string | null;
|
|
156
|
-
duration?: number | null;
|
|
157
|
-
currentTime?: number | null;
|
|
158
|
-
[key: string]: unknown;
|
|
159
|
-
}
|
|
160
|
-
interface TrackingEventOptions {
|
|
161
|
-
value?: number | null;
|
|
162
|
-
[key: string]: unknown;
|
|
163
|
-
}
|
|
164
|
-
declare class Tracking extends Tracking$1 {
|
|
165
|
-
variables: Record<string, unknown> | null;
|
|
166
|
-
constructor(opts?: TrackingOptions);
|
|
167
|
-
setVariables(variables: Record<string, unknown> | null): void;
|
|
168
|
-
getVariables(): Record<string, unknown> | null;
|
|
169
|
-
trackScreenView(screen: Screen | null, screenIndex: number): void;
|
|
170
|
-
trackEvent(category: string, action: string, label: string, { value, ...opts }?: TrackingEventOptions): void;
|
|
171
|
-
trackMedia(type: string, media: Media$1 | null, action: string, { value, ...opts }?: TrackingEventOptions): void;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* User definition
|
|
176
|
-
*/
|
|
177
|
-
interface User {
|
|
178
|
-
id?: number | string;
|
|
179
|
-
[key: string]: unknown;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
48
|
/**
|
|
183
49
|
* Core UI Types
|
|
184
50
|
*/
|
|
@@ -186,10 +52,7 @@ interface User {
|
|
|
186
52
|
/**
|
|
187
53
|
* Internationalization message definition
|
|
188
54
|
*/
|
|
189
|
-
|
|
190
|
-
id: string;
|
|
191
|
-
defaultMessage?: string;
|
|
192
|
-
}
|
|
55
|
+
type Message = MessageDescriptor;
|
|
193
56
|
/**
|
|
194
57
|
* Label can be either a message object or any React node
|
|
195
58
|
*/
|
|
@@ -231,10 +94,14 @@ interface Button {
|
|
|
231
94
|
* Button theme variants (Bootstrap 5)
|
|
232
95
|
*/
|
|
233
96
|
type ButtonTheme = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark' | null;
|
|
97
|
+
/**
|
|
98
|
+
* Breakpoints size variants
|
|
99
|
+
*/
|
|
100
|
+
type BreakpointsSize = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | null;
|
|
234
101
|
/**
|
|
235
102
|
* Button size variants
|
|
236
103
|
*/
|
|
237
|
-
type ButtonSize = 'lg' | '
|
|
104
|
+
type ButtonSize = 'lg' | 'sm' | null;
|
|
238
105
|
/**
|
|
239
106
|
* Button type attribute
|
|
240
107
|
*/
|
|
@@ -247,6 +114,10 @@ type DropdownAlign = 'start' | 'end';
|
|
|
247
114
|
* Form control size
|
|
248
115
|
*/
|
|
249
116
|
type ControlSize = 'lg' | 'sm' | null;
|
|
117
|
+
/**
|
|
118
|
+
* Dialog size
|
|
119
|
+
*/
|
|
120
|
+
type DialogSize = 'xl' | 'lg' | 'sm' | null;
|
|
250
121
|
/**
|
|
251
122
|
* Form status states
|
|
252
123
|
*/
|
|
@@ -277,7 +148,7 @@ interface Breadcrumb {
|
|
|
277
148
|
/**
|
|
278
149
|
* Font definition
|
|
279
150
|
*/
|
|
280
|
-
interface Font {
|
|
151
|
+
interface Font$1 {
|
|
281
152
|
name: string;
|
|
282
153
|
}
|
|
283
154
|
/**
|
|
@@ -297,6 +168,23 @@ interface Item {
|
|
|
297
168
|
id: string;
|
|
298
169
|
[key: string]: unknown;
|
|
299
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Generic definition
|
|
173
|
+
*/
|
|
174
|
+
interface Definition {
|
|
175
|
+
id: string;
|
|
176
|
+
component?: string | ElementType;
|
|
177
|
+
[key: string]: unknown;
|
|
178
|
+
}
|
|
179
|
+
interface RouteDefinition {
|
|
180
|
+
path?: string;
|
|
181
|
+
route?: string;
|
|
182
|
+
component: string | ElementType;
|
|
183
|
+
[key: string]: unknown;
|
|
184
|
+
}
|
|
185
|
+
interface PageDefinition {
|
|
186
|
+
component: string | ElementType;
|
|
187
|
+
}
|
|
300
188
|
|
|
301
189
|
/**
|
|
302
190
|
* Form Types
|
|
@@ -320,18 +208,162 @@ type SelectOption = string | number | {
|
|
|
320
208
|
/**
|
|
321
209
|
* Field definition
|
|
322
210
|
*/
|
|
323
|
-
interface Field {
|
|
211
|
+
interface Field$2 {
|
|
324
212
|
name?: string;
|
|
325
213
|
type?: string;
|
|
326
|
-
|
|
327
|
-
|
|
214
|
+
label?: Label;
|
|
215
|
+
component?: string;
|
|
216
|
+
size?: ControlSize;
|
|
217
|
+
[key: string]: unknown;
|
|
218
|
+
}
|
|
219
|
+
interface FieldDefinition extends Omit<Field$2, 'component'>, Definition {
|
|
328
220
|
}
|
|
329
221
|
/**
|
|
330
222
|
* Form definition
|
|
331
223
|
*/
|
|
332
224
|
interface Form {
|
|
333
|
-
title
|
|
225
|
+
title?: ReactNode;
|
|
226
|
+
fields?: Field$2[];
|
|
227
|
+
method?: string | null;
|
|
228
|
+
action?: string | null;
|
|
229
|
+
submitButtonLabel?: Label | null;
|
|
230
|
+
[key: string]: unknown;
|
|
231
|
+
}
|
|
232
|
+
interface FormDefinition extends Form, Definition {
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
declare class FieldsManager extends DefinitionsManager<FieldDefinition> {
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
interface Manager$1 {
|
|
239
|
+
getDefinition: (type: string) => Record<string, unknown> | null;
|
|
240
|
+
}
|
|
241
|
+
interface FontsParserOptions {
|
|
242
|
+
fieldsManager: Manager$1;
|
|
243
|
+
screensManager: Manager$1;
|
|
244
|
+
}
|
|
245
|
+
interface Font {
|
|
246
|
+
name?: string;
|
|
247
|
+
type?: string;
|
|
248
|
+
[key: string]: unknown;
|
|
249
|
+
}
|
|
250
|
+
interface Field$1 {
|
|
251
|
+
id?: string | null;
|
|
252
|
+
name?: string | null;
|
|
253
|
+
type?: string | null;
|
|
254
|
+
fields?: Field$1[];
|
|
255
|
+
itemsField?: Field$1 | null;
|
|
256
|
+
settings?: Field$1[];
|
|
257
|
+
[key: string]: unknown;
|
|
258
|
+
}
|
|
259
|
+
interface Screen$2 {
|
|
260
|
+
type: string;
|
|
261
|
+
[key: string]: unknown;
|
|
262
|
+
}
|
|
263
|
+
interface Story$1 {
|
|
264
|
+
theme?: Story$1 | null;
|
|
265
|
+
components?: Screen$2[];
|
|
266
|
+
fonts?: Font[];
|
|
267
|
+
[key: string]: unknown;
|
|
268
|
+
}
|
|
269
|
+
declare class FontsParser {
|
|
270
|
+
fieldsManager: Manager$1;
|
|
271
|
+
screensManager: Manager$1;
|
|
272
|
+
constructor({ fieldsManager, screensManager }: FontsParserOptions);
|
|
273
|
+
parse(story: Story$1 | null): Story$1 | null;
|
|
274
|
+
getFieldsPattern(fields: Field$1[], namePrefix?: string | null): RegExp[];
|
|
275
|
+
static fieldIsFontFamily({ id }: Field$1): boolean;
|
|
276
|
+
static valueIsFont({ type }: Record<string, unknown>): boolean;
|
|
277
|
+
static extractFontsWithPaths(data: unknown, patterns: RegExp[], keyPrefix?: string | null): Font[];
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
declare class FormsManager extends DefinitionsManager<FormDefinition> {
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
interface Manager {
|
|
284
|
+
getDefinition: (type: string) => Record<string, unknown> | null;
|
|
285
|
+
}
|
|
286
|
+
interface MediasParserOptions {
|
|
287
|
+
fieldsManager: Manager;
|
|
288
|
+
screensManager: Manager;
|
|
289
|
+
}
|
|
290
|
+
interface Media$2 {
|
|
291
|
+
id?: string | null;
|
|
292
|
+
[key: string]: unknown;
|
|
293
|
+
}
|
|
294
|
+
interface Field {
|
|
295
|
+
id?: string | null;
|
|
296
|
+
name?: string | null;
|
|
297
|
+
type?: string | null;
|
|
298
|
+
media?: boolean;
|
|
334
299
|
fields?: Field[];
|
|
300
|
+
itemsField?: Field | null;
|
|
301
|
+
settings?: Field[];
|
|
302
|
+
[key: string]: unknown;
|
|
303
|
+
}
|
|
304
|
+
interface Screen$1 {
|
|
305
|
+
type: string;
|
|
306
|
+
[key: string]: unknown;
|
|
307
|
+
}
|
|
308
|
+
interface Story {
|
|
309
|
+
theme?: Story | null;
|
|
310
|
+
components?: Screen$1[];
|
|
311
|
+
medias?: Record<string, Media$2> | null;
|
|
312
|
+
[key: string]: unknown;
|
|
313
|
+
}
|
|
314
|
+
declare class MediasParser {
|
|
315
|
+
fieldsManager: Manager;
|
|
316
|
+
screensManager: Manager;
|
|
317
|
+
constructor({ fieldsManager, screensManager }: MediasParserOptions);
|
|
318
|
+
toPath(story: Story | null): Story | null;
|
|
319
|
+
fromPath(story: Story | null, defaultMedias?: Record<string, Media$2> | null): Story | null;
|
|
320
|
+
getMediaFieldsPattern(fields: Field[], namePrefix?: string | null): RegExp[];
|
|
321
|
+
static fieldIsMedia({ media }: Field): boolean;
|
|
322
|
+
static fieldIsFontFamily({ id }: Field): boolean;
|
|
323
|
+
static replacePathsWithMedias(data: unknown, medias: Record<string, Media$2>, patterns: RegExp[], keyPrefix?: string | null): unknown;
|
|
324
|
+
static getMediaPath({ id }: Media$2): string | null;
|
|
325
|
+
static replaceMediasWithPaths(data: unknown, patterns: RegExp[], medias?: Record<string, Media$2> | null, keyPrefix?: string | null): {
|
|
326
|
+
data: unknown;
|
|
327
|
+
medias: Record<string, Media$2> | null;
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
interface TrackingOptions {
|
|
332
|
+
variables?: Record<string, unknown> | null;
|
|
333
|
+
[key: string]: unknown;
|
|
334
|
+
}
|
|
335
|
+
interface Screen {
|
|
336
|
+
id?: string | null;
|
|
337
|
+
type?: string | null;
|
|
338
|
+
[key: string]: unknown;
|
|
339
|
+
}
|
|
340
|
+
interface Media$1 {
|
|
341
|
+
id?: string | null;
|
|
342
|
+
name?: string | null;
|
|
343
|
+
duration?: number | null;
|
|
344
|
+
currentTime?: number | null;
|
|
345
|
+
[key: string]: unknown;
|
|
346
|
+
}
|
|
347
|
+
interface TrackingEventOptions {
|
|
348
|
+
value?: number | null;
|
|
349
|
+
[key: string]: unknown;
|
|
350
|
+
}
|
|
351
|
+
declare class Tracking extends Tracking$1 {
|
|
352
|
+
variables: Record<string, unknown> | null;
|
|
353
|
+
constructor(opts?: TrackingOptions);
|
|
354
|
+
setVariables(variables: Record<string, unknown> | null): void;
|
|
355
|
+
getVariables(): Record<string, unknown> | null;
|
|
356
|
+
trackScreenView(screen: Screen | null, screenIndex: number): void;
|
|
357
|
+
trackEvent(category: string, action: string, label: string, { value, ...opts }?: TrackingEventOptions): void;
|
|
358
|
+
trackMedia(type: string, media: Media$1 | null, action: string, { value, ...opts }?: TrackingEventOptions): void;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* User definition
|
|
363
|
+
*/
|
|
364
|
+
interface User {
|
|
365
|
+
id?: number | string;
|
|
366
|
+
[key: string]: unknown;
|
|
335
367
|
}
|
|
336
368
|
|
|
337
369
|
type MediaType = 'audio' | 'image' | 'video' | 'document' | 'font';
|
|
@@ -383,7 +415,7 @@ interface Column extends Record<string, unknown> {
|
|
|
383
415
|
path?: string;
|
|
384
416
|
valueKey?: string;
|
|
385
417
|
component?: string | ElementType | null;
|
|
386
|
-
field?: Field | string | null;
|
|
418
|
+
field?: Field$2 | string | null;
|
|
387
419
|
actions?: ActionDefinition[] | null;
|
|
388
420
|
}
|
|
389
421
|
interface Action {
|
|
@@ -397,7 +429,7 @@ interface Action {
|
|
|
397
429
|
target?: string;
|
|
398
430
|
onClick?: (() => void) | null;
|
|
399
431
|
endpoint?: string | null;
|
|
400
|
-
|
|
432
|
+
withoutConfirmation?: boolean;
|
|
401
433
|
[key: string]: unknown;
|
|
402
434
|
}
|
|
403
435
|
type ActionDefinition = string | Action;
|
|
@@ -421,18 +453,36 @@ interface ResourceIndex {
|
|
|
421
453
|
filters?: Filter[];
|
|
422
454
|
columns?: TableColumn[];
|
|
423
455
|
actions?: ActionDefinition[];
|
|
424
|
-
fields?: Field[];
|
|
456
|
+
fields?: Field$2[];
|
|
425
457
|
[key: string]: unknown;
|
|
426
458
|
}
|
|
459
|
+
interface ResourcePages {
|
|
460
|
+
index?: PageDefinition;
|
|
461
|
+
show?: PageDefinition;
|
|
462
|
+
create?: PageDefinition;
|
|
463
|
+
edit?: PageDefinition;
|
|
464
|
+
delete?: PageDefinition;
|
|
465
|
+
duplicate?: PageDefinition;
|
|
466
|
+
[key: string]: PageDefinition | undefined;
|
|
467
|
+
}
|
|
468
|
+
interface ResourceForms {
|
|
469
|
+
default: FormDefinition | null;
|
|
470
|
+
create: FormDefinition | null;
|
|
471
|
+
edit: FormDefinition | null;
|
|
472
|
+
delete: FormDefinition | null;
|
|
473
|
+
modal: FormDefinition | null;
|
|
474
|
+
[key: string]: FormDefinition | null;
|
|
475
|
+
}
|
|
427
476
|
interface Resource {
|
|
428
477
|
id: string;
|
|
429
478
|
name: string;
|
|
430
479
|
intl?: ResourceIntl;
|
|
431
|
-
fields?: Field[];
|
|
480
|
+
fields?: Field$2[];
|
|
432
481
|
index?: ResourceIndex;
|
|
433
|
-
forms?:
|
|
434
|
-
shows_in_navbar?: boolean;
|
|
482
|
+
forms?: ResourceForms;
|
|
435
483
|
settings?: Record<string, unknown>;
|
|
484
|
+
extraRoutes?: RouteDefinition[];
|
|
485
|
+
pages?: ResourcePages;
|
|
436
486
|
}
|
|
437
487
|
interface ResourceItem extends Item {
|
|
438
488
|
type?: string;
|
|
@@ -482,25 +532,18 @@ interface uppy {
|
|
|
482
532
|
* Panneau route configuration
|
|
483
533
|
*/
|
|
484
534
|
interface Routes {
|
|
485
|
-
'resources.index': string;
|
|
486
|
-
'resources.create': string;
|
|
487
|
-
'resources.store': string;
|
|
488
|
-
'resources.show': string;
|
|
489
|
-
'resources.edit': string;
|
|
490
|
-
'resources.update': string;
|
|
491
|
-
'resources.delete': string;
|
|
492
|
-
'resources.destroy': string;
|
|
493
|
-
'resources.duplicate': string;
|
|
494
|
-
'resources.clone': string;
|
|
495
|
-
'resources.restore': string;
|
|
496
|
-
[key: string]: string;
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* Page definition
|
|
500
|
-
*/
|
|
501
|
-
interface Page {
|
|
502
|
-
component: string;
|
|
503
|
-
[key: string]: unknown;
|
|
535
|
+
'resources.index': RouteDefinition | string;
|
|
536
|
+
'resources.create': RouteDefinition | string;
|
|
537
|
+
'resources.store': RouteDefinition | string;
|
|
538
|
+
'resources.show': RouteDefinition | string;
|
|
539
|
+
'resources.edit': RouteDefinition | string;
|
|
540
|
+
'resources.update': RouteDefinition | string;
|
|
541
|
+
'resources.delete': RouteDefinition | string;
|
|
542
|
+
'resources.destroy': RouteDefinition | string;
|
|
543
|
+
'resources.duplicate': RouteDefinition | string;
|
|
544
|
+
'resources.clone': RouteDefinition | string;
|
|
545
|
+
'resources.restore': RouteDefinition | string;
|
|
546
|
+
[key: string]: RouteDefinition | string;
|
|
504
547
|
}
|
|
505
548
|
interface PanneauTheme {
|
|
506
549
|
colorScheme?: string | null;
|
|
@@ -521,24 +564,26 @@ interface PanneauIntl {
|
|
|
521
564
|
messages?: Record<string, string>;
|
|
522
565
|
values?: PanneauIntlValues;
|
|
523
566
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
[key: string]: unknown;
|
|
567
|
+
interface PanneauPages extends ResourcePages {
|
|
568
|
+
home?: PageDefinition;
|
|
569
|
+
login?: PageDefinition;
|
|
570
|
+
account?: PageDefinition;
|
|
571
|
+
error?: PageDefinition;
|
|
530
572
|
}
|
|
531
573
|
/**
|
|
532
574
|
* Panneau definition (main configuration)
|
|
533
575
|
*/
|
|
534
|
-
interface PanneauDefinition
|
|
576
|
+
interface PanneauDefinition {
|
|
577
|
+
name?: string;
|
|
535
578
|
resources?: Resource[];
|
|
536
579
|
routes?: Routes;
|
|
537
|
-
pages?:
|
|
580
|
+
pages?: PanneauPages;
|
|
538
581
|
intl?: PanneauIntl;
|
|
539
582
|
theme?: PanneauTheme;
|
|
540
583
|
components?: PanneauComponents;
|
|
541
584
|
settings?: Record<string, unknown>;
|
|
585
|
+
forms?: FormDefinition[];
|
|
586
|
+
fields?: FieldDefinition[];
|
|
542
587
|
}
|
|
543
588
|
/**
|
|
544
589
|
* Tracking variables
|
|
@@ -546,4 +591,4 @@ interface PanneauDefinition extends Definition {
|
|
|
546
591
|
type TrackingVariables = Record<string, unknown>;
|
|
547
592
|
|
|
548
593
|
export { ComponentsManager, DefinitionsManager, EventsManager, FieldsManager, FontsParser, FormsManager, MediasParser, Tracking };
|
|
549
|
-
export type { Action, ActionDefinition, ActionValue, AudioMedia, Breadcrumb, Button, ButtonElement, ButtonSize, ButtonTheme, ButtonType, Column, ControlSize, Definition, DropdownAlign, Feedback, Field, FieldOption, Filter, Font, Form, FormError, FormStatus, ImageMedia, Item, Label, Media, MediaFile, MediaType, MenuItem, Message, Modal,
|
|
594
|
+
export type { Action, ActionDefinition, ActionValue, AudioMedia, Breadcrumb, BreakpointsSize, Button, ButtonElement, ButtonSize, ButtonTheme, ButtonType, Column, ControlSize, Definition, DialogSize, DropdownAlign, Feedback, Field$2 as Field, FieldDefinition, FieldOption, Filter, Font$1 as Font, Form, FormDefinition, FormError, FormStatus, ImageMedia, Item, Label, Media, MediaFile, MediaType, MenuItem, Message, Modal, PageDefinition, Pagination, PanneauComponents, PanneauDefinition, PanneauIntl, PanneauIntlValues, PanneauPages, PanneauTheme, Preview, Resource, ResourceForms, ResourceIndex, ResourceIntl, ResourceIntlValues, ResourceItem, ResourcePages, RouteDefinition, Routes, SelectOption, StatusCode, TableColumn, Toggle, TrackingVariables, TriggerUpdate, Uppy, User, VideoMedia, uppy };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { flattenComponents, getComponentFromName } from '@panneau/core/utils';
|
|
2
|
+
import { isObject } from 'lodash';
|
|
2
3
|
import isArray from 'lodash-es/isArray';
|
|
3
4
|
import uniqBy from 'lodash-es/uniqBy';
|
|
4
5
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
5
|
-
import isObject from 'lodash-es/isObject';
|
|
6
|
+
import isObject$1 from 'lodash-es/isObject';
|
|
6
7
|
import uniq from 'lodash-es/uniq';
|
|
7
8
|
import { Tracking as Tracking$1 } from '@folklore/tracking';
|
|
8
9
|
|
|
@@ -40,6 +41,9 @@ class ComponentsManager {
|
|
|
40
41
|
return this;
|
|
41
42
|
}
|
|
42
43
|
getComponent(name, namespace = null) {
|
|
44
|
+
if (isObject(name)) {
|
|
45
|
+
return name;
|
|
46
|
+
}
|
|
43
47
|
const components = this.getComponents(namespace);
|
|
44
48
|
return getComponentFromName(name, components);
|
|
45
49
|
}
|
|
@@ -240,9 +244,9 @@ class FontsParser {
|
|
|
240
244
|
const value = data[key];
|
|
241
245
|
let font = null;
|
|
242
246
|
let subFonts = null;
|
|
243
|
-
if (patternMatch && isObject(value) && FontsParser.valueIsFont(value)) {
|
|
247
|
+
if (patternMatch && isObject$1(value) && FontsParser.valueIsFont(value)) {
|
|
244
248
|
font = value;
|
|
245
|
-
} else if (isObject(value) || isArray(value)) {
|
|
249
|
+
} else if (isObject$1(value) || isArray(value)) {
|
|
246
250
|
subFonts = FontsParser.extractFontsWithPaths(value, patterns, path);
|
|
247
251
|
}
|
|
248
252
|
return subFonts !== null || font !== null ? [...currentFonts, ...(subFonts || []), ...(font !== null ? [font] : [])] : currentFonts;
|
|
@@ -250,7 +254,7 @@ class FontsParser {
|
|
|
250
254
|
}
|
|
251
255
|
}
|
|
252
256
|
|
|
253
|
-
class FormsManager extends
|
|
257
|
+
class FormsManager extends DefinitionsManager {}
|
|
254
258
|
|
|
255
259
|
class MediasParser {
|
|
256
260
|
constructor({
|
|
@@ -401,9 +405,9 @@ class MediasParser {
|
|
|
401
405
|
const value = data[key];
|
|
402
406
|
let newValue;
|
|
403
407
|
if (patternMatch) {
|
|
404
|
-
newValue = isObject(value) ? value : medias[value] || null;
|
|
408
|
+
newValue = isObject$1(value) ? value : medias[value] || null;
|
|
405
409
|
} else {
|
|
406
|
-
newValue = isObject(value) || isArray(value) ? MediasParser.replacePathsWithMedias(value, medias, patterns, path) : value;
|
|
410
|
+
newValue = isObject$1(value) || isArray(value) ? MediasParser.replacePathsWithMedias(value, medias, patterns, path) : value;
|
|
407
411
|
}
|
|
408
412
|
return dataIsArray ? [...newData, newValue] : {
|
|
409
413
|
...newData,
|
|
@@ -429,11 +433,11 @@ class MediasParser {
|
|
|
429
433
|
let newValue;
|
|
430
434
|
let media = null;
|
|
431
435
|
let subMedias = null;
|
|
432
|
-
if (patternMatch && isObject(value)) {
|
|
436
|
+
if (patternMatch && isObject$1(value)) {
|
|
433
437
|
const mediaPath = MediasParser.getMediaPath(value);
|
|
434
438
|
newValue = mediaPath !== null ? mediaPath : value;
|
|
435
439
|
media = mediaPath !== null ? value : null;
|
|
436
|
-
} else if (isObject(value) || isArray(value)) {
|
|
440
|
+
} else if (isObject$1(value) || isArray(value)) {
|
|
437
441
|
const subReturn = MediasParser.replaceMediasWithPaths(value, patterns, medias, path);
|
|
438
442
|
newValue = subReturn.data;
|
|
439
443
|
subMedias = subReturn.medias;
|