Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@udecode/plate-table

Package Overview
Dependencies
Maintainers
2
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@udecode/plate-table - npm Package Compare versions

Comparing version 38.0.0 to 38.0.1

dist/getEmptyTableNode-BTpZEVNY.d.mts

86

dist/index.d.ts
import * as slate from 'slate';
import { Path, Location } from 'slate';
import * as _udecode_slate from '@udecode/slate';
import { B as BorderDirection, T as TableStoreCellAttributes, C as CreateCellOptions, a as TTableCellElement, b as TableConfig, c as TTableElement, d as TableStoreSizeOverrides } from './getEmptyTableNode-DdWndQ-f.js';
export { f as BorderStyle, G as GetEmptyRowNodeOptions, k as GetEmptyTableNodeOptions, g as TTableRowElement, e as TableApi, j as getEmptyRowNode, l as getEmptyTableNode, i as insertTableColumn, h as insertTableRow } from './getEmptyTableNode-DdWndQ-f.js';
import * as _udecode_plate_common from '@udecode/plate-common';
import { B as BorderDirection, T as TableStoreCellAttributes, C as CreateCellOptions, a as TTableCellElement, b as TableConfig, c as TTableElement, d as TableStoreSizeOverrides } from './getEmptyTableNode-BTpZEVNY.js';
export { f as BorderStyle, G as GetEmptyRowNodeOptions, k as GetEmptyTableNodeOptions, g as TTableRowElement, e as TableApi, j as getEmptyRowNode, l as getEmptyTableNode, i as insertTableColumn, h as insertTableRow } from './getEmptyTableNode-BTpZEVNY.js';
import * as _udecode_plate_core from '@udecode/plate-core';
import { SlateEditor, TEditor, GetAboveNodeOptions, ExtendEditor, TNodeEntry, TElement } from '@udecode/plate-common';

@@ -12,4 +12,4 @@

declare const setBorderSize: (editor: SlateEditor, size: number, { at, border, }?: {
at?: Path | undefined;
border?: "all" | BorderDirection | undefined;
at?: Path;
border?: BorderDirection | "all";
}) => void;

@@ -31,17 +31,17 @@

declare const TableRowPlugin: _udecode_plate_common.SlatePlugin<_udecode_plate_common.PluginConfig<"tr", {}, {}, {}>>;
declare const TableCellPlugin: _udecode_plate_common.SlatePlugin<_udecode_plate_common.PluginConfig<"td", {}, {}, {}>>;
declare const TableCellHeaderPlugin: _udecode_plate_common.SlatePlugin<_udecode_plate_common.PluginConfig<"th", {}, {}, {}>>;
declare const BaseTableRowPlugin: _udecode_plate_core.SlatePlugin<_udecode_plate_core.PluginConfig<"tr", {}, {}, {}>>;
declare const BaseTableCellPlugin: _udecode_plate_core.SlatePlugin<_udecode_plate_core.PluginConfig<"td", {}, {}, {}>>;
declare const BaseTableCellHeaderPlugin: _udecode_plate_core.SlatePlugin<_udecode_plate_core.PluginConfig<"th", {}, {}, {}>>;
/** Enables support for tables. */
declare const TablePlugin: _udecode_plate_common.SlatePlugin<_udecode_plate_common.PluginConfig<"table", {
_cellIndices?: TableStoreCellAttributes | undefined;
disableExpandOnInsert?: boolean | undefined;
disableMarginLeft?: boolean | undefined;
enableMerging?: boolean | undefined;
enableUnsetSingleColSize?: boolean | undefined;
initialTableWidth?: number | undefined;
minColumnWidth?: number | undefined;
declare const BaseTablePlugin: _udecode_plate_core.SlatePlugin<_udecode_plate_core.PluginConfig<"table", {
_cellIndices?: TableStoreCellAttributes;
disableExpandOnInsert?: boolean;
disableMarginLeft?: boolean;
enableMerging?: boolean;
enableUnsetSingleColSize?: boolean;
initialTableWidth?: number;
minColumnWidth?: number;
}, {
create: {
cell: (options?: CreateCellOptions | undefined) => TTableCellElement;
cell: (options?: CreateCellOptions) => TTableCellElement;
};

@@ -54,22 +54,22 @@ table: {

tableColumn: ((options?: {
at?: slate.Path | undefined;
disableSelect?: boolean | undefined;
fromCell?: slate.Path | undefined;
header?: boolean | undefined;
at?: slate.Path;
disableSelect?: boolean;
fromCell?: slate.Path;
header?: boolean;
} | undefined) => void) & ((options?: {
at?: slate.Path | undefined;
disableSelect?: boolean | undefined;
fromCell?: slate.Path | undefined;
header?: boolean | undefined;
at?: slate.Path;
disableSelect?: boolean;
fromCell?: slate.Path;
header?: boolean;
} | undefined) => void);
tableRow: ((options?: {
at?: slate.Path | undefined;
disableSelect?: boolean | undefined;
fromRow?: slate.Path | undefined;
header?: boolean | undefined;
at?: slate.Path;
disableSelect?: boolean;
fromRow?: slate.Path;
header?: boolean;
} | undefined) => void) & ((options?: {
at?: slate.Path | undefined;
disableSelect?: boolean | undefined;
fromRow?: slate.Path | undefined;
header?: boolean | undefined;
at?: slate.Path;
disableSelect?: boolean;
fromRow?: slate.Path;
header?: boolean;
} | undefined) => void);

@@ -124,8 +124,8 @@ };

/** Exact path of the cell to insert the column at. Will overrule `fromCell`. */
at?: Path | undefined;
at?: Path;
/** Disable selection after insertion. */
disableSelect?: boolean | undefined;
disableSelect?: boolean;
/** Path of the cell to insert the column from. */
fromCell?: Path | undefined;
header?: boolean | undefined;
fromCell?: Path;
header?: boolean;
}) => void;

