@youp-grid/react 0.2.0 → 0.2.1
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/dist/YoupGrid.js +26 -5
- package/package.json +2 -2
package/dist/YoupGrid.js
CHANGED
|
@@ -1420,10 +1420,15 @@ function handleCellKeyDown(context) {
|
|
|
1420
1420
|
}
|
|
1421
1421
|
return;
|
|
1422
1422
|
}
|
|
1423
|
-
if (
|
|
1423
|
+
if (isTextEditingKey(context.event)) {
|
|
1424
1424
|
if (context.cell.editable && context.cell.column.editor !== "checkbox") {
|
|
1425
|
-
context.event
|
|
1426
|
-
|
|
1425
|
+
if (canUseKeyAsInitialDraft(context.event)) {
|
|
1426
|
+
context.event.preventDefault();
|
|
1427
|
+
context.startEditing(createEditingCell(context.cell, context.event.key));
|
|
1428
|
+
}
|
|
1429
|
+
else {
|
|
1430
|
+
context.startEditing(createEditingCell(context.cell, ""));
|
|
1431
|
+
}
|
|
1427
1432
|
}
|
|
1428
1433
|
return;
|
|
1429
1434
|
}
|
|
@@ -1888,8 +1893,24 @@ function getCellTitle(meta, disabledReason, editable) {
|
|
|
1888
1893
|
}
|
|
1889
1894
|
return undefined;
|
|
1890
1895
|
}
|
|
1891
|
-
function
|
|
1892
|
-
|
|
1896
|
+
function isTextEditingKey(event) {
|
|
1897
|
+
if (event.metaKey || event.ctrlKey || event.altKey) {
|
|
1898
|
+
return false;
|
|
1899
|
+
}
|
|
1900
|
+
return event.key.length === 1 || isCompositionEditingKey(event);
|
|
1901
|
+
}
|
|
1902
|
+
function canUseKeyAsInitialDraft(event) {
|
|
1903
|
+
return event.key.length === 1 && isAsciiPrintableKey(event.key) && !isCompositionEditingKey(event);
|
|
1904
|
+
}
|
|
1905
|
+
function isCompositionEditingKey(event) {
|
|
1906
|
+
return (event.nativeEvent.isComposing ||
|
|
1907
|
+
event.key === "Process" ||
|
|
1908
|
+
event.key === "Dead" ||
|
|
1909
|
+
event.key === "Unidentified" ||
|
|
1910
|
+
event.keyCode === 229);
|
|
1911
|
+
}
|
|
1912
|
+
function isAsciiPrintableKey(key) {
|
|
1913
|
+
return key >= " " && key <= "~";
|
|
1893
1914
|
}
|
|
1894
1915
|
function isUndoShortcut(event) {
|
|
1895
1916
|
return (event.metaKey || event.ctrlKey) && !event.altKey && !event.shiftKey && event.key.toLowerCase() === "z";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@youp-grid/react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "React adapter for Youp Grid.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"build": "tsc -p tsconfig.build.json && cp src/styles.css dist/styles.css"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@youp-grid/core": "0.2.
|
|
31
|
+
"@youp-grid/core": "0.2.1"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": ">=18.2.0"
|