/** * Move a control the file itself defines to another place among its siblings. * * add-control could only put a control where it was created, and only on a form * extension: on a plain AxForm the bridge's AddControl appends to the parent * (`parent.Controls.Add`) and previousSibling/positionType never reached it. Once a * control existed nothing could move it — add-control again answered "already * present — skipped" with a ✅, and modify-property refuses PositionType and * PreviousSibling because no control type carries them (in an extension they belong * to the envelope, not to the control). An agent that had * just added display-method fields to a custom form could not put them next to the * field they belong with. * * Where a control sits is expressed in one of two ways, and this module writes * whichever the control already uses: * * - ORDER — on an AxForm, and for a control nested under a container the * extension owns, position is the control's place in its parent's . * The control's element is cut and spliced back after the sibling (or first, or * last), byte for byte, indentation and all. * - ENVELOPE — a control an extension adds to a BASE-form parent sits in an * whose / place it among * children the extension file does not contain. Those two elements are * rewritten after , in the order shipped metadata uses (see * envelopeControlLines in formExtensionControlXml.ts). * * Only within the same parent: moving to another container changes what the * control is part of (a field group, a grid), which is remove-control + add-control. * * Pure and side-effect-free; the file I/O stays in the caller. */ export interface PlaceFormControlSpec { /** of the control to move (case-insensitive). */ controlName: string; /** The parent the caller expects; a different current parent is refused, not silently ignored. */ parentControl?: string; /** Sibling to place the control after. Implies AfterItem. */ previousSibling?: string; /** "AfterItem" (with previousSibling), "Begin" or "End". */ positionType?: string; } export type PlaceFormControlResult = /** `changed` is false when the control already sat there; `detail` says where it is now. */ { kind: 'placed'; xml: string; changed: boolean; detail: string; } | { kind: 'refused'; message: string; } /** No live control of that name in this file. */ | { kind: 'not-found'; present: string[]; } | { kind: 'unsupported'; }; /** Whether the file defines a live control of this name — what add-control asks before adding. */ export declare function formDefinesControl(xml: string, controlName: string): boolean; /** * The live control of this name the file defines: its own spelling, its parent, and * whether that parent is the one the caller named (`requestedParent`; a design-root * name such as "FormDesign" counts as "Design"). Undefined when there is none. */ export declare function findFormControl(xml: string, controlName: string, requestedParent?: string): { name: string; parentName: string; inRequestedParent: boolean; } | undefined; /** * Whether a control can be put where add-control asks, checked BEFORE the bridge * adds it: the bridge appends and saves, so a position found wrong afterwards * leaves the control written at the end. Returns the refusal, or undefined to go * ahead — also when the parent is not in the file, which is the bridge's to report. */ export declare function checkNewControlPosition(xml: string, spec: PlaceFormControlSpec): string | undefined; /** * Shipped metadata is CRLF and the writers hand this module LF; either works. The * splice works on LF lines, and a CRLF document comes back CRLF, never mixed. */ export declare function placeFormControl(xml: string, spec: PlaceFormControlSpec): PlaceFormControlResult; //# sourceMappingURL=formControlPlacement.d.ts.map