@panneau/app 4.0.2 → 4.0.4
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/es/index.js +617 -507
- package/package.json +41 -41
package/es/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
3
3
|
import { useMemoryRouter, createPathToRegexpParser } from '@folklore/routes';
|
|
4
|
-
import
|
|
4
|
+
import { useCallback, useMemo, useState, useEffect, Fragment as Fragment$1 } from 'react';
|
|
5
5
|
import { useLocation, useSearch, Route, Switch, Redirect, Router } from 'wouter';
|
|
6
6
|
import ActionsProvider from '@panneau/actions';
|
|
7
7
|
import { useUser, useLogout, useAuth, AuthProvider } from '@panneau/auth';
|
|
@@ -19,6 +19,7 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
|
19
19
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
20
20
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
21
21
|
import isObject from 'lodash-es/isObject';
|
|
22
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
22
23
|
import classNames from 'classnames';
|
|
23
24
|
import isString from 'lodash-es/isString';
|
|
24
25
|
import queryString from 'query-string';
|
|
@@ -39,9 +40,8 @@ import ResourceForm from '@panneau/form-resource';
|
|
|
39
40
|
import { getComponentFromName } from '@panneau/core/utils';
|
|
40
41
|
import Filters from '@panneau/filter-filters';
|
|
41
42
|
|
|
42
|
-
// Kept for backward compatibility with exports
|
|
43
43
|
function ResourceFormWrapper(props) {
|
|
44
|
-
return /*#__PURE__*/
|
|
44
|
+
return /*#__PURE__*/jsx(ResourceForm, _objectSpread({}, props));
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
function AccountMenu(_ref) {
|
|
@@ -63,7 +63,7 @@ function AccountMenu(_ref) {
|
|
|
63
63
|
var items = useMemo(function () {
|
|
64
64
|
return user !== null ? [{
|
|
65
65
|
id: 'account',
|
|
66
|
-
label: /*#__PURE__*/
|
|
66
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
67
67
|
id: "IuqEHB",
|
|
68
68
|
defaultMessage: [{
|
|
69
69
|
"type": 0,
|
|
@@ -72,7 +72,7 @@ function AccountMenu(_ref) {
|
|
|
72
72
|
}),
|
|
73
73
|
href: route('account'),
|
|
74
74
|
dropdown: [].concat(_toConsumableArray(withAccountForm ? [{
|
|
75
|
-
label: /*#__PURE__*/
|
|
75
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
76
76
|
id: "V7Us0a",
|
|
77
77
|
defaultMessage: [{
|
|
78
78
|
"type": 0,
|
|
@@ -81,7 +81,7 @@ function AccountMenu(_ref) {
|
|
|
81
81
|
}),
|
|
82
82
|
href: route('account')
|
|
83
83
|
}] : []), [{
|
|
84
|
-
label: /*#__PURE__*/
|
|
84
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
85
85
|
id: "REIcPg",
|
|
86
86
|
defaultMessage: [{
|
|
87
87
|
"type": 0,
|
|
@@ -92,7 +92,7 @@ function AccountMenu(_ref) {
|
|
|
92
92
|
onClick: onClickLogout
|
|
93
93
|
}])
|
|
94
94
|
}] : [{
|
|
95
|
-
label: /*#__PURE__*/
|
|
95
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
96
96
|
id: "d0g58T",
|
|
97
97
|
defaultMessage: [{
|
|
98
98
|
"type": 0,
|
|
@@ -102,7 +102,7 @@ function AccountMenu(_ref) {
|
|
|
102
102
|
href: route('auth.login')
|
|
103
103
|
}];
|
|
104
104
|
}, [user, route, onClickLogout, withAccountForm]);
|
|
105
|
-
return items !== null ? /*#__PURE__*/
|
|
105
|
+
return items !== null ? /*#__PURE__*/jsx(Menu, {
|
|
106
106
|
className: className,
|
|
107
107
|
itemClassName: itemClassName,
|
|
108
108
|
linkClassName: linkClassName,
|
|
@@ -140,7 +140,7 @@ function ResourcesMenu(_ref) {
|
|
|
140
140
|
};
|
|
141
141
|
});
|
|
142
142
|
}, [resources, pathname, resourceRoute]);
|
|
143
|
-
return /*#__PURE__*/
|
|
143
|
+
return /*#__PURE__*/jsx(Menu, {
|
|
144
144
|
items: items,
|
|
145
145
|
className: className,
|
|
146
146
|
itemClassName: itemClassName,
|
|
@@ -180,53 +180,53 @@ function MainNavbar(_ref) {
|
|
|
180
180
|
return it !== null;
|
|
181
181
|
}).reduce(function (currentItems, item, index) {
|
|
182
182
|
if (item === 'resources') {
|
|
183
|
-
return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/
|
|
184
|
-
key: "menu-item-resource-".concat(index + 1),
|
|
183
|
+
return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/jsx(ResourcesMenu, {
|
|
185
184
|
className: navClassNames,
|
|
186
185
|
itemClassName: "nav-item",
|
|
187
186
|
linkClassName: "nav-link"
|
|
188
|
-
})]);
|
|
187
|
+
}, "menu-item-resource-".concat(index + 1))]);
|
|
189
188
|
}
|
|
190
189
|
if (item === 'account') {
|
|
191
|
-
return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/
|
|
192
|
-
key: "menu-item-account-".concat(index + 1),
|
|
190
|
+
return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/jsx(AccountMenu, {
|
|
193
191
|
className: navClassNames,
|
|
194
192
|
itemClassName: "nav-item",
|
|
195
193
|
linkClassName: "nav-link"
|
|
196
|
-
})]);
|
|
194
|
+
}, "menu-item-account-".concat(index + 1))]);
|
|
197
195
|
}
|
|
198
196
|
if (item === 'separator') {
|
|
199
|
-
return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/
|
|
200
|
-
key: "menu-item-spacer-".concat(index + 1),
|
|
197
|
+
return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/jsx("span", {
|
|
201
198
|
className: "ms-auto"
|
|
202
|
-
})]);
|
|
199
|
+
}, "menu-item-spacer-".concat(index + 1))]);
|
|
203
200
|
}
|
|
204
201
|
var lastItem = currentItems.length > 0 ? currentItems[currentItems.length - 1] : null;
|
|
205
202
|
return isArray(lastItem) ? [].concat(_toConsumableArray(currentItems.slice(0, currentItems.length - 1)), [[].concat(_toConsumableArray(lastItem), [item])]) : [].concat(_toConsumableArray(currentItems), [[item]]);
|
|
206
203
|
}, []).map(function (it, index) {
|
|
207
|
-
return isArray(it) ? /*#__PURE__*/
|
|
204
|
+
return isArray(it) ? /*#__PURE__*/jsx(Menu, {
|
|
208
205
|
items: it,
|
|
209
|
-
key: "submenu-item-".concat(index + 1),
|
|
210
206
|
className: navClassNames,
|
|
211
207
|
itemClassName: "nav-item",
|
|
212
208
|
linkClassName: "nav-link"
|
|
213
|
-
}) : it;
|
|
209
|
+
}, "submenu-item-".concat(index + 1)) : it;
|
|
214
210
|
});
|
|
215
211
|
}, [main, guest, user, navClassNames]);
|
|
216
|
-
return /*#__PURE__*/
|
|
212
|
+
return /*#__PURE__*/jsxs(Navbar, _objectSpread(_objectSpread({
|
|
217
213
|
theme: background,
|
|
218
214
|
loading: loading,
|
|
219
215
|
vertical: vertical,
|
|
220
216
|
className: className
|
|
221
|
-
}, props),
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
217
|
+
}, props), {}, {
|
|
218
|
+
children: [name !== null ? /*#__PURE__*/jsx(Link, {
|
|
219
|
+
href: route('home'),
|
|
220
|
+
className: "navbar-brand",
|
|
221
|
+
children: /*#__PURE__*/jsx("span", {
|
|
222
|
+
className: classNames([{
|
|
223
|
+
'text-opacity-75': loading,
|
|
224
|
+
'ms-2': vertical
|
|
225
|
+
}]),
|
|
226
|
+
children: name
|
|
227
|
+
})
|
|
228
|
+
}) : null, items]
|
|
229
|
+
}));
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
function MainLayout(_ref) {
|
|
@@ -246,35 +246,37 @@ function MainLayout(_ref) {
|
|
|
246
246
|
_usePanneauColorSchem5 = _usePanneauColorSchem.text,
|
|
247
247
|
text = _usePanneauColorSchem5 === void 0 ? null : _usePanneauColorSchem5;
|
|
248
248
|
var vertical = sidebarPosition === 'left' || sidebarPosition === 'right';
|
|
249
|
-
return /*#__PURE__*/
|
|
249
|
+
return /*#__PURE__*/jsxs("div", {
|
|
250
250
|
className: classNames(['d-flex', 'min-vh-100', {
|
|
251
251
|
'flex-column': !vertical
|
|
252
252
|
}]),
|
|
253
|
-
"data-bs-theme": theme !== null ? theme : undefined
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
253
|
+
"data-bs-theme": theme !== null ? theme : undefined,
|
|
254
|
+
children: [/*#__PURE__*/jsx(MainNavbar, {
|
|
255
|
+
className: classNames([{
|
|
256
|
+
'shadow-sm': !vertical,
|
|
257
|
+
'border-bottom': !vertical,
|
|
258
|
+
'sticky-top': !vertical,
|
|
259
|
+
'px-3': !vertical,
|
|
260
|
+
'pe-3': vertical && sidebarPosition === 'left',
|
|
261
|
+
'ps-3': vertical && sidebarPosition === 'right',
|
|
262
|
+
'me-2': vertical && sidebarPosition === 'left',
|
|
263
|
+
'ms-2': vertical && sidebarPosition === 'right'
|
|
264
|
+
// [styles.navbar]: true,
|
|
265
|
+
// [styles[sidebarPosition]]: sidebarPosition !== null,
|
|
266
|
+
// [styles.verticalNav]: vertical,
|
|
267
|
+
}]),
|
|
268
|
+
theme: theme,
|
|
269
|
+
loading: loading,
|
|
270
|
+
vertical: vertical
|
|
271
|
+
}), /*#__PURE__*/jsx("div", {
|
|
272
|
+
className: classNames(['flex-grow-1', _defineProperty(_defineProperty({
|
|
273
|
+
'd-flex flex-column': fullscreen
|
|
274
|
+
}, "bg-".concat(background), background !== null), "text-".concat(text), text !== null)]),
|
|
275
|
+
children: children
|
|
276
|
+
}), /*#__PURE__*/jsx(Modals, {
|
|
277
|
+
theme: theme
|
|
278
|
+
})]
|
|
279
|
+
});
|
|
278
280
|
}
|
|
279
281
|
|
|
280
282
|
function PageHeader(_ref) {
|
|
@@ -293,22 +295,31 @@ function PageHeader(_ref) {
|
|
|
293
295
|
var _usePanneauColorSchem = usePanneauColorScheme(),
|
|
294
296
|
text = _usePanneauColorSchem.text,
|
|
295
297
|
background = _usePanneauColorSchem.background;
|
|
296
|
-
var inner = /*#__PURE__*/
|
|
297
|
-
className: "d-flex align-items-center flex-wrap"
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
298
|
+
var inner = /*#__PURE__*/jsxs("div", {
|
|
299
|
+
className: "d-flex align-items-center flex-wrap",
|
|
300
|
+
children: [title !== null ? /*#__PURE__*/jsx("h1", {
|
|
301
|
+
className: classNames(['mb-0', 'h2']),
|
|
302
|
+
children: /*#__PURE__*/jsx(Label, {
|
|
303
|
+
children: title
|
|
304
|
+
})
|
|
305
|
+
}) : null, actions !== null ? /*#__PURE__*/jsx("div", {
|
|
306
|
+
className: "ms-auto",
|
|
307
|
+
children: actions
|
|
308
|
+
}) : null]
|
|
309
|
+
});
|
|
310
|
+
return /*#__PURE__*/jsxs("div", {
|
|
311
|
+
className: classNames(['py-4', _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "bg-".concat(background), background !== null), "text-".concat(text), text !== null), "border-bottom", background || text !== null), className, className !== null)]),
|
|
312
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
313
|
+
className: "container-sm",
|
|
314
|
+
children: small ? /*#__PURE__*/jsx("div", {
|
|
315
|
+
className: "row justify-content-center",
|
|
316
|
+
children: /*#__PURE__*/jsx("div", {
|
|
317
|
+
className: "col-12 col-md-8 col-lg-7",
|
|
318
|
+
children: inner
|
|
319
|
+
})
|
|
320
|
+
}) : inner
|
|
321
|
+
}), children]
|
|
322
|
+
});
|
|
312
323
|
}
|
|
313
324
|
|
|
314
325
|
function ResourceCreatePage(_ref) {
|
|
@@ -330,30 +341,36 @@ function ResourceCreatePage(_ref) {
|
|
|
330
341
|
var onSuccess = useCallback(function () {
|
|
331
342
|
navigate("".concat(resourceRoute('index'), "?created=true"));
|
|
332
343
|
}, [navigate, resourceRoute]);
|
|
333
|
-
return /*#__PURE__*/
|
|
334
|
-
resource: resource
|
|
335
|
-
}, /*#__PURE__*/React.createElement(MainLayout, null, /*#__PURE__*/React.createElement(ResourceFormWrapper, {
|
|
344
|
+
return /*#__PURE__*/jsx(ResourceProvider, {
|
|
336
345
|
resource: resource,
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
346
|
+
children: /*#__PURE__*/jsx(MainLayout, {
|
|
347
|
+
children: /*#__PURE__*/jsx(ResourceFormWrapper, {
|
|
348
|
+
resource: resource,
|
|
349
|
+
type: type,
|
|
350
|
+
onSuccess: onSuccess,
|
|
351
|
+
withContainer: true,
|
|
352
|
+
header: /*#__PURE__*/jsx(PageHeader, {
|
|
353
|
+
title: /*#__PURE__*/jsxs(Fragment, {
|
|
354
|
+
children: [/*#__PURE__*/jsx(FormattedMessage, {
|
|
355
|
+
values: resourceValues,
|
|
356
|
+
id: "6viUpq",
|
|
357
|
+
defaultMessage: [{
|
|
358
|
+
"type": 0,
|
|
359
|
+
"value": "Create "
|
|
360
|
+
}, {
|
|
361
|
+
"type": 1,
|
|
362
|
+
"value": "a_singular"
|
|
363
|
+
}]
|
|
364
|
+
}), typeName !== null ? /*#__PURE__*/jsxs("span", {
|
|
365
|
+
className: "text-body-secondary",
|
|
366
|
+
children: [" (", typeName, ")"]
|
|
367
|
+
}) : null]
|
|
368
|
+
}),
|
|
369
|
+
small: true
|
|
370
|
+
})
|
|
371
|
+
})
|
|
355
372
|
})
|
|
356
|
-
})
|
|
373
|
+
});
|
|
357
374
|
}
|
|
358
375
|
|
|
359
376
|
function ResourceDeletePage(_ref) {
|
|
@@ -375,41 +392,47 @@ function ResourceDeletePage(_ref) {
|
|
|
375
392
|
var onSuccess = useCallback(function () {
|
|
376
393
|
return navigate("".concat(resourceRoute('index'), "?deleted=true"));
|
|
377
394
|
}, [navigate, resourceRoute]);
|
|
378
|
-
return /*#__PURE__*/
|
|
379
|
-
resource: resource
|
|
380
|
-
}, /*#__PURE__*/React.createElement(MainLayout, {
|
|
381
|
-
loading: loading
|
|
382
|
-
}, item !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
|
|
395
|
+
return /*#__PURE__*/jsx(ResourceProvider, {
|
|
383
396
|
resource: resource,
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
397
|
+
children: /*#__PURE__*/jsxs(MainLayout, {
|
|
398
|
+
loading: loading,
|
|
399
|
+
children: [item !== null ? /*#__PURE__*/jsx(ResourceFormWrapper, {
|
|
400
|
+
resource: resource,
|
|
401
|
+
item: item,
|
|
402
|
+
onSuccess: onSuccess,
|
|
403
|
+
isDelete: true,
|
|
404
|
+
withContainer: true,
|
|
405
|
+
header: /*#__PURE__*/jsx(PageHeader, {
|
|
406
|
+
title: /*#__PURE__*/jsxs(Fragment, {
|
|
407
|
+
children: [/*#__PURE__*/jsx(FormattedMessage, {
|
|
408
|
+
values: resourceValues,
|
|
409
|
+
id: "zN5N/Q",
|
|
410
|
+
defaultMessage: [{
|
|
411
|
+
"type": 0,
|
|
412
|
+
"value": "Delete "
|
|
413
|
+
}, {
|
|
414
|
+
"type": 1,
|
|
415
|
+
"value": "a_singular"
|
|
416
|
+
}]
|
|
417
|
+
}), typeName !== null ? /*#__PURE__*/jsxs("span", {
|
|
418
|
+
className: "text-body-secondary",
|
|
419
|
+
children: [' ', "(", typeName, ")"]
|
|
420
|
+
}) : null]
|
|
421
|
+
}),
|
|
422
|
+
small: true
|
|
423
|
+
})
|
|
424
|
+
}) : null, item === null && loading && !error ? /*#__PURE__*/jsx(Loading, {
|
|
425
|
+
withDelay: true,
|
|
426
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
427
|
+
id: "TV3jir",
|
|
428
|
+
defaultMessage: [{
|
|
429
|
+
"type": 0,
|
|
430
|
+
"value": "Loading"
|
|
431
|
+
}]
|
|
432
|
+
})
|
|
433
|
+
}) : null]
|
|
403
434
|
})
|
|
404
|
-
})
|
|
405
|
-
withDelay: true
|
|
406
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
407
|
-
id: "TV3jir",
|
|
408
|
-
defaultMessage: [{
|
|
409
|
-
"type": 0,
|
|
410
|
-
"value": "Loading"
|
|
411
|
-
}]
|
|
412
|
-
})) : null));
|
|
435
|
+
});
|
|
413
436
|
}
|
|
414
437
|
|
|
415
438
|
function ResourceEditPage(_ref) {
|
|
@@ -434,41 +457,47 @@ function ResourceEditPage(_ref) {
|
|
|
434
457
|
setEditItem(item);
|
|
435
458
|
}, [item, setEditItem]);
|
|
436
459
|
var resourceValues = useResourceValues(resource);
|
|
437
|
-
return /*#__PURE__*/
|
|
438
|
-
resource: resource
|
|
439
|
-
}, /*#__PURE__*/React.createElement(MainLayout, {
|
|
440
|
-
loading: loading
|
|
441
|
-
}, editItem !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
|
|
460
|
+
return /*#__PURE__*/jsx(ResourceProvider, {
|
|
442
461
|
resource: resource,
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
+
children: /*#__PURE__*/jsxs(MainLayout, {
|
|
463
|
+
loading: loading,
|
|
464
|
+
children: [editItem !== null ? /*#__PURE__*/jsx(ResourceFormWrapper, {
|
|
465
|
+
resource: resource,
|
|
466
|
+
item: editItem,
|
|
467
|
+
type: type,
|
|
468
|
+
onSuccess: onSuccess,
|
|
469
|
+
withContainer: true,
|
|
470
|
+
header: /*#__PURE__*/jsx(PageHeader, {
|
|
471
|
+
title: /*#__PURE__*/jsxs(Fragment, {
|
|
472
|
+
children: [/*#__PURE__*/jsx(FormattedMessage, {
|
|
473
|
+
values: resourceValues,
|
|
474
|
+
id: "mCfzkJ",
|
|
475
|
+
defaultMessage: [{
|
|
476
|
+
"type": 0,
|
|
477
|
+
"value": "Edit "
|
|
478
|
+
}, {
|
|
479
|
+
"type": 1,
|
|
480
|
+
"value": "a_singular"
|
|
481
|
+
}]
|
|
482
|
+
}), typeName !== null ? /*#__PURE__*/jsxs("span", {
|
|
483
|
+
className: "text-body-secondary",
|
|
484
|
+
children: [' ', "(", typeName, ")"]
|
|
485
|
+
}) : null]
|
|
486
|
+
}),
|
|
487
|
+
small: true
|
|
488
|
+
})
|
|
489
|
+
}) : null, editItem === null && loading && !error ? /*#__PURE__*/jsx(Loading, {
|
|
490
|
+
withDelay: true,
|
|
491
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
492
|
+
id: "TV3jir",
|
|
493
|
+
defaultMessage: [{
|
|
494
|
+
"type": 0,
|
|
495
|
+
"value": "Loading"
|
|
496
|
+
}]
|
|
497
|
+
})
|
|
498
|
+
}) : null]
|
|
462
499
|
})
|
|
463
|
-
})
|
|
464
|
-
withDelay: true
|
|
465
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
466
|
-
id: "TV3jir",
|
|
467
|
-
defaultMessage: [{
|
|
468
|
-
"type": 0,
|
|
469
|
-
"value": "Loading"
|
|
470
|
-
}]
|
|
471
|
-
})) : null));
|
|
500
|
+
});
|
|
472
501
|
}
|
|
473
502
|
|
|
474
503
|
function ResourceCreateButton(_ref) {
|
|
@@ -503,41 +532,43 @@ function ResourceCreateButton(_ref) {
|
|
|
503
532
|
setDropdownOpened(false);
|
|
504
533
|
}
|
|
505
534
|
}, [setDropdownOpened, dropdownOpened]);
|
|
506
|
-
var button = /*#__PURE__*/
|
|
535
|
+
var button = /*#__PURE__*/jsx(Button, {
|
|
507
536
|
href: !hasMultipleTypes ? "".concat(resourceRoute('create')).concat(finalTypes !== null && finalTypes.length === 1 ? "?type=".concat(finalTypes[0].id) : '') : '#',
|
|
508
537
|
size: size,
|
|
509
538
|
theme: "primary",
|
|
510
539
|
className: classNames([_defineProperty({
|
|
511
540
|
'dropdown-toggle': hasMultipleTypes
|
|
512
541
|
}, className, className !== null)]),
|
|
513
|
-
onClick: hasMultipleTypes ? onClickDropdown : null
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
542
|
+
onClick: hasMultipleTypes ? onClickDropdown : null,
|
|
543
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
544
|
+
values: resourceValues,
|
|
545
|
+
id: "l+ddDH",
|
|
546
|
+
defaultMessage: [{
|
|
547
|
+
"type": 0,
|
|
548
|
+
"value": "Create "
|
|
549
|
+
}, {
|
|
550
|
+
"type": 1,
|
|
551
|
+
"value": "a_singular"
|
|
552
|
+
}]
|
|
553
|
+
})
|
|
554
|
+
});
|
|
555
|
+
return hasMultipleTypes ? /*#__PURE__*/jsxs("div", {
|
|
526
556
|
className: classNames(['dropdown', {
|
|
527
557
|
show: dropdownOpened
|
|
528
|
-
}])
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
558
|
+
}]),
|
|
559
|
+
children: [button, /*#__PURE__*/jsx(Dropdown, {
|
|
560
|
+
items: finalTypes.map(function (it) {
|
|
561
|
+
return {
|
|
562
|
+
id: it.id,
|
|
563
|
+
label: it.name,
|
|
564
|
+
href: "".concat(resourceRoute('create'), "?type=").concat(it.id)
|
|
565
|
+
};
|
|
566
|
+
}),
|
|
567
|
+
visible: dropdownOpened,
|
|
568
|
+
align: "end",
|
|
569
|
+
onClickOutside: onDropdownClickOutside
|
|
570
|
+
})]
|
|
571
|
+
}) : button;
|
|
541
572
|
}
|
|
542
573
|
|
|
543
574
|
var _excluded$3 = ["resource"];
|
|
@@ -550,7 +581,7 @@ function ResourceItemsList(_ref) {
|
|
|
550
581
|
},
|
|
551
582
|
_ref2$id = _ref2.id,
|
|
552
583
|
finalResource = _ref2$id === void 0 ? null : _ref2$id;
|
|
553
|
-
return /*#__PURE__*/
|
|
584
|
+
return /*#__PURE__*/jsx(ResourceList, _objectSpread({
|
|
554
585
|
resource: finalResource
|
|
555
586
|
}, props));
|
|
556
587
|
}
|
|
@@ -630,75 +661,81 @@ function ResourceIndexPage(_ref) {
|
|
|
630
661
|
replace: true
|
|
631
662
|
});
|
|
632
663
|
}, [navigate, url]);
|
|
633
|
-
return /*#__PURE__*/
|
|
634
|
-
resource: resource
|
|
635
|
-
}, /*#__PURE__*/React.createElement(MainLayout, null, /*#__PURE__*/React.createElement(PageHeader, {
|
|
636
|
-
title: name,
|
|
637
|
-
actions: finalActions.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
638
|
-
className: "d-flex align-items-center"
|
|
639
|
-
}, finalActions.map(function (_ref5) {
|
|
640
|
-
var id = _ref5.id,
|
|
641
|
-
_ref5$component = _ref5.component,
|
|
642
|
-
component = _ref5$component === void 0 ? Button : _ref5$component,
|
|
643
|
-
_ref5$withQuery = _ref5.withQuery,
|
|
644
|
-
withQuery = _ref5$withQuery === void 0 ? false : _ref5$withQuery,
|
|
645
|
-
_ref5$href = _ref5.href,
|
|
646
|
-
href = _ref5$href === void 0 ? null : _ref5$href,
|
|
647
|
-
actionsProps = _objectWithoutProperties(_ref5, _excluded$2);
|
|
648
|
-
var ActionComponent = isString(component) ? componentsManager.getComponent(component) : component;
|
|
649
|
-
var isButton = ActionComponent === Button;
|
|
650
|
-
var finalHref = href;
|
|
651
|
-
if (isButton && withQuery && href !== null) {
|
|
652
|
-
finalHref = "".concat(finalHref).concat(finalHref.indexOf('?') !== -1 ? '&' : '?').concat(queryString.stringify(query, {
|
|
653
|
-
arrayFormat: 'bracket'
|
|
654
|
-
}));
|
|
655
|
-
}
|
|
656
|
-
return ActionComponent !== null ? /*#__PURE__*/React.createElement(ActionComponent, Object.assign({
|
|
657
|
-
key: "action-".concat(id),
|
|
658
|
-
href: finalHref
|
|
659
|
-
}, actionsProps, !isButton ? {
|
|
660
|
-
resource: resource,
|
|
661
|
-
query: query,
|
|
662
|
-
onQueryChange: onQueryChange
|
|
663
|
-
} : {})) : null;
|
|
664
|
-
})) : null
|
|
665
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
666
|
-
className: classNames(['container-sm py-4'])
|
|
667
|
-
}, created ? /*#__PURE__*/React.createElement(Alert, {
|
|
668
|
-
className: "mb-4",
|
|
669
|
-
onClose: onClickCloseAlert
|
|
670
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
671
|
-
values: resourceValues,
|
|
672
|
-
id: "bfP/d8",
|
|
673
|
-
defaultMessage: [{
|
|
674
|
-
"type": 1,
|
|
675
|
-
"value": "The_singular"
|
|
676
|
-
}, {
|
|
677
|
-
"type": 0,
|
|
678
|
-
"value": " has been created."
|
|
679
|
-
}]
|
|
680
|
-
})) : null, deleted ? /*#__PURE__*/React.createElement(Alert, {
|
|
681
|
-
className: "mb-4",
|
|
682
|
-
onClose: onClickCloseAlert
|
|
683
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
684
|
-
values: resourceValues,
|
|
685
|
-
id: "dkRdks",
|
|
686
|
-
defaultMessage: [{
|
|
687
|
-
"type": 1,
|
|
688
|
-
"value": "The_singular"
|
|
689
|
-
}, {
|
|
690
|
-
"type": 0,
|
|
691
|
-
"value": " has been deleted."
|
|
692
|
-
}]
|
|
693
|
-
})) : null, /*#__PURE__*/React.createElement(ResourceItemsList, {
|
|
664
|
+
return /*#__PURE__*/jsx(ResourceProvider, {
|
|
694
665
|
resource: resource,
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
666
|
+
children: /*#__PURE__*/jsxs(MainLayout, {
|
|
667
|
+
children: [/*#__PURE__*/jsx(PageHeader, {
|
|
668
|
+
title: name,
|
|
669
|
+
actions: finalActions.length > 0 ? /*#__PURE__*/jsx("div", {
|
|
670
|
+
className: "d-flex align-items-center",
|
|
671
|
+
children: finalActions.map(function (_ref5) {
|
|
672
|
+
var id = _ref5.id,
|
|
673
|
+
_ref5$component = _ref5.component,
|
|
674
|
+
component = _ref5$component === void 0 ? Button : _ref5$component,
|
|
675
|
+
_ref5$withQuery = _ref5.withQuery,
|
|
676
|
+
withQuery = _ref5$withQuery === void 0 ? false : _ref5$withQuery,
|
|
677
|
+
_ref5$href = _ref5.href,
|
|
678
|
+
href = _ref5$href === void 0 ? null : _ref5$href,
|
|
679
|
+
actionsProps = _objectWithoutProperties(_ref5, _excluded$2);
|
|
680
|
+
var ActionComponent = isString(component) ? componentsManager.getComponent(component) : component;
|
|
681
|
+
var isButton = ActionComponent === Button;
|
|
682
|
+
var finalHref = href;
|
|
683
|
+
if (isButton && withQuery && href !== null) {
|
|
684
|
+
finalHref = "".concat(finalHref).concat(finalHref.indexOf('?') !== -1 ? '&' : '?').concat(queryString.stringify(query, {
|
|
685
|
+
arrayFormat: 'bracket'
|
|
686
|
+
}));
|
|
687
|
+
}
|
|
688
|
+
return ActionComponent !== null ? /*#__PURE__*/jsx(ActionComponent, _objectSpread(_objectSpread({
|
|
689
|
+
href: finalHref
|
|
690
|
+
}, actionsProps), !isButton ? {
|
|
691
|
+
resource: resource,
|
|
692
|
+
query: query,
|
|
693
|
+
onQueryChange: onQueryChange
|
|
694
|
+
} : {}), "action-".concat(id)) : null;
|
|
695
|
+
})
|
|
696
|
+
}) : null
|
|
697
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
698
|
+
className: classNames(['container-sm py-4']),
|
|
699
|
+
children: [created ? /*#__PURE__*/jsx(Alert, {
|
|
700
|
+
className: "mb-4",
|
|
701
|
+
onClose: onClickCloseAlert,
|
|
702
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
703
|
+
values: resourceValues,
|
|
704
|
+
id: "bfP/d8",
|
|
705
|
+
defaultMessage: [{
|
|
706
|
+
"type": 1,
|
|
707
|
+
"value": "The_singular"
|
|
708
|
+
}, {
|
|
709
|
+
"type": 0,
|
|
710
|
+
"value": " has been created."
|
|
711
|
+
}]
|
|
712
|
+
})
|
|
713
|
+
}) : null, deleted ? /*#__PURE__*/jsx(Alert, {
|
|
714
|
+
className: "mb-4",
|
|
715
|
+
onClose: onClickCloseAlert,
|
|
716
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
717
|
+
values: resourceValues,
|
|
718
|
+
id: "dkRdks",
|
|
719
|
+
defaultMessage: [{
|
|
720
|
+
"type": 1,
|
|
721
|
+
"value": "The_singular"
|
|
722
|
+
}, {
|
|
723
|
+
"type": 0,
|
|
724
|
+
"value": " has been deleted."
|
|
725
|
+
}]
|
|
726
|
+
})
|
|
727
|
+
}) : null, /*#__PURE__*/jsx(ResourceItemsList, {
|
|
728
|
+
resource: resource,
|
|
729
|
+
baseUrl: url,
|
|
730
|
+
query: listQuery,
|
|
731
|
+
paginated: paginated,
|
|
732
|
+
onQueryChange: onQueryChange,
|
|
733
|
+
onQueryReset: onQueryReset,
|
|
734
|
+
theme: theme
|
|
735
|
+
})]
|
|
736
|
+
})]
|
|
737
|
+
})
|
|
738
|
+
});
|
|
702
739
|
}
|
|
703
740
|
|
|
704
741
|
function ResourceShowPage(_ref) {
|
|
@@ -712,29 +749,32 @@ function ResourceShowPage(_ref) {
|
|
|
712
749
|
var _ref2 = item || {},
|
|
713
750
|
_ref2$type = _ref2.type,
|
|
714
751
|
type = _ref2$type === void 0 ? null : _ref2$type;
|
|
715
|
-
return /*#__PURE__*/
|
|
716
|
-
resource: resource
|
|
717
|
-
}, /*#__PURE__*/React.createElement(MainLayout, {
|
|
718
|
-
loading: loading
|
|
719
|
-
}, item !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
|
|
752
|
+
return /*#__PURE__*/jsx(ResourceProvider, {
|
|
720
753
|
resource: resource,
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
754
|
+
children: /*#__PURE__*/jsxs(MainLayout, {
|
|
755
|
+
loading: loading,
|
|
756
|
+
children: [item !== null ? /*#__PURE__*/jsx(ResourceFormWrapper, {
|
|
757
|
+
resource: resource,
|
|
758
|
+
item: item,
|
|
759
|
+
type: type,
|
|
760
|
+
disabled: true,
|
|
761
|
+
header: /*#__PURE__*/jsx(PageHeader, {
|
|
762
|
+
title: "".concat(name, " #").concat(itemId),
|
|
763
|
+
small: true
|
|
764
|
+
}),
|
|
765
|
+
withContainer: true
|
|
766
|
+
}) : null, item === null && loading && !error ? /*#__PURE__*/jsx(Loading, {
|
|
767
|
+
withDelay: true,
|
|
768
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
769
|
+
id: "TV3jir",
|
|
770
|
+
defaultMessage: [{
|
|
771
|
+
"type": 0,
|
|
772
|
+
"value": "Loading"
|
|
773
|
+
}]
|
|
774
|
+
})
|
|
775
|
+
}) : null]
|
|
776
|
+
})
|
|
777
|
+
});
|
|
738
778
|
}
|
|
739
779
|
|
|
740
780
|
function ResourceDuplicatePage(_ref) {
|
|
@@ -761,42 +801,48 @@ function ResourceDuplicatePage(_ref) {
|
|
|
761
801
|
id: id
|
|
762
802
|
}), "?duplicated=true"));
|
|
763
803
|
}, [navigate, resourceRoute]);
|
|
764
|
-
return /*#__PURE__*/
|
|
765
|
-
resource: resource
|
|
766
|
-
}, /*#__PURE__*/React.createElement(MainLayout, {
|
|
767
|
-
loading: loading
|
|
768
|
-
}, item !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
|
|
804
|
+
return /*#__PURE__*/jsx(ResourceProvider, {
|
|
769
805
|
resource: resource,
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
806
|
+
children: /*#__PURE__*/jsxs(MainLayout, {
|
|
807
|
+
loading: loading,
|
|
808
|
+
children: [item !== null ? /*#__PURE__*/jsx(ResourceFormWrapper, {
|
|
809
|
+
resource: resource,
|
|
810
|
+
item: item,
|
|
811
|
+
onSuccess: onSuccess,
|
|
812
|
+
isDuplicate: true,
|
|
813
|
+
withContainer: true,
|
|
814
|
+
header: /*#__PURE__*/jsx(PageHeader, {
|
|
815
|
+
title: /*#__PURE__*/jsxs(Fragment, {
|
|
816
|
+
children: [/*#__PURE__*/jsx(FormattedMessage, {
|
|
817
|
+
values: resourceValues,
|
|
818
|
+
id: "G7M4nI",
|
|
819
|
+
defaultMessage: [{
|
|
820
|
+
"type": 0,
|
|
821
|
+
"value": "Duplicate "
|
|
822
|
+
}, {
|
|
823
|
+
"type": 1,
|
|
824
|
+
"value": "a_singular"
|
|
825
|
+
}]
|
|
826
|
+
}), typeName !== null ? /*#__PURE__*/jsxs("span", {
|
|
827
|
+
className: "text-body-secondary",
|
|
828
|
+
children: [' ', "(", typeName, ")"]
|
|
829
|
+
}) : null]
|
|
830
|
+
}),
|
|
831
|
+
small: true
|
|
832
|
+
})
|
|
833
|
+
}) : null, item === null && loading && !error ? /*#__PURE__*/jsx(Loading, {
|
|
834
|
+
className: "w-10 m-auto",
|
|
835
|
+
withDelay: true,
|
|
836
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
837
|
+
id: "TV3jir",
|
|
838
|
+
defaultMessage: [{
|
|
839
|
+
"type": 0,
|
|
840
|
+
"value": "Loading"
|
|
841
|
+
}]
|
|
842
|
+
})
|
|
843
|
+
}) : null]
|
|
789
844
|
})
|
|
790
|
-
})
|
|
791
|
-
className: "w-10 m-auto",
|
|
792
|
-
withDelay: true
|
|
793
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
794
|
-
id: "TV3jir",
|
|
795
|
-
defaultMessage: [{
|
|
796
|
-
"type": 0,
|
|
797
|
-
"value": "Loading"
|
|
798
|
-
}]
|
|
799
|
-
})) : null));
|
|
845
|
+
});
|
|
800
846
|
}
|
|
801
847
|
|
|
802
848
|
function ResourceLink(_ref) {
|
|
@@ -805,22 +851,23 @@ function ResourceLink(_ref) {
|
|
|
805
851
|
var _ref2 = resource || {},
|
|
806
852
|
resourceId = _ref2.id;
|
|
807
853
|
var resourceValues = useResourceValues(resource);
|
|
808
|
-
return /*#__PURE__*/
|
|
854
|
+
return /*#__PURE__*/jsx(Link, {
|
|
809
855
|
className: "d-block my-2",
|
|
810
856
|
href: route('resources.index', {
|
|
811
857
|
resource: resourceId
|
|
858
|
+
}),
|
|
859
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
860
|
+
values: resourceValues,
|
|
861
|
+
id: "FntHPK",
|
|
862
|
+
defaultMessage: [{
|
|
863
|
+
"type": 0,
|
|
864
|
+
"value": "View "
|
|
865
|
+
}, {
|
|
866
|
+
"type": 1,
|
|
867
|
+
"value": "the_plural"
|
|
868
|
+
}]
|
|
812
869
|
})
|
|
813
|
-
}
|
|
814
|
-
values: resourceValues,
|
|
815
|
-
id: "FntHPK",
|
|
816
|
-
defaultMessage: [{
|
|
817
|
-
"type": 0,
|
|
818
|
-
"value": "View "
|
|
819
|
-
}, {
|
|
820
|
-
"type": 1,
|
|
821
|
-
"value": "the_plural"
|
|
822
|
-
}]
|
|
823
|
-
}));
|
|
870
|
+
});
|
|
824
871
|
}
|
|
825
872
|
function HomePage() {
|
|
826
873
|
var resources = usePanneauResources();
|
|
@@ -831,22 +878,27 @@ function HomePage() {
|
|
|
831
878
|
hideInNavbar = _ref3$settings2$hideI === void 0 ? false : _ref3$settings2$hideI;
|
|
832
879
|
return !hideInNavbar;
|
|
833
880
|
});
|
|
834
|
-
return /*#__PURE__*/
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
881
|
+
return /*#__PURE__*/jsx(MainLayout, {
|
|
882
|
+
children: /*#__PURE__*/jsx("div", {
|
|
883
|
+
className: "container-sm py-4",
|
|
884
|
+
children: visibleResources.map(function (resource) {
|
|
885
|
+
var _ref4 = resource || {},
|
|
886
|
+
resourceId = _ref4.id;
|
|
887
|
+
return /*#__PURE__*/jsx(ResourceLink, {
|
|
888
|
+
resource: resource
|
|
889
|
+
}, "resource-link-".concat(resourceId));
|
|
890
|
+
})
|
|
891
|
+
})
|
|
892
|
+
});
|
|
844
893
|
}
|
|
845
894
|
|
|
846
895
|
function AccountPage() {
|
|
847
|
-
return /*#__PURE__*/
|
|
848
|
-
|
|
849
|
-
|
|
896
|
+
return /*#__PURE__*/jsx(MainLayout, {
|
|
897
|
+
children: /*#__PURE__*/jsx("div", {
|
|
898
|
+
className: "container-sm py-4",
|
|
899
|
+
children: "Account page"
|
|
900
|
+
})
|
|
901
|
+
});
|
|
850
902
|
}
|
|
851
903
|
|
|
852
904
|
function LoginForm(_ref) {
|
|
@@ -864,12 +916,12 @@ function LoginForm(_ref) {
|
|
|
864
916
|
}, [login]);
|
|
865
917
|
var FormComponents = useFormsComponents();
|
|
866
918
|
var FormComponent = getComponentFromName('login', FormComponents);
|
|
867
|
-
return FormComponent !== null ? /*#__PURE__*/
|
|
919
|
+
return FormComponent !== null ? /*#__PURE__*/jsx(FormComponent, {
|
|
868
920
|
action: url('auth.login'),
|
|
869
921
|
postForm: postForm,
|
|
870
922
|
onComplete: onSuccess,
|
|
871
923
|
className: className,
|
|
872
|
-
submitButtonLabel: /*#__PURE__*/
|
|
924
|
+
submitButtonLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
873
925
|
id: "g6qbbX",
|
|
874
926
|
defaultMessage: [{
|
|
875
927
|
"type": 0,
|
|
@@ -890,22 +942,25 @@ function GuestLayout(_ref) {
|
|
|
890
942
|
background = _usePanneauColorSchem3 === void 0 ? null : _usePanneauColorSchem3,
|
|
891
943
|
_usePanneauColorSchem4 = _usePanneauColorSchem.text,
|
|
892
944
|
text = _usePanneauColorSchem4 === void 0 ? null : _usePanneauColorSchem4;
|
|
893
|
-
return /*#__PURE__*/
|
|
945
|
+
return /*#__PURE__*/jsxs("div", {
|
|
894
946
|
className: classNames([{
|
|
895
947
|
'd-flex flex-column min-vh-100': fullscreen
|
|
896
948
|
}]),
|
|
897
|
-
"data-bs-theme": theme !== null ? theme : undefined
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
949
|
+
"data-bs-theme": theme !== null ? theme : undefined,
|
|
950
|
+
children: [/*#__PURE__*/jsx(MainNavbar, {
|
|
951
|
+
className: classNames(['sticky-top', 'px-3'])
|
|
952
|
+
}), /*#__PURE__*/jsx("div", {
|
|
953
|
+
className: classNames(_defineProperty(_defineProperty({
|
|
954
|
+
'd-flex flex-column flex-grow-1': fullscreen
|
|
955
|
+
}, "bg-".concat(background), background !== null), "text-".concat(text), text !== null)),
|
|
956
|
+
children: /*#__PURE__*/jsx("div", {
|
|
957
|
+
className: classNames({
|
|
958
|
+
'w-100 my-auto': fullscreen
|
|
959
|
+
}),
|
|
960
|
+
children: children
|
|
961
|
+
})
|
|
962
|
+
})]
|
|
963
|
+
});
|
|
909
964
|
}
|
|
910
965
|
|
|
911
966
|
function LoginPage() {
|
|
@@ -915,25 +970,30 @@ function LoginPage() {
|
|
|
915
970
|
var onSuccess = useCallback(function () {
|
|
916
971
|
window.location.href = route('home');
|
|
917
972
|
}, [route]);
|
|
918
|
-
return /*#__PURE__*/
|
|
919
|
-
fullscreen: true
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
973
|
+
return /*#__PURE__*/jsx(GuestLayout, {
|
|
974
|
+
fullscreen: true,
|
|
975
|
+
children: /*#__PURE__*/jsx("div", {
|
|
976
|
+
className: "container-sm py-4",
|
|
977
|
+
children: /*#__PURE__*/jsx("div", {
|
|
978
|
+
className: "row justify-content-center",
|
|
979
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
980
|
+
className: "col-12 col-sm-8 col-md-6",
|
|
981
|
+
children: [/*#__PURE__*/jsx("h1", {
|
|
982
|
+
className: "mb-4",
|
|
983
|
+
children: /*#__PURE__*/jsx(FormattedMessage, {
|
|
984
|
+
id: "AeOZq+",
|
|
985
|
+
defaultMessage: [{
|
|
986
|
+
"type": 0,
|
|
987
|
+
"value": "Login"
|
|
988
|
+
}]
|
|
989
|
+
})
|
|
990
|
+
}), /*#__PURE__*/jsx(LoginForm, {
|
|
991
|
+
onSuccess: onSuccess
|
|
992
|
+
})]
|
|
993
|
+
})
|
|
994
|
+
})
|
|
995
|
+
})
|
|
996
|
+
});
|
|
937
997
|
}
|
|
938
998
|
|
|
939
999
|
var messages = defineMessages({
|
|
@@ -1032,15 +1092,27 @@ var messages = defineMessages({
|
|
|
1032
1092
|
function ErrorPage(_ref) {
|
|
1033
1093
|
var _ref$statusCode = _ref.statusCode,
|
|
1034
1094
|
statusCode = _ref$statusCode === void 0 ? null : _ref$statusCode;
|
|
1035
|
-
return /*#__PURE__*/
|
|
1036
|
-
fullscreen: true
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1095
|
+
return /*#__PURE__*/jsx(GuestLayout, {
|
|
1096
|
+
fullscreen: true,
|
|
1097
|
+
children: /*#__PURE__*/jsx("div", {
|
|
1098
|
+
className: "container-sm py-4",
|
|
1099
|
+
children: /*#__PURE__*/jsx("div", {
|
|
1100
|
+
className: "row justify-content-center",
|
|
1101
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
1102
|
+
className: "col-12 col-sm-8 col-md-6",
|
|
1103
|
+
children: [/*#__PURE__*/jsx("h1", {
|
|
1104
|
+
children: /*#__PURE__*/jsx(Label, {
|
|
1105
|
+
children: messages["title".concat(statusCode || 404)]
|
|
1106
|
+
})
|
|
1107
|
+
}), /*#__PURE__*/jsx("p", {
|
|
1108
|
+
children: /*#__PURE__*/jsx(Label, {
|
|
1109
|
+
children: messages["description".concat(statusCode || 404)]
|
|
1110
|
+
})
|
|
1111
|
+
})]
|
|
1112
|
+
})
|
|
1113
|
+
})
|
|
1114
|
+
})
|
|
1115
|
+
});
|
|
1044
1116
|
}
|
|
1045
1117
|
|
|
1046
1118
|
var _excluded$1 = ["path", "component"];
|
|
@@ -1088,91 +1160,91 @@ function createResourceRoutes(resource, _ref) {
|
|
|
1088
1160
|
var ResourceEditComponent = componentsManager.getComponent(resourceEditPage === null || resourceEditPage === void 0 ? void 0 : resourceEditPage.component) || componentsManager.getComponent(editPage === null || editPage === void 0 ? void 0 : editPage.component) || ResourceEditPage;
|
|
1089
1161
|
var ResourceDeleteComponent = componentsManager.getComponent(resourceDeletePage === null || resourceDeletePage === void 0 ? void 0 : resourceDeletePage.component) || componentsManager.getComponent(deletePage === null || deletePage === void 0 ? void 0 : deletePage.component) || ResourceDeletePage;
|
|
1090
1162
|
var ResourceDuplicateComponent = componentsManager.getComponent(resourceDuplicatePage === null || resourceDuplicatePage === void 0 ? void 0 : resourceDuplicatePage.component) || componentsManager.getComponent(duplicatePage === null || duplicatePage === void 0 ? void 0 : duplicatePage.component) || ResourceDuplicatePage;
|
|
1091
|
-
return [/*#__PURE__*/
|
|
1092
|
-
key: "".concat(resourceId, "-create"),
|
|
1163
|
+
return [/*#__PURE__*/jsx(Route, {
|
|
1093
1164
|
path: route('resources.create', {
|
|
1094
1165
|
resource: resourceId
|
|
1095
1166
|
}),
|
|
1096
|
-
exact: true
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1167
|
+
exact: true,
|
|
1168
|
+
children: function children() {
|
|
1169
|
+
return /*#__PURE__*/jsx(ResourceCreateComponent, {
|
|
1170
|
+
resource: resource
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
}, "".concat(resourceId, "-create")), /*#__PURE__*/jsx(Route, {
|
|
1103
1174
|
path: route('resources.show', {
|
|
1104
1175
|
resource: resourceId,
|
|
1105
1176
|
id: ':id'
|
|
1106
|
-
})
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1177
|
+
}),
|
|
1178
|
+
children: function children(_ref4) {
|
|
1179
|
+
var _ref4$id = _ref4.id,
|
|
1180
|
+
id = _ref4$id === void 0 ? null : _ref4$id;
|
|
1181
|
+
return /*#__PURE__*/jsx(ResourceShowComponent, {
|
|
1182
|
+
itemId: id,
|
|
1183
|
+
resource: resource
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1186
|
+
}, "".concat(resourceId, "-show")), /*#__PURE__*/jsx(Route, {
|
|
1116
1187
|
path: route('resources.edit', {
|
|
1117
1188
|
resource: resourceId,
|
|
1118
1189
|
id: ':id'
|
|
1119
|
-
})
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1190
|
+
}),
|
|
1191
|
+
children: function children(_ref5) {
|
|
1192
|
+
var _ref5$id = _ref5.id,
|
|
1193
|
+
id = _ref5$id === void 0 ? null : _ref5$id;
|
|
1194
|
+
return /*#__PURE__*/jsx(ResourceEditComponent, {
|
|
1195
|
+
itemId: id,
|
|
1196
|
+
resource: resource
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
}, "".concat(resourceId, "-edit")), /*#__PURE__*/jsx(Route, {
|
|
1129
1200
|
path: route('resources.delete', {
|
|
1130
1201
|
resource: resourceId,
|
|
1131
1202
|
id: ':id'
|
|
1132
|
-
})
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1203
|
+
}),
|
|
1204
|
+
children: function children(_ref6) {
|
|
1205
|
+
var _ref6$id = _ref6.id,
|
|
1206
|
+
id = _ref6$id === void 0 ? null : _ref6$id;
|
|
1207
|
+
return /*#__PURE__*/jsx(ResourceDeleteComponent, {
|
|
1208
|
+
itemId: id,
|
|
1209
|
+
resource: resource
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
}, "".concat(resourceId, "-delete")), /*#__PURE__*/jsx(Route, {
|
|
1142
1213
|
path: route('resources.duplicate', {
|
|
1143
1214
|
resource: resourceId,
|
|
1144
1215
|
id: ':id'
|
|
1145
|
-
})
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1216
|
+
}),
|
|
1217
|
+
children: function children(_ref7) {
|
|
1218
|
+
var _ref7$id = _ref7.id,
|
|
1219
|
+
id = _ref7$id === void 0 ? null : _ref7$id;
|
|
1220
|
+
return /*#__PURE__*/jsx(ResourceDuplicateComponent, {
|
|
1221
|
+
itemId: id,
|
|
1222
|
+
resource: resource
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
}, "".concat(resourceId, "-duplicate"))].concat(_toConsumableArray(extraRoutes.map(function (_ref8) {
|
|
1154
1226
|
var path = _ref8.path,
|
|
1155
1227
|
component = _ref8.component,
|
|
1156
1228
|
pageProps = _objectWithoutProperties(_ref8, _excluded$1);
|
|
1157
1229
|
var RouteComponent = componentsManager.getComponent(component);
|
|
1158
|
-
return RouteComponent !== null ? /*#__PURE__*/
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
}
|
|
1165
|
-
}) : null;
|
|
1166
|
-
})), [/*#__PURE__*/
|
|
1167
|
-
key: "".concat(resourceId, "-index"),
|
|
1230
|
+
return RouteComponent !== null ? /*#__PURE__*/jsx(Route, {
|
|
1231
|
+
path: path,
|
|
1232
|
+
children: function children() {
|
|
1233
|
+
return /*#__PURE__*/jsx(RouteComponent, _objectSpread({
|
|
1234
|
+
resource: resource
|
|
1235
|
+
}, pageProps));
|
|
1236
|
+
}
|
|
1237
|
+
}, "route-".concat(path)) : null;
|
|
1238
|
+
})), [/*#__PURE__*/jsx(Route, {
|
|
1168
1239
|
path: route('resources.index', {
|
|
1169
1240
|
resource: resourceId
|
|
1170
|
-
})
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1241
|
+
}),
|
|
1242
|
+
children: function children() {
|
|
1243
|
+
return /*#__PURE__*/jsx(ResourceIndexComponent, {
|
|
1244
|
+
resource: resource
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
}, "".concat(resourceId, "-index"))]);
|
|
1176
1248
|
}
|
|
1177
1249
|
|
|
1178
1250
|
var _excluded = ["home", "login", "account", "error", "index", "show", "create", "edit", "delete", "duplicate"],
|
|
@@ -1252,54 +1324,66 @@ function PanneauRoutes(_ref) {
|
|
|
1252
1324
|
|
|
1253
1325
|
// If there is an error status code
|
|
1254
1326
|
if (statusCode !== null) {
|
|
1255
|
-
return /*#__PURE__*/
|
|
1327
|
+
return /*#__PURE__*/jsx(ErrorComponent, _objectSpread({
|
|
1256
1328
|
statusCode: statusCode
|
|
1257
1329
|
}, errorPage));
|
|
1258
1330
|
}
|
|
1259
1331
|
|
|
1260
1332
|
// If user is unauthenticated
|
|
1261
1333
|
if (user === null) {
|
|
1262
|
-
return /*#__PURE__*/
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1334
|
+
return /*#__PURE__*/jsxs(Switch, {
|
|
1335
|
+
children: [/*#__PURE__*/jsx(Route, {
|
|
1336
|
+
path: routes['auth.login'],
|
|
1337
|
+
children: /*#__PURE__*/jsx(LoginComponent, _objectSpread({}, loginPage))
|
|
1338
|
+
}), /*#__PURE__*/jsx(Route, {
|
|
1339
|
+
children: /*#__PURE__*/jsx(Redirect, {
|
|
1340
|
+
to: "".concat(route('auth.login'), "?next=").concat(encodeURIComponent(pathname))
|
|
1341
|
+
})
|
|
1342
|
+
})]
|
|
1343
|
+
});
|
|
1267
1344
|
}
|
|
1268
1345
|
|
|
1269
1346
|
// Normal routes
|
|
1270
|
-
return /*#__PURE__*/
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1347
|
+
return /*#__PURE__*/jsxs(Switch, {
|
|
1348
|
+
children: [user !== null ? /*#__PURE__*/jsx(Route, {
|
|
1349
|
+
path: routes['auth.login'],
|
|
1350
|
+
children: /*#__PURE__*/jsx(Redirect, {
|
|
1351
|
+
to: routes.home,
|
|
1352
|
+
replace: true
|
|
1353
|
+
})
|
|
1354
|
+
}) : null, resources.map(function (resource) {
|
|
1355
|
+
var _ref4 = resource || {},
|
|
1356
|
+
resourceId = _ref4.id;
|
|
1357
|
+
return /*#__PURE__*/jsx(Fragment$1, {
|
|
1358
|
+
children: createResourceRoutes(resource, {
|
|
1359
|
+
route: route,
|
|
1360
|
+
componentsManager: componentsManager,
|
|
1361
|
+
pages: pages
|
|
1362
|
+
})
|
|
1363
|
+
}, "resource-".concat(resourceId));
|
|
1364
|
+
}), /*#__PURE__*/jsx(Route, {
|
|
1365
|
+
path: routes.account,
|
|
1366
|
+
children: /*#__PURE__*/jsx(AccountComponent, _objectSpread({}, accountPage))
|
|
1367
|
+
}), customRoutes.map(function (_ref5) {
|
|
1368
|
+
var _ref5$path = _ref5.path,
|
|
1369
|
+
path = _ref5$path === void 0 ? null : _ref5$path,
|
|
1370
|
+
_ref5$route = _ref5.route,
|
|
1371
|
+
pageRoute = _ref5$route === void 0 ? null : _ref5$route,
|
|
1372
|
+
component = _ref5.component,
|
|
1373
|
+
props = _objectWithoutProperties(_ref5, _excluded2);
|
|
1374
|
+
var PageComponent = componentsManager.getComponent(component);
|
|
1375
|
+
var finalPath = path || routes[pageRoute];
|
|
1376
|
+
return PageComponent !== null ? /*#__PURE__*/jsx(Route, {
|
|
1377
|
+
path: path || routes[pageRoute],
|
|
1378
|
+
children: /*#__PURE__*/jsx(PageComponent, _objectSpread({}, props))
|
|
1379
|
+
}, "custom-route-".concat(finalPath)) : null;
|
|
1380
|
+
}), /*#__PURE__*/jsx(Route, {
|
|
1381
|
+
path: routes.home,
|
|
1382
|
+
children: /*#__PURE__*/jsx(HomeComponent, _objectSpread({}, homePage))
|
|
1383
|
+
}), /*#__PURE__*/jsx(Route, {
|
|
1384
|
+
children: /*#__PURE__*/jsx(ErrorComponent, {})
|
|
1385
|
+
})]
|
|
1386
|
+
});
|
|
1303
1387
|
}
|
|
1304
1388
|
|
|
1305
1389
|
var pathToRegexpParser = createPathToRegexpParser();
|
|
@@ -1360,34 +1444,60 @@ function Container(_ref) {
|
|
|
1360
1444
|
var _useMemoryRouter = useMemoryRouter(),
|
|
1361
1445
|
memoryLocationHook = _useMemoryRouter.hook,
|
|
1362
1446
|
memorySearchHook = _useMemoryRouter.searchHook;
|
|
1363
|
-
return /*#__PURE__*/
|
|
1447
|
+
return /*#__PURE__*/jsx(Router, {
|
|
1364
1448
|
hook: isMemoryRouter ? memoryLocationHook : undefined,
|
|
1365
1449
|
searchHook: isMemoryRouter ? memorySearchHook : undefined,
|
|
1366
|
-
parser: pathToRegexpParser
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1450
|
+
parser: pathToRegexpParser,
|
|
1451
|
+
children: /*#__PURE__*/jsx(IntlProvider, {
|
|
1452
|
+
locale: locale,
|
|
1453
|
+
locales: locales,
|
|
1454
|
+
extraMessages: extraMessages,
|
|
1455
|
+
children: /*#__PURE__*/jsx(PanneauProvider, {
|
|
1456
|
+
definition: definition,
|
|
1457
|
+
children: /*#__PURE__*/jsx(UppyProvider, _objectSpread(_objectSpread({}, uppy), {}, {
|
|
1458
|
+
children: /*#__PURE__*/jsx(RoutesProvider, {
|
|
1459
|
+
routes: routes,
|
|
1460
|
+
children: /*#__PURE__*/jsx(FieldsProvider, {
|
|
1461
|
+
children: /*#__PURE__*/jsx(FormsProvider, {
|
|
1462
|
+
children: /*#__PURE__*/jsx(ListsProvider, {
|
|
1463
|
+
children: /*#__PURE__*/jsx(DisplaysProvider, {
|
|
1464
|
+
children: /*#__PURE__*/jsx(FiltersProvider, {
|
|
1465
|
+
children: /*#__PURE__*/jsx(ActionsProvider, {
|
|
1466
|
+
children: /*#__PURE__*/jsx(ModalProvider, {
|
|
1467
|
+
children: /*#__PURE__*/jsx(ModalsProvider, {
|
|
1468
|
+
children: /*#__PURE__*/jsx(ApiProvider, {
|
|
1469
|
+
baseUrl: baseUrl,
|
|
1470
|
+
onUnauthorized: onUnauthorized,
|
|
1471
|
+
children: /*#__PURE__*/jsx(QueryProvider, {
|
|
1472
|
+
children: /*#__PURE__*/jsx(AuthProvider, {
|
|
1473
|
+
user: user,
|
|
1474
|
+
onLogout: onLogout,
|
|
1475
|
+
children: /*#__PURE__*/jsx(ComponentsProvider, {
|
|
1476
|
+
components: components,
|
|
1477
|
+
children: /*#__PURE__*/jsx(PanneauRoutes, {
|
|
1478
|
+
statusCode: statusCode
|
|
1479
|
+
})
|
|
1480
|
+
})
|
|
1481
|
+
})
|
|
1482
|
+
})
|
|
1483
|
+
})
|
|
1484
|
+
})
|
|
1485
|
+
})
|
|
1486
|
+
})
|
|
1487
|
+
})
|
|
1488
|
+
})
|
|
1489
|
+
})
|
|
1490
|
+
})
|
|
1491
|
+
})
|
|
1492
|
+
})
|
|
1493
|
+
}))
|
|
1494
|
+
})
|
|
1495
|
+
})
|
|
1496
|
+
});
|
|
1386
1497
|
}
|
|
1387
1498
|
|
|
1388
|
-
// Kept for backward compatibility with exports
|
|
1389
1499
|
function ResourceFilters(props) {
|
|
1390
|
-
return /*#__PURE__*/
|
|
1500
|
+
return /*#__PURE__*/jsx(Filters, _objectSpread({}, props));
|
|
1391
1501
|
}
|
|
1392
1502
|
|
|
1393
1503
|
export { GuestLayout, MainLayout, PageHeader, ResourceFilters, ResourceFormWrapper as ResourceForm, ResourceItemsList, Container as default };
|