/** * Represents the underlying metadata type. */ export declare enum ZMetadataType { /** * A date. * * Should be a string or Date value. */ Date = "date", /** * A number. * * Should be a string or number value. */ Number = "number", /** * A raw string. * * This is the default type. Should be a string value. */ Text = "text", /** * A text field that represents a path to a file. * * Should behave the same as a text field. */ File = "file", /** * A flag. */ Boolean = "boolean", /** * An icon value. * * The underlying metadata cls should be set that * defines which class style the icon comes from. */ Icon = "icon", /** * An image value. * * The value should be a URL to an image file. If the image * is binary, then it should be a data URL. */ Image = "image", /** * Custom value that is defined by the person who is using this * metadata. */ Custom = "custom" } /** * Represents metadata about a object field. * * This of this as data about the data. */ export interface IZMetadata { /** * The id. * * This can be a guid or a human readable * value. The most important feature is that * this must be unique across a collection of * metadata. */ id: string; /** * Human readable name of the field data. */ name: string; /** * The metadata type. */ type: ZMetadataType; /** * The field path into the entity that targets * the value. */ path?: string; /** * An explanation of what the field is for. * * This can act like a comment. Those looking * at the metadata can use this to get a better * idea of what the value represents. */ description?: string; /** * The default value that should be used for null or undefined * representations of this value. */ fallback?: any; /** * The expected format. * * The usage of this depends on the type. * For example, for date fields, this can be something * such as 'L LT' and for numbers this can be something * such as 'currency' or 'percentage'. */ format?: string; /** * Whether or not this metadata can be sorted. */ sortable?: boolean; /** * Whether or not this metadata can be edited. */ editable?: boolean; /** * The class type of the metadata. * * This is useful for icons where you need to specify * which set the icon value comes from. * * For example, if the value is refresh, then this * value can be font-awesome to specify usage of * the refresh icon from the font-awesome set. * * The actual class usage is determined by the one * using the metadata. */ cls?: string; /** * Decimal precision. * * Useful for numbers. */ precision?: number; /** * The width represented as a string. * * Useful for things like icons and images. * * This allows for pseudo sizes such as xs, * sm, lg, etc, as well as css values such as * 24px, 2rem, etc. * * The usage of this depends on the developer using it. */ width?: string; /** * The height represented as a string. * * Useful for things like icons and images. * * This allows for pseudo sizes such as xs, * sm, lg, etc, as well as css values such as * 24px, 2rem, etc. * * The usage of this depends on the developer using it. */ height?: string; } /** * Represents a builder for metadata. */ export declare class ZMetadataBuilder { private _metadata; /** * Initializes a new instance of this object. */ constructor(); /** * Sets the id of the metadata. * * @param val - * The value to set. If this * is undefined, then a new * guid will be set as the value. * * @returns * This object. */ id(val?: string): this; /** * Sets the name of the metadata. * * @param val - * The value to set. * * @returns * This object. */ name(val: string): this; /** * Sets the path of the metadata. * * @param val - * The value to set. * * @returns * This object. */ path(val: string): this; /** * Sets the description for the field. * * @param val - * The value to set. * * @returns * This object. */ description(val: string): this; /** * Sets the fallback value for the field. * * @param val - * The fallback value. * * @returns * This object. */ fallback(val: any): this; /** * Sets the format of the metadata. * * @param val - * The value to set. * * @returns * This object. */ format(val?: string): this; /** * Sets the class type of the metadata. * * @param val - * The value to set. * * @returns * This object. */ cls(val?: string): this; /** * Sets the precision of the metadata. * * @param val - * The value to set. * * @returns * This object. */ precision(val?: number): this; /** * Sets the width of the metadata. * * @param val - * The value to set. * * @returns * This object. */ width(val?: string): this; /** * Sets the height of the metadata. * * @param val - * The value to set. * * @returns * This object. */ height(val?: string): this; /** * Sets both width and height. * * @param val - * The value to set. * * @returns * This object. */ square(val?: string): this; /** * Sets the type of the metadata. * * @param val - * The value to set. * * @returns * This object. */ type(val: ZMetadataType): this; /** * Sets the type as text. * * @returns * This object. */ text: () => this; /** * Sets the type as file. * * @returns * This object. */ file: () => this; /** * Sets the type as custom. * * @returns * This object. */ custom: () => this; /** * Sets the type as date. * * @returns * This object. */ date: () => this; /** * Sets the type as a number. * * @returns * This object. */ number: () => this; /** * Sets the type as an icon. * * @returns * This object. */ icon: () => this; /** * Sets the type as an image. * * @returns * This object. */ image: () => this; /** * Sets the type as a boolean. * * @returns * This object. */ boolean: () => this; /** * Sets the metadata as sortable. * * @param value - * The value to set. * * @returns * This object. */ sortable(value?: boolean): this; /** * Sets the metadata as editable. * * @param value - * The value to set. * * @returns * This object. */ editable(value?: boolean): this; /** * Copies another metadata object into this object. * * @param other - * The metadata to copy. * * @returns * This object. */ copy(other: IZMetadata): this; /** * Returns the constructed metadata. * * @returns * The built metadata. */ build(): IZMetadata; }