main

mattermost/focalboard

Last updated at: 28/12/2023 01:42

tableCalculationOptions.tsx

TLDR

This file exports a React functional component called TableCalculationOptions. It takes in a props object and renders a CalculationOptions component with certain values and options based on the props.

Methods

None

Classes

None

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react'

import {CalculationOptions, CommonCalculationOptionProps, optionsByType} from '../../calculations/options'

export const TableCalculationOptions = (props: CommonCalculationOptionProps): JSX.Element => {
    const options = [...optionsByType.get('common')!]
    if (props.property && optionsByType.get(props.property.type)) {
        options.push(...optionsByType.get(props.property.type)!)
    }

    return (
        <CalculationOptions
            value={props.value}
            menuOpen={props.menuOpen}
            onClose={props.onClose}
            onChange={props.onChange}
            property={props.property}
            options={options}
        />
    )
}