@strapi/content-manager 0.0.0-experimental.da85533897155e719d784f0271223c866d2f69ab → 0.0.0-experimental.dd1d47ef78ef6cfec4ed62576108500bd9f13740
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-9lRmRdIr.mjs → ComponentConfigurationPage-BpM_Hc7r.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-9lRmRdIr.mjs.map → ComponentConfigurationPage-BpM_Hc7r.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DyDkPajU.js → ComponentConfigurationPage-CL9CAMaL.js} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-DyDkPajU.js.map → ComponentConfigurationPage-CL9CAMaL.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DValmA0m.js → EditConfigurationPage-ILWo0h1e.js} +4 -4
- package/dist/_chunks/{EditConfigurationPage-DValmA0m.js.map → EditConfigurationPage-ILWo0h1e.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-Bk893vVY.mjs → EditConfigurationPage-_prbqpTM.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-Bk893vVY.mjs.map → EditConfigurationPage-_prbqpTM.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-Dk7Eaft4.js → EditViewPage-BqZvBN4s.js} +15 -5
- package/dist/_chunks/EditViewPage-BqZvBN4s.js.map +1 -0
- package/dist/_chunks/{EditViewPage-DiNFdFqP.mjs → EditViewPage-DAtscabN.mjs} +15 -5
- package/dist/_chunks/EditViewPage-DAtscabN.mjs.map +1 -0
- package/dist/_chunks/{Field-DH2OaqUP.js → Field-CcoQiiz1.js} +78 -44
- package/dist/_chunks/Field-CcoQiiz1.js.map +1 -0
- package/dist/_chunks/{Field-Dv_HTFTa.mjs → Field-D-mgn1tH.mjs} +74 -40
- package/dist/_chunks/Field-D-mgn1tH.mjs.map +1 -0
- package/dist/_chunks/{Form-Dy6P4HgH.mjs → Form-BxyeWiXW.mjs} +16 -8
- package/dist/_chunks/Form-BxyeWiXW.mjs.map +1 -0
- package/dist/_chunks/{Form-B_dUDizM.js → Form-CmLbZDfi.js} +16 -8
- package/dist/_chunks/Form-CmLbZDfi.js.map +1 -0
- package/dist/_chunks/{History-DrwsD1Vc.mjs → History-BOhLaq_g.mjs} +38 -41
- package/dist/_chunks/History-BOhLaq_g.mjs.map +1 -0
- package/dist/_chunks/{History-BT4w83Oa.js → History-uECUbCZB.js} +37 -40
- package/dist/_chunks/History-uECUbCZB.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-BxIP0jRy.mjs → ListConfigurationPage-D0vQez6F.mjs} +3 -3
- package/dist/_chunks/{ListConfigurationPage-BxIP0jRy.mjs.map → ListConfigurationPage-D0vQez6F.mjs.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-CuYrMcW3.js → ListConfigurationPage-D_bBSFNW.js} +3 -3
- package/dist/_chunks/{ListConfigurationPage-CuYrMcW3.js.map → ListConfigurationPage-D_bBSFNW.js.map} +1 -1
- package/dist/_chunks/{ListViewPage-BvpwNur7.js → ListViewPage-BkZ83b1A.js} +40 -17
- package/dist/_chunks/ListViewPage-BkZ83b1A.js.map +1 -0
- package/dist/_chunks/{ListViewPage-5a1vw-OK.mjs → ListViewPage-ns-bmy5C.mjs} +36 -13
- package/dist/_chunks/ListViewPage-ns-bmy5C.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-Bm6tRcd3.mjs → NoContentTypePage-BA5ZKMDR.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-Bm6tRcd3.mjs.map → NoContentTypePage-BA5ZKMDR.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-UqEiWKkM.js → NoContentTypePage-C1439s4s.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-UqEiWKkM.js.map → NoContentTypePage-C1439s4s.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BHPqn_tQ.mjs → NoPermissionsPage-B0GdMw1Q.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BHPqn_tQ.mjs.map → NoPermissionsPage-B0GdMw1Q.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-C_vGRo8Q.js → NoPermissionsPage-CPGwsVfb.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-C_vGRo8Q.js.map → NoPermissionsPage-CPGwsVfb.js.map} +1 -1
- package/dist/_chunks/{Relations-C7fPyh5P.mjs → Relations-BIGPMSW4.mjs} +72 -36
- package/dist/_chunks/Relations-BIGPMSW4.mjs.map +1 -0
- package/dist/_chunks/{Relations-CznVF6LS.js → Relations-d-8Uef_-.js} +71 -35
- package/dist/_chunks/Relations-d-8Uef_-.js.map +1 -0
- package/dist/_chunks/{en-otD_UBJi.js → en-Bdpa50w3.js} +17 -12
- package/dist/_chunks/{en-otD_UBJi.js.map → en-Bdpa50w3.js.map} +1 -1
- package/dist/_chunks/{en-CbaIuYoB.mjs → en-CZw4xdPY.mjs} +17 -12
- package/dist/_chunks/{en-CbaIuYoB.mjs.map → en-CZw4xdPY.mjs.map} +1 -1
- package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
- package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
- package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
- package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
- package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
- package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
- package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
- package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
- package/dist/_chunks/{index-BJ6uTqLL.mjs → index-3_WeHXYp.mjs} +890 -685
- package/dist/_chunks/index-3_WeHXYp.mjs.map +1 -0
- package/dist/_chunks/{index-D9UmmBcM.js → index-BgaeYWIy.js} +887 -681
- package/dist/_chunks/index-BgaeYWIy.js.map +1 -0
- package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
- package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
- package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
- package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
- package/dist/_chunks/{layout-kfu5Wtix.js → layout-ByFyQRDH.js} +5 -4
- package/dist/_chunks/{layout-kfu5Wtix.js.map → layout-ByFyQRDH.js.map} +1 -1
- package/dist/_chunks/{layout-uomiIGbG.mjs → layout-CrTxOnCy.mjs} +5 -4
- package/dist/_chunks/{layout-uomiIGbG.mjs.map → layout-CrTxOnCy.mjs.map} +1 -1
- package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
- package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
- package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
- package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
- package/dist/_chunks/{relations-DiDufGSA.mjs → relations-BlpLgngh.mjs} +3 -7
- package/dist/_chunks/relations-BlpLgngh.mjs.map +1 -0
- package/dist/_chunks/{relations-DKENrxko.js → relations-C5RSW926.js} +3 -7
- package/dist/_chunks/relations-C5RSW926.js.map +1 -0
- 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/Header.d.ts +11 -11
- package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
- package/dist/admin/src/preview/constants.d.ts +1 -0
- package/dist/admin/src/preview/index.d.ts +4 -0
- package/dist/admin/src/preview/services/preview.d.ts +3 -0
- package/dist/admin/src/services/documents.d.ts +3 -1
- package/dist/server/index.js +378 -162
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +378 -162
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +15 -1
- package/dist/server/src/controllers/utils/metadata.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 +2 -3
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +4 -4
- package/dist/server/src/preview/constants.d.ts +2 -0
- package/dist/server/src/preview/constants.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/index.d.ts +2 -0
- package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/preview.d.ts +13 -0
- package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
- package/dist/server/src/preview/index.d.ts +4 -0
- package/dist/server/src/preview/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/index.d.ts +8 -0
- package/dist/server/src/preview/routes/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/preview.d.ts +4 -0
- package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
- package/dist/server/src/preview/services/index.d.ts +15 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview-config.d.ts +30 -0
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview.d.ts +12 -0
- package/dist/server/src/preview/services/preview.d.ts.map +1 -0
- package/dist/server/src/preview/utils.d.ts +18 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -0
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/services/document-metadata.d.ts +8 -8
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +4 -4
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
- package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
- package/dist/server/src/utils/index.d.ts +2 -0
- package/dist/server/src/utils/index.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/dist/shared/contracts/index.d.ts +1 -0
- package/dist/shared/contracts/index.d.ts.map +1 -1
- package/dist/shared/contracts/preview.d.ts +27 -0
- package/dist/shared/contracts/preview.d.ts.map +1 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +4 -0
- package/dist/shared/index.mjs.map +1 -1
- package/package.json +13 -13
- package/dist/_chunks/EditViewPage-DiNFdFqP.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-Dk7Eaft4.js.map +0 -1
- package/dist/_chunks/Field-DH2OaqUP.js.map +0 -1
- package/dist/_chunks/Field-Dv_HTFTa.mjs.map +0 -1
- package/dist/_chunks/Form-B_dUDizM.js.map +0 -1
- package/dist/_chunks/Form-Dy6P4HgH.mjs.map +0 -1
- package/dist/_chunks/History-BT4w83Oa.js.map +0 -1
- package/dist/_chunks/History-DrwsD1Vc.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-5a1vw-OK.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-BvpwNur7.js.map +0 -1
- package/dist/_chunks/Relations-C7fPyh5P.mjs.map +0 -1
- package/dist/_chunks/Relations-CznVF6LS.js.map +0 -1
- package/dist/_chunks/index-BJ6uTqLL.mjs.map +0 -1
- package/dist/_chunks/index-D9UmmBcM.js.map +0 -1
- package/dist/_chunks/relations-DKENrxko.js.map +0 -1
- package/dist/_chunks/relations-DiDufGSA.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
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
const fractionalIndexing = require("fractional-indexing");
|
3
|
-
const index = require("./index-
|
3
|
+
const index = require("./index-BgaeYWIy.js");
|
4
4
|
const relationsApi = index.contentManagerApi.injectEndpoints({
|
5
5
|
endpoints: (build) => ({
|
6
6
|
getRelations: build.query({
|
@@ -27,11 +27,7 @@ const relationsApi = index.contentManagerApi.injectEndpoints({
|
|
27
27
|
merge: (currentCache, newItems) => {
|
28
28
|
if (currentCache.pagination && newItems.pagination) {
|
29
29
|
if (currentCache.pagination.page < newItems.pagination.page) {
|
30
|
-
|
31
|
-
const uniqueNewItems = newItems.results.filter(
|
32
|
-
(item) => !existingIds.includes(item.documentId)
|
33
|
-
);
|
34
|
-
currentCache.results.push(...prepareTempKeys(uniqueNewItems, currentCache.results));
|
30
|
+
currentCache.results.push(...prepareTempKeys(newItems.results, currentCache.results));
|
35
31
|
currentCache.pagination = newItems.pagination;
|
36
32
|
} else if (newItems.pagination.page === 1) {
|
37
33
|
currentCache.results = prepareTempKeys(newItems.results);
|
@@ -131,4 +127,4 @@ const getRelationLabel = (relation, mainField) => {
|
|
131
127
|
exports.getRelationLabel = getRelationLabel;
|
132
128
|
exports.useGetRelationsQuery = useGetRelationsQuery;
|
133
129
|
exports.useLazySearchRelationsQuery = useLazySearchRelationsQuery;
|
134
|
-
//# sourceMappingURL=relations-
|
130
|
+
//# sourceMappingURL=relations-C5RSW926.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"relations-C5RSW926.js","sources":["../../admin/src/services/relations.ts","../../admin/src/utils/relations.ts"],"sourcesContent":["import { generateNKeysBetween } from 'fractional-indexing';\n\nimport {\n RelationResult as RelResult,\n FindAvailable,\n FindExisting,\n} from '../../../shared/contracts/relations';\n\nimport { contentManagerApi } from './api';\n\nimport type { Modules } from '@strapi/types';\nimport type { errors } from '@strapi/utils';\n\ninterface RelationResult extends RelResult {\n __temp_key__: string;\n}\n\ntype GetRelationsResponse =\n | {\n results: Array<RelationResult>;\n pagination: {\n page: NonNullable<Modules.EntityService.Params.Pagination.PageNotation['page']>;\n pageSize: NonNullable<Modules.EntityService.Params.Pagination.PageNotation['pageSize']>;\n pageCount: number;\n total: number;\n } | null;\n error?: never;\n }\n | {\n results?: never;\n pagination?: never;\n error: errors.ApplicationError | errors.YupValidationError;\n };\n\nconst relationsApi = contentManagerApi.injectEndpoints({\n endpoints: (build) => ({\n getRelations: build.query<\n GetRelationsResponse,\n FindExisting.Params & {\n params?: FindExisting.Request['query'];\n }\n >({\n query: ({ model, id, targetField, params }) => {\n return {\n url: `/content-manager/relations/${model}/${id}/${targetField}`,\n method: 'GET',\n config: {\n params,\n },\n };\n },\n serializeQueryArgs: (args) => {\n const { endpointName, queryArgs } = args;\n return {\n endpointName,\n model: queryArgs.model,\n id: queryArgs.id,\n targetField: queryArgs.targetField,\n locale: queryArgs.params?.locale,\n status: queryArgs.params?.status,\n };\n },\n merge: (currentCache, newItems) => {\n if (currentCache.pagination && newItems.pagination) {\n if (currentCache.pagination.page < newItems.pagination.page) {\n /**\n * Relations will always have unique IDs, so we can therefore assume\n * that we only need to push the new items to the cache.\n */\n\n currentCache.results.push(...prepareTempKeys(newItems.results, currentCache.results));\n currentCache.pagination = newItems.pagination;\n } else if (newItems.pagination.page === 1) {\n /**\n * We're resetting the relations\n */\n currentCache.results = prepareTempKeys(newItems.results);\n currentCache.pagination = newItems.pagination;\n }\n }\n },\n forceRefetch({ currentArg, previousArg }) {\n if (!currentArg?.params && !previousArg?.params) {\n return false;\n }\n\n return (\n currentArg?.params?.page !== previousArg?.params?.page ||\n currentArg?.params?.pageSize !== previousArg?.params?.pageSize\n );\n },\n transformResponse: (response: FindExisting.Response) => {\n if ('results' in response && response.results) {\n return {\n ...response,\n results: prepareTempKeys(response.results.toReversed()),\n };\n } else {\n return response;\n }\n },\n providesTags: ['Relations'],\n }),\n searchRelations: build.query<\n FindAvailable.Response,\n FindAvailable.Params & {\n params?: FindAvailable.Request['query'];\n }\n >({\n query: ({ model, targetField, params }) => {\n return {\n url: `/content-manager/relations/${model}/${targetField}`,\n method: 'GET',\n config: {\n params,\n },\n };\n },\n serializeQueryArgs: (args) => {\n const { endpointName, queryArgs } = args;\n return {\n endpointName,\n model: queryArgs.model,\n targetField: queryArgs.targetField,\n _q: queryArgs.params?._q,\n idsToOmit: queryArgs.params?.idsToOmit,\n idsToInclude: queryArgs.params?.idsToInclude,\n };\n },\n merge: (currentCache, newItems) => {\n if (currentCache.pagination && newItems.pagination) {\n if (currentCache.pagination.page < newItems.pagination.page) {\n /**\n * Relations will always have unique IDs, so we can therefore assume\n * that we only need to push the new items to the cache.\n */\n const existingIds = currentCache.results.map((item) => item.documentId);\n const uniqueNewItems = newItems.results.filter(\n (item) => !existingIds.includes(item.documentId)\n );\n currentCache.results.push(...uniqueNewItems);\n currentCache.pagination = newItems.pagination;\n } else if (newItems.pagination.page === 1) {\n /**\n * We're resetting the relations\n */\n currentCache.results = newItems.results;\n currentCache.pagination = newItems.pagination;\n }\n }\n },\n forceRefetch({ currentArg, previousArg }) {\n if (!currentArg?.params && !previousArg?.params) {\n return false;\n }\n\n return (\n currentArg?.params?.page !== previousArg?.params?.page ||\n currentArg?.params?.pageSize !== previousArg?.params?.pageSize\n );\n },\n transformResponse: (response: FindAvailable.Response) => {\n if (response.results) {\n return {\n ...response,\n results: response.results,\n };\n } else {\n return response;\n }\n },\n }),\n }),\n});\n\n/**\n * @internal\n * @description Adds a `__temp_key__` to each relation item. This gives us\n * a stable identifier regardless of it's ids etc. that we can then use for drag and drop.\n */\nconst prepareTempKeys = (relations: RelResult[], existingRelations: RelationResult[] = []) => {\n const [firstItem] = existingRelations.slice(0);\n\n const keys = generateNKeysBetween(null, firstItem?.__temp_key__ ?? null, relations.length);\n\n return relations.map((datum, index) => ({\n ...datum,\n __temp_key__: keys[index],\n }));\n};\n\nconst { useGetRelationsQuery, useLazySearchRelationsQuery } = relationsApi;\n\nexport { useGetRelationsQuery, useLazySearchRelationsQuery };\nexport type { RelationResult };\n","import type { MainField } from './attributes';\nimport type { RelationResult } from '../../../shared/contracts/relations';\n\n/**\n * @internal\n * @description Get the label of a relation, the contract has [key: string]: unknown,\n * so we need to check if the mainFieldKey is defined and if the relation has a value\n * under that property. If it does, we then verify it's type of string and return it.\n *\n * We fallback to the documentId.\n */\nconst getRelationLabel = (relation: RelationResult, mainField?: MainField): string => {\n const label = mainField && relation[mainField.name] ? relation[mainField.name] : null;\n\n if (typeof label === 'string') {\n return label;\n }\n\n return relation.documentId;\n};\n\nexport { getRelationLabel };\n"],"names":["contentManagerApi","generateNKeysBetween","index"],"mappings":";;;AAkCA,MAAM,eAAeA,wBAAkB,gBAAgB;AAAA,EACrD,WAAW,CAAC,WAAW;AAAA,IACrB,cAAc,MAAM,MAKlB;AAAA,MACA,OAAO,CAAC,EAAE,OAAO,IAAI,aAAa,aAAa;AACtC,eAAA;AAAA,UACL,KAAK,8BAA8B,KAAK,IAAI,EAAE,IAAI,WAAW;AAAA,UAC7D,QAAQ;AAAA,UACR,QAAQ;AAAA,YACN;AAAA,UACF;AAAA,QAAA;AAAA,MAEJ;AAA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AAC,WAAwB,oBAAsC,OAAO;AAC5F,QAAM,CAAC,SAAS,IAAI,kBAAkB,MAAM,CAAC;AAE7C,QAAM,OAAOC,mBAAqB,qBAAA,MAAM,WAAW,gBAAgB,MAAM,UAAU,MAAM;AAEzF,SAAO,UAAU,IAAI,CAAC,OAAOC,YAAW;AAAA,IACtC,GAAG;AAAA,IACH,cAAc,KAAKA,MAAK;AAAA,EACxB,EAAA;AACJ;AAEM,MAAA,EAAE,sBAAsB,gCAAgC;ACpLxD,MAAA,mBAAmB,CAAC,UAA0B,cAAkC;AAC9E,QAAA,QAAQ,aAAa,SAAS,UAAU,IAAI,IAAI,SAAS,UAAU,IAAI,IAAI;AAE7E,MAAA,OAAO,UAAU,UAAU;AACtB,WAAA;AAAA,EACT;AAEA,SAAO,SAAS;AAClB;;;;"}
|
@@ -10,6 +10,19 @@ const usePrev = (value) => {
|
|
10
10
|
}, [value]);
|
11
11
|
return ref.current;
|
12
12
|
};
|
13
|
+
function useDebounce(value, delay) {
|
14
|
+
const [debouncedValue, setDebouncedValue] = React.useState(value);
|
15
|
+
React.useEffect(() => {
|
16
|
+
const handler = setTimeout(() => {
|
17
|
+
setDebouncedValue(value);
|
18
|
+
}, delay);
|
19
|
+
return () => {
|
20
|
+
clearTimeout(handler);
|
21
|
+
};
|
22
|
+
}, [value, delay]);
|
23
|
+
return debouncedValue;
|
24
|
+
}
|
13
25
|
exports.prefixFileUrlWithBackendUrl = prefixFileUrlWithBackendUrl;
|
26
|
+
exports.useDebounce = useDebounce;
|
14
27
|
exports.usePrev = usePrev;
|
15
|
-
//# sourceMappingURL=
|
28
|
+
//# sourceMappingURL=useDebounce-CtcjDB3L.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useDebounce-CtcjDB3L.js","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":["useRef","useEffect","useState"],"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,MAAMA,MAAAA;AAEZC,QAAAA,UAAU,MAAM;AACd,QAAI,UAAU;AAAA,EAAA,GACb,CAAC,KAAK,CAAC;AAEV,SAAO,IAAI;AACb;ACRgB,SAAA,YAAoB,OAAe,OAAuB;AACxE,QAAM,CAAC,gBAAgB,iBAAiB,IAAIC,eAAS,KAAK;AAE1DD,QAAAA,UAAU,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;;;;"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { useRef, useEffect, useState } from "react";
|
2
|
+
const prefixFileUrlWithBackendUrl = (fileURL) => {
|
3
|
+
return !!fileURL && fileURL.startsWith("/") ? `${window.strapi.backendURL}${fileURL}` : fileURL;
|
4
|
+
};
|
5
|
+
const usePrev = (value) => {
|
6
|
+
const ref = useRef();
|
7
|
+
useEffect(() => {
|
8
|
+
ref.current = value;
|
9
|
+
}, [value]);
|
10
|
+
return ref.current;
|
11
|
+
};
|
12
|
+
function useDebounce(value, delay) {
|
13
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
14
|
+
useEffect(() => {
|
15
|
+
const handler = setTimeout(() => {
|
16
|
+
setDebouncedValue(value);
|
17
|
+
}, delay);
|
18
|
+
return () => {
|
19
|
+
clearTimeout(handler);
|
20
|
+
};
|
21
|
+
}, [value, delay]);
|
22
|
+
return debouncedValue;
|
23
|
+
}
|
24
|
+
export {
|
25
|
+
useDebounce as a,
|
26
|
+
prefixFileUrlWithBackendUrl as p,
|
27
|
+
usePrev as u
|
28
|
+
};
|
29
|
+
//# sourceMappingURL=useDebounce-DmuSJIF3.mjs.map
|
@@ -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-BgaeYWIy.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-3_WeHXYp.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 };
|
@@ -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 };
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const FEATURE_ID = "preview";
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { GetPreviewUrl } from '../../../../shared/contracts/preview';
|
2
|
+
declare const useGetPreviewUrlQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/query").QueryDefinition<GetPreviewUrl.Request, 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", GetPreviewUrl.Response, "adminApi">>;
|
3
|
+
export { useGetPreviewUrlQuery };
|
@@ -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, };
|