Skip to content

Commit 9f13f2e

Browse files
authored
4.0.2 (#252)
* Update packaging * Update version * Make tests work again * Try to improve score * Fix crash with highlight regions out of bounds horizontally * Fix another crash * Fix security issues * 4.0.2-beta1 * Add basic menu story * Prep for 4.0.2
1 parent 02a6a57 commit 9f13f2e

File tree

15 files changed

+396
-52
lines changed

15 files changed

+396
-52
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "root",
3-
"version": "4.0.1",
3+
"version": "4.0.2",
44
"scripts": {
55
"start": "npm run storybook",
66
"bootstrap": "./bootstrap.sh",

packages/cells/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cells/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{
22
"name": "@glideapps/glide-data-grid-cells",
3-
"version": "4.0.1",
3+
"version": "4.0.2",
44
"description": "Extra cells for glide-data-grid",
55
"sideEffects": false,
66
"type": "module",
7-
"main": "dist/js/index.js",
7+
"browser": "dist/js/index.js",
8+
"main": "dist/cjs/index.js",
9+
"module": "dist/js/index.js",
810
"types": "dist/ts/index.d.ts",
911
"exports": {
1012
"import": "./dist/js/index.js",
@@ -14,7 +16,7 @@
1416
"dist"
1517
],
1618
"scripts": {
17-
"build": "npm run build-js && npm run build-types",
19+
"build": "npm run build-js && npm run build-cjs && npm run build-types",
1820
"build-js": "babel --config-file ../../babel.config.json ./src -d dist/js --ignore '**/*.stories.tsx','src/stories/*.tsx' --extensions .ts,.tsx && tsc-esm-fix --target='dist/js'",
1921
"build-cjs": "babel --config-file ../../babel.cjs.json ./src -d dist/cjs --ignore '**/*.stories.tsx','src/stories/*.tsx' --extensions .ts,.tsx",
2022
"build-types": "tsc -p tsconfig.types.json",
@@ -41,7 +43,7 @@
4143
"canvas"
4244
],
4345
"dependencies": {
44-
"@glideapps/glide-data-grid": "4.0.1",
46+
"@glideapps/glide-data-grid": "4.0.2",
4547
"@toast-ui/editor": "^3.1.3",
4648
"@toast-ui/react-editor": "^3.1.3",
4749
"react-select": "^5.2.2"

packages/core/.npmignore

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
src
2-
package-lock.json
3-
.eslintrc
4-
.eslintignore
5-
tsconfig.json
6-
tsconfig.types.json
7-
jest.config.js
8-
API.md
2+
tsconfig*
3+
coverage/*

packages/core/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
{
22
"name": "@glideapps/glide-data-grid",
3-
"version": "4.0.1",
3+
"version": "4.0.2",
44
"description": "Super fast, pure canvas Data Grid Editor",
55
"sideEffects": false,
66
"type": "module",
7-
"main": "dist/js/index.js",
7+
"browser": "dist/js/index.js",
8+
"main": "dist/cjs/index.js",
9+
"module": "dist/js/index.js",
10+
"types": "dist/ts/index.d.ts",
811
"exports": {
912
"import": "./dist/js/index.js",
1013
"require": "./dist/cjs/index.js"
1114
},
12-
"files": [
13-
"dist",
14-
"CHANGELOG.md"
15-
],
16-
"types": "dist/ts/index.d.ts",
1715
"scripts": {
1816
"build": "npm run build-js && npm run build-cjs && npm run build-types",
1917
"build-js": "babel --config-file ../../babel.config.json ./src -d dist/js --ignore 'src/setupTests.ts','src/docs','**/*.test.ts','**/*.test.tsx','**/*.stories.tsx','src/stories/*.tsx','**/*.d.ts' --extensions .ts,.tsx && tsc-esm-fix --target='dist/js'",

packages/core/src/data-editor/data-editor.tsx

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -477,18 +477,6 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
477477
abortControllerRef.current
478478
);
479479

480-
const highlightRegions = React.useMemo(() => {
481-
if (highlightRegionsIn === undefined) return undefined;
482-
if (rowMarkerOffset === 0) return highlightRegionsIn;
483-
return highlightRegionsIn.map(r => ({
484-
color: r.color,
485-
range: {
486-
...r.range,
487-
x: r.range.x + rowMarkerOffset,
488-
},
489-
}));
490-
}, [highlightRegionsIn, rowMarkerOffset]);
491-
492480
const enableGroups = React.useMemo(() => {
493481
return columns.some(c => c.group !== undefined);
494482
}, [columns]);
@@ -549,6 +537,26 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
549537
];
550538
}, [columns, rowMarkerWidth, rowMarkers]);
551539

540+
const highlightRegions = React.useMemo(() => {
541+
if (highlightRegionsIn === undefined) return undefined;
542+
if (rowMarkerOffset === 0) return highlightRegionsIn;
543+
544+
return highlightRegionsIn
545+
.map(r => {
546+
const maxWidth = mangledCols.length - r.range.x - rowMarkerOffset;
547+
if (maxWidth <= 0) return undefined;
548+
return {
549+
color: r.color,
550+
range: {
551+
...r.range,
552+
x: r.range.x + rowMarkerOffset,
553+
width: Math.min(maxWidth, r.range.width),
554+
},
555+
};
556+
})
557+
.filter(x => x !== undefined) as typeof highlightRegionsIn;
558+
}, [highlightRegionsIn, mangledCols.length, rowMarkerOffset]);
559+
552560
const visibleRegionRef = React.useRef(visibleRegion);
553561
const getMangledCellContent = React.useCallback(
554562
([col, row]: Item): InnerGridCell => {

0 commit comments

Comments
 (0)