docxml
Version:
TypeScript (component) library for building and parsing a DOCX file
48 lines (47 loc) • 1.73 kB
TypeScript
import './Cell.js';
import { type ComponentAncestor, Component, ComponentContext } from '../classes/Component.js';
import { type TableRowProperties } from '../properties/table-row-properties.js';
import { type Cell } from './Cell.js';
import { type RowAddition } from './RowAddition.js';
import { type RowDeletion } from './RowDeletion.js';
/**
* A type describing the components accepted as children of {@link Row}.
*/
export declare type RowChild = Cell;
/**
* A type describing the props accepted by {@link Row}.
*/
export declare type RowProps = TableRowProperties;
/**
* For drying some logic between {@link Row}, {@link RowAddition} and {@link RowDeletion}
*
* Parses the children (and no props yet) from an existing XML node.
*/
export declare function parsePropsAndChildNodes(node: Node): RowProps & {
children: Node[];
};
/**
* For drying some logic between {@link Row}, {@link RowAddition} and {@link RowDeletion}
*
* Creates an XML node for a given row.
*/
export declare function createNodeFromRow(row: Row | RowAddition | RowDeletion, ancestry: ComponentAncestor[]): Promise<Node>;
/**
* A component that represents a table row.
*/
export declare class Row extends Component<RowProps, RowChild> {
static readonly children: string[];
static readonly mixed: boolean;
/**
* Creates an XML DOM node for this component instance.
*/
toNode(ancestry: ComponentAncestor[]): Promise<Node>;
/**
* Asserts whether or not a given XML node correlates with this component.
*/
static matchesNode(node: Node): boolean;
/**
* Instantiate this component from the XML in an existing DOCX file.
*/
static fromNode(node: Node, context: ComponentContext): Row;
}