strapi-plugin-navigation 2.1.0-beta.2 → 2.2.1
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 +20 -10
- package/admin/src/components/AdditionalFieldInput/index.d.ts +5 -0
- package/admin/src/components/AdditionalFieldInput/index.js +71 -0
- package/admin/src/components/AdditionalFieldInput/types.d.ts +14 -0
- package/admin/src/components/AdditionalFieldInput/types.js +3 -0
- package/admin/src/components/DragButton/index.d.ts +4 -0
- package/admin/src/components/DragButton/index.js +61 -0
- package/admin/src/components/Item/ItemCardHeader/Wrapper.d.ts +1 -1
- package/admin/src/components/Item/ItemCardHeader/icons.d.ts +5 -0
- package/admin/src/components/Item/ItemCardHeader/icons.js +12 -0
- package/admin/src/components/Item/ItemCardHeader/index.d.ts +13 -10
- package/admin/src/components/Item/ItemCardHeader/index.js +17 -38
- package/admin/src/components/Item/index.js +6 -6
- package/admin/src/components/RestartAlert/index.d.ts +1 -1
- package/admin/src/components/TextArrayInput/index.d.ts +14 -0
- package/admin/src/components/TextArrayInput/index.js +45 -0
- package/admin/src/hooks/useAllContentTypes.d.ts +1 -4
- package/admin/src/hooks/useAllContentTypes.js +3 -7
- package/admin/src/hooks/useI18nCopyNavigationItemsModal.d.ts +9 -0
- package/admin/src/hooks/useI18nCopyNavigationItemsModal.js +51 -0
- package/admin/src/hooks/useNavigationConfig.d.ts +1 -1
- package/admin/src/hooks/useNavigationConfig.js +6 -6
- package/admin/src/hooks/useNavigationManager.d.ts +7 -0
- package/admin/src/hooks/useNavigationManager.js +41 -0
- package/admin/src/pages/DataManagerProvider/index.d.ts +1 -1
- package/admin/src/pages/DataManagerProvider/index.js +46 -10
- package/admin/src/pages/SettingsPage/components/CustomFieldForm/index.d.ts +12 -0
- package/admin/src/pages/SettingsPage/components/CustomFieldForm/index.js +112 -0
- package/admin/src/pages/SettingsPage/components/CustomFieldModal/index.d.ts +12 -0
- package/admin/src/pages/SettingsPage/components/CustomFieldModal/index.js +20 -0
- package/admin/src/pages/SettingsPage/components/CustomFieldTable/index.d.ts +11 -0
- package/admin/src/pages/SettingsPage/components/CustomFieldTable/index.js +105 -0
- package/admin/src/pages/SettingsPage/index.d.ts +2 -1
- package/admin/src/pages/SettingsPage/index.js +111 -75
- package/admin/src/pages/SettingsPage/types.d.ts +32 -0
- package/admin/src/pages/SettingsPage/types.js +3 -0
- package/admin/src/pages/SettingsPage/utils/form.d.ts +18 -0
- package/admin/src/pages/SettingsPage/utils/form.js +34 -0
- package/admin/src/pages/SettingsPage/utils/functions.d.ts +2 -2
- package/admin/src/pages/SettingsPage/utils/functions.js +1 -1
- package/admin/src/pages/View/components/I18nCopyNavigationItems/index.d.ts +3 -9
- package/admin/src/pages/View/components/I18nCopyNavigationItems/index.js +2 -47
- package/admin/src/pages/View/components/NavigationHeader/index.js +11 -6
- package/admin/src/pages/View/components/NavigationItemForm/index.d.ts +3 -49
- package/admin/src/pages/View/components/NavigationItemForm/index.js +219 -152
- package/admin/src/pages/View/components/NavigationItemForm/types.d.ts +90 -0
- package/admin/src/pages/View/components/NavigationItemForm/types.js +3 -0
- package/admin/src/pages/View/components/NavigationItemForm/utils/form.d.ts +24 -43
- package/admin/src/pages/View/components/NavigationItemForm/utils/form.js +84 -48
- package/admin/src/pages/View/components/NavigationItemPopup/index.d.ts +4 -1
- package/admin/src/pages/View/components/NavigationItemPopup/index.js +32 -7
- package/admin/src/pages/View/components/NavigationManager/AllNavigations/icons.d.ts +4 -0
- package/admin/src/pages/View/components/NavigationManager/AllNavigations/icons.js +11 -0
- package/admin/src/pages/View/components/NavigationManager/AllNavigations/index.d.ts +9 -0
- package/admin/src/pages/View/components/NavigationManager/AllNavigations/index.js +139 -0
- package/admin/src/pages/View/components/NavigationManager/DeletionConfirm/index.d.ts +9 -0
- package/admin/src/pages/View/components/NavigationManager/DeletionConfirm/index.js +34 -0
- package/admin/src/pages/View/components/NavigationManager/ErrorDetails/index.d.ts +9 -0
- package/admin/src/pages/View/components/NavigationManager/ErrorDetails/index.js +53 -0
- package/admin/src/pages/View/components/NavigationManager/Footer/index.d.ts +24 -0
- package/admin/src/pages/View/components/NavigationManager/Footer/index.js +13 -0
- package/admin/src/pages/View/components/NavigationManager/Form/index.d.ts +20 -0
- package/admin/src/pages/View/components/NavigationManager/Form/index.js +103 -0
- package/admin/src/pages/View/components/NavigationManager/NavigationUpdate/index.d.ts +9 -0
- package/admin/src/pages/View/components/NavigationManager/NavigationUpdate/index.js +59 -0
- package/admin/src/pages/View/components/NavigationManager/NewNavigation/index.d.ts +10 -0
- package/admin/src/pages/View/components/NavigationManager/NewNavigation/index.js +62 -0
- package/admin/src/pages/View/components/NavigationManager/index.d.ts +11 -0
- package/admin/src/pages/View/components/NavigationManager/index.js +190 -0
- package/admin/src/pages/View/components/NavigationManager/types.d.ts +40 -0
- package/admin/src/pages/View/components/NavigationManager/types.js +3 -0
- package/admin/src/pages/View/index.d.ts +1 -1
- package/admin/src/pages/View/index.js +11 -9
- package/admin/src/pages/View/utils/parsers.d.ts +7 -1
- package/admin/src/pages/View/utils/parsers.js +21 -10
- package/admin/src/translations/en.json +68 -0
- package/admin/src/translations/index.d.ts +2 -1
- package/admin/src/translations/index.js +1 -1
- package/admin/src/utils/api.d.ts +8 -7
- package/admin/src/utils/api.js +6 -41
- package/admin/src/utils/enums.d.ts +25 -0
- package/admin/src/utils/enums.js +30 -0
- package/admin/src/utils/functions.d.ts +16 -0
- package/admin/src/utils/functions.js +46 -0
- package/admin/src/utils/index.d.ts +3 -4
- package/admin/src/utils/index.js +16 -24
- package/package.json +6 -7
- package/server/config/index.js +6 -4
- package/server/config/setupStrategy.js +13 -1
- package/server/content-types/index.d.ts +5 -25
- package/server/content-types/navigation/index.d.ts +0 -7
- package/server/content-types/navigation/index.js +0 -2
- package/server/content-types/navigation/schema.js +1 -1
- package/server/content-types/navigation-item/index.d.ts +5 -13
- package/server/content-types/navigation-item/index.js +0 -2
- package/server/content-types/navigation-item/schema.d.ts +5 -0
- package/server/content-types/navigation-item/schema.js +5 -0
- package/server/content-types/navigations-items-related/index.d.ts +0 -5
- package/server/content-types/navigations-items-related/index.js +0 -2
- package/server/controllers/admin.js +67 -14
- package/server/controllers/client.js +43 -19
- package/server/graphql/types/navigation-item.d.ts +2 -1
- package/server/graphql/types/navigation-item.js +26 -2
- package/server/i18n/serviceEnhancers.d.ts +2 -1
- package/server/i18n/serviceEnhancers.js +45 -6
- package/server/i18n/types.d.ts +6 -0
- package/server/index.d.ts +5 -25
- package/server/navigation/setupStrategy.js +3 -1
- package/server/routes/admin.js +10 -0
- package/server/services/admin.js +104 -37
- package/server/services/client.js +64 -21
- package/server/services/common.js +26 -7
- package/server/utils/constant.d.ts +0 -3
- package/server/utils/constant.js +1 -2
- package/server/utils/functions.d.ts +13 -12
- package/server/utils/functions.js +62 -22
- package/strapi-server.d.ts +5 -25
- package/tsconfig.tsbuildinfo +1 -1
- package/types/config.d.ts +6 -2
- package/types/contentTypes.d.ts +22 -1
- package/types/controllers.d.ts +21 -8
- package/types/services.d.ts +20 -5
- package/types/utils.d.ts +10 -1
- package/types/utils.js +18 -3
- package/utils/InvalidParamNavigationError.js +0 -3
- package/admin/src/pages/View/utils/enums.d.ts +0 -9
- package/admin/src/pages/View/utils/enums.js +0 -12
- package/admin/src/utils/getTrad.d.ts +0 -3
- package/admin/src/utils/getTrad.js +0 -9
- package/server/content-types/navigation/lifecycle.d.ts +0 -9
- package/server/content-types/navigation/lifecycle.js +0 -10
- package/server/content-types/navigation-item/lifecycle.d.ts +0 -16
- package/server/content-types/navigation-item/lifecycle.js +0 -31
- package/server/content-types/navigations-items-related/lifecycle.d.ts +0 -8
- package/server/content-types/navigations-items-related/lifecycle.js +0 -22
package/README.md
CHANGED
|
@@ -102,10 +102,10 @@ yarn develop --watch-admin
|
|
|
102
102
|
|
|
103
103
|
The **UI Navigation** plugin should appear in the **Plugins** section of Strapi sidebar after you run app again.
|
|
104
104
|
|
|
105
|
-
You can manage your multiple navigation containers by going to the **Navigation**
|
|
105
|
+
You can manage your multiple navigation containers by going to the **Navigation** manage view by clicking "Manage" button.
|
|
106
106
|
|
|
107
107
|
<div style="margin: 20px 0" align="center">
|
|
108
|
-
<img style="width: 100%; height: auto;" src="public/assets/
|
|
108
|
+
<img style="width: 100%; height: auto;" src="public/assets/manager-view.png" alt="Navigation Manager View" />
|
|
109
109
|
</div>
|
|
110
110
|
|
|
111
111
|
As a next step you must configure your the plugin by the way you want to. See [**Configuration**](#🔧-configuration) section.
|
|
@@ -118,7 +118,7 @@ Complete installation requirements are exact same as for Strapi itself and can b
|
|
|
118
118
|
|
|
119
119
|
**Supported Strapi versions**:
|
|
120
120
|
|
|
121
|
-
- Strapi v4.
|
|
121
|
+
- Strapi v4.2.0 (recently tested)
|
|
122
122
|
- Strapi v4.x
|
|
123
123
|
|
|
124
124
|
> This plugin is designed for **Strapi v4** and is not working with v3.x. To get version for **Strapi v3** install version [v1.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-navigation/tree/strapi-v3).
|
|
@@ -155,25 +155,38 @@ Config for this plugin is stored as a part of the `config/plugins.js` or `config
|
|
|
155
155
|
navigation: {
|
|
156
156
|
enabled: true,
|
|
157
157
|
config: {
|
|
158
|
-
additionalFields: ['audience'],
|
|
158
|
+
additionalFields: ['audience', { name: 'my_custom_field', type: 'boolean', label: 'My custom field' }],
|
|
159
159
|
contentTypes: ['api::page.page'],
|
|
160
160
|
contentTypesNameFields: {
|
|
161
161
|
'api::page.page': ['title']
|
|
162
162
|
},
|
|
163
163
|
allowedLevels: 2,
|
|
164
164
|
gql: {...},
|
|
165
|
+
slugify: {
|
|
166
|
+
customReplacements: [
|
|
167
|
+
["🤔", "thinking"],
|
|
168
|
+
],
|
|
169
|
+
}
|
|
165
170
|
}
|
|
166
171
|
}
|
|
167
172
|
});
|
|
168
173
|
```
|
|
169
174
|
|
|
170
175
|
### Properties
|
|
171
|
-
- `additionalFields` - Additional fields
|
|
176
|
+
- `additionalFields` - Additional fields for navigation items. More **[ here ](#additional-fields)**
|
|
172
177
|
- `allowedLevels` - Maximum level for which you're able to mark item as "Menu attached"
|
|
173
178
|
- `contentTypes` - UIDs of related content types
|
|
174
179
|
- `contentTypesNameFields` - Definition of content type title fields like `'api::<collection name>.<content type name>': ['field_name_1', 'field_name_2']`, if not set titles are pulled from fields like `['title', 'subject', 'name']`. **TIP** - Proper content type uid you can find in the URL of Content Manager where you're managing relevant entities like: `admin/content-manager/collectionType/< THE UID HERE >?page=1&pageSize=10&sort=Title:ASC&plugins[i18n][locale]=en`
|
|
175
180
|
- `gql` - If you're using GraphQL that's the right place to put all necessary settings. More **[ here ](#gql-configuration)**
|
|
176
181
|
- `i18nEnabled` - should you want to manage multi-locale content via navigation set this value `Enabled`. More **[ here ](#i18n-internationalization)**
|
|
182
|
+
- `slugify` - allows to extend configuration of our "slugging" solution of choice. To learn more visit the [documentation](https://github.com/sindresorhus/slugify#api). It can be left unset since it's optional. **This option can only be handled by configuration in config file**.
|
|
183
|
+
|
|
184
|
+
### Properties
|
|
185
|
+
|
|
186
|
+
### Additional Fields
|
|
187
|
+
It is advised to configure additional fields through the plugin's Settings Page. There you can find the table of custom fields and toggle input for the audience field. When enabled, the audience field can be customized through the content manager. Custom fields can be added, edited, toggled, and removed with the use of the table provided on the Settings Page. When removing custom fields be advised that their values in navigation items will be lost. Disabling the custom fields will not affect the data and can be done with no consequence of loosing information.
|
|
188
|
+
|
|
189
|
+
Creating configuration for additional fields with the `config.js` file should be done with caution. Config object contains the `additionalFields` property of type `Array<CustomField | 'audience'>`, where CustomField is of type `{type: 'string' | 'boolean', name: string, label: string}`. When creating custom fields be advised that the `name` property has to be unique. When editing a custom field it is advised not to edit its `name` and `type` properties. After config has been restored the custom fields that are not present in `config.js` file will be deleted and their values in navigation items will be lost.
|
|
177
190
|
|
|
178
191
|
## 🔧 GQL Configuration
|
|
179
192
|
Using navigation with GraphQL requires both plugins to be installed and working. You can find installation guide for GraphQL plugin **[here](https://docs.strapi.io/developer-docs/latest/plugins/graphql.html#graphql)**. To properly configure GQL to work with navigation you should provide `gql` prop. This should contain union types that will be used to define GQL response format for your data while fetching:
|
|
@@ -579,11 +592,8 @@ query {
|
|
|
579
592
|
"title": "Another page",
|
|
580
593
|
"path": "/another",
|
|
581
594
|
"related": {
|
|
582
|
-
"
|
|
583
|
-
"
|
|
584
|
-
"__typename": "Page",
|
|
585
|
-
"Title": "dfdfdf"
|
|
586
|
-
}
|
|
595
|
+
"__typename": "Page",
|
|
596
|
+
"Title": "Eg. Page title"
|
|
587
597
|
},
|
|
588
598
|
"items": []
|
|
589
599
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const react_1 = __importStar(require("react"));
|
|
27
|
+
const types_1 = require("../../../../types");
|
|
28
|
+
const ToggleInput_1 = require("@strapi/design-system/ToggleInput");
|
|
29
|
+
const TextInput_1 = require("@strapi/design-system/TextInput");
|
|
30
|
+
const Select_1 = require("@strapi/design-system/Select");
|
|
31
|
+
const helper_plugin_1 = require("@strapi/helper-plugin");
|
|
32
|
+
const translations_1 = require("../../translations");
|
|
33
|
+
const lodash_1 = require("lodash");
|
|
34
|
+
const react_intl_1 = require("react-intl");
|
|
35
|
+
const DEFAULT_STRING_VALUE = "";
|
|
36
|
+
const handlerFactory = ({ field, prop, onChange }) => ({ target }) => {
|
|
37
|
+
onChange(field.name, target[prop]);
|
|
38
|
+
};
|
|
39
|
+
const AdditionalFieldInput = ({ field, isLoading, onChange, value, error }) => {
|
|
40
|
+
const toggleNotification = (0, helper_plugin_1.useNotification)();
|
|
41
|
+
const { formatMessage } = (0, react_intl_1.useIntl)();
|
|
42
|
+
const defaultInputProps = (0, react_1.useMemo)(() => ({
|
|
43
|
+
id: field.name,
|
|
44
|
+
name: field.name,
|
|
45
|
+
label: field.label,
|
|
46
|
+
disabled: isLoading,
|
|
47
|
+
error: error && formatMessage(error),
|
|
48
|
+
}), [field, isLoading, error]);
|
|
49
|
+
const handleBoolean = (0, react_1.useMemo)(() => handlerFactory({ field, onChange, prop: "checked" }), [onChange, field]);
|
|
50
|
+
const handleString = (0, react_1.useMemo)(() => handlerFactory({ field, onChange, prop: "value" }), [onChange, field]);
|
|
51
|
+
switch (field.type) {
|
|
52
|
+
case 'boolean':
|
|
53
|
+
if (!(0, lodash_1.isNil)(value))
|
|
54
|
+
(0, types_1.assertBoolean)(value);
|
|
55
|
+
return (react_1.default.createElement(ToggleInput_1.ToggleInput, { ...defaultInputProps, checked: !!value, onChange: handleBoolean, onLabel: "true", offLabel: "false" }));
|
|
56
|
+
case 'string':
|
|
57
|
+
if (!(0, lodash_1.isNil)(value))
|
|
58
|
+
(0, types_1.assertString)(value);
|
|
59
|
+
return (react_1.default.createElement(TextInput_1.TextInput, { ...defaultInputProps, onChange: handleString, value: value || DEFAULT_STRING_VALUE }));
|
|
60
|
+
case 'select':
|
|
61
|
+
return (react_1.default.createElement(Select_1.Select, { ...defaultInputProps, onChange: (v) => onChange(field.name, v), value: (0, lodash_1.isNil)(value) ? field.multi ? [] : null : value, multi: field.multi, withTags: field.multi }, field.options.map((option, index) => (react_1.default.createElement(Select_1.Option, { key: `${field.name}-option-${index}`, value: option }, option)))));
|
|
62
|
+
default:
|
|
63
|
+
toggleNotification({
|
|
64
|
+
type: 'warning',
|
|
65
|
+
message: (0, translations_1.getTrad)('notification.error.customField.type'),
|
|
66
|
+
});
|
|
67
|
+
throw new Error(`Type of custom field is unsupported`);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
exports.default = AdditionalFieldInput;
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MessageDescriptor } from "react-intl";
|
|
2
|
+
import { NavigationItemCustomField } from "../../../../types";
|
|
3
|
+
export declare type AdditionalFieldInputProps = {
|
|
4
|
+
field: NavigationItemCustomField;
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
onChange: (name: string, value: string) => void;
|
|
7
|
+
value: string | boolean | string[] | null;
|
|
8
|
+
error: MessageDescriptor | null;
|
|
9
|
+
};
|
|
10
|
+
export declare type TargetProp = "value" | "checked";
|
|
11
|
+
export declare type Input = {
|
|
12
|
+
prop: TargetProp;
|
|
13
|
+
} & Pick<AdditionalFieldInputProps, "onChange" | "field">;
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
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 styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
const icons_1 = require("@strapi/icons");
|
|
9
|
+
const DRAG_BUTTON_SIZE_IN_REM = 2;
|
|
10
|
+
const DragButtonWrapper = styled_components_1.default.span `
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
|
|
15
|
+
height: ${DRAG_BUTTON_SIZE_IN_REM}rem;
|
|
16
|
+
width: ${DRAG_BUTTON_SIZE_IN_REM}rem;
|
|
17
|
+
padding: ${({ theme }) => theme.spaces[2]};
|
|
18
|
+
|
|
19
|
+
background: ${({ theme }) => theme.colors.neutral0};
|
|
20
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
21
|
+
border-radius: ${({ theme }) => theme.borderRadius};
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
|
|
24
|
+
svg {
|
|
25
|
+
height: ${({ theme }) => theme.spaces[3]};
|
|
26
|
+
width: ${({ theme }) => theme.spaces[3]};
|
|
27
|
+
|
|
28
|
+
> g,
|
|
29
|
+
path {
|
|
30
|
+
fill: ${({ theme }) => theme.colors.neutral500};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
&:hover {
|
|
34
|
+
svg {
|
|
35
|
+
> g,
|
|
36
|
+
path {
|
|
37
|
+
fill: ${({ theme }) => theme.colors.neutral600};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
&:active {
|
|
42
|
+
svg {
|
|
43
|
+
> g,
|
|
44
|
+
path {
|
|
45
|
+
fill: ${({ theme }) => theme.colors.neutral400};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
&[aria-disabled='true'] {
|
|
50
|
+
background-color: ${({ theme }) => theme.colors.neutral150};
|
|
51
|
+
svg {
|
|
52
|
+
path {
|
|
53
|
+
fill: ${({ theme }) => theme.colors.neutral600};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
const DragButton = react_1.default.forwardRef((props, ref) => (react_1.default.createElement(DragButtonWrapper, { ...props, ref: ref },
|
|
59
|
+
react_1.default.createElement(icons_1.Drag, null))));
|
|
60
|
+
exports.default = DragButton;
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
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.trashIcon = exports.refreshIcon = exports.pencilIcon = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const icons_1 = require("@strapi/icons");
|
|
9
|
+
exports.pencilIcon = react_1.default.createElement(icons_1.Pencil, null);
|
|
10
|
+
exports.refreshIcon = react_1.default.createElement(icons_1.Refresh, null);
|
|
11
|
+
exports.trashIcon = react_1.default.createElement(icons_1.Trash, null);
|
|
12
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ToBeFixed, VoidEffect } from '../../../../../types';
|
|
3
|
+
interface IProps {
|
|
4
|
+
title: string;
|
|
5
|
+
path: string;
|
|
6
|
+
icon: ToBeFixed;
|
|
7
|
+
removed: boolean;
|
|
8
|
+
onItemRemove: VoidEffect;
|
|
9
|
+
onItemEdit: VoidEffect;
|
|
10
|
+
onItemRestore: VoidEffect;
|
|
11
|
+
dragRef: React.MutableRefObject<HTMLHeadingElement>;
|
|
12
|
+
}
|
|
13
|
+
declare const ItemCardHeader: React.FC<IProps>;
|
|
1
14
|
export default ItemCardHeader;
|
|
2
|
-
declare function ItemCardHeader({ title, path, icon, removed, onItemRemove, onItemEdit, onItemRestore, dragRef }: {
|
|
3
|
-
title: any;
|
|
4
|
-
path: any;
|
|
5
|
-
icon: any;
|
|
6
|
-
removed: any;
|
|
7
|
-
onItemRemove: any;
|
|
8
|
-
onItemEdit: any;
|
|
9
|
-
onItemRestore: any;
|
|
10
|
-
dragRef: any;
|
|
11
|
-
}): JSX.Element;
|
|
12
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,49 +4,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
7
|
const Flex_1 = require("@strapi/design-system/Flex");
|
|
9
|
-
const IconButton_1 = require("@strapi/design-system/IconButton");
|
|
10
8
|
const Typography_1 = require("@strapi/design-system/Typography");
|
|
9
|
+
const IconButton_1 = require("@strapi/design-system/IconButton");
|
|
11
10
|
const Icon_1 = require("@strapi/design-system/Icon");
|
|
12
|
-
const
|
|
11
|
+
const DragButton_1 = __importDefault(require("../../DragButton"));
|
|
13
12
|
const Wrapper_1 = __importDefault(require("./Wrapper"));
|
|
14
13
|
const ItemCardBadge_1 = __importDefault(require("../ItemCardBadge"));
|
|
15
14
|
const utils_1 = require("../../../utils");
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
path {
|
|
32
|
-
fill: ${({ theme }) => theme.colors.neutral500};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
const ItemCardHeader = ({ title, path, icon, removed, onItemRemove, onItemEdit, onItemRestore, dragRef }) => {
|
|
37
|
-
return (react_1.default.createElement(Wrapper_1.default, null,
|
|
38
|
-
react_1.default.createElement(Flex_1.Flex, { alignItems: "center" },
|
|
39
|
-
react_1.default.createElement(IconButton_1.IconButton, { ref: dragRef, label: "Drag", icon: react_1.default.createElement(icons_1.Drag, null) }),
|
|
40
|
-
react_1.default.createElement(Typography_1.Typography, { variant: "omega", fontWeight: "bold" }, title),
|
|
41
|
-
react_1.default.createElement(Typography_1.Typography, { variant: "omega", fontWeight: "bold", textColor: 'neutral500' }, path),
|
|
42
|
-
react_1.default.createElement(Icon_1.Icon, { as: icon })),
|
|
43
|
-
react_1.default.createElement(Flex_1.Flex, { alignItems: "center", style: { zIndex: 2 } },
|
|
44
|
-
removed &&
|
|
45
|
-
(react_1.default.createElement(ItemCardBadge_1.default, { borderColor: `danger200`, backgroundColor: `danger100`, textColor: `danger600` }, (0, utils_1.getMessage)("components.navigationItem.badge.removed"))),
|
|
46
|
-
react_1.default.createElement(IconButton_1.IconButton, { disabled: removed, onClick: onItemEdit, label: "Edit", icon: react_1.default.createElement(icons_1.Pencil, null) }),
|
|
47
|
-
removed ?
|
|
48
|
-
react_1.default.createElement(IconButton_1.IconButton, { onClick: onItemRestore, label: "Restore", icon: react_1.default.createElement(icons_1.Refresh, null) }) :
|
|
49
|
-
react_1.default.createElement(IconButton_1.IconButton, { onClick: onItemRemove, label: "Remove", icon: react_1.default.createElement(icons_1.Trash, null) }))));
|
|
50
|
-
};
|
|
15
|
+
const icons_1 = require("./icons");
|
|
16
|
+
const wrapperStyle = { zIndex: 2 };
|
|
17
|
+
const ItemCardHeader = ({ title, path, icon, removed, onItemRemove, onItemEdit, onItemRestore, dragRef }) => (react_1.default.createElement(Wrapper_1.default, null,
|
|
18
|
+
react_1.default.createElement(Flex_1.Flex, { alignItems: "center" },
|
|
19
|
+
react_1.default.createElement(DragButton_1.default, { ref: dragRef }),
|
|
20
|
+
react_1.default.createElement(Typography_1.Typography, { variant: "omega", fontWeight: "bold" }, title),
|
|
21
|
+
react_1.default.createElement(Typography_1.Typography, { variant: "omega", fontWeight: "bold", textColor: 'neutral500' }, path),
|
|
22
|
+
react_1.default.createElement(Icon_1.Icon, { as: icon })),
|
|
23
|
+
react_1.default.createElement(Flex_1.Flex, { alignItems: "center", style: wrapperStyle },
|
|
24
|
+
removed &&
|
|
25
|
+
(react_1.default.createElement(ItemCardBadge_1.default, { borderColor: "danger200", backgroundColor: "danger100", textColor: "danger600" }, (0, utils_1.getMessage)("components.navigationItem.badge.removed"))),
|
|
26
|
+
react_1.default.createElement(IconButton_1.IconButton, { disabled: removed, onClick: onItemEdit, label: "Edit", icon: icons_1.pencilIcon }),
|
|
27
|
+
removed ?
|
|
28
|
+
react_1.default.createElement(IconButton_1.IconButton, { onClick: onItemRestore, label: "Restore", icon: icons_1.refreshIcon }) :
|
|
29
|
+
react_1.default.createElement(IconButton_1.IconButton, { onClick: onItemRemove, label: "Remove", icon: icons_1.trashIcon }))));
|
|
51
30
|
exports.default = ItemCardHeader;
|
|
52
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -37,7 +37,6 @@ const Link_1 = require("@strapi/design-system/Link");
|
|
|
37
37
|
const TextButton_1 = require("@strapi/design-system/TextButton");
|
|
38
38
|
const Typography_1 = require("@strapi/design-system/Typography");
|
|
39
39
|
const icons_1 = require("@strapi/icons");
|
|
40
|
-
const enums_1 = require("../../pages/View/utils/enums");
|
|
41
40
|
const ItemCardHeader_1 = __importDefault(require("./ItemCardHeader"));
|
|
42
41
|
const NavigationItemList_1 = __importDefault(require("../NavigationItemList"));
|
|
43
42
|
const Wrapper_1 = __importDefault(require("./Wrapper"));
|
|
@@ -48,10 +47,10 @@ const utils_1 = require("../../utils");
|
|
|
48
47
|
const CollapseButton_1 = __importDefault(require("../CollapseButton"));
|
|
49
48
|
const Item = (props) => {
|
|
50
49
|
const { item, isLast = false, level = 0, levelPath = '', allowedLevels, relatedRef, isParentAttachedToMenu, onItemLevelAdd, onItemRemove, onItemRestore, onItemEdit, onItemReOrder, onItemToggleCollapse, error, displayChildren, config = {}, } = props;
|
|
51
|
-
const { viewId, title, type, path, removed, externalPath, menuAttached, collapsed, } = item;
|
|
52
|
-
const { contentTypes, contentTypesNameFields } = config;
|
|
53
|
-
const isExternal = type ===
|
|
54
|
-
const isWrapper = type ===
|
|
50
|
+
const { viewId, title, type, path, removed, externalPath, menuAttached, collapsed, structureId, items = [], } = item;
|
|
51
|
+
const { contentTypes = [], contentTypesNameFields } = config;
|
|
52
|
+
const isExternal = type === utils_1.navigationItemType.EXTERNAL;
|
|
53
|
+
const isWrapper = type === utils_1.navigationItemType.WRAPPER;
|
|
55
54
|
const isHandledByPublishFlow = contentTypes.find(_ => _.uid === relatedRef?.__collectionUid)?.draftAndPublish;
|
|
56
55
|
const isPublished = isHandledByPublishFlow && relatedRef.publishedAt;
|
|
57
56
|
const isNextMenuAllowedLevel = (0, lodash_1.isNumber)(allowedLevels) ? level < (allowedLevels - 1) : true;
|
|
@@ -111,6 +110,7 @@ const Item = (props) => {
|
|
|
111
110
|
const { isSingle } = contentType;
|
|
112
111
|
return `/content-manager/${isSingle ? 'singleType' : 'collectionType'}/${entity?.__collectionUid}${!isSingle ? '/' + entity?.id : ''}`;
|
|
113
112
|
};
|
|
113
|
+
const onNewItemClick = (0, react_1.useCallback)((event) => onItemLevelAdd(event, viewId, isNextMenuAllowedLevel, absolutePath, menuAttached, `${structureId}.${items.length}`), [viewId, isNextMenuAllowedLevel, absolutePath, menuAttached, structureId, items]);
|
|
114
114
|
return (react_1.default.createElement(Wrapper_1.default, { level: level, isLast: isLast, style: { opacity: isDragging ? 0.2 : 1 }, ref: refs ? refs.dropRef : null },
|
|
115
115
|
react_1.default.createElement(Card_1.Card, { style: { width: "728px", zIndex: 1, position: "relative", overflow: 'hidden' } },
|
|
116
116
|
removed && (react_1.default.createElement(ItemCardRemovedOverlay_1.ItemCardRemovedOverlay, null)),
|
|
@@ -126,7 +126,7 @@ const Item = (props) => {
|
|
|
126
126
|
react_1.default.createElement(Flex_1.Flex, { style: { width: '100%' }, direction: "row", alignItems: "center", justifyContent: "space-between" },
|
|
127
127
|
react_1.default.createElement(Flex_1.Flex, null,
|
|
128
128
|
!(0, lodash_1.isEmpty)(item.items) && react_1.default.createElement(CollapseButton_1.default, { toggle: () => onItemToggleCollapse(item), collapsed: collapsed, itemsCount: item.items.length }),
|
|
129
|
-
react_1.default.createElement(TextButton_1.TextButton, { disabled: removed, startIcon: react_1.default.createElement(icons_1.Plus, null), onClick:
|
|
129
|
+
react_1.default.createElement(TextButton_1.TextButton, { disabled: removed, startIcon: react_1.default.createElement(icons_1.Plus, null), onClick: onNewItemClick },
|
|
130
130
|
react_1.default.createElement(Typography_1.Typography, { variant: "pi", fontWeight: "bold", textColor: removed ? "neutral600" : "primary600" }, (0, utils_1.getMessage)("components.navigationItem.action.newItem")))),
|
|
131
131
|
relatedItemLabel && (react_1.default.createElement(Flex_1.Flex, { justifyContent: 'center', alignItems: 'center' },
|
|
132
132
|
isHandledByPublishFlow && (react_1.default.createElement(ItemCardBadge_1.default, { borderColor: `${relatedBadgeColor}200`, backgroundColor: `${relatedBadgeColor}100`, textColor: `${relatedBadgeColor}600`, className: "action", small: true }, (0, utils_1.getMessage)({ id: `components.navigationItem.badge.${isPublished ? 'published' : 'draft'}` }))),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Effect } from '../../../../types';
|
|
3
|
+
interface IProps {
|
|
4
|
+
onChange: Effect<string[]>;
|
|
5
|
+
initialValue?: string[];
|
|
6
|
+
id?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
error?: string | string[];
|
|
11
|
+
}
|
|
12
|
+
declare const TextArrayInput: React.FC<IProps>;
|
|
13
|
+
export default TextArrayInput;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
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;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const react_1 = __importStar(require("react"));
|
|
27
|
+
const TextInput_1 = require("@strapi/design-system/TextInput");
|
|
28
|
+
const lodash_1 = require("lodash");
|
|
29
|
+
const TextArrayInput = ({ onChange, initialValue, ...props }) => {
|
|
30
|
+
const [value, setValue] = (0, react_1.useState)((0, lodash_1.isArray)(initialValue)
|
|
31
|
+
? initialValue.reduce((acc, cur) => `${acc}${cur}; `, "")
|
|
32
|
+
: "");
|
|
33
|
+
const handleOnChange = ({ target: { value } }) => {
|
|
34
|
+
const newValue = value;
|
|
35
|
+
const valuesArray = newValue
|
|
36
|
+
.split(';')
|
|
37
|
+
.map(v => v.trim())
|
|
38
|
+
.filter(v => !!v.length);
|
|
39
|
+
setValue(value);
|
|
40
|
+
onChange(valuesArray);
|
|
41
|
+
};
|
|
42
|
+
return (react_1.default.createElement(TextInput_1.TextInput, { ...props, onChange: handleOnChange, value: value }));
|
|
43
|
+
};
|
|
44
|
+
exports.default = TextArrayInput;
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const react_query_1 = require("react-query");
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const useAllContentTypes = () =>
|
|
7
|
-
const toggleNotification = (0, helper_plugin_1.useNotification)();
|
|
8
|
-
const { isLoading, data } = (0, react_query_1.useQuery)('contentTypes', () => (0, api_1.fetchAllContentTypes)(toggleNotification));
|
|
9
|
-
return { data, isLoading, };
|
|
10
|
-
};
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const useAllContentTypes = () => (0, lodash_1.pick)((0, react_query_1.useQuery)('contentTypes', () => (0, utils_1.fetchAllContentTypes)()), ["data", "isLoading", "error"]);
|
|
11
7
|
exports.default = useAllContentTypes;
|
|
12
8
|
//# sourceMappingURL=useAllContentTypes.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ConfirmEffect } from "../pages/View/components/I18nCopyNavigationItems";
|
|
3
|
+
export declare const useI18nCopyNavigationItemsModal: (onConfirm: ConfirmEffect) => {
|
|
4
|
+
setI18nCopyModalOpened: React.Dispatch<React.SetStateAction<boolean>>;
|
|
5
|
+
setI18nCopySourceLocale: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
6
|
+
i18nCopyItemsModal: JSX.Element | null;
|
|
7
|
+
i18nCopySourceLocale: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=useI18nCopyNavigationItemsModal.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
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;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.useI18nCopyNavigationItemsModal = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const I18nCopyNavigationItems_1 = require("../pages/View/components/I18nCopyNavigationItems");
|
|
29
|
+
const useI18nCopyNavigationItemsModal = (onConfirm) => {
|
|
30
|
+
const [isOpened, setIsOpened] = (0, react_1.useState)(false);
|
|
31
|
+
const [sourceLocale, setSourceLocale] = (0, react_1.useState)(undefined);
|
|
32
|
+
const onCancel = (0, react_1.useCallback)(() => {
|
|
33
|
+
setIsOpened(false);
|
|
34
|
+
}, [setIsOpened]);
|
|
35
|
+
const onConfirmWithModalClose = (0, react_1.useCallback)(() => {
|
|
36
|
+
if (!sourceLocale) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
onConfirm(sourceLocale);
|
|
40
|
+
setIsOpened(false);
|
|
41
|
+
}, [onConfirm, sourceLocale]);
|
|
42
|
+
const modal = (0, react_1.useMemo)(() => isOpened ? (react_1.default.createElement(I18nCopyNavigationItems_1.I18nCopyNavigationItemsModal, { onConfirm: onConfirmWithModalClose, onCancel: onCancel })) : null, [isOpened, onConfirmWithModalClose, onCancel]);
|
|
43
|
+
return (0, react_1.useMemo)(() => ({
|
|
44
|
+
setI18nCopyModalOpened: setIsOpened,
|
|
45
|
+
setI18nCopySourceLocale: setSourceLocale,
|
|
46
|
+
i18nCopyItemsModal: modal,
|
|
47
|
+
i18nCopySourceLocale: sourceLocale,
|
|
48
|
+
}), [setSourceLocale, setIsOpened, modal, sourceLocale]);
|
|
49
|
+
};
|
|
50
|
+
exports.useI18nCopyNavigationItemsModal = useI18nCopyNavigationItemsModal;
|
|
51
|
+
//# sourceMappingURL=useI18nCopyNavigationItemsModal.js.map
|
|
@@ -2,7 +2,7 @@ export default useNavigationConfig;
|
|
|
2
2
|
declare function useNavigationConfig(): {
|
|
3
3
|
data: any;
|
|
4
4
|
isLoading: any;
|
|
5
|
-
|
|
5
|
+
error: any;
|
|
6
6
|
submitMutation: (...args: any[]) => Promise<void>;
|
|
7
7
|
restoreMutation: (...args: any[]) => Promise<void>;
|
|
8
8
|
restartMutation: (...args: any[]) => Promise<void>;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const react_query_1 = require("react-query");
|
|
4
4
|
const helper_plugin_1 = require("@strapi/helper-plugin");
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
6
|
const translations_1 = require("../translations");
|
|
7
7
|
const useNavigationConfig = () => {
|
|
8
8
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
9
9
|
const toggleNotification = (0, helper_plugin_1.useNotification)();
|
|
10
|
-
const { isLoading, data,
|
|
10
|
+
const { isLoading, data, error } = (0, react_query_1.useQuery)('navigationConfig', () => (0, utils_1.fetchNavigationConfig)(toggleNotification));
|
|
11
11
|
const handleError = (type) => {
|
|
12
12
|
toggleNotification({
|
|
13
13
|
type: 'warning',
|
|
@@ -23,7 +23,7 @@ const useNavigationConfig = () => {
|
|
|
23
23
|
};
|
|
24
24
|
const submitMutation = async (...args) => {
|
|
25
25
|
try {
|
|
26
|
-
await (0,
|
|
26
|
+
await (0, utils_1.updateNavigationConfig)(...args);
|
|
27
27
|
await handleSuccess('submit');
|
|
28
28
|
}
|
|
29
29
|
catch (e) {
|
|
@@ -32,7 +32,7 @@ const useNavigationConfig = () => {
|
|
|
32
32
|
};
|
|
33
33
|
const restoreMutation = async (...args) => {
|
|
34
34
|
try {
|
|
35
|
-
await (0,
|
|
35
|
+
await (0, utils_1.restoreNavigationConfig)(...args);
|
|
36
36
|
await handleSuccess('restore');
|
|
37
37
|
}
|
|
38
38
|
catch (e) {
|
|
@@ -41,14 +41,14 @@ const useNavigationConfig = () => {
|
|
|
41
41
|
};
|
|
42
42
|
const restartMutation = async (...args) => {
|
|
43
43
|
try {
|
|
44
|
-
await (0,
|
|
44
|
+
await (0, utils_1.restartStrapi)(...args);
|
|
45
45
|
await handleSuccess('restart');
|
|
46
46
|
}
|
|
47
47
|
catch (e) {
|
|
48
48
|
handleError('restart');
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
return { data, isLoading,
|
|
51
|
+
return { data, isLoading, error, submitMutation, restoreMutation, restartMutation };
|
|
52
52
|
};
|
|
53
53
|
exports.default = useNavigationConfig;
|
|
54
54
|
//# sourceMappingURL=useNavigationConfig.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const useNavigationManager: () => {
|
|
3
|
+
navigationManagerModal: JSX.Element | null;
|
|
4
|
+
openNavigationManagerModal: () => void;
|
|
5
|
+
closeNavigationManagerModal: () => void;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=useNavigationManager.d.ts.map
|