@uxf/cms 11.46.0 → 11.47.1
Sign up to get free protection for your applications and to get access to all the features.
- package/api/swr.d.ts +75 -0
- package/api/swr.js +43 -0
- package/lib/menu/active-item-resolver.js +14 -2
- package/package.json +7 -7
- package/pages/grid-page/grid-page.d.ts +3 -1
- package/pages/grid-page/grid-page.js +34 -30
- package/pages/grid-page/types.d.ts +1 -3
- package/security/restricted-page.d.ts +9 -0
- package/security/restricted-page.js +38 -0
- package/utils/remove-confirm-handler.js +1 -1
package/api/swr.d.ts
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
import { Schema } from "@uxf/data-grid";
|
2
|
+
import { SWRConfiguration } from "swr";
|
3
|
+
import { SWRMutationConfiguration, SWRMutationResponse } from "swr/mutation";
|
4
|
+
export declare class ApiError extends Error {
|
5
|
+
readonly code: string;
|
6
|
+
readonly statusCode: number;
|
7
|
+
readonly info: {
|
8
|
+
error: {
|
9
|
+
code: string;
|
10
|
+
message: string;
|
11
|
+
};
|
12
|
+
validationErrors: {
|
13
|
+
field: string;
|
14
|
+
message: string;
|
15
|
+
}[];
|
16
|
+
};
|
17
|
+
constructor(message: string, code: string, statusCode: number, info: {
|
18
|
+
error: {
|
19
|
+
code: string;
|
20
|
+
message: string;
|
21
|
+
};
|
22
|
+
validationErrors: {
|
23
|
+
field: string;
|
24
|
+
message: string;
|
25
|
+
}[];
|
26
|
+
});
|
27
|
+
}
|
28
|
+
export declare const _fetch: (url: string, method?: string, body?: any) => Promise<any>;
|
29
|
+
type Mixed = any;
|
30
|
+
type XString = string;
|
31
|
+
type Int = number;
|
32
|
+
type Email = string;
|
33
|
+
export interface CMSSaveUserConfigRequestBody {
|
34
|
+
name: XString;
|
35
|
+
data: Array<Mixed>;
|
36
|
+
}
|
37
|
+
export interface CMSUserResponse {
|
38
|
+
id: Int;
|
39
|
+
email: Email;
|
40
|
+
name: XString;
|
41
|
+
roles: Array<XString>;
|
42
|
+
}
|
43
|
+
export interface Metadata {
|
44
|
+
title: XString;
|
45
|
+
entityAlias: XString;
|
46
|
+
actions: Array<XString>;
|
47
|
+
}
|
48
|
+
export declare const useCmsUserConfigQuery: <T extends SWRConfiguration<Mixed, ApiError>>(config: {
|
49
|
+
path: {
|
50
|
+
name: XString;
|
51
|
+
};
|
52
|
+
} & {
|
53
|
+
skip?: boolean;
|
54
|
+
}, options?: T) => import("swr").SWRResponse<any, ApiError, T>;
|
55
|
+
export declare const useCmsUserConfigUpdateMutation: (config: {
|
56
|
+
path: {
|
57
|
+
name: XString;
|
58
|
+
};
|
59
|
+
}, options?: SWRMutationConfiguration<Mixed, ApiError, string, Mixed> | undefined) => SWRMutationResponse<Mixed, ApiError, string, Mixed>;
|
60
|
+
export declare const useCmsMeQuery: <T extends SWRConfiguration<CMSUserResponse, ApiError>>(config?: {
|
61
|
+
skip?: boolean;
|
62
|
+
}, options?: T) => import("swr").SWRResponse<CMSUserResponse, ApiError, T>;
|
63
|
+
/** @deprecated will be removed - schemas are generated */
|
64
|
+
export declare const useCmsTablesQuery: <T extends SWRConfiguration<Record<string, Metadata>, ApiError>>(config?: {
|
65
|
+
skip?: boolean;
|
66
|
+
}, options?: T) => import("swr").SWRResponse<Record<string, Metadata>, ApiError, T>;
|
67
|
+
/** @deprecated will be removed - schemas are generated */
|
68
|
+
export declare const useDatagridGetSchemaQuery: <T extends SWRConfiguration<Schema<any>, ApiError>>(config: {
|
69
|
+
path: {
|
70
|
+
name: XString;
|
71
|
+
};
|
72
|
+
} & {
|
73
|
+
skip?: boolean;
|
74
|
+
}, options?: T) => import("swr").SWRResponse<Schema<any>, ApiError, T>;
|
75
|
+
export {};
|
package/api/swr.js
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.useDatagridGetSchemaQuery = exports.useCmsTablesQuery = exports.useCmsMeQuery = exports.useCmsUserConfigUpdateMutation = exports.useCmsUserConfigQuery = exports._fetch = exports.ApiError = void 0;
|
7
|
+
const swr_1 = __importDefault(require("swr"));
|
8
|
+
const mutation_1 = __importDefault(require("swr/mutation"));
|
9
|
+
class ApiError extends Error {
|
10
|
+
constructor(message, code, statusCode, info) {
|
11
|
+
super(message);
|
12
|
+
this.code = code;
|
13
|
+
this.statusCode = statusCode;
|
14
|
+
this.info = info;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
exports.ApiError = ApiError;
|
18
|
+
const _fetch = (url, method = "GET", body = undefined) => {
|
19
|
+
var _a;
|
20
|
+
return fetch(((_a = process.env.API_URL) !== null && _a !== void 0 ? _a : "") + url, {
|
21
|
+
method,
|
22
|
+
body: typeof body !== "undefined" ? JSON.stringify(body) : undefined,
|
23
|
+
}).then(async (res) => {
|
24
|
+
const data = await res.json();
|
25
|
+
if (!res.ok) {
|
26
|
+
throw new ApiError(data.error.message, data.error.code, res.status, data);
|
27
|
+
}
|
28
|
+
return data;
|
29
|
+
});
|
30
|
+
};
|
31
|
+
exports._fetch = _fetch;
|
32
|
+
const useCmsUserConfigQuery = (config, options = {}) => (0, swr_1.default)(config.skip !== true ? `/api/cms/user-config/${config.path.name}` : null, options);
|
33
|
+
exports.useCmsUserConfigQuery = useCmsUserConfigQuery;
|
34
|
+
const useCmsUserConfigUpdateMutation = (config, options = undefined) => (0, mutation_1.default)(`/api/cms/user-config/${config.path.name}`, (url, { arg: body }) => (0, exports._fetch)(url, "PUT", body), options);
|
35
|
+
exports.useCmsUserConfigUpdateMutation = useCmsUserConfigUpdateMutation;
|
36
|
+
const useCmsMeQuery = (config = {}, options = {}) => (0, swr_1.default)(config.skip !== true ? `/api/cms/me` : null, options);
|
37
|
+
exports.useCmsMeQuery = useCmsMeQuery;
|
38
|
+
/** @deprecated will be removed - schemas are generated */
|
39
|
+
const useCmsTablesQuery = (config = {}, options = {}) => (0, swr_1.default)(config.skip !== true ? `/api/cms/tables` : null, options);
|
40
|
+
exports.useCmsTablesQuery = useCmsTablesQuery;
|
41
|
+
/** @deprecated will be removed - schemas are generated */
|
42
|
+
const useDatagridGetSchemaQuery = (config, options = {}) => (0, swr_1.default)(config.skip !== true ? `/api/cms/datagrid/schema/${config.path.name}` : null, options);
|
43
|
+
exports.useDatagridGetSchemaQuery = useDatagridGetSchemaQuery;
|
@@ -1,12 +1,24 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.ActiveItemResolver = void 0;
|
4
|
+
const is_nil_1 = require("@uxf/core/utils/is-nil");
|
4
5
|
const exactMatch = () => (menuItem) => (_, activeRoute) => {
|
5
6
|
return activeRoute === menuItem.route;
|
6
7
|
};
|
7
8
|
const exactMatchWithParams = () => (menuItem) => (router, activeRoute) => {
|
8
|
-
const isQueryEqual =
|
9
|
-
|
9
|
+
const isQueryEqual = (menuQuery, itemQuery) => {
|
10
|
+
// match when both undefined or empty
|
11
|
+
if ((0, is_nil_1.isNil)(itemQuery)) {
|
12
|
+
return Object.keys(menuQuery).length === 0;
|
13
|
+
}
|
14
|
+
const keysMenu = Object.keys(menuQuery);
|
15
|
+
const keysItem = Object.keys(itemQuery);
|
16
|
+
if (keysMenu.length !== keysItem.length) {
|
17
|
+
return false;
|
18
|
+
}
|
19
|
+
return keysMenu.every((key) => key in itemQuery && String(menuQuery[key]) === String(itemQuery[key]));
|
20
|
+
};
|
21
|
+
return activeRoute === menuItem.route && isQueryEqual(router.query, menuItem.routeParams);
|
10
22
|
};
|
11
23
|
const anyOf = (routeNames) => (menuItem) => (_, activeRoute) => {
|
12
24
|
if (activeRoute === menuItem.route) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uxf/cms",
|
3
|
-
"version": "11.
|
3
|
+
"version": "11.47.1",
|
4
4
|
"description": "UXF Cms",
|
5
5
|
"author": "UXFans <dev@uxf.cz>",
|
6
6
|
"homepage": "https://gitlab.com/uxf-npm/cms#readme",
|
@@ -30,13 +30,13 @@
|
|
30
30
|
"@dnd-kit/utilities": "3.2.2",
|
31
31
|
"@floating-ui/react": "0.26.28",
|
32
32
|
"@redux-devtools/extension": "3.3.0",
|
33
|
-
"@uxf/core": "11.
|
34
|
-
"@uxf/core-react": "11.
|
35
|
-
"@uxf/data-grid": "11.
|
36
|
-
"@uxf/form": "11.
|
33
|
+
"@uxf/core": "11.47.0",
|
34
|
+
"@uxf/core-react": "11.47.0",
|
35
|
+
"@uxf/data-grid": "11.47.1",
|
36
|
+
"@uxf/form": "11.47.1",
|
37
37
|
"@uxf/router": "11.46.0",
|
38
|
-
"@uxf/ui": "11.
|
39
|
-
"@uxf/wysiwyg": "11.
|
38
|
+
"@uxf/ui": "11.47.1",
|
39
|
+
"@uxf/wysiwyg": "11.47.1",
|
40
40
|
"axios": "1.7.5",
|
41
41
|
"axios-hooks": "5.0.2",
|
42
42
|
"es6-error": "4.1.1",
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import { Request, Response } from "@uxf/data-grid";
|
2
|
+
import React from "react";
|
2
3
|
import { GridPageConfig } from "./types";
|
3
4
|
export declare const dataGridLoader: (gridName: string, request: Request) => Promise<Response>;
|
4
|
-
|
5
|
+
/** @deprecated - use custom DataGrid on project */
|
6
|
+
export declare const GridPage: (config: GridPageConfig) => (props: any) => React.JSX.Element;
|
@@ -29,30 +29,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.GridPage = exports.dataGridLoader = void 0;
|
30
30
|
const empty_array_1 = require("@uxf/core/constants/empty-array");
|
31
31
|
const buildArray_1 = require("@uxf/core/utils/buildArray");
|
32
|
+
const is_nil_1 = require("@uxf/core/utils/is-nil");
|
32
33
|
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
34
|
+
const isServer_1 = require("@uxf/core/utils/isServer");
|
33
35
|
const data_grid_1 = require("@uxf/data-grid");
|
34
36
|
const table_1 = require("@uxf/data-grid/table");
|
35
37
|
const use_data_grid_control_1 = require("@uxf/data-grid/use-data-grid-control");
|
36
38
|
const use_data_grid_fetching_1 = require("@uxf/data-grid/use-data-grid-fetching");
|
37
39
|
const router_1 = require("@uxf/router");
|
38
40
|
const icon_1 = require("@uxf/ui/icon");
|
41
|
+
const loader_1 = require("@uxf/ui/loader");
|
39
42
|
const link_1 = __importDefault(require("next/link"));
|
40
|
-
const router_2 =
|
43
|
+
const router_2 = __importStar(require("next/router"));
|
41
44
|
const qs_1 = require("qs");
|
42
45
|
const react_1 = __importStar(require("react"));
|
43
46
|
const url_1 = require("url");
|
44
|
-
const
|
45
|
-
const
|
46
|
-
const
|
47
|
-
const
|
48
|
-
const get_initial_props_helper_1 = require("./get-initial-props-helper");
|
49
|
-
const { axiosRequest } = (0, api_2.createAxiosInstance)();
|
47
|
+
const swr_1 = require("../../api/swr");
|
48
|
+
const api_1 = require("../../lib/api");
|
49
|
+
const restricted_page_1 = require("../../security/restricted-page");
|
50
|
+
const { axiosRequest } = (0, api_1.createAxiosInstance)();
|
50
51
|
const dataGridLoader = (gridName, request) => {
|
51
52
|
return axiosRequest(null, `/api/cms/datagrid/${gridName}`, "get", null, request).then((r) => r.data);
|
52
53
|
};
|
53
54
|
exports.dataGridLoader = dataGridLoader;
|
54
55
|
const DefaultLayout = (props) => react_1.default.createElement("div", { ...props });
|
55
|
-
|
56
|
+
function GridPageComponent(props) {
|
56
57
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
57
58
|
// eslint-disable-next-line react/destructuring-assignment
|
58
59
|
const { query, AddIcon = react_1.default.createElement(icon_1.Icon, { name: "plus" }), onAddTitle = "Přidat záznam" } = props;
|
@@ -71,14 +72,14 @@ const GridPageComponent = (props) => {
|
|
71
72
|
router_2.default.replace(`${(0, url_1.parse)(((_a = window.history.state) === null || _a === void 0 ? void 0 : _a.url) || "").pathname}?${(0, qs_1.stringify)(newQuery)}`, `${(0, url_1.parse)(((_b = window.history.state) === null || _b === void 0 ? void 0 : _b.as) || "").pathname}?${(0, qs_1.stringify)(newQuery)}`, { shallow: true });
|
72
73
|
return response;
|
73
74
|
}, [query]);
|
74
|
-
const { data, isLoading, error,
|
75
|
+
const { data, isLoading, error, reload } = (0, use_data_grid_fetching_1.useDataGridFetching)({
|
75
76
|
loader: (_c = props.loader) !== null && _c !== void 0 ? _c : universalLoader,
|
76
77
|
schema: props.gridSchema,
|
77
78
|
state,
|
78
79
|
});
|
79
80
|
const actionsBag = (0, react_1.useMemo)(() => ({
|
80
|
-
reload
|
81
|
-
}), [
|
81
|
+
reload,
|
82
|
+
}), [reload]);
|
82
83
|
const hasOnAdd = props.onAdd && (!props.metaSchema || props.metaSchema.actions.includes("add"));
|
83
84
|
const cActions = [
|
84
85
|
...((_d = props.customActions) !== null && _d !== void 0 ? _d : empty_array_1.EMPTY_ARRAY),
|
@@ -129,26 +130,29 @@ const GridPageComponent = (props) => {
|
|
129
130
|
: undefined);
|
130
131
|
return (react_1.default.createElement(Layout, { key: props.entityAlias, title: (_j = (_g = props.title) !== null && _g !== void 0 ? _g : (_h = props.metaSchema) === null || _h === void 0 ? void 0 : _h.title) !== null && _j !== void 0 ? _j : "" },
|
131
132
|
react_1.default.createElement("div", { className: "mb-10" },
|
132
|
-
react_1.default.createElement(data_grid_1.DataGrid, { NoRowsFallback: (_k = props.ui) === null || _k === void 0 ? void 0 : _k.NoRowsFallback, SelectedRowsToolbarActions: (_l = props.ui) === null || _l === void 0 ? void 0 : _l.SelectedRowsToolbarActions, actionCell: actionCell, actions: actions, bodyCells: (_m = props.ui) === null || _m === void 0 ? void 0 : _m.BodyCells, customActions: cActions, data: data, error: error, filterHandlers: (_o = props.ui) === null || _o === void 0 ? void 0 : _o.FilterHandlers, gridName: props.entityAlias, isLoading: isLoading, isRowSelectable: props.selectable, onCsvDownload: (r) => window.open(`/api/cms/datagrid/export/${props.entityAlias}?${(0, qs_1.stringify)(r)}`),
|
133
|
-
}
|
133
|
+
react_1.default.createElement(data_grid_1.DataGrid, { NoRowsFallback: (_k = props.ui) === null || _k === void 0 ? void 0 : _k.NoRowsFallback, SelectedRowsToolbarActions: (_l = props.ui) === null || _l === void 0 ? void 0 : _l.SelectedRowsToolbarActions, actionCell: actionCell, actions: actions, bodyCells: (_m = props.ui) === null || _m === void 0 ? void 0 : _m.BodyCells, customActions: cActions, data: data, error: error, filterHandlers: (_o = props.ui) === null || _o === void 0 ? void 0 : _o.FilterHandlers, gridName: props.entityAlias, isLoading: isLoading, isRowSelectable: props.selectable, onCsvDownload: (r) => window.open(`/api/cms/datagrid/export/${props.entityAlias}?${(0, qs_1.stringify)(r)}`), reload: reload, rowHeight: props.rowHeight, schema: props.gridSchema, state: state }))));
|
134
|
+
}
|
134
135
|
GridPageComponent.displayName = "GridPageComponent";
|
136
|
+
/** @deprecated - use custom DataGrid on project */
|
135
137
|
const GridPage = (config) => {
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
const
|
141
|
-
const
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
138
|
+
var _a;
|
139
|
+
function Component() {
|
140
|
+
var _a, _b;
|
141
|
+
const router = (0, router_2.useRouter)();
|
142
|
+
const userConfigQuery = (0, swr_1.useCmsUserConfigQuery)({ path: { name: `v1--hidden-columns--${config.entityAlias}` } });
|
143
|
+
const cmsTablesQuery = (0, swr_1.useCmsTablesQuery)();
|
144
|
+
const dataGridSchemaQuery = (0, swr_1.useDatagridGetSchemaQuery)({ path: { name: config.entityAlias } });
|
145
|
+
if (cmsTablesQuery.isLoading || dataGridSchemaQuery.isLoading || isServer_1.isServer) {
|
146
|
+
return (react_1.default.createElement("div", { className: "flex min-h-screen w-full items-center justify-center" },
|
147
|
+
react_1.default.createElement(loader_1.Loader, null)));
|
148
|
+
}
|
149
|
+
const metadata = (_a = cmsTablesQuery.data) === null || _a === void 0 ? void 0 : _a[config.entityAlias];
|
150
|
+
const schema = dataGridSchemaQuery.data;
|
151
|
+
if ((0, is_nil_1.isNil)(schema) || (0, is_nil_1.isNil)(metadata)) {
|
152
|
+
return react_1.default.createElement("div", null, "Omlouv\u00E1me se, n\u011Bco se pokazilo.");
|
153
|
+
}
|
154
|
+
return (react_1.default.createElement(GridPageComponent, { AddIcon: config.AddIcon, customActions: config.customActions, entityAlias: config.entityAlias, getEditUrl: config.getEditUrl, getOpenUrl: config.getOpenUrl, gridSchema: schema, initialHiddenColumns: (_b = userConfigQuery.data) !== null && _b !== void 0 ? _b : [], initialUserConfig: config.initialUserConfig, loader: config.loader, metaSchema: metadata, onAdd: config.onAdd, onAddTitle: config.onAddTitle, onEdit: config.onEdit, onOpen: config.onOpen, onRemove: config.onRemove, query: router.query, rowHeight: config.rowHeight, selectable: config.selectable, title: config.title, ui: config.ui }));
|
155
|
+
}
|
156
|
+
return (0, restricted_page_1.restrictedPage)(Component, { allowedRole: (_a = config.allowedRoles) !== null && _a !== void 0 ? _a : ["ROLE_ROOT"] });
|
153
157
|
};
|
154
158
|
exports.GridPage = GridPage;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { Nullish } from "@uxf/core/types";
|
2
2
|
import { ActionCellComponent, DataGridProps, DataGridUserConfig, Loader, Schema } from "@uxf/data-grid";
|
3
|
-
import { NextPageContext } from "next";
|
4
3
|
import { ParsedUrlQuery } from "querystring";
|
5
4
|
import { FC, ReactElement } from "react";
|
6
5
|
import { EntityMetaSchema } from "../../api";
|
@@ -42,11 +41,10 @@ export type GridPageComponentProps = {
|
|
42
41
|
customActions?: DataGridProps<any, any>["customActions"];
|
43
42
|
initialUserConfig?: DataGridUserConfig<any> | Nullish;
|
44
43
|
};
|
45
|
-
export type EntityAliasExtractor = (ctx: NextPageContext) => string;
|
46
44
|
export type GridPageConfig<T extends object = any> = {
|
47
45
|
ui?: UIComponents;
|
48
46
|
title?: string;
|
49
|
-
entityAlias: string
|
47
|
+
entityAlias: string;
|
50
48
|
onOpen?: (entityAlias: string, row: T, actions: ActionsBag) => void;
|
51
49
|
getOpenUrl?: (entityAlias: string, row: T) => string | undefined | null;
|
52
50
|
onAdd?: (entityAlias: string, actions: ActionsBag) => void;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React, { ReactNode } from "react";
|
2
|
+
interface Config {
|
3
|
+
allowedRole: string[];
|
4
|
+
}
|
5
|
+
export declare function ErrorContent(props: {
|
6
|
+
error: any;
|
7
|
+
}): React.JSX.Element;
|
8
|
+
export declare function restrictedPage(Component: () => ReactNode, config: Config): (props: any) => React.JSX.Element;
|
9
|
+
export {};
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.ErrorContent = ErrorContent;
|
7
|
+
exports.restrictedPage = restrictedPage;
|
8
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
9
|
+
const button_1 = require("@uxf/ui/button");
|
10
|
+
const loader_1 = require("@uxf/ui/loader");
|
11
|
+
const react_1 = __importDefault(require("react"));
|
12
|
+
const swr_1 = require("../api/swr");
|
13
|
+
function ErrorContent(props) {
|
14
|
+
if (props.error.code === "UNAUTHORIZED") {
|
15
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
16
|
+
react_1.default.createElement("div", null, "Mus\u00EDte se p\u0159\u00EDhl\u00E1sit"),
|
17
|
+
react_1.default.createElement(button_1.Button, { href: `/admin/login?redirect=${window.location.href}` }, "P\u0159ihl\u00E1sit")));
|
18
|
+
}
|
19
|
+
return react_1.default.createElement("div", null, "Vyskytla se chyba");
|
20
|
+
}
|
21
|
+
function restrictedPage(Component, config) {
|
22
|
+
return function Page(props) {
|
23
|
+
const meQuery = (0, swr_1.useCmsMeQuery)();
|
24
|
+
if (meQuery.isLoading || typeof window === "undefined") {
|
25
|
+
return (react_1.default.createElement("div", { className: "flex min-h-screen w-full items-center justify-center" },
|
26
|
+
react_1.default.createElement(loader_1.Loader, null)));
|
27
|
+
}
|
28
|
+
if ((0, is_not_nil_1.isNotNil)(meQuery.error)) {
|
29
|
+
return (react_1.default.createElement("div", { className: "flex min-h-screen w-full flex-col items-center justify-center gap-4" },
|
30
|
+
react_1.default.createElement(ErrorContent, { error: meQuery.error })));
|
31
|
+
}
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
33
|
+
if (!config.allowedRole.some((role) => { var _a, _b; return (_b = (_a = meQuery.data) === null || _a === void 0 ? void 0 : _a.roles) === null || _b === void 0 ? void 0 : _b.includes(role); })) {
|
34
|
+
return (react_1.default.createElement("div", { className: "flex min-h-screen w-full items-center justify-center" }, "Pro tuto str\u00E1nku nem\u00E1te opr\u00E1vn\u011Bn\u00ED."));
|
35
|
+
}
|
36
|
+
return react_1.default.createElement(Component, { ...props });
|
37
|
+
};
|
38
|
+
}
|
@@ -11,7 +11,7 @@ const react_1 = __importDefault(require("react"));
|
|
11
11
|
function removeConfirmHandler() {
|
12
12
|
return new Promise((resolve) => {
|
13
13
|
(0, modal_1.openModal)({
|
14
|
-
|
14
|
+
isBackdropCloseDisabled: true,
|
15
15
|
children: (react_1.default.createElement(modal_dialog_1.ModalDialog, { footer: react_1.default.createElement(react_1.default.Fragment, null,
|
16
16
|
react_1.default.createElement(button_1.Button, { onClick: () => {
|
17
17
|
resolve(false);
|