@panneau/app 4.1.1 → 5.0.0-alpha.0

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/index.js CHANGED
@@ -1,2958 +1,4 @@
1
- import { c } from 'react/compiler-runtime';
2
- import { useMemoryRouter, createPathToRegexpParser } from '@folklore/routes';
3
- import { useLocation, useSearch, Route, Switch, Redirect, Router } from 'wouter';
4
- import ActionsProvider from '@panneau/actions';
5
- import { useUser, useLogout, useAuth, AuthProvider } from '@panneau/auth';
6
- import { useUrlGenerator, usePanneauResources, usePanneau, usePanneauColorScheme, ResourceProvider, useActionsComponentsManager, usePanneauAuth, useRoutes, usePagesComponentsManager, ComponentsProvider, ModalProvider, RoutesProvider, PanneauProvider } from '@panneau/core/contexts';
7
- import { useResourceItem, DataProvider } from '@panneau/data';
8
- import DisplaysProvider from '@panneau/displays';
9
- import FieldsProvider from '@panneau/fields';
10
- import FiltersProvider from '@panneau/filters';
11
- import FormsProvider from '@panneau/forms';
12
- import { useResourceValues, IntlProvider } from '@panneau/intl';
13
- import ListsProvider from '@panneau/lists';
14
- import ModalsProvider from '@panneau/modals';
15
- import { UppyProvider } from '@panneau/uppy';
16
- import isObject from 'lodash-es/isObject';
17
- import { useState, useEffect } from 'react';
18
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
19
- import classNames from 'classnames';
20
- import isString from 'lodash-es/isString';
21
- import omit from 'lodash-es/omit';
22
- import queryString from 'query-string';
23
- import { FormattedMessage } from 'react-intl';
24
- import { useResourceUrlGenerator, useResourceTypeName } from '@panneau/core/hooks';
25
- import Alert from '@panneau/element-alert';
26
- import Button from '@panneau/element-button';
27
- import Dropdown from '@panneau/element-dropdown';
28
- import { Modals } from '@panneau/element-modal';
29
- import isArray from 'lodash-es/isArray';
30
- import Link from '@panneau/element-link';
31
- import Menu from '@panneau/element-menu';
32
- import Navbar from '@panneau/element-navbar';
33
- import LabelComponent from '@panneau/element-label';
34
- import ResourceList from '@panneau/list-resource-items';
35
- import Loading from '@panneau/element-loading';
36
- import ResourceForm from '@panneau/form-resource';
37
- import Form from '@panneau/form';
38
- import Filters from '@panneau/filter-filters';
39
-
40
- function ResourceFormWrapper(props) {
41
- const $ = c(2);
42
- let t0;
43
- if ($[0] !== props) {
44
- t0 = /*#__PURE__*/jsx(ResourceForm, {
45
- ...props
46
- });
47
- $[0] = props;
48
- $[1] = t0;
49
- } else {
50
- t0 = $[1];
51
- }
52
- return t0;
53
- }
54
-
55
- function AccountMenu(t0) {
56
- const $ = c(12);
57
- const {
58
- withAccountForm: t1,
59
- className: t2,
60
- itemClassName: t3,
61
- linkClassName: t4
62
- } = t0;
63
- const withAccountForm = t1 === undefined ? false : t1;
64
- const className = t2 === undefined ? null : t2;
65
- const itemClassName = t3 === undefined ? null : t3;
66
- const linkClassName = t4 === undefined ? null : t4;
67
- const route = useUrlGenerator();
68
- const user = useUser();
69
- const logout = useLogout();
70
- let t5;
71
- if ($[0] !== logout) {
72
- t5 = e => {
73
- e.preventDefault();
74
- logout();
75
- };
76
- $[0] = logout;
77
- $[1] = t5;
78
- } else {
79
- t5 = $[1];
80
- }
81
- const onClickLogout = t5;
82
- let t6;
83
- if ($[2] !== onClickLogout || $[3] !== route || $[4] !== user || $[5] !== withAccountForm) {
84
- t6 = user !== null ? [{
85
- id: "account",
86
- label: /*#__PURE__*/jsx(FormattedMessage, {
87
- id: "IuqEHB"
88
- }),
89
- href: route("account"),
90
- dropdown: [...(withAccountForm ? [{
91
- label: /*#__PURE__*/jsx(FormattedMessage, {
92
- id: "V7Us0a"
93
- }),
94
- href: route("account")
95
- }] : []), {
96
- label: /*#__PURE__*/jsx(FormattedMessage, {
97
- id: "REIcPg"
98
- }),
99
- href: route("auth.logout"),
100
- onClick: onClickLogout
101
- }]
102
- }] : [{
103
- label: /*#__PURE__*/jsx(FormattedMessage, {
104
- id: "d0g58T"
105
- }),
106
- href: route("auth.login")
107
- }];
108
- $[2] = onClickLogout;
109
- $[3] = route;
110
- $[4] = user;
111
- $[5] = withAccountForm;
112
- $[6] = t6;
113
- } else {
114
- t6 = $[6];
115
- }
116
- const items = t6;
117
- let t7;
118
- if ($[7] !== className || $[8] !== itemClassName || $[9] !== items || $[10] !== linkClassName) {
119
- t7 = items !== null ? /*#__PURE__*/jsx(Menu, {
120
- className: className,
121
- itemClassName: itemClassName,
122
- linkClassName: linkClassName,
123
- items: items,
124
- dropdownAlign: "end"
125
- }) : null;
126
- $[7] = className;
127
- $[8] = itemClassName;
128
- $[9] = items;
129
- $[10] = linkClassName;
130
- $[11] = t7;
131
- } else {
132
- t7 = $[11];
133
- }
134
- return t7;
135
- }
136
-
137
- function ResourcesMenu(t0) {
138
- const $ = c(12);
139
- const {
140
- className: t1,
141
- itemClassName: t2,
142
- linkClassName: t3
143
- } = t0;
144
- const className = t1 === undefined ? null : t1;
145
- const itemClassName = t2 === undefined ? null : t2;
146
- const linkClassName = t3 === undefined ? null : t3;
147
- const [pathname] = useLocation();
148
- const resources = usePanneauResources();
149
- const resourceRoute = useResourceUrlGenerator();
150
- let t4;
151
- if ($[0] !== pathname || $[1] !== resourceRoute || $[2] !== resources) {
152
- let t5;
153
- if ($[4] !== pathname || $[5] !== resourceRoute) {
154
- t5 = it => {
155
- const url = resourceRoute(it, "index");
156
- return {
157
- id: it.id,
158
- label: it.name,
159
- href: url,
160
- active: pathname.substr(0, url.length) === url
161
- };
162
- };
163
- $[4] = pathname;
164
- $[5] = resourceRoute;
165
- $[6] = t5;
166
- } else {
167
- t5 = $[6];
168
- }
169
- t4 = resources.filter(_temp$6).map(t5);
170
- $[0] = pathname;
171
- $[1] = resourceRoute;
172
- $[2] = resources;
173
- $[3] = t4;
174
- } else {
175
- t4 = $[3];
176
- }
177
- const items = t4;
178
- let t5;
179
- if ($[7] !== className || $[8] !== itemClassName || $[9] !== items || $[10] !== linkClassName) {
180
- t5 = /*#__PURE__*/jsx(Menu, {
181
- items: items,
182
- className: className,
183
- itemClassName: itemClassName,
184
- linkClassName: linkClassName
185
- });
186
- $[7] = className;
187
- $[8] = itemClassName;
188
- $[9] = items;
189
- $[10] = linkClassName;
190
- $[11] = t5;
191
- } else {
192
- t5 = $[11];
193
- }
194
- return t5;
195
- }
196
- function _temp$6(t0) {
197
- const {
198
- settings: t1
199
- } = t0;
200
- const {
201
- hideInNavbar: t2
202
- } = t1 === undefined ? {} : t1;
203
- const hideInNavbar = t2 === undefined ? false : t2;
204
- return !hideInNavbar;
205
- }
206
-
207
- function MainNavbar(t0) {
208
- const $ = c(30);
209
- let className;
210
- let props;
211
- let t1;
212
- let t2;
213
- let t3;
214
- let t4;
215
- if ($[0] !== t0) {
216
- ({
217
- loading: t1,
218
- theme: t2,
219
- vertical: t3,
220
- position: t4,
221
- className,
222
- ...props
223
- } = t0);
224
- $[0] = t0;
225
- $[1] = className;
226
- $[2] = props;
227
- $[3] = t1;
228
- $[4] = t2;
229
- $[5] = t3;
230
- $[6] = t4;
231
- } else {
232
- className = $[1];
233
- props = $[2];
234
- t1 = $[3];
235
- t2 = $[4];
236
- t3 = $[5];
237
- t4 = $[6];
238
- }
239
- const loading = t1 === undefined ? false : t1;
240
- const vertical = t3 === undefined ? false : t3;
241
- const {
242
- name,
243
- menus: t5
244
- } = usePanneau();
245
- const menus = t5 === undefined ? null : t5;
246
- let t6;
247
- if ($[7] !== menus) {
248
- t6 = menus || {};
249
- $[7] = menus;
250
- $[8] = t6;
251
- } else {
252
- t6 = $[8];
253
- }
254
- const {
255
- main: t7,
256
- guest: t8
257
- } = t6;
258
- const main = t7 === undefined ? null : t7;
259
- const guest = t8 === undefined ? null : t8;
260
- const {
261
- background
262
- } = usePanneauColorScheme();
263
- const route = useUrlGenerator();
264
- const user = useUser();
265
- const navClassNames = vertical ? "navbar-nav d-flex flex-column" : "navbar-nav";
266
- let t9;
267
- if ($[9] !== guest || $[10] !== main || $[11] !== navClassNames || $[12] !== user) {
268
- const menuItems = (user !== null ? main : guest) || [];
269
- const hasResources = menuItems.indexOf("resources") !== -1;
270
- const hasAccount = menuItems.indexOf("account") !== -1;
271
- let t10;
272
- if ($[14] !== navClassNames) {
273
- t10 = (currentItems, item, index) => {
274
- if (item === "resources") {
275
- return [...currentItems, /*#__PURE__*/jsx(ResourcesMenu, {
276
- className: navClassNames,
277
- itemClassName: "nav-item",
278
- linkClassName: "nav-link"
279
- }, `menu-item-resource-${index + 1}`)];
280
- }
281
- if (item === "account") {
282
- return [...currentItems, /*#__PURE__*/jsx(AccountMenu, {
283
- className: navClassNames,
284
- itemClassName: "nav-item",
285
- linkClassName: "nav-link"
286
- }, `menu-item-account-${index + 1}`)];
287
- }
288
- if (item === "separator") {
289
- return [...currentItems, /*#__PURE__*/jsx("span", {
290
- className: "ms-auto"
291
- }, `menu-item-spacer-${index + 1}`)];
292
- }
293
- const lastItem = currentItems.length > 0 ? currentItems[currentItems.length - 1] : null;
294
- const menuItem = item;
295
- return isArray(lastItem) ? [...currentItems.slice(0, currentItems.length - 1), [...lastItem, menuItem]] : [...currentItems, [menuItem]];
296
- };
297
- $[14] = navClassNames;
298
- $[15] = t10;
299
- } else {
300
- t10 = $[15];
301
- }
302
- let t11;
303
- if ($[16] !== navClassNames) {
304
- t11 = (it_0, index_0) => isArray(it_0) ? /*#__PURE__*/jsx(Menu, {
305
- items: it_0,
306
- className: navClassNames,
307
- itemClassName: "nav-item",
308
- linkClassName: "nav-link"
309
- }, `submenu-item-${index_0 + 1}`) : it_0;
310
- $[16] = navClassNames;
311
- $[17] = t11;
312
- } else {
313
- t11 = $[17];
314
- }
315
- t9 = [!hasResources && user !== null ? "resources" : null, ...menuItems, !hasAccount && menuItems.indexOf("separator") === -1 ? "separator" : null, !hasAccount ? "account" : null].filter(_temp$5).reduce(t10, []).map(t11);
316
- $[9] = guest;
317
- $[10] = main;
318
- $[11] = navClassNames;
319
- $[12] = user;
320
- $[13] = t9;
321
- } else {
322
- t9 = $[13];
323
- }
324
- const items = t9;
325
- let t10;
326
- if ($[18] !== loading || $[19] !== name || $[20] !== route || $[21] !== vertical) {
327
- t10 = name !== null ? /*#__PURE__*/jsx(Link, {
328
- href: route("home"),
329
- className: "navbar-brand",
330
- children: /*#__PURE__*/jsx("span", {
331
- className: classNames([{
332
- "text-opacity-75": loading,
333
- "ms-2": vertical
334
- }]),
335
- children: name
336
- })
337
- }) : null;
338
- $[18] = loading;
339
- $[19] = name;
340
- $[20] = route;
341
- $[21] = vertical;
342
- $[22] = t10;
343
- } else {
344
- t10 = $[22];
345
- }
346
- let t11;
347
- if ($[23] !== background || $[24] !== className || $[25] !== items || $[26] !== props || $[27] !== t10 || $[28] !== vertical) {
348
- t11 = /*#__PURE__*/jsxs(Navbar, {
349
- theme: background,
350
- vertical: vertical,
351
- className: className,
352
- ...props,
353
- children: [t10, items]
354
- });
355
- $[23] = background;
356
- $[24] = className;
357
- $[25] = items;
358
- $[26] = props;
359
- $[27] = t10;
360
- $[28] = vertical;
361
- $[29] = t11;
362
- } else {
363
- t11 = $[29];
364
- }
365
- return t11;
366
- }
367
- function _temp$5(it) {
368
- return it !== null;
369
- }
370
-
371
- function MainLayout(t0) {
372
- const $ = c(29);
373
- const {
374
- fullscreen: t1,
375
- loading: t2,
376
- children: t3
377
- } = t0;
378
- const fullscreen = t1 === undefined ? false : t1;
379
- const loading = t2 === undefined ? false : t2;
380
- const children = t3 === undefined ? null : t3;
381
- const {
382
- theme: t4,
383
- sidebarPosition: t5,
384
- background: t6,
385
- text: t7
386
- } = usePanneauColorScheme();
387
- const theme = t4 === undefined ? null : t4;
388
- const sidebarPosition = t5 === undefined ? null : t5;
389
- const background = t6 === undefined ? null : t6;
390
- const text = t7 === undefined ? null : t7;
391
- const vertical = sidebarPosition === "left" || sidebarPosition === "right";
392
- const t8 = !vertical;
393
- let t9;
394
- if ($[0] !== t8) {
395
- t9 = classNames(["d-flex", "min-vh-100", {
396
- "flex-column": t8
397
- }]);
398
- $[0] = t8;
399
- $[1] = t9;
400
- } else {
401
- t9 = $[1];
402
- }
403
- const t10 = theme !== null ? theme : undefined;
404
- const t11 = !vertical;
405
- const t12 = !vertical;
406
- const t13 = !vertical;
407
- const t14 = !vertical;
408
- const t15 = vertical && sidebarPosition === "left";
409
- const t16 = vertical && sidebarPosition === "right";
410
- const t17 = vertical && sidebarPosition === "left";
411
- const t18 = vertical && sidebarPosition === "right";
412
- let t19;
413
- if ($[2] !== t11 || $[3] !== t12 || $[4] !== t13 || $[5] !== t14 || $[6] !== t15 || $[7] !== t16 || $[8] !== t17 || $[9] !== t18) {
414
- t19 = classNames([{
415
- "shadow-sm": t11,
416
- "border-bottom": t12,
417
- "sticky-top": t13,
418
- "px-3": t14,
419
- "pe-3": t15,
420
- "ps-3": t16,
421
- "me-2": t17,
422
- "ms-2": t18
423
- }]);
424
- $[2] = t11;
425
- $[3] = t12;
426
- $[4] = t13;
427
- $[5] = t14;
428
- $[6] = t15;
429
- $[7] = t16;
430
- $[8] = t17;
431
- $[9] = t18;
432
- $[10] = t19;
433
- } else {
434
- t19 = $[10];
435
- }
436
- let t20;
437
- if ($[11] !== loading || $[12] !== t19 || $[13] !== theme || $[14] !== vertical) {
438
- t20 = /*#__PURE__*/jsx(MainNavbar, {
439
- className: t19,
440
- theme: theme,
441
- loading: loading,
442
- vertical: vertical
443
- });
444
- $[11] = loading;
445
- $[12] = t19;
446
- $[13] = theme;
447
- $[14] = vertical;
448
- $[15] = t20;
449
- } else {
450
- t20 = $[15];
451
- }
452
- let t21;
453
- if ($[16] !== background || $[17] !== fullscreen || $[18] !== text) {
454
- t21 = classNames(["flex-grow-1", {
455
- "d-flex flex-column": fullscreen
456
- }, background !== null ? `bg-${background}` : null, text !== null ? `text-${text}` : null]);
457
- $[16] = background;
458
- $[17] = fullscreen;
459
- $[18] = text;
460
- $[19] = t21;
461
- } else {
462
- t21 = $[19];
463
- }
464
- let t22;
465
- if ($[20] !== children || $[21] !== t21) {
466
- t22 = /*#__PURE__*/jsx("div", {
467
- className: t21,
468
- children: children
469
- });
470
- $[20] = children;
471
- $[21] = t21;
472
- $[22] = t22;
473
- } else {
474
- t22 = $[22];
475
- }
476
- let t23;
477
- if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
478
- t23 = /*#__PURE__*/jsx(Modals, {});
479
- $[23] = t23;
480
- } else {
481
- t23 = $[23];
482
- }
483
- let t24;
484
- if ($[24] !== t10 || $[25] !== t20 || $[26] !== t22 || $[27] !== t9) {
485
- t24 = /*#__PURE__*/jsxs("div", {
486
- className: t9,
487
- "data-bs-theme": t10,
488
- children: [t20, t22, t23]
489
- });
490
- $[24] = t10;
491
- $[25] = t20;
492
- $[26] = t22;
493
- $[27] = t9;
494
- $[28] = t24;
495
- } else {
496
- t24 = $[28];
497
- }
498
- return t24;
499
- }
500
-
501
- function PageHeader(t0) {
502
- const $ = c(20);
503
- const {
504
- title: t1,
505
- actions: t2,
506
- small: t3,
507
- className: t4,
508
- children: t5
509
- } = t0;
510
- const title = t1 === undefined ? null : t1;
511
- const actions = t2 === undefined ? null : t2;
512
- const small = t3 === undefined ? false : t3;
513
- const className = t4 === undefined ? null : t4;
514
- const children = t5 === undefined ? null : t5;
515
- const {
516
- text,
517
- background
518
- } = usePanneauColorScheme();
519
- let t6;
520
- if ($[0] !== title) {
521
- t6 = title !== null ? /*#__PURE__*/jsx("h1", {
522
- className: classNames(["mb-0", "h2"]),
523
- children: /*#__PURE__*/jsx(LabelComponent, {
524
- children: title
525
- })
526
- }) : null;
527
- $[0] = title;
528
- $[1] = t6;
529
- } else {
530
- t6 = $[1];
531
- }
532
- let t7;
533
- if ($[2] !== actions) {
534
- t7 = actions !== null ? /*#__PURE__*/jsx("div", {
535
- className: "ms-auto",
536
- children: actions
537
- }) : null;
538
- $[2] = actions;
539
- $[3] = t7;
540
- } else {
541
- t7 = $[3];
542
- }
543
- let t8;
544
- if ($[4] !== t6 || $[5] !== t7) {
545
- t8 = /*#__PURE__*/jsxs("div", {
546
- className: "d-flex align-items-center flex-wrap",
547
- children: [t6, t7]
548
- });
549
- $[4] = t6;
550
- $[5] = t7;
551
- $[6] = t8;
552
- } else {
553
- t8 = $[6];
554
- }
555
- const inner = t8;
556
- const t9 = background !== null ? `bg-${background}` : null;
557
- const t10 = text !== null ? `text-${text}` : null;
558
- const t11 = background || text !== null;
559
- const t12 = className !== null;
560
- let t13;
561
- if ($[7] !== className || $[8] !== t10 || $[9] !== t11 || $[10] !== t12 || $[11] !== t9) {
562
- t13 = classNames(["py-4", t9, t10, {
563
- "border-bottom": t11,
564
- [className]: t12
565
- }]);
566
- $[7] = className;
567
- $[8] = t10;
568
- $[9] = t11;
569
- $[10] = t12;
570
- $[11] = t9;
571
- $[12] = t13;
572
- } else {
573
- t13 = $[12];
574
- }
575
- let t14;
576
- if ($[13] !== inner || $[14] !== small) {
577
- t14 = /*#__PURE__*/jsx("div", {
578
- className: "container-sm",
579
- children: small ? /*#__PURE__*/jsx("div", {
580
- className: "row justify-content-center",
581
- children: /*#__PURE__*/jsx("div", {
582
- className: "col-12 col-md-8 col-lg-7",
583
- children: inner
584
- })
585
- }) : inner
586
- });
587
- $[13] = inner;
588
- $[14] = small;
589
- $[15] = t14;
590
- } else {
591
- t14 = $[15];
592
- }
593
- let t15;
594
- if ($[16] !== children || $[17] !== t13 || $[18] !== t14) {
595
- t15 = /*#__PURE__*/jsxs("div", {
596
- className: t13,
597
- children: [t14, children]
598
- });
599
- $[16] = children;
600
- $[17] = t13;
601
- $[18] = t14;
602
- $[19] = t15;
603
- } else {
604
- t15 = $[19];
605
- }
606
- return t15;
607
- }
608
-
609
- function ResourceCreatePage(t0) {
610
- const $ = c(22);
611
- const {
612
- resource
613
- } = t0;
614
- const [, navigate] = useLocation();
615
- const search = useSearch();
616
- const resourceRoute = useResourceUrlGenerator(resource);
617
- let t1;
618
- if ($[0] !== search) {
619
- t1 = queryString.parse(search, {
620
- arrayFormat: "bracket"
621
- });
622
- $[0] = search;
623
- $[1] = t1;
624
- } else {
625
- t1 = $[1];
626
- }
627
- const {
628
- type: t2
629
- } = t1;
630
- const queryType = t2 === undefined ? null : t2;
631
- let t3;
632
- if ($[2] !== queryType) {
633
- t3 = isString(queryType) ? queryType : null;
634
- $[2] = queryType;
635
- $[3] = t3;
636
- } else {
637
- t3 = $[3];
638
- }
639
- const type = t3;
640
- const resourceValues = useResourceValues(resource);
641
- const typeName = useResourceTypeName(resource, type);
642
- let t4;
643
- if ($[4] !== navigate || $[5] !== resourceRoute) {
644
- t4 = () => {
645
- navigate(`${resourceRoute("index")}?created=true`);
646
- };
647
- $[4] = navigate;
648
- $[5] = resourceRoute;
649
- $[6] = t4;
650
- } else {
651
- t4 = $[6];
652
- }
653
- const onComplete = t4;
654
- let t5;
655
- if ($[7] !== resourceValues) {
656
- t5 = /*#__PURE__*/jsx(FormattedMessage, {
657
- id: "6viUpq",
658
- values: resourceValues
659
- });
660
- $[7] = resourceValues;
661
- $[8] = t5;
662
- } else {
663
- t5 = $[8];
664
- }
665
- let t6;
666
- if ($[9] !== typeName) {
667
- t6 = typeName !== null ? /*#__PURE__*/jsxs("span", {
668
- className: "text-body-secondary",
669
- children: [" (", typeName, ")"]
670
- }) : null;
671
- $[9] = typeName;
672
- $[10] = t6;
673
- } else {
674
- t6 = $[10];
675
- }
676
- let t7;
677
- if ($[11] !== t5 || $[12] !== t6) {
678
- t7 = /*#__PURE__*/jsx(PageHeader, {
679
- title: /*#__PURE__*/jsxs(Fragment, {
680
- children: [t5, t6]
681
- }),
682
- small: true
683
- });
684
- $[11] = t5;
685
- $[12] = t6;
686
- $[13] = t7;
687
- } else {
688
- t7 = $[13];
689
- }
690
- let t8;
691
- if ($[14] !== onComplete || $[15] !== resource || $[16] !== t7 || $[17] !== type) {
692
- t8 = /*#__PURE__*/jsx(MainLayout, {
693
- children: /*#__PURE__*/jsx(ResourceFormWrapper, {
694
- resource: resource,
695
- type: type,
696
- onComplete: onComplete,
697
- withContainer: true,
698
- header: t7
699
- })
700
- });
701
- $[14] = onComplete;
702
- $[15] = resource;
703
- $[16] = t7;
704
- $[17] = type;
705
- $[18] = t8;
706
- } else {
707
- t8 = $[18];
708
- }
709
- let t9;
710
- if ($[19] !== resource || $[20] !== t8) {
711
- t9 = /*#__PURE__*/jsx(ResourceProvider, {
712
- resource: resource,
713
- children: t8
714
- });
715
- $[19] = resource;
716
- $[20] = t8;
717
- $[21] = t9;
718
- } else {
719
- t9 = $[21];
720
- }
721
- return t9;
722
- }
723
-
724
- function ResourceDeletePage(t0) {
725
- const $ = c(22);
726
- const {
727
- itemId,
728
- resource
729
- } = t0;
730
- const [, navigate] = useLocation();
731
- const resourceRoute = useResourceUrlGenerator(resource);
732
- const {
733
- item,
734
- isLoading,
735
- error
736
- } = useResourceItem(resource, itemId);
737
- let t1;
738
- if ($[0] !== item) {
739
- t1 = item || {};
740
- $[0] = item;
741
- $[1] = t1;
742
- } else {
743
- t1 = $[1];
744
- }
745
- const {
746
- type: t2
747
- } = t1;
748
- const type = t2 === undefined ? null : t2;
749
- const resourceValues = useResourceValues(resource);
750
- const typeName = useResourceTypeName(resource, type);
751
- let t3;
752
- if ($[2] !== navigate || $[3] !== resourceRoute) {
753
- t3 = () => navigate(`${resourceRoute("index")}?deleted=true`);
754
- $[2] = navigate;
755
- $[3] = resourceRoute;
756
- $[4] = t3;
757
- } else {
758
- t3 = $[4];
759
- }
760
- const onComplete = t3;
761
- let t4;
762
- if ($[5] !== item || $[6] !== onComplete || $[7] !== resource || $[8] !== resourceValues || $[9] !== typeName) {
763
- t4 = item !== null ? /*#__PURE__*/jsx(ResourceFormWrapper, {
764
- resource: resource,
765
- item: item,
766
- onComplete: onComplete,
767
- isDelete: true,
768
- withContainer: true,
769
- header: /*#__PURE__*/jsx(PageHeader, {
770
- title: /*#__PURE__*/jsxs(Fragment, {
771
- children: [/*#__PURE__*/jsx(FormattedMessage, {
772
- id: "zN5N/Q",
773
- values: resourceValues
774
- }), typeName !== null ? /*#__PURE__*/jsxs("span", {
775
- className: "text-body-secondary",
776
- children: [" ", "(", typeName, ")"]
777
- }) : null]
778
- }),
779
- small: true
780
- })
781
- }) : null;
782
- $[5] = item;
783
- $[6] = onComplete;
784
- $[7] = resource;
785
- $[8] = resourceValues;
786
- $[9] = typeName;
787
- $[10] = t4;
788
- } else {
789
- t4 = $[10];
790
- }
791
- let t5;
792
- if ($[11] !== error || $[12] !== isLoading || $[13] !== item) {
793
- t5 = item === null && isLoading && !error ? /*#__PURE__*/jsx(Loading, {
794
- className: "mw-25 my-4 m-auto",
795
- withDelay: true,
796
- children: /*#__PURE__*/jsx(FormattedMessage, {
797
- id: "TV3jir"
798
- })
799
- }) : null;
800
- $[11] = error;
801
- $[12] = isLoading;
802
- $[13] = item;
803
- $[14] = t5;
804
- } else {
805
- t5 = $[14];
806
- }
807
- let t6;
808
- if ($[15] !== isLoading || $[16] !== t4 || $[17] !== t5) {
809
- t6 = /*#__PURE__*/jsxs(MainLayout, {
810
- loading: isLoading,
811
- children: [t4, t5]
812
- });
813
- $[15] = isLoading;
814
- $[16] = t4;
815
- $[17] = t5;
816
- $[18] = t6;
817
- } else {
818
- t6 = $[18];
819
- }
820
- let t7;
821
- if ($[19] !== resource || $[20] !== t6) {
822
- t7 = /*#__PURE__*/jsx(ResourceProvider, {
823
- resource: resource,
824
- children: t6
825
- });
826
- $[19] = resource;
827
- $[20] = t6;
828
- $[21] = t7;
829
- } else {
830
- t7 = $[21];
831
- }
832
- return t7;
833
- }
834
-
835
- function ResourceEditPage(t0) {
836
- const $ = c(23);
837
- const {
838
- itemId,
839
- resource
840
- } = t0;
841
- const {
842
- item,
843
- isLoading,
844
- error
845
- } = useResourceItem(resource, itemId);
846
- let t1;
847
- if ($[0] !== item) {
848
- t1 = item || {};
849
- $[0] = item;
850
- $[1] = t1;
851
- } else {
852
- t1 = $[1];
853
- }
854
- const {
855
- type: t2
856
- } = t1;
857
- const type = t2 === undefined ? null : t2;
858
- const [editItem, setEditItem] = useState(item);
859
- const typeName = useResourceTypeName(resource, type);
860
- let t3;
861
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
862
- t3 = newItem => setEditItem(newItem);
863
- $[2] = t3;
864
- } else {
865
- t3 = $[2];
866
- }
867
- const onComplete = t3;
868
- let t4;
869
- let t5;
870
- if ($[3] !== item) {
871
- t4 = () => {
872
- setEditItem(item);
873
- };
874
- t5 = [item, setEditItem];
875
- $[3] = item;
876
- $[4] = t4;
877
- $[5] = t5;
878
- } else {
879
- t4 = $[4];
880
- t5 = $[5];
881
- }
882
- useEffect(t4, t5);
883
- const resourceValues = useResourceValues(resource);
884
- let t6;
885
- if ($[6] !== editItem || $[7] !== resource || $[8] !== resourceValues || $[9] !== type || $[10] !== typeName) {
886
- t6 = editItem !== null ? /*#__PURE__*/jsx(ResourceFormWrapper, {
887
- resource: resource,
888
- item: editItem,
889
- type: type,
890
- onComplete: onComplete,
891
- withContainer: true,
892
- header: /*#__PURE__*/jsx(PageHeader, {
893
- title: /*#__PURE__*/jsxs(Fragment, {
894
- children: [/*#__PURE__*/jsx(FormattedMessage, {
895
- id: "mCfzkJ",
896
- values: resourceValues
897
- }), typeName !== null ? /*#__PURE__*/jsxs("span", {
898
- className: "text-body-secondary",
899
- children: [" ", "(", typeName, ")"]
900
- }) : null]
901
- }),
902
- small: true
903
- })
904
- }) : null;
905
- $[6] = editItem;
906
- $[7] = resource;
907
- $[8] = resourceValues;
908
- $[9] = type;
909
- $[10] = typeName;
910
- $[11] = t6;
911
- } else {
912
- t6 = $[11];
913
- }
914
- let t7;
915
- if ($[12] !== editItem || $[13] !== error || $[14] !== isLoading) {
916
- t7 = editItem === null && isLoading && !error ? /*#__PURE__*/jsx(Loading, {
917
- className: "mw-25 my-4 m-auto",
918
- withDelay: true,
919
- children: /*#__PURE__*/jsx(FormattedMessage, {
920
- id: "TV3jir"
921
- })
922
- }) : null;
923
- $[12] = editItem;
924
- $[13] = error;
925
- $[14] = isLoading;
926
- $[15] = t7;
927
- } else {
928
- t7 = $[15];
929
- }
930
- let t8;
931
- if ($[16] !== isLoading || $[17] !== t6 || $[18] !== t7) {
932
- t8 = /*#__PURE__*/jsxs(MainLayout, {
933
- loading: isLoading,
934
- children: [t6, t7]
935
- });
936
- $[16] = isLoading;
937
- $[17] = t6;
938
- $[18] = t7;
939
- $[19] = t8;
940
- } else {
941
- t8 = $[19];
942
- }
943
- let t9;
944
- if ($[20] !== resource || $[21] !== t8) {
945
- t9 = /*#__PURE__*/jsx(ResourceProvider, {
946
- resource: resource,
947
- children: t8
948
- });
949
- $[20] = resource;
950
- $[21] = t8;
951
- $[22] = t9;
952
- } else {
953
- t9 = $[22];
954
- }
955
- return t9;
956
- }
957
-
958
- function ResourceCreateButton(t0) {
959
- const $ = c(24);
960
- const {
961
- resource,
962
- size: t1,
963
- className: t2
964
- } = t0;
965
- const size = t1 === undefined ? "lg" : t1;
966
- const className = t2 === undefined ? null : t2;
967
- const {
968
- types: t3
969
- } = resource;
970
- const types = t3 === undefined ? null : t3;
971
- const resourceRoute = useResourceUrlGenerator(resource);
972
- const resourceValues = useResourceValues(resource);
973
- const [dropdownOpened, setDropdownOpened] = useState(false);
974
- let t4;
975
- if ($[0] !== dropdownOpened) {
976
- t4 = e => {
977
- e.preventDefault();
978
- e.stopPropagation();
979
- setDropdownOpened(!dropdownOpened);
980
- };
981
- $[0] = dropdownOpened;
982
- $[1] = t4;
983
- } else {
984
- t4 = $[1];
985
- }
986
- const onClickDropdown = t4;
987
- let t5;
988
- if ($[2] !== className || $[3] !== dropdownOpened || $[4] !== onClickDropdown || $[5] !== resourceRoute || $[6] !== resourceValues || $[7] !== size || $[8] !== types) {
989
- const finalTypes = types !== null ? types.filter(_temp$4) : null;
990
- const hasMultipleTypes = finalTypes !== null && finalTypes.length > 1;
991
- let t6;
992
- if ($[10] !== dropdownOpened) {
993
- t6 = () => {
994
- if (dropdownOpened) {
995
- setDropdownOpened(false);
996
- }
997
- };
998
- $[10] = dropdownOpened;
999
- $[11] = t6;
1000
- } else {
1001
- t6 = $[11];
1002
- }
1003
- const onDropdownClickOutside = t6;
1004
- const t7 = !hasMultipleTypes ? `${resourceRoute("create")}${finalTypes !== null && finalTypes.length === 1 ? `?type=${finalTypes[0].id}` : ""}` : "#";
1005
- const t8 = className !== null;
1006
- let t9;
1007
- if ($[12] !== className || $[13] !== hasMultipleTypes || $[14] !== t8) {
1008
- t9 = classNames([{
1009
- "dropdown-toggle": hasMultipleTypes,
1010
- [className]: t8
1011
- }]);
1012
- $[12] = className;
1013
- $[13] = hasMultipleTypes;
1014
- $[14] = t8;
1015
- $[15] = t9;
1016
- } else {
1017
- t9 = $[15];
1018
- }
1019
- const t10 = hasMultipleTypes ? onClickDropdown : null;
1020
- let t11;
1021
- if ($[16] !== resourceValues) {
1022
- t11 = /*#__PURE__*/jsx(FormattedMessage, {
1023
- id: "l+ddDH",
1024
- values: resourceValues
1025
- });
1026
- $[16] = resourceValues;
1027
- $[17] = t11;
1028
- } else {
1029
- t11 = $[17];
1030
- }
1031
- let t12;
1032
- if ($[18] !== size || $[19] !== t10 || $[20] !== t11 || $[21] !== t7 || $[22] !== t9) {
1033
- t12 = /*#__PURE__*/jsx(Button, {
1034
- href: t7,
1035
- size: size,
1036
- theme: "primary",
1037
- className: t9,
1038
- onClick: t10,
1039
- children: t11
1040
- });
1041
- $[18] = size;
1042
- $[19] = t10;
1043
- $[20] = t11;
1044
- $[21] = t7;
1045
- $[22] = t9;
1046
- $[23] = t12;
1047
- } else {
1048
- t12 = $[23];
1049
- }
1050
- const button = t12;
1051
- t5 = hasMultipleTypes ? /*#__PURE__*/jsxs("div", {
1052
- className: classNames(["dropdown", {
1053
- show: dropdownOpened
1054
- }]),
1055
- children: [button, /*#__PURE__*/jsx(Dropdown, {
1056
- items: finalTypes.map(it => ({
1057
- id: it.id,
1058
- label: it.name,
1059
- href: `${resourceRoute("create")}?type=${it.id}`
1060
- })),
1061
- visible: dropdownOpened,
1062
- align: "end",
1063
- onClickOutside: onDropdownClickOutside
1064
- })]
1065
- }) : button;
1066
- $[2] = className;
1067
- $[3] = dropdownOpened;
1068
- $[4] = onClickDropdown;
1069
- $[5] = resourceRoute;
1070
- $[6] = resourceValues;
1071
- $[7] = size;
1072
- $[8] = types;
1073
- $[9] = t5;
1074
- } else {
1075
- t5 = $[9];
1076
- }
1077
- return t5;
1078
- }
1079
- function _temp$4(t0) {
1080
- const {
1081
- settings: t1
1082
- } = t0;
1083
- const {
1084
- canCreate: t2
1085
- } = t1 === undefined ? {} : t1;
1086
- const canCreate = t2 === undefined ? true : t2;
1087
- return canCreate;
1088
- }
1089
-
1090
- // Kept for backward compatibility with exports
1091
- function ResourceItemsList(t0) {
1092
- const $ = c(8);
1093
- let props;
1094
- let resource;
1095
- if ($[0] !== t0) {
1096
- ({
1097
- resource,
1098
- ...props
1099
- } = t0);
1100
- $[0] = t0;
1101
- $[1] = props;
1102
- $[2] = resource;
1103
- } else {
1104
- props = $[1];
1105
- resource = $[2];
1106
- }
1107
- let t1;
1108
- if ($[3] !== resource) {
1109
- t1 = isObject(resource) ? resource : {
1110
- id: resource
1111
- };
1112
- $[3] = resource;
1113
- $[4] = t1;
1114
- } else {
1115
- t1 = $[4];
1116
- }
1117
- const {
1118
- id: t2
1119
- } = t1;
1120
- const finalResource = t2 === undefined ? null : t2;
1121
- let t3;
1122
- if ($[5] !== finalResource || $[6] !== props) {
1123
- t3 = /*#__PURE__*/jsx(ResourceList, {
1124
- resource: finalResource,
1125
- ...props
1126
- });
1127
- $[5] = finalResource;
1128
- $[6] = props;
1129
- $[7] = t3;
1130
- } else {
1131
- t3 = $[7];
1132
- }
1133
- return t3;
1134
- }
1135
-
1136
- const DEFAULT_ACTIONS = ['create'];
1137
- function ResourceIndexPage(t0) {
1138
- const $ = c(72);
1139
- const {
1140
- resource,
1141
- defaultActions: t1,
1142
- actionsProps: t2
1143
- } = t0;
1144
- const defaultActions = t1 === undefined ? DEFAULT_ACTIONS : t1;
1145
- const actionsProps = t2 === undefined ? null : t2;
1146
- const {
1147
- theme: t3
1148
- } = usePanneauColorScheme();
1149
- const theme = t3 === undefined ? null : t3;
1150
- const {
1151
- name,
1152
- settings: t4,
1153
- index: t5
1154
- } = resource;
1155
- let t6;
1156
- if ($[0] !== t4) {
1157
- t6 = t4 === undefined ? {} : t4;
1158
- $[0] = t4;
1159
- $[1] = t6;
1160
- } else {
1161
- t6 = $[1];
1162
- }
1163
- const settings = t6;
1164
- let t7;
1165
- if ($[2] !== t5) {
1166
- t7 = t5 === undefined ? {} : t5;
1167
- $[2] = t5;
1168
- $[3] = t7;
1169
- } else {
1170
- t7 = $[3];
1171
- }
1172
- const index = t7;
1173
- let t8;
1174
- if ($[4] !== settings) {
1175
- t8 = settings || {};
1176
- $[4] = settings;
1177
- $[5] = t8;
1178
- } else {
1179
- t8 = $[5];
1180
- }
1181
- const {
1182
- canCreate: t9,
1183
- indexIsPaginated: t10
1184
- } = t8;
1185
- const canCreate = t9 === undefined ? true : t9;
1186
- const paginated = t10 === undefined ? false : t10;
1187
- let t11;
1188
- if ($[6] !== index) {
1189
- t11 = index || {};
1190
- $[6] = index;
1191
- $[7] = t11;
1192
- } else {
1193
- t11 = $[7];
1194
- }
1195
- const {
1196
- actions: t12
1197
- } = t11;
1198
- const indexActions = t12 === undefined ? null : t12;
1199
- let t13;
1200
- if ($[8] !== canCreate || $[9] !== defaultActions || $[10] !== indexActions) {
1201
- t13 = indexActions || defaultActions.filter(it => it !== "create" || canCreate);
1202
- $[8] = canCreate;
1203
- $[9] = defaultActions;
1204
- $[10] = indexActions;
1205
- $[11] = t13;
1206
- } else {
1207
- t13 = $[11];
1208
- }
1209
- let t14;
1210
- if ($[12] !== t13) {
1211
- t14 = t13.map(_temp$3);
1212
- $[12] = t13;
1213
- $[13] = t14;
1214
- } else {
1215
- t14 = $[13];
1216
- }
1217
- const finalActions = t14;
1218
- const resourceValues = useResourceValues(resource);
1219
- const actionsComponentsManager = useActionsComponentsManager();
1220
- const [, navigate] = useLocation();
1221
- const search = useSearch();
1222
- let t15;
1223
- if ($[14] !== search) {
1224
- t15 = queryString.parse(search, {
1225
- arrayFormat: "bracket"
1226
- });
1227
- $[14] = search;
1228
- $[15] = t15;
1229
- } else {
1230
- t15 = $[15];
1231
- }
1232
- const query = t15;
1233
- let t16;
1234
- if ($[16] !== query) {
1235
- t16 = omit(query, ["created", "deleted"]);
1236
- $[16] = query;
1237
- $[17] = t16;
1238
- } else {
1239
- t16 = $[17];
1240
- }
1241
- const listQuery = t16;
1242
- let t17;
1243
- if ($[18] !== query) {
1244
- t17 = query || {};
1245
- $[18] = query;
1246
- $[19] = t17;
1247
- } else {
1248
- t17 = $[19];
1249
- }
1250
- const {
1251
- created: t18,
1252
- deleted: t19
1253
- } = t17;
1254
- const created = t18 === undefined ? false : t18;
1255
- const deleted = t19 === undefined ? false : t19;
1256
- const resourceRoute = useResourceUrlGenerator(resource);
1257
- let t20;
1258
- if ($[20] !== resourceRoute) {
1259
- t20 = resourceRoute("index");
1260
- $[20] = resourceRoute;
1261
- $[21] = t20;
1262
- } else {
1263
- t20 = $[21];
1264
- }
1265
- const url = t20;
1266
- let t21;
1267
- if ($[22] !== navigate || $[23] !== url) {
1268
- t21 = submitQuery => {
1269
- const newQuery = submitQuery !== null ? Object.keys(submitQuery).reduce((currentQuery, key) => {
1270
- const value = submitQuery[key];
1271
- return value !== null ? {
1272
- ...currentQuery,
1273
- [key]: value
1274
- } : currentQuery;
1275
- }, {}) : null;
1276
- navigate(`${url}${newQuery !== null ? `?${queryString.stringify(newQuery, {
1277
- arrayFormat: "bracket"
1278
- })}` : ""}`);
1279
- };
1280
- $[22] = navigate;
1281
- $[23] = url;
1282
- $[24] = t21;
1283
- } else {
1284
- t21 = $[24];
1285
- }
1286
- const onQueryChange = t21;
1287
- let t22;
1288
- if ($[25] !== navigate || $[26] !== url) {
1289
- t22 = () => {
1290
- const resetQuery = queryString.stringify(null, {
1291
- arrayFormat: "bracket"
1292
- });
1293
- navigate(`${url}?${resetQuery}`);
1294
- };
1295
- $[25] = navigate;
1296
- $[26] = url;
1297
- $[27] = t22;
1298
- } else {
1299
- t22 = $[27];
1300
- }
1301
- const onQueryReset = t22;
1302
- let t23;
1303
- if ($[28] !== navigate || $[29] !== url) {
1304
- t23 = () => {
1305
- navigate(url, {
1306
- replace: true
1307
- });
1308
- };
1309
- $[28] = navigate;
1310
- $[29] = url;
1311
- $[30] = t23;
1312
- } else {
1313
- t23 = $[30];
1314
- }
1315
- const onClickCloseAlert = t23;
1316
- let t24;
1317
- if ($[31] !== actionsComponentsManager || $[32] !== finalActions || $[33] !== onQueryChange || $[34] !== query || $[35] !== resource) {
1318
- t24 = finalActions.length > 0 ? /*#__PURE__*/jsx("div", {
1319
- className: "d-flex align-items-center",
1320
- children: finalActions.map(t25 => {
1321
- const {
1322
- id,
1323
- component: t26,
1324
- withQuery: t27,
1325
- href: t28,
1326
- ...otherProps
1327
- } = t25;
1328
- const component = t26 === undefined ? Button : t26;
1329
- const withQuery = t27 === undefined ? false : t27;
1330
- const href = t28 === undefined ? null : t28;
1331
- const ActionComponent = isString(component) ? actionsComponentsManager.getComponent(component) : component;
1332
- const isButton = ActionComponent === Button;
1333
- let finalHref = href;
1334
- if (isButton && withQuery && href !== null) {
1335
- finalHref = `${finalHref}${finalHref.indexOf("?") !== -1 ? "&" : "?"}${queryString.stringify(query, {
1336
- arrayFormat: "bracket"
1337
- })}`;
1338
- }
1339
- return ActionComponent !== null ? /*#__PURE__*/jsx(ActionComponent, {
1340
- href: finalHref,
1341
- ...otherProps,
1342
- ...(!isButton ? {
1343
- resource,
1344
- query,
1345
- onQueryChange
1346
- } : {})
1347
- }, `action-${id}`) : null;
1348
- })
1349
- }) : null;
1350
- $[31] = actionsComponentsManager;
1351
- $[32] = finalActions;
1352
- $[33] = onQueryChange;
1353
- $[34] = query;
1354
- $[35] = resource;
1355
- $[36] = t24;
1356
- } else {
1357
- t24 = $[36];
1358
- }
1359
- let t25;
1360
- if ($[37] !== name || $[38] !== t24) {
1361
- t25 = /*#__PURE__*/jsx(PageHeader, {
1362
- title: name,
1363
- actions: t24
1364
- });
1365
- $[37] = name;
1366
- $[38] = t24;
1367
- $[39] = t25;
1368
- } else {
1369
- t25 = $[39];
1370
- }
1371
- let t26;
1372
- if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
1373
- t26 = classNames(["container-sm py-4"]);
1374
- $[40] = t26;
1375
- } else {
1376
- t26 = $[40];
1377
- }
1378
- let t27;
1379
- if ($[41] !== created || $[42] !== onClickCloseAlert || $[43] !== resourceValues) {
1380
- t27 = created ? /*#__PURE__*/jsx(Alert, {
1381
- className: "mb-4",
1382
- onClose: onClickCloseAlert,
1383
- children: /*#__PURE__*/jsx(FormattedMessage, {
1384
- id: "bfP/d8",
1385
- values: resourceValues
1386
- })
1387
- }) : null;
1388
- $[41] = created;
1389
- $[42] = onClickCloseAlert;
1390
- $[43] = resourceValues;
1391
- $[44] = t27;
1392
- } else {
1393
- t27 = $[44];
1394
- }
1395
- let t28;
1396
- if ($[45] !== deleted || $[46] !== onClickCloseAlert || $[47] !== resourceValues) {
1397
- t28 = deleted ? /*#__PURE__*/jsx(Alert, {
1398
- className: "mb-4",
1399
- onClose: onClickCloseAlert,
1400
- children: /*#__PURE__*/jsx(FormattedMessage, {
1401
- id: "dkRdks",
1402
- values: resourceValues
1403
- })
1404
- }) : null;
1405
- $[45] = deleted;
1406
- $[46] = onClickCloseAlert;
1407
- $[47] = resourceValues;
1408
- $[48] = t28;
1409
- } else {
1410
- t28 = $[48];
1411
- }
1412
- let t29;
1413
- if ($[49] !== actionsProps) {
1414
- t29 = actionsProps || {};
1415
- $[49] = actionsProps;
1416
- $[50] = t29;
1417
- } else {
1418
- t29 = $[50];
1419
- }
1420
- let t30;
1421
- if ($[51] !== t29) {
1422
- t30 = {
1423
- size: "sm",
1424
- ...t29
1425
- };
1426
- $[51] = t29;
1427
- $[52] = t30;
1428
- } else {
1429
- t30 = $[52];
1430
- }
1431
- let t31;
1432
- if ($[53] !== listQuery || $[54] !== onQueryChange || $[55] !== onQueryReset || $[56] !== paginated || $[57] !== resource || $[58] !== t30 || $[59] !== theme || $[60] !== url) {
1433
- t31 = /*#__PURE__*/jsx(ResourceItemsList, {
1434
- resource: resource,
1435
- baseUrl: url,
1436
- query: listQuery,
1437
- paginated: paginated,
1438
- onQueryChange: onQueryChange,
1439
- onQueryReset: onQueryReset,
1440
- theme: theme,
1441
- actionsProps: t30
1442
- });
1443
- $[53] = listQuery;
1444
- $[54] = onQueryChange;
1445
- $[55] = onQueryReset;
1446
- $[56] = paginated;
1447
- $[57] = resource;
1448
- $[58] = t30;
1449
- $[59] = theme;
1450
- $[60] = url;
1451
- $[61] = t31;
1452
- } else {
1453
- t31 = $[61];
1454
- }
1455
- let t32;
1456
- if ($[62] !== t27 || $[63] !== t28 || $[64] !== t31) {
1457
- t32 = /*#__PURE__*/jsxs("div", {
1458
- className: t26,
1459
- children: [t27, t28, t31]
1460
- });
1461
- $[62] = t27;
1462
- $[63] = t28;
1463
- $[64] = t31;
1464
- $[65] = t32;
1465
- } else {
1466
- t32 = $[65];
1467
- }
1468
- let t33;
1469
- if ($[66] !== t25 || $[67] !== t32) {
1470
- t33 = /*#__PURE__*/jsxs(MainLayout, {
1471
- children: [t25, t32]
1472
- });
1473
- $[66] = t25;
1474
- $[67] = t32;
1475
- $[68] = t33;
1476
- } else {
1477
- t33 = $[68];
1478
- }
1479
- let t34;
1480
- if ($[69] !== resource || $[70] !== t33) {
1481
- t34 = /*#__PURE__*/jsx(ResourceProvider, {
1482
- resource: resource,
1483
- children: t33
1484
- });
1485
- $[69] = resource;
1486
- $[70] = t33;
1487
- $[71] = t34;
1488
- } else {
1489
- t34 = $[71];
1490
- }
1491
- return t34;
1492
- }
1493
- function _temp$3(it_0) {
1494
- return it_0 === "create" ? {
1495
- id: "create",
1496
- component: ResourceCreateButton,
1497
- size: "md",
1498
- theme: "primary"
1499
- } : it_0;
1500
- }
1501
-
1502
- function ResourceShowPage(t0) {
1503
- const $ = c(19);
1504
- const {
1505
- resource,
1506
- itemId
1507
- } = t0;
1508
- const {
1509
- name
1510
- } = resource;
1511
- const {
1512
- item,
1513
- isLoading,
1514
- error
1515
- } = useResourceItem(resource, itemId);
1516
- let t1;
1517
- if ($[0] !== item) {
1518
- t1 = item || {};
1519
- $[0] = item;
1520
- $[1] = t1;
1521
- } else {
1522
- t1 = $[1];
1523
- }
1524
- const {
1525
- type: t2
1526
- } = t1;
1527
- const type = t2 === undefined ? null : t2;
1528
- let t3;
1529
- if ($[2] !== item || $[3] !== itemId || $[4] !== name || $[5] !== resource || $[6] !== type) {
1530
- t3 = item !== null ? /*#__PURE__*/jsx(ResourceFormWrapper, {
1531
- resource: resource,
1532
- item: item,
1533
- type: type,
1534
- disabled: true,
1535
- header: /*#__PURE__*/jsx(PageHeader, {
1536
- title: `${name} #${itemId}`,
1537
- small: true
1538
- }),
1539
- withContainer: true
1540
- }) : null;
1541
- $[2] = item;
1542
- $[3] = itemId;
1543
- $[4] = name;
1544
- $[5] = resource;
1545
- $[6] = type;
1546
- $[7] = t3;
1547
- } else {
1548
- t3 = $[7];
1549
- }
1550
- let t4;
1551
- if ($[8] !== error || $[9] !== isLoading || $[10] !== item) {
1552
- t4 = item === null && isLoading && !error ? /*#__PURE__*/jsx(Loading, {
1553
- className: "mw-25 my-4 m-auto",
1554
- withDelay: true,
1555
- children: /*#__PURE__*/jsx(FormattedMessage, {
1556
- id: "TV3jir"
1557
- })
1558
- }) : null;
1559
- $[8] = error;
1560
- $[9] = isLoading;
1561
- $[10] = item;
1562
- $[11] = t4;
1563
- } else {
1564
- t4 = $[11];
1565
- }
1566
- let t5;
1567
- if ($[12] !== isLoading || $[13] !== t3 || $[14] !== t4) {
1568
- t5 = /*#__PURE__*/jsxs(MainLayout, {
1569
- loading: isLoading,
1570
- children: [t3, t4]
1571
- });
1572
- $[12] = isLoading;
1573
- $[13] = t3;
1574
- $[14] = t4;
1575
- $[15] = t5;
1576
- } else {
1577
- t5 = $[15];
1578
- }
1579
- let t6;
1580
- if ($[16] !== resource || $[17] !== t5) {
1581
- t6 = /*#__PURE__*/jsx(ResourceProvider, {
1582
- resource: resource,
1583
- children: t5
1584
- });
1585
- $[16] = resource;
1586
- $[17] = t5;
1587
- $[18] = t6;
1588
- } else {
1589
- t6 = $[18];
1590
- }
1591
- return t6;
1592
- }
1593
-
1594
- function ResourceDuplicatePage(t0) {
1595
- const $ = c(22);
1596
- const {
1597
- itemId,
1598
- resource
1599
- } = t0;
1600
- const [, navigate] = useLocation();
1601
- const resourceRoute = useResourceUrlGenerator(resource);
1602
- const {
1603
- item,
1604
- isLoading,
1605
- error
1606
- } = useResourceItem(resource, itemId);
1607
- let t1;
1608
- if ($[0] !== item) {
1609
- t1 = item || {};
1610
- $[0] = item;
1611
- $[1] = t1;
1612
- } else {
1613
- t1 = $[1];
1614
- }
1615
- const {
1616
- type: t2
1617
- } = t1;
1618
- const type = t2 === undefined ? null : t2;
1619
- const resourceValues = useResourceValues(resource);
1620
- const typeName = useResourceTypeName(resource, type);
1621
- let t3;
1622
- if ($[2] !== navigate || $[3] !== resourceRoute) {
1623
- t3 = t4 => {
1624
- const {
1625
- id: t5
1626
- } = t4 === undefined ? {} : t4;
1627
- const id = t5 === undefined ? null : t5;
1628
- return navigate(`${resourceRoute("edit", {
1629
- id
1630
- })}?duplicated=true`);
1631
- };
1632
- $[2] = navigate;
1633
- $[3] = resourceRoute;
1634
- $[4] = t3;
1635
- } else {
1636
- t3 = $[4];
1637
- }
1638
- const onComplete = t3;
1639
- let t4;
1640
- if ($[5] !== item || $[6] !== onComplete || $[7] !== resource || $[8] !== resourceValues || $[9] !== typeName) {
1641
- t4 = item !== null ? /*#__PURE__*/jsx(ResourceFormWrapper, {
1642
- resource: resource,
1643
- item: item,
1644
- onComplete: onComplete,
1645
- isDuplicate: true,
1646
- withContainer: true,
1647
- header: /*#__PURE__*/jsx(PageHeader, {
1648
- title: /*#__PURE__*/jsxs(Fragment, {
1649
- children: [/*#__PURE__*/jsx(FormattedMessage, {
1650
- id: "G7M4nI",
1651
- values: resourceValues
1652
- }), typeName !== null ? /*#__PURE__*/jsxs("span", {
1653
- className: "text-body-secondary",
1654
- children: [" ", "(", typeName, ")"]
1655
- }) : null]
1656
- }),
1657
- small: true
1658
- })
1659
- }) : null;
1660
- $[5] = item;
1661
- $[6] = onComplete;
1662
- $[7] = resource;
1663
- $[8] = resourceValues;
1664
- $[9] = typeName;
1665
- $[10] = t4;
1666
- } else {
1667
- t4 = $[10];
1668
- }
1669
- let t5;
1670
- if ($[11] !== error || $[12] !== isLoading || $[13] !== item) {
1671
- t5 = item === null && isLoading && !error ? /*#__PURE__*/jsx(Loading, {
1672
- className: "mw-25 my-4 m-auto",
1673
- withDelay: true,
1674
- children: /*#__PURE__*/jsx(FormattedMessage, {
1675
- id: "TV3jir"
1676
- })
1677
- }) : null;
1678
- $[11] = error;
1679
- $[12] = isLoading;
1680
- $[13] = item;
1681
- $[14] = t5;
1682
- } else {
1683
- t5 = $[14];
1684
- }
1685
- let t6;
1686
- if ($[15] !== isLoading || $[16] !== t4 || $[17] !== t5) {
1687
- t6 = /*#__PURE__*/jsxs(MainLayout, {
1688
- loading: isLoading,
1689
- children: [t4, t5]
1690
- });
1691
- $[15] = isLoading;
1692
- $[16] = t4;
1693
- $[17] = t5;
1694
- $[18] = t6;
1695
- } else {
1696
- t6 = $[18];
1697
- }
1698
- let t7;
1699
- if ($[19] !== resource || $[20] !== t6) {
1700
- t7 = /*#__PURE__*/jsx(ResourceProvider, {
1701
- resource: resource,
1702
- children: t6
1703
- });
1704
- $[19] = resource;
1705
- $[20] = t6;
1706
- $[21] = t7;
1707
- } else {
1708
- t7 = $[21];
1709
- }
1710
- return t7;
1711
- }
1712
-
1713
- function ResourceLink(t0) {
1714
- const $ = c(6);
1715
- const {
1716
- resource
1717
- } = t0;
1718
- const route = useUrlGenerator();
1719
- const {
1720
- id: resourceId
1721
- } = resource || {};
1722
- const resourceValues = useResourceValues(resource);
1723
- const T0 = Link;
1724
- const t1 = "d-block my-2";
1725
- const t2 = route("resources.index", {
1726
- resource: resourceId
1727
- });
1728
- let t3;
1729
- if ($[0] !== resourceValues) {
1730
- t3 = /*#__PURE__*/jsx(FormattedMessage, {
1731
- id: "FntHPK",
1732
- values: resourceValues
1733
- });
1734
- $[0] = resourceValues;
1735
- $[1] = t3;
1736
- } else {
1737
- t3 = $[1];
1738
- }
1739
- let t4;
1740
- if ($[2] !== T0 || $[3] !== t2 || $[4] !== t3) {
1741
- t4 = /*#__PURE__*/jsx(T0, {
1742
- className: t1,
1743
- href: t2,
1744
- children: t3
1745
- });
1746
- $[2] = T0;
1747
- $[3] = t2;
1748
- $[4] = t3;
1749
- $[5] = t4;
1750
- } else {
1751
- t4 = $[5];
1752
- }
1753
- return t4;
1754
- }
1755
- function HomePage() {
1756
- const $ = c(10);
1757
- const resources = usePanneauResources();
1758
- let T0;
1759
- let t0;
1760
- let t1;
1761
- if ($[0] !== resources) {
1762
- const visibleResources = resources.filter(_temp$2);
1763
- T0 = MainLayout;
1764
- t0 = "container-sm py-4";
1765
- t1 = visibleResources.map(_temp2$2);
1766
- $[0] = resources;
1767
- $[1] = T0;
1768
- $[2] = t0;
1769
- $[3] = t1;
1770
- } else {
1771
- T0 = $[1];
1772
- t0 = $[2];
1773
- t1 = $[3];
1774
- }
1775
- let t2;
1776
- if ($[4] !== t0 || $[5] !== t1) {
1777
- t2 = /*#__PURE__*/jsx("div", {
1778
- className: t0,
1779
- children: t1
1780
- });
1781
- $[4] = t0;
1782
- $[5] = t1;
1783
- $[6] = t2;
1784
- } else {
1785
- t2 = $[6];
1786
- }
1787
- let t3;
1788
- if ($[7] !== T0 || $[8] !== t2) {
1789
- t3 = /*#__PURE__*/jsx(T0, {
1790
- children: t2
1791
- });
1792
- $[7] = T0;
1793
- $[8] = t2;
1794
- $[9] = t3;
1795
- } else {
1796
- t3 = $[9];
1797
- }
1798
- return t3;
1799
- }
1800
- function _temp2$2(resource) {
1801
- const {
1802
- id: resourceId
1803
- } = resource || {};
1804
- return /*#__PURE__*/jsx(ResourceLink, {
1805
- resource: resource
1806
- }, `resource-link-${resourceId}`);
1807
- }
1808
- function _temp$2(t0) {
1809
- const {
1810
- settings: t1
1811
- } = t0;
1812
- const {
1813
- hideInNavbar: t2
1814
- } = t1 === undefined ? {} : t1;
1815
- const hideInNavbar = t2 === undefined ? false : t2;
1816
- return !hideInNavbar;
1817
- }
1818
-
1819
- function AccountPage() {
1820
- const $ = c(1);
1821
- let t0;
1822
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1823
- t0 = /*#__PURE__*/jsx(MainLayout, {
1824
- children: /*#__PURE__*/jsx("div", {
1825
- className: "container-sm py-4",
1826
- children: "Account page"
1827
- })
1828
- });
1829
- $[0] = t0;
1830
- } else {
1831
- t0 = $[0];
1832
- }
1833
- return t0;
1834
- }
1835
-
1836
- function LoginForm(t0) {
1837
- const $ = c(9);
1838
- const {
1839
- className: t1,
1840
- onComplete: t2
1841
- } = t0;
1842
- const className = t1 === undefined ? null : t1;
1843
- const onComplete = t2 === undefined ? null : t2;
1844
- const url = useUrlGenerator();
1845
- const {
1846
- login
1847
- } = useAuth();
1848
- let t3;
1849
- if ($[0] !== login) {
1850
- t3 = (action, t4) => {
1851
- const {
1852
- email,
1853
- password
1854
- } = t4;
1855
- return login(email, password);
1856
- };
1857
- $[0] = login;
1858
- $[1] = t3;
1859
- } else {
1860
- t3 = $[1];
1861
- }
1862
- const postForm = t3;
1863
- let t4;
1864
- if ($[2] !== url) {
1865
- t4 = url("auth.login");
1866
- $[2] = url;
1867
- $[3] = t4;
1868
- } else {
1869
- t4 = $[3];
1870
- }
1871
- let t5;
1872
- if ($[4] !== className || $[5] !== onComplete || $[6] !== postForm || $[7] !== t4) {
1873
- t5 = /*#__PURE__*/jsx(Form, {
1874
- type: "login",
1875
- action: t4,
1876
- postForm: postForm,
1877
- onComplete: onComplete,
1878
- className: className
1879
- });
1880
- $[4] = className;
1881
- $[5] = onComplete;
1882
- $[6] = postForm;
1883
- $[7] = t4;
1884
- $[8] = t5;
1885
- } else {
1886
- t5 = $[8];
1887
- }
1888
- return t5;
1889
- }
1890
-
1891
- function GuestLayout(t0) {
1892
- const $ = c(19);
1893
- const {
1894
- fullscreen: t1,
1895
- children
1896
- } = t0;
1897
- const fullscreen = t1 === undefined ? false : t1;
1898
- const {
1899
- theme: t2,
1900
- background: t3,
1901
- text: t4
1902
- } = usePanneauColorScheme();
1903
- const theme = t2 === undefined ? null : t2;
1904
- const background = t3 === undefined ? null : t3;
1905
- const text = t4 === undefined ? null : t4;
1906
- let t5;
1907
- if ($[0] !== fullscreen) {
1908
- t5 = classNames([{
1909
- "d-flex flex-column min-vh-100": fullscreen
1910
- }]);
1911
- $[0] = fullscreen;
1912
- $[1] = t5;
1913
- } else {
1914
- t5 = $[1];
1915
- }
1916
- const t6 = theme !== null ? theme : undefined;
1917
- let t7;
1918
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1919
- t7 = /*#__PURE__*/jsx(MainNavbar, {
1920
- className: classNames(["sticky-top", "px-3"])
1921
- });
1922
- $[2] = t7;
1923
- } else {
1924
- t7 = $[2];
1925
- }
1926
- let t8;
1927
- if ($[3] !== background || $[4] !== fullscreen || $[5] !== text) {
1928
- t8 = classNames([{
1929
- "d-flex flex-column flex-grow-1": fullscreen
1930
- }, background !== null ? `bg-${background}` : null, text !== null ? `text-${text}` : null]);
1931
- $[3] = background;
1932
- $[4] = fullscreen;
1933
- $[5] = text;
1934
- $[6] = t8;
1935
- } else {
1936
- t8 = $[6];
1937
- }
1938
- let t9;
1939
- if ($[7] !== fullscreen) {
1940
- t9 = classNames({
1941
- "w-100 my-auto": fullscreen
1942
- });
1943
- $[7] = fullscreen;
1944
- $[8] = t9;
1945
- } else {
1946
- t9 = $[8];
1947
- }
1948
- let t10;
1949
- if ($[9] !== children || $[10] !== t9) {
1950
- t10 = /*#__PURE__*/jsx("div", {
1951
- className: t9,
1952
- children: children
1953
- });
1954
- $[9] = children;
1955
- $[10] = t9;
1956
- $[11] = t10;
1957
- } else {
1958
- t10 = $[11];
1959
- }
1960
- let t11;
1961
- if ($[12] !== t10 || $[13] !== t8) {
1962
- t11 = /*#__PURE__*/jsx("div", {
1963
- className: t8,
1964
- children: t10
1965
- });
1966
- $[12] = t10;
1967
- $[13] = t8;
1968
- $[14] = t11;
1969
- } else {
1970
- t11 = $[14];
1971
- }
1972
- let t12;
1973
- if ($[15] !== t11 || $[16] !== t5 || $[17] !== t6) {
1974
- t12 = /*#__PURE__*/jsxs("div", {
1975
- className: t5,
1976
- "data-bs-theme": t6,
1977
- children: [t7, t11]
1978
- });
1979
- $[15] = t11;
1980
- $[16] = t5;
1981
- $[17] = t6;
1982
- $[18] = t12;
1983
- } else {
1984
- t12 = $[18];
1985
- }
1986
- return t12;
1987
- }
1988
-
1989
- function getLink(link, defaultLink) {
1990
- if (typeof link === 'string') {
1991
- return link;
1992
- }
1993
- return link === true ? defaultLink : null;
1994
- }
1995
- function LoginPage() {
1996
- const $ = c(15);
1997
- const route = useUrlGenerator();
1998
- const {
1999
- forgotPassword,
2000
- register
2001
- } = usePanneauAuth();
2002
- let t0;
2003
- if ($[0] !== forgotPassword) {
2004
- t0 = getLink(forgotPassword, "/forgot-password");
2005
- $[0] = forgotPassword;
2006
- $[1] = t0;
2007
- } else {
2008
- t0 = $[1];
2009
- }
2010
- const forgotPasswordLink = t0;
2011
- let t1;
2012
- if ($[2] !== register) {
2013
- t1 = getLink(register, "/register");
2014
- $[2] = register;
2015
- $[3] = t1;
2016
- } else {
2017
- t1 = $[3];
2018
- }
2019
- const registerLink = t1;
2020
- let t2;
2021
- if ($[4] !== route) {
2022
- t2 = () => {
2023
- window.location.href = route("home");
2024
- };
2025
- $[4] = route;
2026
- $[5] = t2;
2027
- } else {
2028
- t2 = $[5];
2029
- }
2030
- const onComplete = t2;
2031
- let t3;
2032
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
2033
- t3 = /*#__PURE__*/jsx("h1", {
2034
- className: "mb-4",
2035
- children: /*#__PURE__*/jsx(FormattedMessage, {
2036
- id: "AeOZq+"
2037
- })
2038
- });
2039
- $[6] = t3;
2040
- } else {
2041
- t3 = $[6];
2042
- }
2043
- let t4;
2044
- if ($[7] !== onComplete) {
2045
- t4 = /*#__PURE__*/jsx(LoginForm, {
2046
- onComplete: onComplete
2047
- });
2048
- $[7] = onComplete;
2049
- $[8] = t4;
2050
- } else {
2051
- t4 = $[8];
2052
- }
2053
- let t5;
2054
- if ($[9] !== forgotPasswordLink || $[10] !== registerLink) {
2055
- t5 = forgotPasswordLink !== null || registerLink !== null ? /*#__PURE__*/jsxs("div", {
2056
- className: "d-flex flex-wrap gap-3 mt-4",
2057
- children: [forgotPasswordLink !== null ? /*#__PURE__*/jsx(Link, {
2058
- href: forgotPasswordLink,
2059
- external: true,
2060
- target: "_self",
2061
- children: /*#__PURE__*/jsx(FormattedMessage, {
2062
- id: "ZBNqY2"
2063
- })
2064
- }) : null, registerLink !== null ? /*#__PURE__*/jsx(Link, {
2065
- href: registerLink,
2066
- external: true,
2067
- target: "_self",
2068
- children: /*#__PURE__*/jsx(FormattedMessage, {
2069
- id: "PQX/ph"
2070
- })
2071
- }) : null]
2072
- }) : null;
2073
- $[9] = forgotPasswordLink;
2074
- $[10] = registerLink;
2075
- $[11] = t5;
2076
- } else {
2077
- t5 = $[11];
2078
- }
2079
- let t6;
2080
- if ($[12] !== t4 || $[13] !== t5) {
2081
- t6 = /*#__PURE__*/jsx(GuestLayout, {
2082
- fullscreen: true,
2083
- children: /*#__PURE__*/jsx("div", {
2084
- className: "container-sm py-4",
2085
- children: /*#__PURE__*/jsx("div", {
2086
- className: "row justify-content-center",
2087
- children: /*#__PURE__*/jsxs("div", {
2088
- className: "col-12 col-sm-8 col-md-6",
2089
- children: [t3, t4, t5]
2090
- })
2091
- })
2092
- })
2093
- });
2094
- $[12] = t4;
2095
- $[13] = t5;
2096
- $[14] = t6;
2097
- } else {
2098
- t6 = $[14];
2099
- }
2100
- return t6;
2101
- }
2102
-
2103
- function ErrorPage(t0) {
2104
- const $ = c(17);
2105
- const {
2106
- statusCode: t1
2107
- } = t0;
2108
- const statusCode = t1 === undefined ? null : t1;
2109
- const code = statusCode || 404;
2110
- let t2;
2111
- bb0: switch (code) {
2112
- case 401:
2113
- {
2114
- let t3;
2115
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2116
- t3 = /*#__PURE__*/jsx(FormattedMessage, {
2117
- id: "6nwWPR"
2118
- });
2119
- $[0] = t3;
2120
- } else {
2121
- t3 = $[0];
2122
- }
2123
- t2 = t3;
2124
- break bb0;
2125
- }
2126
- case 403:
2127
- {
2128
- let t3;
2129
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
2130
- t3 = /*#__PURE__*/jsx(FormattedMessage, {
2131
- id: "Pih2UO"
2132
- });
2133
- $[1] = t3;
2134
- } else {
2135
- t3 = $[1];
2136
- }
2137
- t2 = t3;
2138
- break bb0;
2139
- }
2140
- case 404:
2141
- {
2142
- let t3;
2143
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
2144
- t3 = /*#__PURE__*/jsx(FormattedMessage, {
2145
- id: "6Ie+vL"
2146
- });
2147
- $[2] = t3;
2148
- } else {
2149
- t3 = $[2];
2150
- }
2151
- t2 = t3;
2152
- break bb0;
2153
- }
2154
- case 500:
2155
- {
2156
- let t3;
2157
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
2158
- t3 = /*#__PURE__*/jsx(FormattedMessage, {
2159
- id: "owrRHV"
2160
- });
2161
- $[3] = t3;
2162
- } else {
2163
- t3 = $[3];
2164
- }
2165
- t2 = t3;
2166
- break bb0;
2167
- }
2168
- default:
2169
- {
2170
- let t3;
2171
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
2172
- t3 = /*#__PURE__*/jsx(FormattedMessage, {
2173
- id: "6Ie+vL"
2174
- });
2175
- $[4] = t3;
2176
- } else {
2177
- t3 = $[4];
2178
- }
2179
- t2 = t3;
2180
- }
2181
- }
2182
- const title = t2;
2183
- let t3;
2184
- bb1: switch (code) {
2185
- case 401:
2186
- {
2187
- let t4;
2188
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
2189
- t4 = /*#__PURE__*/jsx(FormattedMessage, {
2190
- id: "82P2dS"
2191
- });
2192
- $[5] = t4;
2193
- } else {
2194
- t4 = $[5];
2195
- }
2196
- t3 = t4;
2197
- break bb1;
2198
- }
2199
- case 403:
2200
- {
2201
- let t4;
2202
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
2203
- t4 = /*#__PURE__*/jsx(FormattedMessage, {
2204
- id: "8HFiMs"
2205
- });
2206
- $[6] = t4;
2207
- } else {
2208
- t4 = $[6];
2209
- }
2210
- t3 = t4;
2211
- break bb1;
2212
- }
2213
- case 404:
2214
- {
2215
- let t4;
2216
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
2217
- t4 = /*#__PURE__*/jsx(FormattedMessage, {
2218
- id: "naie2b"
2219
- });
2220
- $[7] = t4;
2221
- } else {
2222
- t4 = $[7];
2223
- }
2224
- t3 = t4;
2225
- break bb1;
2226
- }
2227
- case 500:
2228
- {
2229
- let t4;
2230
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
2231
- t4 = /*#__PURE__*/jsx(FormattedMessage, {
2232
- id: "yALN2p"
2233
- });
2234
- $[8] = t4;
2235
- } else {
2236
- t4 = $[8];
2237
- }
2238
- t3 = t4;
2239
- break bb1;
2240
- }
2241
- default:
2242
- {
2243
- let t4;
2244
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
2245
- t4 = /*#__PURE__*/jsx(FormattedMessage, {
2246
- id: "naie2b"
2247
- });
2248
- $[9] = t4;
2249
- } else {
2250
- t4 = $[9];
2251
- }
2252
- t3 = t4;
2253
- }
2254
- }
2255
- const description = t3;
2256
- let t4;
2257
- if ($[10] !== title) {
2258
- t4 = /*#__PURE__*/jsx("h1", {
2259
- children: title
2260
- });
2261
- $[10] = title;
2262
- $[11] = t4;
2263
- } else {
2264
- t4 = $[11];
2265
- }
2266
- let t5;
2267
- if ($[12] !== description) {
2268
- t5 = /*#__PURE__*/jsx("p", {
2269
- children: description
2270
- });
2271
- $[12] = description;
2272
- $[13] = t5;
2273
- } else {
2274
- t5 = $[13];
2275
- }
2276
- let t6;
2277
- if ($[14] !== t4 || $[15] !== t5) {
2278
- t6 = /*#__PURE__*/jsx(GuestLayout, {
2279
- fullscreen: true,
2280
- children: /*#__PURE__*/jsx("div", {
2281
- className: "container-sm py-4",
2282
- children: /*#__PURE__*/jsx("div", {
2283
- className: "row justify-content-center",
2284
- children: /*#__PURE__*/jsxs("div", {
2285
- className: "col-12 col-sm-8 col-md-6",
2286
- children: [t4, t5]
2287
- })
2288
- })
2289
- })
2290
- });
2291
- $[14] = t4;
2292
- $[15] = t5;
2293
- $[16] = t6;
2294
- } else {
2295
- t6 = $[16];
2296
- }
2297
- return t6;
2298
- }
2299
-
2300
- function createResourceRoutes(resource, {
2301
- route,
2302
- componentsManager,
2303
- pages = {}
2304
- }) {
2305
- const {
2306
- id: resourceId,
2307
- pages: resourcePages = {},
2308
- extraRoutes = []
2309
- } = resource;
2310
-
2311
- // Resolution order: resource typed key (`pages.show`), resource legacy key
2312
- // (`pages.resourceShowPage`), panneau typed key (`pages.show`), panneau legacy key
2313
- // (`pages.showPage`), then the built-in page
2314
- const ResourceIndexComponent = componentsManager.getComponent(resourcePages?.index?.component) || componentsManager.getComponent(resourcePages?.resourceIndexPage?.component) || componentsManager.getComponent(pages?.index?.component) || componentsManager.getComponent(pages?.indexPage?.component) || ResourceIndexPage;
2315
- const ResourceShowComponent = componentsManager.getComponent(resourcePages?.show?.component) || componentsManager.getComponent(resourcePages?.resourceShowPage?.component) || componentsManager.getComponent(pages?.show?.component) || componentsManager.getComponent(pages?.showPage?.component) || ResourceShowPage;
2316
- const ResourceCreateComponent = componentsManager.getComponent(resourcePages?.create?.component) || componentsManager.getComponent(resourcePages?.resourceCreatePage?.component) || componentsManager.getComponent(pages?.create?.component) || componentsManager.getComponent(pages?.createPage?.component) || ResourceCreatePage;
2317
- const ResourceEditComponent = componentsManager.getComponent(resourcePages?.edit?.component) || componentsManager.getComponent(resourcePages?.resourceEditPage?.component) || componentsManager.getComponent(pages?.edit?.component) || componentsManager.getComponent(pages?.editPage?.component) || ResourceEditPage;
2318
- const ResourceDeleteComponent = componentsManager.getComponent(resourcePages?.delete?.component) || componentsManager.getComponent(resourcePages?.resourceDeletePage?.component) || componentsManager.getComponent(pages?.delete?.component) || componentsManager.getComponent(pages?.deletePage?.component) || ResourceDeletePage;
2319
- const ResourceDuplicateComponent = componentsManager.getComponent(resourcePages?.duplicate?.component) || componentsManager.getComponent(resourcePages?.resourceDuplicatePage?.component) || componentsManager.getComponent(pages?.duplicate?.component) || componentsManager.getComponent(pages?.duplicatePage?.component) || ResourceDuplicatePage;
2320
-
2321
- // Extra routes are registered first so they are not shadowed by the
2322
- // generic `/:resource/:id` show route
2323
- const extraRoutesElements = extraRoutes.map(({
2324
- path,
2325
- component,
2326
- ...pageProps
2327
- }) => {
2328
- const RouteComponent = componentsManager.getComponent(component);
2329
- return RouteComponent !== null ? /*#__PURE__*/jsx(Route, {
2330
- path: path,
2331
- children: () => /*#__PURE__*/jsx(RouteComponent, {
2332
- resource: resource,
2333
- ...pageProps
2334
- })
2335
- }, `route-${path}`) : null;
2336
- });
2337
- return [...extraRoutesElements, /*#__PURE__*/jsx(Route, {
2338
- path: route('resources.create', {
2339
- resource: resourceId
2340
- }),
2341
- children: () => /*#__PURE__*/jsx(ResourceCreateComponent, {
2342
- resource: resource
2343
- })
2344
- }, `${resourceId}-create`), /*#__PURE__*/jsx(Route, {
2345
- path: route('resources.show', {
2346
- resource: resourceId,
2347
- id: ':id'
2348
- }),
2349
- children: ({
2350
- id = null
2351
- }) => /*#__PURE__*/jsx(ResourceShowComponent, {
2352
- itemId: id,
2353
- resource: resource
2354
- })
2355
- }, `${resourceId}-show`), /*#__PURE__*/jsx(Route, {
2356
- path: route('resources.edit', {
2357
- resource: resourceId,
2358
- id: ':id'
2359
- }),
2360
- children: ({
2361
- id = null
2362
- }) => /*#__PURE__*/jsx(ResourceEditComponent, {
2363
- itemId: id,
2364
- resource: resource
2365
- })
2366
- }, `${resourceId}-edit`), /*#__PURE__*/jsx(Route, {
2367
- path: route('resources.delete', {
2368
- resource: resourceId,
2369
- id: ':id'
2370
- }),
2371
- children: ({
2372
- id = null
2373
- }) => /*#__PURE__*/jsx(ResourceDeleteComponent, {
2374
- itemId: id,
2375
- resource: resource
2376
- })
2377
- }, `${resourceId}-delete`), /*#__PURE__*/jsx(Route, {
2378
- path: route('resources.duplicate', {
2379
- resource: resourceId,
2380
- id: ':id'
2381
- }),
2382
- children: ({
2383
- id = null
2384
- }) => /*#__PURE__*/jsx(ResourceDuplicateComponent, {
2385
- itemId: id,
2386
- resource: resource
2387
- })
2388
- }, `${resourceId}-duplicate`), /*#__PURE__*/jsx(Route, {
2389
- path: route('resources.index', {
2390
- resource: resourceId
2391
- }),
2392
- children: () => /*#__PURE__*/jsx(ResourceIndexComponent, {
2393
- resource: resource
2394
- })
2395
- }, `${resourceId}-index`)];
2396
- }
2397
-
2398
- function PanneauRoutes(t0) {
2399
- const $ = c(22);
2400
- const {
2401
- statusCode: t1
2402
- } = t0;
2403
- const initialStatusCode = t1 === undefined ? null : t1;
2404
- const routes = useRoutes();
2405
- const [pathname] = useLocation();
2406
- let t2;
2407
- if ($[0] !== initialStatusCode || $[1] !== pathname) {
2408
- t2 = {
2409
- statusCode: initialStatusCode,
2410
- pathname
2411
- };
2412
- $[0] = initialStatusCode;
2413
- $[1] = pathname;
2414
- $[2] = t2;
2415
- } else {
2416
- t2 = $[2];
2417
- }
2418
- const [initialRequest, setInitialRequest] = useState(t2);
2419
- const {
2420
- statusCode,
2421
- pathname: lastPathname
2422
- } = initialRequest;
2423
- const user = useUser();
2424
- const route = useUrlGenerator();
2425
- const resources = usePanneauResources();
2426
- const componentsManager = usePagesComponentsManager();
2427
- let t3;
2428
- let t4;
2429
- if ($[3] !== lastPathname || $[4] !== pathname) {
2430
- t3 = () => {
2431
- if (pathname !== lastPathname) {
2432
- setInitialRequest({
2433
- pathname,
2434
- statusCode: null
2435
- });
2436
- }
2437
- };
2438
- t4 = [pathname, lastPathname];
2439
- $[3] = lastPathname;
2440
- $[4] = pathname;
2441
- $[5] = t3;
2442
- $[6] = t4;
2443
- } else {
2444
- t3 = $[5];
2445
- t4 = $[6];
2446
- }
2447
- useEffect(t3, t4);
2448
- const {
2449
- pages: t5,
2450
- routes: t6
2451
- } = usePanneau() || {};
2452
- const pages = t5 === undefined ? null : t5;
2453
- const routesDefinition = t6 === undefined ? null : t6;
2454
- const builtinPages = ["home", "login", "account", "error", "index", "show", "create", "edit", "delete", "duplicate", "indexPage", "showPage", "createPage", "editPage", "deletePage", "duplicatePage"];
2455
- const otherPages = Object.keys(pages || {}).filter(key => builtinPages.indexOf(key) === -1).reduce((acc, key_0) => ({
2456
- ...acc,
2457
- [key_0]: pages[key_0]
2458
- }), {});
2459
- const {
2460
- home: t7,
2461
- login: t8,
2462
- account: t9,
2463
- error: t10
2464
- } = pages || {};
2465
- const homePage = t7 === undefined ? null : t7;
2466
- const loginPage = t8 === undefined ? null : t8;
2467
- const accountPage = t9 === undefined ? null : t9;
2468
- const errorPage = t10 === undefined ? null : t10;
2469
- const customRoutes = [...Object.keys(routesDefinition || {}).filter(_temp$1).filter(key_2 => {
2470
- const routeDef = routesDefinition[key_2];
2471
- return isObject(routeDef) && typeof routeDef.component !== "undefined" && typeof routeDef.path !== "undefined";
2472
- }).map(key_3 => routesDefinition[key_3]), ...Object.keys(otherPages).map(key_4 => otherPages[key_4]).filter(_temp2$1)];
2473
- const HomeComponent = componentsManager.getComponent(homePage?.component) || HomePage;
2474
- const LoginComponent = componentsManager.getComponent(loginPage?.component) || LoginPage;
2475
- const AccountComponent = componentsManager.getComponent(accountPage?.component) || AccountPage;
2476
- const ErrorComponent = componentsManager.getComponent(errorPage?.component) || ErrorPage;
2477
- if (statusCode !== null) {
2478
- return /*#__PURE__*/jsx(ErrorComponent, {
2479
- statusCode: statusCode,
2480
- ...errorPage
2481
- });
2482
- }
2483
- if (user === null) {
2484
- let t11;
2485
- if ($[7] !== route) {
2486
- t11 = route("auth.login");
2487
- $[7] = route;
2488
- $[8] = t11;
2489
- } else {
2490
- t11 = $[8];
2491
- }
2492
- const t12 = `${t11}?next=${encodeURIComponent(pathname)}`;
2493
- let t13;
2494
- if ($[9] !== t12) {
2495
- t13 = /*#__PURE__*/jsx(Route, {
2496
- children: /*#__PURE__*/jsx(Redirect, {
2497
- to: t12
2498
- })
2499
- });
2500
- $[9] = t12;
2501
- $[10] = t13;
2502
- } else {
2503
- t13 = $[10];
2504
- }
2505
- return /*#__PURE__*/jsxs(Switch, {
2506
- children: [/*#__PURE__*/jsx(Route, {
2507
- path: routes["auth.login"],
2508
- children: /*#__PURE__*/jsx(LoginComponent, {
2509
- ...loginPage
2510
- })
2511
- }), t13]
2512
- });
2513
- }
2514
- let t11;
2515
- if ($[11] !== routes || $[12] !== user) {
2516
- t11 = user !== null ? /*#__PURE__*/jsx(Route, {
2517
- path: routes["auth.login"],
2518
- children: /*#__PURE__*/jsx(Redirect, {
2519
- to: routes.home,
2520
- replace: true
2521
- })
2522
- }) : null;
2523
- $[11] = routes;
2524
- $[12] = user;
2525
- $[13] = t11;
2526
- } else {
2527
- t11 = $[13];
2528
- }
2529
- let t15;
2530
- if ($[14] !== HomeComponent || $[15] !== homePage) {
2531
- t15 = /*#__PURE__*/jsx(HomeComponent, {
2532
- ...homePage
2533
- });
2534
- $[14] = HomeComponent;
2535
- $[15] = homePage;
2536
- $[16] = t15;
2537
- } else {
2538
- t15 = $[16];
2539
- }
2540
- let t16;
2541
- if ($[17] !== routes.home || $[18] !== t15) {
2542
- t16 = /*#__PURE__*/jsx(Route, {
2543
- path: routes.home,
2544
- children: t15
2545
- });
2546
- $[17] = routes.home;
2547
- $[18] = t15;
2548
- $[19] = t16;
2549
- } else {
2550
- t16 = $[19];
2551
- }
2552
- let t17;
2553
- if ($[20] !== ErrorComponent) {
2554
- t17 = /*#__PURE__*/jsx(Route, {
2555
- children: /*#__PURE__*/jsx(ErrorComponent, {})
2556
- });
2557
- $[20] = ErrorComponent;
2558
- $[21] = t17;
2559
- } else {
2560
- t17 = $[21];
2561
- }
2562
- return /*#__PURE__*/jsxs(Switch, {
2563
- children: [t11, resources.reduce((acc_0, resource) => [...acc_0, ...createResourceRoutes(resource, {
2564
- route,
2565
- componentsManager,
2566
- pages
2567
- })], []), /*#__PURE__*/jsx(Route, {
2568
- path: routes.account,
2569
- children: /*#__PURE__*/jsx(AccountComponent, {
2570
- ...accountPage
2571
- })
2572
- }), customRoutes.map(t12 => {
2573
- const {
2574
- path: t13,
2575
- route: t14,
2576
- component,
2577
- ...props
2578
- } = t12;
2579
- const path_0 = t13 === undefined ? null : t13;
2580
- const pageRoute_0 = t14 === undefined ? null : t14;
2581
- const PageComponent = componentsManager.getComponent(component);
2582
- const finalPath = path_0 || routes[pageRoute_0];
2583
- return PageComponent !== null ? /*#__PURE__*/jsx(Route, {
2584
- path: path_0 || routes[pageRoute_0],
2585
- children: /*#__PURE__*/jsx(PageComponent, {
2586
- ...props
2587
- })
2588
- }, `custom-route-${finalPath}`) : null;
2589
- }), t16, t17]
2590
- });
2591
- }
2592
- function _temp2$1(t0) {
2593
- const {
2594
- path: t1,
2595
- route: t2
2596
- } = t0;
2597
- const path = t1 === undefined ? null : t1;
2598
- const pageRoute = t2 === undefined ? null : t2;
2599
- return path !== null || pageRoute !== null;
2600
- }
2601
- function _temp$1(key_1) {
2602
- return key_1.match(/^(resources\.|auth\.)/) === null && key_1 !== "home" && key_1 !== "account";
2603
- }
2604
-
2605
- const pathToRegexpParser = createPathToRegexpParser();
2606
- const DEFAULT_ROUTES = {};
2607
- const DEFAULT_LOCALES = [];
2608
- function Container(t0) {
2609
- const $ = c(65);
2610
- const {
2611
- definition,
2612
- forms: t1,
2613
- fields: t2,
2614
- components: t3,
2615
- user: t4,
2616
- memoryRouter: t5,
2617
- baseUrl: t6,
2618
- uppy: t7,
2619
- statusCode: t8
2620
- } = t0;
2621
- const providedForms = t1 === undefined ? null : t1;
2622
- const providedFields = t2 === undefined ? null : t2;
2623
- const components = t3 === undefined ? null : t3;
2624
- const user = t4 === undefined ? null : t4;
2625
- const memoryRouter = t5 === undefined ? false : t5;
2626
- const baseUrl = t6 === undefined ? null : t6;
2627
- const uppy = t7 === undefined ? null : t7;
2628
- const statusCode = t8 === undefined ? null : t8;
2629
- let fields;
2630
- let forms;
2631
- let isMemoryRouter;
2632
- let locale;
2633
- let locales;
2634
- let routes;
2635
- let t10;
2636
- let t9;
2637
- if ($[0] !== definition || $[1] !== memoryRouter) {
2638
- const {
2639
- intl: t11,
2640
- routes: t12,
2641
- resources: t13,
2642
- settings: t14,
2643
- forms: t15,
2644
- fields: t16
2645
- } = definition || {};
2646
- forms = t15;
2647
- fields = t16;
2648
- const {
2649
- locale: t17,
2650
- locales: t18,
2651
- messages
2652
- } = t11 === undefined ? {} : t11;
2653
- locale = t17 === undefined ? "en" : t17;
2654
- locales = t18 === undefined ? DEFAULT_LOCALES : t18;
2655
- routes = t12 === undefined ? DEFAULT_ROUTES : t12;
2656
- const resources = t13 === undefined ? [] : t13;
2657
- const {
2658
- memoryRouter: t19
2659
- } = t14 === undefined ? {} : t14;
2660
- const usesMemoryRouter = t19 === undefined ? false : t19;
2661
- isMemoryRouter = memoryRouter || usesMemoryRouter || false;
2662
- t9 = messages;
2663
- t10 = resources.reduce(_temp, {});
2664
- $[0] = definition;
2665
- $[1] = memoryRouter;
2666
- $[2] = fields;
2667
- $[3] = forms;
2668
- $[4] = isMemoryRouter;
2669
- $[5] = locale;
2670
- $[6] = locales;
2671
- $[7] = routes;
2672
- $[8] = t10;
2673
- $[9] = t9;
2674
- } else {
2675
- fields = $[2];
2676
- forms = $[3];
2677
- isMemoryRouter = $[4];
2678
- locale = $[5];
2679
- locales = $[6];
2680
- routes = $[7];
2681
- t10 = $[8];
2682
- t9 = $[9];
2683
- }
2684
- let t11;
2685
- if ($[10] !== t10 || $[11] !== t9) {
2686
- t11 = {
2687
- ...t9,
2688
- ...t10
2689
- };
2690
- $[10] = t10;
2691
- $[11] = t9;
2692
- $[12] = t11;
2693
- } else {
2694
- t11 = $[12];
2695
- }
2696
- const extraMessages = t11;
2697
- let t12;
2698
- if ($[13] !== baseUrl) {
2699
- t12 = () => {
2700
- window.location.href = baseUrl || "/";
2701
- };
2702
- $[13] = baseUrl;
2703
- $[14] = t12;
2704
- } else {
2705
- t12 = $[14];
2706
- }
2707
- const onUnauthorized = t12;
2708
- const onLogout = _temp2;
2709
- const {
2710
- hook: memoryLocationHook,
2711
- searchHook: memorySearchHook
2712
- } = useMemoryRouter();
2713
- const t13 = isMemoryRouter ? memoryLocationHook : undefined;
2714
- const t14 = isMemoryRouter ? memorySearchHook : undefined;
2715
- let t15;
2716
- if ($[15] !== fields) {
2717
- t15 = fields || [];
2718
- $[15] = fields;
2719
- $[16] = t15;
2720
- } else {
2721
- t15 = $[16];
2722
- }
2723
- let t16;
2724
- if ($[17] !== providedFields) {
2725
- t16 = providedFields || [];
2726
- $[17] = providedFields;
2727
- $[18] = t16;
2728
- } else {
2729
- t16 = $[18];
2730
- }
2731
- let t17;
2732
- if ($[19] !== t15 || $[20] !== t16) {
2733
- t17 = [...t15, ...t16];
2734
- $[19] = t15;
2735
- $[20] = t16;
2736
- $[21] = t17;
2737
- } else {
2738
- t17 = $[21];
2739
- }
2740
- let t18;
2741
- if ($[22] !== forms) {
2742
- t18 = forms || [];
2743
- $[22] = forms;
2744
- $[23] = t18;
2745
- } else {
2746
- t18 = $[23];
2747
- }
2748
- let t19;
2749
- if ($[24] !== providedForms) {
2750
- t19 = providedForms || [];
2751
- $[24] = providedForms;
2752
- $[25] = t19;
2753
- } else {
2754
- t19 = $[25];
2755
- }
2756
- let t20;
2757
- if ($[26] !== t18 || $[27] !== t19) {
2758
- t20 = [...t18, ...t19];
2759
- $[26] = t18;
2760
- $[27] = t19;
2761
- $[28] = t20;
2762
- } else {
2763
- t20 = $[28];
2764
- }
2765
- let t21;
2766
- if ($[29] !== statusCode) {
2767
- t21 = /*#__PURE__*/jsx(PanneauRoutes, {
2768
- statusCode: statusCode
2769
- });
2770
- $[29] = statusCode;
2771
- $[30] = t21;
2772
- } else {
2773
- t21 = $[30];
2774
- }
2775
- let t22;
2776
- if ($[31] !== components || $[32] !== t21) {
2777
- t22 = /*#__PURE__*/jsx(ComponentsProvider, {
2778
- components: components,
2779
- children: t21
2780
- });
2781
- $[31] = components;
2782
- $[32] = t21;
2783
- $[33] = t22;
2784
- } else {
2785
- t22 = $[33];
2786
- }
2787
- let t23;
2788
- if ($[34] !== t22 || $[35] !== user) {
2789
- t23 = /*#__PURE__*/jsx(AuthProvider, {
2790
- user: user,
2791
- onLogout: onLogout,
2792
- children: t22
2793
- });
2794
- $[34] = t22;
2795
- $[35] = user;
2796
- $[36] = t23;
2797
- } else {
2798
- t23 = $[36];
2799
- }
2800
- let t24;
2801
- if ($[37] !== baseUrl || $[38] !== onUnauthorized || $[39] !== t23) {
2802
- t24 = /*#__PURE__*/jsx(ListsProvider, {
2803
- children: /*#__PURE__*/jsx(DisplaysProvider, {
2804
- children: /*#__PURE__*/jsx(FiltersProvider, {
2805
- children: /*#__PURE__*/jsx(ActionsProvider, {
2806
- children: /*#__PURE__*/jsx(ModalProvider, {
2807
- children: /*#__PURE__*/jsx(ModalsProvider, {
2808
- children: /*#__PURE__*/jsx(DataProvider, {
2809
- baseUrl: baseUrl,
2810
- onUnauthorized: onUnauthorized,
2811
- children: t23
2812
- })
2813
- })
2814
- })
2815
- })
2816
- })
2817
- })
2818
- });
2819
- $[37] = baseUrl;
2820
- $[38] = onUnauthorized;
2821
- $[39] = t23;
2822
- $[40] = t24;
2823
- } else {
2824
- t24 = $[40];
2825
- }
2826
- let t25;
2827
- if ($[41] !== t20 || $[42] !== t24) {
2828
- t25 = /*#__PURE__*/jsx(FormsProvider, {
2829
- definitions: t20,
2830
- children: t24
2831
- });
2832
- $[41] = t20;
2833
- $[42] = t24;
2834
- $[43] = t25;
2835
- } else {
2836
- t25 = $[43];
2837
- }
2838
- let t26;
2839
- if ($[44] !== t17 || $[45] !== t25) {
2840
- t26 = /*#__PURE__*/jsx(FieldsProvider, {
2841
- definitions: t17,
2842
- children: t25
2843
- });
2844
- $[44] = t17;
2845
- $[45] = t25;
2846
- $[46] = t26;
2847
- } else {
2848
- t26 = $[46];
2849
- }
2850
- let t27;
2851
- if ($[47] !== routes || $[48] !== t26) {
2852
- t27 = /*#__PURE__*/jsx(RoutesProvider, {
2853
- routes: routes,
2854
- children: t26
2855
- });
2856
- $[47] = routes;
2857
- $[48] = t26;
2858
- $[49] = t27;
2859
- } else {
2860
- t27 = $[49];
2861
- }
2862
- let t28;
2863
- if ($[50] !== t27 || $[51] !== uppy) {
2864
- t28 = /*#__PURE__*/jsx(UppyProvider, {
2865
- ...uppy,
2866
- children: t27
2867
- });
2868
- $[50] = t27;
2869
- $[51] = uppy;
2870
- $[52] = t28;
2871
- } else {
2872
- t28 = $[52];
2873
- }
2874
- let t29;
2875
- if ($[53] !== definition || $[54] !== t28) {
2876
- t29 = /*#__PURE__*/jsx(PanneauProvider, {
2877
- definition: definition,
2878
- children: t28
2879
- });
2880
- $[53] = definition;
2881
- $[54] = t28;
2882
- $[55] = t29;
2883
- } else {
2884
- t29 = $[55];
2885
- }
2886
- let t30;
2887
- if ($[56] !== extraMessages || $[57] !== locale || $[58] !== locales || $[59] !== t29) {
2888
- t30 = /*#__PURE__*/jsx(IntlProvider, {
2889
- locale: locale,
2890
- locales: locales,
2891
- extraMessages: extraMessages,
2892
- children: t29
2893
- });
2894
- $[56] = extraMessages;
2895
- $[57] = locale;
2896
- $[58] = locales;
2897
- $[59] = t29;
2898
- $[60] = t30;
2899
- } else {
2900
- t30 = $[60];
2901
- }
2902
- let t31;
2903
- if ($[61] !== t13 || $[62] !== t14 || $[63] !== t30) {
2904
- t31 = /*#__PURE__*/jsx(Router, {
2905
- hook: t13,
2906
- searchHook: t14,
2907
- parser: pathToRegexpParser,
2908
- children: t30
2909
- });
2910
- $[61] = t13;
2911
- $[62] = t14;
2912
- $[63] = t30;
2913
- $[64] = t31;
2914
- } else {
2915
- t31 = $[64];
2916
- }
2917
- return t31;
2918
- }
2919
- function _temp2() {
2920
- window.location.reload();
2921
- }
2922
- function _temp(allMessages, t0) {
2923
- const {
2924
- id,
2925
- intl: t1
2926
- } = t0;
2927
- const {
2928
- messages: t2
2929
- } = t1 === undefined ? {} : t1;
2930
- const resourceMessages = t2 === undefined ? {} : t2;
2931
- return {
2932
- ...allMessages,
2933
- ...Object.keys(resourceMessages).reduce((allResourceMessages, key) => {
2934
- const messageKey = `resources.${id}.${key}`;
2935
- return {
2936
- ...allResourceMessages,
2937
- [messageKey]: resourceMessages[key]
2938
- };
2939
- }, {})
2940
- };
2941
- }
2942
-
2943
- function ResourceFilters(props) {
2944
- const $ = c(2);
2945
- let t0;
2946
- if ($[0] !== props) {
2947
- t0 = /*#__PURE__*/jsx(Filters, {
2948
- ...props
2949
- });
2950
- $[0] = props;
2951
- $[1] = t0;
2952
- } else {
2953
- t0 = $[1];
2954
- }
2955
- return t0;
2956
- }
2957
-
2958
- export { GuestLayout, MainLayout, PageHeader, ResourceFilters, ResourceFormWrapper as ResourceForm, ResourceItemsList, Container as default };
1
+ import { Panneau } from "./Panneau.js";
2
+ import { readBootConfig } from "./boot.js";
3
+ import { createPanneauApp } from "./createPanneauApp.js";
4
+ export { Panneau, createPanneauApp, readBootConfig };