3f0ee0139c
This PR prepares the refactor of record field definition and column definition. We need to separate the two concepts of FieldInput and FieldContext at the cell level, and the new RecordField concept that will replace FieldDefinition at the metadata and state level. So we create a new ui sub-folder in the already existing record-field folder, in order to separate those two concepts that are still very close.
20 lines
765 B
TypeScript
20 lines
765 B
TypeScript
import { type RecordBoardFieldDefinition } from '@/object-record/record-board/types/RecordBoardFieldDefinition';
|
|
import { type FieldMetadata } from '@/object-record/record-field/ui/types/FieldMetadata';
|
|
import { type ViewField } from '@/views/types/ViewField';
|
|
|
|
export const mapBoardFieldDefinitionsToViewFields = (
|
|
fieldsDefinitions: RecordBoardFieldDefinition<FieldMetadata>[],
|
|
): ViewField[] => {
|
|
return fieldsDefinitions.map(
|
|
(fieldDefinition): ViewField => ({
|
|
__typename: 'ViewField',
|
|
id: fieldDefinition.viewFieldId || '',
|
|
fieldMetadataId: fieldDefinition.fieldMetadataId,
|
|
size: 0,
|
|
position: fieldDefinition.position,
|
|
isVisible: fieldDefinition.isVisible ?? true,
|
|
definition: fieldDefinition,
|
|
}),
|
|
);
|
|
};
|