UNPKG

@jsonforms/core

Version:

Core module of JSON Forms

57 lines (56 loc) 2.21 kB
import type Ajv from 'ajv'; import type { JsonSchema, Scoped, UISchemaElement } from '../models'; /** * Returns the string representation of the given date. The format of the output string can be specified: * - 'date' for a date-only string (YYYY-MM-DD), * - 'time' for a time-only string (HH:mm:ss), or * - 'date-time' for a full date-time string in ISO format (YYYY-MM-DDTHH:mm:ss.sssZ). * If no format is specified, the full date-time ISO string is returned by default. * * @returns {string} A string representation of the date in the specified format. * * @example * // returns '2023-11-09' * convertDateToString(new Date('2023-11-09T14:22:54.131Z'), 'date'); * * @example * // returns '14:22:54' * convertDateToString(new Date('2023-11-09T14:22:54.131Z'), 'time'); * * @example * // returns '2023-11-09T14:22:54.131Z' * convertDateToString(new Date('2023-11-09T14:22:54.131Z'), 'date-time'); * * @example * // returns '2023-11-09T14:22:54.131Z' * convertDateToString(new Date('2023-11-09T14:22:54.131Z')); */ export declare const convertDateToString: (date: Date, format?: "date" | "time" | "date-time") => string; /** * Escape the given string such that it can be used as a class name, * i.e. hashes and slashes will be replaced. * * @param {string} s the string that should be converted to a valid class name * @returns {string} the escaped string */ export declare const convertToValidClassName: (s: string) => string; export declare const hasType: (jsonSchema: JsonSchema, expected: string) => boolean; /** * Derives the type of the jsonSchema element */ export declare const deriveTypes: (jsonSchema: JsonSchema) => string[]; /** * Convenience wrapper around resolveData and resolveSchema. */ export declare const Resolve: { schema(schema: JsonSchema, schemaPath: string, rootSchema: JsonSchema): JsonSchema; data(data: any, path: string): any; }; export declare const Paths: { compose: (path1: string, path2: string) => string; fromScoped: (scopable: Scoped) => string; }; export declare const Runtime: { isEnabled(uischema: UISchemaElement, data: any, ajv: Ajv): boolean; isVisible(uischema: UISchemaElement, data: any, ajv: Ajv): boolean; };