@linzjs/step-ag-grid 31.2.4 → 32.0.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/dist/GridTheme.scss +4 -4
- package/dist/index.css +5 -1
- package/dist/src/components/GridCell.d.ts +1 -1
- package/dist/src/components/GridLoadableCell.d.ts +1 -1
- package/dist/src/components/GridNoRowsOverlay.d.ts +1 -1
- package/dist/src/components/GridPopoverHook.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilterDownloadCsvButton.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilterQuick.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilters.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormEditBearing.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormInlineTextInput.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +2 -2
- package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormTextInput.d.ts +1 -1
- package/dist/src/components/gridHeader/GridHeaderSelect.d.ts +1 -1
- package/dist/src/components/gridHook/useGridContextMenu.d.ts +1 -1
- package/dist/src/components/gridHook/useGridCopy.d.ts +1 -1
- package/dist/src/components/gridHook/useGridRangeSelection.d.ts +1 -1
- package/dist/src/components/gridRender/GridRenderPopoutMenuCell.d.ts +1 -1
- package/dist/src/contexts/GridPopoverContextProvider.d.ts +1 -1
- package/dist/src/contexts/GridUpdatingContextProvider.d.ts +1 -1
- package/dist/src/lui/FormError.d.ts +1 -1
- package/dist/src/lui/TextAreaInput.d.ts +1 -1
- package/dist/src/react-menu3/components/ControlledMenu.d.ts +1 -1
- package/dist/src/react-menu3/components/FocusableItem.d.ts +1 -1
- package/dist/src/react-menu3/components/Menu.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuGroup.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuHeader.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuList.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +1 -1
- package/dist/src/react-menu3/components/SubMenu.d.ts +1 -1
- package/dist/src/utils/useSharedInterval.d.ts +5 -0
- package/dist/step-ag-grid.cjs +247 -102
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +247 -102
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +29 -30
- package/src/components/gridHook/useGridRangeSelection.ts +1 -1
- package/src/components/gridPopoverEdit/GridEditBoolean.tsx +64 -26
- package/src/contexts/GridContextProvider.tsx +18 -5
- package/src/react-app-env.d.ts +4 -1
- package/src/stories/grid/GridFilterColumnsMultiSelect.stories.tsx +1 -1
- package/src/stories/grid/GridNonEditableRow.stories.tsx +2 -2
- package/src/stories/grid/GridPopoutEditBoolean.stories.tsx +48 -9
- package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +1 -1
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +1 -1
- package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +1 -1
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectGridInteraction.stories.tsx +1 -1
- package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +1 -1
- package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +1 -1
- package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +1 -1
- package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +1 -1
- package/src/stories/grid/gridFormStatic/GridFormDropDown.stories.tsx +1 -1
- package/src/stories/grid/gridFormStatic/GridFormEditBearing.stories.tsx +1 -1
- package/src/stories/grid/gridFormStatic/GridFormEditBearingCorrection.stories.tsx +1 -1
- package/src/stories/grid/gridFormStatic/GridFormMessage.stories.tsx +1 -1
- package/src/stories/grid/gridFormStatic/GridFormMultiSelect.stories.tsx +1 -1
- package/src/stories/grid/gridFormStatic/GridFormPopoverMenu.stories.tsx +1 -1
- package/src/stories/grid/gridFormStatic/GridFormTextArea.stories.tsx +1 -1
- package/src/stories/grid/gridFormStatic/GridFormTextInput.stories.tsx +1 -1
- package/src/styles/GridLoadableCell.scss +5 -1
- package/src/styles/GridTheme.scss +4 -4
- package/src/utils/useSharedInterval.ts +57 -0
- package/src/utils/util.ts +4 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { useIsomorphicLayoutEffect } from 'usehooks-ts';
|
|
3
|
+
|
|
4
|
+
type Callback = () => void;
|
|
5
|
+
|
|
6
|
+
const isNode = typeof process !== 'undefined' && process.env.NODE_ENV === 'test';
|
|
7
|
+
|
|
8
|
+
let sharedIntervalId: ReturnType<typeof setInterval> | null = null;
|
|
9
|
+
const callbacks = new Set<Callback>();
|
|
10
|
+
|
|
11
|
+
const startSharedInterval = () => {
|
|
12
|
+
if (isNode || sharedIntervalId !== null) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
sharedIntervalId = setInterval(() => {
|
|
16
|
+
callbacks.forEach((cb) => {
|
|
17
|
+
try {
|
|
18
|
+
cb();
|
|
19
|
+
} catch (e) {
|
|
20
|
+
console.error(e);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}, 100);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const stopSharedInterval = () => {
|
|
27
|
+
if (sharedIntervalId === null) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
clearInterval(sharedIntervalId);
|
|
31
|
+
sharedIntervalId = null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Like useInterval, but all callers share a single 100ms interval.
|
|
36
|
+
* Each callback is isolated in a try/catch so a throwing callback won't prevent others from running.
|
|
37
|
+
*/
|
|
38
|
+
export const useSharedInterval = (callback: () => void) => {
|
|
39
|
+
const savedCallback = useRef(callback);
|
|
40
|
+
|
|
41
|
+
useIsomorphicLayoutEffect(() => {
|
|
42
|
+
savedCallback.current = callback;
|
|
43
|
+
}, [callback]);
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const cb = () => savedCallback.current();
|
|
47
|
+
callbacks.add(cb);
|
|
48
|
+
startSharedInterval();
|
|
49
|
+
|
|
50
|
+
return () => {
|
|
51
|
+
callbacks.delete(cb);
|
|
52
|
+
if (callbacks.size === 0) {
|
|
53
|
+
stopSharedInterval();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}, []);
|
|
57
|
+
}
|
package/src/utils/util.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { isEmpty, negate } from 'lodash-es';
|
|
2
|
-
import
|
|
2
|
+
import natsortModule from 'natsort';
|
|
3
|
+
// natsort is a CJS module that sets exports.default, so interop wraps it in an extra layer
|
|
4
|
+
const natsort: typeof natsortModule = (natsortModule as any).default ?? natsortModule;
|
|
3
5
|
|
|
4
6
|
export type MaybePromise<T> = T | Promise<T>;
|
|
5
7
|
|
|
@@ -52,7 +54,7 @@ export const fnOrVar = (fn: any, param?: any) => (typeof fn === 'function' ? fn(
|
|
|
52
54
|
export const sanitiseFileName = (filename: string): string => {
|
|
53
55
|
const valid = filename
|
|
54
56
|
.trim()
|
|
55
|
-
.replaceAll(/(
|
|
57
|
+
.replaceAll(/([\/\\])+/g, '-')
|
|
56
58
|
.replaceAll(/\s+/g, '_')
|
|
57
59
|
.replaceAll(/[^\w\-āēīōūĀĒĪŌŪ.]/g, '');
|
|
58
60
|
const parts = valid.split('.');
|