@opencorestack/opengridx 3.2.0 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +16 -0
- package/dist/opengridx.es.js +187 -180
- package/dist/opengridx.es.js.map +1 -1
- package/dist/opengridx.umd.js +6 -6
- package/dist/opengridx.umd.js.map +1 -1
- package/lib/components/Cell/GridEditInputCell.tsx +3 -0
- package/lib/hooks/core/useGridThemeDimensions.ts +1 -1
- package/lib/utils/columnAutosize.ts +1 -1
- package/lib/utils/export/exportShared.ts +11 -2
- package/llms.txt +1 -1
- package/package.json +8 -2
|
@@ -91,6 +91,9 @@ function BooleanEditor({ value, colDef, onValueChange, onCommit, onCancel }: Gri
|
|
|
91
91
|
aria-label={editorLabel(colDef)}
|
|
92
92
|
checked={!!value}
|
|
93
93
|
onChange={handleChange}
|
|
94
|
+
// Safari does not focus checkboxes on click: mousedown moves focus to the cell, the
|
|
95
|
+
// blur commits the unchanged value and the editor unmounts before the click toggles it.
|
|
96
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
94
97
|
onBlur={onCommit}
|
|
95
98
|
onKeyDown={makeKeyDownHandler(onCommit, onCancel, false)}
|
|
96
99
|
/>
|
|
@@ -10,7 +10,7 @@ const COMFORTABLE_ROW_HEIGHT = 72;
|
|
|
10
10
|
/** A theme height in pixels (`'36px'` or `'36'`); anything else (rem, calc, …) is ignored. */
|
|
11
11
|
export function parseThemePixels(value: string | undefined): number | undefined {
|
|
12
12
|
if (value === undefined) return undefined;
|
|
13
|
-
const match =
|
|
13
|
+
const match = /^(\d+(?:\.\d+)?)(?:\s*px)?$/.exec(value.trim());
|
|
14
14
|
if (!match) return undefined;
|
|
15
15
|
const px = Number(match[1]);
|
|
16
16
|
return px > 0 ? px : undefined;
|
|
@@ -29,7 +29,7 @@ function measureCell(cell: HTMLElement, content: HTMLElement): number {
|
|
|
29
29
|
* hidden by a row span are skipped. Returns null when nothing of the column is rendered.
|
|
30
30
|
*/
|
|
31
31
|
export function measureColumnContentWidth(root: HTMLElement, field: string): number | null {
|
|
32
|
-
const escaped = typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(field) : field.replace(/"/g, '
|
|
32
|
+
const escaped = typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(field) : field.replace(/["\\]/g, '\\$&');
|
|
33
33
|
const ownedByRoot = (el: Element) => el.closest(ROOT_SELECTOR) === root;
|
|
34
34
|
let width: number | null = null;
|
|
35
35
|
const take = (w: number) => { width = width === null ? w : Math.max(width, w); };
|
|
@@ -147,7 +147,7 @@ export function pickExportedAggregates<R extends GridRowModel>(
|
|
|
147
147
|
const FORMULA_TRIGGER = /^[=+\-@\t\r]/;
|
|
148
148
|
// Optional sign, then only digits, separators and whitespace (\s includes NBSP and U+202F):
|
|
149
149
|
// such text cannot reference cells or call functions.
|
|
150
|
-
const PLAIN_NUMBER = /^[-+]?[\d.,\s]*\d[\d.,\s]*%?$/;
|
|
150
|
+
const PLAIN_NUMBER = /^[-+]?(?=[\d.,\s]*\d)[\d.,\s]*%?$/;
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
153
|
* Neutralise spreadsheet formula injection (CSV injection). Text that starts with `=`, `+`, `-`,
|
|
@@ -173,6 +173,15 @@ export function escapeHTML(value: string): string {
|
|
|
173
173
|
.replace(/'/g, ''');
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
/** Drops leading and trailing apostrophes (a loop, not a regex: `/'+$/` backtracks on long runs). */
|
|
177
|
+
function stripApostrophes(text: string): string {
|
|
178
|
+
let start = 0;
|
|
179
|
+
let end = text.length;
|
|
180
|
+
while (start < end && text[start] === "'") start++;
|
|
181
|
+
while (end > start && text[end - 1] === "'") end--;
|
|
182
|
+
return text.slice(start, end);
|
|
183
|
+
}
|
|
184
|
+
|
|
176
185
|
const INVALID_SHEET_CHARS = /[\\/?*:[\]]/g;
|
|
177
186
|
const MAX_SHEET_NAME = 31;
|
|
178
187
|
|
|
@@ -183,7 +192,7 @@ const MAX_SHEET_NAME = 31;
|
|
|
183
192
|
* name is added to `used`.
|
|
184
193
|
*/
|
|
185
194
|
export function sanitizeSheetName(name: string | undefined, used: Set<string> = new Set()): string {
|
|
186
|
-
let base = String(name ?? '').replace(INVALID_SHEET_CHARS, '-').trim()
|
|
195
|
+
let base = stripApostrophes(String(name ?? '').replace(INVALID_SHEET_CHARS, '-').trim()).trim();
|
|
187
196
|
if (!base) base = 'Sheet';
|
|
188
197
|
base = base.slice(0, MAX_SHEET_NAME).trim();
|
|
189
198
|
const taken = (candidate: string) => used.has(candidate.toLowerCase()) || candidate.toLowerCase() === 'history';
|
package/llms.txt
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencorestack/opengridx",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "OpenGridX: High-performance React data infrastructure. Unlock advanced Row Grouping, Excel Export, and Column Pinning without the usual \"Pro\" gatekeeping. Built for speed, scale, and complete architectural freedom. Fully open, virtualization-ready, and feature-complete.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/opengridx.umd.js",
|
|
@@ -47,11 +47,12 @@
|
|
|
47
47
|
"build": "tsc --project tsconfig.build.json && vite build",
|
|
48
48
|
"build:lib": "tsc --project tsconfig.build.json && vite build --config vite.config.lib.js && cp lib/styles/opengridx.css.d.ts dist/opengridx.css.d.ts && node scripts/check-bundle.mjs",
|
|
49
49
|
"lint": "eslint .",
|
|
50
|
-
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
50
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit && tsc -p e2e/tsconfig.json",
|
|
51
51
|
"preview": "vite preview",
|
|
52
52
|
"test": "vitest run --project unit",
|
|
53
53
|
"test:browser": "vitest run --project browser",
|
|
54
54
|
"test:all": "vitest run",
|
|
55
|
+
"test:smoke": "node scripts/smoke.mjs",
|
|
55
56
|
"test:watch": "vitest --project unit",
|
|
56
57
|
"coverage": "vitest run --coverage",
|
|
57
58
|
"prepublishOnly": "npm run build:lib"
|
|
@@ -106,6 +107,7 @@
|
|
|
106
107
|
},
|
|
107
108
|
"devDependencies": {
|
|
108
109
|
"@eslint/js": "^9.39.1",
|
|
110
|
+
"@playwright/test": "^1.58.2",
|
|
109
111
|
"@testing-library/jest-dom": "^7.0.0",
|
|
110
112
|
"@testing-library/react": "^16.3.2",
|
|
111
113
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -118,6 +120,7 @@
|
|
|
118
120
|
"eslint": "^9.39.1",
|
|
119
121
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
120
122
|
"eslint-plugin-react-refresh": "^0.4.24",
|
|
123
|
+
"exceljs": "^4.4.0",
|
|
121
124
|
"globals": "^16.5.0",
|
|
122
125
|
"jsdom": "^29.1.1",
|
|
123
126
|
"jspdf": "^4.2.1",
|
|
@@ -131,5 +134,8 @@
|
|
|
131
134
|
"vite": "^7.2.4",
|
|
132
135
|
"vite-plugin-dts": "^4.5.4",
|
|
133
136
|
"vitest": "^4.1.11"
|
|
137
|
+
},
|
|
138
|
+
"overrides": {
|
|
139
|
+
"uuid": "^11.1.1"
|
|
134
140
|
}
|
|
135
141
|
}
|