strapi-plugin-navigation 2.0.13 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -27
- package/admin/src/components/Alert/styles.d.ts +2 -0
- package/admin/src/components/Alert/styles.js +10 -4
- package/admin/src/components/CollapseButton/index.d.ts +7 -0
- package/admin/src/components/CollapseButton/index.js +21 -22
- package/admin/src/components/ConfirmationDialog/index.d.ts +28 -0
- package/admin/src/components/ConfirmationDialog/index.js +32 -54
- package/admin/src/components/EmptyView/index.d.ts +3 -0
- package/admin/src/components/EmptyView/index.js +9 -7
- package/admin/src/components/Item/ItemCardBadge/index.d.ts +3 -0
- package/admin/src/components/Item/ItemCardBadge/index.js +11 -7
- package/admin/src/components/Item/ItemCardHeader/Wrapper.d.ts +3 -0
- package/admin/src/components/Item/ItemCardHeader/Wrapper.js +10 -6
- package/admin/src/components/Item/ItemCardHeader/index.d.ts +12 -0
- package/admin/src/components/Item/ItemCardHeader/index.js +33 -52
- package/admin/src/components/Item/ItemCardRemovedOverlay/index.d.ts +2 -0
- package/admin/src/components/Item/ItemCardRemovedOverlay/index.js +10 -4
- package/admin/src/components/Item/Wrapper.d.ts +3 -0
- package/admin/src/components/Item/Wrapper.js +10 -6
- package/admin/src/components/Item/index.d.ts +31 -0
- package/admin/src/components/Item/index.js +163 -242
- package/admin/src/components/NavigationItemList/Wrapper.d.ts +3 -0
- package/admin/src/components/NavigationItemList/Wrapper.js +9 -5
- package/admin/src/components/NavigationItemList/index.d.ts +35 -0
- package/admin/src/components/NavigationItemList/index.js +28 -66
- package/admin/src/components/RestartAlert/index.d.ts +3 -0
- package/admin/src/components/RestartAlert/index.js +10 -5
- package/admin/src/components/Search/index.d.ts +6 -0
- package/admin/src/components/Search/index.js +57 -46
- package/admin/src/components/icons/navigation.d.ts +6 -0
- package/admin/src/components/icons/navigation.js +11 -13
- package/admin/src/contexts/DataManagerContext.d.ts +3 -0
- package/admin/src/contexts/DataManagerContext.js +6 -5
- package/admin/src/hooks/useAllContentTypes.d.ts +6 -0
- package/admin/src/hooks/useAllContentTypes.js +10 -11
- package/admin/src/hooks/useDataManager.d.ts +3 -0
- package/admin/src/hooks/useDataManager.js +10 -6
- package/admin/src/hooks/useI18nCopyNavigationItemsModal.d.ts +9 -0
- package/admin/src/hooks/useI18nCopyNavigationItemsModal.js +51 -0
- package/admin/src/hooks/useNavigationConfig.d.ts +10 -0
- package/admin/src/hooks/useNavigationConfig.js +52 -56
- package/admin/src/hooks/useNavigationManager.d.ts +7 -0
- package/admin/src/hooks/useNavigationManager.js +41 -0
- package/admin/src/index.d.ts +14 -0
- package/admin/src/index.js +92 -76
- package/admin/src/pages/App/index.d.ts +3 -0
- package/admin/src/pages/App/index.js +43 -31
- package/admin/src/pages/DataManagerProvider/actions.d.ts +19 -0
- package/admin/src/pages/DataManagerProvider/actions.js +22 -26
- package/admin/src/pages/DataManagerProvider/index.d.ts +12 -0
- package/admin/src/pages/DataManagerProvider/index.js +316 -298
- package/admin/src/pages/DataManagerProvider/init.d.ts +3 -0
- package/admin/src/pages/DataManagerProvider/init.js +5 -3
- package/admin/src/pages/DataManagerProvider/reducer.d.ts +19 -0
- package/admin/src/pages/DataManagerProvider/reducer.js +119 -121
- package/admin/src/pages/SettingsPage/components/DisableI18nModal/index.d.ts +24 -0
- package/admin/src/pages/SettingsPage/components/DisableI18nModal/index.js +88 -0
- package/admin/src/pages/SettingsPage/index.d.ts +3 -0
- package/admin/src/pages/SettingsPage/index.js +242 -335
- package/admin/src/pages/SettingsPage/utils/functions.d.ts +5 -0
- package/admin/src/pages/SettingsPage/utils/functions.js +3 -8
- package/admin/src/pages/View/components/I18nCopyNavigationItems/index.d.ts +14 -0
- package/admin/src/pages/View/components/I18nCopyNavigationItems/index.js +15 -0
- package/admin/src/pages/View/components/NavigationContentHeader/index.d.ts +6 -0
- package/admin/src/pages/View/components/NavigationContentHeader/index.js +13 -17
- package/admin/src/pages/View/components/NavigationHeader/index.d.ts +12 -0
- package/admin/src/pages/View/components/NavigationHeader/index.js +79 -65
- package/admin/src/pages/View/components/NavigationHeader/styles.d.ts +2 -0
- package/admin/src/pages/View/components/NavigationHeader/styles.js +10 -5
- package/admin/src/pages/View/components/NavigationItemForm/index.d.ts +57 -0
- package/admin/src/pages/View/components/NavigationItemForm/index.js +416 -453
- package/admin/src/pages/View/components/NavigationItemForm/utils/form.d.ts +45 -0
- package/admin/src/pages/View/components/NavigationItemForm/utils/form.js +84 -52
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupFooter.d.ts +23 -0
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupFooter.js +24 -34
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupHeader.d.ts +4 -0
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupHeader.js +16 -16
- package/admin/src/pages/View/components/NavigationItemPopup/index.d.ts +30 -0
- package/admin/src/pages/View/components/NavigationItemPopup/index.js +85 -108
- package/admin/src/pages/View/components/NavigationManager/Create/index.d.ts +9 -0
- package/admin/src/pages/View/components/NavigationManager/Create/index.js +57 -0
- package/admin/src/pages/View/components/NavigationManager/Delete/index.d.ts +8 -0
- package/admin/src/pages/View/components/NavigationManager/Delete/index.js +28 -0
- package/admin/src/pages/View/components/NavigationManager/Edit/index.d.ts +8 -0
- package/admin/src/pages/View/components/NavigationManager/Edit/index.js +54 -0
- package/admin/src/pages/View/components/NavigationManager/Error/index.d.ts +8 -0
- package/admin/src/pages/View/components/NavigationManager/Error/index.js +53 -0
- package/admin/src/pages/View/components/NavigationManager/Form/index.d.ts +19 -0
- package/admin/src/pages/View/components/NavigationManager/Form/index.js +98 -0
- package/admin/src/pages/View/components/NavigationManager/List/index.d.ts +8 -0
- package/admin/src/pages/View/components/NavigationManager/List/index.js +138 -0
- package/admin/src/pages/View/components/NavigationManager/index.d.ts +10 -0
- package/admin/src/pages/View/components/NavigationManager/index.js +189 -0
- package/admin/src/pages/View/components/NavigationManager/types.d.ts +53 -0
- package/admin/src/pages/View/components/NavigationManager/types.js +3 -0
- package/admin/src/pages/View/index.d.ts +4 -0
- package/admin/src/pages/View/index.js +231 -304
- package/admin/src/pages/View/utils/enums.d.ts +9 -0
- package/admin/src/pages/View/utils/enums.js +11 -8
- package/admin/src/pages/View/utils/form.d.ts +2 -0
- package/admin/src/pages/View/utils/form.js +15 -12
- package/admin/src/pages/View/utils/index.d.ts +2 -0
- package/admin/src/pages/View/utils/index.js +11 -3
- package/admin/src/pages/View/utils/parsers.d.ts +49 -0
- package/admin/src/pages/View/utils/parsers.js +239 -278
- package/admin/src/permissions.d.ts +12 -0
- package/admin/src/permissions.js +11 -7
- package/admin/src/pluginId.d.ts +3 -0
- package/admin/src/pluginId.js +2 -2
- package/admin/src/translations/en.json +157 -104
- package/admin/src/translations/fr.json +44 -44
- package/admin/src/translations/index.d.ts +12 -0
- package/admin/src/translations/index.js +17 -11
- package/admin/src/utils/api.d.ts +8 -0
- package/admin/src/utils/api.js +54 -50
- package/admin/src/utils/getTrad.d.ts +3 -0
- package/admin/src/utils/getTrad.js +9 -5
- package/admin/src/utils/index.d.ts +18 -0
- package/admin/src/utils/index.js +36 -15
- package/package.json +20 -19
- package/permissions.d.ts +9 -0
- package/permissions.js +5 -4
- package/server/bootstrap/index.d.ts +4 -0
- package/server/bootstrap/index.js +41 -0
- package/server/config/index.d.ts +5 -0
- package/server/config/index.js +33 -9
- package/server/config/setupStrategy.d.ts +3 -0
- package/server/config/setupStrategy.js +38 -0
- package/server/content-types/audience/index.d.ts +27 -0
- package/server/content-types/audience/index.js +9 -8
- package/server/content-types/audience/schema.d.ts +25 -0
- package/server/content-types/audience/schema.js +26 -0
- package/server/content-types/index.d.ts +255 -0
- package/server/content-types/index.js +15 -12
- package/server/content-types/navigation/index.d.ts +64 -0
- package/server/content-types/navigation/index.js +11 -8
- package/server/content-types/navigation/lifecycle.d.ts +9 -0
- package/server/content-types/navigation/lifecycle.js +8 -12
- package/server/content-types/navigation/schema.d.ts +55 -0
- package/server/content-types/navigation/schema.js +56 -0
- package/server/content-types/navigation-item/index.d.ts +112 -0
- package/server/content-types/navigation-item/index.js +11 -8
- package/server/content-types/navigation-item/lifecycle.d.ts +16 -0
- package/server/content-types/navigation-item/lifecycle.js +28 -32
- package/server/content-types/navigation-item/schema.d.ts +97 -0
- package/server/content-types/navigation-item/schema.js +102 -0
- package/server/content-types/navigations-items-related/index.d.ts +56 -0
- package/server/content-types/navigations-items-related/index.js +11 -8
- package/server/content-types/navigations-items-related/lifecycle.d.ts +8 -0
- package/server/content-types/navigations-items-related/lifecycle.js +20 -17
- package/server/content-types/navigations-items-related/schema.d.ts +49 -0
- package/server/content-types/navigations-items-related/schema.js +50 -0
- package/server/controllers/admin.d.ts +4 -0
- package/server/controllers/admin.js +130 -0
- package/server/controllers/client.d.ts +4 -0
- package/server/controllers/client.js +57 -0
- package/server/controllers/index.d.ts +4 -0
- package/server/controllers/index.js +12 -6
- package/server/destroy.d.ts +3 -0
- package/server/destroy.js +5 -0
- package/server/graphql/config.d.ts +4 -0
- package/server/graphql/config.js +28 -0
- package/server/graphql/index.d.ts +2 -0
- package/server/graphql/index.js +18 -22
- package/server/graphql/queries/index.d.ts +3 -0
- package/server/graphql/queries/index.js +15 -15
- package/server/graphql/queries/render-navigation-child.d.ts +15 -0
- package/server/graphql/queries/render-navigation-child.js +24 -15
- package/server/graphql/queries/render-navigation.d.ts +21 -0
- package/server/graphql/queries/render-navigation.js +31 -15
- package/server/graphql/resolvers-config.d.ts +10 -0
- package/server/graphql/resolvers-config.js +5 -3
- package/server/graphql/setupStrategy.d.ts +3 -0
- package/server/graphql/setupStrategy.js +15 -0
- package/server/graphql/types/content-types-name-fields.d.ts +6 -0
- package/server/graphql/types/content-types-name-fields.js +13 -9
- package/server/graphql/types/content-types.d.ts +5 -0
- package/server/graphql/types/content-types.js +17 -15
- package/server/graphql/types/create-navigation-item.d.ts +5 -0
- package/server/graphql/types/create-navigation-item.js +18 -16
- package/server/graphql/types/create-navigation-related.d.ts +5 -0
- package/server/graphql/types/create-navigation-related.js +9 -7
- package/server/graphql/types/create-navigation.d.ts +5 -0
- package/server/graphql/types/create-navigation.js +8 -6
- package/server/graphql/types/index.d.ts +3 -0
- package/server/graphql/types/index.js +15 -13
- package/server/graphql/types/navigation-config.d.ts +5 -0
- package/server/graphql/types/navigation-config.js +10 -8
- package/server/graphql/types/navigation-details.d.ts +5 -0
- package/server/graphql/types/navigation-details.js +11 -9
- package/server/graphql/types/navigation-item-related-data.d.ts +5 -0
- package/server/graphql/types/navigation-item-related-data.js +9 -0
- package/server/graphql/types/navigation-item-related.d.ts +7 -0
- package/server/graphql/types/navigation-item-related.js +25 -0
- package/server/graphql/types/navigation-item.d.ts +5 -0
- package/server/graphql/types/navigation-item.js +28 -29
- package/server/graphql/types/navigation-render-type.d.ts +5 -0
- package/server/graphql/types/navigation-render-type.js +7 -4
- package/server/graphql/types/navigation.d.ts +5 -0
- package/server/graphql/types/navigation.js +10 -8
- package/server/i18n/constant.d.ts +2 -0
- package/server/i18n/constant.js +5 -0
- package/server/i18n/errors.d.ts +7 -0
- package/server/i18n/errors.js +14 -0
- package/server/i18n/graphQLEnhancers.d.ts +10 -0
- package/server/i18n/graphQLEnhancers.js +10 -0
- package/server/i18n/index.d.ts +8 -0
- package/server/i18n/index.js +23 -0
- package/server/i18n/navigationSetupStrategy.d.ts +3 -0
- package/server/i18n/navigationSetupStrategy.js +119 -0
- package/server/i18n/serviceEnhancers.d.ts +13 -0
- package/server/i18n/serviceEnhancers.js +156 -0
- package/server/i18n/types.d.ts +60 -0
- package/server/i18n/types.js +3 -0
- package/server/i18n/utils.d.ts +12 -0
- package/server/i18n/utils.js +29 -0
- package/server/index.d.ts +273 -0
- package/server/index.js +26 -0
- package/server/navigation/index.d.ts +2 -0
- package/server/navigation/index.js +18 -0
- package/server/navigation/setupStrategy.d.ts +3 -0
- package/server/navigation/setupStrategy.js +39 -0
- package/server/register/index.d.ts +3 -0
- package/server/register/index.js +4 -0
- package/server/routes/admin.d.ts +4 -0
- package/server/routes/admin.js +82 -61
- package/server/routes/client.d.ts +4 -0
- package/server/routes/client.js +25 -21
- package/server/routes/index.d.ts +6 -0
- package/server/routes/index.js +13 -4
- package/server/services/admin.d.ts +5 -0
- package/server/services/admin.js +238 -0
- package/server/services/client.d.ts +5 -0
- package/server/services/client.js +249 -0
- package/server/services/common.d.ts +5 -0
- package/server/services/common.js +313 -0
- package/server/services/index.d.ts +7 -0
- package/server/services/index.js +14 -6
- package/server/utils/constant.d.ts +27 -0
- package/server/utils/constant.js +24 -0
- package/server/utils/functions.d.ts +139 -0
- package/server/utils/functions.js +226 -0
- package/server/utils/index.d.ts +3 -0
- package/server/utils/index.js +19 -0
- package/strapi-admin.d.ts +3 -0
- package/strapi-admin.js +8 -1
- package/strapi-server.d.ts +273 -0
- package/strapi-server.js +6 -17
- package/tsconfig.tsbuildinfo +1 -0
- package/types/bootstrap.d.ts +13 -0
- package/types/bootstrap.js +3 -0
- package/types/config.d.ts +21 -0
- package/types/config.js +3 -0
- package/types/contentTypes.d.ts +85 -0
- package/types/contentTypes.js +3 -0
- package/types/controllers.d.ts +48 -0
- package/types/controllers.js +5 -0
- package/types/graphQL.d.ts +3 -0
- package/types/graphQL.js +3 -0
- package/types/i18n.d.ts +9 -0
- package/types/i18n.js +3 -0
- package/types/index.d.ts +9 -0
- package/types/index.js +25 -0
- package/types/services.d.ts +74 -0
- package/types/services.js +3 -0
- package/types/utils.d.ts +62 -0
- package/types/utils.js +27 -0
- package/utils/InvalidParamNavigationError.d.ts +4 -0
- package/utils/InvalidParamNavigationError.js +8 -0
- package/utils/NavigationError.d.ts +5 -0
- package/utils/NavigationError.js +7 -7
- package/__mocks__/pages.settings.json +0 -25
- package/__mocks__/strapi.js +0 -207
- package/jest.config.js +0 -14
- package/server/bootstrap.js +0 -52
- package/server/config.js +0 -9
- package/server/content-types/audience/lifecycle.js +0 -8
- package/server/content-types/audience/schema.json +0 -23
- package/server/content-types/navigation/schema.json +0 -45
- package/server/content-types/navigation-item/schema.json +0 -99
- package/server/content-types/navigations-items-related/schema.json +0 -47
- package/server/controllers/navigation.js +0 -105
- package/server/graphql/types/navigation-related.js +0 -25
- package/server/services/__tests__/functions.test.js +0 -48
- package/server/services/__tests__/navigation.test.js +0 -91
- package/server/services/navigation.js +0 -791
- package/server/services/utils/constant.js +0 -21
- package/server/services/utils/functions.js +0 -226
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
2
|
const { capitalize } = require("lodash");
|
|
4
|
-
|
|
5
3
|
const UID_REGEX = /^(?<type>[a-z0-9-]+)\:{2}(?<api>[a-z0-9-]+)\.{1}(?<contentType>[a-z0-9-]+)$/i;
|
|
6
|
-
|
|
7
4
|
const splitTypeUid = (uid = '') => {
|
|
8
5
|
return uid.split(UID_REGEX).filter((s) => s && s.length > 0);
|
|
9
6
|
};
|
|
10
|
-
|
|
11
7
|
module.exports = {
|
|
12
8
|
resolveGlobalLikeId(uid = '') {
|
|
13
9
|
const parse = (str) => str.split('-')
|
|
14
10
|
.map(_ => capitalize(_))
|
|
15
11
|
.join('');
|
|
16
|
-
|
|
17
12
|
const [type, scope, contentTypeName] = splitTypeUid(uid);
|
|
18
13
|
if (type === 'api') {
|
|
19
14
|
return parse(contentTypeName);
|
|
20
15
|
}
|
|
21
16
|
return `${parse(scope)}${parse(contentTypeName)}`;
|
|
22
17
|
},
|
|
23
|
-
|
|
24
18
|
isContentTypeEligible(uid = '', config = {}) {
|
|
25
|
-
const { allowedContentTypes = [], restrictedContentTypes = []} = config;
|
|
19
|
+
const { allowedContentTypes = [], restrictedContentTypes = [] } = config;
|
|
26
20
|
const isOneOfAllowedType = allowedContentTypes.filter(_ => uid.includes(_) || (uid === _)).length > 0;
|
|
27
21
|
const isNoneOfRestricted = restrictedContentTypes.filter(_ => uid.includes(_) || (uid === _)).length === 0;
|
|
28
22
|
return uid && isOneOfAllowedType && isNoneOfRestricted;
|
|
29
23
|
},
|
|
30
|
-
}
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VFC } from "react";
|
|
2
|
+
export interface ConfirmEffect {
|
|
3
|
+
(source: string): void;
|
|
4
|
+
}
|
|
5
|
+
export interface CancelEffect {
|
|
6
|
+
(): void;
|
|
7
|
+
}
|
|
8
|
+
interface Props {
|
|
9
|
+
onConfirm: ConfirmEffect;
|
|
10
|
+
onCancel: CancelEffect;
|
|
11
|
+
}
|
|
12
|
+
export declare const I18nCopyNavigationItemsModal: VFC<Props>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
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.I18nCopyNavigationItemsModal = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ConfirmationDialog_1 = __importDefault(require("../../../../components/ConfirmationDialog"));
|
|
9
|
+
const utils_1 = require("../../../../utils");
|
|
10
|
+
const refreshIcon = react_1.default.createElement(react_1.default.Fragment, null);
|
|
11
|
+
const I18nCopyNavigationItemsModal = ({ onConfirm, onCancel, }) => {
|
|
12
|
+
return (react_1.default.createElement(ConfirmationDialog_1.default, { isVisible: true, header: (0, utils_1.getMessage)("pages.view.actions.i18nCopyItems.confirmation.header"), labelConfirm: (0, utils_1.getMessage)("pages.view.actions.i18nCopyItems.confirmation.confirm"), iconConfirm: refreshIcon, mainIcon: refreshIcon, onConfirm: onConfirm, onCancel: onCancel }, (0, utils_1.getMessage)("pages.view.actions.i18nCopyItems.confirmation.content")));
|
|
13
|
+
};
|
|
14
|
+
exports.I18nCopyNavigationItemsModal = I18nCopyNavigationItemsModal;
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const Flex_1 = require("@strapi/design-system/Flex");
|
|
5
8
|
const NavigationContentHeader = ({ startActions, endActions }) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
{endActions}
|
|
13
|
-
</Flex>
|
|
14
|
-
</Flex>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default NavigationContentHeader;
|
|
9
|
+
return (react_1.default.createElement(Flex_1.Flex, { justifyContent: "space-between", width: "100%" },
|
|
10
|
+
react_1.default.createElement(Flex_1.Flex, { alignItems: "space-between" }, startActions),
|
|
11
|
+
react_1.default.createElement(Flex_1.Flex, { alignItems: "space-between" }, endActions)));
|
|
12
|
+
};
|
|
13
|
+
exports.default = NavigationContentHeader;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default NavigationHeader;
|
|
2
|
+
declare function NavigationHeader({ activeNavigation, availableNavigations, structureHasErrors, structureHasChanged, handleChangeSelection, handleLocalizationSelection, handleSave, config, }: {
|
|
3
|
+
activeNavigation: any;
|
|
4
|
+
availableNavigations: any;
|
|
5
|
+
structureHasErrors: any;
|
|
6
|
+
structureHasChanged: any;
|
|
7
|
+
handleChangeSelection: any;
|
|
8
|
+
handleLocalizationSelection: any;
|
|
9
|
+
handleSave: any;
|
|
10
|
+
config: any;
|
|
11
|
+
}): JSX.Element;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,66 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
primaryAction={
|
|
25
|
-
<Stack horizontal spacing={2}>
|
|
26
|
-
<Box width="10vw">
|
|
27
|
-
<Select
|
|
28
|
-
type="select"
|
|
29
|
-
placeholder={'Change navigation'}
|
|
30
|
-
name={`navigationSelect`}
|
|
31
|
-
onChange={handleChangeSelection}
|
|
32
|
-
value={activeNavigation?.id}
|
|
33
|
-
size="S"
|
|
34
|
-
style={null}
|
|
35
|
-
>
|
|
36
|
-
{availableNavigations.map(({ id, name }) => <Option key={id} value={id}>{name}</Option>)}
|
|
37
|
-
</Select >
|
|
38
|
-
</Box>
|
|
39
|
-
<Button
|
|
40
|
-
onClick={handleSave}
|
|
41
|
-
startIcon={<Check />}
|
|
42
|
-
disabled={structureHasErrors || !structureHasChanged}
|
|
43
|
-
type="submit"
|
|
44
|
-
>
|
|
45
|
-
{formatMessage(getTrad('submit.cta.save'))}
|
|
46
|
-
</Button>
|
|
47
|
-
{/* <MoreButton
|
|
48
|
-
id="more"
|
|
49
|
-
label="More"
|
|
50
|
-
icon={<More />}
|
|
51
|
-
/> */}
|
|
52
|
-
</Stack>
|
|
53
|
-
}
|
|
54
|
-
title={formatMessage({
|
|
55
|
-
id: getTrad('header.title'),
|
|
56
|
-
defaultMessage: 'UI Navigation',
|
|
57
|
-
})}
|
|
58
|
-
subtitle={formatMessage({
|
|
59
|
-
id: getTrad('header.description'),
|
|
60
|
-
defaultMessage: 'Define your portal navigation',
|
|
61
|
-
})}
|
|
62
|
-
/>
|
|
63
|
-
);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
64
24
|
};
|
|
65
|
-
|
|
66
|
-
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const react_intl_1 = require("react-intl");
|
|
31
|
+
const Layout_1 = require("@strapi/design-system/Layout");
|
|
32
|
+
const Stack_1 = require("@strapi/design-system/Stack");
|
|
33
|
+
const Button_1 = require("@strapi/design-system/Button");
|
|
34
|
+
const Check_1 = __importDefault(require("@strapi/icons/Check"));
|
|
35
|
+
const translations_1 = require("../../../../translations");
|
|
36
|
+
const Select_1 = require("@strapi/design-system/Select");
|
|
37
|
+
const Box_1 = require("@strapi/design-system/Box");
|
|
38
|
+
const Grid_1 = require("@strapi/design-system/Grid");
|
|
39
|
+
const lodash_1 = require("lodash");
|
|
40
|
+
const useNavigationManager_1 = require("../../../../hooks/useNavigationManager");
|
|
41
|
+
const submitIcon = react_1.default.createElement(Check_1.default, null);
|
|
42
|
+
const pickDefaultLocaleNavigation = ({ activeNavigation, config }) => config.i18nEnabled
|
|
43
|
+
? activeNavigation
|
|
44
|
+
? activeNavigation.localeCode === config.defaultLocale
|
|
45
|
+
? activeNavigation
|
|
46
|
+
: activeNavigation?.localizations.find(({ localeCode }) => localeCode === config.defaultLocale)
|
|
47
|
+
: null
|
|
48
|
+
: activeNavigation;
|
|
49
|
+
const NavigationHeader = ({ activeNavigation, availableNavigations, structureHasErrors, structureHasChanged, handleChangeSelection, handleLocalizationSelection, handleSave, config, }) => {
|
|
50
|
+
const { formatMessage } = (0, react_intl_1.useIntl)();
|
|
51
|
+
const allLocaleVersions = (0, react_1.useMemo)(() => activeNavigation?.localizations.length && config.i18nEnabled
|
|
52
|
+
? (0, lodash_1.uniqBy)([activeNavigation, ...(activeNavigation.localizations ?? [])].sort((a, b) => a.localeCode.localeCompare(b.localeCode)), 'id')
|
|
53
|
+
: [], [activeNavigation, config]);
|
|
54
|
+
const hasLocalizations = config.i18nEnabled && allLocaleVersions.length;
|
|
55
|
+
const passedActiveNavigation = pickDefaultLocaleNavigation({ activeNavigation, config });
|
|
56
|
+
const { closeNavigationManagerModal, openNavigationManagerModal, navigationManagerModal } = (0, useNavigationManager_1.useNavigationManager)();
|
|
57
|
+
return (react_1.default.createElement(Layout_1.HeaderLayout, { primaryAction: react_1.default.createElement(Stack_1.Stack, { horizontal: true, size: 2 },
|
|
58
|
+
react_1.default.createElement(Box_1.Box, { width: "27vw", marginRight: "8px" },
|
|
59
|
+
react_1.default.createElement(Grid_1.Grid, { gap: 4 },
|
|
60
|
+
!hasLocalizations ? (react_1.default.createElement(Grid_1.GridItem, { col: 2 })) : null,
|
|
61
|
+
react_1.default.createElement(Grid_1.GridItem, { col: 3 },
|
|
62
|
+
react_1.default.createElement(Button_1.Button, { onClick: openNavigationManagerModal, startIcon: null, type: "button", variant: "secondary", fullWidth: true, size: "S" }, formatMessage((0, translations_1.getTrad)('header.action.manage')))),
|
|
63
|
+
react_1.default.createElement(Grid_1.GridItem, { col: 4 },
|
|
64
|
+
react_1.default.createElement(Select_1.Select, { type: "select", placeholder: "Change navigation", name: "navigationSelect", onChange: handleChangeSelection, value: passedActiveNavigation?.id, size: "S", style: null }, availableNavigations.map(({ id, name }) => react_1.default.createElement(Select_1.Option, { key: id, value: id }, name)))),
|
|
65
|
+
hasLocalizations
|
|
66
|
+
? react_1.default.createElement(Grid_1.GridItem, { col: 2 },
|
|
67
|
+
react_1.default.createElement(Select_1.Select, { type: "select", placeholder: formatMessage((0, translations_1.getTrad)('pages.main.header.localization.select.placeholder')), name: "navigationLocalizationSelect", onChange: handleLocalizationSelection, value: activeNavigation?.id, size: "S" }, allLocaleVersions.map(({ id, localeCode }) => react_1.default.createElement(Select_1.Option, { key: id, value: id }, localeCode))))
|
|
68
|
+
: null,
|
|
69
|
+
react_1.default.createElement(Grid_1.GridItem, { col: 3 },
|
|
70
|
+
react_1.default.createElement(Button_1.Button, { onClick: handleSave, startIcon: submitIcon, disabled: structureHasErrors || !structureHasChanged, type: "submit", fullWidth: true, size: "S" }, formatMessage((0, translations_1.getTrad)('submit.cta.save')))))),
|
|
71
|
+
navigationManagerModal), title: formatMessage({
|
|
72
|
+
id: (0, translations_1.getTrad)('header.title'),
|
|
73
|
+
defaultMessage: 'UI Navigation',
|
|
74
|
+
}), subtitle: formatMessage({
|
|
75
|
+
id: (0, translations_1.getTrad)('header.description'),
|
|
76
|
+
defaultMessage: 'Define your portal navigation',
|
|
77
|
+
}) }));
|
|
78
|
+
};
|
|
79
|
+
exports.default = NavigationHeader;
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.MoreButton = void 0;
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
const IconButton_1 = require("@strapi/design-system/IconButton");
|
|
9
|
+
exports.MoreButton = (0, styled_components_1.default)(IconButton_1.IconButton) `
|
|
5
10
|
margin: ${({ theme }) => `0 ${theme.spaces[2]}`};
|
|
6
11
|
padding: ${({ theme }) => theme.spaces[2]};
|
|
7
12
|
|
|
@@ -10,4 +15,4 @@ export const MoreButton = styled(IconButton)`
|
|
|
10
15
|
height: ${18 / 16}rem;
|
|
11
16
|
}
|
|
12
17
|
`;
|
|
13
|
-
|
|
18
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export default NavigationItemForm;
|
|
2
|
+
declare function NavigationItemForm({ config, availableLocale, isLoading: isPreloading, inputsPrefix, data, contentTypes, contentTypeEntities, usedContentTypeEntities, availableAudience, additionalFields, contentTypesNameFields, onSubmit, onCancel, getContentTypeEntities, usedContentTypesData, appendLabelPublicationStatus, locale, readNavigationItemFromLocale, }: {
|
|
3
|
+
config: any;
|
|
4
|
+
availableLocale: any;
|
|
5
|
+
isLoading: any;
|
|
6
|
+
inputsPrefix: any;
|
|
7
|
+
data?: {} | undefined;
|
|
8
|
+
contentTypes?: any[] | undefined;
|
|
9
|
+
contentTypeEntities?: any[] | undefined;
|
|
10
|
+
usedContentTypeEntities?: any[] | undefined;
|
|
11
|
+
availableAudience?: any[] | undefined;
|
|
12
|
+
additionalFields?: any[] | undefined;
|
|
13
|
+
contentTypesNameFields?: {} | undefined;
|
|
14
|
+
onSubmit: any;
|
|
15
|
+
onCancel: any;
|
|
16
|
+
getContentTypeEntities: any;
|
|
17
|
+
usedContentTypesData: any;
|
|
18
|
+
appendLabelPublicationStatus?: (() => string) | undefined;
|
|
19
|
+
locale: any;
|
|
20
|
+
readNavigationItemFromLocale: any;
|
|
21
|
+
}): JSX.Element;
|
|
22
|
+
declare namespace NavigationItemForm {
|
|
23
|
+
namespace defaultProps {
|
|
24
|
+
const fieldsToDisable: never[];
|
|
25
|
+
const formErrors: {};
|
|
26
|
+
const inputsPrefix: string;
|
|
27
|
+
function onSubmit(e: any): any;
|
|
28
|
+
const requestError: null;
|
|
29
|
+
}
|
|
30
|
+
namespace propTypes {
|
|
31
|
+
export const config: PropTypes.Validator<object>;
|
|
32
|
+
export const availableLocale: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
33
|
+
export const isLoading: PropTypes.Requireable<boolean>;
|
|
34
|
+
const fieldsToDisable_1: PropTypes.Requireable<any[]>;
|
|
35
|
+
export { fieldsToDisable_1 as fieldsToDisable };
|
|
36
|
+
const formErrors_1: PropTypes.Validator<object>;
|
|
37
|
+
export { formErrors_1 as formErrors };
|
|
38
|
+
const inputsPrefix_1: PropTypes.Requireable<string>;
|
|
39
|
+
export { inputsPrefix_1 as inputsPrefix };
|
|
40
|
+
export const data: PropTypes.Validator<object>;
|
|
41
|
+
const onSubmit_1: PropTypes.Requireable<(...args: any[]) => any>;
|
|
42
|
+
export { onSubmit_1 as onSubmit };
|
|
43
|
+
const requestError_1: PropTypes.Requireable<object>;
|
|
44
|
+
export { requestError_1 as requestError };
|
|
45
|
+
export const contentTypes: PropTypes.Requireable<any[]>;
|
|
46
|
+
export const contentTypeEntities: PropTypes.Requireable<any[]>;
|
|
47
|
+
export const usedContentTypeEntities: PropTypes.Requireable<any[]>;
|
|
48
|
+
export const availableAudience: PropTypes.Requireable<any[]>;
|
|
49
|
+
export const additionalFields: PropTypes.Requireable<any[]>;
|
|
50
|
+
export const getContentTypeEntities: PropTypes.Validator<(...args: any[]) => any>;
|
|
51
|
+
export const appendLabelPublicationStatus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
52
|
+
export const onCancel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
53
|
+
export const readNavigationItemFromLocale: PropTypes.Validator<(...args: any[]) => any>;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
import PropTypes from "prop-types";
|
|
57
|
+
//# sourceMappingURL=index.d.ts.map
|