import type { Form } from './Form'; import type { IFormCollection } from './IFormCollection'; import { ReadOnlyFormCollection } from './ReadOnlyFormCollection'; /** * Represents a configurable observable collection of forms. Callbacks can be configured for setting up individual * form sections for cases where validation and other aspects are based on the state of an entity or the form itself. * * @template TForm The concrete type of the form. * @template TValidationError The concrete type for representing validation errors (strings, enums, numbers etc.). * * @see {@linkcode Form} */ export declare class FormCollection, TValidationError = string> extends ReadOnlyFormCollection implements IFormCollection { /** * Initializes a new instance of the {@linkcode FormCollection} class. * @param sections The sections to initialize the collection with. */ constructor(sections?: Iterable); /** * Gets or sets the number of items in the collection. * @see [Array.length](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/length) */ get length(): number; /** * Gets or sets the number of items in the collection. * @see [Array.length](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/length) */ set length(value: number); /** * Appends new elements to the end of the collection, and returns the new length of the collection. * @param items New elements to add at the end of the collection. * @returns The new length of the collection. * @see [Array.push](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/push) */ push(...items: readonly TForm[]): number; /** * Removes the last element from the collection and returns it. If the collection is empty, `undefined` is returned. * @returns The last element in the collection that was removed. * @see [Array.pop](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/pop) */ pop(): TForm | undefined; /** * Inserts new elements at the start of the collection, and returns the new length of the collection. * @param items Elements to insert at the start of the collection. * @returns The new length of the collection. * @see [Array.unshift](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift) */ unshift(...items: readonly TForm[]): number; /** * Removes the first element from the collection and returns it. If the collection is empty, `undefined` is returned. * @returns The first element in the collection that was removed. * @see [Array.shift](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/shift) */ shift(): TForm | undefined; /** * Gets the item at the provided index. * @param index The index from which to retrieve an item. * @returns The item at the provided index. * @see [Array.at](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/at) */ get(index: number): TForm; /** * Sets the provided item at the provided index. * @param index The index to which to set the item. * @param item The item to set. * @returns The length of the collection. */ set(index: number, item: TForm): number; /** * Removes and/or adds elements to the collection and returns the deleted elements. * @param start The zero-based location in the collection from which to start removing elements. * @param deleteCount The number of elements to remove. * @param items The items to insert at the given start location. * @returns An array containing the elements that were deleted. * @see [Array.splice](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) */ splice(start: number, deleteCount?: number, ...items: readonly TForm[]): TForm[]; /** * Reverses the items in the collections and returns the observable collection. * @param compareCallback Optional, a callback used to determine the sort order between two items. * @returns The observable collection on which the operation is performed. * @see [Array.sort](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) */ sort(compareCallback?: (left: Exclude, right: Exclude) => number): this; /** * Reverses the items in the collections and returns the observable collection.. * @returns The observable collection on which the operation is performed. * @see [Array.reverse](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse) */ reverse(): this; /** * Copies items inside the collection overwriting existing ones. * @param target The index at which to start copying items, accepts both positive and negative values. * @param start The index from which to start copying items, accepts both positive and negative values. * @param end The index until where to copy items, accepts both positive and negative values. * @see [Array.copyWithin](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin) */ copyWithin(target: number, start: number, end?: number): this; /** * Fills the collection with the provided `item`. * @param item The item to fill the collection with. * @param start The index from which to start filling the collection, accepts both positive and negative values. * @param end The index until which to fill the collection, accepts both positive and negative values. * @returns The observable collection on which the operation is performed. * @see [Array.fill](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/fill) */ fill(item: TForm, start?: number, end?: number): this; }