@payloadcms/ui
Advanced tools
Comparing version 3.0.0-beta.133 to 3.0.0-beta.134
@@ -7,2 +7,3 @@ import type { JoinFieldClient, PaginatedDocs, Where } from 'payload'; | ||
readonly allowCreate?: boolean; | ||
readonly disableTable?: boolean; | ||
readonly field: JoinFieldClient; | ||
@@ -9,0 +10,0 @@ readonly filterOptions?: Where; |
@@ -29,2 +29,3 @@ 'use client'; | ||
allowCreate = true, | ||
disableTable = false, | ||
filterOptions, | ||
@@ -101,6 +102,6 @@ initialData: initialDataFromProps, | ||
useIgnoredEffect(() => { | ||
if (!Table || query) { | ||
if (!disableTable && (!Table || query)) { | ||
void renderTable(); | ||
} | ||
}, [query], [Table, renderTable]); | ||
}, [query, disableTable], [Table, renderTable]); | ||
const [DocumentDrawer, DocumentDrawerToggler, { | ||
@@ -107,0 +108,0 @@ closeDrawer, |
@@ -41,5 +41,8 @@ 'use client'; | ||
const filterOptions = useMemo(() => { | ||
if (!docID) { | ||
return null; | ||
} | ||
const where = { | ||
[on]: { | ||
in: [docID || ''] | ||
equals: docID | ||
} | ||
@@ -58,2 +61,3 @@ }; | ||
allowCreate: typeof docID !== 'undefined' && allowCreate, | ||
disableTable: filterOptions === null, | ||
field: field, | ||
@@ -60,0 +64,0 @@ filterOptions: filterOptions, |
@@ -521,2 +521,4 @@ import ObjectIdImport from 'bson-objectid'; | ||
renderFieldFn({ | ||
id, | ||
collectionSlug, | ||
data: fullData, | ||
@@ -533,2 +535,3 @@ fieldConfig: fieldConfig, | ||
permissions, | ||
preferences, | ||
previousFieldState: previousFormState?.[path], | ||
@@ -535,0 +538,0 @@ req, |
@@ -6,4 +6,8 @@ import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'; | ||
import { FieldDescription } from '../../fields/FieldDescription/index.js'; | ||
// eslint-disable-next-line payload/no-imports-from-exports-dir -- need this to reference already existing bundle. Otherwise, bundle size increases., payload/no-imports-from-exports-dir | ||
import { FieldDescription } from '../../exports/client/index.js'; | ||
const defaultUIFieldComponentKeys = ['Cell', 'Description', 'Field', 'Filter']; | ||
export const renderField = ({ | ||
id, | ||
collectionSlug, | ||
data, | ||
@@ -20,2 +24,3 @@ fieldConfig, | ||
permissions: incomingPermissions, | ||
preferences, | ||
req, | ||
@@ -49,2 +54,3 @@ schemaPath, | ||
const serverProps = { | ||
id, | ||
clientField, | ||
@@ -57,5 +63,9 @@ data, | ||
// value and initialValue should be typed | ||
collectionSlug, | ||
formState, | ||
i18n: req.i18n, | ||
operation, | ||
payload: req.payload, | ||
preferences, | ||
req, | ||
siblingData, | ||
@@ -128,2 +138,21 @@ user: req.user | ||
} | ||
case 'ui': | ||
{ | ||
if (fieldConfig?.admin?.components) { | ||
// Render any extra, untyped components | ||
for (const key in fieldConfig.admin.components) { | ||
if (key in defaultUIFieldComponentKeys) { | ||
continue; | ||
} | ||
const Component = fieldConfig.admin.components[key]; | ||
fieldState.customComponents[key] = /*#__PURE__*/_jsx(RenderServerComponent, { | ||
clientProps: clientProps, | ||
Component: Component, | ||
importMap: req.payload.importMap, | ||
serverProps: serverProps | ||
}, `field.admin.components.${key}`); | ||
} | ||
} | ||
break; | ||
} | ||
default: | ||
@@ -130,0 +159,0 @@ { |
@@ -1,3 +0,4 @@ | ||
import type { Data, Field, FieldSchemaMap, FieldState, FormState, Operation, PayloadRequest, SanitizedFieldPermissions } from 'payload'; | ||
import type { Data, DocumentPreferences, Field, FieldSchemaMap, FieldState, FormState, Operation, PayloadRequest, SanitizedFieldPermissions } from 'payload'; | ||
export type RenderFieldArgs = { | ||
collectionSlug: string; | ||
data: Data; | ||
@@ -8,2 +9,3 @@ fieldConfig: Field; | ||
formState: FormState; | ||
id?: number | string; | ||
indexPath: string; | ||
@@ -17,2 +19,3 @@ operation: Operation; | ||
} | null | SanitizedFieldPermissions; | ||
preferences: DocumentPreferences; | ||
previousFieldState: FieldState; | ||
@@ -19,0 +22,0 @@ req: PayloadRequest; |
@@ -192,3 +192,3 @@ 'use client'; | ||
let revalidatedFormState; | ||
const serializableFields = deepCopyObjectSimpleWithoutReactComponents(fields); | ||
const serializableFields = deepCopyObjectSimpleWithoutReactComponents(contextRef.current.fields); | ||
await beforeSubmit.reduce(async (priorOnChange, beforeSubmitFn) => { | ||
@@ -223,3 +223,3 @@ await priorOnChange; | ||
if (onSubmit) { | ||
const serializableFields_0 = deepCopyObjectSimpleWithoutReactComponents(fields); | ||
const serializableFields_0 = deepCopyObjectSimpleWithoutReactComponents(contextRef.current.fields); | ||
const data_4 = reduceFieldsToValues(serializableFields_0, true); | ||
@@ -327,3 +327,3 @@ if (overrides) { | ||
} | ||
}, [beforeSubmit, action, disableSuccessStatus, disableValidationOnSubmit, disabled, dispatchFields, fields, handleResponse, method, onSubmit, onSuccess, redirect, router, t, i18n, waitForAutocomplete]); | ||
}, [beforeSubmit, action, disableSuccessStatus, disableValidationOnSubmit, disabled, dispatchFields, handleResponse, method, onSubmit, onSuccess, redirect, router, t, i18n, waitForAutocomplete]); | ||
const getFields = useCallback(() => contextRef.current.fields, []); | ||
@@ -330,0 +330,0 @@ const getField = useCallback(path_0 => contextRef.current.fields[path_0], []); |
@@ -14,3 +14,4 @@ 'use client'; | ||
children, | ||
disabled: disabledFromProps | ||
disabled: disabledFromProps, | ||
onClick | ||
} = props; | ||
@@ -20,3 +21,4 @@ const processing = useFormProcessing(); | ||
const { | ||
disabled | ||
disabled, | ||
submit | ||
} = useForm(); | ||
@@ -31,2 +33,5 @@ const canSave = !(disabledFromProps || initializing || processing || disabled); | ||
id: id, | ||
onClick: onClick ?? (() => { | ||
void submit(); | ||
}), | ||
type: type, | ||
@@ -33,0 +38,0 @@ children: children |
@@ -1,2 +0,2 @@ | ||
import { dequal } from 'dequal'; | ||
import { dequal } from 'dequal'; // TODO: Can we change this to dequal/lite ? If not, please add comment explaining why | ||
import { createClientConfig, formatErrors } from 'payload'; | ||
@@ -3,0 +3,0 @@ import { renderFilters, renderTable } from './renderTable.js'; |
{ | ||
"name": "@payloadcms/ui", | ||
"version": "3.0.0-beta.133", | ||
"version": "3.0.0-beta.134", | ||
"homepage": "https://payloadcms.com", | ||
@@ -67,2 +67,12 @@ "repository": { | ||
}, | ||
"./forms/fieldSchemasToFormState": { | ||
"import": "./dist/forms/fieldSchemasToFormState/index.js", | ||
"types": "./dist/forms/fieldSchemasToFormState/index.d.ts", | ||
"default": "./dist/forms/fieldSchemasToFormState/index.js" | ||
}, | ||
"./forms/renderField": { | ||
"import": "./dist/forms/fieldSchemasToFormState/renderField.js", | ||
"types": "./dist/forms/fieldSchemasToFormState/renderField.d.ts", | ||
"default": "./dist/forms/fieldSchemasToFormState/renderField.js" | ||
}, | ||
"./forms/*": { | ||
@@ -127,3 +137,3 @@ "import": "./dist/forms/*/index.js", | ||
"uuid": "10.0.0", | ||
"@payloadcms/translations": "3.0.0-beta.133" | ||
"@payloadcms/translations": "3.0.0-beta.134" | ||
}, | ||
@@ -146,3 +156,3 @@ "devDependencies": { | ||
"eslint-plugin-react-compiler": "19.0.0-beta-a7bf2bd-20241110", | ||
"payload": "3.0.0-beta.133", | ||
"payload": "3.0.0-beta.134", | ||
"@payloadcms/eslint-config": "3.0.0-beta.112" | ||
@@ -154,3 +164,3 @@ }, | ||
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020", | ||
"payload": "3.0.0-beta.133" | ||
"payload": "3.0.0-beta.134" | ||
}, | ||
@@ -157,0 +167,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 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
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
9297295
45711
+ Added@payloadcms/translations@3.0.0-beta.134(transitive)
+ Addedpayload@3.0.0-beta.134(transitive)
+ Addedws@8.18.0(transitive)
- Removed@payloadcms/translations@3.0.0-beta.133(transitive)
- Removedpayload@3.0.0-beta.133(transitive)