/** * Sets form field values from a data object using the name attribute. * Supports dot notation for accessing nested properties and array handling. * * When `context` is provided, `` options * * @example * // Basic usage with flat object * const form = document.querySelector('form'); * const data = { name: 'John', email: 'john@example.com' }; * setFormData(form, data); * * @example * // Using with nested objects via dot notation * const form = document.querySelector('form'); * const data = { * user: { * name: 'John', * contact: { * email: 'john@example.com' * } * } * }; * // Form has fields with names like "user.name" and "user.contact.email" * setFormData(form, data); * * @example * // Using with simple arrays using [] notation * const form = document.querySelector('form'); * const data = { * hobbies: ['Reading', 'Cycling', 'Cooking'] * }; * // Form has multiple fields with names like "hobbies[]" * setFormData(form, data); * * @example * // Using with array of objects using numeric indexers * const form = document.querySelector('form'); * const data = { * users: [ * { name: 'John', email: 'john@example.com' }, * { name: 'Jane', email: 'jane@example.com' } * ] * }; * // Form has fields with names like "users[0].name", "users[1].email", etc. * setFormData(form, data); * * @example * // Populating a * setFormData(form, { country: 'se' }, { * country: [ * { value: 'se', text: 'Sweden' }, * { value: 'us', text: 'United States' } * ] * }); * * @example * // Using data-source with custom value/text properties * // * setFormData(form, { country: 2 }, { * countries: [ * { id: 1, name: 'Sweden' }, * { id: 2, name: 'United States' } * ] * }); * * @example * // data-source as a method on context * // * setFormData(form, { country: 'se' }, { * getCountries: () => [ * { value: 'se', text: 'Sweden' }, * { value: 'us', text: 'United States' } * ] * }); * * @example * // Grouping options into using a third field in data-source * // * setFormData(form, { country: 2 }, { * countries: [ * { id: 1, name: 'Sweden', region: 'Europe' }, * { id: 2, name: 'United States', region: 'Americas' }, * { id: 3, name: 'Germany', region: 'Europe' } * ] * }); * // Produces two elements, "Europe" and "Americas", in the * // order each group first appears in the items array. */ export declare function setFormData(form: HTMLFormElement, data: object, context?: object): void;