/*! Copyright © 2024 Open Text Corporation, All Rights Reserved. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import { OcpdConfigurationManager, OcpdStringLocalizationHelper } from '../ocpd-common-components'; import { OcpdFormClientAPIService } from './ocpd-form-client-api-service'; import { OcpdItemManagerHelper } from './ocpd-item-manager-helper'; import { Constraint, ComponentRow, ConstraintComponentModel } from './ocpd-constraints-config'; import { ConstraintsEditor } from '../models/localization-types'; import { OtConstraint } from '@opentext/forms-common'; import { FormControlConfig } from '@opentext/forms-types'; export declare class OcpdConstraintsManager { private static _instance; private readonly STALE_CONSTRAINTS_MODEL_ID; private readonly TYPE_CHANGE_CONSTRAINTS_MODEL_ID; private readonly FALLBACK_DATA_TYPE; readonly COMPONENT_ROOT_MODEL_SCHEMA_IDS_PREFIX = "exp-root"; readonly COMPONENT_DEFAULT_MODELS_PREFIX = "exp-default"; readonly COMPONENT_SCHEMA_ID = "https://www.opentext.com/ocp/devx/ui/2.0.0/Component"; readonly COMPONENT_ROOT_MODEL_SCHEMA_ID = "https://www.opentext.com/ocp/devx/ui/2.0.0/ComponentRootModel"; _ocpdItemManagerHelper: OcpdItemManagerHelper; _ocpdFormClientAPIService: OcpdFormClientAPIService; _ocpdStringLocalizationHelper: OcpdStringLocalizationHelper; _ocpdConfigurationManager: OcpdConfigurationManager; _rootModelIDs: Record; _defaultModelIDs: Record; _localeDataConstraintsEditor: ConstraintsEditor; constructor(_ocpdItemManagerHelper: OcpdItemManagerHelper); getConfigurationManager(): OcpdConfigurationManager; userInterfaceLocaleChanged(locale?: string): Promise; private updateLoadedModelTooltips; private updateLoadedModelTexts; getStaleConstraintsModelId(): string; getTypeChangeConstraintsModelId(): string; isEditConstraintModelId(itemId: string): boolean; /** * Initializes the model ID mappings for root and default component models */ initializeModelIdMappings(): void; /** * Initializes component models for all supported data types */ initializeComponentModels(): void; /** * Builds a new constraint object for a given property * @param propertyName - The name of the property to build the constraint for * @returns {Constraint} The constructed Constraint object */ getNewConstraintSkeleton(propertyName: string, config: FormControlConfig, rowId: string): Constraint; /** * Gets available component models for a specific row index * @param {string} rowIndex - The row index to get available models for * @param {FormControlConfig} config * @returns {ConstraintComponentModel[]} An array of available component models for the given row index */ getAvailableComponentModels(rowIndex: string, config: FormControlConfig, itemId: string): ConstraintComponentModel[]; private isStalePropertyModel; /** * Loads a field model for the specified property name * Creates and registers a field property component model based on the property's schema definition * @param {FormControlConfig} config */ loadPropertyComponentModel(config: FormControlConfig): void; /** * Deletes the component model for a specific property * @param {FormControlConfig} config * @param {string} [dataType] - Optional data type to avoid having to resolve it again if already known */ deletePropertyComponentModel(config: FormControlConfig, dataType?: string): void; /** * Updates the component model and constraint references when a property's name is changed * @param {string} oldPropertyName - The old name of the property before the change * @param {string} newPropertyName - The new name of the property after the change * @param {FormControlConfig} config */ updatePropertyNameInConstraints(oldPropertyName: string, newPropertyName: string, config: FormControlConfig): void; updateTypeInComponentModel(oldType: string, newType: string, config: FormControlConfig): void; /** * Converts saved constraint components into component rows for a constraint * @param {FormControlConfig} config * @param constraint - The constraint object to which the component rows will be added * @param savedConstraint - The saved constraint containing the components to be converted */ convertSavedComponents(config: FormControlConfig, constraint: Constraint, savedConstraint: OtConstraint): void; /** * Determines the component ID for a follow-up component based on the saved constraint's component value and type */ updateConstraints(config: FormControlConfig, oldComponentValue: any, newComponentValue: any, workingModel: any, rowIndex: string, schemaItemId: string, hasErrors?: boolean): Promise; removeAllUndoEntriesForConstraints(itemId: string, propertyPath: string): void; private getRootModelIdByDataType; private getDefaultModelIdByDataType; private createComponentRow; private createFollowUpComponentRow; private getComponentOutputDataType; private getPreviousConcreteDataType; private getModelsFromRoot; private isModelCompatibleWithPrevious; private isKeyBlockedByPrecedingKey; private isCurrentModelValidInSlot; doesBothFunctionsHaveCompatibleDataTypes(previousModel: ConstraintComponentModel, currentModel: ConstraintComponentModel, constraint: Constraint, currentComponentRow: ComponentRow): boolean; private isCurrentCompatibleWithPrevious; private isValidAfterConstantProperty; private isCompatibleWithArrayType; private clearOldModels; private loadDefaultComponentModel; private loadDefaultComponentModelsForArrayType; private loadRootComponentModel; private loadComponentModel; private getSupportedModelsForDataType; private getAllPropertyModelsByDataType; private findPropertyComponentModel; private getSchemaProperty; private getDataTypeFromSchema; private isArrayTypeProperty; private getPropertyIdFromComponentValue; private createModelsFromConfig; private createPropertyComponent; private removeIncompatibleFollowUpComponents; private shouldRemoveFollowUpComponents; private isEmptyConstantComponent; private constraintAlreadyHasCondition; private isConstraintComplete; private isConstantComponentComplete; }