@uxf/cms 11.31.2 → 11.33.0
Sign up to get free protection for your applications and to get access to all the features.
- package/api/index.js +22 -20
- package/config/container.js +3 -3
- package/context/cms-provider.d.ts +2 -2
- package/context/cms-provider.js +1 -2
- package/deprecated/redux/entities/selectors.js +3 -2
- package/deprecated/redux/redux-helper.js +1 -2
- package/forms/change-password-form/change-password-form.js +1 -1
- package/forms/components/wysiwyg-input/wysiwyg-input.js +8 -8
- package/forms/forgotten-password-form/forgotten-password-form.js +3 -3
- package/forms/invite-user-form/invite-user-form.js +7 -7
- package/forms/login-form/login-form.js +4 -4
- package/lib/api/create-axios-instance.d.ts +1 -1
- package/lib/api/create-axios-instance.js +1 -2
- package/lib/api/create-use-axios-request.d.ts +1 -1
- package/lib/layout/breadcrumbs.js +4 -2
- package/lib/layout/layout.js +3 -3
- package/lib/layout/sidebar.js +5 -5
- package/lib/layout/types.d.ts +9 -9
- package/lib/menu/factory.js +7 -8
- package/lib/menu/mobile-bar.js +6 -6
- package/lib/menu/model.js +4 -2
- package/lib/menu/ui/list-item/list-item.d.ts +1 -1
- package/lib/menu/ui/list-item/list-item.js +10 -10
- package/lib/menu/ui/menu-item.js +1 -1
- package/lib/menu/ui/sub-menu/sub-menu-item.js +1 -1
- package/lib/menu/ui/sub-menu/sub-menu-mobile.js +1 -1
- package/lib/menu/ui/sub-menu/sub-menu.js +1 -1
- package/lib/menu/ui/sub-menu/use-sub-menu.d.ts +7 -8
- package/lib/menu/ui/sub-menu/use-sub-menu.js +2 -3
- package/lib/menu/ui/user-menu.js +6 -4
- package/package.json +19 -19
- package/pages/content-builder/components/form-content.js +7 -7
- package/pages/content-builder/components/form-root-fields.js +20 -19
- package/pages/content-builder/components/form.js +2 -2
- package/pages/content-builder/components/header.js +1 -1
- package/pages/content-builder/content/feature-section.js +9 -9
- package/pages/content-builder/content/gallery.js +1 -1
- package/pages/content-builder/content/hero-section.js +4 -4
- package/pages/content-builder/content/people.js +9 -9
- package/pages/content-builder/content/wysiwyg.js +2 -2
- package/pages/content-builder/content-builder-page.js +2 -2
- package/pages/content-builder/content-field.js +12 -12
- package/pages/content-builder/content-header.js +4 -4
- package/pages/content-builder/context/details-visibility-context.js +2 -1
- package/pages/content-builder/mapper.js +5 -5
- package/pages/content-builder/types.d.ts +33 -33
- package/pages/forgotten-password-page/forgotten-password-page.js +1 -1
- package/pages/form-page/base-field.js +15 -15
- package/pages/form-page/field/content.js +1 -1
- package/pages/form-page/field-array.js +3 -3
- package/pages/form-page/form-page.d.ts +1 -1
- package/pages/form-page/form-page.js +3 -2
- package/pages/form-page/form.d.ts +1 -1
- package/pages/form-page/form.js +7 -8
- package/pages/form-page/mapper.js +2 -1
- package/pages/grid-page/get-initial-props-helper.js +2 -3
- package/pages/grid-page/grid-page.js +4 -3
- package/pages/grid-page/types.d.ts +12 -13
- package/pages/login-page/login-page.js +2 -1
- package/pages/renew-password-page/renew-password-page.js +1 -1
- package/security/use-logged-user.js +1 -2
- package/ui/avatar/get-avatar-user-letters.js +5 -4
- package/ui/copy-to-clipboard/copy-to-clipboard.js +3 -2
- package/utils/on-remove-confirm.js +1 -2
- package/utils/use-viewport-height.js +1 -2
package/api/index.js
CHANGED
@@ -1,25 +1,39 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.dataGridAutocompleteGet = void 0;
|
4
|
+
exports.contentGet = contentGet;
|
5
|
+
exports.contentCreate = contentCreate;
|
6
|
+
exports.contentUpdate = contentUpdate;
|
7
|
+
exports.dataGridSchemaGet = dataGridSchemaGet;
|
8
|
+
exports.forgottenPassword = forgottenPassword;
|
9
|
+
exports.getLoggedUser = getLoggedUser;
|
10
|
+
exports.getEntityMetaSchemas = getEntityMetaSchemas;
|
11
|
+
exports.getFormSchema = getFormSchema;
|
12
|
+
exports.getFormValues = getFormValues;
|
13
|
+
exports.login = login;
|
14
|
+
exports.autocomplete = autocomplete;
|
15
|
+
exports.saveFormValues = saveFormValues;
|
16
|
+
exports.removeEntity = removeEntity;
|
17
|
+
exports.userConfigSave = userConfigSave;
|
18
|
+
exports.userConfigGetAll = userConfigGetAll;
|
19
|
+
exports.userConfigGet = userConfigGet;
|
20
|
+
exports.uploadFile = uploadFile;
|
21
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
4
22
|
// eslint-disable-next-line import/no-cycle
|
5
23
|
const api_1 = require("../lib/api");
|
6
24
|
const { axiosRequest, axiosInstance } = (0, api_1.createAxiosInstance)();
|
7
25
|
function contentGet(ctx, contentId) {
|
8
26
|
return axiosRequest(ctx, `/api/cms/content/${contentId}`, "get", null, null);
|
9
27
|
}
|
10
|
-
exports.contentGet = contentGet;
|
11
28
|
function contentCreate(ctx, content) {
|
12
29
|
return axiosRequest(ctx, "/api/cms/content", "post", content, null);
|
13
30
|
}
|
14
|
-
exports.contentCreate = contentCreate;
|
15
31
|
function contentUpdate(ctx, contentId, content) {
|
16
32
|
return axiosRequest(ctx, `/api/cms/content/${contentId}`, "put", content, null);
|
17
33
|
}
|
18
|
-
exports.contentUpdate = contentUpdate;
|
19
34
|
function dataGridSchemaGet(ctx, gridName) {
|
20
35
|
return axiosRequest(ctx, `/api/cms/datagrid/schema/${gridName}`, "get", null, null);
|
21
36
|
}
|
22
|
-
exports.dataGridSchemaGet = dataGridSchemaGet;
|
23
37
|
const dataGridAutocompleteGet = (ctx, gridName, filterName, text) => {
|
24
38
|
return axiosRequest(ctx, `/api/cms/datagrid/autocomplete/${gridName}/${filterName}`, "get", null, { s: text }).then((r) => r.data);
|
25
39
|
};
|
@@ -27,49 +41,38 @@ exports.dataGridAutocompleteGet = dataGridAutocompleteGet;
|
|
27
41
|
function forgottenPassword(ctx, email, cms = true) {
|
28
42
|
return axiosRequest(ctx, "/api/forgotten-password", "post", { email, cms }, null).then(() => undefined);
|
29
43
|
}
|
30
|
-
exports.forgottenPassword = forgottenPassword;
|
31
44
|
function getLoggedUser(ctx = null) {
|
32
45
|
return axiosRequest(ctx, `/api/cms/user`, "get", null, null).then((r) => r.data.user);
|
33
46
|
}
|
34
|
-
exports.getLoggedUser = getLoggedUser;
|
35
47
|
function getEntityMetaSchemas(ctx) {
|
36
48
|
return axiosRequest(ctx, "/api/cms/tables", "get", null, null);
|
37
49
|
}
|
38
|
-
exports.getEntityMetaSchemas = getEntityMetaSchemas;
|
39
50
|
function getFormSchema(ctx, path) {
|
40
51
|
return axiosRequest(ctx, `/api/cms/form/${path.entityAlias}/schema`, "get", null, null);
|
41
52
|
}
|
42
|
-
exports.getFormSchema = getFormSchema;
|
43
53
|
function getFormValues(ctx, path) {
|
44
54
|
return axiosRequest(ctx, `/api/cms/form/${path.entityAlias}/${path.id}`, "get", null, null);
|
45
55
|
}
|
46
|
-
exports.getFormValues = getFormValues;
|
47
56
|
function login(ctx, body) {
|
48
57
|
return axiosRequest(ctx, "/api/login", "post", body, null);
|
49
58
|
}
|
50
|
-
exports.login = login;
|
51
59
|
function autocomplete(ctx, path, query) {
|
52
60
|
return axiosRequest(ctx, `/api/cms/autocomplete/${path.name}`, "get", null, query);
|
53
61
|
}
|
54
|
-
exports.autocomplete = autocomplete;
|
55
62
|
function saveFormValues(ctx, path, body) {
|
56
63
|
return path.id
|
57
64
|
? axiosRequest(ctx, `/api/cms/form/${path.entityAlias}/${path.id}`, "put", body, null)
|
58
65
|
: axiosRequest(ctx, `/api/cms/form/${path.entityAlias}`, "post", body, null);
|
59
66
|
}
|
60
|
-
exports.saveFormValues = saveFormValues;
|
61
67
|
function removeEntity(ctx, path) {
|
62
68
|
return axiosRequest(ctx, `/api/cms/form/${path.entityAlias}/${path.id}`, "delete", null, null);
|
63
69
|
}
|
64
|
-
exports.removeEntity = removeEntity;
|
65
70
|
async function userConfigSave(name, data) {
|
66
71
|
return axiosRequest(null, "/api/cms/user-config", "post", { name, data }, null);
|
67
72
|
}
|
68
|
-
exports.userConfigSave = userConfigSave;
|
69
73
|
function userConfigGetAll(ctx) {
|
70
74
|
return axiosRequest(ctx, "/api/cms/user-config", "get", null, null);
|
71
75
|
}
|
72
|
-
exports.userConfigGetAll = userConfigGetAll;
|
73
76
|
async function userConfigGet(ctx, name, defaultValue) {
|
74
77
|
const configs = await userConfigGetAll(ctx).then((r) => r.data);
|
75
78
|
const configsName = configs[name];
|
@@ -78,7 +81,6 @@ async function userConfigGet(ctx, name, defaultValue) {
|
|
78
81
|
}
|
79
82
|
return defaultValue;
|
80
83
|
}
|
81
|
-
exports.userConfigGet = userConfigGet;
|
82
84
|
async function uploadFile(file, namespace = "default") {
|
83
85
|
const formData = new FormData();
|
84
86
|
formData.append("files[]", file);
|
@@ -86,9 +88,9 @@ async function uploadFile(file, namespace = "default") {
|
|
86
88
|
timeout: 100 * 1000,
|
87
89
|
params: namespace ? { namespace } : {},
|
88
90
|
});
|
89
|
-
|
90
|
-
|
91
|
+
const firstFile = response.data.at(0);
|
92
|
+
if ((0, is_not_nil_1.isNotNil)(firstFile)) {
|
93
|
+
return firstFile;
|
91
94
|
}
|
92
95
|
throw new Error("Response is null");
|
93
96
|
}
|
94
|
-
exports.uploadFile = uploadFile;
|
package/config/container.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.Container = void 0;
|
4
|
-
|
5
|
-
const api_1 = require("../api");
|
4
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
5
|
+
const api_1 = require("../api"); // eslint-disable-line import/no-cycle
|
6
6
|
class Container {
|
7
7
|
constructor() {
|
8
8
|
// TODO @vejvis - move initial values to better place
|
@@ -23,7 +23,7 @@ class Container {
|
|
23
23
|
return value;
|
24
24
|
}
|
25
25
|
has(key) {
|
26
|
-
return
|
26
|
+
return (0, is_not_nil_1.isNotNil)(this.store[key]);
|
27
27
|
}
|
28
28
|
}
|
29
29
|
exports.Container = Container;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import
|
2
|
-
export declare function CmsProvider(props: PropsWithChildren):
|
1
|
+
import { PropsWithChildren, ReactNode } from "react";
|
2
|
+
export declare function CmsProvider(props: PropsWithChildren): ReactNode;
|
package/context/cms-provider.js
CHANGED
@@ -3,11 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.CmsProvider =
|
6
|
+
exports.CmsProvider = CmsProvider;
|
7
7
|
const react_1 = __importDefault(require("react"));
|
8
8
|
const swr_1 = require("swr");
|
9
9
|
const fetcher = (input, init) => fetch(input, init).then((res) => res.json());
|
10
10
|
function CmsProvider(props) {
|
11
11
|
return react_1.default.createElement(swr_1.SWRConfig, { value: { provider: () => new Map(), fetcher } }, props.children);
|
12
12
|
}
|
13
|
-
exports.CmsProvider = CmsProvider;
|
@@ -1,15 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.formSchemaSelector = exports.formSchemaExistsSelector = exports.gridSchemaSelector = exports.gridSchemaExistsSelector = exports.metaSchemaSelector = exports.metaSchemaExistsSelector = void 0;
|
4
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
4
5
|
const metaSchemaExistsSelector = (state) => Object.keys(state.entities.meta).length > 0;
|
5
6
|
exports.metaSchemaExistsSelector = metaSchemaExistsSelector;
|
6
7
|
const metaSchemaSelector = (entityAlias) => (state) => state.entities.meta[entityAlias];
|
7
8
|
exports.metaSchemaSelector = metaSchemaSelector;
|
8
|
-
const gridSchemaExistsSelector = (entityAlias) => (state) =>
|
9
|
+
const gridSchemaExistsSelector = (entityAlias) => (state) => (0, is_not_nil_1.isNotNil)(state.entities.grid[entityAlias]);
|
9
10
|
exports.gridSchemaExistsSelector = gridSchemaExistsSelector;
|
10
11
|
const gridSchemaSelector = (entityAlias) => (state) => state.entities.grid[entityAlias];
|
11
12
|
exports.gridSchemaSelector = gridSchemaSelector;
|
12
|
-
const formSchemaExistsSelector = (entityAlias) => (state) =>
|
13
|
+
const formSchemaExistsSelector = (entityAlias) => (state) => (0, is_not_nil_1.isNotNil)(state.entities.form[entityAlias]);
|
13
14
|
exports.formSchemaExistsSelector = formSchemaExistsSelector;
|
14
15
|
const formSchemaSelector = (entityAlias) => (state) => state.entities.form[entityAlias];
|
15
16
|
exports.formSchemaSelector = formSchemaSelector;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.createAction =
|
3
|
+
exports.createAction = createAction;
|
4
4
|
function createAction(type, payload) {
|
5
5
|
return payload === undefined ? { type } : { type, payload };
|
6
6
|
}
|
7
|
-
exports.createAction = createAction;
|
@@ -18,7 +18,7 @@ const ChangePasswordForm = (props) => {
|
|
18
18
|
});
|
19
19
|
return (react_1.default.createElement(form_1.Form, { formApi: formApi, id: "change-password-form", ...formProps },
|
20
20
|
react_1.default.createElement(widget_1.Widget, { className: "[&>*]:p-4", footer: react_1.default.createElement("div", { className: "text-right" },
|
21
|
-
react_1.default.createElement(button_1.Button, {
|
21
|
+
react_1.default.createElement(button_1.Button, { isDisabled: formApi.formState.isSubmitting, type: "submit" }, "Ulo\u017Eit")), withDividers: true },
|
22
22
|
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isRequired: true, label: "P\u016Fvodn\u00ED heslo", name: "originalPassword", type: "password" }),
|
23
23
|
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isRequired: true, label: "Nov\u00E9 heslo", name: "newPassword", rules: props.passwordRules, type: "password" }),
|
24
24
|
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isRequired: true, label: "Nov\u00E9 heslo znovu", name: "newPasswordAgain", rules: { validate: (v) => v === formApi.getValues("newPassword") || "Hesla musí být stejná" }, type: "password" }))));
|
@@ -23,11 +23,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
23
|
return result;
|
24
24
|
};
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.WysiwygInput =
|
26
|
+
exports.WysiwygInput = WysiwygInput;
|
27
27
|
const use_input_focus_1 = require("@uxf/core-react/hooks/use-input-focus");
|
28
28
|
const classes_1 = require("@uxf/core/constants/classes");
|
29
29
|
const cx_1 = require("@uxf/core/utils/cx");
|
30
30
|
const file_1 = require("@uxf/core/utils/file");
|
31
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
31
32
|
const form_component_1 = require("@uxf/ui/form-component");
|
32
33
|
const wysiwyg_1 = require("@uxf/wysiwyg");
|
33
34
|
const create_all_plugins_with_ui_1 = require("@uxf/wysiwyg/create-all-plugins-with-ui");
|
@@ -35,14 +36,14 @@ const react_1 = __importStar(require("react"));
|
|
35
36
|
const react_hook_form_1 = require("react-hook-form");
|
36
37
|
const api_1 = require("../../../api");
|
37
38
|
function WysiwygInput(props) {
|
38
|
-
var _a, _b, _c, _d
|
39
|
+
var _a, _b, _c, _d;
|
39
40
|
const { field, fieldState } = (0, react_hook_form_1.useController)({
|
40
41
|
control: props.control,
|
41
42
|
defaultValue: props.defaultValue,
|
42
43
|
name: props.name,
|
43
44
|
rules: {
|
44
45
|
required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
|
45
|
-
...
|
46
|
+
...props.rules,
|
46
47
|
},
|
47
48
|
shouldUnregister: props.shouldUnregister,
|
48
49
|
});
|
@@ -53,19 +54,19 @@ function WysiwygInput(props) {
|
|
53
54
|
: (0, create_all_plugins_with_ui_1.createAllPluginsWithUi)((_a = props.allPluginsOptions) !== null && _a !== void 0 ? _a : { image: { getImageUrl: file_1.getFileUrl, uploadImage: api_1.uploadFile } });
|
54
55
|
}, [props.allPluginsOptions, props.plugins]);
|
55
56
|
const generatedId = (0, react_1.useId)();
|
56
|
-
const id = (
|
57
|
+
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
57
58
|
const innerRef = (0, react_1.useRef)(null);
|
58
59
|
const input = (0, use_input_focus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
59
|
-
const isInvalid =
|
60
|
+
const isInvalid = (0, is_not_nil_1.isNotNil)(fieldState.error);
|
60
61
|
const errorId = isInvalid ? `${props.id}--error-message` : undefined;
|
61
|
-
const rootClassName = (0, cx_1.cx)("uxf-text-input", ((
|
62
|
+
const rootClassName = (0, cx_1.cx)("uxf-text-input", ((_b = props.isFocused) !== null && _b !== void 0 ? _b : input.focused) && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.className);
|
62
63
|
const onBlur = (0, react_1.useCallback)((e) => {
|
63
64
|
var _a;
|
64
65
|
field.onBlur();
|
65
66
|
input.onBlur(e);
|
66
67
|
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
67
68
|
}, [field, input, props]);
|
68
|
-
return (react_1.default.createElement(form_component_1.FormComponent, { className: rootClassName, errorId: errorId, form: props.form, helperText: (
|
69
|
+
return (react_1.default.createElement(form_component_1.FormComponent, { className: rootClassName, errorId: errorId, form: props.form, helperText: (_d = (_c = fieldState.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : props.helperText, hiddenLabel: props.hiddenLabel, inputId: id, isRequired: props.isRequired, label: props.label, name: props.name },
|
69
70
|
react_1.default.createElement(wysiwyg_1.WysiwygEditor, { editableProps: {
|
70
71
|
"aria-describedby": errorId,
|
71
72
|
"aria-invalid": isInvalid,
|
@@ -80,4 +81,3 @@ function WysiwygInput(props) {
|
|
80
81
|
required: props.isRequired,
|
81
82
|
}, id: id, initialValue: field.value, onChange: field.onChange, plugins: plugins, ...props.editorProps })));
|
82
83
|
}
|
83
|
-
exports.WysiwygInput = WysiwygInput;
|
@@ -42,9 +42,9 @@ const ForgottenPasswordForm = (props) => {
|
|
42
42
|
}, []);
|
43
43
|
return (react_1.default.createElement(form_1.Form, { formApi: formApi, id: "forgotten-password-form", ...formProps },
|
44
44
|
react_1.default.createElement("div", { className: "space-y-6" },
|
45
|
-
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isDisabled: formDisabled, label: "E-mail", name: "username",
|
46
|
-
react_1.default.createElement(button_1.Button, { isDisabled: formDisabled || formApi.formState.isSubmitting, isLoading: formApi.formState.isSubmitting, type: "submit"
|
45
|
+
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isDisabled: formDisabled, isRequired: true, label: "E-mail", name: "username", type: "text" }),
|
46
|
+
react_1.default.createElement(button_1.Button, { isDisabled: formDisabled || formApi.formState.isSubmitting, isFullWidth: true, isLoading: formApi.formState.isSubmitting, type: "submit" }, "Obnovit heslo"),
|
47
47
|
onLogin && (react_1.default.createElement("div", { className: "text-right" },
|
48
|
-
react_1.default.createElement(text_link_1.TextLink, {
|
48
|
+
react_1.default.createElement(text_link_1.TextLink, { className: "uxf-typo-medium2 text-primary", isDisabled: formApi.formState.isSubmitting, onClick: onLogin }, "P\u0159ihl\u00E1sit"))))));
|
49
49
|
};
|
50
50
|
exports.ForgottenPasswordForm = ForgottenPasswordForm;
|
@@ -20,12 +20,12 @@ const InviteUserForm = (props) => {
|
|
20
20
|
defaultValues,
|
21
21
|
});
|
22
22
|
return (react_1.default.createElement(form_1.Form, { formApi: formApi, id: "invite-user-form", ...formProps },
|
23
|
-
react_1.default.createElement(widget_1.Widget, {
|
24
|
-
react_1.default.createElement(button_1.Button, {
|
25
|
-
react_1.default.createElement(text_input_1.TextInput, {
|
26
|
-
react_1.default.createElement(text_input_1.TextInput, {
|
27
|
-
react_1.default.createElement(text_input_1.TextInput, {
|
28
|
-
react_1.default.createElement(multi_combobox_1.MultiCombobox, {
|
29
|
-
react_1.default.createElement(checkbox_input_1.CheckboxInput, {
|
23
|
+
react_1.default.createElement(widget_1.Widget, { className: "[&>*]:p-4", footer: react_1.default.createElement("div", { className: "text-right" },
|
24
|
+
react_1.default.createElement(button_1.Button, { isDisabled: formApi.formState.isSubmitting, type: "submit" }, "Ulo\u017Eit")), withDividers: true },
|
25
|
+
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isRequired: true, label: "E-mail", name: "email", type: "email" }),
|
26
|
+
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isRequired: true, label: "Jm\u00E9no", name: "name" }),
|
27
|
+
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isRequired: true, label: "P\u0159\u00EDjmen\u00ED", name: "surname" }),
|
28
|
+
react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: formApi.control, isRequired: true, label: "Role", loadOptions: props.onLoadRoles, name: "roles" }),
|
29
|
+
react_1.default.createElement(checkbox_input_1.CheckboxInput, { control: formApi.control, label: "Odeslat pozv\u00E1nku", name: "sendInvitation" }))));
|
30
30
|
};
|
31
31
|
exports.InviteUserForm = InviteUserForm;
|
@@ -40,10 +40,10 @@ const LoginForm = (props) => {
|
|
40
40
|
}, []);
|
41
41
|
return (react_1.default.createElement(form_1.Form, { formApi: formApi, id: "login-form", ...formProps },
|
42
42
|
react_1.default.createElement("div", { className: "space-y-6" },
|
43
|
-
react_1.default.createElement(text_input_1.TextInput, { isDisabled: formDisabled, label: "E-mail", name: "username", type: "email"
|
44
|
-
react_1.default.createElement(text_input_1.TextInput, { isDisabled: formDisabled, label: "Heslo", name: "password", type: "password"
|
43
|
+
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isDisabled: formDisabled, isRequired: true, label: "E-mail", name: "username", type: "email" }),
|
44
|
+
react_1.default.createElement(text_input_1.TextInput, { control: formApi.control, isDisabled: formDisabled, isRequired: true, label: "Heslo", name: "password", type: "password" }),
|
45
45
|
onForgottenPassword && (react_1.default.createElement("div", { className: "text-right" },
|
46
|
-
react_1.default.createElement(text_link_1.TextLink, {
|
47
|
-
react_1.default.createElement(button_1.Button, { type: "submit"
|
46
|
+
react_1.default.createElement(text_link_1.TextLink, { className: "uxf-typo-medium2 text-primary", isDisabled: formApi.formState.isSubmitting, onClick: onForgottenPassword }, "Nepamatujete si sv\u00E9 heslo?"))),
|
47
|
+
react_1.default.createElement(button_1.Button, { isFullWidth: true, type: "submit" }, "P\u0159ihl\u00E1sit se"))));
|
48
48
|
};
|
49
49
|
exports.LoginForm = LoginForm;
|
@@ -2,5 +2,5 @@ import { AxiosRequestConfig } from "axios";
|
|
2
2
|
export declare function createAxiosInstance(requestConfig?: AxiosRequestConfig): {
|
3
3
|
axiosInstance: import("axios").AxiosInstance;
|
4
4
|
axiosRequest: <Response>(ctx: any, url: string, method: import("axios").Method, body: object | null, query: object | null) => Promise<import("axios").AxiosResponse<Response, any>>;
|
5
|
-
useAxiosRequest: <
|
5
|
+
useAxiosRequest: <Response extends Record<string, any> | boolean, RequestBody extends Record<string, any> | null, RequestQuery extends Record<string, any> | null, RequestPath extends Record<string, any> | null>(url: string, method: import("axios").Method, config: import("./types").RequestConfig<RequestBody, RequestQuery, RequestPath>) => [import("axios-hooks").ResponseValues<Response, any, any>, import("./types").Execute<Response, RequestBody, RequestQuery, RequestPath>];
|
6
6
|
};
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.createAxiosInstance =
|
6
|
+
exports.createAxiosInstance = createAxiosInstance;
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
8
8
|
// eslint-disable-next-line import/no-cycle
|
9
9
|
const create_axios_request_1 = require("./create-axios-request");
|
@@ -16,4 +16,3 @@ function createAxiosInstance(requestConfig = {}) {
|
|
16
16
|
useAxiosRequest: (0, create_use_axios_request_1.createUseAxiosRequest)(instance, requestConfig),
|
17
17
|
};
|
18
18
|
}
|
19
|
-
exports.createAxiosInstance = createAxiosInstance;
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { AxiosInstance, AxiosRequestConfig, Method } from "axios";
|
2
2
|
import { ResponseValues } from "axios-hooks";
|
3
3
|
import { Execute, RequestConfig } from "./types";
|
4
|
-
export declare const createUseAxiosRequest: (axiosInstance: AxiosInstance, requestConfig: AxiosRequestConfig) => <Response extends
|
4
|
+
export declare const createUseAxiosRequest: (axiosInstance: AxiosInstance, requestConfig: AxiosRequestConfig) => <Response extends Record<string, any> | boolean, RequestBody extends Record<string, any> | null, RequestQuery extends Record<string, any> | null, RequestPath extends Record<string, any> | null>(url: string, method: Method, config: RequestConfig<RequestBody, RequestQuery, RequestPath>) => [ResponseValues<Response, any, any>, Execute<Response, RequestBody, RequestQuery, RequestPath>];
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.Breadcrumbs = void 0;
|
7
|
+
const hide_1 = require("@uxf/core-react/components/hide");
|
7
8
|
const icon_1 = require("@uxf/ui/icon");
|
8
9
|
const link_1 = __importDefault(require("next/link"));
|
9
10
|
const react_1 = __importDefault(require("react"));
|
@@ -12,8 +13,9 @@ const Breadcrumbs = (props) => {
|
|
12
13
|
return null;
|
13
14
|
}
|
14
15
|
return (react_1.default.createElement("div", { className: "uxf-cms-breadcrumbs" }, props.items.map((item, index) => (react_1.default.createElement("span", { className: "uxf-cms-breadcrumbs__item", key: index },
|
15
|
-
|
16
|
-
|
16
|
+
react_1.default.createElement(hide_1.Hide, { when: index === 0 },
|
17
|
+
react_1.default.createElement(icon_1.Icon, { className: "uxf-cms-breadcrumbs__divide-icon", name: "angleRight", size: 16 })),
|
18
|
+
item.href ? (react_1.default.createElement(link_1.default, { className: "uxf-cms-breadcrumbs__link", href: item.href },
|
17
19
|
react_1.default.createElement("span", null, item.title))) : (react_1.default.createElement("span", null, item.title)))))));
|
18
20
|
};
|
19
21
|
exports.Breadcrumbs = Breadcrumbs;
|
package/lib/layout/layout.js
CHANGED
@@ -18,12 +18,12 @@ const Layout = (props) => {
|
|
18
18
|
var _a, _b;
|
19
19
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
20
20
|
react_1.default.createElement(head_1.default, null,
|
21
|
-
react_1.default.createElement("meta", {
|
21
|
+
react_1.default.createElement("meta", { content: "width=device-width, initial-scale=1", name: "viewport" }),
|
22
22
|
react_1.default.createElement("meta", { charSet: "utf-8" }),
|
23
23
|
react_1.default.createElement("title", null, `${props.title} | ${config_1.config.get("app-name") || ""}`)),
|
24
24
|
react_1.default.createElement("div", { className: "uxf-cms-layout" },
|
25
25
|
react_1.default.createElement("div", { className: "uxf-cms-layout__wrapper" },
|
26
|
-
react_1.default.createElement(sidebar_1.Sidebar, {
|
26
|
+
react_1.default.createElement(sidebar_1.Sidebar, { Logo: props.Logo, menuConfiguration: props.menuConfiguration }),
|
27
27
|
react_1.default.createElement("main", { className: `uxf-cms-layout__main ${(_a = props.mainClassName) !== null && _a !== void 0 ? _a : ""}`, style: { "--drawer-width": (0, rem_1.rem)(styles_1.drawerWidth) } },
|
28
28
|
props.loading ? (react_1.default.createElement("div", { className: "uxf-cms-layout__loading" },
|
29
29
|
react_1.default.createElement("div", { className: "uxf-cms-layout__loading-inner" },
|
@@ -32,7 +32,7 @@ const Layout = (props) => {
|
|
32
32
|
props.CustomHeader ? (props.CustomHeader) : (react_1.default.createElement("div", { className: `${props.Header ? "uxf-cms-layout__header" : ""} ${props.stickyHeader ? "uxf-cms-layout__header--sticky" : ""}` },
|
33
33
|
props.ToolbarRight && (react_1.default.createElement("div", { className: "uxf-cms-layout__toolbar" }, props.ToolbarRight)),
|
34
34
|
props.MessageBar,
|
35
|
-
react_1.default.createElement(layout_container_1.LayoutContainer, { type: (_b = props.headerContainerType) !== null && _b !== void 0 ? _b : props.containerType
|
35
|
+
react_1.default.createElement(layout_container_1.LayoutContainer, { className: "uxf-cms-layout__container--basic", type: (_b = props.headerContainerType) !== null && _b !== void 0 ? _b : props.containerType },
|
36
36
|
react_1.default.createElement("div", { className: "uxf-cms-layout__avatar-title-wrapper" },
|
37
37
|
props.Avatar,
|
38
38
|
react_1.default.createElement("div", { className: "uxf-cms-layout__breadcrumbs-title-wrapper" },
|
package/lib/layout/sidebar.js
CHANGED
@@ -31,11 +31,11 @@ const menu_1 = require("../menu");
|
|
31
31
|
const mobile_bar_1 = require("../menu/mobile-bar");
|
32
32
|
const user_menu_1 = require("../menu/ui/user-menu");
|
33
33
|
const styles_1 = require("./styles");
|
34
|
-
const uxfLogo = (react_1.default.createElement("svg", {
|
35
|
-
react_1.default.createElement("path", {
|
36
|
-
react_1.default.createElement("path", {
|
34
|
+
const uxfLogo = (react_1.default.createElement("svg", { height: "30", viewBox: "0 0 179 40", width: "134" },
|
35
|
+
react_1.default.createElement("path", { clipRule: "evenodd", d: "M33.563 12.874a9.103 9.103 0 0 0 0-12.874L20.69 12.874l.107.105a9.103 9.103 0 0 0 12.766-.105Zm-20.69-6.437a9.103 9.103 0 0 1 .106 12.766l-.105.107L0 6.437a9.103 9.103 0 0 1 12.874 0ZM40 33.563 27.127 20.69l-.106.107a9.103 9.103 0 0 0 12.98 12.766Zm-20.69-6.437-.107-.105A9.103 9.103 0 0 0 6.437 40l12.874-12.874Z", fill: "#FFF", fillRule: "evenodd" }),
|
36
|
+
react_1.default.createElement("path", { clipRule: "evenodd", d: "m84.325 7.295 5.133 8.675h.199l5.158-8.675h6.078l-7.768 12.727 7.942 12.727h-6.19l-5.22-8.687h-.199l-5.22 8.687h-6.165l7.967-12.727-7.818-12.727h6.103Zm-24.194 0v16.07c0 .97.214 1.832.64 2.586a4.58 4.58 0 0 0 1.809 1.777c.779.431 1.686.647 2.722.647 1.044 0 1.953-.216 2.728-.647a4.591 4.591 0 0 0 1.802-1.777c.427-.754.64-1.616.64-2.585V7.296h5.382v16.53c0 1.856-.441 3.48-1.324 4.872-.882 1.392-2.115 2.475-3.697 3.25-1.583.775-3.426 1.162-5.531 1.162-2.113 0-3.96-.387-5.543-1.162-1.583-.775-2.813-1.858-3.692-3.25-.878-1.392-1.317-3.016-1.317-4.872V7.296h5.381ZM170.25 13.41c2.411 0 4.311.51 5.698 1.529 1.388 1.019 2.198 2.407 2.43 4.164l-4.847.298a2.555 2.555 0 0 0-.534-1.125 2.942 2.942 0 0 0-1.075-.808c-.444-.203-.972-.304-1.585-.304-.821 0-1.512.172-2.076.515-.563.344-.845.802-.845 1.374 0 .456.182.84.547 1.156.364.315.99.567 1.877.758l3.455.696c1.856.381 3.24.994 4.151 1.84.912.845 1.367 1.955 1.367 3.33 0 1.252-.366 2.35-1.1 3.294-.733.945-1.736 1.68-3.007 2.206-1.272.526-2.737.79-4.394.79-2.527 0-4.539-.529-6.034-1.585-1.496-1.057-2.372-2.496-2.629-4.32l5.208-.273c.157.77.538 1.357 1.143 1.759.605.402 1.38.603 2.324.603.928 0 1.676-.18 2.244-.54.567-.361.855-.827.864-1.4-.009-.48-.212-.875-.609-1.186-.398-.31-1.011-.55-1.84-.715l-3.306-.659c-1.864-.372-3.25-1.019-4.157-1.938-.908-.92-1.361-2.093-1.361-3.518 0-1.226.333-2.283 1-3.17.667-.886 1.608-1.57 2.821-2.05 1.214-.48 2.637-.72 4.27-.72Zm-36.686.373a12.285 12.285 0 0 0-3.051-.373c-1.525 0-2.865.23-4.021.69-1.156.46-2.098 1.114-2.827 1.964-.73.849-1.219 1.854-1.467 3.014l4.897.397c.182-.63.555-1.153 1.119-1.572.563-.418 1.321-.627 2.274-.627.903 0 1.601.215 2.094.646.493.43.74 1.04.74 1.827v.075c0 .405-.153.712-.46.92-.307.206-.8.362-1.479.465-.68.104-1.574.214-2.685.33-.944.09-1.845.248-2.703.472a7.698 7.698 0 0 0-2.293.994 4.727 4.727 0 0 0-1.591 1.74c-.39.721-.584 1.612-.584 2.673 0 1.259.275 2.31.826 3.15a5.147 5.147 0 0 0 2.256 1.902c.953.427 2.038.64 3.257.64.944 0 1.777-.126 2.498-.38a5.55 5.55 0 0 0 1.852-1.055 5.31 5.31 0 0 0 1.23-1.573h.149v2.648h5.022V19.873c0-1.135-.22-2.11-.659-2.927a5.655 5.655 0 0 0-1.796-2.007 8.039 8.039 0 0 0-2.598-1.156Zm-13.424-2.05V7.294h-16.853v25.454h5.381V22.235h10.354v-4.438h-10.354v-6.065h11.472Zm32.603 1.677c1.326 0 2.482.29 3.468.87.986.58 1.753 1.407 2.3 2.48.546 1.073.82 2.35.82 3.834V32.75h-5.295V21.539c.008-1.169-.29-2.082-.895-2.74-.605-.66-1.437-.989-2.498-.989-.713 0-1.34.153-1.883.46a3.166 3.166 0 0 0-1.268 1.336c-.302.584-.458 1.286-.466 2.107V32.75h-5.295V13.659h5.047v3.368H147a5.358 5.358 0 0 1 2.126-2.641c.994-.65 2.2-.976 3.616-.976Zm-20.061 10.782c.286-.087.512-.184.678-.292v2.026c0 .671-.17 1.272-.51 1.802-.34.53-.808.951-1.404 1.262-.597.31-1.285.466-2.064.466-.812 0-1.481-.189-2.007-.566-.526-.377-.789-.925-.789-1.646 0-.497.128-.914.385-1.25.257-.335.617-.602 1.082-.801a6.547 6.547 0 0 1 1.628-.435l.969-.143a24.15 24.15 0 0 0 1.069-.186c.356-.071.677-.15.963-.237Z", fill: "#FFF", fillRule: "evenodd" })));
|
37
37
|
const Sidebar = (props) => {
|
38
|
-
var _a, _b;
|
38
|
+
var _a, _b, _c;
|
39
39
|
const [deviceHeight, setDeviceHeight] = (0, react_1.useState)(0);
|
40
40
|
const [isMenuOpen, setIsMenuOpen] = (0, react_1.useState)(false);
|
41
41
|
const toggleMenu = () => setIsMenuOpen((prev) => !prev);
|
@@ -67,7 +67,7 @@ const Sidebar = (props) => {
|
|
67
67
|
react_1.default.createElement("div", { className: `uxf-cms-sidebar__content ${isMenuOpen ? "uxf-cms-sidebar__content--open" : "uxf-cms-sidebar__content--closed"}`, style: { "--device-height": (0, rem_1.rem)(deviceHeight) } },
|
68
68
|
react_1.default.createElement("div", { className: "uxf-cms-sidebar__logo" }, (_b = props.Logo) !== null && _b !== void 0 ? _b : uxfLogo),
|
69
69
|
props.menuConfiguration && props.menuConfiguration.length > 0 && (react_1.default.createElement(react_1.default.Fragment, null,
|
70
|
-
react_1.default.createElement("div", { className: `uxf-cms-sidebar__nav ${props.menuConfiguration
|
70
|
+
react_1.default.createElement("div", { className: `uxf-cms-sidebar__nav ${((_c = props.menuConfiguration.at(0)) === null || _c === void 0 ? void 0 : _c.type) === "super-section"
|
71
71
|
? "uxf-cms-sidebar__nav--super-section"
|
72
72
|
: ""}` },
|
73
73
|
react_1.default.createElement(menu_1.Menu, { menu: props.menuConfiguration })),
|
package/lib/layout/types.d.ts
CHANGED
@@ -5,6 +5,15 @@ export type LayoutContainerType = "fullWidth" | "wide" | "narrow" | "none";
|
|
5
5
|
export interface LayoutContainerProps extends HTMLAttributes<HTMLDivElement> {
|
6
6
|
type?: LayoutContainerType;
|
7
7
|
}
|
8
|
+
export interface AppBarProps {
|
9
|
+
Logo?: ReactNode;
|
10
|
+
ToolbarRight?: ReactNode;
|
11
|
+
}
|
12
|
+
export interface SidebarProps {
|
13
|
+
Logo?: ReactNode;
|
14
|
+
menuConfiguration?: MenuItem[];
|
15
|
+
CustomSidebar?: ReactElement;
|
16
|
+
}
|
8
17
|
export type LayoutProps = SidebarProps & {
|
9
18
|
Avatar?: ReactNode;
|
10
19
|
children?: ReactNode;
|
@@ -24,12 +33,3 @@ export type LayoutProps = SidebarProps & {
|
|
24
33
|
stickyHeader?: boolean;
|
25
34
|
CustomHeader?: ReactNode;
|
26
35
|
};
|
27
|
-
export interface AppBarProps {
|
28
|
-
Logo?: ReactNode;
|
29
|
-
ToolbarRight?: ReactNode;
|
30
|
-
}
|
31
|
-
export interface SidebarProps {
|
32
|
-
Logo?: ReactNode;
|
33
|
-
menuConfiguration?: MenuItem[];
|
34
|
-
CustomSidebar?: ReactElement;
|
35
|
-
}
|
package/lib/menu/factory.js
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.createCustomContent = createCustomContent;
|
4
|
+
exports.createSuperSection = createSuperSection;
|
5
|
+
exports.createSection = createSection;
|
6
|
+
exports.createLink = createLink;
|
7
|
+
exports.createExternalLink = createExternalLink;
|
8
|
+
exports.createUserMenu = createUserMenu;
|
9
|
+
exports.createTableLink = createTableLink;
|
4
10
|
const active_item_resolver_1 = require("./active-item-resolver");
|
5
11
|
const model_1 = require("./model");
|
6
12
|
function createCustomContent(title, content) {
|
7
13
|
return model_1.MenuItem.create(title, "custom").setContent(content);
|
8
14
|
}
|
9
|
-
exports.createCustomContent = createCustomContent;
|
10
15
|
function createSuperSection(title, children) {
|
11
16
|
return model_1.MenuItem.create(title, "super-section").setChildren(children);
|
12
17
|
}
|
13
|
-
exports.createSuperSection = createSuperSection;
|
14
18
|
function createSection(title, icon, children) {
|
15
19
|
return model_1.MenuItem.create(title, "section").setIcon(icon).setChildren(children);
|
16
20
|
}
|
17
|
-
exports.createSection = createSection;
|
18
21
|
function createLink(title, routeName, routeParams, icon, endElement) {
|
19
22
|
return model_1.MenuItem.create(title, "link")
|
20
23
|
.setRoute(routeName, routeParams)
|
@@ -22,15 +25,12 @@ function createLink(title, routeName, routeParams, icon, endElement) {
|
|
22
25
|
.setEndElement(endElement)
|
23
26
|
.setActiveResolver(active_item_resolver_1.ActiveItemResolver.anyOf([routeName]));
|
24
27
|
}
|
25
|
-
exports.createLink = createLink;
|
26
28
|
function createExternalLink(title, href, icon, endElement) {
|
27
29
|
return model_1.MenuItem.create(title, "link").setIsExternal(true).setIcon(icon).setEndElement(endElement).setUrl(href);
|
28
30
|
}
|
29
|
-
exports.createExternalLink = createExternalLink;
|
30
31
|
function createUserMenu(userMenuData, children) {
|
31
32
|
return model_1.MenuItem.create("Můj profil", "super-section").setUserMenuData(userMenuData).setChildren(children);
|
32
33
|
}
|
33
|
-
exports.createUserMenu = createUserMenu;
|
34
34
|
function createTableLink(title, entityAlias, icon, endElement) {
|
35
35
|
return model_1.MenuItem.create(title, "link")
|
36
36
|
.setRoute("cms/table", { entityAlias })
|
@@ -38,4 +38,3 @@ function createTableLink(title, entityAlias, icon, endElement) {
|
|
38
38
|
.setEndElement(endElement)
|
39
39
|
.setActiveResolver(active_item_resolver_1.ActiveItemResolver.tableLink());
|
40
40
|
}
|
41
|
-
exports.createTableLink = createTableLink;
|
package/lib/menu/mobile-bar.js
CHANGED
@@ -36,19 +36,19 @@ const MobileBar = (props) => {
|
|
36
36
|
mobileBarMenu.map((item, index) => {
|
37
37
|
var _a, _b, _c, _d;
|
38
38
|
if (item.children.length) {
|
39
|
-
return (react_1.default.createElement(sub_menu_mobile_1.SubMenuMobile, {
|
40
|
-
react_1.default.createElement("button", { type: "button"
|
39
|
+
return (react_1.default.createElement(sub_menu_mobile_1.SubMenuMobile, { content: item.children, key: index, title: item.title },
|
40
|
+
react_1.default.createElement("button", { className: buttonClassName, type: "button" }, item.userMenuData ? (react_1.default.createElement(avatar_1.Avatar, { className: "uxf-cms-mobile-bar__avatar", letters: (0, get_avatar_user_letters_1.getAvatarUserLetters)(item.userMenuData.name), size: "sm", src: item.userMenuData.avatar, variant: "rounded" })) : (react_1.default.createElement(react_1.default.Fragment, null,
|
41
41
|
react_1.default.createElement(icon_1.Icon, { name: (_a = item.icon) !== null && _a !== void 0 ? _a : "", size: 24 }),
|
42
|
-
react_1.default.createElement(icon_1.Icon, { name: "caretDown", size: 16
|
42
|
+
react_1.default.createElement(icon_1.Icon, { className: "uxf-cms-mobile-bar__caret", name: "caretDown", size: 16 }))))));
|
43
43
|
}
|
44
44
|
if (item.url || item.route) {
|
45
|
-
return (react_1.default.createElement(link_1.default, {
|
45
|
+
return (react_1.default.createElement(link_1.default, { className: buttonClassName, href: (_b = item.url) !== null && _b !== void 0 ? _b : config_1.container.get("route")(item.route, item.routeParams), key: index, rel: item.isExternal ? "noreferrer noopener" : undefined, target: item.isExternal ? "_blank" : undefined },
|
46
46
|
react_1.default.createElement(icon_1.Icon, { name: (_c = item.icon) !== null && _c !== void 0 ? _c : "user", size: 24 })));
|
47
47
|
}
|
48
|
-
return (react_1.default.createElement("span", {
|
48
|
+
return (react_1.default.createElement("span", { className: buttonClassName, key: index },
|
49
49
|
react_1.default.createElement(icon_1.Icon, { name: (_d = item.icon) !== null && _d !== void 0 ? _d : "user", size: 24 })));
|
50
50
|
}),
|
51
|
-
react_1.default.createElement("button", {
|
51
|
+
react_1.default.createElement("button", { className: buttonClassName, onClick: props.toggleMenu, type: "button" },
|
52
52
|
react_1.default.createElement(icon_1.Icon, { name: "bars", size: 24 }))));
|
53
53
|
};
|
54
54
|
exports.MobileBar = MobileBar;
|
package/lib/menu/model.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.MenuItem = void 0;
|
4
|
+
const empty_array_1 = require("@uxf/core/constants/empty-array");
|
5
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
4
6
|
class MenuItem {
|
5
7
|
static create(title, type) {
|
6
8
|
return new MenuItem(title, type);
|
@@ -23,7 +25,7 @@ class MenuItem {
|
|
23
25
|
return this;
|
24
26
|
}
|
25
27
|
setChildren(children) {
|
26
|
-
this._children = children !== null && children !== void 0 ? children :
|
28
|
+
this._children = children !== null && children !== void 0 ? children : empty_array_1.EMPTY_ARRAY;
|
27
29
|
return this;
|
28
30
|
}
|
29
31
|
setRoute(route, routeParams) {
|
@@ -52,7 +54,7 @@ class MenuItem {
|
|
52
54
|
return this;
|
53
55
|
}
|
54
56
|
isActive(router, activeRoute) {
|
55
|
-
return
|
57
|
+
return (0, is_not_nil_1.isNotNil)(this._activeItemResolver && this._activeItemResolver(router, activeRoute));
|
56
58
|
}
|
57
59
|
hasActiveChildren(router, activeRoute) {
|
58
60
|
return this.children.some((item) => item.isActive(router, activeRoute));
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { ReactElement } from "react";
|
2
2
|
import { ListItemProps } from "./types";
|
3
|
-
export declare
|
3
|
+
export declare function ListItem<T extends Record<string, any>>(props: ListItemProps<T>): ReactElement;
|