@linid-dm/directory-manager-client-core
Version:
Core package by providing a set of angular components for the Directory Manager app.
100 lines (99 loc) • 7.43 kB
TypeScript
/**
* Copyright (C) 2020-2024 Linagora
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version, provided you comply with the Additional Terms applicable for
* LinID Directory Manager software by LINAGORA pursuant to Section 7 of the GNU
* Affero General Public License, subsections (b), (c), and (e), pursuant to
* which these Appropriate Legal Notices must notably (i) retain the display of
* the "LinID™" trademark/logo at the top of the interface window, the display
* of the “You are using the Open Source and free version of LinID™, powered by
* Linagora © 2009–2013. Contribute to LinID R&D by subscribing to an Enterprise
* offer!” infobox and in the e-mails sent with the Program, notice appended to
* any type of outbound messages (e.g. e-mail and meeting requests) as well as
* in the LinID Directory Manager user interface, (ii) retain all hypertext
* links between LinID Directory Manager and https://linid.org/, as well as
* between LINAGORA and LINAGORA.com, and (iii) refrain from infringing LINAGORA
* intellectual property rights over its trademarks and commercial brands. Other
* Additional Terms apply, see <http://www.linagora.com/licenses/> for more
* details.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License and
* its applicable Additional Terms for LinID Directory Manager along with this
* program. If not, see <http://www.gnu.org/licenses/> for the GNU Affero
* General Public License version 3 and <http://www.linagora.com/licenses/> for
* the Additional Terms applicable to the LinID Directory Manager software.
*/
import { AbstractControl, FormGroup, FormGroupDirective, NgForm, ValidatorFn } from '@angular/forms';
import { ErrorStateMatcher } from '@angular/material/core';
import { IAttribute } from '../interfaces/configs.interface';
import { FormDataValueTypes, IDataDetail, IDataDetailResource, IFormData, ILink } from '../interfaces/data.interface';
import { FormFieldsAllTypes, FormFieldsExtendedSingleTypes, IAutocompleteOption, IFormFieldControl, IInitFormsAutocompleteField, ISelectOption } from '../interfaces/form.interface';
import { IAdvancedSearchChip } from '../interfaces/ui.interface';
export declare function getAdvancedSearchChipsFromFormData(formData: IFormData[]): IAdvancedSearchChip[];
export declare function getSelectionOptionValue(option: ISelectOption): string;
export declare function setFormFieldDataValue(formData: IFormData, dataValue: FormDataValueTypes, dateDisplayFormat: string): void;
export declare function getFormFieldError(formFieldControl: AbstractControl, attributeConfig: IAttribute): string;
export declare function setDataAttribute(data: string | string[] | boolean | IDataDetailResource | IDataDetailResource[], attributeConfig: IAttribute, dateDisplayFormat: string): IDataDetail;
export declare class FormErrorStateMatcher implements ErrorStateMatcher {
isErrorState(control: AbstractControl | null, _form: FormGroupDirective | NgForm | null): boolean;
}
export declare function concatOldValuesToNewValue(valuesForm: any, formData: IFormData[], prefix?: string): any;
export declare function concatTextAreaContent(addedText: string, currentText?: string): string;
export declare function convertAutocompleteInputValueForRequestBody(checkoutFormValues: {
[id: string]: FormFieldsExtendedSingleTypes;
}, autocompleteOptions: {
[modelRef: string]: IAutocompleteOption[];
}, formPreviousState: {
[key: string]: IFormFieldControl;
}, loadedAutocompletesModelRef: string[]): {
[id: string]: FormDataValueTypes;
};
export declare function convertInputValueToAutocompleteOption(inputValue: string, autocompleteOptions: IAutocompleteOption[]): IAutocompleteOption;
export declare function convertBooleanToString(valuesForm: any, formConfig: IFormData[]): any;
export declare function convertToScimObject(valuesForm: any, formConfig: IFormData[], entryId: string, dataElementExternalId: string, schemas: string[]): any;
export declare function formatDatepickerForm(valuesForm: any, formConfig: IFormData[], dateDisplayFormat: string): any;
export declare function getAuthorWithDate(displayName: string, language: string): string;
export declare function getFilteredOptionsOnInitialState(isInputChipsAutocomplete: boolean, autoCompleteOptions: IAutocompleteOption[], formPreviousStateField: IAutocompleteOption | IAutocompleteOption[]): IAutocompleteOption[];
export declare function getFormAutocompleteFieldInitialValue(fieldValue: ILink | ILink[], currentObject: IAutocompleteOption, formInitialStateFieldValue: FormFieldsAllTypes, formPreviousStateFieldValue: FormFieldsAllTypes): IInitFormsAutocompleteField;
export declare function getFormErrors(form: FormGroup, formData: IFormData[], formFields: {
[modelRef: string]: string;
}): any;
export declare function getLinkedFieldsValues(linkedFieldsModelRefs: string[], formPreviousState: {
[key: string]: IFormFieldControl;
}): string[];
export declare function isAutocompleteOption(fieldValue: FormFieldsAllTypes): boolean;
export declare function isAutocompleteOptionArray(fieldValue: FormFieldsAllTypes): boolean;
export declare function getOptionsFilteringCondition(inputValue: string | IAutocompleteOption, isInputChipsAutocomplete: boolean, formPreviousStateFieldValue: IAutocompleteOption | IAutocompleteOption[]): (param: string) => boolean;
export declare function inputValueIsNotAnOption(filteredOptions: {
[modelRef: string]: IAutocompleteOption[];
}, modelRef: string): ValidatorFn;
export declare function inputValueIsNotAnOptionSimpleAutocomplete(filteredOptions: {
[modelRef: string]: IAutocompleteOption[];
}, modelRef: string): ValidatorFn;
export declare function isAutocompleteInitialState(inputValue: string | IAutocompleteOption, isInputChipsAutocomplete: boolean, formPreviousStateField: IAutocompleteOption | IAutocompleteOption[], formInitialStateField: IAutocompleteOption | IAutocompleteOption[]): boolean;
export declare function isFormFieldDisabled(checkedField: IFormData | IAttribute, crudAction?: string): boolean;
export declare function isFormFieldDisplayed(field: IFormData, crudAction: string): boolean;
export declare function keepFieldInRequestBody(fieldComponentName: string, fieldValue: FormDataValueTypes, initialValue: IFormFieldControl, autocompleteOptionsLoaded: boolean, crudAction: string): boolean;
export declare function resizeImage(width: number, height: number, maxWidth: number, maxHeight: number): {
width: number;
height: number;
};
export declare function saveCheckoutFormState(checkoutFormValues: {
[modelRef: string]: FormFieldsExtendedSingleTypes | ILink | ILink[];
}, formData: IFormData[], crudAction: string): {
[key: string]: IFormFieldControl;
};
export declare function setFormControlValue(field: IFormData): FormDataValueTypes;
export declare function trimFormFieldsValues(formFieldsValues: {
[id: string]: FormDataValueTypes;
}): {
[id: string]: FormDataValueTypes;
};