@prefecthq/prefect-ui-library
Version:
This library is the Vue and Typescript component library for [Prefect 2](https://github.com/PrefectHQ/prefect) and [Prefect Cloud 2](https://www.prefect.io/cloud/). _The components and utilities in this project are not meant to be used independently_.
63 lines (62 loc) • 3.55 kB
TypeScript
import { SelectOption } from '@prefecthq/prefect-design';
import { Component } from 'vue';
import { SchemaPropertyComponentWithProps } from '../../../services/schemas/utilities';
import { SchemaProperty, SchemaPropertyInputAttrs, SchemaPropertyMeta, SchemaValue } from '../../../types/schemas';
import { Require } from '../../../types/utilities';
import { ValidationMethod, ValidationMethodFactory } from '../../../utilities/validation';
export type SchemaPropertyServiceSource = {
property: SchemaProperty;
level: number;
};
export type SchemaPropertyServiceConstructor = new (source: SchemaPropertyServiceSource) => SchemaPropertyService;
export declare abstract class SchemaPropertyService {
/**
* Converts a schema value from the ui into the correct value for the api
*/
protected abstract request(value: SchemaValue): SchemaValue;
/**
* Converts a schema value from the api into the correct value for the ui
*/
protected abstract response(value: SchemaValue): SchemaValue;
/**
* Returns the vue component and any props necessary to render the property in the schema form
*/
protected abstract get component(): SchemaPropertyComponentWithProps;
/**
* Returns the value needed for the @property {PropertyComponentWithProps} property to be
* rendered when no value exists or the value is invalid
*/
protected abstract get default(): SchemaValue;
/**
* Can be extended to add property specific validation rules. Implemented here because this is not required
*/
protected get validators(): ValidationMethodFactory[];
/**
* Can be extended to add property specific attrs rules. Implemented here because this is not required
*/
protected get attrs(): SchemaPropertyInputAttrs;
protected property: SchemaProperty;
protected level: number;
protected withProps: <T extends Component>(...args: Omit<Partial<import("../../../utilities").ComponentProps<T>>, "modelValue"> extends Omit<import("../../../utilities").ComponentProps<T>, "modelValue"> ? [component: T, props?: (Omit<import("../../../utilities").ComponentProps<T>, "modelValue"> & Record<string, unknown>) | undefined] : [component: T, props: Omit<import("../../../utilities").ComponentProps<T>, "modelValue"> & Record<string, unknown>]) => Omit<Partial<import("../../../utilities").ComponentProps<T>>, "modelValue"> extends Omit<import("../../../utilities").ComponentProps<T>, "modelValue"> ? {
component: T;
props?: (Omit<import("../../../utilities").ComponentProps<T>, "modelValue"> & Record<string, unknown>) | undefined;
} : {
component: T;
props: Omit<import("../../../utilities").ComponentProps<T>, "modelValue"> & Record<string, unknown>;
};
constructor({ property, level }: SchemaPropertyServiceSource);
mapResponseValue(value: SchemaValue): SchemaValue;
mapRequestValue(value: SchemaValue): SchemaValue | undefined;
getDefaultValue(): SchemaValue;
getComponent(): SchemaPropertyComponentWithProps;
getValidators(required: boolean): ValidationMethod[];
getAttrs(): SchemaPropertyInputAttrs;
getMeta(required: boolean): SchemaPropertyMeta | null;
protected componentIs(component: Component): boolean;
protected invalid(): void;
protected has<T extends keyof SchemaProperty>(key: T): this is {
property: SchemaProperty & Require<SchemaProperty, T>;
};
protected getSelectOptions(): SelectOption[];
protected isDefaultValue(value: SchemaValue): boolean;
}