strapi-plugin-navigation 2.1.0-beta.1 → 2.2.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 +24 -8
- 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/Item/index.js +11 -18
- 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 +109 -74
- 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 +233 -153
- 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 +18 -9
- 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/queries/render-navigation.d.ts +0 -2
- package/server/graphql/queries/render-navigation.js +10 -8
- package/server/graphql/types/navigation-item.d.ts +2 -1
- package/server/graphql/types/navigation-item.js +26 -2
- package/server/i18n/graphQLEnhancers.js +2 -1
- 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
|
@@ -1,45 +1,26 @@
|
|
|
1
|
-
export namespace form {
|
|
2
|
-
const fieldsToDisable: never[];
|
|
3
|
-
const fieldsToOmit: never[];
|
|
4
|
-
function schema(isSingleSelected: any): import("yup/lib/object").OptionalObjectSchema<{
|
|
5
|
-
title: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
6
|
-
uiRouterKey: import("yup/lib/string").RequiredStringSchema<string | undefined, Record<string, any>>;
|
|
7
|
-
type: import("yup/lib/string").RequiredStringSchema<string | undefined, Record<string, any>>;
|
|
8
|
-
path: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
9
|
-
externalPath: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
10
|
-
menuAttached: yup.BooleanSchema<boolean | undefined, Record<string, any>, boolean | undefined>;
|
|
11
|
-
relatedType: import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
|
|
12
|
-
related: import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
|
|
13
|
-
}, Record<string, any>, import("yup/lib/object").TypeOfShape<{
|
|
14
|
-
title: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
15
|
-
uiRouterKey: import("yup/lib/string").RequiredStringSchema<string | undefined, Record<string, any>>;
|
|
16
|
-
type: import("yup/lib/string").RequiredStringSchema<string | undefined, Record<string, any>>;
|
|
17
|
-
path: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
18
|
-
externalPath: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
19
|
-
menuAttached: yup.BooleanSchema<boolean | undefined, Record<string, any>, boolean | undefined>;
|
|
20
|
-
relatedType: import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
|
|
21
|
-
related: import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
|
|
22
|
-
}>>;
|
|
23
|
-
function schema(isSingleSelected: any): import("yup/lib/object").OptionalObjectSchema<{
|
|
24
|
-
title: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
25
|
-
uiRouterKey: import("yup/lib/string").RequiredStringSchema<string | undefined, Record<string, any>>;
|
|
26
|
-
type: import("yup/lib/string").RequiredStringSchema<string | undefined, Record<string, any>>;
|
|
27
|
-
path: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
28
|
-
externalPath: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
29
|
-
menuAttached: yup.BooleanSchema<boolean | undefined, Record<string, any>, boolean | undefined>;
|
|
30
|
-
relatedType: import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
|
|
31
|
-
related: import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
|
|
32
|
-
}, Record<string, any>, import("yup/lib/object").TypeOfShape<{
|
|
33
|
-
title: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
34
|
-
uiRouterKey: import("yup/lib/string").RequiredStringSchema<string | undefined, Record<string, any>>;
|
|
35
|
-
type: import("yup/lib/string").RequiredStringSchema<string | undefined, Record<string, any>>;
|
|
36
|
-
path: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
37
|
-
externalPath: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
38
|
-
menuAttached: yup.BooleanSchema<boolean | undefined, Record<string, any>, boolean | undefined>;
|
|
39
|
-
relatedType: import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
|
|
40
|
-
related: import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
|
|
41
|
-
}>>;
|
|
42
|
-
const inputsPrefix: string;
|
|
43
|
-
}
|
|
44
1
|
import * as yup from "yup";
|
|
2
|
+
import { NavigationItemAdditionalField } from "../../../../../../../types";
|
|
3
|
+
import { RawFormPayload } from "../types";
|
|
4
|
+
export declare const schemaFactory: (isSingleSelected: boolean, additionalFields: NavigationItemAdditionalField[]) => import("yup/lib/object").OptionalObjectSchema<{
|
|
5
|
+
title: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
6
|
+
uiRouterKey: import("yup/lib/string").RequiredStringSchema<string | undefined, Record<string, any>>;
|
|
7
|
+
type: import("yup/lib/string").RequiredStringSchema<string | undefined, Record<string, any>>;
|
|
8
|
+
path: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
9
|
+
externalPath: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
10
|
+
menuAttached: yup.BooleanSchema<boolean | undefined, Record<string, any>, boolean | undefined>;
|
|
11
|
+
relatedType: import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
|
|
12
|
+
related: import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
|
|
13
|
+
additionalFields: import("yup/lib/object").OptionalObjectSchema<{}, Record<string, any>, import("yup/lib/object").TypeOfShape<{}>>;
|
|
14
|
+
}, Record<string, any>, import("yup/lib/object").TypeOfShape<{
|
|
15
|
+
title: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
16
|
+
uiRouterKey: import("yup/lib/string").RequiredStringSchema<string | undefined, Record<string, any>>;
|
|
17
|
+
type: import("yup/lib/string").RequiredStringSchema<string | undefined, Record<string, any>>;
|
|
18
|
+
path: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
19
|
+
externalPath: yup.StringSchema<string | undefined, Record<string, any>, string | undefined>;
|
|
20
|
+
menuAttached: yup.BooleanSchema<boolean | undefined, Record<string, any>, boolean | undefined>;
|
|
21
|
+
relatedType: import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
|
|
22
|
+
related: import("yup/lib/mixed").MixedSchema<any, Record<string, any>, any>;
|
|
23
|
+
additionalFields: import("yup/lib/object").OptionalObjectSchema<{}, Record<string, any>, import("yup/lib/object").TypeOfShape<{}>>;
|
|
24
|
+
}>>;
|
|
25
|
+
export declare const defaultValues: RawFormPayload;
|
|
45
26
|
//# sourceMappingURL=form.d.ts.map
|
|
@@ -26,58 +26,94 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.defaultValues = exports.schemaFactory = void 0;
|
|
30
30
|
const yup = __importStar(require("yup"));
|
|
31
31
|
const lodash_1 = require("lodash");
|
|
32
32
|
const helper_plugin_1 = require("@strapi/helper-plugin");
|
|
33
|
-
const
|
|
33
|
+
const utils_1 = require("../../../../../utils");
|
|
34
34
|
const pluginId_1 = __importDefault(require("../../../../../pluginId"));
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
35
|
+
const externalPathRegexps = [
|
|
36
|
+
/^mailto:[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/,
|
|
37
|
+
/^tel:(\+\d{1,3})?[\s]?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{3,4}$/,
|
|
38
|
+
/^#.*/,
|
|
39
|
+
/(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/,
|
|
40
|
+
];
|
|
41
|
+
const schemaFactory = (isSingleSelected, additionalFields) => {
|
|
42
|
+
return yup.object({
|
|
43
|
+
title: yup.string()
|
|
44
|
+
.when('type', {
|
|
45
|
+
is: (val) => val !== utils_1.navigationItemType.INTERNAL,
|
|
46
|
+
then: yup.string()
|
|
47
|
+
.required(helper_plugin_1.translatedErrors.required),
|
|
48
|
+
otherwise: yup.string().notRequired(),
|
|
49
|
+
}),
|
|
50
|
+
uiRouterKey: yup.string().required(helper_plugin_1.translatedErrors.required),
|
|
51
|
+
type: yup.string().required(helper_plugin_1.translatedErrors.required),
|
|
52
|
+
path: yup.string()
|
|
53
|
+
.when('type', {
|
|
54
|
+
is: (val) => val !== utils_1.navigationItemType.EXTERNAL || (0, lodash_1.isNil)(val),
|
|
55
|
+
then: yup.string().matches(/^\S+$/, "Invalid path string").required(helper_plugin_1.translatedErrors.required),
|
|
56
|
+
otherwise: yup.string().notRequired(),
|
|
57
|
+
}),
|
|
58
|
+
externalPath: yup.string()
|
|
59
|
+
.when('type', {
|
|
60
|
+
is: (val) => val === utils_1.navigationItemType.EXTERNAL,
|
|
61
|
+
then: yup.string()
|
|
62
|
+
.required(helper_plugin_1.translatedErrors.required)
|
|
63
|
+
.test(`${pluginId_1.default}.popup.item.form.externalPath.validation.type`, externalPath => externalPath ? externalPathRegexps.some(re => re.test(externalPath)) : true),
|
|
64
|
+
otherwise: yup.string().notRequired(),
|
|
65
|
+
}),
|
|
66
|
+
menuAttached: yup.boolean(),
|
|
67
|
+
relatedType: yup.mixed()
|
|
68
|
+
.when('type', {
|
|
69
|
+
is: (val) => val === utils_1.navigationItemType.INTERNAL || (0, lodash_1.isNil)(val),
|
|
70
|
+
then: isSingleSelected ? yup.mixed().notRequired() : yup.mixed().required(helper_plugin_1.translatedErrors.required),
|
|
71
|
+
otherwise: yup.mixed().notRequired(),
|
|
72
|
+
}),
|
|
73
|
+
related: yup.mixed()
|
|
74
|
+
.when('type', {
|
|
75
|
+
is: (val) => val === utils_1.navigationItemType.INTERNAL || (0, lodash_1.isNil)(val),
|
|
76
|
+
then: isSingleSelected ? yup.mixed().notRequired() : yup.mixed().required(helper_plugin_1.translatedErrors.required),
|
|
77
|
+
otherwise: yup.mixed().notRequired(),
|
|
78
|
+
}),
|
|
79
|
+
additionalFields: yup.object({
|
|
80
|
+
...additionalFields.reduce((acc, current) => {
|
|
81
|
+
var value;
|
|
82
|
+
if (typeof current === 'string')
|
|
83
|
+
return acc;
|
|
84
|
+
if (current.type === 'boolean')
|
|
85
|
+
value = yup.bool();
|
|
86
|
+
else if (current.type === 'string')
|
|
87
|
+
value = yup.string();
|
|
88
|
+
else if (current.type === 'select' && current.multi)
|
|
89
|
+
value = yup.array().of(yup.string());
|
|
90
|
+
else if (current.type === 'select' && !current.multi)
|
|
91
|
+
value = yup.string();
|
|
92
|
+
else
|
|
93
|
+
throw new Error(`Type "${current.type}" is unsupported by custom fields`);
|
|
94
|
+
if (current.required)
|
|
95
|
+
value = value.required(helper_plugin_1.translatedErrors.required);
|
|
96
|
+
else
|
|
97
|
+
value = value.notRequired();
|
|
98
|
+
return { ...acc, [current.name]: value };
|
|
99
|
+
}, {})
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
exports.schemaFactory = schemaFactory;
|
|
104
|
+
exports.defaultValues = {
|
|
105
|
+
type: "INTERNAL",
|
|
106
|
+
related: "",
|
|
107
|
+
relatedType: "",
|
|
108
|
+
audience: [],
|
|
109
|
+
menuAttached: false,
|
|
110
|
+
title: "",
|
|
111
|
+
externalPath: "",
|
|
112
|
+
path: "",
|
|
113
|
+
additionalFields: {
|
|
114
|
+
boolean: false,
|
|
115
|
+
string: "",
|
|
80
116
|
},
|
|
81
|
-
|
|
117
|
+
updated: false,
|
|
82
118
|
};
|
|
83
119
|
//# sourceMappingURL=form.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export default NavigationItemPopUp;
|
|
2
|
-
declare function NavigationItemPopUp({ isOpen, isLoading, data, config, onSubmit, onClose, usedContentTypeItems, getContentTypeItems, usedContentTypesData, locale, }: {
|
|
2
|
+
declare function NavigationItemPopUp({ availableLocale, isOpen, isLoading, data, config, onSubmit, onClose, usedContentTypeItems, getContentTypeItems, usedContentTypesData, locale, readNavigationItemFromLocale, }: {
|
|
3
|
+
availableLocale: any;
|
|
3
4
|
isOpen: any;
|
|
4
5
|
isLoading: any;
|
|
5
6
|
data: any;
|
|
@@ -10,6 +11,7 @@ declare function NavigationItemPopUp({ isOpen, isLoading, data, config, onSubmit
|
|
|
10
11
|
getContentTypeItems: any;
|
|
11
12
|
usedContentTypesData: any;
|
|
12
13
|
locale: any;
|
|
14
|
+
readNavigationItemFromLocale: any;
|
|
13
15
|
}): JSX.Element;
|
|
14
16
|
declare namespace NavigationItemPopUp {
|
|
15
17
|
namespace propTypes {
|
|
@@ -21,6 +23,7 @@ declare namespace NavigationItemPopUp {
|
|
|
21
23
|
const onClose: PropTypes.Validator<(...args: any[]) => any>;
|
|
22
24
|
const getContentTypeItems: PropTypes.Validator<(...args: any[]) => any>;
|
|
23
25
|
const locale: PropTypes.Requireable<string>;
|
|
26
|
+
const readNavigationItemFromLocale: PropTypes.Validator<(...args: any[]) => any>;
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
import PropTypes from "prop-types";
|
|
@@ -1,18 +1,40 @@
|
|
|
1
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
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 =
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
7
30
|
const prop_types_1 = __importDefault(require("prop-types"));
|
|
8
31
|
const lodash_1 = require("lodash");
|
|
9
32
|
const ModalLayout_1 = require("@strapi/design-system/ModalLayout");
|
|
10
33
|
const NavigationItemForm_1 = __importDefault(require("../NavigationItemForm"));
|
|
11
34
|
const parsers_1 = require("../../utils/parsers");
|
|
12
|
-
const enums_1 = require("../../utils/enums");
|
|
13
35
|
const NavigationItemPopupHeader_1 = require("./NavigationItemPopupHeader");
|
|
14
36
|
const utils_1 = require("../../../../utils");
|
|
15
|
-
const NavigationItemPopUp = ({ isOpen, isLoading, data, config = {}, onSubmit, onClose, usedContentTypeItems, getContentTypeItems, usedContentTypesData, locale, }) => {
|
|
37
|
+
const NavigationItemPopUp = ({ availableLocale, isOpen, isLoading, data, config = {}, onSubmit, onClose, usedContentTypeItems, getContentTypeItems, usedContentTypesData, locale, readNavigationItemFromLocale, }) => {
|
|
16
38
|
const handleOnSubmit = (payload) => {
|
|
17
39
|
onSubmit(payload);
|
|
18
40
|
};
|
|
@@ -21,7 +43,7 @@ const NavigationItemPopUp = ({ isOpen, isLoading, data, config = {}, onSubmit, o
|
|
|
21
43
|
const appendLabelPublicationStatus = (label = '', item = {}, isCollection = false) => {
|
|
22
44
|
const appendix = (0, parsers_1.isRelationPublished)({
|
|
23
45
|
relatedRef: item,
|
|
24
|
-
type: item.isSingle ?
|
|
46
|
+
type: item.isSingle ? utils_1.navigationItemType.INTERNAL : item.type,
|
|
25
47
|
isCollection,
|
|
26
48
|
}) ? '' : `[${(0, utils_1.getMessage)('notification.navigation.item.relation.status.draft')}] `.toUpperCase();
|
|
27
49
|
return `${appendix}${label}`;
|
|
@@ -45,9 +67,11 @@ const NavigationItemPopUp = ({ isOpen, isLoading, data, config = {}, onSubmit, o
|
|
|
45
67
|
} : undefined,
|
|
46
68
|
};
|
|
47
69
|
};
|
|
70
|
+
const preparedData = (0, react_1.useMemo)(prepareFormData.bind(null, data), [data]);
|
|
71
|
+
const hasViewId = !!data.viewId;
|
|
48
72
|
return (react_1.default.createElement(ModalLayout_1.ModalLayout, { labelledBy: "condition-modal-breadcrumbs", onClose: onClose, isOpen: isOpen },
|
|
49
|
-
react_1.default.createElement(NavigationItemPopupHeader_1.NavigationItemPopupHeader, { isNewItem: !
|
|
50
|
-
react_1.default.createElement(NavigationItemForm_1.default, { data:
|
|
73
|
+
react_1.default.createElement(NavigationItemPopupHeader_1.NavigationItemPopupHeader, { isNewItem: !hasViewId }),
|
|
74
|
+
react_1.default.createElement(NavigationItemForm_1.default, { availableLocale: availableLocale, config: config, data: preparedData, isLoading: isLoading, additionalFields: additionalFields, contentTypesNameFields: contentTypesNameFields, availableAudience: availableAudience, contentTypes: contentTypes, contentTypeEntities: contentTypeItems, usedContentTypeEntities: usedContentTypeItems, getContentTypeEntities: getContentTypeItems, usedContentTypesData: usedContentTypesData, onSubmit: handleOnSubmit, onCancel: onClose, appendLabelPublicationStatus: appendLabelPublicationStatus, locale: locale, readNavigationItemFromLocale: readNavigationItemFromLocale })));
|
|
51
75
|
};
|
|
52
76
|
NavigationItemPopUp.propTypes = {
|
|
53
77
|
data: prop_types_1.default.object.isRequired,
|
|
@@ -57,7 +81,8 @@ NavigationItemPopUp.propTypes = {
|
|
|
57
81
|
onSubmit: prop_types_1.default.func.isRequired,
|
|
58
82
|
onClose: prop_types_1.default.func.isRequired,
|
|
59
83
|
getContentTypeItems: prop_types_1.default.func.isRequired,
|
|
60
|
-
locale: prop_types_1.default.string
|
|
84
|
+
locale: prop_types_1.default.string,
|
|
85
|
+
readNavigationItemFromLocale: prop_types_1.default.func.isRequired,
|
|
61
86
|
};
|
|
62
87
|
exports.default = NavigationItemPopUp;
|
|
63
88
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
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.deleteIcon = exports.edit = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const icons_1 = require("@strapi/icons");
|
|
9
|
+
exports.edit = react_1.default.createElement(icons_1.Pencil, null);
|
|
10
|
+
exports.deleteIcon = react_1.default.createElement(icons_1.Trash, null);
|
|
11
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Footer } from "../Footer";
|
|
3
|
+
import { CommonProps, ListState } from "../types";
|
|
4
|
+
interface Props extends ListState, CommonProps {
|
|
5
|
+
}
|
|
6
|
+
export declare const AllNavigations: ({ navigations, selected, setState }: Props) => JSX.Element;
|
|
7
|
+
export declare const AllNavigationsFooter: Footer;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,139 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.AllNavigationsFooter = exports.AllNavigations = void 0;
|
|
30
|
+
const BaseCheckbox_1 = require("@strapi/design-system/BaseCheckbox");
|
|
31
|
+
const Box_1 = require("@strapi/design-system/Box");
|
|
32
|
+
const Button_1 = require("@strapi/design-system/Button");
|
|
33
|
+
const Flex_1 = require("@strapi/design-system/Flex");
|
|
34
|
+
const Grid_1 = require("@strapi/design-system/Grid");
|
|
35
|
+
const IconButton_1 = require("@strapi/design-system/IconButton");
|
|
36
|
+
const Table_1 = require("@strapi/design-system/Table");
|
|
37
|
+
const Typography_1 = require("@strapi/design-system/Typography");
|
|
38
|
+
const fp_1 = require("lodash/fp");
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const useDataManager_1 = __importDefault(require("../../../../../hooks/useDataManager"));
|
|
41
|
+
const utils_1 = require("../../../../../utils");
|
|
42
|
+
const Footer_1 = require("../Footer");
|
|
43
|
+
const NewNavigation_1 = require("../NewNavigation");
|
|
44
|
+
const icons = __importStar(require("./icons"));
|
|
45
|
+
const AllNavigations = ({ navigations, selected, setState }) => {
|
|
46
|
+
const { config: { i18nEnabled }, } = (0, useDataManager_1.default)();
|
|
47
|
+
const hasAnySelected = !!selected.length;
|
|
48
|
+
const toggleSelected = (0, react_1.useCallback)(() => setState({
|
|
49
|
+
navigations,
|
|
50
|
+
selected: hasAnySelected ? [] : navigations.map((n) => n),
|
|
51
|
+
view: "LIST",
|
|
52
|
+
}), [setState, navigations, hasAnySelected]);
|
|
53
|
+
const currentlySelectedSet = (0, react_1.useMemo)(() => new Set(selected.map((0, fp_1.prop)("id"))), [selected]);
|
|
54
|
+
const handleSelect = (navigation, isSelected) => () => {
|
|
55
|
+
setState({
|
|
56
|
+
navigations,
|
|
57
|
+
selected: isSelected
|
|
58
|
+
? selected.filter(({ id }) => id !== navigation.id)
|
|
59
|
+
: selected.concat([navigation]),
|
|
60
|
+
view: "LIST",
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const edit = (navigation) => () => {
|
|
64
|
+
setState({
|
|
65
|
+
view: "EDIT",
|
|
66
|
+
navigation,
|
|
67
|
+
alreadyUsedNames: navigations.reduce((acc, { name }) => name !== navigation.name ? acc.concat([name]) : acc, []),
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const _delete = (navigations) => () => {
|
|
71
|
+
setState({
|
|
72
|
+
view: "DELETE",
|
|
73
|
+
navigations,
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
const deleteSelected = (0, react_1.useCallback)(_delete(selected), [_delete]);
|
|
77
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
78
|
+
react_1.default.createElement(Grid_1.Grid, null,
|
|
79
|
+
react_1.default.createElement(Grid_1.GridItem, { col: 12, paddingBottom: 3 }, hasAnySelected ? (react_1.default.createElement(Flex_1.Flex, { direction: "row", gap: 1 },
|
|
80
|
+
react_1.default.createElement(Box_1.Box, { paddingRight: 3 }, (0, utils_1.getMessage)({
|
|
81
|
+
id: "popup.navigation.manage.table.hasSelected",
|
|
82
|
+
props: {
|
|
83
|
+
count: selected.length,
|
|
84
|
+
},
|
|
85
|
+
})),
|
|
86
|
+
react_1.default.createElement(Button_1.Button, { onClick: deleteSelected, variant: "tertiary" }, (0, utils_1.getMessage)("popup.navigation.manage.button.delete")))) : null)),
|
|
87
|
+
react_1.default.createElement(Table_1.Table, { rowCount: navigations.length, colCount: i18nEnabled ? 6 : 5 },
|
|
88
|
+
react_1.default.createElement(Table_1.Thead, null,
|
|
89
|
+
react_1.default.createElement(Table_1.Tr, null,
|
|
90
|
+
react_1.default.createElement(Table_1.Th, null,
|
|
91
|
+
react_1.default.createElement(BaseCheckbox_1.BaseCheckbox, { onValueChange: toggleSelected, value: hasAnySelected })),
|
|
92
|
+
react_1.default.createElement(Table_1.Th, null,
|
|
93
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800" }, (0, utils_1.getMessage)("popup.navigation.manage.table.id"))),
|
|
94
|
+
react_1.default.createElement(Table_1.Th, null,
|
|
95
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800" }, (0, utils_1.getMessage)("popup.navigation.manage.table.name"))),
|
|
96
|
+
i18nEnabled ? (react_1.default.createElement(Table_1.Th, null,
|
|
97
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800" }, (0, utils_1.getMessage)("popup.navigation.manage.table.locale")))) : null,
|
|
98
|
+
react_1.default.createElement(Table_1.Th, null,
|
|
99
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800" }, (0, utils_1.getMessage)("popup.navigation.manage.table.visibility"))),
|
|
100
|
+
react_1.default.createElement(Table_1.Th, null))),
|
|
101
|
+
react_1.default.createElement(Table_1.Tbody, null, navigations.map((navigation) => (react_1.default.createElement(Table_1.Tr, { key: navigation.id },
|
|
102
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
103
|
+
react_1.default.createElement(BaseCheckbox_1.BaseCheckbox, { onValueChange: handleSelect(navigation, currentlySelectedSet.has(navigation.id)), value: currentlySelectedSet.has(navigation.id) })),
|
|
104
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
105
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800" }, navigation.id)),
|
|
106
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
107
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800" }, navigation.name)),
|
|
108
|
+
i18nEnabled ? (react_1.default.createElement(Table_1.Td, null,
|
|
109
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800" }, [navigation.localeCode]
|
|
110
|
+
.concat(navigation.localizations?.map((0, fp_1.prop)("localeCode")) || [])
|
|
111
|
+
.join(", ")))) : null,
|
|
112
|
+
react_1.default.createElement(Table_1.Td, null, navigation.visible
|
|
113
|
+
? (0, utils_1.getMessage)("popup.navigation.manage.navigation.visible")
|
|
114
|
+
: (0, utils_1.getMessage)("popup.navigation.manage.navigation.hidden")),
|
|
115
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
116
|
+
react_1.default.createElement(Flex_1.Flex, { direction: "row" },
|
|
117
|
+
react_1.default.createElement(Box_1.Box, { paddingLeft: 1 },
|
|
118
|
+
react_1.default.createElement(IconButton_1.IconButton, { onClick: edit(navigation), label: (0, utils_1.getMessage)("popup.navigation.manage.button.edit"), noBorder: true, icon: icons.edit })),
|
|
119
|
+
react_1.default.createElement(Box_1.Box, { paddingLeft: 1 },
|
|
120
|
+
react_1.default.createElement(IconButton_1.IconButton, { onClick: _delete([navigation]), label: (0, utils_1.getMessage)("popup.navigation.manage.button.delete"), noBorder: true, icon: icons.deleteIcon })))))))))));
|
|
121
|
+
};
|
|
122
|
+
exports.AllNavigations = AllNavigations;
|
|
123
|
+
const AllNavigationsFooter = ({ onClose, state, setState, navigations, }) => (react_1.default.createElement(Footer_1.FooterBase, { start: {
|
|
124
|
+
onClick: onClose,
|
|
125
|
+
variant: "tertiary",
|
|
126
|
+
disabled: state.isLoading,
|
|
127
|
+
children: (0, utils_1.getMessage)("popup.item.form.button.cancel"),
|
|
128
|
+
}, end: {
|
|
129
|
+
onClick: () => setState({
|
|
130
|
+
view: "CREATE",
|
|
131
|
+
alreadyUsedNames: navigations.map(({ name }) => name),
|
|
132
|
+
current: NewNavigation_1.INITIAL_NAVIGATION,
|
|
133
|
+
}),
|
|
134
|
+
variant: "default",
|
|
135
|
+
disabled: state.isLoading,
|
|
136
|
+
children: (0, utils_1.getMessage)("popup.navigation.manage.button.create"),
|
|
137
|
+
} }));
|
|
138
|
+
exports.AllNavigationsFooter = AllNavigationsFooter;
|
|
139
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Footer } from "../Footer";
|
|
3
|
+
import { CommonProps, DeleteState } from "../types";
|
|
4
|
+
interface Props extends DeleteState, CommonProps {
|
|
5
|
+
}
|
|
6
|
+
export declare const DeletionConfirm: ({ navigations }: Props) => JSX.Element;
|
|
7
|
+
export declare const DeleteConfirmFooter: Footer;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
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.DeleteConfirmFooter = exports.DeletionConfirm = void 0;
|
|
7
|
+
const Flex_1 = require("@strapi/design-system/Flex");
|
|
8
|
+
const Grid_1 = require("@strapi/design-system/Grid");
|
|
9
|
+
const Typography_1 = require("@strapi/design-system/Typography");
|
|
10
|
+
const fp_1 = require("lodash/fp");
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const utils_1 = require("../../../../../utils");
|
|
13
|
+
const Footer_1 = require("../Footer");
|
|
14
|
+
const DeletionConfirm = ({ navigations }) => (react_1.default.createElement(Grid_1.Grid, null,
|
|
15
|
+
react_1.default.createElement(Grid_1.GridItem, { col: 12, paddingBottom: 1 },
|
|
16
|
+
react_1.default.createElement(Flex_1.Flex, null,
|
|
17
|
+
react_1.default.createElement(Typography_1.Typography, { variant: "beta" }, (0, utils_1.getMessage)("popup.navigation.manage.delete.header")))),
|
|
18
|
+
react_1.default.createElement(Grid_1.GridItem, { col: 12, paddingBottom: 1 },
|
|
19
|
+
react_1.default.createElement(Typography_1.Typography, { variant: "omega", fontWeight: "semiBold" }, renderItems(navigations)))));
|
|
20
|
+
exports.DeletionConfirm = DeletionConfirm;
|
|
21
|
+
const DeleteConfirmFooter = ({ state, onSubmit, onReset }) => (react_1.default.createElement(Footer_1.FooterBase, { start: {
|
|
22
|
+
children: (0, utils_1.getMessage)("popup.item.form.button.cancel"),
|
|
23
|
+
disabled: state.isLoading,
|
|
24
|
+
onClick: onReset,
|
|
25
|
+
variant: "tertiary",
|
|
26
|
+
}, end: {
|
|
27
|
+
children: (0, utils_1.getMessage)("popup.navigation.manage.button.delete"),
|
|
28
|
+
disabled: state.isLoading,
|
|
29
|
+
onClick: onSubmit,
|
|
30
|
+
variant: "danger",
|
|
31
|
+
} }));
|
|
32
|
+
exports.DeleteConfirmFooter = DeleteConfirmFooter;
|
|
33
|
+
const renderItems = (navigations) => navigations.map((0, fp_1.prop)("name")).join(", ");
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Footer } from "../Footer";
|
|
3
|
+
import { CommonProps, ErrorState } from "../types";
|
|
4
|
+
interface Props extends ErrorState, CommonProps {
|
|
5
|
+
}
|
|
6
|
+
export declare const ErrorDetails: ({ errors }: Props) => JSX.Element;
|
|
7
|
+
export declare const ErrorDetailsFooter: Footer;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
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.ErrorDetailsFooter = exports.ErrorDetails = void 0;
|
|
27
|
+
const Grid_1 = require("@strapi/design-system/Grid");
|
|
28
|
+
const helper_plugin_1 = require("@strapi/helper-plugin");
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const utils_1 = require("../../../../../utils");
|
|
31
|
+
const Footer_1 = require("../Footer");
|
|
32
|
+
const ErrorDetails = ({ errors }) => {
|
|
33
|
+
const toggleNotification = (0, helper_plugin_1.useNotification)();
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
35
|
+
errors.map((error) => {
|
|
36
|
+
toggleNotification({
|
|
37
|
+
type: "warning",
|
|
38
|
+
message: { id: "", defaultMessage: error.message },
|
|
39
|
+
});
|
|
40
|
+
console.error(error);
|
|
41
|
+
});
|
|
42
|
+
}, []);
|
|
43
|
+
return (react_1.default.createElement(Grid_1.Grid, null,
|
|
44
|
+
react_1.default.createElement(Grid_1.GridItem, { col: 12 }, (0, utils_1.getMessage)("popup.navigation.manage.error.message"))));
|
|
45
|
+
};
|
|
46
|
+
exports.ErrorDetails = ErrorDetails;
|
|
47
|
+
const ErrorDetailsFooter = ({ onReset }) => (react_1.default.createElement(Footer_1.FooterBase, { end: {
|
|
48
|
+
children: (0, utils_1.getMessage)("popup.navigation.manage.button.goBack"),
|
|
49
|
+
onClick: onReset,
|
|
50
|
+
variant: "secondary",
|
|
51
|
+
} }));
|
|
52
|
+
exports.ErrorDetailsFooter = ErrorDetailsFooter;
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { VoidEffect } from "../../../../../../../types";
|
|
3
|
+
import { Navigation, SetState, State } from "../types";
|
|
4
|
+
interface FooterBaseProps {
|
|
5
|
+
end?: ActionProps;
|
|
6
|
+
start?: ActionProps;
|
|
7
|
+
}
|
|
8
|
+
export declare type Footer = React.FC<{
|
|
9
|
+
navigations: Array<Navigation>;
|
|
10
|
+
onClose?: VoidEffect;
|
|
11
|
+
onReset: VoidEffect;
|
|
12
|
+
onSubmit: VoidEffect;
|
|
13
|
+
setState: SetState;
|
|
14
|
+
state: State;
|
|
15
|
+
}>;
|
|
16
|
+
interface ActionProps {
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
onClick?: VoidEffect;
|
|
20
|
+
variant: "danger" | "secondary" | "tertiary" | "default";
|
|
21
|
+
}
|
|
22
|
+
export declare const FooterBase: React.FC<FooterBaseProps>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
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.FooterBase = void 0;
|
|
7
|
+
const Button_1 = require("@strapi/design-system/Button");
|
|
8
|
+
const ModalLayout_1 = require("@strapi/design-system/ModalLayout");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const FooterBase = ({ start, end }) => (react_1.default.createElement(ModalLayout_1.ModalFooter, { endActions: renderActions(end), startActions: renderActions(start) }));
|
|
11
|
+
exports.FooterBase = FooterBase;
|
|
12
|
+
const renderActions = (actions) => actions ? (react_1.default.createElement(Button_1.Button, { onClick: actions.onClick, variant: actions.variant, disabled: actions.disabled }, actions.children)) : null;
|
|
13
|
+
//# sourceMappingURL=index.js.map
|