@strapi/content-manager 0.0.0-experimental.5691f94a497e119f564a7f60ce0830bf4c875eb9 → 0.0.0-experimental.5788c38836be65c0321a2dcadbdf44f04b798e8a
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/dist/_chunks/{ComponentConfigurationPage-D_M8iBw5.js → ComponentConfigurationPage-B42mQr1K.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-D_M8iBw5.js.map → ComponentConfigurationPage-B42mQr1K.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-qemkOlnj.mjs → ComponentConfigurationPage-D1YuKq8j.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-qemkOlnj.mjs.map → ComponentConfigurationPage-D1YuKq8j.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CjUrEewK.mjs → EditConfigurationPage-C9yiwgI_.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CjUrEewK.mjs.map → EditConfigurationPage-C9yiwgI_.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BePwPuHy.js → EditConfigurationPage-NC89F29V.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BePwPuHy.js.map → EditConfigurationPage-NC89F29V.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-B-RJeiJD.js → EditViewPage-DYDpe5Wi.js} +15 -5
- package/dist/_chunks/EditViewPage-DYDpe5Wi.js.map +1 -0
- package/dist/_chunks/{EditViewPage-De8GyU8P.mjs → EditViewPage-k8UcfVwt.mjs} +15 -5
- package/dist/_chunks/EditViewPage-k8UcfVwt.mjs.map +1 -0
- package/dist/_chunks/{Field-pb2o8uBe.mjs → Field-BLL5lknV.mjs} +79 -77
- package/dist/_chunks/Field-BLL5lknV.mjs.map +1 -0
- package/dist/_chunks/{Field-dq8Tg1M_.js → Field-Crhugun2.js} +83 -81
- package/dist/_chunks/Field-Crhugun2.js.map +1 -0
- package/dist/_chunks/{Form-DGIf4jQU.js → Form-DUU19g6M.js} +15 -7
- package/dist/_chunks/Form-DUU19g6M.js.map +1 -0
- package/dist/_chunks/{Form-DJn0Dxha.mjs → Form-UHu2eOuG.mjs} +15 -7
- package/dist/_chunks/Form-UHu2eOuG.mjs.map +1 -0
- package/dist/_chunks/{History-BowL3JKP.mjs → History-CpxkZXS3.mjs} +4 -4
- package/dist/_chunks/{History-BowL3JKP.mjs.map → History-CpxkZXS3.mjs.map} +1 -1
- package/dist/_chunks/{History-Dh2NEHnR.js → History-CyA8tvJZ.js} +4 -4
- package/dist/_chunks/{History-Dh2NEHnR.js.map → History-CyA8tvJZ.js.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-BpVOB-hn.mjs → ListConfigurationPage-OUwV8QF1.mjs} +2 -2
- package/dist/_chunks/{ListConfigurationPage-BpVOB-hn.mjs.map → ListConfigurationPage-OUwV8QF1.mjs.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-BxYCWz9e.js → ListConfigurationPage-pJV7aG2V.js} +2 -2
- package/dist/_chunks/{ListConfigurationPage-BxYCWz9e.js.map → ListConfigurationPage-pJV7aG2V.js.map} +1 -1
- package/dist/_chunks/{ListViewPage-4XsciqHZ.js → ListViewPage-BIT0M8VG.js} +43 -39
- package/dist/_chunks/ListViewPage-BIT0M8VG.js.map +1 -0
- package/dist/_chunks/{ListViewPage-CXFUjZQC.mjs → ListViewPage-BOnhCGkE.mjs} +40 -36
- package/dist/_chunks/ListViewPage-BOnhCGkE.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DuhOTp3x.mjs → NoContentTypePage-CwjlHGTn.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-DuhOTp3x.mjs.map → NoContentTypePage-CwjlHGTn.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-C8OpoHeU.js → NoContentTypePage-uIBsBUmH.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-C8OpoHeU.js.map → NoContentTypePage-uIBsBUmH.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-y_r7DVA2.js → NoPermissionsPage-C8wkEaOF.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-y_r7DVA2.js.map → NoPermissionsPage-C8wkEaOF.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DVz3mzDz.mjs → NoPermissionsPage-CcWbyT_z.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DVz3mzDz.mjs.map → NoPermissionsPage-CcWbyT_z.mjs.map} +1 -1
- package/dist/_chunks/{Relations-DPFCAa7b.js → Relations-CwRu_eZv.js} +32 -23
- package/dist/_chunks/Relations-CwRu_eZv.js.map +1 -0
- package/dist/_chunks/{Relations-CVNLrn1Y.mjs → Relations-wIdWJnA9.mjs} +32 -23
- package/dist/_chunks/Relations-wIdWJnA9.mjs.map +1 -0
- package/dist/_chunks/{en-uOUIxfcQ.js → en-Bm0D0IWz.js} +13 -12
- package/dist/_chunks/{en-uOUIxfcQ.js.map → en-Bm0D0IWz.js.map} +1 -1
- package/dist/_chunks/{en-BrCTWlZv.mjs → en-DKV44jRb.mjs} +13 -12
- package/dist/_chunks/{en-BrCTWlZv.mjs.map → en-DKV44jRb.mjs.map} +1 -1
- package/dist/_chunks/{index-C3fJE-1-.js → index-BO-T2BdP.js} +1862 -1765
- package/dist/_chunks/index-BO-T2BdP.js.map +1 -0
- package/dist/_chunks/{index-DiMrfcfy.mjs → index-BQ8DxaCa.mjs} +1866 -1769
- package/dist/_chunks/index-BQ8DxaCa.mjs.map +1 -0
- package/dist/_chunks/{layout-C788OmNr.js → layout-BTB1_M8g.js} +5 -4
- package/dist/_chunks/{layout-C788OmNr.js.map → layout-BTB1_M8g.js.map} +1 -1
- package/dist/_chunks/{layout-ls3gxfpH.mjs → layout-N63eyE5E.mjs} +5 -4
- package/dist/_chunks/{layout-ls3gxfpH.mjs.map → layout-N63eyE5E.mjs.map} +1 -1
- package/dist/_chunks/{relations-CLcOmGO0.mjs → relations-Bh9r0CVE.mjs} +2 -2
- package/dist/_chunks/{relations-CLcOmGO0.mjs.map → relations-Bh9r0CVE.mjs.map} +1 -1
- package/dist/_chunks/{relations-DYeotliT.js → relations-C9AQuM2z.js} +2 -2
- package/dist/_chunks/{relations-DYeotliT.js.map → relations-C9AQuM2z.js.map} +1 -1
- package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +3 -2
- package/dist/admin/src/exports.d.ts +1 -1
- package/dist/admin/src/hooks/useDocument.d.ts +32 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +0 -32
- package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
- package/dist/admin/src/services/documents.d.ts +3 -1
- package/dist/server/index.js +42 -20
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +42 -20
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +1 -0
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/shared/contracts/collection-types.d.ts +3 -1
- package/dist/shared/contracts/collection-types.d.ts.map +1 -1
- package/package.json +11 -11
- package/dist/_chunks/EditViewPage-B-RJeiJD.js.map +0 -1
- package/dist/_chunks/EditViewPage-De8GyU8P.mjs.map +0 -1
- package/dist/_chunks/Field-dq8Tg1M_.js.map +0 -1
- package/dist/_chunks/Field-pb2o8uBe.mjs.map +0 -1
- package/dist/_chunks/Form-DGIf4jQU.js.map +0 -1
- package/dist/_chunks/Form-DJn0Dxha.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-4XsciqHZ.js.map +0 -1
- package/dist/_chunks/ListViewPage-CXFUjZQC.mjs.map +0 -1
- package/dist/_chunks/Relations-CVNLrn1Y.mjs.map +0 -1
- package/dist/_chunks/Relations-DPFCAa7b.js.map +0 -1
- package/dist/_chunks/index-C3fJE-1-.js.map +0 -1
- package/dist/_chunks/index-DiMrfcfy.mjs.map +0 -1
- package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
- package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
- package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
- package/strapi-server.js +0 -3
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useDebounce-DmuSJIF3.mjs","sources":["../../admin/src/utils/urls.ts","../../admin/src/hooks/usePrev.ts","../../admin/src/hooks/useDebounce.ts"],"sourcesContent":["const prefixFileUrlWithBackendUrl = (fileURL?: string): string | undefined => {\n return !!fileURL && fileURL.startsWith('/') ? `${window.strapi.backendURL}${fileURL}` : fileURL;\n};\n\nexport { prefixFileUrlWithBackendUrl };\n","import { useEffect, useRef } from 'react';\n\nexport const usePrev = <T>(value: T): T | undefined => {\n const ref = useRef<T>();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n};\n","import { useEffect, useState } from 'react';\n\nexport function useDebounce<TValue>(value: TValue, delay: number): TValue {\n const [debouncedValue, setDebouncedValue] = useState(value);\n\n useEffect(() => {\n const handler = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n\n return () => {\n clearTimeout(handler);\n };\n }, [value, delay]);\n\n return debouncedValue;\n}\n"],"names":[],"mappings":";AAAM,MAAA,8BAA8B,CAAC,YAAyC;AAC5E,SAAO,CAAC,CAAC,WAAW,QAAQ,WAAW,GAAG,IAAI,GAAG,OAAO,OAAO,UAAU,GAAG,OAAO,KAAK;AAC1F;ACAa,MAAA,UAAU,CAAI,UAA4B;AACrD,QAAM,MAAM;AAEZ,YAAU,MAAM;AACd,QAAI,UAAU;AAAA,EAAA,GACb,CAAC,KAAK,CAAC;AAEV,SAAO,IAAI;AACb;ACRgB,SAAA,YAAoB,OAAe,OAAuB;AACxE,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,KAAK;AAE1D,YAAU,MAAM;AACR,UAAA,UAAU,WAAW,MAAM;AAC/B,wBAAkB,KAAK;AAAA,OACtB,KAAK;AAER,WAAO,MAAM;AACX,mBAAa,OAAO;AAAA,IAAA;AAAA,EACtB,GACC,CAAC,OAAO,KAAK,CAAC;AAEV,SAAA;AACT;"}
|
package/dist/admin/index.js
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
3
|
-
const index = require("../_chunks/index-
|
3
|
+
const index = require("../_chunks/index-BO-T2BdP.js");
|
4
4
|
require("@strapi/icons");
|
5
5
|
exports.DocumentRBAC = index.DocumentRBAC;
|
6
6
|
exports.buildValidParams = index.buildValidParams;
|
7
7
|
exports.default = index.index;
|
8
|
+
exports.unstable_useContentManagerContext = index.useContentManagerContext;
|
8
9
|
exports.unstable_useDocument = index.useDocument;
|
9
10
|
exports.unstable_useDocumentActions = index.useDocumentActions;
|
10
11
|
exports.unstable_useDocumentLayout = index.useDocumentLayout;
|
package/dist/admin/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
package/dist/admin/index.mjs
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
import { l, d, K, J,
|
1
|
+
import { l, d, K, L, J, M, h, f } from "../_chunks/index-BQ8DxaCa.mjs";
|
2
2
|
import "@strapi/icons";
|
3
3
|
export {
|
4
4
|
l as DocumentRBAC,
|
5
5
|
d as buildValidParams,
|
6
6
|
K as default,
|
7
|
+
L as unstable_useContentManagerContext,
|
7
8
|
J as unstable_useDocument,
|
8
|
-
|
9
|
+
M as unstable_useDocumentActions,
|
9
10
|
h as unstable_useDocumentLayout,
|
10
11
|
f as useDocumentRBAC
|
11
12
|
};
|
@@ -4,7 +4,7 @@
|
|
4
4
|
* but should still export the same things.
|
5
5
|
*/
|
6
6
|
export { buildValidParams } from './utils/api';
|
7
|
-
export { useDocument as unstable_useDocument } from './hooks/useDocument';
|
7
|
+
export { useDocument as unstable_useDocument, useContentManagerContext as unstable_useContentManagerContext, } from './hooks/useDocument';
|
8
8
|
export { useDocumentActions as unstable_useDocumentActions } from './hooks/useDocumentActions';
|
9
9
|
export { useDocumentLayout as unstable_useDocumentLayout } from './hooks/useDocumentLayout';
|
10
10
|
export type { EditFieldLayout, EditLayout, ListFieldLayout, ListLayout, } from './hooks/useDocumentLayout';
|
@@ -31,7 +31,9 @@ type UseDocument = (args: UseDocumentArgs, opts?: UseDocumentOpts) => {
|
|
31
31
|
* This is the schema of the content type, it is not the same as the layout.
|
32
32
|
*/
|
33
33
|
schema?: Schema;
|
34
|
+
schemas?: Schema[];
|
34
35
|
validate: (document: Document) => null | FormErrors;
|
36
|
+
hasError?: boolean;
|
35
37
|
};
|
36
38
|
/**
|
37
39
|
* @alpha
|
@@ -78,10 +80,39 @@ declare const useDoc: () => {
|
|
78
80
|
* This is the schema of the content type, it is not the same as the layout.
|
79
81
|
*/
|
80
82
|
schema?: ContentType | undefined;
|
83
|
+
schemas?: ContentType[] | undefined;
|
81
84
|
validate: (document: Document) => null | FormErrors;
|
85
|
+
hasError?: boolean | undefined;
|
82
86
|
collectionType: string;
|
83
87
|
model: string;
|
84
88
|
id: string | undefined;
|
85
89
|
};
|
86
|
-
|
90
|
+
/**
|
91
|
+
* @public
|
92
|
+
* @experimental
|
93
|
+
* Content manager context hooks for plugin development.
|
94
|
+
* Make sure to use this hook inside the content manager.
|
95
|
+
*/
|
96
|
+
declare const useContentManagerContext: () => {
|
97
|
+
error: import("@reduxjs/toolkit").SerializedError | import("../utils/api").BaseQueryError | undefined;
|
98
|
+
isLoading: boolean;
|
99
|
+
model: string;
|
100
|
+
collectionType: string;
|
101
|
+
id: string | undefined;
|
102
|
+
slug: string;
|
103
|
+
isCreatingEntry: boolean;
|
104
|
+
isSingleType: boolean;
|
105
|
+
hasDraftAndPublish: boolean;
|
106
|
+
components: ComponentsDictionary;
|
107
|
+
contentType: ContentType | undefined;
|
108
|
+
contentTypes: ContentType[] | undefined;
|
109
|
+
form: import("@strapi/admin/strapi-admin").FormContextValue<import("@strapi/admin/strapi-admin").FormValues>;
|
110
|
+
layout: {
|
111
|
+
error?: import("@reduxjs/toolkit").SerializedError | import("../utils/api").BaseQueryError | undefined;
|
112
|
+
isLoading: boolean;
|
113
|
+
edit: import("./useDocumentLayout").EditLayout;
|
114
|
+
list: import("./useDocumentLayout").ListLayout;
|
115
|
+
};
|
116
|
+
};
|
117
|
+
export { useDocument, useDoc, useContentManagerContext };
|
87
118
|
export type { UseDocument, UseDocumentArgs, Document, Schema, ComponentsDictionary };
|
@@ -1,37 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { IconButtonComponent } from '@strapi/design-system';
|
3
|
-
export declare const CustomIconButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("@strapi/design-system").TransientBoxProps & {
|
4
|
-
children?: import("react").ReactNode;
|
5
|
-
} & import("@strapi/design-system/dist/types").AsProp<"button"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "children" | keyof import("@strapi/design-system/dist/types").AsProp<C> | keyof import("@strapi/design-system").TransientBoxProps> & {
|
6
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
7
|
-
} & import("@strapi/design-system").TransientFlexProps & Pick<import("@strapi/design-system").ButtonProps, "size" | "variant"> & {
|
8
|
-
children: import("react").ReactNode;
|
9
|
-
disabled?: boolean | undefined;
|
10
|
-
label: string;
|
11
|
-
onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
|
12
|
-
withTooltip?: boolean | undefined;
|
13
|
-
}, never>> & Omit<IconButtonComponent, keyof import("react").Component<any, {}, any>>;
|
14
|
-
export declare const CustomLinkIconButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("styled-components/dist/types").FastOmit<import("@strapi/design-system").TransientBoxProps & {
|
15
|
-
children?: import("react").ReactNode;
|
16
|
-
} & import("@strapi/design-system/dist/types").AsProp<"button"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "children" | keyof import("@strapi/design-system/dist/types").AsProp<C> | keyof import("@strapi/design-system").TransientBoxProps> & {
|
17
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
18
|
-
} & import("@strapi/design-system").TransientFlexProps & Pick<import("@strapi/design-system").ButtonProps, "size" | "variant"> & {
|
19
|
-
children: import("react").ReactNode;
|
20
|
-
disabled?: boolean | undefined;
|
21
|
-
label: string;
|
22
|
-
onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
|
23
|
-
withTooltip?: boolean | undefined;
|
24
|
-
}, never>, never>> & Omit<import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("@strapi/design-system").TransientBoxProps & {
|
25
|
-
children?: import("react").ReactNode;
|
26
|
-
} & import("@strapi/design-system/dist/types").AsProp<"button"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "children" | keyof import("@strapi/design-system/dist/types").AsProp<C> | keyof import("@strapi/design-system").TransientBoxProps> & {
|
27
|
-
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
28
|
-
} & import("@strapi/design-system").TransientFlexProps & Pick<import("@strapi/design-system").ButtonProps, "size" | "variant"> & {
|
29
|
-
children: import("react").ReactNode;
|
30
|
-
disabled?: boolean | undefined;
|
31
|
-
label: string;
|
32
|
-
onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
|
33
|
-
withTooltip?: boolean | undefined;
|
34
|
-
}, never>> & Omit<IconButtonComponent, keyof import("react").Component<any, {}, any>>, keyof import("react").Component<any, {}, any>>;
|
35
3
|
export declare const MainButtons: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<any, never>> | (import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<any, never>> & Omit<any, keyof import("react").Component<any, {}, any>>);
|
36
4
|
export declare const MoreButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("@strapi/design-system").TransientBoxProps & {
|
37
5
|
children?: import("react").ReactNode;
|
@@ -6,20 +6,20 @@ interface HeaderProps {
|
|
6
6
|
title?: string;
|
7
7
|
}
|
8
8
|
declare const Header: ({ isCreating, status, title: documentTitle }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
9
|
-
interface
|
9
|
+
interface DialogOptions {
|
10
|
+
type: 'dialog';
|
11
|
+
title: string;
|
12
|
+
content?: React.ReactNode;
|
13
|
+
footer?: React.ReactNode;
|
14
|
+
}
|
15
|
+
interface HeaderActionDescription {
|
10
16
|
disabled?: boolean;
|
11
17
|
label: string;
|
12
18
|
icon?: React.ReactNode;
|
13
|
-
/**
|
14
|
-
* @default 'default'
|
15
|
-
*/
|
16
19
|
type?: 'icon' | 'default';
|
17
|
-
onClick?: (event: React.SyntheticEvent) => void;
|
18
|
-
|
19
|
-
|
20
|
-
disabled?: boolean;
|
21
|
-
label: string;
|
22
|
-
options: Array<{
|
20
|
+
onClick?: (event: React.SyntheticEvent) => Promise<boolean | void> | boolean | void;
|
21
|
+
dialog?: DialogOptions;
|
22
|
+
options?: Array<{
|
23
23
|
disabled?: boolean;
|
24
24
|
label: string;
|
25
25
|
startIcon?: React.ReactNode;
|
@@ -28,8 +28,8 @@ interface HeaderSelectAction {
|
|
28
28
|
}>;
|
29
29
|
onSelect?: (value: string) => void;
|
30
30
|
value?: string;
|
31
|
+
customizeContent?: (value: string) => React.ReactNode;
|
31
32
|
}
|
32
|
-
type HeaderActionDescription = HeaderButtonAction | HeaderSelectAction;
|
33
33
|
declare const DEFAULT_HEADER_ACTIONS: DocumentActionComponent[];
|
34
34
|
export { Header, DEFAULT_HEADER_ACTIONS };
|
35
35
|
export type { HeaderProps, HeaderActionDescription };
|
@@ -96,6 +96,8 @@ declare const useAutoCloneDocumentMutation: import("@reduxjs/toolkit/dist/query/
|
|
96
96
|
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@strapi/admin/strapi-admin").QueryArguments, unknown, import("@strapi/admin/strapi-admin").BaseQueryError, {}, {}>, "ComponentConfiguration" | "ContentTypesConfiguration" | "ContentTypeSettings" | "Document" | "InitialData" | "HistoryVersion" | "Relations" | "UidAvailability", Unpublish.Response, "adminApi">>, useUnpublishManyDocumentsMutation: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseMutation<import("@reduxjs/toolkit/query").MutationDefinition<Pick<BulkUnpublish.Params, "model"> & {
|
97
97
|
documentIds: string[];
|
98
98
|
} & {
|
99
|
-
params?: {
|
99
|
+
params?: {
|
100
|
+
locale?: string | string[] | null | undefined;
|
101
|
+
} | undefined;
|
100
102
|
}, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@strapi/admin/strapi-admin").QueryArguments, unknown, import("@strapi/admin/strapi-admin").BaseQueryError, {}, {}>, "ComponentConfiguration" | "ContentTypesConfiguration" | "ContentTypeSettings" | "Document" | "InitialData" | "HistoryVersion" | "Relations" | "UidAvailability", BulkUnpublish.Response, "adminApi">>;
|
101
103
|
export { useAutoCloneDocumentMutation, useCloneDocumentMutation, useCreateDocumentMutation, useDeleteDocumentMutation, useDeleteManyDocumentsMutation, useDiscardDocumentMutation, useGetAllDocumentsQuery, useLazyGetDocumentQuery, useGetDocumentQuery, useLazyGetDraftRelationCountQuery as useGetDraftRelationCountQuery, useGetManyDraftRelationCountQuery, usePublishDocumentMutation, usePublishManyDocumentsMutation, useUpdateDocumentMutation, useUnpublishDocumentMutation, useUnpublishManyDocumentsMutation, };
|
package/dist/server/index.js
CHANGED
@@ -199,7 +199,9 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
199
199
|
return strapi2.db.query("plugin::upload.file").findOne({ where: { id: versionRelationData.id } });
|
200
200
|
};
|
201
201
|
const localesService = strapi2.plugin("i18n")?.service("locales");
|
202
|
+
const i18nContentTypeService = strapi2.plugin("i18n")?.service("content-types");
|
202
203
|
const getDefaultLocale = async () => localesService ? localesService.getDefaultLocale() : null;
|
204
|
+
const isLocalizedContentType = (model) => i18nContentTypeService ? i18nContentTypeService.isLocalizedContentType(model) : false;
|
203
205
|
const getLocaleDictionary = async () => {
|
204
206
|
if (!localesService)
|
205
207
|
return {};
|
@@ -317,6 +319,7 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
317
319
|
getRelationRestoreValue,
|
318
320
|
getMediaRestoreValue,
|
319
321
|
getDefaultLocale,
|
322
|
+
isLocalizedContentType,
|
320
323
|
getLocaleDictionary,
|
321
324
|
getRetentionDays,
|
322
325
|
getVersionStatus,
|
@@ -339,7 +342,13 @@ const createHistoryService = ({ strapi: strapi2 }) => {
|
|
339
342
|
});
|
340
343
|
},
|
341
344
|
async findVersionsPage(params) {
|
342
|
-
const
|
345
|
+
const model = strapi2.getModel(params.query.contentType);
|
346
|
+
const isLocalizedContentType = serviceUtils.isLocalizedContentType(model);
|
347
|
+
const defaultLocale = await serviceUtils.getDefaultLocale();
|
348
|
+
let locale = null;
|
349
|
+
if (isLocalizedContentType) {
|
350
|
+
locale = params.query.locale || defaultLocale;
|
351
|
+
}
|
343
352
|
const [{ results, pagination }, localeDictionary] = await Promise.all([
|
344
353
|
query.findPage({
|
345
354
|
...params.query,
|
@@ -555,11 +564,13 @@ const createLifecyclesService = ({ strapi: strapi2 }) => {
|
|
555
564
|
}
|
556
565
|
const uid2 = context.contentType.uid;
|
557
566
|
const schemas = getSchemas(uid2);
|
567
|
+
const model = strapi2.getModel(uid2);
|
568
|
+
const isLocalizedContentType = serviceUtils.isLocalizedContentType(model);
|
558
569
|
const localeEntries = await strapi2.db.query(uid2).findMany({
|
559
570
|
where: {
|
560
571
|
documentId,
|
561
|
-
locale: { $in: locales },
|
562
|
-
publishedAt: null
|
572
|
+
...isLocalizedContentType ? { locale: { $in: locales } } : {},
|
573
|
+
...strapiUtils.contentTypes.hasDraftAndPublish(strapi2.contentTypes[uid2]) ? { publishedAt: null } : {}
|
563
574
|
},
|
564
575
|
populate: serviceUtils.getDeepPopulate(
|
565
576
|
uid2,
|
@@ -1704,7 +1715,7 @@ const updateDocument = async (ctx, opts) => {
|
|
1704
1715
|
throw new strapiUtils.errors.ForbiddenError();
|
1705
1716
|
}
|
1706
1717
|
const pickPermittedFields = documentVersion ? permissionChecker2.sanitizeUpdateInput(documentVersion) : permissionChecker2.sanitizeCreateInput;
|
1707
|
-
const setCreator = strapiUtils.setCreatorFields({ user, isEdition: true });
|
1718
|
+
const setCreator = documentVersion ? strapiUtils.setCreatorFields({ user, isEdition: true }) : strapiUtils.setCreatorFields({ user });
|
1708
1719
|
const sanitizeFn = strapiUtils.async.pipe(pickPermittedFields, setCreator);
|
1709
1720
|
const sanitizedBody = await sanitizeFn(body);
|
1710
1721
|
return documentManager2.update(documentVersion?.documentId || id, model, {
|
@@ -1776,7 +1787,7 @@ const collectionTypes = {
|
|
1776
1787
|
permissionChecker2,
|
1777
1788
|
model,
|
1778
1789
|
// @ts-expect-error TODO: fix
|
1779
|
-
{ id, locale, publishedAt: null },
|
1790
|
+
{ documentId: id, locale, publishedAt: null },
|
1780
1791
|
{ availableLocales: true, availableStatus: false }
|
1781
1792
|
);
|
1782
1793
|
ctx.body = { data: {}, meta };
|
@@ -1913,11 +1924,17 @@ const collectionTypes = {
|
|
1913
1924
|
}
|
1914
1925
|
const isUpdate = !isCreate;
|
1915
1926
|
if (isUpdate) {
|
1916
|
-
|
1917
|
-
if (!
|
1927
|
+
const documentExists = documentManager2.exists(model, id);
|
1928
|
+
if (!documentExists) {
|
1918
1929
|
throw new strapiUtils.errors.NotFoundError("Document not found");
|
1919
1930
|
}
|
1920
|
-
|
1931
|
+
document = await documentManager2.findOne(id, model, { populate, locale });
|
1932
|
+
if (!document) {
|
1933
|
+
if (permissionChecker2.cannot.create({ locale }) || permissionChecker2.cannot.publish({ locale })) {
|
1934
|
+
throw new strapiUtils.errors.ForbiddenError();
|
1935
|
+
}
|
1936
|
+
document = await updateDocument(ctx);
|
1937
|
+
} else if (permissionChecker2.can.update(document)) {
|
1921
1938
|
await updateDocument(ctx);
|
1922
1939
|
}
|
1923
1940
|
}
|
@@ -1979,7 +1996,9 @@ const collectionTypes = {
|
|
1979
1996
|
if (permissionChecker2.cannot.unpublish()) {
|
1980
1997
|
return ctx.forbidden();
|
1981
1998
|
}
|
1982
|
-
const { locale } = await getDocumentLocaleAndStatus(body, model
|
1999
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model, {
|
2000
|
+
allowMultipleLocales: true
|
2001
|
+
});
|
1983
2002
|
const entityPromises = documentIds.map(
|
1984
2003
|
(documentId) => documentManager2.findLocales(documentId, model, { locale, isPublished: true })
|
1985
2004
|
);
|
@@ -2369,11 +2388,8 @@ const validateLocale = (sourceUid, targetUid, locale) => {
|
|
2369
2388
|
const isLocalized = strapi.plugin("i18n").service("content-types").isLocalizedContentType;
|
2370
2389
|
const isSourceLocalized = isLocalized(sourceModel);
|
2371
2390
|
const isTargetLocalized = isLocalized(targetModel);
|
2372
|
-
let validatedLocale = locale;
|
2373
|
-
if (!targetModel || !isTargetLocalized)
|
2374
|
-
validatedLocale = void 0;
|
2375
2391
|
return {
|
2376
|
-
locale
|
2392
|
+
locale,
|
2377
2393
|
isSourceLocalized,
|
2378
2394
|
isTargetLocalized
|
2379
2395
|
};
|
@@ -2476,7 +2492,7 @@ const relations = {
|
|
2476
2492
|
attribute,
|
2477
2493
|
fieldsToSelect,
|
2478
2494
|
mainField,
|
2479
|
-
source: { schema: sourceSchema },
|
2495
|
+
source: { schema: sourceSchema, isLocalized: isSourceLocalized },
|
2480
2496
|
target: { schema: targetSchema, isLocalized: isTargetLocalized },
|
2481
2497
|
sourceSchema,
|
2482
2498
|
targetSchema,
|
@@ -2498,7 +2514,8 @@ const relations = {
|
|
2498
2514
|
fieldsToSelect,
|
2499
2515
|
mainField,
|
2500
2516
|
source: {
|
2501
|
-
schema: { uid: sourceUid, modelType: sourceModelType }
|
2517
|
+
schema: { uid: sourceUid, modelType: sourceModelType },
|
2518
|
+
isLocalized: isSourceLocalized
|
2502
2519
|
},
|
2503
2520
|
target: {
|
2504
2521
|
schema: { uid: targetUid },
|
@@ -2536,12 +2553,16 @@ const relations = {
|
|
2536
2553
|
} else {
|
2537
2554
|
where.id = id;
|
2538
2555
|
}
|
2539
|
-
|
2540
|
-
|
2556
|
+
const publishedAt = getPublishedAtClause(status, targetUid);
|
2557
|
+
if (!fp.isEmpty(publishedAt)) {
|
2558
|
+
where[`${alias}.published_at`] = publishedAt;
|
2541
2559
|
}
|
2542
|
-
if (
|
2560
|
+
if (isTargetLocalized && locale) {
|
2543
2561
|
where[`${alias}.locale`] = locale;
|
2544
2562
|
}
|
2563
|
+
if (isSourceLocalized && locale) {
|
2564
|
+
where.locale = locale;
|
2565
|
+
}
|
2545
2566
|
if ((idsToInclude?.length ?? 0) !== 0) {
|
2546
2567
|
where[`${alias}.id`].$notIn = idsToInclude;
|
2547
2568
|
}
|
@@ -2559,7 +2580,8 @@ const relations = {
|
|
2559
2580
|
id: { $notIn: fp.uniq(idsToOmit) }
|
2560
2581
|
});
|
2561
2582
|
}
|
2562
|
-
const
|
2583
|
+
const dbQuery = strapi.get("query-params").transform(targetUid, queryParams);
|
2584
|
+
const res = await strapi.db.query(targetUid).findPage(dbQuery);
|
2563
2585
|
ctx.body = {
|
2564
2586
|
...res,
|
2565
2587
|
results: await addStatusToRelations(targetUid, res.results)
|
@@ -2681,7 +2703,7 @@ const singleTypes = {
|
|
2681
2703
|
permissionChecker2,
|
2682
2704
|
model,
|
2683
2705
|
// @ts-expect-error - fix types
|
2684
|
-
{
|
2706
|
+
{ documentId: document.documentId, locale, publishedAt: null },
|
2685
2707
|
{ availableLocales: true, availableStatus: false }
|
2686
2708
|
);
|
2687
2709
|
ctx.body = { data: {}, meta };
|