UNPKG

fluig-types

Version:
191 lines (167 loc) 6.62 kB
/** @format */ interface FormControl { /** * Returns the company code of the current form record * * @returns {Number} The company code */ getCompanyId(): number; /** * Returns the document id of the current form record * * @returns {Number} the document id (form record) */ getDocumentId(): number; /** * Returns the version of the current form record * * @returns {Number} The version of the document (form record) */ getVersion(): number; /** * Returns the card index of the current form record * * @returns {Number} The card index (form record) */ getCardIndex(): number; /** * Returns the value of a field in the form. * The field name is case-insensitive, so you can use variations like "code", "Code", "CoDe", or "CODE". * * @returns {String} The value of the field */ getValue(fieldname: string): any; /** * Sets the value of a field in the form. * The field name is case-insensitive, so you can use variations like "code", "Code", "CoDe", or "CODE". * * @param {string} fieldName - The name of the field. * @param {string} fieldValue - The value to set. */ setValue(fieldName: string, fieldValue: string): void; /** * Checks if a field is enabled. * * @param {string} fieldName - The name of the field. * @returns {boolean} `true` if the field is enabled, otherwise `false`. */ getEnabled(fieldName: string): boolean; /** * Enables or disables a field in the form. * * @param {string} fieldName - The name of the field. * @param {boolean} enabled - `true` to enable the field, `false` to disable it. */ setEnabled(fieldName: string, enabled: boolean): void; /** * Enables or disables a field in the form and whether the disabled field should be protected. * When the `protect` parameter is set to `true`, the disabled field will not have its value saved in the form record. * This protection is only valid in the context of a workflow movement. * * @param {string} fieldName - The name of the field. * @param {boolean} enabled - `true` to enable the field, `false` to disable it. * @param {boolean} protect - `true` to protect the disabled field's value from being saved. */ setEnabled(fieldName: string, enabled: boolean, protect: boolean): void; /** * Sets enhanced security for hidden inputs. * When set to `true`, all fields disabled by `setEnabled` will be protected and their values will not be saved in the form record. * This function must be called before `setEnabled`. * This protection is only valid in the context of a workflow movement. * * @param {boolean} protect - `true` to enable enhanced security for hidden inputs. */ setEnhancedSecurityHiddenInputs(protect: boolean): void; /** * Gets the form's edit mode. * * @returns {string} The form mode: "ADD" for form creation, "MOD" for editing, "VIEW" for viewing, or "NONE" for no interaction. */ getFormMode(): string; /** * Hides or shows the print link button on the form. * * @param {boolean} hide - `true` to hide the print button, `false` to show it. */ setHidePrintLink(hide: boolean): void; /** * Checks if the print link button is hidden. * * @returns {boolean} `true` if the print button is hidden, otherwise `false`. */ isHidePrintLink(): boolean; /** * Hides or shows the delete button for child records in a parent-child form. * * @param {boolean} hide - `true` to hide the delete button, `false` to show it. */ setHideDeleteButton(hide: boolean): void; /** * Checks if the delete button for child records is hidden. * * @returns {boolean} `true` if the delete button is hidden, otherwise `false`. */ isHideDeleteButton(): boolean; /** * Checks if the form is being accessed on a mobile device. * * @returns {boolean} `true` if the form is accessed on a mobile device, otherwise `false`. */ getMobile(): boolean; /** * Checks if a field is visible by its name. * * @param {string} fieldName - The name of the field. * @returns {boolean} `true` if the field is visible, otherwise `false`. */ isVisible(fieldName: string): boolean; /** * Sets the visibility of a field by its name. * * @param {string} fieldName - The name of the field. * @param {boolean} visible - `true` to make the field visible, `false` to hide it. */ setVisible(fieldName: string, visible: boolean): void; /** * Checks if an HTML element is visible by its ID. * * @param {string} id - The ID of the HTML element. * @returns {boolean} `true` if the element is visible, otherwise `false`. */ isVisibleById(id: string): boolean; /** * Sets the visibility of an HTML element by its ID. * * @param {string} id - The ID of the HTML element. * @param {boolean} enabled - `true` to make the element visible, `false` to hide it. */ setVisibleById(id: string, enabled: boolean): void; /** * Gets the child fields and their values from a parent table. * * @param {string} tableName - The name of the parent table. * @returns {Map<string, string>} A map of child field names and their values. */ getChildrenFromTable(tableName: string): Map<string, string>; /** * Gets the indices of child fields in a parent table. * * @param {string} tableName - The name of the parent table. * @returns {number[]} An array of indices containing child fields in the parent table. */ getChildrenIndexes(tableName: string): number[]; /** * Whether or not to view the form in its original format with the disabled fields. * * @param {boolean} showAsDisabled disabled fields - `true` to show as disabled fields, `false` to show as text. * @returns {void} */ setShowDisabledFields(showAsDisabled: boolean): void; } declare function afterProcessing(form: FormControl): void; declare function afterSaveNew(form: FormControl): void; declare function beforeProcessing(form: FormControl): void; declare function displayFields(form: FormControl, customHTML: string): void; declare function enableFields(form: FormControl): void; declare function inputFields(form: FormControl): void; declare function validateForm(form: FormControl): void;