UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

55 lines 3.96 kB
import { ColumnModel, ColumnType, ColumnTypeEnum, Entity, FacetType, ViewScope } from '@sage-bionetworks/synapse-types'; import { JSONSchema7Definition } from 'json-schema'; import { SetOptional } from 'type-fest'; import { ColumnModelFormData } from './Validators/ColumnModelValidator'; /** * Get the allowed column types for a column model based on the table type. * @param isView - whether the base table is a view * @param isJsonSubColumnFacet - whether the proposed column is a JSON subcolumn facet */ export declare function getAllowedColumnTypes(isView: boolean, isJsonSubColumnFacet: boolean): ColumnTypeEnum[]; export declare function getFacetTypeFriendlyName(facetType: FacetType): "Range" | "Values"; export declare function getColumnTypeFriendlyName(type: ColumnType | ColumnTypeEnum): "File" | "Link" | "STRING" | "DOUBLE" | "BOOLEAN" | "INTEGER" | "DATE" | "FILEHANDLEID" | "ENTITYID" | "LINK" | "MEDIUMTEXT" | "LARGETEXT" | "USERID" | "STRING_LIST" | "INTEGER_LIST" | "BOOLEAN_LIST" | "DATE_LIST" | "USERID_LIST" | "ENTITYID_LIST" | "EVALUATIONID" | "SUBMISSIONID" | "JSON" | "String" | "Integer" | "Boolean" | "Double" | "Date" | "Entity" | "MediumText" | "LargeText" | "User" | "String List" | "Integer List" | "Boolean List" | "Date List" | "User ID List" | "Entity ID List" | "Evaluation" | "Submission"; /** * Can the given type have a size? * * @param type * @return */ export declare function canHaveSize(type: ColumnType | ColumnTypeEnum): boolean; export declare function canHaveMaxListLength(type: ColumnType | ColumnTypeEnum): boolean; /** * Configure the facet selection based on the column type * * @param type a ColumnType for which to get the facet selection * @param isJsonSubColumnFacet is this a facet for a json subcolumn? * @return the allowed facetTypes, or null if faceting is not allowed */ export declare function configureFacetsForType(type: ColumnType | ColumnTypeEnum, isJsonSubColumnFacet: boolean): (FacetType | undefined)[] | null; export declare function canHaveDefault(type: ColumnType | ColumnTypeEnum, isView: boolean, isJsonSubColumnFacet: boolean): boolean; export declare const DEFAULT_STRING_SIZE = 50; export declare const MAX_STRING_SIZE = 1000; export declare const MAX_LIST_LENGTH = 100; /** * Get the default max size for a given type. * * @param type * @return */ export declare function getMaxSizeForType(type: ColumnType | ColumnTypeEnum): number; export declare function canHaveRestrictedValues(type: ColumnType | ColumnTypeEnum, isJsonSubColumnFacet: boolean): boolean; /** * Transform ColumnModels returned by Synapse into the form data for the TableColumnSchemaForm. * Default column models, if available, are used to determine which columns should not be editable in the form. * @param columnModels * @param defaultColumns */ export declare function transformColumnModelsToFormData(columnModels: SetOptional<ColumnModel, 'id'>[], defaultColumns?: ColumnModel[]): ColumnModelFormData[]; export declare function getViewScopeForEntity(entity: Entity): ViewScope | undefined; export declare function getJsonSchemaItemDefinitionForColumnType(columnType: ColumnTypeEnum): JSONSchema7Definition; export declare const findMatchingColumnModel: (columnModels: ColumnModel[], target: ColumnModelFormData) => ColumnModel | undefined; export declare function getFormDataValueAsNumber(formDataValue: string | number | undefined): number | null; export declare const isFormDataValueSmallerThanRecommendedValue: (formDataValue: string | number | undefined, recommendedValue: number | undefined) => boolean; export declare function doesColumnModelSatisfyAnnotationMinimums(columnModel: ColumnModelFormData, annotationColumnModel?: ColumnModel): boolean; export declare function getNumberOfColumnModelsWithValuesBelowMinimumRecommendedSizes(columnModels: ColumnModelFormData[], annotationColumnModels: ColumnModel[]): number; //# sourceMappingURL=TableColumnSchemaEditorUtils.d.ts.map