strapi-plugin-navigation 2.3.1 → 2.4.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 +47 -6
- package/admin/src/components/AdditionalFieldInput/index.d.ts +2 -2
- package/admin/src/components/AdditionalFieldInput/index.js +36 -8
- package/admin/src/components/AdditionalFieldInput/types.d.ts +1 -1
- package/admin/src/components/DragButton/index.d.ts +3 -1
- package/admin/src/components/DragButton/index.js +2 -1
- package/admin/src/components/Item/ItemCardHeader/index.d.ts +1 -0
- package/admin/src/components/Item/ItemCardHeader/index.js +10 -5
- package/admin/src/components/Item/index.js +24 -4
- package/admin/src/components/NavigationItemList/index.js +1 -1
- package/admin/src/components/Search/index.d.ts +10 -4
- package/admin/src/components/Search/index.js +45 -6
- package/admin/src/components/TextArrayInput/index.d.ts +2 -1
- package/admin/src/hooks/useAllContentTypes.d.ts +1 -1
- package/admin/src/hooks/useNavigationConfig.d.ts +3 -3
- package/admin/src/index.d.ts +3 -1
- package/admin/src/pages/SettingsPage/common/const.d.ts +2 -0
- package/admin/src/pages/SettingsPage/common/const.js +5 -0
- package/admin/src/pages/SettingsPage/common/index.d.ts +2 -0
- package/admin/src/pages/SettingsPage/common/index.js +18 -0
- package/admin/src/pages/SettingsPage/components/CustomFieldForm/index.js +27 -12
- package/admin/src/pages/SettingsPage/components/CustomFieldTable/index.js +1 -1
- package/admin/src/pages/SettingsPage/components/DisableI18nModal/index.d.ts +2 -3
- package/admin/src/pages/SettingsPage/components/DisableI18nModal/index.js +12 -14
- package/admin/src/pages/SettingsPage/index.js +3 -2
- package/admin/src/pages/SettingsPage/utils/form.js +2 -1
- package/admin/src/pages/View/components/NavigationItemForm/index.js +49 -19
- package/admin/src/pages/View/components/NavigationItemForm/types.d.ts +2 -1
- package/admin/src/pages/View/components/NavigationItemForm/utils/form.js +2 -0
- package/admin/src/pages/View/index.js +20 -10
- package/admin/src/pages/View/utils/form.d.ts +1 -1
- package/admin/src/pages/View/utils/types.d.ts +3 -0
- package/admin/src/pages/View/utils/types.js +3 -0
- package/admin/src/translations/ca.json +1 -0
- package/admin/src/translations/en.json +3 -0
- package/admin/src/translations/fr.json +1 -0
- package/admin/src/utils/api.d.ts +4 -4
- package/admin/src/utils/api.js +1 -1
- package/package.json +8 -3
- package/server/content-types/index.d.ts +2 -0
- package/server/content-types/navigation/index.d.ts +1 -0
- package/server/content-types/navigation/index.js +3 -1
- package/server/content-types/navigation/lifecycles.d.ts +3 -0
- package/server/content-types/navigation/lifecycles.js +7 -0
- package/server/content-types/navigation-item/index.d.ts +1 -0
- package/server/content-types/navigation-item/index.js +3 -1
- package/server/content-types/navigation-item/lifecycles.d.ts +3 -0
- package/server/content-types/navigation-item/lifecycles.js +7 -0
- package/server/controllers/admin.js +19 -16
- package/server/controllers/client.js +6 -4
- package/server/graphql/queries/render-navigation-child.d.ts +1 -1
- package/server/graphql/queries/render-navigation.d.ts +1 -1
- package/server/graphql/types/index.js +1 -0
- package/server/graphql/types/navigation-item-additional-field-media.d.ts +5 -0
- package/server/graphql/types/navigation-item-additional-field-media.js +13 -0
- package/server/graphql/types/navigation-item.js +3 -0
- package/server/i18n/utils.d.ts +1 -0
- package/server/i18n/utils.js +4 -0
- package/server/index.d.ts +2 -0
- package/server/services/admin.js +18 -8
- package/server/services/client.js +42 -11
- package/server/services/common.js +17 -5
- package/server/utils/constant.d.ts +3 -0
- package/server/utils/constant.js +21 -1
- package/server/utils/functions.d.ts +16 -4
- package/server/utils/functions.js +54 -8
- package/strapi-server.d.ts +2 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/types/contentTypes.d.ts +7 -2
- package/types/controllers.d.ts +4 -3
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/lifecycle.d.ts +22 -0
- package/types/lifecycle.js +3 -0
- package/types/services.d.ts +13 -1
package/types/contentTypes.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ type EntityDatePartial = {
|
|
|
82
82
|
updatedAt: DateString;
|
|
83
83
|
};
|
|
84
84
|
export type NotVoid<T> = T extends undefined ? never : T;
|
|
85
|
-
export type NavigationItemCustomFieldType = 'boolean' | 'string' | 'select';
|
|
85
|
+
export type NavigationItemCustomFieldType = 'boolean' | 'string' | 'select' | 'media';
|
|
86
86
|
type NavigationItemCustomFieldBase = {
|
|
87
87
|
name: string;
|
|
88
88
|
label: string;
|
|
@@ -99,7 +99,12 @@ type NavigationItemCustomFieldPrimitive = NavigationItemCustomFieldBase & {
|
|
|
99
99
|
multi: false;
|
|
100
100
|
options: [];
|
|
101
101
|
};
|
|
102
|
-
|
|
102
|
+
type NavigationItemCustomFieldMedia = NavigationItemCustomFieldBase & {
|
|
103
|
+
type: 'media';
|
|
104
|
+
multi: false;
|
|
105
|
+
options: [];
|
|
106
|
+
};
|
|
107
|
+
export type NavigationItemCustomField = NavigationItemCustomFieldPrimitive | NavigationItemCustomFieldSelect | NavigationItemCustomFieldMedia;
|
|
103
108
|
export type NavigationItemAdditionalField = NavigationItemCustomField | 'audience';
|
|
104
109
|
export type NavigationItemAdditionalFieldValues = Record<string, string | boolean | string[]>;
|
|
105
110
|
export {};
|
package/types/controllers.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { StrapiController } from "strapi-typed";
|
|
2
2
|
import { Navigation, NotVoid } from "./contentTypes";
|
|
3
|
-
import { IAdminService, IClientService,
|
|
3
|
+
import { IAdminService, IClientService, ICommonService } from "./services";
|
|
4
4
|
import { AuditLogContext, StrapiControllerContext, ToBeFixed } from "./utils";
|
|
5
5
|
type ControllerCommonContext = {
|
|
6
6
|
auditLog: AuditLogContext;
|
|
7
7
|
};
|
|
8
8
|
export interface IAdminController {
|
|
9
|
-
|
|
9
|
+
getAdminService(): IAdminService;
|
|
10
|
+
getCommonService(): ICommonService;
|
|
10
11
|
config: () => ToBeFixed;
|
|
11
12
|
get: StrapiController<Promise<Array<Navigation>>>;
|
|
12
13
|
getById: StrapiController<Promise<Navigation>, never, never, {
|
|
@@ -41,7 +42,7 @@ export interface IAdminController {
|
|
|
41
42
|
}>;
|
|
42
43
|
}
|
|
43
44
|
export interface IClientController {
|
|
44
|
-
getService:
|
|
45
|
+
getService: () => IClientService;
|
|
45
46
|
render: (ctx: StrapiControllerContext) => ToBeFixed;
|
|
46
47
|
renderChild: (ctx: StrapiControllerContext) => ToBeFixed;
|
|
47
48
|
readAll: (ctx: StrapiControllerContext) => ToBeFixed;
|
package/types/index.d.ts
CHANGED
package/types/index.js
CHANGED
|
@@ -22,4 +22,5 @@ __exportStar(require("./services"), exports);
|
|
|
22
22
|
__exportStar(require("./utils"), exports);
|
|
23
23
|
__exportStar(require("./bootstrap"), exports);
|
|
24
24
|
__exportStar(require("./graphQL"), exports);
|
|
25
|
+
__exportStar(require("./lifecycle"), exports);
|
|
25
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Effect } from "./utils";
|
|
2
|
+
export type LifeCycleHookName = "beforeCreate" | "beforeCreateMany" | "afterCreate" | "afterCreateMany" | "beforeUpdate" | "beforeUpdateMany" | "afterUpdate" | "afterUpdateMany" | "beforeDelete" | "beforeDeleteMany" | "afterDelete" | "afterDeleteMany" | "beforeCount" | "afterCount" | "beforeFindOne" | "afterFindOne" | "beforeFindMany" | "afterFindMany";
|
|
3
|
+
export interface LifeCycleEvent<THookName extends LifeCycleHookName = LifeCycleHookName, TResult = unknown, TParams = Record<string, unknown>> {
|
|
4
|
+
action: THookName;
|
|
5
|
+
model: {
|
|
6
|
+
singularName: string;
|
|
7
|
+
uid: string;
|
|
8
|
+
tableName: string;
|
|
9
|
+
attributes: Record<string, unknown>;
|
|
10
|
+
lifecycles: Partial<Record<LifeCycleHookName, Effect<LifeCycleEvent>>>;
|
|
11
|
+
indexes: Array<{
|
|
12
|
+
type?: string;
|
|
13
|
+
name: string;
|
|
14
|
+
columns: string[];
|
|
15
|
+
}>;
|
|
16
|
+
columnToAttribute: Record<string, string>;
|
|
17
|
+
};
|
|
18
|
+
state: Record<string, unknown>;
|
|
19
|
+
params: TParams;
|
|
20
|
+
result?: TResult | TResult[];
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
package/types/services.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import { Id, StrapiContentType, StrapiEvents, StrapiStore, StringMap } from "str
|
|
|
2
2
|
import { NavigationPluginConfig } from "./config";
|
|
3
3
|
import { Navigation, NavigationItem, NavigationItemCustomField, NavigationItemEntity, NavigationItemInput, NestedStructure, NotVoid, RelatedRef, RelatedRefBase } from "./contentTypes";
|
|
4
4
|
import { I18nQueryParams } from "./i18n";
|
|
5
|
-
import { AuditLogContext, ContentTypeEntity, NavigationActions, NavigationActionsPerItem, PopulateQueryParam, RenderType, RFRNavItem, ToBeFixed } from "./utils";
|
|
5
|
+
import { AuditLogContext, ContentTypeEntity, Effect, NavigationActions, NavigationActionsPerItem, PopulateQueryParam, RenderType, RFRNavItem, ToBeFixed } from "./utils";
|
|
6
|
+
import { ContentType } from "../server/utils";
|
|
7
|
+
import { LifeCycleEvent, LifeCycleHookName } from "./lifecycle";
|
|
6
8
|
export type NavigationServiceName = "common" | "admin" | "client";
|
|
7
9
|
export type NavigationService = ICommonService | IAdminService | IClientService;
|
|
8
10
|
export interface IAdminService {
|
|
@@ -42,6 +44,16 @@ export interface ICommonService {
|
|
|
42
44
|
setDefaultConfig: () => Promise<NavigationPluginConfig>;
|
|
43
45
|
updateBranch: (toUpdate: NestedStructure<NavigationItem>[], masterEntity: Navigation | null, parentItem: NavigationItemEntity | null, operations: NavigationActions) => ToBeFixed;
|
|
44
46
|
getSlug(query: string): Promise<string>;
|
|
47
|
+
registerLifecycleHook(input: {
|
|
48
|
+
hookName: LifeCycleHookName;
|
|
49
|
+
callback: Effect<LifeCycleEvent>;
|
|
50
|
+
contentTypeName: ContentType;
|
|
51
|
+
}): void;
|
|
52
|
+
runLifecycleHook(input: {
|
|
53
|
+
hookName: LifeCycleHookName;
|
|
54
|
+
event: LifeCycleEvent;
|
|
55
|
+
contentTypeName: ContentType;
|
|
56
|
+
}): Promise<void>;
|
|
45
57
|
}
|
|
46
58
|
export interface IClientService {
|
|
47
59
|
readAll: (input: {
|