import { Node } from '../../core/Node.js'; /** * Table configuration options * @typedef {Object} TableConfig * @property {number} [rows=3] - Number of rows to create * @property {number} [cols=3] - Number of columns to create * @property {boolean} [withHeaderRow=false] - Create first row as header row * @property {number[]} [columnWidths] - Explicit column widths in pixels */ /** * Table indentation configuration * @typedef {Object} TableIndent * @property {number} width - Indent width in pixels * @property {string} [type='dxa'] - Indent type */ /** * Cell selection position * @typedef {Object} CellSelectionPosition * @property {number} anchorCell - Starting cell position * @property {number} headCell - Ending cell position */ /** * Configuration options for Table * @typedef {Object} TableOptions * @category Options * @property {Object} [htmlAttributes={'aria-label': 'Table node'}] - Default HTML attributes for all tables * @property {boolean} [resizable=true] - Enable column resizing functionality * @property {number} [handleWidth=5] - Width of resize handles in pixels * @property {number} [cellMinWidth=10] - Minimum cell width constraint in pixels * @property {boolean} [lastColumnResizable=true] - Allow resizing of the last column * @property {boolean} [allowTableNodeSelection=false] - Enable selecting the entire table node */ /** * Attributes for table nodes * @typedef {Object} TableAttributes * @category Attributes * @property {TableIndent} [tableIndent] - Table indentation configuration * @property {import("./tableHelpers/createTableBorders.js").TableBorders} [borders] - Border styling for this table * @property {string} [borderCollapse='collapse'] - CSS border-collapse property * @property {string} [justification] - Table alignment ('left', 'center', 'right') * @property {TableMeasurement} [tableCellSpacing] - Cell spacing for this table * @property {string} [sdBlockId] @internal - Internal block tracking ID * @property {string} [tableStyleId] @internal - Internal reference to table style * @property {string} [tableLayout] @internal - CSS table-layout property (advanced usage) */ /** * Current cell information * @typedef {Object} CurrentCellInfo * @property {Object} rect - Selected rectangle information * @property {import('prosemirror-model').Node} cell - The cell node * @property {Object} attrs - Cell attributes */ /** * @typedef {Object} TableNodeAttributes * @property {TableProperties} tableProperties * @property {TableGrid} grid */ /** * @typedef {Node} TableNode * @property {TableNodeAttributes} attrs */ /** * @module Table * @sidebarTitle Table * @snippetPath /snippets/extensions/table.mdx * @shortcut Tab | goToNextCell/addRowAfter | Navigate to next cell or add row * @shortcut Shift-Tab | goToPreviousCell | Navigate to previous cell * @shortcut Backspace | deleteTableWhenSelected | Delete table when all cells selected * @shortcut Delete | deleteTableWhenSelected | Delete table when all cells selected */ export const Table: Node, Record, Record>; /** * Theme color options */ export type ThemeColor = "dark1" | "light1" | "dark2" | "light2" | "accent1" | "accent2" | "accent3" | "accent4" | "accent5" | "accent6" | "hyperlink" | "followedHyperlink" | "none" | "background1" | "text1" | "background2" | "text2"; /** * Shading pattern options */ export type ShadingPattern = "nil" | "clear" | "solid" | "horzStripe" | "vertStripe" | "reverseDiagStripe" | "diagStripe" | "horzCross" | "diagCross" | "thinHorzStripe" | "thinVertStripe" | "thinReverseDiagStripe" | "thinDiagStripe" | "thinHorzCross" | "thinDiagCross"; /** * Shading properties */ export type ShadingProperties = { /** * - Shading color (hex without # or "auto" for automatic) */ color?: string | undefined; /** * - Shading fill color (hex without # or "auto" for automatic) */ fill?: string | undefined; /** * - Theme color name */ themeColor?: ThemeColor | undefined; /** * - Theme fill name */ themeFill?: ThemeColor | undefined; /** * - Theme fill shade (0-255 in hex format without #) */ themeFillShade?: string | undefined; /** * - Theme fill tint (0-255 in hex format without #) */ themeFillTint?: string | undefined; /** * - Theme shade (0-255 in hex format without #) */ themeShade?: string | undefined; /** * - Theme tint (0-255 in hex format without #) */ themeTint?: string | undefined; /** * - Shading pattern */ val?: ShadingPattern | undefined; }; /** * Table width options */ export type TableMeasurement = { /** * - Width value in twips */ value: number; /** * - Table width type (dxa=twips, pct=percentage, auto=automatic) */ type?: "auto" | "pct" | "dxa" | undefined; }; /** * Table look options */ export type TableLook = { /** * - Specifies that the first column conditional formatting should be applied */ firstColumn?: boolean | undefined; /** * - Specifies that the first row conditional formatting should be applied */ firstRow?: boolean | undefined; /** * - Specifies that the last column conditional formatting should be applied */ lastColumn?: boolean | undefined; /** * - Specifies that the last row conditional formatting should be applied */ lastRow?: boolean | undefined; /** * - Specifies that no horizontal banding conditional formatting should be applied */ noHBand?: boolean | undefined; /** * - Specifies that no vertical banding conditional formatting should be applied */ noVBand?: boolean | undefined; }; /** * Floating table properties */ export type FloatingTableProperties = { /** * - Specifies the minimum distance in twips which shall be maintained between the current floating table and the edge of text in the paragraph which is to the left of this floating table. */ leftFromText?: number | undefined; /** * - Specifies the minimum distance in twips which shall be maintained between the current floating table and the edge of text in the paragraph which is to the right of this floating table. */ rightFromText?: number | undefined; /** * - Specifies the minimum distance in twips which shall be maintained between the current floating table and the bottom edge of text in the paragraph which is above this floating table. */ topFromText?: number | undefined; /** * - Specifies the minimum distance in twips which shall be maintained between the current floating table and the top edge of text in the paragraph which is below this floating table. */ bottomFromText?: number | undefined; /** * - Specifies and absolute horizontal position for the floating table. The position is measured from the horizontal anchor point (horzAnchor) in twips. */ tblpX?: number | undefined; /** * - Specifies and absolute vertical position for the floating table. The position is measured from the vertical anchor point (vertAnchor) in twips. */ tblpY?: number | undefined; /** * - Horizontal anchor point for tblpX */ horzAnchor?: "text" | "page" | "margin" | undefined; /** * - Vertical anchor point for tblpY */ vertAnchor?: "text" | "page" | "margin" | undefined; /** * - Specifies a relative horizontal position for the floating table. Supercedes tblpX if both are specified. */ tblpXSpec?: "center" | "left" | "right" | "inside" | "outside" | undefined; /** * - Specifies a relative vertical position for the floating table. Supercedes tblpY if both are specified. */ tblpYSpec?: "top" | "center" | "bottom" | "inline" | "inside" | "outside" | undefined; }; /** * Table border specification */ export type TableBorderSpec = { /** * - Border style (e.g., 'single', 'double', 'dashed', etc.) */ val?: string | undefined; /** * - Border color (hex without #, e.g., 'FF0000' for red) */ color?: string | undefined; /** * - Theme color name */ themeColor?: ThemeColor | undefined; /** * - Theme tint (0-255 in hex format without #) */ themeTint?: string | undefined; /** * - Theme shade (0-255 in hex format without #) */ themeShade?: string | undefined; /** * - Border size in eighths of a point (e.g., 8 = 1pt, 16 = 2pt) */ size?: number | undefined; /** * - Space in points between border and text */ space?: number | undefined; /** * - Whether the border has a shadow */ shadow?: boolean | undefined; /** * - Whether the border is a frame */ frame?: boolean | undefined; }; /** * Table borders properties */ export type TableBorders = { /** * - Bottom border specification */ bottom?: TableBorderSpec | undefined; /** * - End (right in LTR, left in RTL) border specification */ end?: TableBorderSpec | undefined; /** * - Inside horizontal border specification */ insideH?: TableBorderSpec | undefined; /** * - Inside vertical border specification */ insideV?: TableBorderSpec | undefined; /** * - Left border specification */ left?: TableBorderSpec | undefined; /** * - Right border specification */ right?: TableBorderSpec | undefined; /** * - Start (left in LTR, right in RTL) border specification */ start?: TableBorderSpec | undefined; /** * - Top border specification */ top?: TableBorderSpec | undefined; }; /** * Table cell margin properties */ export type TableCellMargins = { /** * - Top cell margin */ top?: TableMeasurement | undefined; /** * - Left cell margin */ left?: TableMeasurement | undefined; /** * - Bottom cell margin */ bottom?: TableMeasurement | undefined; /** * - Start cell margin (left in LTR, right in RTL) */ start?: TableMeasurement | undefined; /** * - End cell margin (right in LTR, left in RTL) */ end?: TableMeasurement | undefined; /** * - Right cell margin */ right?: TableMeasurement | undefined; }; /** * Table properties */ export type TableProperties = { /** * - Specifies that the cells with this table shall be visually represented in a right to left direction */ rightToLeft?: boolean | undefined; /** * - The alignment of the set of rows which are part of the current table. */ justification?: "center" | "start" | "left" | "right" | "end" | undefined; /** * - Shading properties for the table */ shading?: ShadingProperties | undefined; /** * - Caption text for the table */ caption?: string | undefined; /** * - Description text for the table */ description?: string | undefined; /** * - Cell spacing */ tableCellSpacing?: TableMeasurement | undefined; /** * - Table indentation */ tableIndent?: TableMeasurement | undefined; /** * - Table layout algorithm */ tableLayout?: "fixed" | "autofit" | undefined; /** * - Various boolean flags that affect the rendering of the table */ tblLook?: TableLook | undefined; /** * - Specifies whether the current table should allow other floating tables to overlap its extents when the tables are displayed in a document */ overlap?: "never" | "overlap" | undefined; /** * - Reference to table style ID */ tableStyleId?: string | undefined; /** * - Number of columns for which the table style is applied */ tableStyleColBandSize?: number | undefined; /** * - Number of rows for which the table style is applied */ tableStyleRowBandSize?: number | undefined; /** * - Table width */ tableWidth?: TableMeasurement | undefined; /** * - Floating table properties */ floatingTableProperties?: FloatingTableProperties | undefined; /** * - Table border configuration */ borders?: TableBorders | undefined; /** * - Cell margin configuration */ cellMargins?: TableCellMargins | undefined; }; /** * Column width definition */ export type ColWidth = { /** * - Column width in twips */ col: number; }; /** * Table grid definition */ export type TableGrid = { /** * - Array of column widths in twips */ colWidths?: ColWidth[] | undefined; }; /** * Row template formatting */ export type RowTemplateFormatting = { /** * - Node type used when building cell content */ blockType: import('prosemirror-model').NodeType; /** * - Attributes to apply to the created block node */ blockAttrs: Object | null; /** * - Marks copied from the template text node */ textMarks: Array; }; /** * Build row from template row parameters */ export type BuildRowFromTemplateRowParams = { /** * - Editor schema */ schema: import('prosemirror-model').Schema; /** * - Table node used for column map lookup */ tableNode: import('prosemirror-model').Node; /** * - Row providing structure and formatting */ templateRow: import('prosemirror-model').Node; /** * - Values to populate each table cell */ values: any[]; /** * - Clone template marks and block attrs when true */ copyRowStyle?: boolean | undefined; }; /** * Append rows to the end of a table in a single transaction. */ export type appendRowsWithContentOptions = { /** * - Absolute position of the target table; required when `tableNode` is not provided */ tablePos?: number | undefined; /** * - Table node reference; required when `tablePos` is not provided */ tableNode?: import('prosemirror-model').Node | undefined; /** * - Cell values for each appended row */ valueRows: string[][]; /** * - Clone template styling when true */ copyRowStyle?: boolean | undefined; }; /** * Insert rows at table end parameters */ export type InsertRowsAtTableEndParams = { /** * - Transaction to mutate */ tr: import('prosemirror-state').Transaction; /** * - Absolute position of the target table */ tablePos: number; /** * - Table node receiving new rows */ tableNode: import('prosemirror-model').Node; /** * - Row nodes to append */ rows: import('prosemirror-model').Node[]; }; /** * Table configuration options */ export type TableConfig = { /** * - Number of rows to create */ rows?: number | undefined; /** * - Number of columns to create */ cols?: number | undefined; /** * - Create first row as header row */ withHeaderRow?: boolean | undefined; /** * - Explicit column widths in pixels */ columnWidths?: number[] | undefined; }; /** * Table indentation configuration */ export type TableIndent = { /** * - Indent width in pixels */ width: number; /** * - Indent type */ type?: string | undefined; }; /** * Cell selection position */ export type CellSelectionPosition = { /** * - Starting cell position */ anchorCell: number; /** * - Ending cell position */ headCell: number; }; /** * Configuration options for Table */ export type TableOptions = Object; /** * Attributes for table nodes */ export type TableAttributes = Object; /** * Current cell information */ export type CurrentCellInfo = { /** * - Selected rectangle information */ rect: Object; /** * - The cell node */ cell: import('prosemirror-model').Node; /** * - Cell attributes */ attrs: Object; }; export type TableNodeAttributes = { tableProperties: TableProperties; grid: TableGrid; }; export type TableNode = Node; //# sourceMappingURL=table.d.ts.map