FieldDisplay & FieldInput (#1708)
* Removed view field duplicate types * wip * wip 2 * wip 3 * Unified state for fields * Renaming * Wip * Post merge * Post post merge * wip * Delete unused file * Boolean and Probability * Finished InlineCell * Renamed EditableCell to TableCell * Finished double texts * Finished MoneyField * Fixed bug inline cell click outside * Fixed hotkey scope * Final fixes * Phone * Fix url and number input validation * Fix * Fix position * wip refactor activity editor * Fixed activity editor --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -10,16 +10,14 @@ import {
|
||||
|
||||
import { StyledDropdownMenuItemsContainer } from '@/ui/dropdown/components/StyledDropdownMenuItemsContainer';
|
||||
import { StyledDropdownMenuSubheader } from '@/ui/dropdown/components/StyledDropdownMenuSubheader';
|
||||
import {
|
||||
ViewFieldDefinition,
|
||||
ViewFieldMetadata,
|
||||
} from '@/ui/editable-field/types/ViewField';
|
||||
import { IconMinus, IconPlus } from '@/ui/icon';
|
||||
import { MenuItem } from '@/ui/menu-item/components/MenuItem';
|
||||
|
||||
type OwnProps<Field> = {
|
||||
fields: Field[];
|
||||
onVisibilityChange: (field: Field) => void;
|
||||
import { ViewFieldForVisibility } from '../types/ViewFieldForVisibility';
|
||||
|
||||
type OwnProps = {
|
||||
fields: ViewFieldForVisibility[];
|
||||
onVisibilityChange: (field: ViewFieldForVisibility) => void;
|
||||
title: string;
|
||||
isDraggable: boolean;
|
||||
onDragEnd?: OnDragEndResponder;
|
||||
@ -29,20 +27,18 @@ const StyledDropdownMenuItemWrapper = styled.div`
|
||||
width: 100%;
|
||||
`;
|
||||
|
||||
export const ViewFieldsVisibilityDropdownSection = <
|
||||
Field extends ViewFieldDefinition<ViewFieldMetadata>,
|
||||
>({
|
||||
export const ViewFieldsVisibilityDropdownSection = ({
|
||||
fields,
|
||||
onVisibilityChange,
|
||||
title,
|
||||
isDraggable,
|
||||
onDragEnd,
|
||||
}: OwnProps<Field>) => {
|
||||
}: OwnProps) => {
|
||||
const handleOnDrag = (result: DropResult, provided: ResponderProvided) => {
|
||||
onDragEnd?.(result, provided);
|
||||
};
|
||||
|
||||
const getIconButtons = (index: number, field: Field) => {
|
||||
const getIconButtons = (index: number, field: ViewFieldForVisibility) => {
|
||||
if (index !== 0) {
|
||||
return [
|
||||
{
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
import { FieldDefinition } from '@/ui/field/types/FieldDefinition';
|
||||
import { FieldMetadata } from '@/ui/field/types/FieldMetadata';
|
||||
|
||||
export type ViewFieldForVisibility = Pick<
|
||||
FieldDefinition<FieldMetadata>,
|
||||
'key' | 'name' | 'Icon'
|
||||
> & {
|
||||
isVisible?: boolean;
|
||||
index: number;
|
||||
};
|
||||
Reference in New Issue
Block a user