@payloadcms/ui
Advanced tools
Comparing version 3.11.1-canary.3f6217a to 3.11.1-canary.54f6c59
@@ -15,3 +15,3 @@ 'use client'; | ||
import { useUploadEdits } from '../../../providers/UploadEdits/index.js'; | ||
import { abortAndIgnore } from '../../../utilities/abortAndIgnore.js'; | ||
import { abortAndIgnore, handleAbortRef } from '../../../utilities/abortAndIgnore.js'; | ||
import { formatAdminURL } from '../../../utilities/formatAdminURL.js'; | ||
@@ -56,3 +56,3 @@ import { useDocumentDrawerContext } from '../../DocumentDrawer/Provider.js'; | ||
} = useConfig(); | ||
const formStateAbortControllerRef = React.useRef(null); | ||
const abortOnChangeRef = React.useRef(null); | ||
const collectionConfig = getEntityConfig({ | ||
@@ -98,5 +98,3 @@ collectionSlug: docSlug | ||
}) => { | ||
abortAndIgnore(formStateAbortControllerRef.current); | ||
const controller = new AbortController(); | ||
formStateAbortControllerRef.current = controller; | ||
const controller = handleAbortRef(abortOnChangeRef); | ||
const docPreferences = await getDocPreferences(); | ||
@@ -114,7 +112,9 @@ const { | ||
}); | ||
abortOnChangeRef.current = null; | ||
return newFormState; | ||
}, [collectionSlug, schemaPath, getDocPreferences, getFormState, docPermissions]); | ||
useEffect(() => { | ||
const abortOnChange = abortOnChangeRef.current; | ||
return () => { | ||
abortAndIgnore(formStateAbortControllerRef.current); | ||
abortAndIgnore(abortOnChange); | ||
}; | ||
@@ -121,0 +121,0 @@ }, []); |
@@ -11,3 +11,3 @@ 'use client'; | ||
import { useTranslation } from '../../providers/Translation/index.js'; | ||
import { abortAndIgnore } from '../../utilities/abortAndIgnore.js'; | ||
import { abortAndIgnore, handleAbortRef } from '../../utilities/abortAndIgnore.js'; | ||
import { DocumentDrawerContextProvider } from './Provider.js'; | ||
@@ -36,3 +36,3 @@ export const DocumentDrawerContent = ({ | ||
const [collectionConfig] = useState(() => collections.find(collection => collection.slug === collectionSlug)); | ||
const documentViewAbortControllerRef = React.useRef(null); | ||
const abortGetDocumentViewRef = React.useRef(null); | ||
const { | ||
@@ -51,5 +51,3 @@ closeModal | ||
const getDocumentView = useCallback(docID => { | ||
abortAndIgnore(documentViewAbortControllerRef.current); | ||
const controller = new AbortController(); | ||
documentViewAbortControllerRef.current = controller; | ||
const controller = handleAbortRef(abortGetDocumentViewRef); | ||
const fetchDocumentView = async () => { | ||
@@ -78,2 +76,3 @@ setIsLoading(true); | ||
} | ||
abortGetDocumentViewRef.current = null; | ||
}; | ||
@@ -120,4 +119,5 @@ void fetchDocumentView(); | ||
useEffect(() => { | ||
const abortGetDocumentView = abortGetDocumentViewRef.current; | ||
return () => { | ||
abortAndIgnore(documentViewAbortControllerRef.current); | ||
abortAndIgnore(abortGetDocumentView); | ||
}; | ||
@@ -124,0 +124,0 @@ }, []); |
@@ -24,3 +24,3 @@ 'use client'; | ||
import { useTranslation } from '../../providers/Translation/index.js'; | ||
import { abortAndIgnore } from '../../utilities/abortAndIgnore.js'; | ||
import { abortAndIgnore, handleAbortRef } from '../../utilities/abortAndIgnore.js'; | ||
import { mergeListSearchAndWhere } from '../../utilities/mergeListSearchAndWhere.js'; | ||
@@ -236,3 +236,3 @@ import { parseSearchParams } from '../../utilities/parseSearchParams.js'; | ||
const hasInitializedState = React.useRef(false); | ||
const formStateAbortControllerRef = React.useRef(null); | ||
const abortFormStateRef = React.useRef(null); | ||
const { | ||
@@ -271,5 +271,3 @@ clearRouteCache | ||
}) => { | ||
abortAndIgnore(formStateAbortControllerRef.current); | ||
const controller_0 = new AbortController(); | ||
formStateAbortControllerRef.current = controller_0; | ||
const controller_0 = handleAbortRef(abortFormStateRef); | ||
const { | ||
@@ -286,7 +284,9 @@ state | ||
}); | ||
abortFormStateRef.current = null; | ||
return state; | ||
}, [getFormState, slug, collectionPermissions]); | ||
useEffect(() => { | ||
const abortFormState = abortFormStateRef.current; | ||
return () => { | ||
abortAndIgnore(formStateAbortControllerRef.current); | ||
abortAndIgnore(abortFormState); | ||
}; | ||
@@ -293,0 +293,0 @@ }, []); |
@@ -8,3 +8,3 @@ 'use client'; | ||
import { useServerFunctions } from '../../providers/ServerFunctions/index.js'; | ||
import { abortAndIgnore } from '../../utilities/abortAndIgnore.js'; | ||
import { abortAndIgnore, handleAbortRef } from '../../utilities/abortAndIgnore.js'; | ||
export const TableColumnContext = /*#__PURE__*/createContext({}); | ||
@@ -58,5 +58,6 @@ export const useTableColumns = () => { | ||
const [tableColumns, setTableColumns] = React.useState(columnState); | ||
const tableStateControllerRef = React.useRef(null); | ||
const abortTableStateRef = React.useRef(null); | ||
const abortToggleColumnRef = React.useRef(null); | ||
const moveColumn = useCallback(async args => { | ||
abortAndIgnore(tableStateControllerRef.current); | ||
const controller = handleAbortRef(abortTableStateRef); | ||
const { | ||
@@ -70,4 +71,2 @@ fromIndex, | ||
setTableColumns(withMovedColumn); | ||
const controller = new AbortController(); | ||
tableStateControllerRef.current = controller; | ||
const result = await getTableState({ | ||
@@ -86,5 +85,6 @@ collectionSlug, | ||
} | ||
abortTableStateRef.current = null; | ||
}, [tableColumns, collectionSlug, docs, getTableState, setTable, enableRowSelections, renderRowTypes, tableAppearance]); | ||
const toggleColumn = useCallback(async column => { | ||
abortAndIgnore(tableStateControllerRef.current); | ||
const controller_0 = handleAbortRef(abortToggleColumnRef); | ||
const { | ||
@@ -117,4 +117,2 @@ newColumnState, | ||
setTableColumns(newColumnState); | ||
const controller_0 = new AbortController(); | ||
tableStateControllerRef.current = controller_0; | ||
const result_0 = await getTableState({ | ||
@@ -133,2 +131,3 @@ collectionSlug, | ||
} | ||
abortToggleColumnRef.current = null; | ||
}, [tableColumns, getTableState, setTable, collectionSlug, docs, enableRowSelections, renderRowTypes, tableAppearance]); | ||
@@ -195,4 +194,5 @@ const setActiveColumns = React.useCallback(async activeColumnAccessors => { | ||
useEffect(() => { | ||
const abortTableState = abortTableStateRef.current; | ||
return () => { | ||
abortAndIgnore(tableStateControllerRef.current); | ||
abortAndIgnore(abortTableState); | ||
}; | ||
@@ -199,0 +199,0 @@ }, []); |
@@ -215,2 +215,3 @@ export { fieldComponents } from '../../fields/index.js'; | ||
export { SetDocumentTitle } from '../../views/Edit/SetDocumentTitle/index.js'; | ||
export { parseSearchParams } from '../../utilities/parseSearchParams.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -10,3 +10,3 @@ export { filterFields } from '../../elements/TableColumns/filterFields.js'; | ||
export { PayloadLogo } from '../../graphics/Logo/index.js'; | ||
export { abortAndIgnore } from '../../utilities/abortAndIgnore.js'; | ||
export { abortAndIgnore, handleAbortRef } from '../../utilities/abortAndIgnore.js'; | ||
export { requests } from '../../utilities/api.js'; | ||
@@ -13,0 +13,0 @@ export { findLocaleFromCode } from '../../utilities/findLocaleFromCode.js'; |
@@ -1,6 +0,6 @@ | ||
import{fieldIsHiddenOrDisabled as P,fieldIsID as R}from"payload/shared";var L=e=>{let t=o=>o.type!=="ui"&&P(o)&&!R(o)||o?.admin?.disableListColumn===!0;return e?.reduce((o,n)=>{if(t(n))return o;let i=n.type==="tabs"&&"tabs"in n?{...n,tabs:n.tabs.map(s=>({...s,fields:s.fields.filter(a=>!t(a))}))}:n;return o.push(i),o},[])};import{fieldAffectsData as x}from"payload/shared";var g=(e,t)=>e?.reduce((r,o)=>x(o)&&o.name===t?r:!x(o)&&"fields"in o?[...r,...g(o.fields,t)]:o.type==="tabs"&&"tabs"in o?[...r,...o.tabs.reduce((n,i)=>[...n,..."name"in i?[i.name]:g(i.fields,t)],[])]:[...r,o.name],[]),T=(e,t,r)=>{let o=[];if(Array.isArray(r)&&r.length>=1)o=r;else{t&&o.push(t);let n=g(e,t);o=o.concat(n),o=o.slice(0,4)}return o.map(n=>({accessor:n,active:!0}))};import*as m from"react";var v=({elements:e,translationString:t})=>{let r=/(<[^>]+>.*?<\/[^>]+>)/g,o=t.split(r);return m.createElement("span",null,o.map((n,i)=>{if(e&&n.startsWith("<")&&n.endsWith(">")){let s=n[1],a=e[s];if(a){let p=new RegExp(`<${s}>(.*?)</${s}>`,"g"),c=n.replace(p,(d,f)=>f);return m.createElement(a,{key:i},m.createElement(v,{translationString:c}))}}return n}))},I=({elements:e,i18nKey:t,t:r,variables:o})=>{let n=r(t,o||{});return e?m.createElement(v,{elements:e,translationString:n}):n};import{isReactServerComponentOrFunction as M,serverProps as w}from"payload/shared";import k from"react";function D({Component:e,sanitizeServerOnlyProps:t,toMergeIntoProps:r}){return t===void 0&&(t=!M(e)),n=>{let i=A(n,r);return t&&w.forEach(s=>{delete i[s]}),k.createElement(e,{...i})}}function A(e,t){return{...e,...t}}import{isReactServerComponentOrFunction as z}from"payload/shared";import O from"react";var Z=({Component:e,serverOnlyProps:t,...r})=>e?(n=>{let i={...n,...z(e)?t??{}:{}};return O.createElement(e,{...i})})(r):null;var N=e=>({...e?.admin?.style||{},...e?.admin?.width?{"--field-width":e.admin.width}:{flex:"1 1 auto"},...e?.admin?.style?.flex?{flex:e.admin.style.flex}:{}});import{deepCopyObjectComplex as $}from"payload/shared";var B=["validate","customComponents"],E=e=>{let t=$(e);return B.forEach(r=>{delete t[r]}),t},U=e=>Object.keys(e).reduce((t,r)=>(t[r]=E(e[r]),t),{});import h from"react";var q=({fill:e})=>{let t=e||"var(--theme-elevation-1000)";return h.createElement("svg",{className:"graphic-icon",height:"100%",viewBox:"0 0 25 25",width:"100%",xmlns:"http://www.w3.org/2000/svg"},h.createElement("path",{d:"M11.8673 21.2336L4.40922 16.9845C4.31871 16.9309 4.25837 16.8355 4.25837 16.7282V10.1609C4.25837 10.0477 4.38508 9.97616 4.48162 10.0298L13.1404 14.9642C13.2611 15.0358 13.412 14.9464 13.412 14.8093V11.6091C13.412 11.4839 13.3456 11.3647 13.2309 11.2992L2.81624 5.36353C2.72573 5.30989 2.60505 5.30989 2.51454 5.36353L1.15085 6.14422C1.06034 6.19786 1 6.29321 1 6.40048V18.5995C1 18.7068 1.06034 18.8021 1.15085 18.8558L11.8491 24.9583C11.9397 25.0119 12.0603 25.0119 12.1509 24.9583L21.1355 19.8331C21.2562 19.7616 21.2562 19.5948 21.1355 19.5232L18.3357 17.9261C18.2211 17.8605 18.0883 17.8605 17.9737 17.9261L12.175 21.2336C12.0845 21.2872 11.9638 21.2872 11.8733 21.2336H11.8673Z",fill:t}),h.createElement("path",{d:"M22.8491 6.13827L12.1508 0.0417218C12.0603 -0.0119135 11.9397 -0.0119135 11.8491 0.0417218L6.19528 3.2658C6.0746 3.33731 6.0746 3.50418 6.19528 3.57569L8.97092 5.16091C9.08557 5.22647 9.21832 5.22647 9.33296 5.16091L11.8672 3.71872C11.9578 3.66508 12.0784 3.66508 12.1689 3.71872L19.627 7.96782C19.7175 8.02146 19.7778 8.11681 19.7778 8.22408V14.8212C19.7778 14.9464 19.8442 15.0656 19.9589 15.1311L22.7345 16.7104C22.8552 16.7819 23.006 16.6925 23.006 16.5554V6.40048C23.006 6.29321 22.9457 6.19786 22.8552 6.14423L22.8491 6.13827Z",fill:t}))};import l from"react";var G=` | ||
import{fieldIsHiddenOrDisabled as P,fieldIsID as R}from"payload/shared";var L=e=>{let t=o=>o.type!=="ui"&&P(o)&&!R(o)||o?.admin?.disableListColumn===!0;return e?.reduce((o,n)=>{if(t(n))return o;let i=n.type==="tabs"&&"tabs"in n?{...n,tabs:n.tabs.map(s=>({...s,fields:s.fields.filter(a=>!t(a))}))}:n;return o.push(i),o},[])};import{fieldAffectsData as x}from"payload/shared";var h=(e,t)=>e?.reduce((r,o)=>x(o)&&o.name===t?r:!x(o)&&"fields"in o?[...r,...h(o.fields,t)]:o.type==="tabs"&&"tabs"in o?[...r,...o.tabs.reduce((n,i)=>[...n,..."name"in i?[i.name]:h(i.fields,t)],[])]:[...r,o.name],[]),T=(e,t,r)=>{let o=[];if(Array.isArray(r)&&r.length>=1)o=r;else{t&&o.push(t);let n=h(e,t);o=o.concat(n),o=o.slice(0,4)}return o.map(n=>({accessor:n,active:!0}))};import*as m from"react";var v=({elements:e,translationString:t})=>{let r=/(<[^>]+>.*?<\/[^>]+>)/g,o=t.split(r);return m.createElement("span",null,o.map((n,i)=>{if(e&&n.startsWith("<")&&n.endsWith(">")){let s=n[1],a=e[s];if(a){let p=new RegExp(`<${s}>(.*?)</${s}>`,"g"),c=n.replace(p,(d,f)=>f);return m.createElement(a,{key:i},m.createElement(v,{translationString:c}))}}return n}))},I=({elements:e,i18nKey:t,t:r,variables:o})=>{let n=r(t,o||{});return e?m.createElement(v,{elements:e,translationString:n}):n};import{isReactServerComponentOrFunction as A,serverProps as M}from"payload/shared";import w from"react";function k({Component:e,sanitizeServerOnlyProps:t,toMergeIntoProps:r}){return t===void 0&&(t=!A(e)),n=>{let i=D(n,r);return t&&M.forEach(s=>{delete i[s]}),w.createElement(e,{...i})}}function D(e,t){return{...e,...t}}import{isReactServerComponentOrFunction as O}from"payload/shared";import z from"react";var Z=({Component:e,serverOnlyProps:t,...r})=>e?(n=>{let i={...n,...O(e)?t??{}:{}};return z.createElement(e,{...i})})(r):null;var N=e=>({...e?.admin?.style||{},...e?.admin?.width?{"--field-width":e.admin.width}:{flex:"1 1 auto"},...e?.admin?.style?.flex?{flex:e.admin.style.flex}:{}});import{deepCopyObjectComplex as $}from"payload/shared";var B=["validate","customComponents"],E=e=>{let t=$(e);return B.forEach(r=>{delete t[r]}),t},U=e=>Object.keys(e).reduce((t,r)=>(t[r]=E(e[r]),t),{});import g from"react";var q=({fill:e})=>{let t=e||"var(--theme-elevation-1000)";return g.createElement("svg",{className:"graphic-icon",height:"100%",viewBox:"0 0 25 25",width:"100%",xmlns:"http://www.w3.org/2000/svg"},g.createElement("path",{d:"M11.8673 21.2336L4.40922 16.9845C4.31871 16.9309 4.25837 16.8355 4.25837 16.7282V10.1609C4.25837 10.0477 4.38508 9.97616 4.48162 10.0298L13.1404 14.9642C13.2611 15.0358 13.412 14.9464 13.412 14.8093V11.6091C13.412 11.4839 13.3456 11.3647 13.2309 11.2992L2.81624 5.36353C2.72573 5.30989 2.60505 5.30989 2.51454 5.36353L1.15085 6.14422C1.06034 6.19786 1 6.29321 1 6.40048V18.5995C1 18.7068 1.06034 18.8021 1.15085 18.8558L11.8491 24.9583C11.9397 25.0119 12.0603 25.0119 12.1509 24.9583L21.1355 19.8331C21.2562 19.7616 21.2562 19.5948 21.1355 19.5232L18.3357 17.9261C18.2211 17.8605 18.0883 17.8605 17.9737 17.9261L12.175 21.2336C12.0845 21.2872 11.9638 21.2872 11.8733 21.2336H11.8673Z",fill:t}),g.createElement("path",{d:"M22.8491 6.13827L12.1508 0.0417218C12.0603 -0.0119135 11.9397 -0.0119135 11.8491 0.0417218L6.19528 3.2658C6.0746 3.33731 6.0746 3.50418 6.19528 3.57569L8.97092 5.16091C9.08557 5.22647 9.21832 5.22647 9.33296 5.16091L11.8672 3.71872C11.9578 3.66508 12.0784 3.66508 12.1689 3.71872L19.627 7.96782C19.7175 8.02146 19.7778 8.11681 19.7778 8.22408V14.8212C19.7778 14.9464 19.8442 15.0656 19.9589 15.1311L22.7345 16.7104C22.8552 16.7819 23.006 16.6925 23.006 16.5554V6.40048C23.006 6.29321 22.9457 6.19786 22.8552 6.14423L22.8491 6.13827Z",fill:t}))};import l from"react";var G=` | ||
.graphic-logo path { | ||
fill: var(--theme-elevation-1000); | ||
} | ||
`,j=()=>l.createElement("svg",{className:"graphic-logo",fill:"none",height:"43.5",id:"b",viewBox:"0 0 193.38 43.5",width:"193.38",xmlns:"http://www.w3.org/2000/svg"},l.createElement("style",null,G),l.createElement("g",{id:"c"},l.createElement("path",{d:"M18.01,35.63l-12.36-7.13c-.15-.09-.25-.25-.25-.43v-11.02c0-.19.21-.31.37-.22l14.35,8.28c.2.12.45-.03.45-.26v-5.37c0-.21-.11-.41-.3-.52L3.01,9c-.15-.09-.35-.09-.5,0l-2.26,1.31c-.15.09-.25.25-.25.43v20.47c0,.18.1.34.25.43l17.73,10.24c.15.09.35.09.5,0l14.89-8.6c.2-.12.2-.4,0-.52l-4.64-2.68c-.19-.11-.41-.11-.6,0l-9.61,5.55c-.15.09-.35.09-.5,0Z"}),l.createElement("path",{d:"M36.21,10.3L18.48.07c-.15-.09-.35-.09-.5,0l-9.37,5.41c-.2.12-.2.4,0,.52l4.6,2.66c.19.11.41.11.6,0l4.2-2.42c.15-.09.35-.09.5,0l12.36,7.13c.15.09.25.25.25.43v11.07c0,.21.11.41.3.52l4.6,2.65c.2.12.45-.03.45-.26V10.74c0-.18-.1-.34-.25-.43Z"}),l.createElement("g",{id:"d"},l.createElement("path",{d:"M193.38,9.47c0,1.94-1.48,3.32-3.3,3.32s-3.31-1.39-3.31-3.32,1.49-3.31,3.31-3.31,3.3,1.39,3.3,3.31ZM192.92,9.47c0-1.68-1.26-2.88-2.84-2.88s-2.84,1.2-2.84,2.88,1.26,2.89,2.84,2.89,2.84-1.2,2.84-2.89ZM188.69,11.17v-3.51h1.61c.85,0,1.35.39,1.35,1.15,0,.53-.3.86-.67,1.02l.79,1.35h-.89l-.72-1.22h-.64v1.22h-.82ZM190.18,9.31c.46,0,.64-.16.64-.5s-.19-.49-.64-.49h-.67v.99h.67Z"}),l.createElement("path",{d:"M54.72,24.84v10.93h-5.4V6.1h12.26c7.02,0,11.1,3.2,11.1,9.39s-4.07,9.35-11.06,9.35h-6.9,0ZM61.12,20.52c4.07,0,6.11-1.66,6.11-5.03s-2.04-5.03-6.11-5.03h-6.4v10.06h6.4Z"}),l.createElement("path",{d:"M85.94,32.45c-1,2.41-3.66,3.78-7.02,3.78-4.11,0-7.11-2.29-7.11-6.11,0-4.24,3.32-5.98,7.61-6.48l6.32-.71v-1c0-2.58-1.58-3.82-3.99-3.82s-3.74,1.29-3.91,3.24h-5.11c.46-4.53,3.99-7.19,9.18-7.19,5.74,0,9.02,2.7,9.02,8.19v8.15c0,1.95.08,3.58.42,5.28h-5.11c-.21-1.16-.29-2.29-.29-3.32h0ZM85.73,27.58v-1.29l-4.7.54c-2.24.29-3.95.79-3.95,2.99,0,1.66,1.16,2.7,3.28,2.7,2.74,0,5.36-1.62,5.36-4.95h0Z"}),l.createElement("path",{d:"M90.39,14.66h5.4l5.86,15.92h.08l5.57-15.92h5.28l-8.23,21.49c-2,5.28-4.45,7.32-8.89,7.36-.71,0-1.7-.08-2.45-.21v-4.03c.62.13.96.13,1.41.13,2.16,0,3.07-.75,4.2-3.66l-8.23-21.07h0Z"}),l.createElement("path",{d:"M113.46,35.77V6.1h5.32v29.67h-5.32Z"}),l.createElement("path",{d:"M130.79,36.27c-6.23,0-10.68-4.2-10.68-11.05s4.45-11.05,10.68-11.05,10.68,4.24,10.68,11.05-4.45,11.05-10.68,11.05ZM130.79,32.32c3.41,0,5.36-2.66,5.36-7.11s-1.95-7.11-5.36-7.11-5.36,2.7-5.36,7.11,1.91,7.11,5.36,7.11Z"}),l.createElement("path",{d:"M156.19,32.45c-1,2.41-3.66,3.78-7.02,3.78-4.11,0-7.11-2.29-7.11-6.11,0-4.24,3.32-5.98,7.61-6.48l6.32-.71v-1c0-2.58-1.58-3.82-3.99-3.82s-3.74,1.29-3.91,3.24h-5.11c.46-4.53,3.99-7.19,9.19-7.19,5.74,0,9.02,2.7,9.02,8.19v8.15c0,1.95.08,3.58.42,5.28h-5.11c-.21-1.16-.29-2.29-.29-3.32h0ZM155.98,27.58v-1.29l-4.7.54c-2.24.29-3.95.79-3.95,2.99,0,1.66,1.16,2.7,3.28,2.7,2.74,0,5.36-1.62,5.36-4.95h0Z"}),l.createElement("path",{d:"M178.5,32.41c-1.04,2.12-3.58,3.87-6.78,3.87-5.53,0-9.31-4.49-9.31-11.05s3.78-11.05,9.31-11.05c3.28,0,5.69,1.83,6.69,3.95V6.1h5.32v29.67h-5.24v-3.37h0ZM178.55,24.84c0-4.11-1.95-6.78-5.32-6.78s-5.45,2.83-5.45,7.15,2,7.15,5.45,7.15,5.32-2.66,5.32-6.78v-.75h0Z"}))));function V(e){if(e)try{e.abort()}catch{}}import*as S from"qs-esm";var K={delete:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"delete"};return fetch(e,o)},get:(e,t={headers:{}})=>{let r="";return t.params&&(r=S.stringify(t.params,{addQueryPrefix:!0})),fetch(`${e}${r}`,{credentials:"include",...t})},patch:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"PATCH"};return fetch(e,o)},post:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"post"};return fetch(`${e}`,o)},put:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"put"};return fetch(e,o)}};var W=(e,t)=>!e?.locales||e.locales.length===0?null:e.locales.find(r=>r?.code===t);var u=e=>{let{adminRoute:t,basePath:r="",path:o,serverURL:n}=e;if(t)if(t==="/"){if(!o)return`${n||""}${r}${t}`}else return`${n||""}${r}${t}${o}`;return`${n||""}${r}${o}`};import{format as H,formatDistanceToNow as we}from"date-fns";var y=({date:e,i18n:t,pattern:r})=>{let o=new Date(e);return H(o,r,{locale:t.dateFNS})};import{getTranslation as Q}from"@payloadcms/translations";var _=({collectionConfig:e,data:t,dateFormat:r,fallback:o,globalConfig:n,i18n:i})=>{let s;if(e){let a=e?.admin?.useAsTitle;if(a&&(s=t?.[a]||s,s)){let p=e.fields.find(d=>"name"in d&&d.name===a);if(p?.type==="date"){let d="date"in p.admin&&p?.admin?.date?.displayFormat||r;s=y({date:s,i18n:i,pattern:d})||s}}}return n&&(s=Q(n?.label,i)||n?.slug),s||(s=o||`[${i.t("general:untitled")}]`),s};import{getTranslation as C}from"@payloadcms/translations";var F=(r=>(r.collection="collections",r.global="globals",r))(F||{});function J(e,t,r){return e.reduce((n,i)=>{if(i.entity?.admin?.group===!1)return n;if(t?.[i.type.toLowerCase()]?.[i.entity.slug]?.read){let s=C(i.entity.admin.group,r),a="labels"in i.entity?i.entity.labels.plural:i.entity.label,p=typeof a=="function"?a({t:r.t}):a;if(i.entity.admin.group){let c=n.find(f=>C(f.label,r)===s),d=c;c||(d={entities:[],label:s},n.push(d)),d.entities.push({slug:i.entity.slug,type:i.type,label:p})}else n.find(d=>C(d.label,r)===r.t(`general:${i.type}`)).entities.push({slug:i.entity.slug,type:i.type,label:p})}return n},[{entities:[],label:r.t("general:collections")},{entities:[],label:r.t("general:globals")}]).filter(n=>n.entities.length>0)}var X=({adminRoute:e,router:t})=>{let r=u({adminRoute:e,path:"/"});t.push(r)};var Y=({adminRoute:e,collectionSlug:t,router:r})=>{let o=u({adminRoute:e,path:t?`/collections/${t}`:"/"});r.push(o)};var ee=(e,t,r,o,n,i,s,a,p,c)=>{if(p)try{i(e,t??r,o),n||(a.current.hasShownLockedModal=!0),a.current={hasShownLockedModal:a.current?.hasShownLockedModal,isLocked:!0,user:o},s(o),n&&c&&c(!1)}catch(d){console.error("Error during document takeover:",d)}};var te=e=>{let{collectionSlug:t,docPermissions:r,globalSlug:o,isEditing:n}=e;return t?!!(n&&r?.update||!n&&r?.create):o?!!r?.update:!1};var re=e=>e&&typeof e=="object";var oe=({id:e,collectionSlug:t,globalSlug:r})=>!!(r||t&&e);var b=e=>Object.keys(e).length===0,ne=(e,t)=>b(t)?e:b(e)?t:("and"in e?e.and.push(t):"or"in e?e={and:[e,t]}:e={and:[e,t]},e),ie=({collectionConfig:e,search:t,where:r={}})=>{if(t){let o={...r||{}},n=(e.admin.listSearchableFields||[e.admin?.useAsTitle||"id"]).map(i=>({[i]:{like:t}}));n.length>0&&(o=ne(o,{or:n})),b(o)||(r=o)}return r};function se(e){return e===void 0||typeof e=="number"?e:decodeURIComponent(e)}export{F as EntityType,q as PayloadIcon,j as PayloadLogo,I as Translation,Z as WithServerSideProps,V as abortAndIgnore,L as filterFields,W as findLocaleFromCode,u as formatAdminURL,y as formatDate,_ as formatDocTitle,T as getInitialColumns,J as groupNavItems,X as handleBackToDashboard,Y as handleGoBack,ee as handleTakeOver,te as hasSavePermission,re as isClientUserObject,oe as isEditing,N as mergeFieldStyles,ie as mergeListSearchAndWhere,U as reduceToSerializableFields,K as requests,se as sanitizeID,D as withMergedProps}; | ||
`,j=()=>l.createElement("svg",{className:"graphic-logo",fill:"none",height:"43.5",id:"b",viewBox:"0 0 193.38 43.5",width:"193.38",xmlns:"http://www.w3.org/2000/svg"},l.createElement("style",null,G),l.createElement("g",{id:"c"},l.createElement("path",{d:"M18.01,35.63l-12.36-7.13c-.15-.09-.25-.25-.25-.43v-11.02c0-.19.21-.31.37-.22l14.35,8.28c.2.12.45-.03.45-.26v-5.37c0-.21-.11-.41-.3-.52L3.01,9c-.15-.09-.35-.09-.5,0l-2.26,1.31c-.15.09-.25.25-.25.43v20.47c0,.18.1.34.25.43l17.73,10.24c.15.09.35.09.5,0l14.89-8.6c.2-.12.2-.4,0-.52l-4.64-2.68c-.19-.11-.41-.11-.6,0l-9.61,5.55c-.15.09-.35.09-.5,0Z"}),l.createElement("path",{d:"M36.21,10.3L18.48.07c-.15-.09-.35-.09-.5,0l-9.37,5.41c-.2.12-.2.4,0,.52l4.6,2.66c.19.11.41.11.6,0l4.2-2.42c.15-.09.35-.09.5,0l12.36,7.13c.15.09.25.25.25.43v11.07c0,.21.11.41.3.52l4.6,2.65c.2.12.45-.03.45-.26V10.74c0-.18-.1-.34-.25-.43Z"}),l.createElement("g",{id:"d"},l.createElement("path",{d:"M193.38,9.47c0,1.94-1.48,3.32-3.3,3.32s-3.31-1.39-3.31-3.32,1.49-3.31,3.31-3.31,3.3,1.39,3.3,3.31ZM192.92,9.47c0-1.68-1.26-2.88-2.84-2.88s-2.84,1.2-2.84,2.88,1.26,2.89,2.84,2.89,2.84-1.2,2.84-2.89ZM188.69,11.17v-3.51h1.61c.85,0,1.35.39,1.35,1.15,0,.53-.3.86-.67,1.02l.79,1.35h-.89l-.72-1.22h-.64v1.22h-.82ZM190.18,9.31c.46,0,.64-.16.64-.5s-.19-.49-.64-.49h-.67v.99h.67Z"}),l.createElement("path",{d:"M54.72,24.84v10.93h-5.4V6.1h12.26c7.02,0,11.1,3.2,11.1,9.39s-4.07,9.35-11.06,9.35h-6.9,0ZM61.12,20.52c4.07,0,6.11-1.66,6.11-5.03s-2.04-5.03-6.11-5.03h-6.4v10.06h6.4Z"}),l.createElement("path",{d:"M85.94,32.45c-1,2.41-3.66,3.78-7.02,3.78-4.11,0-7.11-2.29-7.11-6.11,0-4.24,3.32-5.98,7.61-6.48l6.32-.71v-1c0-2.58-1.58-3.82-3.99-3.82s-3.74,1.29-3.91,3.24h-5.11c.46-4.53,3.99-7.19,9.18-7.19,5.74,0,9.02,2.7,9.02,8.19v8.15c0,1.95.08,3.58.42,5.28h-5.11c-.21-1.16-.29-2.29-.29-3.32h0ZM85.73,27.58v-1.29l-4.7.54c-2.24.29-3.95.79-3.95,2.99,0,1.66,1.16,2.7,3.28,2.7,2.74,0,5.36-1.62,5.36-4.95h0Z"}),l.createElement("path",{d:"M90.39,14.66h5.4l5.86,15.92h.08l5.57-15.92h5.28l-8.23,21.49c-2,5.28-4.45,7.32-8.89,7.36-.71,0-1.7-.08-2.45-.21v-4.03c.62.13.96.13,1.41.13,2.16,0,3.07-.75,4.2-3.66l-8.23-21.07h0Z"}),l.createElement("path",{d:"M113.46,35.77V6.1h5.32v29.67h-5.32Z"}),l.createElement("path",{d:"M130.79,36.27c-6.23,0-10.68-4.2-10.68-11.05s4.45-11.05,10.68-11.05,10.68,4.24,10.68,11.05-4.45,11.05-10.68,11.05ZM130.79,32.32c3.41,0,5.36-2.66,5.36-7.11s-1.95-7.11-5.36-7.11-5.36,2.7-5.36,7.11,1.91,7.11,5.36,7.11Z"}),l.createElement("path",{d:"M156.19,32.45c-1,2.41-3.66,3.78-7.02,3.78-4.11,0-7.11-2.29-7.11-6.11,0-4.24,3.32-5.98,7.61-6.48l6.32-.71v-1c0-2.58-1.58-3.82-3.99-3.82s-3.74,1.29-3.91,3.24h-5.11c.46-4.53,3.99-7.19,9.19-7.19,5.74,0,9.02,2.7,9.02,8.19v8.15c0,1.95.08,3.58.42,5.28h-5.11c-.21-1.16-.29-2.29-.29-3.32h0ZM155.98,27.58v-1.29l-4.7.54c-2.24.29-3.95.79-3.95,2.99,0,1.66,1.16,2.7,3.28,2.7,2.74,0,5.36-1.62,5.36-4.95h0Z"}),l.createElement("path",{d:"M178.5,32.41c-1.04,2.12-3.58,3.87-6.78,3.87-5.53,0-9.31-4.49-9.31-11.05s3.78-11.05,9.31-11.05c3.28,0,5.69,1.83,6.69,3.95V6.1h5.32v29.67h-5.24v-3.37h0ZM178.55,24.84c0-4.11-1.95-6.78-5.32-6.78s-5.45,2.83-5.45,7.15,2,7.15,5.45,7.15,5.32-2.66,5.32-6.78v-.75h0Z"}))));function V(e){if(e)try{e.abort()}catch{}}function K(e){if(e.current)try{e.current.abort(),e.current=null}catch{}else{let t=new AbortController;return e.current=t,t}}import*as S from"qs-esm";var W={delete:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"delete"};return fetch(e,o)},get:(e,t={headers:{}})=>{let r="";return t.params&&(r=S.stringify(t.params,{addQueryPrefix:!0})),fetch(`${e}${r}`,{credentials:"include",...t})},patch:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"PATCH"};return fetch(e,o)},post:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"post"};return fetch(`${e}`,o)},put:(e,t={headers:{}})=>{let r=t&&t.headers?{...t.headers}:{},o={...t,credentials:"include",headers:{...r},method:"put"};return fetch(e,o)}};var H=(e,t)=>!e?.locales||e.locales.length===0?null:e.locales.find(r=>r?.code===t);var u=e=>{let{adminRoute:t,basePath:r="",path:o,serverURL:n}=e;if(t)if(t==="/"){if(!o)return`${n||""}${r}${t}`}else return`${n||""}${r}${t}${o}`;return`${n||""}${r}${o}`};import{format as Q,formatDistanceToNow as we}from"date-fns";var y=({date:e,i18n:t,pattern:r})=>{let o=new Date(e);return Q(o,r,{locale:t.dateFNS})};import{getTranslation as _}from"@payloadcms/translations";var J=({collectionConfig:e,data:t,dateFormat:r,fallback:o,globalConfig:n,i18n:i})=>{let s;if(e){let a=e?.admin?.useAsTitle;if(a&&(s=t?.[a]||s,s)){let p=e.fields.find(d=>"name"in d&&d.name===a);if(p?.type==="date"){let d="date"in p.admin&&p?.admin?.date?.displayFormat||r;s=y({date:s,i18n:i,pattern:d})||s}}}return n&&(s=_(n?.label,i)||n?.slug),s||(s=o||`[${i.t("general:untitled")}]`),s};import{getTranslation as C}from"@payloadcms/translations";var F=(r=>(r.collection="collections",r.global="globals",r))(F||{});function X(e,t,r){return e.reduce((n,i)=>{if(i.entity?.admin?.group===!1)return n;if(t?.[i.type.toLowerCase()]?.[i.entity.slug]?.read){let s=C(i.entity.admin.group,r),a="labels"in i.entity?i.entity.labels.plural:i.entity.label,p=typeof a=="function"?a({t:r.t}):a;if(i.entity.admin.group){let c=n.find(f=>C(f.label,r)===s),d=c;c||(d={entities:[],label:s},n.push(d)),d.entities.push({slug:i.entity.slug,type:i.type,label:p})}else n.find(d=>C(d.label,r)===r.t(`general:${i.type}`)).entities.push({slug:i.entity.slug,type:i.type,label:p})}return n},[{entities:[],label:r.t("general:collections")},{entities:[],label:r.t("general:globals")}]).filter(n=>n.entities.length>0)}var Y=({adminRoute:e,router:t})=>{let r=u({adminRoute:e,path:"/"});t.push(r)};var ee=({adminRoute:e,collectionSlug:t,router:r})=>{let o=u({adminRoute:e,path:t?`/collections/${t}`:"/"});r.push(o)};var te=(e,t,r,o,n,i,s,a,p,c)=>{if(p)try{i(e,t??r,o),n||(a.current.hasShownLockedModal=!0),a.current={hasShownLockedModal:a.current?.hasShownLockedModal,isLocked:!0,user:o},s(o),n&&c&&c(!1)}catch(d){console.error("Error during document takeover:",d)}};var re=e=>{let{collectionSlug:t,docPermissions:r,globalSlug:o,isEditing:n}=e;return t?!!(n&&r?.update||!n&&r?.create):o?!!r?.update:!1};var oe=e=>e&&typeof e=="object";var ne=({id:e,collectionSlug:t,globalSlug:r})=>!!(r||t&&e);var b=e=>Object.keys(e).length===0,ie=(e,t)=>b(t)?e:b(e)?t:("and"in e?e.and.push(t):"or"in e?e={and:[e,t]}:e={and:[e,t]},e),se=({collectionConfig:e,search:t,where:r={}})=>{if(t){let o={...r||{}},n=(e.admin.listSearchableFields||[e.admin?.useAsTitle||"id"]).map(i=>({[i]:{like:t}}));n.length>0&&(o=ie(o,{or:n})),b(o)||(r=o)}return r};function ae(e){return e===void 0||typeof e=="number"?e:decodeURIComponent(e)}export{F as EntityType,q as PayloadIcon,j as PayloadLogo,I as Translation,Z as WithServerSideProps,V as abortAndIgnore,L as filterFields,H as findLocaleFromCode,u as formatAdminURL,y as formatDate,J as formatDocTitle,T as getInitialColumns,X as groupNavItems,K as handleAbortRef,Y as handleBackToDashboard,ee as handleGoBack,te as handleTakeOver,re as hasSavePermission,oe as isClientUserObject,ne as isEditing,N as mergeFieldStyles,se as mergeListSearchAndWhere,U as reduceToSerializableFields,W as requests,ae as sanitizeID,k as withMergedProps}; | ||
//# sourceMappingURL=index.js.map |
@@ -122,3 +122,6 @@ 'use client'; | ||
className: `${baseClass}__row-header`, | ||
children: [isLoading ? null : _jsx(RowLabel, { | ||
children: [isLoading ? _jsx(ShimmerEffect, { | ||
height: "1rem", | ||
width: "8rem" | ||
}) : _jsx(RowLabel, { | ||
CustomComponent: CustomRowLabel, | ||
@@ -125,0 +128,0 @@ label: fallbackLabel, |
@@ -80,3 +80,6 @@ 'use client'; | ||
if ($[35] !== Label || $[36] !== block || $[37] !== errorCount || $[38] !== fieldHasErrors || $[39] !== i18n || $[40] !== isLoading || $[41] !== path || $[42] !== readOnly || $[43] !== row.blockType || $[44] !== rowIndex) { | ||
t5 = isLoading ? null : Label || _jsxs("div", { | ||
t5 = isLoading ? _jsx(ShimmerEffect, { | ||
height: "1rem", | ||
width: "8rem" | ||
}) : Label || _jsxs("div", { | ||
className: `${baseClass}__block-header`, | ||
@@ -83,0 +86,0 @@ children: [_jsx("span", { |
@@ -19,3 +19,3 @@ 'use client'; | ||
import { useTranslation } from '../../providers/Translation/index.js'; | ||
import { abortAndIgnore } from '../../utilities/abortAndIgnore.js'; | ||
import { abortAndIgnore, handleAbortRef } from '../../utilities/abortAndIgnore.js'; | ||
import { requests } from '../../utilities/api.js'; | ||
@@ -84,3 +84,3 @@ import { FormContext, FormFieldsContext, FormWatchContext, InitializingContext, ModifiedContext, ProcessingContext, SubmittedContext } from './context.js'; | ||
const contextRef = useRef({}); | ||
const resetFormStateAbortControllerRef = useRef(null); | ||
const abortResetFormRef = useRef(null); | ||
const fieldsReducer = useReducer(fieldReducer, {}, () => initialState); | ||
@@ -377,5 +377,3 @@ /** | ||
const reset = useCallback(async data_6 => { | ||
abortAndIgnore(resetFormStateAbortControllerRef.current); | ||
const controller = new AbortController(); | ||
resetFormStateAbortControllerRef.current = controller; | ||
const controller = handleAbortRef(abortResetFormRef); | ||
const docPreferences = await getDocPreferences(); | ||
@@ -405,2 +403,3 @@ const { | ||
}); | ||
abortResetFormRef.current = null; | ||
}, [collectionSlug, dispatchFields, globalSlug, id, operation, getFormState, docPermissions, getDocPreferences, locale]); | ||
@@ -464,4 +463,5 @@ const replaceState = useCallback(state => { | ||
useEffect(() => { | ||
const abortOnChange = abortResetFormRef.current; | ||
return () => { | ||
abortAndIgnore(resetFormStateAbortControllerRef.current); | ||
abortAndIgnore(abortOnChange); | ||
}; | ||
@@ -468,0 +468,0 @@ }, []); |
@@ -139,3 +139,3 @@ 'use client'; | ||
try { | ||
await requests.post(`${serverURL}${apiRoute}/${userSlug}/logout`); | ||
await requests.post(`${serverURL}${apiRoute}/${user.collection}/logout`); | ||
setNewUser(null); | ||
@@ -148,3 +148,3 @@ revokeTokenAndExpire(); | ||
} | ||
}, [apiRoute, revokeTokenAndExpire, serverURL, setNewUser, userSlug]); | ||
}, [apiRoute, revokeTokenAndExpire, serverURL, setNewUser, user]); | ||
const refreshPermissions = useCallback(async ({ | ||
@@ -235,3 +235,3 @@ locale | ||
}; | ||
}, [tokenExpiration, openModal, i18n, setNewUser, user]); | ||
}, [tokenExpiration, openModal, i18n, setNewUser, user, redirectToInactivityRoute]); | ||
return /*#__PURE__*/_jsx(Context.Provider, { | ||
@@ -238,0 +238,0 @@ value: { |
@@ -0,7 +1,3 @@ | ||
import type { DocumentEvent } from 'payload'; | ||
import React from 'react'; | ||
export type UpdatedDocument = { | ||
entitySlug: string; | ||
id?: number | string; | ||
updatedAt: string; | ||
}; | ||
export declare const DocumentEventsProvider: React.FC<{ | ||
@@ -12,4 +8,4 @@ children: React.ReactNode; | ||
mostRecentUpdate: any; | ||
reportUpdate: (doc: UpdatedDocument) => any; | ||
reportUpdate: (doc: DocumentEvent) => any; | ||
}; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,3 @@ | ||
export declare function abortAndIgnore(controller: AbortController): void; | ||
export declare function abortAndIgnore(abortController: AbortController): void; | ||
export declare function handleAbortRef(abortControllerRef: React.RefObject<AbortController>): AbortController; | ||
//# sourceMappingURL=abortAndIgnore.d.ts.map |
@@ -1,5 +0,5 @@ | ||
export function abortAndIgnore(controller) { | ||
if (controller) { | ||
export function abortAndIgnore(abortController) { | ||
if (abortController) { | ||
try { | ||
controller.abort(); | ||
abortController.abort(); | ||
} catch (_err) { | ||
@@ -10,2 +10,16 @@ // swallow error | ||
} | ||
export function handleAbortRef(abortControllerRef) { | ||
if (abortControllerRef.current) { | ||
try { | ||
abortControllerRef.current.abort(); | ||
abortControllerRef.current = null; | ||
} catch (_err) { | ||
// swallow error | ||
} | ||
} else { | ||
const controller = new AbortController(); | ||
abortControllerRef.current = controller; | ||
return controller; | ||
} | ||
} | ||
//# sourceMappingURL=abortAndIgnore.js.map |
import type { ReadonlyURLSearchParams } from 'next/navigation.js'; | ||
import * as qs from 'qs-esm'; | ||
export declare function parseSearchParams(params: ReadonlyURLSearchParams): qs.ParsedQs; | ||
/** | ||
* A utility function to parse URLSearchParams into a ParsedQs object. | ||
* This function is a wrapper around the `qs` library. | ||
* In Next.js, the `useSearchParams()` hook from `next/navigation` returns a `URLSearchParams` object. | ||
* This function can be used to parse that object into a more usable format. | ||
* @param {ReadonlyURLSearchParams} searchParams - The URLSearchParams object to parse. | ||
* @returns {qs.ParsedQs} - The parsed query string object. | ||
*/ | ||
export declare function parseSearchParams(searchParams: ReadonlyURLSearchParams): qs.ParsedQs; | ||
//# sourceMappingURL=parseSearchParams.d.ts.map |
import * as qs from 'qs-esm'; | ||
export function parseSearchParams(params) { | ||
const search = params.toString(); | ||
/** | ||
* A utility function to parse URLSearchParams into a ParsedQs object. | ||
* This function is a wrapper around the `qs` library. | ||
* In Next.js, the `useSearchParams()` hook from `next/navigation` returns a `URLSearchParams` object. | ||
* This function can be used to parse that object into a more usable format. | ||
* @param {ReadonlyURLSearchParams} searchParams - The URLSearchParams object to parse. | ||
* @returns {qs.ParsedQs} - The parsed query string object. | ||
*/ | ||
export function parseSearchParams(searchParams) { | ||
const search = searchParams.toString(); | ||
return qs.parse(search, { | ||
@@ -5,0 +13,0 @@ depth: 10, |
@@ -23,3 +23,3 @@ 'use client'; | ||
import { useUploadEdits } from '../../providers/UploadEdits/index.js'; | ||
import { abortAndIgnore } from '../../utilities/abortAndIgnore.js'; | ||
import { abortAndIgnore, handleAbortRef } from '../../utilities/abortAndIgnore.js'; | ||
import { formatAdminURL } from '../../utilities/formatAdminURL.js'; | ||
@@ -120,4 +120,4 @@ import { handleBackToDashboard } from '../../utilities/handleBackToDashboard.js'; | ||
} = useServerFunctions(); | ||
const onChangeAbortControllerRef = useRef(null); | ||
const onSaveAbortControllerRef = useRef(null); | ||
const abortOnChangeRef = useRef(null); | ||
const abortOnSaveRef = useRef(null); | ||
const locale = params.get('locale'); | ||
@@ -135,13 +135,4 @@ const entitySlug = collectionConfig?.slug || globalConfig?.slug; | ||
const lockDurationInMilliseconds = lockDuration * 1000; | ||
let preventLeaveWithoutSaving = true; | ||
let autosaveEnabled = false; | ||
if (collectionConfig) { | ||
autosaveEnabled = Boolean(collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.autosave); | ||
preventLeaveWithoutSaving = !autosaveEnabled; | ||
} else if (globalConfig) { | ||
autosaveEnabled = Boolean(globalConfig?.versions?.drafts && globalConfig?.versions?.drafts?.autosave); | ||
preventLeaveWithoutSaving = !autosaveEnabled; | ||
} else if (typeof disableLeaveWithoutSaving !== 'undefined') { | ||
preventLeaveWithoutSaving = !disableLeaveWithoutSaving; | ||
} | ||
const autosaveEnabled = Boolean(collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.autosave || globalConfig?.versions?.drafts && globalConfig?.versions?.drafts?.autosave); | ||
const preventLeaveWithoutSaving = typeof disableLeaveWithoutSaving !== 'undefined' ? !disableLeaveWithoutSaving : !autosaveEnabled; | ||
const [isReadOnlyForIncomingUser, setIsReadOnlyForIncomingUser] = useState(false); | ||
@@ -196,2 +187,3 @@ const [showTakeOverModal, setShowTakeOverModal] = useState(false); | ||
const onSave = useCallback(async json => { | ||
const controller = handleAbortRef(abortOnSaveRef); | ||
reportUpdate({ | ||
@@ -229,5 +221,2 @@ id, | ||
if ((id || globalSlug) && !autosaveEnabled) { | ||
abortAndIgnore(onSaveAbortControllerRef.current); | ||
const controller = new AbortController(); | ||
onSaveAbortControllerRef.current = controller; | ||
const docPreferences = await getDocPreferences(); | ||
@@ -253,2 +242,3 @@ const { | ||
} | ||
abortOnSaveRef.current = null; | ||
return state; | ||
@@ -260,5 +250,3 @@ } | ||
}) => { | ||
abortAndIgnore(onChangeAbortControllerRef.current); | ||
const controller_0 = new AbortController(); | ||
onChangeAbortControllerRef.current = controller_0; | ||
const controller_0 = handleAbortRef(abortOnChangeRef); | ||
const currentTime = Date.now(); | ||
@@ -294,2 +282,3 @@ const timeSinceLastUpdate = currentTime - editSessionStartTime; | ||
} | ||
abortOnChangeRef.current = null; | ||
return state_0; | ||
@@ -316,5 +305,7 @@ }, [id, collectionSlug, getDocPreferences, getFormState, globalSlug, handleDocumentLocking, isLockingEnabled, operation, schemaPathSegments, docPermissions, editSessionStartTime]); | ||
useEffect(() => { | ||
const abortOnChange = abortOnChangeRef.current; | ||
const abortOnSave = abortOnSaveRef.current; | ||
return () => { | ||
abortAndIgnore(onChangeAbortControllerRef.current); | ||
abortAndIgnore(onSaveAbortControllerRef.current); | ||
abortAndIgnore(abortOnChange); | ||
abortAndIgnore(abortOnSave); | ||
}; | ||
@@ -321,0 +312,0 @@ }, []); |
{ | ||
"name": "@payloadcms/ui", | ||
"version": "3.11.1-canary.3f6217a", | ||
"version": "3.11.1-canary.54f6c59", | ||
"homepage": "https://payloadcms.com", | ||
@@ -135,3 +135,3 @@ "repository": { | ||
"uuid": "10.0.0", | ||
"@payloadcms/translations": "3.11.1-canary.3f6217a" | ||
"@payloadcms/translations": "3.11.1-canary.54f6c59" | ||
}, | ||
@@ -154,3 +154,3 @@ "devDependencies": { | ||
"@payloadcms/eslint-config": "3.9.0", | ||
"payload": "3.11.1-canary.3f6217a" | ||
"payload": "3.11.1-canary.54f6c59" | ||
}, | ||
@@ -161,3 +161,3 @@ "peerDependencies": { | ||
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020", | ||
"payload": "3.11.1-canary.3f6217a" | ||
"payload": "3.11.1-canary.54f6c59" | ||
}, | ||
@@ -164,0 +164,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9369817
45585
+ Added@payloadcms/translations@3.11.1-canary.54f6c59(transitive)
+ Addedpayload@3.11.1-canary.54f6c59(transitive)
- Removed@payloadcms/translations@3.11.1-canary.3f6217a(transitive)
- Removedpayload@3.11.1-canary.3f6217a(transitive)