@panneau/app 4.0.1 → 4.0.3
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 -514
- 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,11 +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
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
43
|
-
|
|
44
|
-
// Kept for backward compatibility with exports
|
|
45
43
|
function ResourceFormWrapper(props) {
|
|
46
|
-
return /*#__PURE__*/
|
|
44
|
+
return /*#__PURE__*/jsx(ResourceForm, _objectSpread({}, props));
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
function AccountMenu(_ref) {
|
|
@@ -65,7 +63,7 @@ function AccountMenu(_ref) {
|
|
|
65
63
|
var items = useMemo(function () {
|
|
66
64
|
return user !== null ? [{
|
|
67
65
|
id: 'account',
|
|
68
|
-
label: /*#__PURE__*/
|
|
66
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
69
67
|
id: "IuqEHB",
|
|
70
68
|
defaultMessage: [{
|
|
71
69
|
"type": 0,
|
|
@@ -74,7 +72,7 @@ function AccountMenu(_ref) {
|
|
|
74
72
|
}),
|
|
75
73
|
href: route('account'),
|
|
76
74
|
dropdown: [].concat(_toConsumableArray(withAccountForm ? [{
|
|
77
|
-
label: /*#__PURE__*/
|
|
75
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
78
76
|
id: "V7Us0a",
|
|
79
77
|
defaultMessage: [{
|
|
80
78
|
"type": 0,
|
|
@@ -83,7 +81,7 @@ function AccountMenu(_ref) {
|
|
|
83
81
|
}),
|
|
84
82
|
href: route('account')
|
|
85
83
|
}] : []), [{
|
|
86
|
-
label: /*#__PURE__*/
|
|
84
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
87
85
|
id: "REIcPg",
|
|
88
86
|
defaultMessage: [{
|
|
89
87
|
"type": 0,
|
|
@@ -94,7 +92,7 @@ function AccountMenu(_ref) {
|
|
|
94
92
|
onClick: onClickLogout
|
|
95
93
|
}])
|
|
96
94
|
}] : [{
|
|
97
|
-
label: /*#__PURE__*/
|
|
95
|
+
label: /*#__PURE__*/jsx(FormattedMessage, {
|
|
98
96
|
id: "d0g58T",
|
|
99
97
|
defaultMessage: [{
|
|
100
98
|
"type": 0,
|
|
@@ -104,7 +102,7 @@ function AccountMenu(_ref) {
|
|
|
104
102
|
href: route('auth.login')
|
|
105
103
|
}];
|
|
106
104
|
}, [user, route, onClickLogout, withAccountForm]);
|
|
107
|
-
return items !== null ? /*#__PURE__*/
|
|
105
|
+
return items !== null ? /*#__PURE__*/jsx(Menu, {
|
|
108
106
|
className: className,
|
|
109
107
|
itemClassName: itemClassName,
|
|
110
108
|
linkClassName: linkClassName,
|
|
@@ -142,7 +140,7 @@ function ResourcesMenu(_ref) {
|
|
|
142
140
|
};
|
|
143
141
|
});
|
|
144
142
|
}, [resources, pathname, resourceRoute]);
|
|
145
|
-
return /*#__PURE__*/
|
|
143
|
+
return /*#__PURE__*/jsx(Menu, {
|
|
146
144
|
items: items,
|
|
147
145
|
className: className,
|
|
148
146
|
itemClassName: itemClassName,
|
|
@@ -182,53 +180,53 @@ function MainNavbar(_ref) {
|
|
|
182
180
|
return it !== null;
|
|
183
181
|
}).reduce(function (currentItems, item, index) {
|
|
184
182
|
if (item === 'resources') {
|
|
185
|
-
return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/
|
|
186
|
-
key: "menu-item-resource-".concat(index + 1),
|
|
183
|
+
return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/jsx(ResourcesMenu, {
|
|
187
184
|
className: navClassNames,
|
|
188
185
|
itemClassName: "nav-item",
|
|
189
186
|
linkClassName: "nav-link"
|
|
190
|
-
})]);
|
|
187
|
+
}, "menu-item-resource-".concat(index + 1))]);
|
|
191
188
|
}
|
|
192
189
|
if (item === 'account') {
|
|
193
|
-
return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/
|
|
194
|
-
key: "menu-item-account-".concat(index + 1),
|
|
190
|
+
return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/jsx(AccountMenu, {
|
|
195
191
|
className: navClassNames,
|
|
196
192
|
itemClassName: "nav-item",
|
|
197
193
|
linkClassName: "nav-link"
|
|
198
|
-
})]);
|
|
194
|
+
}, "menu-item-account-".concat(index + 1))]);
|
|
199
195
|
}
|
|
200
196
|
if (item === 'separator') {
|
|
201
|
-
return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/
|
|
202
|
-
key: "menu-item-spacer-".concat(index + 1),
|
|
197
|
+
return [].concat(_toConsumableArray(currentItems), [/*#__PURE__*/jsx("span", {
|
|
203
198
|
className: "ms-auto"
|
|
204
|
-
})]);
|
|
199
|
+
}, "menu-item-spacer-".concat(index + 1))]);
|
|
205
200
|
}
|
|
206
201
|
var lastItem = currentItems.length > 0 ? currentItems[currentItems.length - 1] : null;
|
|
207
202
|
return isArray(lastItem) ? [].concat(_toConsumableArray(currentItems.slice(0, currentItems.length - 1)), [[].concat(_toConsumableArray(lastItem), [item])]) : [].concat(_toConsumableArray(currentItems), [[item]]);
|
|
208
203
|
}, []).map(function (it, index) {
|
|
209
|
-
return isArray(it) ? /*#__PURE__*/
|
|
204
|
+
return isArray(it) ? /*#__PURE__*/jsx(Menu, {
|
|
210
205
|
items: it,
|
|
211
|
-
key: "submenu-item-".concat(index + 1),
|
|
212
206
|
className: navClassNames,
|
|
213
207
|
itemClassName: "nav-item",
|
|
214
208
|
linkClassName: "nav-link"
|
|
215
|
-
}) : it;
|
|
209
|
+
}, "submenu-item-".concat(index + 1)) : it;
|
|
216
210
|
});
|
|
217
211
|
}, [main, guest, user, navClassNames]);
|
|
218
|
-
return /*#__PURE__*/
|
|
212
|
+
return /*#__PURE__*/jsxs(Navbar, _objectSpread(_objectSpread({
|
|
219
213
|
theme: background,
|
|
220
214
|
loading: loading,
|
|
221
215
|
vertical: vertical,
|
|
222
216
|
className: className
|
|
223
|
-
}, props),
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
+
}));
|
|
232
230
|
}
|
|
233
231
|
|
|
234
232
|
function MainLayout(_ref) {
|
|
@@ -248,35 +246,37 @@ function MainLayout(_ref) {
|
|
|
248
246
|
_usePanneauColorSchem5 = _usePanneauColorSchem.text,
|
|
249
247
|
text = _usePanneauColorSchem5 === void 0 ? null : _usePanneauColorSchem5;
|
|
250
248
|
var vertical = sidebarPosition === 'left' || sidebarPosition === 'right';
|
|
251
|
-
return /*#__PURE__*/
|
|
249
|
+
return /*#__PURE__*/jsxs("div", {
|
|
252
250
|
className: classNames(['d-flex', 'min-vh-100', {
|
|
253
251
|
'flex-column': !vertical
|
|
254
252
|
}]),
|
|
255
|
-
"data-bs-theme": theme !== null ? theme : undefined
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
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
|
+
});
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
function PageHeader(_ref) {
|
|
@@ -295,22 +295,31 @@ function PageHeader(_ref) {
|
|
|
295
295
|
var _usePanneauColorSchem = usePanneauColorScheme(),
|
|
296
296
|
text = _usePanneauColorSchem.text,
|
|
297
297
|
background = _usePanneauColorSchem.background;
|
|
298
|
-
var inner = /*#__PURE__*/
|
|
299
|
-
className: "d-flex align-items-center flex-wrap"
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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
|
+
});
|
|
314
323
|
}
|
|
315
324
|
|
|
316
325
|
function ResourceCreatePage(_ref) {
|
|
@@ -332,30 +341,36 @@ function ResourceCreatePage(_ref) {
|
|
|
332
341
|
var onSuccess = useCallback(function () {
|
|
333
342
|
navigate("".concat(resourceRoute('index'), "?created=true"));
|
|
334
343
|
}, [navigate, resourceRoute]);
|
|
335
|
-
return /*#__PURE__*/
|
|
336
|
-
resource: resource
|
|
337
|
-
}, /*#__PURE__*/React.createElement(MainLayout, null, /*#__PURE__*/React.createElement(ResourceFormWrapper, {
|
|
344
|
+
return /*#__PURE__*/jsx(ResourceProvider, {
|
|
338
345
|
resource: resource,
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
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
|
+
})
|
|
357
372
|
})
|
|
358
|
-
})
|
|
373
|
+
});
|
|
359
374
|
}
|
|
360
375
|
|
|
361
376
|
function ResourceDeletePage(_ref) {
|
|
@@ -377,41 +392,47 @@ function ResourceDeletePage(_ref) {
|
|
|
377
392
|
var onSuccess = useCallback(function () {
|
|
378
393
|
return navigate("".concat(resourceRoute('index'), "?deleted=true"));
|
|
379
394
|
}, [navigate, resourceRoute]);
|
|
380
|
-
return /*#__PURE__*/
|
|
381
|
-
resource: resource
|
|
382
|
-
}, /*#__PURE__*/React.createElement(MainLayout, {
|
|
383
|
-
loading: loading
|
|
384
|
-
}, item !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
|
|
395
|
+
return /*#__PURE__*/jsx(ResourceProvider, {
|
|
385
396
|
resource: resource,
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
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]
|
|
405
434
|
})
|
|
406
|
-
})
|
|
407
|
-
withDelay: true
|
|
408
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
409
|
-
id: "TV3jir",
|
|
410
|
-
defaultMessage: [{
|
|
411
|
-
"type": 0,
|
|
412
|
-
"value": "Loading"
|
|
413
|
-
}]
|
|
414
|
-
})) : null));
|
|
435
|
+
});
|
|
415
436
|
}
|
|
416
437
|
|
|
417
438
|
function ResourceEditPage(_ref) {
|
|
@@ -436,41 +457,47 @@ function ResourceEditPage(_ref) {
|
|
|
436
457
|
setEditItem(item);
|
|
437
458
|
}, [item, setEditItem]);
|
|
438
459
|
var resourceValues = useResourceValues(resource);
|
|
439
|
-
return /*#__PURE__*/
|
|
440
|
-
resource: resource
|
|
441
|
-
}, /*#__PURE__*/React.createElement(MainLayout, {
|
|
442
|
-
loading: loading
|
|
443
|
-
}, editItem !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
|
|
460
|
+
return /*#__PURE__*/jsx(ResourceProvider, {
|
|
444
461
|
resource: resource,
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
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]
|
|
464
499
|
})
|
|
465
|
-
})
|
|
466
|
-
withDelay: true
|
|
467
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
468
|
-
id: "TV3jir",
|
|
469
|
-
defaultMessage: [{
|
|
470
|
-
"type": 0,
|
|
471
|
-
"value": "Loading"
|
|
472
|
-
}]
|
|
473
|
-
})) : null));
|
|
500
|
+
});
|
|
474
501
|
}
|
|
475
502
|
|
|
476
503
|
function ResourceCreateButton(_ref) {
|
|
@@ -505,41 +532,43 @@ function ResourceCreateButton(_ref) {
|
|
|
505
532
|
setDropdownOpened(false);
|
|
506
533
|
}
|
|
507
534
|
}, [setDropdownOpened, dropdownOpened]);
|
|
508
|
-
var button = /*#__PURE__*/
|
|
535
|
+
var button = /*#__PURE__*/jsx(Button, {
|
|
509
536
|
href: !hasMultipleTypes ? "".concat(resourceRoute('create')).concat(finalTypes !== null && finalTypes.length === 1 ? "?type=".concat(finalTypes[0].id) : '') : '#',
|
|
510
537
|
size: size,
|
|
511
538
|
theme: "primary",
|
|
512
539
|
className: classNames([_defineProperty({
|
|
513
540
|
'dropdown-toggle': hasMultipleTypes
|
|
514
541
|
}, className, className !== null)]),
|
|
515
|
-
onClick: hasMultipleTypes ? onClickDropdown : null
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
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", {
|
|
528
556
|
className: classNames(['dropdown', {
|
|
529
557
|
show: dropdownOpened
|
|
530
|
-
}])
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
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;
|
|
543
572
|
}
|
|
544
573
|
|
|
545
574
|
var _excluded$3 = ["resource"];
|
|
@@ -552,7 +581,7 @@ function ResourceItemsList(_ref) {
|
|
|
552
581
|
},
|
|
553
582
|
_ref2$id = _ref2.id,
|
|
554
583
|
finalResource = _ref2$id === void 0 ? null : _ref2$id;
|
|
555
|
-
return /*#__PURE__*/
|
|
584
|
+
return /*#__PURE__*/jsx(ResourceList, _objectSpread({
|
|
556
585
|
resource: finalResource
|
|
557
586
|
}, props));
|
|
558
587
|
}
|
|
@@ -632,75 +661,81 @@ function ResourceIndexPage(_ref) {
|
|
|
632
661
|
replace: true
|
|
633
662
|
});
|
|
634
663
|
}, [navigate, url]);
|
|
635
|
-
return /*#__PURE__*/
|
|
636
|
-
resource: resource
|
|
637
|
-
}, /*#__PURE__*/React.createElement(MainLayout, null, /*#__PURE__*/React.createElement(PageHeader, {
|
|
638
|
-
title: name,
|
|
639
|
-
actions: finalActions.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
640
|
-
className: "d-flex align-items-center"
|
|
641
|
-
}, finalActions.map(function (_ref5) {
|
|
642
|
-
var id = _ref5.id,
|
|
643
|
-
_ref5$component = _ref5.component,
|
|
644
|
-
component = _ref5$component === void 0 ? Button : _ref5$component,
|
|
645
|
-
_ref5$withQuery = _ref5.withQuery,
|
|
646
|
-
withQuery = _ref5$withQuery === void 0 ? false : _ref5$withQuery,
|
|
647
|
-
_ref5$href = _ref5.href,
|
|
648
|
-
href = _ref5$href === void 0 ? null : _ref5$href,
|
|
649
|
-
actionsProps = _objectWithoutProperties(_ref5, _excluded$2);
|
|
650
|
-
var ActionComponent = isString(component) ? componentsManager.getComponent(component) : component;
|
|
651
|
-
var isButton = ActionComponent === Button;
|
|
652
|
-
var finalHref = href;
|
|
653
|
-
if (isButton && withQuery && href !== null) {
|
|
654
|
-
finalHref = "".concat(finalHref).concat(finalHref.indexOf('?') !== -1 ? '&' : '?').concat(queryString.stringify(query, {
|
|
655
|
-
arrayFormat: 'bracket'
|
|
656
|
-
}));
|
|
657
|
-
}
|
|
658
|
-
return ActionComponent !== null ? /*#__PURE__*/React.createElement(ActionComponent, Object.assign({
|
|
659
|
-
key: "action-".concat(id),
|
|
660
|
-
href: finalHref
|
|
661
|
-
}, actionsProps, !isButton ? {
|
|
662
|
-
resource: resource,
|
|
663
|
-
query: query,
|
|
664
|
-
onQueryChange: onQueryChange
|
|
665
|
-
} : {})) : null;
|
|
666
|
-
})) : null
|
|
667
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
668
|
-
className: classNames(['container-sm py-4'])
|
|
669
|
-
}, created ? /*#__PURE__*/React.createElement(Alert, {
|
|
670
|
-
className: "mb-4",
|
|
671
|
-
onClose: onClickCloseAlert
|
|
672
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
673
|
-
values: resourceValues,
|
|
674
|
-
id: "bfP/d8",
|
|
675
|
-
defaultMessage: [{
|
|
676
|
-
"type": 1,
|
|
677
|
-
"value": "The_singular"
|
|
678
|
-
}, {
|
|
679
|
-
"type": 0,
|
|
680
|
-
"value": " has been created."
|
|
681
|
-
}]
|
|
682
|
-
})) : null, deleted ? /*#__PURE__*/React.createElement(Alert, {
|
|
683
|
-
className: "mb-4",
|
|
684
|
-
onClose: onClickCloseAlert
|
|
685
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
686
|
-
values: resourceValues,
|
|
687
|
-
id: "dkRdks",
|
|
688
|
-
defaultMessage: [{
|
|
689
|
-
"type": 1,
|
|
690
|
-
"value": "The_singular"
|
|
691
|
-
}, {
|
|
692
|
-
"type": 0,
|
|
693
|
-
"value": " has been deleted."
|
|
694
|
-
}]
|
|
695
|
-
})) : null, /*#__PURE__*/React.createElement(ResourceItemsList, {
|
|
664
|
+
return /*#__PURE__*/jsx(ResourceProvider, {
|
|
696
665
|
resource: resource,
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
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
|
+
});
|
|
704
739
|
}
|
|
705
740
|
|
|
706
741
|
function ResourceShowPage(_ref) {
|
|
@@ -714,29 +749,32 @@ function ResourceShowPage(_ref) {
|
|
|
714
749
|
var _ref2 = item || {},
|
|
715
750
|
_ref2$type = _ref2.type,
|
|
716
751
|
type = _ref2$type === void 0 ? null : _ref2$type;
|
|
717
|
-
return /*#__PURE__*/
|
|
718
|
-
resource: resource
|
|
719
|
-
}, /*#__PURE__*/React.createElement(MainLayout, {
|
|
720
|
-
loading: loading
|
|
721
|
-
}, item !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
|
|
752
|
+
return /*#__PURE__*/jsx(ResourceProvider, {
|
|
722
753
|
resource: resource,
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
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
|
+
});
|
|
740
778
|
}
|
|
741
779
|
|
|
742
780
|
function ResourceDuplicatePage(_ref) {
|
|
@@ -763,67 +801,73 @@ function ResourceDuplicatePage(_ref) {
|
|
|
763
801
|
id: id
|
|
764
802
|
}), "?duplicated=true"));
|
|
765
803
|
}, [navigate, resourceRoute]);
|
|
766
|
-
return /*#__PURE__*/
|
|
767
|
-
resource: resource
|
|
768
|
-
}, /*#__PURE__*/React.createElement(MainLayout, {
|
|
769
|
-
loading: loading
|
|
770
|
-
}, item !== null ? /*#__PURE__*/React.createElement(ResourceFormWrapper, {
|
|
804
|
+
return /*#__PURE__*/jsx(ResourceProvider, {
|
|
771
805
|
resource: resource,
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
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]
|
|
791
844
|
})
|
|
792
|
-
})
|
|
793
|
-
className: "w-10 m-auto",
|
|
794
|
-
withDelay: true
|
|
795
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
796
|
-
id: "TV3jir",
|
|
797
|
-
defaultMessage: [{
|
|
798
|
-
"type": 0,
|
|
799
|
-
"value": "Loading"
|
|
800
|
-
}]
|
|
801
|
-
})) : null));
|
|
845
|
+
});
|
|
802
846
|
}
|
|
803
847
|
|
|
804
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
805
848
|
function ResourceLink(_ref) {
|
|
806
849
|
var resource = _ref.resource;
|
|
807
850
|
var route = useUrlGenerator();
|
|
808
851
|
var _ref2 = resource || {},
|
|
809
852
|
resourceId = _ref2.id;
|
|
810
853
|
var resourceValues = useResourceValues(resource);
|
|
811
|
-
return /*#__PURE__*/
|
|
854
|
+
return /*#__PURE__*/jsx(Link, {
|
|
812
855
|
className: "d-block my-2",
|
|
813
856
|
href: route('resources.index', {
|
|
814
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
|
+
}]
|
|
815
869
|
})
|
|
816
|
-
}
|
|
817
|
-
values: resourceValues,
|
|
818
|
-
id: "FntHPK",
|
|
819
|
-
defaultMessage: [{
|
|
820
|
-
"type": 0,
|
|
821
|
-
"value": "View "
|
|
822
|
-
}, {
|
|
823
|
-
"type": 1,
|
|
824
|
-
"value": "the_plural"
|
|
825
|
-
}]
|
|
826
|
-
}));
|
|
870
|
+
});
|
|
827
871
|
}
|
|
828
872
|
function HomePage() {
|
|
829
873
|
var resources = usePanneauResources();
|
|
@@ -834,25 +878,29 @@ function HomePage() {
|
|
|
834
878
|
hideInNavbar = _ref3$settings2$hideI === void 0 ? false : _ref3$settings2$hideI;
|
|
835
879
|
return !hideInNavbar;
|
|
836
880
|
});
|
|
837
|
-
return /*#__PURE__*/
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
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
|
+
});
|
|
847
893
|
}
|
|
848
894
|
|
|
849
895
|
function AccountPage() {
|
|
850
|
-
return /*#__PURE__*/
|
|
851
|
-
|
|
852
|
-
|
|
896
|
+
return /*#__PURE__*/jsx(MainLayout, {
|
|
897
|
+
children: /*#__PURE__*/jsx("div", {
|
|
898
|
+
className: "container-sm py-4",
|
|
899
|
+
children: "Account page"
|
|
900
|
+
})
|
|
901
|
+
});
|
|
853
902
|
}
|
|
854
903
|
|
|
855
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
856
904
|
function LoginForm(_ref) {
|
|
857
905
|
var _ref$className = _ref.className,
|
|
858
906
|
className = _ref$className === void 0 ? null : _ref$className,
|
|
@@ -868,12 +916,12 @@ function LoginForm(_ref) {
|
|
|
868
916
|
}, [login]);
|
|
869
917
|
var FormComponents = useFormsComponents();
|
|
870
918
|
var FormComponent = getComponentFromName('login', FormComponents);
|
|
871
|
-
return FormComponent !== null ? /*#__PURE__*/
|
|
919
|
+
return FormComponent !== null ? /*#__PURE__*/jsx(FormComponent, {
|
|
872
920
|
action: url('auth.login'),
|
|
873
921
|
postForm: postForm,
|
|
874
922
|
onComplete: onSuccess,
|
|
875
923
|
className: className,
|
|
876
|
-
submitButtonLabel: /*#__PURE__*/
|
|
924
|
+
submitButtonLabel: /*#__PURE__*/jsx(FormattedMessage, {
|
|
877
925
|
id: "g6qbbX",
|
|
878
926
|
defaultMessage: [{
|
|
879
927
|
"type": 0,
|
|
@@ -894,25 +942,27 @@ function GuestLayout(_ref) {
|
|
|
894
942
|
background = _usePanneauColorSchem3 === void 0 ? null : _usePanneauColorSchem3,
|
|
895
943
|
_usePanneauColorSchem4 = _usePanneauColorSchem.text,
|
|
896
944
|
text = _usePanneauColorSchem4 === void 0 ? null : _usePanneauColorSchem4;
|
|
897
|
-
return /*#__PURE__*/
|
|
945
|
+
return /*#__PURE__*/jsxs("div", {
|
|
898
946
|
className: classNames([{
|
|
899
947
|
'd-flex flex-column min-vh-100': fullscreen
|
|
900
948
|
}]),
|
|
901
|
-
"data-bs-theme": theme !== null ? theme : undefined
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
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
|
+
});
|
|
913
964
|
}
|
|
914
965
|
|
|
915
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
916
966
|
function LoginPage() {
|
|
917
967
|
var route = useUrlGenerator();
|
|
918
968
|
// Sadly necessary to update cookies and routes correctly from the backend,
|
|
@@ -920,25 +970,30 @@ function LoginPage() {
|
|
|
920
970
|
var onSuccess = useCallback(function () {
|
|
921
971
|
window.location.href = route('home');
|
|
922
972
|
}, [route]);
|
|
923
|
-
return /*#__PURE__*/
|
|
924
|
-
fullscreen: true
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
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
|
+
});
|
|
942
997
|
}
|
|
943
998
|
|
|
944
999
|
var messages = defineMessages({
|
|
@@ -1037,15 +1092,27 @@ var messages = defineMessages({
|
|
|
1037
1092
|
function ErrorPage(_ref) {
|
|
1038
1093
|
var _ref$statusCode = _ref.statusCode,
|
|
1039
1094
|
statusCode = _ref$statusCode === void 0 ? null : _ref$statusCode;
|
|
1040
|
-
return /*#__PURE__*/
|
|
1041
|
-
fullscreen: true
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
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
|
+
});
|
|
1049
1116
|
}
|
|
1050
1117
|
|
|
1051
1118
|
var _excluded$1 = ["path", "component"];
|
|
@@ -1093,91 +1160,91 @@ function createResourceRoutes(resource, _ref) {
|
|
|
1093
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;
|
|
1094
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;
|
|
1095
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;
|
|
1096
|
-
return [/*#__PURE__*/
|
|
1097
|
-
key: "".concat(resourceId, "-create"),
|
|
1163
|
+
return [/*#__PURE__*/jsx(Route, {
|
|
1098
1164
|
path: route('resources.create', {
|
|
1099
1165
|
resource: resourceId
|
|
1100
1166
|
}),
|
|
1101
|
-
exact: true
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1167
|
+
exact: true,
|
|
1168
|
+
children: function children() {
|
|
1169
|
+
return /*#__PURE__*/jsx(ResourceCreateComponent, {
|
|
1170
|
+
resource: resource
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
}, "".concat(resourceId, "-create")), /*#__PURE__*/jsx(Route, {
|
|
1108
1174
|
path: route('resources.show', {
|
|
1109
1175
|
resource: resourceId,
|
|
1110
1176
|
id: ':id'
|
|
1111
|
-
})
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
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, {
|
|
1121
1187
|
path: route('resources.edit', {
|
|
1122
1188
|
resource: resourceId,
|
|
1123
1189
|
id: ':id'
|
|
1124
|
-
})
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
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, {
|
|
1134
1200
|
path: route('resources.delete', {
|
|
1135
1201
|
resource: resourceId,
|
|
1136
1202
|
id: ':id'
|
|
1137
|
-
})
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
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, {
|
|
1147
1213
|
path: route('resources.duplicate', {
|
|
1148
1214
|
resource: resourceId,
|
|
1149
1215
|
id: ':id'
|
|
1150
|
-
})
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
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) {
|
|
1159
1226
|
var path = _ref8.path,
|
|
1160
1227
|
component = _ref8.component,
|
|
1161
1228
|
pageProps = _objectWithoutProperties(_ref8, _excluded$1);
|
|
1162
1229
|
var RouteComponent = componentsManager.getComponent(component);
|
|
1163
|
-
return RouteComponent !== null ? /*#__PURE__*/
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
}
|
|
1170
|
-
}) : null;
|
|
1171
|
-
})), [/*#__PURE__*/
|
|
1172
|
-
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, {
|
|
1173
1239
|
path: route('resources.index', {
|
|
1174
1240
|
resource: resourceId
|
|
1175
|
-
})
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1241
|
+
}),
|
|
1242
|
+
children: function children() {
|
|
1243
|
+
return /*#__PURE__*/jsx(ResourceIndexComponent, {
|
|
1244
|
+
resource: resource
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
}, "".concat(resourceId, "-index"))]);
|
|
1181
1248
|
}
|
|
1182
1249
|
|
|
1183
1250
|
var _excluded = ["home", "login", "account", "error", "index", "show", "create", "edit", "delete", "duplicate"],
|
|
@@ -1257,54 +1324,66 @@ function PanneauRoutes(_ref) {
|
|
|
1257
1324
|
|
|
1258
1325
|
// If there is an error status code
|
|
1259
1326
|
if (statusCode !== null) {
|
|
1260
|
-
return /*#__PURE__*/
|
|
1327
|
+
return /*#__PURE__*/jsx(ErrorComponent, _objectSpread({
|
|
1261
1328
|
statusCode: statusCode
|
|
1262
1329
|
}, errorPage));
|
|
1263
1330
|
}
|
|
1264
1331
|
|
|
1265
1332
|
// If user is unauthenticated
|
|
1266
1333
|
if (user === null) {
|
|
1267
|
-
return /*#__PURE__*/
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
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
|
+
});
|
|
1272
1344
|
}
|
|
1273
1345
|
|
|
1274
1346
|
// Normal routes
|
|
1275
|
-
return /*#__PURE__*/
|
|
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
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
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
|
+
});
|
|
1308
1387
|
}
|
|
1309
1388
|
|
|
1310
1389
|
var pathToRegexpParser = createPathToRegexpParser();
|
|
@@ -1365,36 +1444,60 @@ function Container(_ref) {
|
|
|
1365
1444
|
var _useMemoryRouter = useMemoryRouter(),
|
|
1366
1445
|
memoryLocationHook = _useMemoryRouter.hook,
|
|
1367
1446
|
memorySearchHook = _useMemoryRouter.searchHook;
|
|
1368
|
-
return /*#__PURE__*/
|
|
1447
|
+
return /*#__PURE__*/jsx(Router, {
|
|
1369
1448
|
hook: isMemoryRouter ? memoryLocationHook : undefined,
|
|
1370
1449
|
searchHook: isMemoryRouter ? memorySearchHook : undefined,
|
|
1371
|
-
parser: pathToRegexpParser
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
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
|
+
});
|
|
1391
1497
|
}
|
|
1392
1498
|
|
|
1393
|
-
/* eslint-disable react/jsx-props-no-spreading */
|
|
1394
|
-
|
|
1395
|
-
// Kept for backward compatibility with exports
|
|
1396
1499
|
function ResourceFilters(props) {
|
|
1397
|
-
return /*#__PURE__*/
|
|
1500
|
+
return /*#__PURE__*/jsx(Filters, _objectSpread({}, props));
|
|
1398
1501
|
}
|
|
1399
1502
|
|
|
1400
1503
|
export { GuestLayout, MainLayout, PageHeader, ResourceFilters, ResourceFormWrapper as ResourceForm, ResourceItemsList, Container as default };
|