Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
1 line
2.5 KiB
Plaintext
1 line
2.5 KiB
Plaintext
{"version":3,"file":"types.js","names":[],"sources":["../../../src/forms/useField/types.ts"],"sourcesContent":["import type { FieldState, Validate } from 'payload'\n\nexport type Options = {\n disableFormData?: boolean\n hasRows?: boolean\n /**\n * If `path` is provided to this hook, it will be used outright. This is useful when calling this hook directly within a custom component.\n * Otherwise, the field will attempt to get the path from the `FieldPathContext` via the `useFieldPath` hook.\n * If still not found, the `potentiallyStalePath` arg will be used. See the note below about why this is important.\n */\n path?: string\n /**\n * Custom server components receive a static `path` prop at render-time, leading to temporarily stale paths when re-ordering rows in form state.\n * This is because when manipulating rows, field paths change in form state, but the prop remains the same until the component is re-rendered on the server.\n * This causes the component to temporarily point to the wrong field in form state until the server responds with a freshly rendered component.\n * To prevent this, fields are wrapped with a `FieldPathContext` which is guaranteed to be up-to-date.\n * The `path` prop that Payload's default fields receive, then, are sent into this hook as the `potentiallyStalePath` arg.\n * This ensures that:\n * 1. Custom components that use this hook directly will still respect the `path` prop as top priority.\n * 2. Custom server components that blindly spread their props into default Payload fields still prefer the dynamic path from context.\n * 3. Components that render default Payload fields directly do not require a `FieldPathProvider`, e.g. the email field in the account view.\n */\n potentiallyStalePath?: string\n /**\n * Client-side validation function fired when the form is submitted.\n */\n validate?: Validate\n}\n\nexport type FieldType<T> = {\n disabled: boolean\n formInitializing: boolean\n formProcessing: boolean\n formSubmitted: boolean\n initialValue?: T\n path: string\n /**\n * @deprecated - readOnly is no longer returned from useField. Remove this in 4.0.\n */\n readOnly?: boolean\n setValue: (val: unknown, disableModifyingForm?: boolean) => void\n showError: boolean\n value: T\n} & Pick<\n FieldState,\n | 'blocksFilterOptions'\n | 'customComponents'\n | 'errorMessage'\n | 'errorPaths'\n | 'filterOptions'\n | 'rows'\n | 'selectFilterOptions'\n | 'valid'\n>\n"],"mappings":"AA6BA","ignoreList":[]} |