@@ -135,6 +135,6 @@

/** Exact path of the row to insert the column at. Will overrule `fromRow`. */
at?: Path | undefined;
disableSelect?: boolean | undefined;
fromRow?: Path | undefined;
header?: boolean | undefined;
at?: Path;
disableSelect?: boolean;
fromRow?: Path;
header?: boolean;
}) => void;

@@ -183,3 +183,3 @@

declare const getTableEntries: (editor: SlateEditor, { at }?: {
at?: Location | null | undefined;
at?: Location | null;
}) => {

@@ -213,2 +213,2 @@ cell: _udecode_slate.TNodeEntry<_udecode_slate.NodeOf<SlateEditor>>;

export { BorderDirection, CreateCellOptions, KEY_SHIFT_EDGES, TTableCellElement, TTableElement, TableCellHeaderPlugin, TableCellPlugin, TableConfig, TablePlugin, TableRowPlugin, TableStoreCellAttributes, TableStoreSizeOverrides, computeAllCellIndices, computeCellIndices, deleteTable, findCellByIndexes, getCellInNextTableRow, getCellInPreviousTableRow, getCellIndices, getCellIndicesWithSpans, getCellPath, getCellRowIndexByPath, getCellTypes, getColSpan, getEmptyCellNode, getLeftTableCell, getNextTableCell, getPreviousTableCell, getRowSpan, getSelectionWidth, getTableAbove, getTableColumnCount, getTableEntries, getTableMergedColumnCount, getTableOverriddenColSizes, getTopTableCell, insertTableMergeColumn, insertTableMergeRow, isTableBorderHidden, isTableRectangular, setBorderSize, setTableColSize, setTableMarginLeft, setTableRowSize, withNormalizeTable, withTable };
export { BaseTableCellHeaderPlugin, BaseTableCellPlugin, BaseTablePlugin, BaseTableRowPlugin, BorderDirection, CreateCellOptions, KEY_SHIFT_EDGES, TTableCellElement, TTableElement, TableConfig, TableStoreCellAttributes, TableStoreSizeOverrides, computeAllCellIndices, computeCellIndices, deleteTable, findCellByIndexes, getCellInNextTableRow, getCellInPreviousTableRow, getCellIndices, getCellIndicesWithSpans, getCellPath, getCellRowIndexByPath, getCellTypes, getColSpan, getEmptyCellNode, getLeftTableCell, getNextTableCell, getPreviousTableCell, getRowSpan, getSelectionWidth, getTableAbove, getTableColumnCount, getTableEntries, getTableMergedColumnCount, getTableOverriddenColSizes, getTopTableCell, insertTableMergeColumn, insertTableMergeRow, isTableBorderHidden, isTableRectangular, setBorderSize, setTableColSize, setTableMarginLeft, setTableRowSize, withNormalizeTable, withTable };

@@ -52,7 +52,7 @@ "use strict";

__export(src_exports, {
BaseTableCellHeaderPlugin: () => BaseTableCellHeaderPlugin,
BaseTableCellPlugin: () => BaseTableCellPlugin,
BaseTablePlugin: () => BaseTablePlugin,
BaseTableRowPlugin: () => BaseTableRowPlugin,
KEY_SHIFT_EDGES: () => KEY_SHIFT_EDGES,
TableCellHeaderPlugin: () => TableCellHeaderPlugin,
TableCellPlugin: () => TableCellPlugin,
TablePlugin: () => TablePlugin,
TableRowPlugin: () => TableRowPlugin,
computeAllCellIndices: () => computeAllCellIndices,

@@ -99,3 +99,3 @@ computeCellIndices: () => computeCellIndices,

// src/lib/TablePlugin.ts
// src/lib/BaseTablePlugin.ts
var import_plate_common23 = require("@udecode/plate-common");

@@ -107,6 +107,6 @@

if ((0, import_plate_common.someNode)(editor, {
match: { type: editor.getType(TablePlugin) }
match: { type: editor.getType(BaseTablePlugin) }
})) {
const tableItem = (0, import_plate_common.getAboveNode)(editor, {
match: { type: editor.getType(TablePlugin) }
match: { type: editor.getType(BaseTablePlugin) }
});

@@ -152,3 +152,3 @@ if (tableItem) {

var import_plate_common2 = require("@udecode/plate-common");
var getCellTypes = (editor) => (0, import_plate_common2.getPluginTypes)(editor, [TableCellPlugin, TableCellHeaderPlugin]);
var getCellTypes = (editor) => (0, import_plate_common2.getPluginTypes)(editor, [BaseTableCellPlugin, BaseTableCellHeaderPlugin]);

@@ -158,7 +158,7 @@ // src/lib/utils/getEmptyCellNode.ts

header = header != null ? header : row ? row.children.every(
(c) => c.type === editor.getType(TableCellHeaderPlugin)
(c) => c.type === editor.getType(BaseTableCellHeaderPlugin)
) : false;
return {
children: children != null ? children : [editor.api.create.block()],
type: header ? editor.getType(TableCellHeaderPlugin) : editor.getType(TableCellPlugin)
type: header ? editor.getType(BaseTableCellHeaderPlugin) : editor.getType(BaseTableCellPlugin)
};

@@ -171,6 +171,6 @@ };

var _b = _a, { colCount = 1 } = _b, cellOptions = __objRest(_b, ["colCount"]);
const { api } = (0, import_plate_common3.getEditorPlugin)(editor, TablePlugin);
const { api } = (0, import_plate_common3.getEditorPlugin)(editor, BaseTablePlugin);
return {
children: Array.from({ length: colCount }).fill(colCount).map(() => api.create.cell(cellOptions)),
type: editor.getType(TableRowPlugin)
type: editor.getType(BaseTableRowPlugin)
};

@@ -199,3 +199,3 @@ };

children: rows,
type: editor.getType(TablePlugin)
type: editor.getType(BaseTablePlugin)
};

@@ -210,4 +210,3 @@ };

const nextRow = (0, import_plate_common4.getNodeEntry)(editor, import_slate.Path.next(currentRowPath));
if (!nextRow)
return;
if (!nextRow) return;
const [nextRowNode, nextRowPath] = nextRow;

@@ -226,7 +225,5 @@ const nextCell = (_a = nextRowNode == null ? void 0 : nextRowNode.children) == null ? void 0 : _a[0];

const prevPath = (0, import_plate_common5.getPreviousPath)(currentRowPath);
if (!prevPath)
return;
if (!prevPath) return;
const previousRow = (0, import_plate_common5.getNodeEntry)(editor, prevPath);
if (!previousRow)
return;
if (!previousRow) return;
const [previousRowNode, previousRowPath] = previousRow;

@@ -253,8 +250,6 @@ const previousCell = (_a = previousRowNode == null ? void 0 : previousRowNode.children) == null ? void 0 : _a[previousRowNode.children.length - 1];

})) == null ? void 0 : _a[1];
if (!cellPath)
return;
if (!cellPath) return;
}
const cellIndex = cellPath.at(-1);
if (!cellIndex)
return;
if (!cellIndex) return;
const prevCellPath = import_slate2.Path.previous(cellPath);

