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.
19 lines
717 B
TypeScript
19 lines
717 B
TypeScript
import { type FieldMetadata } from '@/object-record/record-field/ui/types/FieldMetadata';
|
|
import { type ColumnDefinition } from '@/object-record/record-table/types/ColumnDefinition';
|
|
|
|
import { type ViewField } from '../types/ViewField';
|
|
|
|
export const mapColumnDefinitionsToViewFields = (
|
|
columnDefinitions: ColumnDefinition<FieldMetadata>[],
|
|
): ViewField[] => {
|
|
return columnDefinitions.map((columnDefinition) => ({
|
|
__typename: 'ViewField',
|
|
id: columnDefinition.viewFieldId || '',
|
|
fieldMetadataId: columnDefinition.fieldMetadataId,
|
|
position: columnDefinition.position,
|
|
size: columnDefinition.size,
|
|
isVisible: columnDefinition.isVisible ?? true,
|
|
definition: columnDefinition,
|
|
}));
|
|
};
|