@panneau/core 4.1.1 → 5.0.0-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/README.md +83 -0
- package/dist/definition/abilities.d.ts +21 -0
- package/dist/definition/abilities.d.ts.map +1 -0
- package/dist/definition/abilities.js +47 -0
- package/dist/definition/abilities.js.map +1 -0
- package/dist/definition/form.d.ts +31 -0
- package/dist/definition/form.d.ts.map +1 -0
- package/dist/definition/form.js +54 -0
- package/dist/definition/form.js.map +1 -0
- package/dist/definition/list.d.ts +44 -0
- package/dist/definition/list.d.ts.map +1 -0
- package/dist/definition/list.js +70 -0
- package/dist/definition/list.js.map +1 -0
- package/dist/definition/resource.d.ts +21 -0
- package/dist/definition/resource.d.ts.map +1 -0
- package/dist/definition/resource.js +24 -0
- package/dist/definition/resource.js.map +1 -0
- package/dist/form/form.d.ts +148 -0
- package/dist/form/form.d.ts.map +1 -0
- package/dist/form/form.js +239 -0
- package/dist/form/form.js.map +1 -0
- package/dist/form/messages.d.ts +7 -0
- package/dist/form/messages.d.ts.map +1 -0
- package/dist/form/messages.js +25 -0
- package/dist/form/messages.js.map +1 -0
- package/dist/form/problem.d.ts +16 -0
- package/dist/form/problem.d.ts.map +1 -0
- package/dist/form/problem.js +34 -0
- package/dist/form/problem.js.map +1 -0
- package/dist/form/selectors.d.ts +16 -0
- package/dist/form/selectors.d.ts.map +1 -0
- package/dist/form/selectors.js +27 -0
- package/dist/form/selectors.js.map +1 -0
- package/dist/form/store.d.ts +19 -0
- package/dist/form/store.d.ts.map +1 -0
- package/dist/form/store.js +29 -0
- package/dist/form/store.js.map +1 -0
- package/dist/index.d.ts +17 -692
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -536
- package/dist/list/list.d.ts +68 -0
- package/dist/list/list.d.ts.map +1 -0
- package/dist/list/list.js +191 -0
- package/dist/list/list.js.map +1 -0
- package/dist/list/router.d.ts +26 -0
- package/dist/list/router.d.ts.map +1 -0
- package/dist/list/router.js +54 -0
- package/dist/list/router.js.map +1 -0
- package/dist/plugins.d.ts +73 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/plugins.js +54 -0
- package/dist/plugins.js.map +1 -0
- package/dist/react/provider.d.ts +38 -0
- package/dist/react/provider.d.ts.map +1 -0
- package/dist/react/provider.js +63 -0
- package/dist/react/provider.js.map +1 -0
- package/dist/react/useForm.d.ts +26 -0
- package/dist/react/useForm.d.ts.map +1 -0
- package/dist/react/useForm.js +115 -0
- package/dist/react/useForm.js.map +1 -0
- package/dist/react/useList.d.ts +11 -0
- package/dist/react/useList.d.ts.map +1 -0
- package/dist/react/useList.js +47 -0
- package/dist/react/useList.js.map +1 -0
- package/dist/values.d.ts +12 -0
- package/dist/values.d.ts.map +1 -0
- package/dist/values.js +44 -0
- package/dist/values.js.map +1 -0
- package/package.json +19 -81
- package/dist/contexts.d.ts +0 -667
- package/dist/contexts.js +0 -1772
- package/dist/hooks.d.ts +0 -512
- package/dist/hooks.js +0 -2146
- package/dist/utils.d.ts +0 -457
- package/dist/utils.js +0 -557
package/dist/index.d.ts
CHANGED
|
@@ -1,692 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Internationalization message definition
|
|
20
|
-
*/
|
|
21
|
-
type Message = MessageDescriptor;
|
|
22
|
-
/**
|
|
23
|
-
* Values that can be interpolated in an internationalization message
|
|
24
|
-
* (the `values` prop of FormattedMessage)
|
|
25
|
-
*/
|
|
26
|
-
type MessageValues = NonNullable<ComponentProps<typeof FormattedMessage>['values']>;
|
|
27
|
-
type MessageValue = MessageValues[string];
|
|
28
|
-
/**
|
|
29
|
-
* Label can be either a message object or any React node
|
|
30
|
-
*/
|
|
31
|
-
type Label = Message | ReactNode;
|
|
32
|
-
/**
|
|
33
|
-
* Map of components, can be nested by namespace (ex: { fields: { text: TextField } })
|
|
34
|
-
*/
|
|
35
|
-
interface ComponentsMap {
|
|
36
|
-
[name: string]: ElementType | ComponentsMap;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* HTTP status code (number or string)
|
|
40
|
-
*/
|
|
41
|
-
type StatusCode = number | string;
|
|
42
|
-
/**
|
|
43
|
-
* Menu item definition
|
|
44
|
-
*/
|
|
45
|
-
interface MenuItem {
|
|
46
|
-
id?: number | string;
|
|
47
|
-
label?: Label;
|
|
48
|
-
url?: string;
|
|
49
|
-
href?: string | null;
|
|
50
|
-
external?: boolean;
|
|
51
|
-
active?: boolean;
|
|
52
|
-
type?: string;
|
|
53
|
-
component?: string;
|
|
54
|
-
className?: string | null;
|
|
55
|
-
linkClassName?: string | null;
|
|
56
|
-
onClick?: ((e: MouseEvent) => void) | null;
|
|
57
|
-
items?: MenuItem[] | null;
|
|
58
|
-
dropdown?: MenuItem[] | null;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Button definition
|
|
62
|
-
*/
|
|
63
|
-
type ButtonElement = HTMLButtonElement | HTMLAnchorElement;
|
|
64
|
-
interface Button {
|
|
65
|
-
id?: string;
|
|
66
|
-
name?: string;
|
|
67
|
-
label?: Label;
|
|
68
|
-
onClick?: (e: MouseEvent<ButtonElement>, button?: Button, index?: number) => void;
|
|
69
|
-
href?: string;
|
|
70
|
-
target?: string;
|
|
71
|
-
theme?: ButtonTheme;
|
|
72
|
-
size?: ButtonSize;
|
|
73
|
-
type?: ButtonType;
|
|
74
|
-
disabled?: boolean;
|
|
75
|
-
external?: boolean;
|
|
76
|
-
className?: string;
|
|
77
|
-
component?: string | ElementType;
|
|
78
|
-
renderButton?: (button: Button, index: number, fixedProps: Record<string, unknown>) => ReactNode;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Button theme variants (Bootstrap 5)
|
|
82
|
-
*/
|
|
83
|
-
type ButtonTheme = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark' | null;
|
|
84
|
-
/**
|
|
85
|
-
* Breakpoints size variants
|
|
86
|
-
*/
|
|
87
|
-
type BreakpointsSize = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | null;
|
|
88
|
-
/**
|
|
89
|
-
* Button size variants
|
|
90
|
-
*/
|
|
91
|
-
type ButtonSize = 'lg' | 'sm' | null;
|
|
92
|
-
/**
|
|
93
|
-
* Button type attribute
|
|
94
|
-
*/
|
|
95
|
-
type ButtonType = 'button' | 'submit';
|
|
96
|
-
/**
|
|
97
|
-
* Dropdown alignment
|
|
98
|
-
*/
|
|
99
|
-
type DropdownAlign = 'start' | 'end';
|
|
100
|
-
/**
|
|
101
|
-
* Form control size
|
|
102
|
-
*/
|
|
103
|
-
type ControlSize = 'lg' | 'sm' | null;
|
|
104
|
-
/**
|
|
105
|
-
* Dialog size
|
|
106
|
-
*/
|
|
107
|
-
type DialogSize = 'xl' | 'lg' | 'sm' | null;
|
|
108
|
-
/**
|
|
109
|
-
* Form status states
|
|
110
|
-
*/
|
|
111
|
-
type FormStatus = 'loading' | 'success' | 'error' | null;
|
|
112
|
-
/**
|
|
113
|
-
* Form feedback states
|
|
114
|
-
*/
|
|
115
|
-
type Feedback = 'valid' | 'invalid' | 'loading' | null;
|
|
116
|
-
/**
|
|
117
|
-
* Form error object
|
|
118
|
-
*/
|
|
119
|
-
interface FormError {
|
|
120
|
-
message?: string;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Toggle definition
|
|
124
|
-
*/
|
|
125
|
-
interface Toggle {
|
|
126
|
-
key?: string;
|
|
127
|
-
label?: string;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Breadcrumb definition
|
|
131
|
-
*/
|
|
132
|
-
interface Breadcrumb {
|
|
133
|
-
url?: string;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Font definition
|
|
137
|
-
*/
|
|
138
|
-
interface Font$1 {
|
|
139
|
-
name: string;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Trigger update identifier
|
|
143
|
-
*/
|
|
144
|
-
type TriggerUpdate = string;
|
|
145
|
-
interface Pagination {
|
|
146
|
-
page: number;
|
|
147
|
-
count: number;
|
|
148
|
-
total: number;
|
|
149
|
-
last_page: number;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Generic item (base interface for data items)
|
|
153
|
-
*/
|
|
154
|
-
interface Item {
|
|
155
|
-
id: string;
|
|
156
|
-
[key: string]: unknown;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Generic definition
|
|
160
|
-
*/
|
|
161
|
-
interface Definition$1 {
|
|
162
|
-
id: string;
|
|
163
|
-
component?: string | ElementType;
|
|
164
|
-
[key: string]: unknown;
|
|
165
|
-
}
|
|
166
|
-
interface RouteDefinition {
|
|
167
|
-
path?: string;
|
|
168
|
-
route?: string;
|
|
169
|
-
component: string | ElementType;
|
|
170
|
-
[key: string]: unknown;
|
|
171
|
-
}
|
|
172
|
-
interface PageDefinition {
|
|
173
|
-
component: string | ElementType;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Form Types
|
|
178
|
-
* TypeScript interfaces for form-related components
|
|
179
|
-
*/
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Field option for select/radio inputs
|
|
183
|
-
*/
|
|
184
|
-
interface FieldOption {
|
|
185
|
-
value?: string;
|
|
186
|
-
label?: string;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Select option (more flexible than FieldOption)
|
|
190
|
-
*/
|
|
191
|
-
type SelectOption = string | number | {
|
|
192
|
-
value?: unknown;
|
|
193
|
-
label?: Label | string;
|
|
194
|
-
} | Record<string, unknown>;
|
|
195
|
-
/**
|
|
196
|
-
* Settings of a field in a resource (the `settings` key of the field)
|
|
197
|
-
*/
|
|
198
|
-
interface FieldSettings {
|
|
199
|
-
/** Not shown in the resource forms */
|
|
200
|
-
hiddenInForm?: boolean;
|
|
201
|
-
/** Only shown in the create form */
|
|
202
|
-
createOnly?: boolean;
|
|
203
|
-
/** Only shown in the edit form (and show page) */
|
|
204
|
-
updateOnly?: boolean;
|
|
205
|
-
/** Shown as a column of the index when the resource has no `index.columns` */
|
|
206
|
-
showInIndex?: boolean;
|
|
207
|
-
[key: string]: unknown;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Field definition
|
|
211
|
-
*/
|
|
212
|
-
interface Field$2 {
|
|
213
|
-
name?: string;
|
|
214
|
-
type?: string;
|
|
215
|
-
label?: Label;
|
|
216
|
-
component?: string;
|
|
217
|
-
size?: ControlSize;
|
|
218
|
-
[key: string]: unknown;
|
|
219
|
-
}
|
|
220
|
-
interface FieldDefinition extends Omit<Field$2, 'component'>, Definition$1 {
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Form definition
|
|
224
|
-
*/
|
|
225
|
-
interface Form {
|
|
226
|
-
title?: ReactNode;
|
|
227
|
-
fields?: Field$2[];
|
|
228
|
-
method?: string | null;
|
|
229
|
-
action?: string | null;
|
|
230
|
-
submitButtonLabel?: Label | null;
|
|
231
|
-
[key: string]: unknown;
|
|
232
|
-
}
|
|
233
|
-
interface FormDefinition extends Form, Definition$1 {
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
type MediaType = 'audio' | 'image' | 'video' | 'document' | 'font';
|
|
237
|
-
interface MediaFile {
|
|
238
|
-
url: string;
|
|
239
|
-
type: string;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Media file definition
|
|
243
|
-
*/
|
|
244
|
-
interface Media$2 extends Item {
|
|
245
|
-
id: string;
|
|
246
|
-
name: string;
|
|
247
|
-
type: string;
|
|
248
|
-
thumbnail_url?: string;
|
|
249
|
-
thumbnailUrl?: string;
|
|
250
|
-
url?: string;
|
|
251
|
-
provider?: string;
|
|
252
|
-
deletedAt?: string | null;
|
|
253
|
-
[key: string]: unknown;
|
|
254
|
-
files?: Record<string, MediaFile> | null;
|
|
255
|
-
}
|
|
256
|
-
interface VideoMedia extends Media$2 {
|
|
257
|
-
type: 'video';
|
|
258
|
-
iframeUrl?: string;
|
|
259
|
-
width?: number | null;
|
|
260
|
-
height?: number | null;
|
|
261
|
-
duration?: number | null;
|
|
262
|
-
}
|
|
263
|
-
interface AudioMedia extends Media$2 {
|
|
264
|
-
type: 'audio';
|
|
265
|
-
duration?: number | null;
|
|
266
|
-
}
|
|
267
|
-
interface ImageMedia extends Media$2 {
|
|
268
|
-
type: 'image';
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Resource Types
|
|
273
|
-
* TypeScript interfaces for resources, items, users, media, and other entities
|
|
274
|
-
*/
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Table column definition
|
|
278
|
-
*/
|
|
279
|
-
type TableColumn = string | Column;
|
|
280
|
-
interface Column extends Record<string, unknown> {
|
|
281
|
-
id?: string | null;
|
|
282
|
-
name?: string | null;
|
|
283
|
-
label?: unknown;
|
|
284
|
-
path?: string;
|
|
285
|
-
valueKey?: string;
|
|
286
|
-
component?: string | ElementType | null;
|
|
287
|
-
field?: Field$2 | string | null;
|
|
288
|
-
actions?: ActionDefinition[] | null;
|
|
289
|
-
}
|
|
290
|
-
interface Action {
|
|
291
|
-
id?: string;
|
|
292
|
-
component?: string;
|
|
293
|
-
label?: string | null;
|
|
294
|
-
icon?: string | null;
|
|
295
|
-
href?: string | null;
|
|
296
|
-
external?: boolean;
|
|
297
|
-
theme?: string;
|
|
298
|
-
target?: string;
|
|
299
|
-
onClick?: (() => void) | null;
|
|
300
|
-
endpoint?: string | null;
|
|
301
|
-
withoutConfirmation?: boolean;
|
|
302
|
-
[key: string]: unknown;
|
|
303
|
-
}
|
|
304
|
-
type ActionDefinition = string | Action;
|
|
305
|
-
type ActionValue = Item | Item[] | null;
|
|
306
|
-
interface ResourceIntlValues {
|
|
307
|
-
a_singular?: string;
|
|
308
|
-
a_plural?: string;
|
|
309
|
-
[key: string]: MessageValue;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Internationalization configuration
|
|
313
|
-
*/
|
|
314
|
-
interface ResourceIntl {
|
|
315
|
-
messages?: Record<string, string>;
|
|
316
|
-
values?: ResourceIntlValues;
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Resource definition
|
|
320
|
-
*/
|
|
321
|
-
interface ResourceIndex {
|
|
322
|
-
filters?: Filter[];
|
|
323
|
-
columns?: TableColumn[];
|
|
324
|
-
actions?: ActionDefinition[];
|
|
325
|
-
fields?: Field$2[];
|
|
326
|
-
[key: string]: unknown;
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Overrides of the built-in resource pages, ex: `{ show: { component: 'my-page' } }`.
|
|
330
|
-
* Used on a resource (`resource.pages`) and on the panneau definition (`definition.pages`),
|
|
331
|
-
* the resource taking precedence.
|
|
332
|
-
*/
|
|
333
|
-
interface ResourcePages {
|
|
334
|
-
index?: PageDefinition;
|
|
335
|
-
show?: PageDefinition;
|
|
336
|
-
create?: PageDefinition;
|
|
337
|
-
edit?: PageDefinition;
|
|
338
|
-
delete?: PageDefinition;
|
|
339
|
-
duplicate?: PageDefinition;
|
|
340
|
-
/** @deprecated Legacy resource keys, use `index`, `show`, `create`, etc. */
|
|
341
|
-
resourceIndexPage?: PageDefinition;
|
|
342
|
-
resourceShowPage?: PageDefinition;
|
|
343
|
-
resourceCreatePage?: PageDefinition;
|
|
344
|
-
resourceEditPage?: PageDefinition;
|
|
345
|
-
resourceDeletePage?: PageDefinition;
|
|
346
|
-
resourceDuplicatePage?: PageDefinition;
|
|
347
|
-
/** @deprecated Legacy panneau keys, use `index`, `show`, `create`, etc. */
|
|
348
|
-
indexPage?: PageDefinition;
|
|
349
|
-
showPage?: PageDefinition;
|
|
350
|
-
createPage?: PageDefinition;
|
|
351
|
-
editPage?: PageDefinition;
|
|
352
|
-
deletePage?: PageDefinition;
|
|
353
|
-
duplicatePage?: PageDefinition;
|
|
354
|
-
[key: string]: PageDefinition | undefined;
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Form definition of a resource (the id is optional, the form is identified by its key)
|
|
358
|
-
*/
|
|
359
|
-
interface ResourceForm extends Form {
|
|
360
|
-
id?: string;
|
|
361
|
-
component?: string | ElementType;
|
|
362
|
-
}
|
|
363
|
-
interface ResourceForms {
|
|
364
|
-
default?: ResourceForm | null;
|
|
365
|
-
create?: ResourceForm | null;
|
|
366
|
-
edit?: ResourceForm | null;
|
|
367
|
-
delete?: ResourceForm | null;
|
|
368
|
-
duplicate?: ResourceForm | null;
|
|
369
|
-
modal?: ResourceForm | null;
|
|
370
|
-
[key: string]: ResourceForm | null | undefined;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Resource type (sub-type of a resource, ex: page types)
|
|
374
|
-
*/
|
|
375
|
-
interface ResourceType {
|
|
376
|
-
id?: string;
|
|
377
|
-
name?: string;
|
|
378
|
-
fields?: Field$2[];
|
|
379
|
-
settings?: {
|
|
380
|
-
canCreate?: boolean;
|
|
381
|
-
[key: string]: unknown;
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
interface Resource {
|
|
385
|
-
id: string;
|
|
386
|
-
name: string;
|
|
387
|
-
intl?: ResourceIntl;
|
|
388
|
-
fields?: Field$2[];
|
|
389
|
-
index?: ResourceIndex;
|
|
390
|
-
forms?: ResourceForms;
|
|
391
|
-
settings?: Record<string, unknown>;
|
|
392
|
-
extraRoutes?: RouteDefinition[];
|
|
393
|
-
pages?: ResourcePages;
|
|
394
|
-
types?: ResourceType[];
|
|
395
|
-
}
|
|
396
|
-
interface ResourceItem extends Item {
|
|
397
|
-
type?: string;
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Preview definition
|
|
401
|
-
*/
|
|
402
|
-
interface Preview {
|
|
403
|
-
id?: string;
|
|
404
|
-
[key: string]: unknown;
|
|
405
|
-
}
|
|
406
|
-
/**
|
|
407
|
-
* Modal definition
|
|
408
|
-
*/
|
|
409
|
-
interface Modal {
|
|
410
|
-
name?: string;
|
|
411
|
-
[key: string]: unknown;
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Filter definition
|
|
415
|
-
*/
|
|
416
|
-
interface Filter {
|
|
417
|
-
id?: string;
|
|
418
|
-
component?: string;
|
|
419
|
-
[key: string]: unknown;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Uppy configuration
|
|
423
|
-
*/
|
|
424
|
-
interface Uppy {
|
|
425
|
-
tus?: Record<string, unknown>;
|
|
426
|
-
[key: string]: unknown;
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Uppy instance
|
|
430
|
-
*/
|
|
431
|
-
interface uppy {
|
|
432
|
-
[key: string]: unknown;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Panneau Definition Types
|
|
437
|
-
* TypeScript interfaces for main Panneau configuration and definitions
|
|
438
|
-
*/
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* Panneau route configuration
|
|
442
|
-
*/
|
|
443
|
-
interface Routes {
|
|
444
|
-
'resources.index'?: RouteDefinition | string;
|
|
445
|
-
'resources.create'?: RouteDefinition | string;
|
|
446
|
-
'resources.store'?: RouteDefinition | string;
|
|
447
|
-
'resources.show'?: RouteDefinition | string;
|
|
448
|
-
'resources.edit'?: RouteDefinition | string;
|
|
449
|
-
'resources.update'?: RouteDefinition | string;
|
|
450
|
-
'resources.delete'?: RouteDefinition | string;
|
|
451
|
-
'resources.destroy'?: RouteDefinition | string;
|
|
452
|
-
'resources.duplicate'?: RouteDefinition | string;
|
|
453
|
-
'resources.clone'?: RouteDefinition | string;
|
|
454
|
-
'resources.restore'?: RouteDefinition | string;
|
|
455
|
-
[key: string]: RouteDefinition | string;
|
|
456
|
-
}
|
|
457
|
-
interface PanneauTheme {
|
|
458
|
-
colorScheme?: string | null;
|
|
459
|
-
[key: string]: unknown;
|
|
460
|
-
}
|
|
461
|
-
interface PanneauComponents {
|
|
462
|
-
[key: string]: string | {
|
|
463
|
-
component: string;
|
|
464
|
-
[key: string]: unknown;
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
interface PanneauIntlValues {
|
|
468
|
-
[key: string]: string;
|
|
469
|
-
}
|
|
470
|
-
interface PanneauIntl {
|
|
471
|
-
locale?: string;
|
|
472
|
-
locales?: string[];
|
|
473
|
-
messages?: Record<string, string>;
|
|
474
|
-
/** @deprecated Not used: set the values of each resource in `resources[].intl.values` */
|
|
475
|
-
values?: PanneauIntlValues;
|
|
476
|
-
}
|
|
477
|
-
interface PanneauPages extends ResourcePages {
|
|
478
|
-
home?: PageDefinition;
|
|
479
|
-
login?: PageDefinition;
|
|
480
|
-
account?: PageDefinition;
|
|
481
|
-
error?: PageDefinition;
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Menu item in a Panneau menu: a menu item definition or a special item id
|
|
485
|
-
* (ex: 'resources', 'account', 'separator')
|
|
486
|
-
*/
|
|
487
|
-
type PanneauMenuItem = MenuItem | string;
|
|
488
|
-
interface PanneauMenus {
|
|
489
|
-
main?: PanneauMenuItem[] | null;
|
|
490
|
-
guest?: PanneauMenuItem[] | null;
|
|
491
|
-
[key: string]: PanneauMenuItem[] | null | undefined;
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Links shown on the login page: `true` for the default url, or the url of the page
|
|
495
|
-
*/
|
|
496
|
-
interface PanneauAuth {
|
|
497
|
-
/** "Forgot your password?" link (default url: /forgot-password) */
|
|
498
|
-
forgotPassword?: boolean | string;
|
|
499
|
-
/** "Create account" link (default url: /register) */
|
|
500
|
-
register?: boolean | string;
|
|
501
|
-
[key: string]: unknown;
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* Panneau definition (main configuration)
|
|
505
|
-
*/
|
|
506
|
-
interface PanneauDefinition {
|
|
507
|
-
name?: string;
|
|
508
|
-
resources?: Resource[];
|
|
509
|
-
routes?: Routes;
|
|
510
|
-
pages?: PanneauPages;
|
|
511
|
-
intl?: PanneauIntl;
|
|
512
|
-
theme?: PanneauTheme;
|
|
513
|
-
/** @deprecated Not used: give the custom components to the `components` prop of the container */
|
|
514
|
-
components?: PanneauComponents;
|
|
515
|
-
settings?: Record<string, unknown>;
|
|
516
|
-
forms?: FormDefinition[];
|
|
517
|
-
fields?: FieldDefinition[];
|
|
518
|
-
menus?: PanneauMenus;
|
|
519
|
-
auth?: PanneauAuth;
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* Tracking variables
|
|
523
|
-
*/
|
|
524
|
-
type TrackingVariables = Record<string, unknown>;
|
|
525
|
-
|
|
526
|
-
declare class ComponentsManager {
|
|
527
|
-
components: Record<string, ElementType>;
|
|
528
|
-
constructor(components?: ComponentsMap);
|
|
529
|
-
addComponent(name: string, component: ElementType, namespace?: string | null): this;
|
|
530
|
-
addComponents(components: Record<string, ElementType>, namespace?: string | null): this;
|
|
531
|
-
merge(manager: ComponentsManager, namespace?: string | null): this;
|
|
532
|
-
addNamespace(namespace: string | null): this;
|
|
533
|
-
getComponent(name: string | ElementType, namespace?: string | null): ElementType | null;
|
|
534
|
-
getComponents(namespace?: string | null): Record<string, ElementType> | null;
|
|
535
|
-
hasComponent(name: string, namespace?: string | null): boolean;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
interface Definition {
|
|
539
|
-
id: string;
|
|
540
|
-
component?: unknown;
|
|
541
|
-
[key: string]: unknown;
|
|
542
|
-
}
|
|
543
|
-
declare class DefinitionsManager<T extends Definition = Definition> {
|
|
544
|
-
definitions: T[];
|
|
545
|
-
constructor(definitions?: T[]);
|
|
546
|
-
addDefinition(definition: T | T[]): this;
|
|
547
|
-
addDefinitions(definitions: T[]): this;
|
|
548
|
-
merge(manager: DefinitionsManager<T>): this;
|
|
549
|
-
getDefinition(id: string | null): T | null;
|
|
550
|
-
getDefinitions(): T[];
|
|
551
|
-
hasDefinition(id: string): boolean;
|
|
552
|
-
getComponent(id: string): unknown;
|
|
553
|
-
getComponents(): Record<string, unknown>;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
type EventCallback = (...args: unknown[]) => void;
|
|
557
|
-
declare class EventsManager extends EventEmitter {
|
|
558
|
-
element: EventTarget;
|
|
559
|
-
events: Record<string, EventCallback[]>;
|
|
560
|
-
listeners: Record<string, EventListener>;
|
|
561
|
-
constructor(element: EventTarget);
|
|
562
|
-
subscribe(event: string, callback: EventCallback): void;
|
|
563
|
-
unsubscribe(event: string, callback: EventCallback): void;
|
|
564
|
-
addEventListener(event: string): void;
|
|
565
|
-
removeEventListener(event: string): void;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
declare class FieldsManager extends DefinitionsManager<FieldDefinition> {
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
interface Manager$1 {
|
|
572
|
-
getDefinition: (type: string) => Record<string, unknown> | null;
|
|
573
|
-
}
|
|
574
|
-
interface FontsParserOptions {
|
|
575
|
-
fieldsManager: Manager$1;
|
|
576
|
-
screensManager: Manager$1;
|
|
577
|
-
}
|
|
578
|
-
interface Font {
|
|
579
|
-
name?: string;
|
|
580
|
-
type?: string;
|
|
581
|
-
[key: string]: unknown;
|
|
582
|
-
}
|
|
583
|
-
interface Field$1 {
|
|
584
|
-
id?: string | null;
|
|
585
|
-
name?: string | null;
|
|
586
|
-
type?: string | null;
|
|
587
|
-
fields?: Field$1[];
|
|
588
|
-
itemsField?: Field$1 | null;
|
|
589
|
-
settings?: Field$1[];
|
|
590
|
-
[key: string]: unknown;
|
|
591
|
-
}
|
|
592
|
-
interface Screen$2 {
|
|
593
|
-
type: string;
|
|
594
|
-
[key: string]: unknown;
|
|
595
|
-
}
|
|
596
|
-
interface Story$1 {
|
|
597
|
-
theme?: Story$1 | null;
|
|
598
|
-
components?: Screen$2[];
|
|
599
|
-
fonts?: Font[];
|
|
600
|
-
[key: string]: unknown;
|
|
601
|
-
}
|
|
602
|
-
declare class FontsParser {
|
|
603
|
-
fieldsManager: Manager$1;
|
|
604
|
-
screensManager: Manager$1;
|
|
605
|
-
constructor({ fieldsManager, screensManager }: FontsParserOptions);
|
|
606
|
-
parse(story: Story$1 | null): Story$1 | null;
|
|
607
|
-
getFieldsPattern(fields: Field$1[], namePrefix?: string | null): RegExp[];
|
|
608
|
-
static fieldIsFontFamily({ id }: Field$1): boolean;
|
|
609
|
-
static valueIsFont({ type }: {
|
|
610
|
-
type?: unknown;
|
|
611
|
-
}): boolean;
|
|
612
|
-
static extractFontsWithPaths(data: unknown, patterns: RegExp[], keyPrefix?: string | null): Font[];
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
declare class FormsManager extends DefinitionsManager<FormDefinition> {
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
interface Manager {
|
|
619
|
-
getDefinition: (type: string) => Record<string, unknown> | null;
|
|
620
|
-
}
|
|
621
|
-
interface MediasParserOptions {
|
|
622
|
-
fieldsManager: Manager;
|
|
623
|
-
screensManager?: Manager | null;
|
|
624
|
-
}
|
|
625
|
-
interface Media$1 {
|
|
626
|
-
id?: string | null;
|
|
627
|
-
[key: string]: unknown;
|
|
628
|
-
}
|
|
629
|
-
interface Field {
|
|
630
|
-
id?: string | null;
|
|
631
|
-
name?: string | null;
|
|
632
|
-
type?: string | null;
|
|
633
|
-
media?: boolean;
|
|
634
|
-
fields?: Field[];
|
|
635
|
-
itemsField?: Field | null;
|
|
636
|
-
settings?: Field[];
|
|
637
|
-
[key: string]: unknown;
|
|
638
|
-
}
|
|
639
|
-
interface Screen$1 {
|
|
640
|
-
type: string;
|
|
641
|
-
[key: string]: unknown;
|
|
642
|
-
}
|
|
643
|
-
interface Story {
|
|
644
|
-
theme?: Story | null;
|
|
645
|
-
components?: Screen$1[];
|
|
646
|
-
medias?: Record<string, Media$1> | null;
|
|
647
|
-
[key: string]: unknown;
|
|
648
|
-
}
|
|
649
|
-
declare class MediasParser {
|
|
650
|
-
fieldsManager: Manager;
|
|
651
|
-
screensManager: Manager | null;
|
|
652
|
-
constructor({ fieldsManager, screensManager }: MediasParserOptions);
|
|
653
|
-
toPath(story: Story | null): Story | null;
|
|
654
|
-
fromPath(story: Story | null, defaultMedias?: Record<string, Media$1> | null): Story | null;
|
|
655
|
-
getMediaFieldsPattern(fields: Field[], namePrefix?: string | null): RegExp[];
|
|
656
|
-
static fieldIsMedia({ media }: Field): boolean;
|
|
657
|
-
static fieldIsFontFamily({ id }: Field): boolean;
|
|
658
|
-
static replacePathsWithMedias(data: unknown, medias: Record<string, Media$1>, patterns: RegExp[], keyPrefix?: string | null): unknown;
|
|
659
|
-
static getMediaPath({ id }: Media$1): string | null;
|
|
660
|
-
static replaceMediasWithPaths(data: unknown, patterns: RegExp[], medias?: Record<string, Media$1> | null, keyPrefix?: string | null): {
|
|
661
|
-
data: unknown;
|
|
662
|
-
medias: Record<string, Media$1> | null;
|
|
663
|
-
};
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
interface Screen {
|
|
667
|
-
id?: string | null;
|
|
668
|
-
type?: string | null;
|
|
669
|
-
[key: string]: unknown;
|
|
670
|
-
}
|
|
671
|
-
interface Media {
|
|
672
|
-
id?: string | null;
|
|
673
|
-
name?: string | null;
|
|
674
|
-
duration?: number | null;
|
|
675
|
-
currentTime?: number | null;
|
|
676
|
-
[key: string]: unknown;
|
|
677
|
-
}
|
|
678
|
-
interface TrackingEventOptions {
|
|
679
|
-
value?: string | number | null;
|
|
680
|
-
[key: string]: unknown;
|
|
681
|
-
}
|
|
682
|
-
declare class Tracking extends Tracking$1 {
|
|
683
|
-
variables: Record<string, unknown> | null;
|
|
684
|
-
setVariables(variables: Record<string, unknown> | null): void;
|
|
685
|
-
getVariables(): Record<string, unknown> | null;
|
|
686
|
-
trackScreenView(screen: Screen | null, screenIndex: number): void;
|
|
687
|
-
trackEvent(category: string, action: string, label?: string | null, options?: TrackingEventOptions | string | number | null): void;
|
|
688
|
-
trackMedia(type: string, media: Media | null, action: string, { value, ...opts }?: TrackingEventOptions): void;
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
export { ComponentsManager, DefinitionsManager, EventsManager, FieldsManager, FontsParser, FormsManager, MediasParser, Tracking };
|
|
692
|
-
export type { Action, ActionDefinition, ActionValue, AudioMedia, Breadcrumb, BreakpointsSize, Button, ButtonElement, ButtonSize, ButtonTheme, ButtonType, Column, ComponentsMap, ControlSize, Definition$1 as Definition, DialogSize, DropdownAlign, Feedback, Field$2 as Field, FieldDefinition, FieldOption, FieldSettings, Filter, Font$1 as Font, Form, FormDefinition, FormError, FormStatus, ImageMedia, Item, Label, Media$2 as Media, MediaFile, MediaType, MenuItem, Message, MessageValue, MessageValues, Modal, PageDefinition, Pagination, PanneauAuth, PanneauComponents, PanneauDefinition, PanneauIntl, PanneauIntlValues, PanneauMenuItem, PanneauMenus, PanneauPages, PanneauTheme, Preview, Resource, ResourceForm, ResourceForms, ResourceIndex, ResourceIntl, ResourceIntlValues, ResourceItem, ResourcePages, ResourceType, RouteDefinition, Routes, SelectOption, StatusCode, TableColumn, Toggle, TrackingVariables, TriggerUpdate, Uppy, User, VideoMedia, uppy };
|
|
1
|
+
export { can, canRunAction, getActionPlacements, isActionAllowedOn, partitionByAction, } from './definition/abilities';
|
|
2
|
+
export { type FormMode, type ResolveFormOptions, type ResolvedForm, getLayoutFieldNames, resolveFields, resolveForm, } from './definition/form';
|
|
3
|
+
export { DEFAULT_PER_PAGE, type ResolvedColumn, type ResolvedList, groupActions, resolveList, } from './definition/list';
|
|
4
|
+
export { type ResolvedResource, type ResourceAbilities, findResource, resolveResource, } from './definition/resource';
|
|
5
|
+
export { type Form, type FormConflict, type FormOptions, type FormState, type FormStatus, type GetErrorsOptions, type SubmitContext, type SubmitResult, type UpdatableFormOptions, createForm, getDefaultValues, } from './form/form';
|
|
6
|
+
export { formatRuleFailure } from './form/messages';
|
|
7
|
+
export { getItemValues, getProblem, isItem } from './form/problem';
|
|
8
|
+
export { selectErrorCount, selectErrors, selectValue, selectVisible } from './form/selectors';
|
|
9
|
+
export { type FormStore, createLocalStore } from './form/store';
|
|
10
|
+
export { type List, type ListDefaults, type ListOptions, type ListSelection, type ListState, createList, } from './list/list';
|
|
11
|
+
export { type MemoryRouter, type Router, createHistoryRouter, createMemoryRouter, } from './list/router';
|
|
12
|
+
export { type Messages, type MessagesLoader, type PanneauPlugin, type PluginComponent, type PluginComponentKind, type PluginRegistry, type Theme, createPluginRegistry, definePlugin, loadMessages, } from './plugins';
|
|
13
|
+
export { PanneauProvider, type PanneauContextValue, type PanneauProviderProps, usePanneau, usePlugins, useResource, } from './react/provider';
|
|
14
|
+
export { type UseFormFieldResult, type UseFormResult, useForm, useFormField, } from './react/useForm';
|
|
15
|
+
export { type UseListResult, useList } from './react/useList';
|
|
16
|
+
export { type Values, isEqual, setValue } from './values';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,GAAG,EACH,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACH,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,mBAAmB,EACnB,aAAa,EACb,WAAW,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,YAAY,EACZ,WAAW,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,YAAY,EACZ,eAAe,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACH,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,UAAU,EACV,gBAAgB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,KAAK,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACH,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,UAAU,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,mBAAmB,EACnB,kBAAkB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,oBAAoB,EACpB,YAAY,EACZ,YAAY,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EACH,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,UAAU,EACV,UAAU,EACV,WAAW,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,OAAO,EACP,YAAY,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,aAAa,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,KAAK,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC"}
|