From 0f3c00c4d51823246bce76e484ded97662934540 Mon Sep 17 00:00:00 2001 From: Lourens Schep Date: Tue, 10 Dec 2024 11:23:02 +0100 Subject: [PATCH] Change bulk editing to opt in --- packages/dataviews/src/field-types/datetime.tsx | 1 + packages/dataviews/src/field-types/index.tsx | 1 + packages/dataviews/src/field-types/integer.tsx | 1 + packages/dataviews/src/field-types/text.tsx | 1 + packages/dataviews/src/normalize-fields.ts | 9 ++++----- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/dataviews/src/field-types/datetime.tsx b/packages/dataviews/src/field-types/datetime.tsx index aa97fc86c318c2..6f1c004e83e1df 100644 --- a/packages/dataviews/src/field-types/datetime.tsx +++ b/packages/dataviews/src/field-types/datetime.tsx @@ -25,4 +25,5 @@ export default { sort, isValid, Edit: 'datetime', + supportsBulkEditing: true, }; diff --git a/packages/dataviews/src/field-types/index.tsx b/packages/dataviews/src/field-types/index.tsx index eb9dada479c6bf..16ea89769479e3 100644 --- a/packages/dataviews/src/field-types/index.tsx +++ b/packages/dataviews/src/field-types/index.tsx @@ -46,5 +46,6 @@ export default function getFieldTypeDefinition( type?: FieldType ) { return true; }, Edit: () => null, + supportsBulkEditing: false, }; } diff --git a/packages/dataviews/src/field-types/integer.tsx b/packages/dataviews/src/field-types/integer.tsx index f57c8e382db816..e06c9c75f4a0bd 100644 --- a/packages/dataviews/src/field-types/integer.tsx +++ b/packages/dataviews/src/field-types/integer.tsx @@ -31,4 +31,5 @@ export default { sort, isValid, Edit: 'integer', + supportsBulkEditing: true, }; diff --git a/packages/dataviews/src/field-types/text.tsx b/packages/dataviews/src/field-types/text.tsx index 76ff699d0848c4..531fe47ac6f599 100644 --- a/packages/dataviews/src/field-types/text.tsx +++ b/packages/dataviews/src/field-types/text.tsx @@ -24,4 +24,5 @@ export default { sort, isValid, Edit: 'text', + supportsBulkEditing: true, }; diff --git a/packages/dataviews/src/normalize-fields.ts b/packages/dataviews/src/normalize-fields.ts index c32fcf81e9ae7f..8ac1905fd9ce07 100644 --- a/packages/dataviews/src/normalize-fields.ts +++ b/packages/dataviews/src/normalize-fields.ts @@ -64,11 +64,10 @@ export function normalizeFields< Item >( ); }; - let supportsBulkEditing = true; - // If custom Edit component is passed in we default to false for bulk edit support. - if ( typeof field.Edit === 'function' || field.supportsBulkEditing ) { - supportsBulkEditing = field.supportsBulkEditing ?? false; - } + const supportsBulkEditing = + field.supportsBulkEditing || + ( typeof field.Edit !== 'function' && + fieldTypeDefinition.supportsBulkEditing ); const render = field.render || ( field.elements ? renderFromElements : getValue );