import { Config } from '../models/control-config'; import { OcpdComponentRegister } from './ocpd-component-register'; import { Model, OcpdItemManagerHelper, SchemaPropertyInfo } from './ocpd-item-manager-helper'; import { Component } from '@opentext/forms-common'; import { ComponentRow, Constraint, DATA_TYPES } from './ocpd-constraints-config'; export declare class OcpdFormSchemaManager { _ocpdComponentRegister: OcpdComponentRegister; _ocpdItemManagerHelper: OcpdItemManagerHelper; stagingSchema: { properties: {}; }; private static _instance; private activeAdditionalFormSchemas; private formSchema; private currentSchema; formSchemaLocalizations: {}; static isPropertyPathSupported: { 'check-box': { type: string; }; datetime: { date: { type: string; otFormat: { dataType: string; repeating: boolean; }; }; dateTime: { type: string; otFormat: { dataType: string; repeating: boolean; }; }; }; 'property-bag': { type: string; $ref: string; }; 'text-box': { string: { type: string; otFormat: { repeating: boolean; }; }; integer: { type: string; otMinimum: number; otMaximum: number; otFormat: { repeating: boolean; }; }; numeric: { type: string; otFormat: { dataType: string; repeating: boolean; }; }; bigint: { type: string; otFormat: { dataType: string; repeating: boolean; }; }; number: { type: string; otFormat: { repeating: boolean; }; }; decimal: { type: string; otFormat: { dataType: string; repeating: boolean; }; }; currency: { type: string; otFormat: { dataType: string; repeating: boolean; }; }; }; 'radio-group': { type: string; otFormat: { presentationType: string; }; }; 'richtext-editor': { type: string; otFormat: { presentationType: string; }; }; 'select-box': { type: string; otFormat: { presentationType: string; repeating: boolean; }; }; 'combo-box': { type: string; otFormat: { presentationType: string; repeating: boolean; }; }; 'multi-select': { type: string; items: { type: string; }; otFormat: { repeating: boolean; presentationType: string; }; }; 'simple-list': { type: string; items: { type: string; }; otFormat: { presentationType: string; repeating: boolean; }; }; table: { type: string; items: { $ref: string; }; otFormat: { presentationType: string; }; }; 'text-area': { otFormat: { presentationType: string; repeating: boolean; }; type: string; }; 'toggle-switch': { type: string; otFormat: { presentationType: string; }; }; upload: {}; image: {}; 'user-control': { otFormat: { dataType: string; presentationType: string; repeating: boolean; }; type: string; }; }; static workingSchemaId: string; constructor(); deleteFormSchema(): void; isFormSchemaCreated(): boolean; getFormSchema(): any; createFormSchema(id: any): void; deleteActiveAdditionalFormSchemas(): void; createActiveAdditionalFormSchemas(id: any): void; findSchemaPropertyObject(propertyPath: string, withSchemaId?: boolean): any; getActiveAdditionalFormSchemaById(schemaId: any): any; isPropertiesSectionDefined(): boolean; addPropertiesSection(): void; /** * Return information about a character. * @param {string} str the string to extract the character from * @param {number} pos the zero-based index of the character within the string * @returns {CharInfo} information about the character */ getCharInfo(str: string, pos: number): { ch: string; chUpper: string; chLower: string; isUpper: boolean; isLower: boolean; isDigit: boolean; }; /** * Checks if a word separator should be appended at the current position in a string. * @param {string} str the string to check * @param {number} pos the zero-based index of the next character within the string * @param {CharInfo} [prev] information about the previous character within the string * @returns {boolean} true if a word separator should be inserted */ appendWordSeparator(str: string, pos: number, prev: any | undefined): boolean; /** * Format a model name from a file name. * @param {string} fileName the file name of the model * @returns {string} the model name formatted from the file name */ formatNameFromFileName(fileName: string): string; static isPropertyNameInUse(propertyName: any, formSchemaModel: any): boolean; getFormSchemaPropertyObject(propertyPath: string): any; getLocalizedFormSchemaPropertyObject(locale: any, propertyName: any): any; isPropertiesDefined(propertyName: string): boolean; removeRowIdFromOptionsOrEnum(options: any, isEnum?: boolean): any; createEnumFromArrayOfObjects(enumObject: any): any[]; supportsEnumOrOptions(config: Config): boolean; /** * Adds `otOptions` to a specific schema property * @param propertyPath property path * @param schemaProperty schema property object where otOptions will be added * @param otOptions options to be added */ addOtOptionsForProperty(propertyPath: any, schemaProperty: any, otOptions: any): void; /** * Resets `otOptions` from a specific target object. * Resets to an empty array * @param workingModel object where otOptions needs to be reset */ resetOtOptionsForProperty(workingModel: any): void; /** * Adds `enum` to a specific target object * @param propertyPath property path * @param schemaProperty schema property object where enums will be added * @param enums enum values to be added */ addEnumsForProperty(propertyPath: string, schemaProperty: any, enums: any): void; /** * Deletes `enum` from the default schema property which is used to validate default value * @param defaultSchemaProperty object where enum needs to be deleted */ deleteEnumsFromProperty(defaultSchemaProperty: any): void; /** * Deletes `otOptions` from the default schema property which is used to validate default value * @param defaultSchemaProperty object where otOptions needs to be deleted */ deleteOtOptionsFromProperty(defaultSchemaProperty: any): void; /** * Resets `enum` from a specific target object. * Resets to an empty array * @param workingModel object where enum needs to be reset */ resetEnumsForProperty(workingModel: any): void; /** * Populates options/enums into a target schema property using model and form schema based on `path` * @param modelSchemaProperty model schema property * @param formSchemaProperty form schema property * @param targetObject target property where otOptions will be added * @param values options to be added * @param {string} path type of values (either `otEnum` or `otOptions`) */ populateOptionsEnumsFromSchemas(modelSchemaProperty: any, formSchemaProperty: any, targetObject: any, values: any[], path: string): void; /** * Checks if the given schema property defines an `items` field * @param modelSchemaObject model schema object * @param formSchemaObject form schema object * @returns true if the property has `items` field in either of the two schemas */ doesPropertyHasItems(modelSchemaObject: any, formSchemaObject: any): boolean; findSchema(schemaId: any): any; findUnboundSchema(schemaId: any): any; generateCustomSchemaId(schemaId: string, config: Config): string; addProperty(config: Config, rootModelSchema: any, schemaItemId: any, currentLocale: any, defaultLocale: any): void; deleteLocalizationsForDeletedOTOption(workingModel: any): void; /** * Checks if an option exists in the working model otOptions * @param optionValue option value to be checked * @param workingModel working model * @returns {boolean} true if option exists */ doesOptionExistsInWorkingModel(optionValue: string, workingModel: any): boolean; /** * Delete `otOptions` for a property in all form schema localizations * This is function is mainly used when changing otOptions to enum * @param {string}propertyName propertyPath */ deleteOtOptionsFromAllLocales(propertyName: string): void; /** * Returns the otOptions from the property * @param property schema property * @returns {any[] | undefined} `otOptions` from schema */ getOtOptionsFromProperty(property: any): any[] | undefined; /** * Returns the enum from the property * @param property schema property * @returns {any[] | undefined} `enum` from schema */ getEnumsFromProperty(property: any): any[] | undefined; changeToRequiredArray(config: Config, currentSchema: any, formSchema: any, currentSchemaProperty: any, dictionaryId: any): void; changeUserDataType(schemaProperty: any, dataType: any): void; changeExternalDataSource(propertyPath: any, currentSchema: any, dataSource: any): void; changeExternalDictionary(propertyPath: any, currentSchema: any, dictionaryId: any): void; changeConstraints(propertyPath: any, schemaProperty: any, propertyModel: any): void; changeConstraintErrorMessage(propertyPath: any, schemaProperty: any, errorMessage: any): void; processConstraintComponents(components: ComponentRow[]): Component[]; processComponentItem(componentItem: ComponentRow): Component; processComponentArray(dataType: string, componentsArray: any[]): any[]; isValidComponentModel(model: any, componentId: string | any[]): boolean; isMinItemsDefinedInSchema(config: Config, schema: any, propertyName: string): boolean; isMinLengthDefinedInSchema(config: Config, schema: any, propertyName: string): boolean; isConstDefinedInSchema(config: Config, schema: any, propertyName: string): boolean; isMinLengthSupportedByPresentationType(currentSchemaProperty: any, dictionaryId: any): boolean; isMinLengthSupportedByDataType(currentSchemaProperty: any): boolean; isMinItemsSupportedByPresentationType(currentSchemaProperty: any): boolean; isMinItemsSupported(currentSchemaProperty: any): boolean; isMinLengthSupported(currentSchemaProperty: any, dictionaryId: any): boolean; setMinItems(currentSchemaProperty: any, property: any, minItems: number): void; setMinLength(currentSchemaProperty: any, property: any, minLength: number): void; setConstValue(property: any, constValue: any): void; setPrecision(config: Config, currentSchemaProperty: any, precision: number): void; setScale(config: Config, currentSchemaProperty: any, scale: number): void; setCurrencyCode(config: Config, currentSchemaProperty: any, currencyCode: string): void; changeToRepeatingAttribute(config: Config, currentSchemaProperty: any): void; isMaxLengthSupported(type: any, dataType: any): boolean; changeToMaxLengthAttribute(config: Config, currentSchemaProperty: any, workingModel: any): void; static getInitialValueForProperty(config: Config): any; resetAndBuildFormSchema(allPropertyModelsOnCanvas: Model[], formSchema: any, schemaItemId: any, currentLocale: any, defaultLocale: any): void; findModelSchemaByPropertyPath(propertyPath: string, formSchema: any, config: Config): any; getRefFromSchemaProperty(schemaPropertyObject: any): any; rebuildFormSchema(allPropertyModelsOnCanvas: Model[], rootModelSchema: any, schemaItemId: any, currentLocale: any, defaultLocale: any): void; getConfig(allModels: Model[], parentId: any): Config; static getFormSchemaSchemaById(schemaId: any): any; setActiveAdditionalFormSchemas(activeAdditionalFormSchemas: any): void; getActiveAdditionalFormSchemas(): any[]; clearLocalizationsForProperty(propertyPath: string): void; getAllLocalizations(): string[]; setFormSchemaLocalizations(formSchemaLocalizations: any, currentFormLocale: any, propertyName: any, value: any, propertyChanged: any): void; isEmptyObject(obj: any): boolean; deleteFormSchemaDefaultLocalizations(defaultLocale: any, formSchemaLocalizations: any): void; updateDefaultLocalePropertyInFormSchema(localeProperty: any, schemaProperty: any): void; updateDefaultLocaleInFormSchema(defaultLocale: any, formSchemaLocalizations: any): any; deleteMissingPropertyFromLocalizations(formSchemaLocalizations: any, formSchemaModel: any): any; deleteUnusedLocaleObject(localeObject: any, locale: any, formSchemaLocalizations: any): void; getFormSchemaLocalizations(): {}; setFormSchema(formSchema: any): void; resetStagingSchema(): void; notifyFormLocaleChanged(locale: any, oldLocale: any, formSchemaModel: Model): void; createPropertyModel(propertyName: string, propertyPath: string, config: Config): Model; restoreLocalizationsWithFullPropertyPath(localizations: any, defaultLocale: any, config: Config): void; createPropertyModelSchema(model: Model): { $id: string; properties: { default: {}; }; additionalProperties: boolean; type: string; }; /** * Delete property model for the given property name * @param propertyName - property name * @param schemaItemId - property mapping model id */ deletePropertyModel(propertyPath: string): void; static createWorkingSchema(): { $id: string; title: string; type: string; required: string[]; properties: { propertyPath: { type: string; pattern: string; }; otFormat: { type: string; items: { $ref: string; }; }; otMaxLength: { type: string; otMinimum: number; otMaximum: number; }; read_only: { type: string; }; required: { type: string; }; repeating: { type: string; }; otOptionsToggle: { type: string; }; otOptions: { type: string; items: { $ref: string; }; }; otEnum: { type: string; items: { $ref: string; }; }; default: { type: string; otFormat: {}; }; dataSource: { type: string; otMinLength: number; }; dictionaryId: { type: string; otMinLength: number; }; constraints: { type: string; items: { $ref: string; }; }; constraintsErrorMessage: { type: string; }; precision: { type: string; otMinimum: number; otMaximum: number; }; scale: { type: string; otMinimum: number; }; currencyCode: { type: string; otMinLength: number; }; }; }; createWorkingModelSkeleton(schemaItemId: any): Model; /** * Finds the maximum of two values * @param value1 first value * @param value2 second value * @returns the maximum value */ findMaximumValue(value1: any, value2: any): any; getMaxLengthFromDefault(defaultValue: any): number; calculatePropertiesMaxLength(schemaLocalisations: any, property: any, locale: any, propertyName: any, maxLengthDefaultValue: any): any; getLongestDefaultValueStringLength(propertyNames: string[]): number; /** * Get the longest string length from the `otOptions` or `enum` values for the given property names * @param propertyNames array of property names * @returns {number} the longest string length from the `otOptions` or `enum` values */ getLongestOptionsValueStringLength(propertyNames: string[]): number; /** * Get the maximum length of the otOptions/enum for a specific property * @param maxLength current max length * @param property the property to check i.e., either model schema or form schema property * @returns {number} the updated max length */ getOptionsMaxLengthForProperty(maxLength: number, property: any): number; getPropertyPath(element: HTMLElement): any; getConfigFromElement(element: HTMLElement): any; getPropertyPathsFromFocusTree(): string[]; getConfigsInCanvasThatMatchPropertyPaths(models: any, propertyPaths: any): any; getPropertyMappingModel(propertyPath: string): any; getRootPropertyMappingModel(): any; getWorkingModel(schemaItemId: any): any; getPropertyModel(schemaItemId: any, propertyPath: any): Model; getTypeFromFocusTree(): any; updateSchemaProperties(propertyPath: string, oldValue: any, newValue: any, transactionId: any, schemaItemId: any, currentFormLocale: any, defaultFormLocale: any, rowGuid: any, isUndo: any): Promise; applyPrecisionAndScale(config: Config, localPropertyPath: string, newValue: any, propertyModel: any, transactionId: string): Promise; applyCurrencyCode(propertyModel: any, oldValue: string, newValue: string, config: Config, isUndo: boolean, schemaItemId: string, transactionId: string): Promise; applyMaxLengthToOptionsAndEnumSchemas(isComboBox: boolean, isComboBoxOtOptionsValue: boolean, isComboBoxEnumValue: boolean, workingModel: any): void; /** * Validate and resets the default value if it is not valid * @param propertyModel property model * @param workingModel working model * @param optionValues list values */ validateAndResetDefault(propertyModel: any, workingModel: any, optionValues: any): void; /** * Checks if the default value is valid against list of options/enums * @param defaultValue default value * @param options list of options/enums * @returns {boolean} true if default value present in list of options/enums */ isDefaultValueValid(defaultValue: any, options: any[]): boolean; /** * Returns model schema object for the propertyPath * @param {string} propertyPath property path * @returns {Object | undefined} model schema object for a bound control, else undefined */ getModelSchemaObject(propertyPath: string): object | undefined; createPropertyMappingSchema(propertyMappingModel: any, schemaItemId: any): any; createPropertyMappingModel(schemaItemId: any, addWorkingModel?: boolean): Model; addPropertyToPropertyModel(config: Config, schemaItemId: string): any; addValidationMetaDataToSchemaProperty(schemaPropertyInfo: any, config: any): any; static getFormSchemaSchemas(): any[]; clearFormSchemaLocalizations(): void; setLocalizationsFromDesign(contentLocalizations: any): void; extractAdditionalFormSchemaLocalizationsLocalizations(additionalFormSchemaLocalizations: any): any; formatFormSchemaLocalizationsForStorage(formSchemaLocalizations: any): {}; validateMaxLength(valueToTest: any, maxLength: any, repeating?: boolean): { schema: { $id: string; type: string; properties: {}; additionalProperties: boolean; }; model: { data: { valueToTest: any; }; }; additionalSchemas: any[]; }; validatePropertyPath(valueToTest: any): { schema: { $id: string; type: string; required: string[]; properties: { valueToTest: { type: string; otMinLength: number; pattern: string; }; }; additionalProperties: boolean; }; model: { data: { valueToTest: any; }; }; additionalSchemas: any[]; }; validateRequired(valueToTest: any, repeating?: boolean): { schema: { $id: string; type: string; required: string[]; properties: { valueToTest: { type: string; otMinLength: number; otFormat: { repeating: boolean; }; }; }; additionalProperties: boolean; }; model: { data: { valueToTest: any; }; }; additionalSchemas: any[]; }; validateDefaultValue(config: Config, valueToTest: any, maxLength: any, repeating: any, schemaPropertyInfo: any): { schema: { $id: string; type: string; properties: { valueToTest: any; }; additionalProperties: boolean; }; model: { data: { valueToTest: any; }; }; additionalSchemas: any[]; }; validateIntegerRange(minimum: any, maximum: any, valueToTest: any): { schema: { $id: string; type: string; required: string[]; properties: { valueToTest: { type: string; otMinimum: any; otMaximum: any; }; }; additionalProperties: boolean; }; model: { data: { valueToTest: any; }; }; additionalSchemas: any[]; }; validateDuplicateOptions(valueToTest: any): { schema: { $id: string; type: string; properties: { options: { type: string; items: { type: string; }; uniqueItems: boolean; }; }; additionalProperties: boolean; }; model: { data: { options: any; }; }; additionalSchemas: any[]; }; setValidationSchemaMaxLength(property: any, maxLength: number): void; showDuplicateOptionErrorMessages(validationDataAndSchema: any, schemaItemId: any, otOptionTypeIndex: any, actualPropertyPath: any): Promise<{ data: any[]; }>; getDataTypesHasOtFormat(): DATA_TYPES[]; validateByDataType(valueToTest: any, dataType: string, isRepeating: boolean, schemaItemId: string): { schema: { $id: string; type: string; properties: { valueToTest: any; }; additionalProperties: boolean; }; model: { data: { valueToTest: any; }; id: string; }; additionalSchemas: any[]; }; getSchemaForDataType(dataType: string, isRepeating: boolean): { $id: string; type: string; properties: { valueToTest: any; }; additionalProperties: boolean; }; validateSchemaProperty(schemaItemId: any, propertyPath: string, propertyRowIndex: any): Promise<{ data: any; }>; getProblemsForConstraints(constraints: Constraint[], schemaItemId: string): Promise<{ data: any[]; }>; validateConstantInConstraint(componentRow: ComponentRow, problems: any[], iConstraint: number, iComponent: number, schemaItemId: string): Promise; processComponentValue(propertyPath: string, itemId: string, rowId: string, newValue: any, messageId?: string): Promise<{ returnValue: any; }>; getSavedDefault(propertyPath: string, config: Config, currentFormLocale: any, schemaPropertyInfo: SchemaPropertyInfo): string; getSavedMaxLength(config: Config, schemaPropertyInfo: SchemaPropertyInfo): number; getSavedDataType(config: Config, schemaPropertyInfo: SchemaPropertyInfo): any; /** * Returns the `OT options` from the form schema or the model schema. * @param {string} propertyName propertyName of the property * @returns {any} returns otOptions from the schema property if it exists. */ getSavedOTOptions(propertyPath: string, config: Config, currentFormLocale: any, schemaPropertyInfo: SchemaPropertyInfo): any; getSavedConstraintErrorMessage(propertyPath: string, config: Config, currentFormLocale: any, schemaPropertyInfo: SchemaPropertyInfo): string | undefined; getSavedEnum(config: Config, schemaPropertyInfo: SchemaPropertyInfo): any; getSavedConstraints(propertyPath: string, config: Config, schemaPropertyInfo: SchemaPropertyInfo): any[]; private getConvertedConstraints; getSavedDataSource(config: Config, propertyName: string, schemaPropertyInfo: SchemaPropertyInfo): any; getSavedDictionaryId(config: Config, propertyName: string, schemaPropertyInfo: SchemaPropertyInfo): any; getSavedPrecision(config: Config, schemaPropertyInfo: SchemaPropertyInfo): number; getSavedScale(config: Config, schemaPropertyInfo: SchemaPropertyInfo): number; getSavedCurrencyCode(config: Config, schemaPropertyInfo: SchemaPropertyInfo): any; deleteMetaDataForProperty(config: Config): void; }