@mui/x-data-grid 6.7.0 → 6.8.0
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 +77 -15
- package/components/GridColumnHeaders.d.ts +2 -2
- package/components/GridColumnHeaders.js +3 -1
- package/components/GridRow.d.ts +2 -2
- package/components/GridRow.js +23 -69
- package/components/cell/GridCell.d.ts +24 -15
- package/components/cell/GridCell.js +422 -45
- package/components/cell/index.d.ts +2 -1
- package/components/cell/index.js +1 -1
- package/components/containers/GridRootStyles.js +30 -16
- package/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/components/toolbar/GridToolbar.js +2 -2
- package/components/virtualization/GridVirtualScroller.js +4 -9
- package/components/virtualization/GridVirtualScrollerContent.js +11 -20
- package/constants/defaultGridSlotsComponents.js +6 -2
- package/hooks/core/useGridApiInitialization.js +4 -1
- package/hooks/core/useGridStateInitialization.js +2 -9
- package/hooks/features/clipboard/useGridClipboard.js +1 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
- package/hooks/features/editing/useGridCellEditing.js +5 -3
- package/hooks/features/editing/useGridRowEditing.js +14 -6
- package/hooks/features/filter/gridFilterUtils.d.ts +4 -1
- package/hooks/features/filter/gridFilterUtils.js +19 -13
- package/hooks/features/filter/useGridFilter.js +2 -1
- package/hooks/features/focus/useGridFocus.js +9 -4
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -0
- package/hooks/features/rows/useGridParamsApi.js +7 -15
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +8 -816
- package/hooks/features/virtualization/useGridVirtualScroller.js +40 -38
- package/hooks/utils/index.d.ts +1 -1
- package/hooks/utils/index.js +1 -1
- package/hooks/utils/useGridSelector.d.ts +3 -1
- package/hooks/utils/useGridSelector.js +37 -6
- package/hooks/utils/useLazyRef.d.ts +2 -0
- package/hooks/utils/useLazyRef.js +9 -0
- package/hooks/utils/useOnMount.d.ts +2 -0
- package/hooks/utils/useOnMount.js +7 -0
- package/index.js +1 -1
- package/legacy/components/GridColumnHeaders.js +3 -1
- package/legacy/components/GridRow.js +25 -69
- package/legacy/components/cell/GridCell.js +425 -46
- package/legacy/components/cell/index.js +1 -1
- package/legacy/components/containers/GridRootStyles.js +20 -17
- package/legacy/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/legacy/components/toolbar/GridToolbar.js +2 -2
- package/legacy/components/virtualization/GridVirtualScroller.js +4 -7
- package/legacy/components/virtualization/GridVirtualScrollerContent.js +10 -17
- package/legacy/constants/defaultGridSlotsComponents.js +6 -2
- package/legacy/hooks/core/useGridApiInitialization.js +4 -1
- package/legacy/hooks/core/useGridStateInitialization.js +2 -7
- package/legacy/hooks/features/clipboard/useGridClipboard.js +1 -4
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
- package/legacy/hooks/features/editing/useGridCellEditing.js +5 -3
- package/legacy/hooks/features/editing/useGridRowEditing.js +15 -7
- package/legacy/hooks/features/filter/gridFilterUtils.js +23 -19
- package/legacy/hooks/features/filter/useGridFilter.js +2 -1
- package/legacy/hooks/features/focus/useGridFocus.js +9 -4
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
- package/legacy/hooks/features/rows/useGridParamsApi.js +23 -15
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +38 -34
- package/legacy/hooks/utils/index.js +1 -1
- package/legacy/hooks/utils/useGridSelector.js +43 -5
- package/legacy/hooks/utils/useLazyRef.js +9 -0
- package/legacy/hooks/utils/useOnMount.js +7 -0
- package/legacy/index.js +1 -1
- package/legacy/locales/elGR.js +70 -79
- package/legacy/utils/Store.js +34 -0
- package/legacy/utils/doesSupportPreventScroll.js +13 -0
- package/legacy/utils/fastMemo.js +5 -0
- package/legacy/utils/fastObjectShallowCompare.js +32 -0
- package/legacy/utils/keyboardUtils.js +4 -2
- package/locales/elGR.js +66 -79
- package/models/api/gridCoreApi.d.ts +6 -0
- package/models/colDef/gridColDef.d.ts +4 -3
- package/models/colDef/gridColType.d.ts +3 -1
- package/models/events/gridEventLookup.d.ts +3 -3
- package/modern/components/GridColumnHeaders.js +3 -1
- package/modern/components/GridRow.js +22 -69
- package/modern/components/cell/GridCell.js +421 -45
- package/modern/components/cell/index.js +1 -1
- package/modern/components/containers/GridRootStyles.js +30 -16
- package/modern/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/modern/components/toolbar/GridToolbar.js +2 -2
- package/modern/components/virtualization/GridVirtualScroller.js +4 -9
- package/modern/components/virtualization/GridVirtualScrollerContent.js +10 -20
- package/modern/constants/defaultGridSlotsComponents.js +6 -2
- package/modern/hooks/core/useGridApiInitialization.js +4 -1
- package/modern/hooks/core/useGridStateInitialization.js +2 -9
- package/modern/hooks/features/clipboard/useGridClipboard.js +1 -4
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
- package/modern/hooks/features/editing/useGridCellEditing.js +5 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +14 -6
- package/modern/hooks/features/filter/gridFilterUtils.js +17 -12
- package/modern/hooks/features/filter/useGridFilter.js +2 -1
- package/modern/hooks/features/focus/useGridFocus.js +8 -4
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
- package/modern/hooks/features/rows/useGridParamsApi.js +7 -15
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +40 -38
- package/modern/hooks/utils/index.js +1 -1
- package/modern/hooks/utils/useGridSelector.js +37 -6
- package/modern/hooks/utils/useLazyRef.js +9 -0
- package/modern/hooks/utils/useOnMount.js +7 -0
- package/modern/index.js +1 -1
- package/modern/locales/elGR.js +66 -79
- package/modern/utils/Store.js +24 -0
- package/modern/utils/doesSupportPreventScroll.js +13 -0
- package/modern/utils/fastMemo.js +5 -0
- package/modern/utils/fastObjectShallowCompare.js +32 -0
- package/modern/utils/keyboardUtils.js +4 -2
- package/node/components/GridColumnHeaders.js +4 -2
- package/node/components/GridRow.js +22 -69
- package/node/components/cell/GridCell.js +424 -47
- package/node/components/cell/index.js +17 -10
- package/node/components/containers/GridRootStyles.js +30 -16
- package/node/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/node/components/toolbar/GridToolbar.js +2 -2
- package/node/components/virtualization/GridVirtualScroller.js +4 -9
- package/node/components/virtualization/GridVirtualScrollerContent.js +10 -20
- package/node/constants/defaultGridSlotsComponents.js +4 -1
- package/node/hooks/core/useGridApiInitialization.js +4 -1
- package/node/hooks/core/useGridStateInitialization.js +2 -9
- package/node/hooks/features/clipboard/useGridClipboard.js +1 -4
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +8 -2
- package/node/hooks/features/editing/useGridCellEditing.js +5 -3
- package/node/hooks/features/editing/useGridRowEditing.js +14 -6
- package/node/hooks/features/filter/gridFilterUtils.js +17 -12
- package/node/hooks/features/filter/useGridFilter.js +2 -1
- package/node/hooks/features/focus/useGridFocus.js +8 -4
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
- package/node/hooks/features/rows/useGridParamsApi.js +9 -15
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +40 -36
- package/node/hooks/utils/index.js +14 -10
- package/node/hooks/utils/useGridSelector.js +41 -7
- package/node/hooks/utils/useLazyRef.js +17 -0
- package/node/hooks/utils/useOnMount.js +15 -0
- package/node/index.js +1 -1
- package/node/locales/elGR.js +66 -79
- package/node/utils/Store.js +31 -0
- package/node/utils/doesSupportPreventScroll.js +19 -0
- package/node/utils/fastMemo.js +13 -0
- package/node/utils/fastObjectShallowCompare.js +38 -0
- package/node/utils/keyboardUtils.js +4 -2
- package/package.json +1 -1
- package/utils/Store.d.ts +11 -0
- package/utils/Store.js +24 -0
- package/utils/doesSupportPreventScroll.d.ts +1 -0
- package/utils/doesSupportPreventScroll.js +13 -0
- package/utils/fastMemo.d.ts +1 -0
- package/utils/fastMemo.js +5 -0
- package/utils/fastObjectShallowCompare.d.ts +1 -0
- package/utils/fastObjectShallowCompare.js +32 -0
- package/utils/keyboardUtils.js +4 -2
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.areRenderContextsEqual = void 0;
|
|
7
8
|
exports.binarySearch = binarySearch;
|
|
8
9
|
exports.useGridVirtualScroller = exports.getRenderableIndexes = void 0;
|
|
9
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
@@ -27,8 +28,7 @@ var _gridColumnsUtils = require("../columns/gridColumnsUtils");
|
|
|
27
28
|
var _gridRowsUtils = require("../rows/gridRowsUtils");
|
|
28
29
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
30
|
const _excluded = ["style"],
|
|
30
|
-
_excluded2 = ["style"]
|
|
31
|
-
_excluded3 = ["style"];
|
|
31
|
+
_excluded2 = ["style"];
|
|
32
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
33
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
34
34
|
// Uses binary search to avoid looping through all possible positions
|
|
@@ -67,6 +67,12 @@ const areRenderContextsEqual = (context1, context2) => {
|
|
|
67
67
|
}
|
|
68
68
|
return context1.firstRowIndex === context2.firstRowIndex && context1.lastRowIndex === context2.lastRowIndex && context1.firstColumnIndex === context2.firstColumnIndex && context1.lastColumnIndex === context2.lastColumnIndex;
|
|
69
69
|
};
|
|
70
|
+
exports.areRenderContextsEqual = areRenderContextsEqual;
|
|
71
|
+
// The `maxSize` is 3 so that reselect caches the `renderedColumns` values for the pinned left,
|
|
72
|
+
// unpinned, and pinned right sections.
|
|
73
|
+
const MEMOIZE_OPTIONS = {
|
|
74
|
+
maxSize: 3
|
|
75
|
+
};
|
|
70
76
|
const useGridVirtualScroller = props => {
|
|
71
77
|
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
72
78
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
@@ -106,7 +112,7 @@ const useGridVirtualScroller = props => {
|
|
|
106
112
|
const prevRootRowStyle = React.useRef();
|
|
107
113
|
const getRenderedColumnsRef = React.useRef((0, _reselect.defaultMemoize)((columns, firstColumnToRender, lastColumnToRender) => {
|
|
108
114
|
return columns.slice(firstColumnToRender, lastColumnToRender);
|
|
109
|
-
}));
|
|
115
|
+
}, MEMOIZE_OPTIONS));
|
|
110
116
|
const getNearestIndexToRender = React.useCallback(offset => {
|
|
111
117
|
const lastMeasuredIndexRelativeToAllRows = apiRef.current.getLastMeasuredRowIndex();
|
|
112
118
|
let allRowsMeasured = lastMeasuredIndexRelativeToAllRows === Infinity;
|
|
@@ -264,7 +270,7 @@ const useGridVirtualScroller = props => {
|
|
|
264
270
|
};
|
|
265
271
|
apiRef.current.publishEvent('scrollPositionChange', params);
|
|
266
272
|
}, [apiRef, computeRenderContext, containerDimensions.width, updateRenderContext]);
|
|
267
|
-
const handleScroll = event => {
|
|
273
|
+
const handleScroll = (0, _utils.unstable_useEventCallback)(event => {
|
|
268
274
|
const {
|
|
269
275
|
scrollTop,
|
|
270
276
|
scrollLeft
|
|
@@ -306,13 +312,13 @@ const useGridVirtualScroller = props => {
|
|
|
306
312
|
});
|
|
307
313
|
prevTotalWidth.current = columnsTotalWidth;
|
|
308
314
|
}
|
|
309
|
-
};
|
|
310
|
-
const handleWheel = event => {
|
|
315
|
+
});
|
|
316
|
+
const handleWheel = (0, _utils.unstable_useEventCallback)(event => {
|
|
311
317
|
apiRef.current.publishEvent('virtualScrollerWheel', {}, event);
|
|
312
|
-
};
|
|
313
|
-
const handleTouchMove = event => {
|
|
318
|
+
});
|
|
319
|
+
const handleTouchMove = (0, _utils.unstable_useEventCallback)(event => {
|
|
314
320
|
apiRef.current.publishEvent('virtualScrollerTouchMove', {}, event);
|
|
315
|
-
};
|
|
321
|
+
});
|
|
316
322
|
const getRows = (params = {
|
|
317
323
|
renderContext
|
|
318
324
|
}) => {
|
|
@@ -457,22 +463,25 @@ const useGridVirtualScroller = props => {
|
|
|
457
463
|
height,
|
|
458
464
|
minHeight: shouldExtendContent ? '100%' : 'auto'
|
|
459
465
|
};
|
|
466
|
+
if (rootProps.autoHeight && currentPage.rows.length === 0) {
|
|
467
|
+
size.height = (0, _gridRowsUtils.getMinimalContentHeight)(apiRef, rootProps.rowHeight); // Give room to show the overlay when there no rows.
|
|
468
|
+
}
|
|
469
|
+
|
|
460
470
|
return size;
|
|
461
|
-
}, [rootRef, columnsTotalWidth, rowsMeta.currentPageTotalHeight, needsHorizontalScrollbar]);
|
|
471
|
+
}, [apiRef, rootRef, columnsTotalWidth, rowsMeta.currentPageTotalHeight, needsHorizontalScrollbar, rootProps.autoHeight, rootProps.rowHeight, currentPage.rows.length]);
|
|
462
472
|
React.useEffect(() => {
|
|
463
473
|
apiRef.current.publishEvent('virtualScrollerContentSizeChange');
|
|
464
474
|
}, [apiRef, contentSize]);
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
}
|
|
475
|
+
const rootStyle = React.useMemo(() => {
|
|
476
|
+
const style = {};
|
|
477
|
+
if (!needsHorizontalScrollbar) {
|
|
478
|
+
style.overflowX = 'hidden';
|
|
479
|
+
}
|
|
480
|
+
if (rootProps.autoHeight) {
|
|
481
|
+
style.overflowY = 'hidden';
|
|
482
|
+
}
|
|
483
|
+
return style;
|
|
484
|
+
}, [needsHorizontalScrollbar, rootProps.autoHeight]);
|
|
476
485
|
const getRenderContext = React.useCallback(() => {
|
|
477
486
|
return prevRenderContext.current;
|
|
478
487
|
}, []);
|
|
@@ -483,23 +492,18 @@ const useGridVirtualScroller = props => {
|
|
|
483
492
|
renderContext,
|
|
484
493
|
updateRenderZonePosition,
|
|
485
494
|
getRows,
|
|
486
|
-
getRootProps: (
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
onWheel: handleWheel,
|
|
495
|
-
onTouchMove: handleTouchMove,
|
|
496
|
-
style: (0, _extends2.default)({}, style, rootStyle)
|
|
497
|
-
}, other);
|
|
498
|
-
},
|
|
495
|
+
getRootProps: (inputProps = {}) => (0, _extends2.default)({
|
|
496
|
+
ref: handleRef,
|
|
497
|
+
onScroll: handleScroll,
|
|
498
|
+
onWheel: handleWheel,
|
|
499
|
+
onTouchMove: handleTouchMove
|
|
500
|
+
}, inputProps, {
|
|
501
|
+
style: inputProps.style ? (0, _extends2.default)({}, inputProps.style, rootStyle) : rootStyle
|
|
502
|
+
}),
|
|
499
503
|
getContentProps: ({
|
|
500
|
-
style
|
|
504
|
+
style
|
|
501
505
|
} = {}) => ({
|
|
502
|
-
style: (0, _extends2.default)({}, style, contentSize)
|
|
506
|
+
style: style ? (0, _extends2.default)({}, style, contentSize) : contentSize
|
|
503
507
|
}),
|
|
504
508
|
getRenderZoneProps: () => ({
|
|
505
509
|
ref: renderZoneRef
|
|
@@ -3,9 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
useGridSelector: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "useGridSelector", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _useGridSelector.useGridSelector;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
6
15
|
var _useGridApiEventHandler = require("./useGridApiEventHandler");
|
|
7
16
|
Object.keys(_useGridApiEventHandler).forEach(function (key) {
|
|
8
17
|
if (key === "default" || key === "__esModule") return;
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
9
19
|
if (key in exports && exports[key] === _useGridApiEventHandler[key]) return;
|
|
10
20
|
Object.defineProperty(exports, key, {
|
|
11
21
|
enumerable: true,
|
|
@@ -17,6 +27,7 @@ Object.keys(_useGridApiEventHandler).forEach(function (key) {
|
|
|
17
27
|
var _useGridApiMethod = require("./useGridApiMethod");
|
|
18
28
|
Object.keys(_useGridApiMethod).forEach(function (key) {
|
|
19
29
|
if (key === "default" || key === "__esModule") return;
|
|
30
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
31
|
if (key in exports && exports[key] === _useGridApiMethod[key]) return;
|
|
21
32
|
Object.defineProperty(exports, key, {
|
|
22
33
|
enumerable: true,
|
|
@@ -28,6 +39,7 @@ Object.keys(_useGridApiMethod).forEach(function (key) {
|
|
|
28
39
|
var _useGridLogger = require("./useGridLogger");
|
|
29
40
|
Object.keys(_useGridLogger).forEach(function (key) {
|
|
30
41
|
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
31
43
|
if (key in exports && exports[key] === _useGridLogger[key]) return;
|
|
32
44
|
Object.defineProperty(exports, key, {
|
|
33
45
|
enumerable: true,
|
|
@@ -37,19 +49,10 @@ Object.keys(_useGridLogger).forEach(function (key) {
|
|
|
37
49
|
});
|
|
38
50
|
});
|
|
39
51
|
var _useGridSelector = require("./useGridSelector");
|
|
40
|
-
Object.keys(_useGridSelector).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _useGridSelector[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _useGridSelector[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
52
|
var _useGridNativeEventListener = require("./useGridNativeEventListener");
|
|
51
53
|
Object.keys(_useGridNativeEventListener).forEach(function (key) {
|
|
52
54
|
if (key === "default" || key === "__esModule") return;
|
|
55
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
53
56
|
if (key in exports && exports[key] === _useGridNativeEventListener[key]) return;
|
|
54
57
|
Object.defineProperty(exports, key, {
|
|
55
58
|
enumerable: true,
|
|
@@ -61,6 +64,7 @@ Object.keys(_useGridNativeEventListener).forEach(function (key) {
|
|
|
61
64
|
var _useFirstRender = require("./useFirstRender");
|
|
62
65
|
Object.keys(_useFirstRender).forEach(function (key) {
|
|
63
66
|
if (key === "default" || key === "__esModule") return;
|
|
67
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
64
68
|
if (key in exports && exports[key] === _useFirstRender[key]) return;
|
|
65
69
|
Object.defineProperty(exports, key, {
|
|
66
70
|
enumerable: true,
|
|
@@ -3,21 +3,55 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useGridSelector = void 0;
|
|
6
|
+
exports.useGridSelector = exports.objectShallowCompare = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _useLazyRef = require("./useLazyRef");
|
|
9
|
+
var _useOnMount = require("./useOnMount");
|
|
7
10
|
var _warning = require("../../utils/warning");
|
|
11
|
+
var _fastObjectShallowCompare = require("../../utils/fastObjectShallowCompare");
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
const stateNotInitializedWarning = (0, _warning.buildWarning)(['MUI: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
|
|
8
15
|
function isOutputSelector(selector) {
|
|
9
16
|
return selector.acceptsApiRef;
|
|
10
17
|
}
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
function applySelector(apiRef, selector) {
|
|
19
|
+
if (isOutputSelector(selector)) {
|
|
20
|
+
return selector(apiRef);
|
|
21
|
+
}
|
|
22
|
+
return selector(apiRef.current.state);
|
|
23
|
+
}
|
|
24
|
+
const defaultCompare = Object.is;
|
|
25
|
+
const objectShallowCompare = _fastObjectShallowCompare.fastObjectShallowCompare;
|
|
26
|
+
exports.objectShallowCompare = objectShallowCompare;
|
|
27
|
+
const createRefs = () => ({
|
|
28
|
+
state: null,
|
|
29
|
+
equals: null,
|
|
30
|
+
selector: null
|
|
31
|
+
});
|
|
32
|
+
const useGridSelector = (apiRef, selector, equals = defaultCompare) => {
|
|
13
33
|
if (process.env.NODE_ENV !== 'production') {
|
|
14
34
|
if (!apiRef.current.state) {
|
|
15
35
|
stateNotInitializedWarning();
|
|
16
36
|
}
|
|
17
37
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
const refs = (0, _useLazyRef.useLazyRef)(createRefs);
|
|
39
|
+
const didInit = refs.current.selector !== null;
|
|
40
|
+
const [state, setState] = React.useState(
|
|
41
|
+
// We don't use an initialization function to avoid allocations
|
|
42
|
+
didInit ? null : applySelector(apiRef, selector));
|
|
43
|
+
refs.current.state = state;
|
|
44
|
+
refs.current.equals = equals;
|
|
45
|
+
refs.current.selector = selector;
|
|
46
|
+
(0, _useOnMount.useOnMount)(() => {
|
|
47
|
+
return apiRef.current.store.subscribe(() => {
|
|
48
|
+
const newState = applySelector(apiRef, refs.current.selector);
|
|
49
|
+
if (!refs.current.equals(refs.current.state, newState)) {
|
|
50
|
+
refs.current.state = newState;
|
|
51
|
+
setState(newState);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
return state;
|
|
22
56
|
};
|
|
23
57
|
exports.useGridSelector = useGridSelector;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useLazyRef = useLazyRef;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
|
+
const UNINITIALIZED = {};
|
|
11
|
+
function useLazyRef(init, initArg) {
|
|
12
|
+
const ref = React.useRef(UNINITIALIZED);
|
|
13
|
+
if (ref.current === UNINITIALIZED) {
|
|
14
|
+
ref.current = init(initArg);
|
|
15
|
+
}
|
|
16
|
+
return ref;
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useOnMount = useOnMount;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
|
+
const EMPTY = [];
|
|
11
|
+
function useOnMount(fn) {
|
|
12
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
13
|
+
React.useEffect(fn, EMPTY);
|
|
14
|
+
/* eslint-enable react-hooks/exhaustive-deps */
|
|
15
|
+
}
|
package/node/index.js
CHANGED
package/node/locales/elGR.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.elGR = void 0;
|
|
7
|
+
var _locale = require("@mui/material/locale");
|
|
7
8
|
var _getGridLocalization = require("../utils/getGridLocalization");
|
|
8
9
|
const elGRGrid = {
|
|
9
10
|
// Root
|
|
@@ -25,17 +26,15 @@ const elGRGrid = {
|
|
|
25
26
|
toolbarFiltersTooltipShow: 'Εμφάνιση φίλτρων',
|
|
26
27
|
toolbarFiltersTooltipActive: count => count !== 1 ? `${count} ενεργά φίλτρα` : `${count} ενεργό φίλτρο`,
|
|
27
28
|
// Quick filter toolbar field
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
toolbarQuickFilterPlaceholder: 'Αναζήτηση…',
|
|
30
|
+
toolbarQuickFilterLabel: 'Αναζήτηση',
|
|
31
|
+
toolbarQuickFilterDeleteIconLabel: 'Καθαρισμός',
|
|
32
32
|
// Export selector toolbar button text
|
|
33
33
|
toolbarExport: 'Εξαγωγή',
|
|
34
34
|
toolbarExportLabel: 'Εξαγωγή',
|
|
35
35
|
toolbarExportCSV: 'Λήψη ως CSV',
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
toolbarExportPrint: 'Εκτύπωση',
|
|
37
|
+
toolbarExportExcel: 'Λήψη ως Excel',
|
|
39
38
|
// Columns panel text
|
|
40
39
|
columnsPanelTextFieldLabel: 'Εύρεση στήλης',
|
|
41
40
|
columnsPanelTextFieldPlaceholder: 'Επικεφαλίδα στήλης',
|
|
@@ -44,9 +43,9 @@ const elGRGrid = {
|
|
|
44
43
|
columnsPanelHideAllButton: 'Απόκρυψη όλων',
|
|
45
44
|
// Filter panel text
|
|
46
45
|
filterPanelAddFilter: 'Προσθήκη φίλτρου',
|
|
47
|
-
|
|
46
|
+
filterPanelRemoveAll: 'Αφαίρεση όλων',
|
|
48
47
|
filterPanelDeleteIconLabel: 'Διαγραφή',
|
|
49
|
-
|
|
48
|
+
filterPanelLogicOperator: 'Λογικός τελεστής',
|
|
50
49
|
filterPanelOperator: 'Τελεστές',
|
|
51
50
|
filterPanelOperatorAnd: 'Καί',
|
|
52
51
|
filterPanelOperatorOr: 'Ή',
|
|
@@ -66,44 +65,41 @@ const elGRGrid = {
|
|
|
66
65
|
filterOperatorOnOrBefore: 'είναι ίσο ή πριν',
|
|
67
66
|
filterOperatorIsEmpty: 'είναι κενό',
|
|
68
67
|
filterOperatorIsNotEmpty: 'δεν είναι κενό',
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
filterOperatorIsAnyOf: 'είναι οποιοδήποτε από',
|
|
69
|
+
'filterOperator=': '=',
|
|
70
|
+
'filterOperator!=': '!=',
|
|
71
|
+
'filterOperator>': '>',
|
|
72
|
+
'filterOperator>=': '>=',
|
|
73
|
+
'filterOperator<': '<',
|
|
74
|
+
'filterOperator<=': '<=',
|
|
77
75
|
// Header filter operators text
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
76
|
+
headerFilterOperatorContains: 'Περιέχει',
|
|
77
|
+
headerFilterOperatorEquals: 'Ισούται',
|
|
78
|
+
headerFilterOperatorStartsWith: 'Ξεκινάει με',
|
|
79
|
+
headerFilterOperatorEndsWith: 'Τελειώνει με',
|
|
80
|
+
headerFilterOperatorIs: 'Είναι',
|
|
81
|
+
headerFilterOperatorNot: 'Δεν είναι',
|
|
82
|
+
headerFilterOperatorAfter: 'Είναι μετά',
|
|
83
|
+
headerFilterOperatorOnOrAfter: 'Είναι ίσο ή μετά',
|
|
84
|
+
headerFilterOperatorBefore: 'Είναι πριν',
|
|
85
|
+
headerFilterOperatorOnOrBefore: 'Είναι ίσο ή πριν',
|
|
86
|
+
headerFilterOperatorIsEmpty: 'Είναι κενό',
|
|
87
|
+
headerFilterOperatorIsNotEmpty: 'Δεν είναι κενό',
|
|
88
|
+
headerFilterOperatorIsAnyOf: 'Είναι οποιοδήποτε από',
|
|
89
|
+
'headerFilterOperator=': 'Ισούται',
|
|
90
|
+
'headerFilterOperator!=': 'Δεν ισούται',
|
|
91
|
+
'headerFilterOperator>': 'Μεγαλύτερο από',
|
|
92
|
+
'headerFilterOperator>=': 'Μεγαλύτερο ή ίσο με',
|
|
93
|
+
'headerFilterOperator<': 'Μικρότερο από',
|
|
94
|
+
'headerFilterOperator<=': 'Μικρότερο ή ίσο με',
|
|
98
95
|
// Filter values text
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
filterValueAny: 'οποιοδήποτε',
|
|
97
|
+
filterValueTrue: 'αληθές',
|
|
98
|
+
filterValueFalse: 'ψευδές',
|
|
103
99
|
// Column menu text
|
|
104
100
|
columnMenuLabel: 'Μενού',
|
|
105
101
|
columnMenuShowColumns: 'Εμφάνιση στηλών',
|
|
106
|
-
|
|
102
|
+
columnMenuManageColumns: 'Διαχείριση στηλών',
|
|
107
103
|
columnMenuFilter: 'Φίλτρο',
|
|
108
104
|
columnMenuHideColumn: 'Απόκρυψη',
|
|
109
105
|
columnMenuUnsort: 'Απενεργοποίηση ταξινόμησης',
|
|
@@ -120,50 +116,41 @@ const elGRGrid = {
|
|
|
120
116
|
// Total visible row amount footer text
|
|
121
117
|
footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} από ${totalCount.toLocaleString()}`,
|
|
122
118
|
// Checkbox selection text
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
119
|
+
checkboxSelectionHeaderName: 'Επιλογή πλαισίου ελέγχου',
|
|
120
|
+
checkboxSelectionSelectAllRows: 'Επιλέξτε όλες τις σειρές',
|
|
121
|
+
checkboxSelectionUnselectAllRows: 'Καταργήση επιλογής όλων των σειρών',
|
|
122
|
+
checkboxSelectionSelectRow: 'Επιλογή γραμμής',
|
|
123
|
+
checkboxSelectionUnselectRow: 'Καταργήση επιλογής γραμμής',
|
|
129
124
|
// Boolean cell text
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
booleanCellTrueLabel: 'ναί',
|
|
126
|
+
booleanCellFalseLabel: 'όχι',
|
|
133
127
|
// Actions cell more text
|
|
134
|
-
actionsCellMore: 'περισσότερα'
|
|
135
|
-
|
|
128
|
+
actionsCellMore: 'περισσότερα',
|
|
136
129
|
// Column pinning text
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
130
|
+
pinToLeft: 'Καρφιτσώμα στα αριστερά',
|
|
131
|
+
pinToRight: 'Καρφιτσώμα στα δεξιά',
|
|
132
|
+
unpin: 'Ξεκαρφίτσωμα',
|
|
141
133
|
// Tree Data
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
134
|
+
treeDataGroupingHeaderName: 'Ομαδοποίηση',
|
|
135
|
+
treeDataExpand: 'εμφάνιση περιεχομένων',
|
|
136
|
+
treeDataCollapse: 'απόκρυψη περιεχομένων',
|
|
146
137
|
// Grouping columns
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
138
|
+
groupingColumnHeaderName: 'Ομαδοποίηση',
|
|
139
|
+
groupColumn: name => `Ομαδοποίηση κατά ${name}`,
|
|
140
|
+
unGroupColumn: name => `Διακοπή ομαδοποίησης κατά ${name}`,
|
|
151
141
|
// Master/detail
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
142
|
+
detailPanelToggle: 'Εναλλαγή πίνακα λεπτομερειών',
|
|
143
|
+
expandDetailPanel: 'Ανάπτυξη',
|
|
144
|
+
collapseDetailPanel: 'Σύμπτυξη',
|
|
156
145
|
// Row reordering text
|
|
157
|
-
|
|
158
|
-
|
|
146
|
+
rowReorderingHeaderName: 'Αναδιάταξη γραμμών',
|
|
159
147
|
// Aggregation
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
148
|
+
aggregationMenuItemHeader: 'Συσσωμάτωση',
|
|
149
|
+
aggregationFunctionLabelSum: 'άθροισμα',
|
|
150
|
+
aggregationFunctionLabelAvg: 'μέση τιμή',
|
|
151
|
+
aggregationFunctionLabelMin: 'ελάχιστο',
|
|
152
|
+
aggregationFunctionLabelMax: 'μέγιστο',
|
|
153
|
+
aggregationFunctionLabelSize: 'μέγεθος'
|
|
166
154
|
};
|
|
167
|
-
|
|
168
|
-
const elGR = (0, _getGridLocalization.getGridLocalization)(elGRGrid);
|
|
155
|
+
const elGR = (0, _getGridLocalization.getGridLocalization)(elGRGrid, _locale.elGR);
|
|
169
156
|
exports.elGR = elGR;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Store = void 0;
|
|
7
|
+
class Store {
|
|
8
|
+
static create(value) {
|
|
9
|
+
return new Store(value);
|
|
10
|
+
}
|
|
11
|
+
constructor(_value) {
|
|
12
|
+
this.value = void 0;
|
|
13
|
+
this.listeners = void 0;
|
|
14
|
+
this.subscribe = fn => {
|
|
15
|
+
this.listeners.add(fn);
|
|
16
|
+
return () => {
|
|
17
|
+
this.listeners.delete(fn);
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
this.getSnapshot = () => {
|
|
21
|
+
return this.value;
|
|
22
|
+
};
|
|
23
|
+
this.update = value => {
|
|
24
|
+
this.value = value;
|
|
25
|
+
this.listeners.forEach(l => l(value));
|
|
26
|
+
};
|
|
27
|
+
this.value = _value;
|
|
28
|
+
this.listeners = new Set();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.Store = Store;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.doesSupportPreventScroll = doesSupportPreventScroll;
|
|
7
|
+
// Based on https://stackoverflow.com/a/59518678
|
|
8
|
+
let cachedSupportsPreventScroll;
|
|
9
|
+
function doesSupportPreventScroll() {
|
|
10
|
+
if (cachedSupportsPreventScroll === undefined) {
|
|
11
|
+
document.createElement('div').focus({
|
|
12
|
+
get preventScroll() {
|
|
13
|
+
cachedSupportsPreventScroll = true;
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return cachedSupportsPreventScroll;
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.fastMemo = fastMemo;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _fastObjectShallowCompare = require("./fastObjectShallowCompare");
|
|
9
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
+
function fastMemo(component) {
|
|
12
|
+
return /*#__PURE__*/React.memo(component, _fastObjectShallowCompare.fastObjectShallowCompare);
|
|
13
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.fastObjectShallowCompare = fastObjectShallowCompare;
|
|
7
|
+
const is = Object.is;
|
|
8
|
+
function fastObjectShallowCompare(a, b) {
|
|
9
|
+
if (a === b) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
if (!(a instanceof Object) || !(b instanceof Object)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
let aLength = 0;
|
|
16
|
+
let bLength = 0;
|
|
17
|
+
|
|
18
|
+
/* eslint-disable no-restricted-syntax */
|
|
19
|
+
/* eslint-disable guard-for-in */
|
|
20
|
+
for (const key in a) {
|
|
21
|
+
aLength += 1;
|
|
22
|
+
if (!is(a[key], b[key])) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
if (!(key in b)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars */
|
|
31
|
+
for (const _ in b) {
|
|
32
|
+
bLength += 1;
|
|
33
|
+
}
|
|
34
|
+
/* eslint-enable no-restricted-syntax */
|
|
35
|
+
/* eslint-enable guard-for-in */
|
|
36
|
+
|
|
37
|
+
return aLength === bLength;
|
|
38
|
+
}
|
|
@@ -24,12 +24,14 @@ const isDeleteKeys = key => key === 'Delete' || key === 'Backspace';
|
|
|
24
24
|
|
|
25
25
|
// Non printable keys have a name, e.g. "ArrowRight", see the whole list:
|
|
26
26
|
// https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values
|
|
27
|
-
//
|
|
27
|
+
// So event.key.length === 1 is often enough.
|
|
28
|
+
//
|
|
29
|
+
// However, we also need to ignore shortcuts, for example: select all:
|
|
28
30
|
// - Windows: Ctrl+A, event.ctrlKey is true
|
|
29
31
|
// - macOS: ⌘ Command+A, event.metaKey is true
|
|
30
32
|
exports.isDeleteKeys = isDeleteKeys;
|
|
31
33
|
function isPrintableKey(event) {
|
|
32
|
-
return event.key.length === 1 && event.ctrlKey
|
|
34
|
+
return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
|
|
33
35
|
}
|
|
34
36
|
const GRID_MULTIPLE_SELECTION_KEYS = ['Meta', 'Control', 'Shift'];
|
|
35
37
|
exports.GRID_MULTIPLE_SELECTION_KEYS = GRID_MULTIPLE_SELECTION_KEYS;
|