import { Logger } from '../../common/utils'; import { BaseComponent } from '../base'; import { ComponentNames } from '../types'; import { FormElementsProps } from './types'; export declare class FormElements extends BaseComponent { name: ComponentNames; protected logger: Logger; private localParticipant; private fields; private fieldsOriginalOutline; private focusList; private enabledOutlineFields; private enabledRealtimeSyncFields; private flags; private readonly allowedTagNames; private readonly allowedInputTypes; private readonly throwError; constructor(props?: FormElementsProps); /** * @function enableOutline * @description Enables changes in the color of the outline of a field. Color changes are triggered when, in general, another participant interacts with the field on their side AND they also have color changes enabled. * * Enabling this feature through this method overrides the global flag "disableOutline" set in the constructor for this particular input. * @param fieldId The id of the input field or textarea that will have its outline color changed * @returns {void} */ enableOutline(fieldId: string): void; /** * @function disableOutline * @description Disables changes in the color of the outline of a field. * * Disabling this feature through this method overrides the global flag "disableOutline" set in the constructor for this particular input. * @param fieldId The id of the input field or textarea that will have its outline color changed * @returns {void} */ disableOutline(fieldId: string): void; /** * @function enableRealtimeSync * @description Enables the synchronization of the content of a field in real time. The content of the field will be updated in real time when another participant interacts with the field on their side AND they also have content synchronization enabled. * * "Content" may refer to the value the user has typed or selected, or the status of the field (checked or not), depending on the type of field. * * Enabling this feature through this method overrides the global flag "disableRealtimeSync" set in the constructor for this particular input. * @param fieldId The id of the input field or textarea that will have its content synchronized * @returns {void} */ enableRealtimeSync(fieldId: string): void; /** * @function disableRealtimeSync * @description Disables the synchronization of the content of a field in real time. * * Disabling this feature through this method overrides the global flag "disableRealtimeSync" set in the constructor for this particular input. * * @param fieldId The id of the input field or textarea that will have its content synchronized * @returns {void} */ disableRealtimeSync(fieldId: string): void; /** * @function sync * @description Sends the value of the field to every other participant with the realtime sync enabled for this field. * * This method is useful when you want to update the content of a field without waiting for the user to interact with it. * * If realtime sync is disabled for the field, even though the content won't be updated, every other participant receives an event with details about the sync attempt. * @param fieldId */ sync: (fieldId: string) => void; /** * @function registerField * @description Registers a field element. A registered field will be monitored and most interactions with it will be shared with every other user in the room that is tracking the same field. Examples of common interactions that will be monitored include typing, focusing, and blurring, but more may apply. * @param {string} fieldId The id of the field that will be registered * @returns {void} */ registerField(fieldId: string): void; /** * @function deregisterField * @description Deregisters a single field * @param {string} fieldId The id of the field that will be deregistered * @returns {void} */ deregisterField(fieldId: string): void; /** * @function start * @description starts the component * @returns {void} * */ protected start(): void; /** * @function destroy * @description destroys the component * @returns {void} * */ protected destroy(): void; /** * @function addListenersToField * @description Adds listeners to a field * @param {Field} field The field that will have the listeners added * @returns {void} */ private addListenersToField; /** * @function addRealtimeListenersToField * @description Adds realtime listeners to a field * @param {string} fieldId The id of the field that will have the listeners added * @returns {void} */ private addRealtimeListenersToField; /** * @function removeListenersFromField * @description Removes listeners from a field * @param {Field} field The field that will have the listeners removed * @returns {void} */ private removeListenersFromField; /** * @function removeRealtimeListenersFromField * @description Removes realtime listeners from a field * @param {string} fieldId The id of the field that will have the listeners removed * @returns {void} */ private removeRealtimeListenersFromField; /** * @function deregisterAllFields * @description Deregisters an element. No interactions with the field will be shared after this. * @returns {void} */ private deregisterAllFields; /** * @function handleInput * @description Handles the input event on an input element * @param {Event} event The event that triggered the function * @returns {void} */ private handleInput; /** * @function handleChange * @description Handles the change event on an input element * @param {Event} event The event that triggered the function * @returns {void} */ private handleChange; /** * @function handleFocus * @description Handles the focus event on an input element * @param {Event} event The event that triggered the function * @returns {void} */ private handleFocus; /** * @function handleBlur * @description Handles the blur event on an input element * @param {Event} event The event that triggered the function * @returns {void} */ private handleBlur; /** * @function validateField * @description Verifies if an element can be registered * @param {Field} field The element * @returns {void} */ private validateField; /** * @function validateFieldTagName * @description Verifies if the element has one of the allowed tag names that can be registered * @param {Field} field The element that will be checked * @returns {void} */ private validateFieldTagName; /** * @function validateFieldType * @description Checks if an input element has one of the allowed types that can be registered * @param {Field} field The element that will be checked * @returns {void} */ private validateFieldType; private validateFieldId; /** * @function removeFieldColor * @description Resets the outline of a field to its original value * @param {SocketEvent} event The payload from the event * @returns {void} A function that will be called when the event is triggered */ private removeFieldColor; /** * @function updateFieldColor * @description Changes the outline of a field to the color of the participant that is interacting with it, following the rules defined in the function * @param {SocketEvent} event The payload from the event * @returns {void} */ private updateFieldColor; /** * @function updateFieldContent * @description Updates the content of a field * @param {string} fieldId The id of the field that will have its content updated * @returns {void} */ private updateFieldContent; private publishTypedEvent; /** * @function restoreOutlines * @description Restores the outline of all fields to their original value * @returns {void} */ private restoreOutlines; private hasCheckedProperty; private canUpdateColor; private canSyncContent; }