@@ -269,4 +264,3 @@ return (0, import_plate_common6.getNodeEntry)(editor, prevCellPath);

const cell = (0, import_plate_common7.getNodeEntry)(editor, import_slate3.Path.next(currentPath));
if (cell)
return cell;
if (cell) return cell;
const [, currentRowPath] = currentRow;

@@ -285,4 +279,3 @@ return getCellInNextTableRow(editor, currentRowPath);

const cell = (0, import_plate_common8.getNodeEntry)(editor, prevPath);
if (cell)
return cell;
if (cell) return cell;
};

@@ -294,3 +287,3 @@

match: {
type: editor.getType(TablePlugin)
type: editor.getType(BaseTablePlugin)
}

@@ -316,4 +309,3 @@ }, options));

var getTableEntries = (editor, { at = editor.selection } = {}) => {
if (!at)
return;
if (!at) return;
const cellEntry = (0, import_plate_common10.findNode)(editor, {

@@ -325,18 +317,15 @@ at,

});
if (!cellEntry)
return;
if (!cellEntry) return;
const [, cellPath] = cellEntry;
const rowEntry = (0, import_plate_common10.getAboveNode)(editor, {
at: cellPath,
match: { type: editor.getType(TableRowPlugin) }
match: { type: editor.getType(BaseTableRowPlugin) }
});
if (!rowEntry)
return;
if (!rowEntry) return;
const [, rowPath] = rowEntry;
const tableEntry = (0, import_plate_common10.getAboveNode)(editor, {
at: rowPath,
match: { type: editor.getType(TablePlugin) }
match: { type: editor.getType(BaseTablePlugin) }
});
if (!tableEntry)
return;
if (!tableEntry) return;
return {

@@ -370,9 +359,7 @@ cell: cellEntry,

})) == null ? void 0 : _a[1];
if (!cellPath)
return;
if (!cellPath) return;
}
const cellIndex = cellPath.at(-1);
const rowIndex = cellPath.at(-2);
if (rowIndex === 0)
return;
if (rowIndex === 0) return;
const cellAbovePath = [

@@ -410,3 +397,3 @@ ...import_slate4.Path.parent(import_slate4.Path.parent(cellPath)),

var _a;
const options = editor.getOptions(TablePlugin);
const options = editor.getOptions(BaseTablePlugin);
const tableNodes = tableEl.children;

@@ -456,3 +443,3 @@ let rowIndex = -1;

var _a;
const options = editor.getOptions(TablePlugin);
const options = editor.getOptions(BaseTablePlugin);
for (const tableChild of tableNode.children) {

@@ -485,3 +472,3 @@ const row = tableChild;

var findCellByIndexes = (editor, table, searchRowIndex, searchColIndex) => {
const { _cellIndices: cellIndices } = editor.getOptions(TablePlugin);
const { _cellIndices: cellIndices } = editor.getOptions(BaseTablePlugin);
const allCells = table.children.flatMap(

@@ -508,3 +495,3 @@ (current) => current.children

var getCellPath = (editor, tableEntry, curRowIndex, curColIndex) => {
const { _cellIndices: cellIndices } = editor.getOptions(TablePlugin);
const { _cellIndices: cellIndices } = editor.getOptions(BaseTablePlugin);
const [tableNode, tablePath] = tableEntry;

@@ -526,3 +513,3 @@ const rowElem = tableNode.children[curRowIndex];

} = {}) => {
const { api, getOptions, type } = (0, import_plate_common14.getEditorPlugin)(editor, TablePlugin);
const { api, getOptions, type } = (0, import_plate_common14.getEditorPlugin)(editor, BaseTablePlugin);
const {

@@ -539,4 +526,3 @@ _cellIndices: cellIndices,

});
if (!cellEntry)
return;
if (!cellEntry) return;
const [, cellPath] = cellEntry;

@@ -548,4 +534,3 @@ const cell = cellEntry[0];

});
if (!tableEntry)
return;
if (!tableEntry) return;
const [tableNode, tablePath] = tableEntry;

@@ -648,3 +633,3 @@ const { col: cellColIndex } = getCellIndices(cellIndices, cell) || computeCellIndices(editor, tableNode, cell);

var insertTableColumn = (editor, options = {}) => {
const { api, getOptions, type } = (0, import_plate_common15.getEditorPlugin)(editor, TablePlugin);
const { api, getOptions, type } = (0, import_plate_common15.getEditorPlugin)(editor, BaseTablePlugin);
const { enableMerging, initialTableWidth, minColumnWidth } = getOptions();

@@ -661,4 +646,3 @@ if (enableMerging) {

});
if (!cellEntry)
return;
if (!cellEntry) return;
const [, cellPath] = cellEntry;

@@ -669,4 +653,3 @@ const tableEntry = (0, import_plate_common15.getBlockAbove)(editor, {

});
if (!tableEntry)
return;
if (!tableEntry) return;
const [tableNode, tablePath] = tableEntry;

@@ -693,3 +676,3 @@ let nextCellPath;

const isHeaderRow = header === void 0 ? row.children.every(
(c) => c.type === editor.getType(TableCellHeaderPlugin)
(c) => c.type === editor.getType(BaseTableCellHeaderPlugin)
) : header;

@@ -751,12 +734,11 @@ (0, import_plate_common15.insertElements)(

} = {}) => {
const { api, getOptions, type } = (0, import_plate_common16.getEditorPlugin)(editor, TablePlugin);
const { api, getOptions, type } = (0, import_plate_common16.getEditorPlugin)(editor, BaseTablePlugin);
const { _cellIndices: cellIndices } = getOptions();
const trEntry = fromRow ? (0, import_plate_common16.findNode)(editor, {
at: fromRow,
match: { type: editor.getType(TableRowPlugin) }
match: { type: editor.getType(BaseTableRowPlugin) }
}) : (0, import_plate_common16.getBlockAbove)(editor, {
match: { type: editor.getType(TableRowPlugin) }
match: { type: editor.getType(BaseTableRowPlugin) }
});
if (!trEntry)
return;
if (!trEntry) return;
const [, trPath] = trEntry;

@@ -767,4 +749,3 @@ const tableEntry = (0, import_plate_common16.getBlockAbove)(editor, {

});
if (!tableEntry)
return;
if (!tableEntry) return;
const tableNode = tableEntry[0];

@@ -775,4 +756,3 @@ const cellEntry = (0, import_plate_common16.findNode)(editor, {

});
if (!cellEntry)
return;
if (!cellEntry) return;
const [cellNode, cellPath] = cellEntry;

@@ -811,4 +791,3 @@ const cellElement = cellNode;

affectedCells.forEach((cur) => {
if (!cur)
return;
if (!cur) return;
const curCell = cur;

@@ -846,3 +825,3 @@ const { col: curColIndex, row: curRowIndex } = getCellIndices(cellIndices, curCell) || computeCellIndices(editor, tableNode, curCell);

children: newRowChildren,
type: editor.getType(TableRowPlugin)
type: editor.getType(BaseTableRowPlugin)
},

@@ -859,3 +838,3 @@ {

var insertTableRow = (editor, options = {}) => {
const { api, getOptions, type } = (0, import_plate_common17.getEditorPlugin)(editor, TablePlugin);
const { api, getOptions, type } = (0, import_plate_common17.getEditorPlugin)(editor, BaseTablePlugin);
const { enableMerging } = getOptions();

@@ -868,8 +847,7 @@ if (enableMerging) {

at: fromRow,
match: { type: editor.getType(TableRowPlugin) }
match: { type: editor.getType(BaseTableRowPlugin) }
}) : (0, import_plate_common17.getBlockAbove)(editor, {
match: { type: editor.getType(TableRowPlugin) }
match: { type: editor.getType(BaseTableRowPlugin) }
});
if (!trEntry)
return;
if (!trEntry) return;
const [trNode, trPath] = trEntry;

@@ -880,4 +858,3 @@ const tableEntry = (0, import_plate_common17.getBlockAbove)(editor, {

});
if (!tableEntry)
return;
if (!tableEntry) return;
const getEmptyRowNode2 = () => ({

@@ -887,3 +864,3 @@ children: trNode.children.map((_, i) => {

const isHeaderColumn = !hasSingleRow && tableEntry[0].children.every(
(n) => n.children[i].type === editor.getType(TableCellHeaderPlugin)
(n) => n.children[i].type === editor.getType(BaseTableCellHeaderPlugin)
);

@@ -894,3 +871,3 @@ return api.create.cell({

}),
type: editor.getType(TableRowPlugin)
type: editor.getType(BaseTableRowPlugin)
});

@@ -906,4 +883,3 @@ (0, import_plate_common17.withoutNormalizing)(editor, () => {

});
if (!cellEntry)
return;
if (!cellEntry) return;
const [, nextCellPath] = cellEntry;

@@ -929,4 +905,3 @@ if (import_slate8.Path.isPath(at)) {

});
if (!cellEntry)
return;
if (!cellEntry) return;
const [cellNode, cellPath] = cellEntry;

@@ -957,4 +932,3 @@ const cellIndex = cellPath.at(-1);

const cellAboveEntry = getTopTableCell(editor, { at: cellPath });
if (!cellAboveEntry)
return;
if (!cellAboveEntry) return;
const [cellAboveNode, cellAbovePath] = cellAboveEntry;

@@ -999,4 +973,3 @@ const newBorders = __spreadProps(__spreadValues({}, cellAboveNode.borders), {

const prevCellEntry = getLeftTableCell(editor, { at: cellPath });
if (!prevCellEntry)
return;
if (!prevCellEntry) return;
const [prevCellNode, prevCellPath] = prevCellEntry;

@@ -1039,6 +1012,5 @@ const newBorders = __spreadProps(__spreadValues({}, prevCellNode.borders), {

const table = (0, import_plate_common19.findNode)(editor, __spreadValues({
match: { type: TablePlugin.key }
match: { type: BaseTablePlugin.key }
}, options));
if (!table)
return;
if (!table) return;
const [tableNode, tablePath] = table;

@@ -1054,6 +1026,5 @@ const colSizes = tableNode.colSizes ? [...tableNode.colSizes] : Array.from({ length: getTableColumnCount(tableNode) }).fill(0);

const table = (0, import_plate_common20.findNode)(editor, __spreadValues({
match: { type: TablePlugin.key }
match: { type: BaseTablePlugin.key }
}, options));
if (!table)
return;
if (!table) return;
const [, tablePath] = table;

@@ -1067,6 +1038,5 @@ (0, import_plate_common20.setNodes)(editor, { marginLeft }, { at: tablePath });

const table = (0, import_plate_common21.findNode)(editor, __spreadValues({
match: { type: TablePlugin.key }
match: { type: BaseTablePlugin.key }
}, options));
if (!table)
return;
if (!table) return;
const [, tablePath] = table;

@@ -1121,3 +1091,3 @@ const tableRowPath = [...tablePath, rowIndex];

}
if (node.type === editor.getType(TableRowPlugin)) {
if (node.type === editor.getType(BaseTableRowPlugin)) {
const parentEntry = (0, import_plate_common22.getParentNode)(editor, path);

@@ -1134,3 +1104,3 @@ if ((parentEntry == null ? void 0 : parentEntry[0].type) !== type) {

const parentEntry = (0, import_plate_common22.getParentNode)(editor, path);
if ((parentEntry == null ? void 0 : parentEntry[0].type) !== editor.getType(TableRowPlugin)) {
if ((parentEntry == null ? void 0 : parentEntry[0].type) !== editor.getType(BaseTableRowPlugin)) {
(0, import_plate_common22.unwrapNodes)(editor, {

@@ -1165,4 +1135,4 @@ at: path

// src/lib/TablePlugin.ts
var TableRowPlugin = (0, import_plate_common23.createSlatePlugin)({
// src/lib/BaseTablePlugin.ts
var BaseTableRowPlugin = (0, import_plate_common23.createSlatePlugin)({
key: "tr",

@@ -1178,3 +1148,3 @@ node: { isElement: true },

});
var TableCellPlugin = (0, import_plate_common23.createSlatePlugin)({
var BaseTableCellPlugin = (0, import_plate_common23.createSlatePlugin)({
key: "td",

@@ -1193,3 +1163,3 @@ node: { isElement: true }

}));
var TableCellHeaderPlugin = (0, import_plate_common23.createSlatePlugin)({
var BaseTableCellHeaderPlugin = (0, import_plate_common23.createSlatePlugin)({
key: "th",

@@ -1208,5 +1178,5 @@ node: { isElement: true }

}));
var TablePlugin = (0, import_plate_common23.createTSlatePlugin)({
var BaseTablePlugin = (0, import_plate_common23.createTSlatePlugin)({
key: "table",
extendEditor: withTable,
key: "table",
node: { isElement: true },

@@ -1225,3 +1195,3 @@ options: {

},
plugins: [TableRowPlugin, TableCellPlugin, TableCellHeaderPlugin]
plugins: [BaseTableRowPlugin, BaseTableCellPlugin, BaseTableCellHeaderPlugin]
}).extendEditorApi(({ editor }) => ({

@@ -1318,7 +1288,7 @@ create: {

0 && (module.exports = {
BaseTableCellHeaderPlugin,
BaseTableCellPlugin,
BaseTablePlugin,
BaseTableRowPlugin,
KEY_SHIFT_EDGES,
TableCellHeaderPlugin,
TableCellPlugin,
TablePlugin,
TableRowPlugin,
computeAllCellIndices,

@@ -1325,0 +1295,0 @@ computeCellIndices,

import * as slate from 'slate';
import { Range, Location } from 'slate';
import * as _udecode_utils from '@udecode/utils';
import * as _udecode_slate from '@udecode/slate';
import { T as TableStoreCellAttributes, e as TableApi, C as CreateCellOptions, a as TTableCellElement, b as TableConfig, B as BorderDirection, f as BorderStyle, c as TTableElement, d as TableStoreSizeOverrides, k as GetEmptyTableNodeOptions } from '../getEmptyTableNode-DdWndQ-f.js';
import { T as TableStoreCellAttributes, e as TableApi, C as CreateCellOptions, a as TTableCellElement, i as insertTableColumn, h as insertTableRow, b as TableConfig, B as BorderDirection, f as BorderStyle, c as TTableElement, d as TableStoreSizeOverrides, k as GetEmptyTableNodeOptions } from '../getEmptyTableNode-BTpZEVNY.js';
import * as _udecode_plate_core from '@udecode/plate-core';
import * as _udecode_plate_core_react from '@udecode/plate-core/react';
import * as _udecode_plate_core from '@udecode/plate-core';
import { KeyboardHandler, ExtendEditor } from '@udecode/plate-common/react';

@@ -19,12 +20,12 @@ import { SlateEditor, TElement, TNodeEntry, TEditor, TElementEntry, GetAboveNodeOptions, InsertNodesOptions, TRange } from '@udecode/plate-common';

declare const TablePlugin: _udecode_plate_core_react.PlatePlugin<_udecode_plate_core.PluginConfig<"table", {
_cellIndices?: TableStoreCellAttributes | undefined;
disableExpandOnInsert?: boolean | undefined;
disableMarginLeft?: boolean | undefined;
enableMerging?: boolean | undefined;
enableUnsetSingleColSize?: boolean | undefined;
initialTableWidth?: number | undefined;
minColumnWidth?: number | undefined;
_cellIndices?: TableStoreCellAttributes;
disableExpandOnInsert?: boolean;
disableMarginLeft?: boolean;
enableMerging?: boolean;
enableUnsetSingleColSize?: boolean;
initialTableWidth?: number;
minColumnWidth?: number;
}, TableApi & {
create: {
cell: (options?: CreateCellOptions | undefined) => TTableCellElement;
cell: (options?: CreateCellOptions) => TTableCellElement;
};

@@ -36,14 +37,4 @@ table: {

insert: {
tableColumn: (options?: {
at?: slate.Path | undefined;
disableSelect?: boolean | undefined;
fromCell?: slate.Path | undefined;
header?: boolean | undefined;
} | undefined) => void;
tableRow: (options?: {
at?: slate.Path | undefined;
disableSelect?: boolean | undefined;
fromRow?: slate.Path | undefined;
header?: boolean | undefined;
} | undefined) => void;
tableColumn: _udecode_utils.OmitFirst<typeof insertTableColumn>;
tableRow: _udecode_utils.OmitFirst<typeof insertTableRow>;
};

@@ -53,22 +44,22 @@ } & {

tableColumn: ((options?: {
at?: slate.Path | undefined;
disableSelect?: boolean | undefined;
fromCell?: slate.Path | undefined;
header?: boolean | undefined;
at?: slate.Path;
disableSelect?: boolean;
fromCell?: slate.Path;
header?: boolean;
} | undefined) => void) & ((options?: {
at?: slate.Path | undefined;
disableSelect?: boolean | undefined;
fromCell?: slate.Path | undefined;
header?: boolean | undefined;
at?: slate.Path;
disableSelect?: boolean;
fromCell?: slate.Path;
header?: boolean;
} | undefined) => void);
tableRow: ((options?: {
at?: slate.Path | undefined;
disableSelect?: boolean | undefined;
fromRow?: slate.Path | undefined;
header?: boolean | undefined;
at?: slate.Path;
disableSelect?: boolean;
fromRow?: slate.Path;
header?: boolean;
} | undefined) => void) & ((options?: {
at?: slate.Path | undefined;
disableSelect?: boolean | undefined;
fromRow?: slate.Path | undefined;
header?: boolean | undefined;
at?: slate.Path;
disableSelect?: boolean;
fromRow?: slate.Path;
header?: boolean;
} | undefined) => void);

@@ -87,4 +78,4 @@ };

declare const preventDeleteTableCell: (editor: SlateEditor, { reverse, unit, }: {
reverse?: boolean | undefined;
unit?: "block" | "character" | "line" | "word" | undefined;
reverse?: boolean;
unit?: "block" | "character" | "line" | "word";
}) => true | undefined;

@@ -124,3 +115,3 @@ /** Prevent cell deletion. */

declare const getOnSelectTableBorderFactory: (editor: SlateEditor, selectedCells: TElement[] | null) => (border: 'none' | 'outer' | BorderDirection) => () => void;
declare const getOnSelectTableBorderFactory: (editor: SlateEditor, selectedCells: TElement[] | null) => (border: BorderDirection | "none" | "outer") => () => void;

@@ -134,5 +125,5 @@ interface BorderStylesDefault {

declare const getTableCellBorders: (element: TTableCellElement, { defaultBorder, isFirstCell, isFirstRow, }?: {
defaultBorder?: Required<BorderStyle> | undefined;
isFirstCell?: boolean | undefined;
isFirstRow?: boolean | undefined;
defaultBorder?: Required<BorderStyle>;
isFirstCell?: boolean;
isFirstRow?: boolean;
}) => BorderStylesDefault;

@@ -172,3 +163,3 @@

/** Ignores editable readOnly mode */
ignoreReadOnly?: boolean | undefined;
ignoreReadOnly?: boolean;
}) => TableCellElementState;

@@ -228,3 +219,3 @@ declare const useTableCellElement: ({ element, }: {

/** Transform node column sizes */
transformColSizes?: ((colSizes: number[]) => number[]) | undefined;
transformColSizes?: (colSizes: number[]) => number[];
}) => TableElementState;

@@ -338,4 +329,4 @@ declare const useTableElement: () => {

}, object>;
declare const useOverrideColSize: () => (index: number, size: null | number) => void;
declare const useOverrideRowSize: () => (index: number, size: null | number) => void;
declare const useOverrideColSize: () => (index: number, size: number | null) => void;
declare const useOverrideRowSize: () => (index: number, size: number | null) => void;
declare const useOverrideMarginLeft: () => (args_0: number | null) => void;

@@ -352,9 +343,9 @@

declare const moveSelectionFromCell: (editor: SlateEditor, { at, edge, fromOneCell, reverse, }?: {
at?: Location | undefined;
at?: Location;
/** Expand cell selection to an edge. */
edge?: "bottom" | "left" | "right" | "top" | undefined;
edge?: "bottom" | "left" | "right" | "top";
/** Move selection from one selected cell */
fromOneCell?: boolean | undefined;
fromOneCell?: boolean;
/** False: move selection to cell below true: move selection to cell above */
reverse?: boolean | undefined;
reverse?: boolean;
}) => true | undefined;

@@ -361,0 +352,0 @@

{
"name": "@udecode/plate-table",
"version": "38.0.0",
"version": "38.0.1",
"description": "Table plugin for Plate",

@@ -60,3 +60,3 @@ "keywords": [

"peerDependencies": {
"@udecode/plate-common": ">=38.0.0",
"@udecode/plate-common": ">=38.0.1",
"react": ">=16.8.0",

@@ -63,0 +63,0 @@ "react-dom": ">=16.8.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc