New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rowsncolumns/grid

Package Overview
Dependencies
Maintainers
1
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rowsncolumns/grid - npm Package Compare versions

Comparing version 6.2.1 to 6.2.2

16

dist/helpers.d.ts

@@ -26,3 +26,3 @@ /// <reference types="react" />

}
export declare const getRowStartIndexForOffset: ({ rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale }: Omit<IItemMetaData, "index" | "itemType">) => number;
export declare const getRowStartIndexForOffset: ({ rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale, }: Omit<IItemMetaData, "index" | "itemType">) => number;
interface IRowStopIndex extends Omit<IItemMetaData, "itemType" | "index" | "offset" | "columnCount"> {

@@ -33,4 +33,4 @@ startIndex: number;

}
export declare const getRowStopIndexForStartIndex: ({ startIndex, rowCount, rowHeight, columnWidth, scrollTop, containerHeight, instanceProps, scale }: IRowStopIndex) => number;
export declare const getColumnStartIndexForOffset: ({ rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale }: Omit<IItemMetaData, "index" | "itemType">) => number;
export declare const getRowStopIndexForStartIndex: ({ startIndex, rowCount, rowHeight, columnWidth, scrollTop, containerHeight, instanceProps, scale, }: IRowStopIndex) => number;
export declare const getColumnStartIndexForOffset: ({ rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale, }: Omit<IItemMetaData, "index" | "itemType">) => number;
interface IColumnStopIndex extends Omit<IItemMetaData, "itemType" | "index" | "offset" | "rowCount"> {

@@ -41,7 +41,7 @@ startIndex: number;

}
export declare const getColumnStopIndexForStartIndex: ({ startIndex, rowHeight, columnWidth, instanceProps, containerWidth, scrollLeft, columnCount, scale }: IColumnStopIndex) => number;
export declare const getColumnStopIndexForStartIndex: ({ startIndex, rowHeight, columnWidth, instanceProps, containerWidth, scrollLeft, columnCount, scale, }: IColumnStopIndex) => number;
export declare const getBoundedCells: (area: AreaProps | null | undefined) => Set<unknown>;
export declare const itemKey: ({ rowIndex, columnIndex }: CellInterface) => string;
export declare const getRowOffset: ({ index, rowHeight, columnWidth, instanceProps, scale }: Omit<IGetItemMetadata, "itemType">) => number;
export declare const getColumnOffset: ({ index, rowHeight, columnWidth, instanceProps, scale }: Omit<IGetItemMetadata, "itemType">) => number;
export declare const getRowOffset: ({ index, rowHeight, columnWidth, instanceProps, scale, }: Omit<IGetItemMetadata, "itemType">) => number;
export declare const getColumnOffset: ({ index, rowHeight, columnWidth, instanceProps, scale, }: Omit<IGetItemMetadata, "itemType">) => number;
export declare const getRowHeight: (index: number, instanceProps: InstanceInterface) => number;

@@ -51,3 +51,3 @@ export declare const getColumnWidth: (index: number, instanceProps: InstanceInterface) => number;

}
export declare const getItemMetadata: ({ itemType, index, rowHeight, columnWidth, instanceProps, scale }: IGetItemMetadata) => CellMetaData;
export declare const getItemMetadata: ({ itemType, index, rowHeight, columnWidth, instanceProps, scale, }: IGetItemMetadata) => CellMetaData;
export declare const getEstimatedTotalHeight: (rowCount: number, instanceProps: InstanceInterface) => number;

@@ -72,3 +72,3 @@ export declare const getEstimatedTotalWidth: (columnCount: number, instanceProps: InstanceInterface) => number;

}
export declare const getOffsetForIndexAndAlignment: ({ itemType, containerHeight, containerWidth, rowHeight, columnWidth, columnCount, rowCount, index, align, scrollOffset, instanceProps, scrollbarSize, frozenOffset, scale }: AlignmentProps) => number;
export declare const getOffsetForIndexAndAlignment: ({ itemType, containerHeight, containerWidth, rowHeight, columnWidth, columnCount, rowCount, index, align, scrollOffset, instanceProps, scrollbarSize, frozenOffset, scale, }: AlignmentProps) => number;
export declare const getOffsetForColumnAndAlignment: (props: Omit<AlignmentProps, "itemType">) => number;

@@ -75,0 +75,0 @@ export declare const getOffsetForRowAndAlignment: (props: Omit<AlignmentProps, "itemType">) => number;

@@ -18,3 +18,3 @@ "use strict";

})(ItemType = exports.ItemType || (exports.ItemType = {}));
exports.getRowStartIndexForOffset = ({ rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale }) => {
exports.getRowStartIndexForOffset = ({ rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale, }) => {
return findNearestItem({

@@ -28,6 +28,6 @@ itemType: ItemType.row,

offset,
scale
scale,
});
};
exports.getRowStopIndexForStartIndex = ({ startIndex, rowCount, rowHeight, columnWidth, scrollTop, containerHeight, instanceProps, scale }) => {
exports.getRowStopIndexForStartIndex = ({ startIndex, rowCount, rowHeight, columnWidth, scrollTop, containerHeight, instanceProps, scale, }) => {
const itemMetadata = exports.getItemMetadata({

@@ -39,3 +39,3 @@ itemType: ItemType.row,

instanceProps,
scale
scale,
});

@@ -53,3 +53,3 @@ const maxOffset = scrollTop + containerHeight;

instanceProps,
scale
scale,
}).size;

@@ -59,3 +59,3 @@ }

};
exports.getColumnStartIndexForOffset = ({ rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale }) => {
exports.getColumnStartIndexForOffset = ({ rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale, }) => {
return findNearestItem({

@@ -69,6 +69,6 @@ itemType: ItemType.column,

offset,
scale
scale,
});
};
exports.getColumnStopIndexForStartIndex = ({ startIndex, rowHeight, columnWidth, instanceProps, containerWidth, scrollLeft, columnCount, scale }) => {
exports.getColumnStopIndexForStartIndex = ({ startIndex, rowHeight, columnWidth, instanceProps, containerWidth, scrollLeft, columnCount, scale, }) => {
const itemMetadata = exports.getItemMetadata({

@@ -80,3 +80,3 @@ itemType: ItemType.column,

instanceProps,
scale
scale,
});

@@ -94,3 +94,3 @@ const maxOffset = scrollLeft + containerWidth;

instanceProps,
scale
scale,
}).size;

@@ -113,3 +113,3 @@ }

exports.itemKey = ({ rowIndex, columnIndex }) => `${rowIndex}:${columnIndex}`;
exports.getRowOffset = ({ index, rowHeight, columnWidth, instanceProps, scale }) => {
exports.getRowOffset = ({ index, rowHeight, columnWidth, instanceProps, scale, }) => {
return exports.getItemMetadata({

@@ -121,6 +121,6 @@ itemType: ItemType.row,

instanceProps,
scale
scale,
}).offset;
};
exports.getColumnOffset = ({ index, rowHeight, columnWidth, instanceProps, scale }) => {
exports.getColumnOffset = ({ index, rowHeight, columnWidth, instanceProps, scale, }) => {
return exports.getItemMetadata({

@@ -132,3 +132,3 @@ itemType: ItemType.column,

instanceProps,
scale
scale,
}).offset;

@@ -142,3 +142,3 @@ };

};
exports.getItemMetadata = ({ itemType, index, rowHeight, columnWidth, instanceProps, scale = 2 }) => {
exports.getItemMetadata = ({ itemType, index, rowHeight, columnWidth, instanceProps, scale = 2, }) => {
var _a;

@@ -174,3 +174,3 @@ let itemMetadataMap, itemSize, lastMeasuredIndex, recalcIndices;

offset,
size
size,
};

@@ -188,3 +188,3 @@ offset += size;

};
const findNearestItem = ({ itemType, rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale }) => {
const findNearestItem = ({ itemType, rowHeight, columnWidth, rowCount, columnCount, instanceProps, offset, scale, }) => {
let itemMetadataMap, lastMeasuredIndex;

@@ -210,3 +210,3 @@ if (itemType === "column") {

offset,
scale
scale,
});

@@ -227,7 +227,7 @@ }

offset,
scale
scale,
});
}
};
const findNearestItemBinarySearch = ({ itemType, rowHeight, columnWidth, instanceProps, high, low, offset, scale }) => {
const findNearestItemBinarySearch = ({ itemType, rowHeight, columnWidth, instanceProps, high, low, offset, scale, }) => {
while (low <= high) {

@@ -241,3 +241,3 @@ const middle = low + Math.floor((high - low) / 2);

instanceProps,
scale
scale,
}).offset;

@@ -261,3 +261,3 @@ if (currentOffset === offset) {

};
const findNearestItemExponentialSearch = ({ itemType, rowHeight, columnWidth, rowCount, columnCount, instanceProps, index, offset, scale }) => {
const findNearestItemExponentialSearch = ({ itemType, rowHeight, columnWidth, rowCount, columnCount, instanceProps, index, offset, scale, }) => {
const itemCount = itemType === "column" ? columnCount : rowCount;

@@ -272,3 +272,3 @@ let interval = 1;

instanceProps,
scale
scale,
}).offset < offset) {

@@ -286,3 +286,3 @@ index += interval;

offset,
scale
scale,
});

@@ -372,3 +372,3 @@ };

exports.rafThrottle = rafThrottle;
exports.getOffsetForIndexAndAlignment = ({ itemType, containerHeight, containerWidth, rowHeight, columnWidth, columnCount, rowCount, index, align = Align.smart, scrollOffset, instanceProps, scrollbarSize, frozenOffset = 0, scale }) => {
exports.getOffsetForIndexAndAlignment = ({ itemType, containerHeight, containerWidth, rowHeight, columnWidth, columnCount, rowCount, index, align = Align.smart, scrollOffset, instanceProps, scrollbarSize, frozenOffset = 0, scale, }) => {
const size = itemType === "column" ? containerWidth : containerHeight;

@@ -381,3 +381,3 @@ const itemMetadata = exports.getItemMetadata({

instanceProps,
scale
scale,
});

@@ -427,3 +427,3 @@ // Get estimated total size after ItemMetadata is computed,

itemType: ItemType.column,
...props
...props,
});

@@ -434,3 +434,3 @@ };

itemType: ItemType.row,
...props
...props,
});

@@ -464,3 +464,3 @@ };

const timeoutID = {
id: requestAnimationFrame(tick)
id: requestAnimationFrame(tick),
};

@@ -479,5 +479,5 @@ return timeoutID;

bottom: activeCell.rowIndex,
right: activeCell.columnIndex
}
}
right: activeCell.columnIndex,
},
},
];

@@ -500,6 +500,6 @@ };

const csv = [];
rows.forEach(row => {
rows.forEach((row) => {
html.push("<tr>");
const csvRow = [];
row.forEach(cell => {
row.forEach((cell) => {
var _a;

@@ -612,3 +612,3 @@ html.push(`<td>${cell}</td>`);

exports.AutoSizerCanvas = (defaults = {}) => {
const { fontFamily = "Arial", fontSize = 12, fontWeight = "normal", fontStyle = "", lineHeight = 16, scale = 1 } = defaults;
const { fontFamily = "Arial", fontSize = 12, fontWeight = "", fontStyle = "", lineHeight = 16, scale = 1, } = defaults;
var o = {

@@ -620,3 +620,3 @@ fontFamily,

lineHeight,
scale
scale,
};

@@ -631,4 +631,3 @@ const canvas = exports.canUseDOM && document.createElement("canvas");

if (context) {
context.font = `${o.fontStyle} ${o.fontWeight} ${o.fontSize *
o.scale}px ${o.fontFamily}`;
context.font = `${o.fontStyle} ${o.fontWeight} ${o.fontSize * o.scale}px ${o.fontFamily}`;
}

@@ -659,3 +658,3 @@ };

setFont,
reset
reset,
};

@@ -774,3 +773,3 @@ };

? rowIndex - 1
: rowIndex
: rowIndex,
};

@@ -789,3 +788,3 @@ }

? rowIndex + 1
: rowIndex
: rowIndex,
};

@@ -804,3 +803,3 @@ }

? columnIndex - 1
: columnIndex
: columnIndex,
};

@@ -819,3 +818,3 @@ }

? columnIndex + 1
: columnIndex
: columnIndex,
};

@@ -858,3 +857,3 @@ }

rowIndex,
columnIndex: columnIndex + 1
columnIndex: columnIndex + 1,
});

@@ -871,3 +870,3 @@ const isNextCellEmpty = exports.isNull(nextCellValue);

rowIndex,
columnIndex: columnIndex - 1
columnIndex: columnIndex - 1,
});

@@ -874,0 +873,0 @@ const isNextCellEmpty = exports.isNull(nextCellValue);

@@ -17,3 +17,3 @@ "use strict";

*/
const useAutoSizer = ({ gridRef, getValue, initialVisibleRows = 20, cellSpacing = 10, minColumnWidth = 60, timeout = 300, resizeStrategy = "lazy", rowCount, resizeOnScroll = true, fontFamily = "Arial", fontSize = 12, fontWeight = "normal", fontStyle = "italic", autoResize = true, columnSizes = {}, frozenRows = 0, scale = 1, isHiddenRow, isHiddenColumn, getText = defaultGetText, }) => {
const useAutoSizer = ({ gridRef, getValue, initialVisibleRows = 20, cellSpacing = 10, minColumnWidth = 60, timeout = 300, resizeStrategy = "lazy", rowCount, resizeOnScroll = true, fontFamily = "Arial", fontSize = 12, fontWeight = "", fontStyle = "", autoResize = true, columnSizes = {}, frozenRows = 0, scale = 1, isHiddenRow, isHiddenColumn, getText = defaultGetText, }) => {
tiny_invariant_1.default(!(resizeStrategy === "full" && rowCount === void 0), "Row count should be specified if resize stragtegy is full");

@@ -70,3 +70,3 @@ const autoSizer = react_1.useRef(helpers_1.autoSizerCanvas);

const text = getText(cellValue);
if (text !== void 0 && !helpers_1.isNull(text)) {
if (helpers_1.cellIdentifier !== void 0 && !helpers_1.isNull(text) && text !== void 0) {
/* Reset fonts */

@@ -77,5 +77,6 @@ autoSizer.current.reset();

autoSizer.current.setFont({
fontWeight: isBold ? "bold" : "normal",
fontWeight: isBold ? "bold" : "",
fontSize: (cellValue.fontSize || fontSize) * scale,
fontFamily: cellValue.fontFamily,
fontStyle: cellValue.italic ? "italic" : "",
});

@@ -82,0 +83,0 @@ }

{
"name": "@rowsncolumns/grid",
"description": "Declarative React Canvas Grid primitive for Data table, Pivot table, Excel Worksheets",
"version": "6.2.1",
"version": "6.2.2",
"main": "dist/index.js",

@@ -46,3 +46,3 @@ "license": "MIT",

},
"gitHead": "7e79182f69cc03fba6ba8321f9dc5ba5fd1385f5"
"gitHead": "d8277ea4340b13bafcd7bba4abc4f950547f7392"
}

@@ -8,3 +8,3 @@ // Utilities extracted from https://github.com/bvaughn/react-window

CellMetaData,
SelectionArea
SelectionArea,
} from "./Grid";

@@ -18,3 +18,3 @@ import { Direction, KeyCodes } from "./types";

auto = "auto",
smart = "smart"
smart = "smart",
}

@@ -24,3 +24,3 @@

row = "row",
column = "column"
column = "column",
}

@@ -47,3 +47,3 @@

offset,
scale
scale,
}: Omit<IItemMetaData, "index" | "itemType">): number => {

@@ -58,3 +58,3 @@ return findNearestItem({

offset,
scale
scale,
});

@@ -77,3 +77,3 @@ };

instanceProps,
scale
scale,
}: IRowStopIndex): number => {

@@ -86,3 +86,3 @@ const itemMetadata = getItemMetadata({

instanceProps,
scale
scale,
});

@@ -102,3 +102,3 @@ const maxOffset = scrollTop + containerHeight;

instanceProps,
scale
scale,
}).size;

@@ -117,3 +117,3 @@ }

offset,
scale
scale,
}: Omit<IItemMetaData, "index" | "itemType">): number => {

@@ -128,3 +128,3 @@ return findNearestItem({

offset,
scale
scale,
});

@@ -147,3 +147,3 @@ };

columnCount,
scale
scale,
}: IColumnStopIndex): number => {

@@ -156,3 +156,3 @@ const itemMetadata = getItemMetadata({

instanceProps,
scale
scale,
});

@@ -172,3 +172,3 @@ const maxOffset = scrollLeft + containerWidth;

instanceProps,
scale
scale,
}).size;

@@ -200,3 +200,3 @@ }

instanceProps,
scale
scale,
}: Omit<IGetItemMetadata, "itemType">): number => {

@@ -209,3 +209,3 @@ return getItemMetadata({

instanceProps,
scale
scale,
}).offset;

@@ -219,3 +219,3 @@ };

instanceProps,
scale
scale,
}: Omit<IGetItemMetadata, "itemType">): number => {

@@ -228,3 +228,3 @@ return getItemMetadata({

instanceProps,
scale
scale,
}).offset;

@@ -263,3 +263,3 @@ };

instanceProps,
scale = 2
scale = 2,
}: IGetItemMetadata): CellMetaData => {

@@ -296,3 +296,3 @@ let itemMetadataMap, itemSize, lastMeasuredIndex, recalcIndices: number[];

offset,
size
size,
};

@@ -321,3 +321,3 @@

offset,
scale
scale,
}: Omit<IItemMetaData, "index">): number => {

@@ -345,3 +345,3 @@ let itemMetadataMap, lastMeasuredIndex;

offset,
scale
scale,
});

@@ -361,3 +361,3 @@ } else {

offset,
scale
scale,
});

@@ -380,3 +380,3 @@ }

offset,
scale
scale,
}: IBinarySearchArgs): number => {

@@ -391,3 +391,3 @@ while (low <= high) {

instanceProps,
scale
scale,
}).offset;

@@ -420,3 +420,3 @@

offset,
scale
scale,
}: IItemMetaData) => {

@@ -434,3 +434,3 @@ const itemCount = itemType === "column" ? columnCount : rowCount;

instanceProps,
scale
scale,
}).offset < offset

@@ -450,3 +450,3 @@ ) {

offset,
scale
scale,
});

@@ -537,3 +537,3 @@ };

var evt: any; // to keep track of the last event
var handler = function() {
var handler = function () {
// fired only when screen has refreshed

@@ -578,3 +578,3 @@ active = false; // release our flag

frozenOffset = 0,
scale
scale,
}: AlignmentProps): number => {

@@ -588,3 +588,3 @@ const size = itemType === "column" ? containerWidth : containerHeight;

instanceProps,
scale
scale,
});

@@ -644,3 +644,3 @@

itemType: ItemType.column,
...props
...props,
});

@@ -654,3 +654,3 @@ };

itemType: ItemType.row,
...props
...props,
});

@@ -694,3 +694,3 @@ };

const timeoutID: TimeoutID = {
id: requestAnimationFrame(tick)
id: requestAnimationFrame(tick),
};

@@ -711,5 +711,5 @@

bottom: activeCell.rowIndex,
right: activeCell.columnIndex
}
}
right: activeCell.columnIndex,
},
},
];

@@ -738,6 +738,6 @@ };

const csv: string[] = [];
rows.forEach(row => {
rows.forEach((row) => {
html.push("<tr>");
const csvRow: string[] = [];
row.forEach(cell => {
row.forEach((cell) => {
html.push(`<td>${cell}</td>`);

@@ -891,6 +891,6 @@ csvRow.push(`${castToString(cell)?.replace(/"/g, '""')}`);

fontSize = 12,
fontWeight = "normal",
fontWeight = "",
fontStyle = "",
lineHeight = 16,
scale = 1
scale = 1,
} = defaults;

@@ -903,3 +903,3 @@ var o: IOptions = {

lineHeight,
scale
scale,
};

@@ -915,4 +915,5 @@ const canvas =

if (context) {
context.font = `${o.fontStyle} ${o.fontWeight} ${o.fontSize *
o.scale}px ${o.fontFamily}`;
context.font = `${o.fontStyle} ${o.fontWeight} ${
o.fontSize * o.scale
}px ${o.fontFamily}`;
}

@@ -943,3 +944,3 @@ };

setFont,
reset
reset,
};

@@ -1112,3 +1113,3 @@ };

? rowIndex - 1
: rowIndex
: rowIndex,
};

@@ -1127,3 +1128,3 @@ }

? rowIndex + 1
: rowIndex
: rowIndex,
};

@@ -1150,3 +1151,3 @@ }

? columnIndex - 1
: columnIndex
: columnIndex,
};

@@ -1174,3 +1175,3 @@ }

? columnIndex + 1
: columnIndex
: columnIndex,
};

@@ -1247,3 +1248,3 @@ }

rowIndex,
columnIndex: columnIndex + 1
columnIndex: columnIndex + 1,
});

@@ -1273,3 +1274,3 @@ const isNextCellEmpty = isNull(nextCellValue);

rowIndex,
columnIndex: columnIndex - 1
columnIndex: columnIndex - 1,
});

@@ -1276,0 +1277,0 @@ const isNextCellEmpty = isNull(nextCellValue);

@@ -9,2 +9,3 @@ import React, { useCallback, useState, useRef, useEffect } from "react";

castToString,
cellIdentifier,
} from "./../helpers";

@@ -142,4 +143,4 @@ import invariant from "tiny-invariant";

fontSize = 12,
fontWeight = "normal",
fontStyle = "italic",
fontWeight = "",
fontStyle = "",
autoResize = true,

@@ -217,3 +218,3 @@ columnSizes = {},

const text = getText(cellValue);
if (text !== void 0 && !isNull(text)) {
if (cellIdentifier !== void 0 && !isNull(text) && text !== void 0) {
/* Reset fonts */

@@ -225,5 +226,6 @@ autoSizer.current.reset();

autoSizer.current.setFont({
fontWeight: isBold ? "bold" : "normal",
fontWeight: isBold ? "bold" : "",
fontSize: (cellValue.fontSize || fontSize) * scale,
fontFamily: cellValue.fontFamily,
fontStyle: cellValue.italic ? "italic" : "",
});

@@ -230,0 +232,0 @@ }

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