Skip to content

Commit

Permalink
Change bulk editing to opt in
Browse files Browse the repository at this point in the history
  • Loading branch information
louwie17 committed Dec 10, 2024
1 parent 9ff0ba0 commit 0f3c00c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/dataviews/src/field-types/datetime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ export default {
sort,
isValid,
Edit: 'datetime',
supportsBulkEditing: true,
};
1 change: 1 addition & 0 deletions packages/dataviews/src/field-types/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ export default function getFieldTypeDefinition( type?: FieldType ) {
return true;
},
Edit: () => null,
supportsBulkEditing: false,
};
}
1 change: 1 addition & 0 deletions packages/dataviews/src/field-types/integer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ export default {
sort,
isValid,
Edit: 'integer',
supportsBulkEditing: true,
};
1 change: 1 addition & 0 deletions packages/dataviews/src/field-types/text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export default {
sort,
isValid,
Edit: 'text',
supportsBulkEditing: true,
};
9 changes: 4 additions & 5 deletions packages/dataviews/src/normalize-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit 0f3c00c

Please sign in to comment.