@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
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -58454,8 +58454,10 @@ function requireLib () {
|
|
|
58454
58454
|
}
|
|
58455
58455
|
|
|
58456
58456
|
var libExports = requireLib();
|
|
58457
|
-
var
|
|
58457
|
+
var natsortModule = /*@__PURE__*/getDefaultExportFromCjs(libExports);
|
|
58458
58458
|
|
|
58459
|
+
// natsort is a CJS module that sets exports.default, so interop wraps it in an extra layer
|
|
58460
|
+
const natsort = natsortModule.default ?? natsortModule;
|
|
58459
58461
|
const isNotEmpty = negate(isEmpty);
|
|
58460
58462
|
const wait = (timeoutMs) => new Promise((resolve) => {
|
|
58461
58463
|
setTimeout(resolve, timeoutMs);
|
|
@@ -58497,7 +58499,7 @@ const fnOrVar = (fn, param) => (typeof fn === 'function' ? fn(param) : fn);
|
|
|
58497
58499
|
const sanitiseFileName = (filename) => {
|
|
58498
58500
|
const valid = filename
|
|
58499
58501
|
.trim()
|
|
58500
|
-
.replaceAll(/(
|
|
58502
|
+
.replaceAll(/([\/\\])+/g, '-')
|
|
58501
58503
|
.replaceAll(/\s+/g, '_')
|
|
58502
58504
|
.replaceAll(/[^\w\-āēīōūĀĒĪŌŪ.]/g, '');
|
|
58503
58505
|
const parts = valid.split('.');
|
|
@@ -59020,14 +59022,6 @@ const useMenuChange = (onMenuChange, isOpen) => {
|
|
|
59020
59022
|
}, [onMenuChange, isOpen]);
|
|
59021
59023
|
};
|
|
59022
59024
|
|
|
59023
|
-
//#region src/utils.ts
|
|
59024
|
-
const PRE_ENTER = 0;
|
|
59025
|
-
const ENTERING = 1;
|
|
59026
|
-
const ENTERED = 2;
|
|
59027
|
-
const PRE_EXIT = 3;
|
|
59028
|
-
const EXITING = 4;
|
|
59029
|
-
const EXITED = 5;
|
|
59030
|
-
const UNMOUNTED = 6;
|
|
59031
59025
|
const STATUS = [
|
|
59032
59026
|
"preEnter",
|
|
59033
59027
|
"entering",
|
|
@@ -59038,67 +59032,76 @@ const STATUS = [
|
|
|
59038
59032
|
"unmounted"
|
|
59039
59033
|
];
|
|
59040
59034
|
const getState = (status) => ({
|
|
59041
|
-
|
|
59035
|
+
$: status,
|
|
59042
59036
|
status: STATUS[status],
|
|
59043
|
-
isEnter: status <
|
|
59044
|
-
isMounted: status !==
|
|
59045
|
-
isResolved: status ===
|
|
59037
|
+
isEnter: status < 3,
|
|
59038
|
+
isMounted: status !== 6,
|
|
59039
|
+
isResolved: status === 2 || status > 4
|
|
59046
59040
|
});
|
|
59047
|
-
const startOrEnd = (unmounted) => unmounted ?
|
|
59041
|
+
const startOrEnd = (unmounted) => unmounted ? 6 : 5;
|
|
59048
59042
|
const getEndStatus = (status, unmountOnExit) => {
|
|
59049
59043
|
switch (status) {
|
|
59050
|
-
case
|
|
59051
|
-
case
|
|
59052
|
-
case
|
|
59053
|
-
case
|
|
59044
|
+
case 1:
|
|
59045
|
+
case 0: return 2;
|
|
59046
|
+
case 4:
|
|
59047
|
+
case 3: return startOrEnd(unmountOnExit);
|
|
59054
59048
|
}
|
|
59055
59049
|
};
|
|
59056
59050
|
const getTimeout = (timeout) => typeof timeout === "object" ? [timeout.enter, timeout.exit] : [timeout, timeout];
|
|
59057
|
-
const
|
|
59058
|
-
|
|
59059
|
-
|
|
59060
|
-
}
|
|
59051
|
+
const nextTick = (callback, config) => {
|
|
59052
|
+
config.r = requestAnimationFrame(() => {
|
|
59053
|
+
config.r = requestAnimationFrame(callback);
|
|
59054
|
+
});
|
|
59055
|
+
};
|
|
59061
59056
|
|
|
59062
59057
|
//#region src/useTransitionState.ts
|
|
59063
|
-
const updateState = (status, setState,
|
|
59064
|
-
clearTimeout(
|
|
59058
|
+
const updateState = (status, setState, ref, onChange) => {
|
|
59059
|
+
clearTimeout(ref.t);
|
|
59060
|
+
cancelAnimationFrame(ref.r);
|
|
59065
59061
|
const state = getState(status);
|
|
59066
59062
|
setState(state);
|
|
59067
|
-
|
|
59068
|
-
onChange
|
|
59063
|
+
ref.s = state;
|
|
59064
|
+
onChange?.({ current: state });
|
|
59069
59065
|
};
|
|
59070
59066
|
const useTransitionState = ({ enter = true, exit = true, preEnter, preExit, timeout, initialEntered, mountOnEnter, unmountOnExit, onStateChange: onChange } = {}) => {
|
|
59071
|
-
const [state, setState] = useState(() => getState(initialEntered ?
|
|
59072
|
-
const
|
|
59073
|
-
|
|
59067
|
+
const [state, setState] = useState(() => getState(initialEntered ? 2 : startOrEnd(mountOnEnter)));
|
|
59068
|
+
const [ref] = useState({
|
|
59069
|
+
s: state,
|
|
59070
|
+
r: 0
|
|
59071
|
+
});
|
|
59074
59072
|
const [enterTimeout, exitTimeout] = getTimeout(timeout);
|
|
59075
59073
|
const endTransition = useCallback(() => {
|
|
59076
|
-
const status = getEndStatus(
|
|
59077
|
-
status
|
|
59078
|
-
}, [
|
|
59074
|
+
const status = getEndStatus(ref.s.$, unmountOnExit);
|
|
59075
|
+
if (status) updateState(status, setState, ref, onChange);
|
|
59076
|
+
}, [
|
|
59077
|
+
onChange,
|
|
59078
|
+
unmountOnExit,
|
|
59079
|
+
ref
|
|
59080
|
+
]);
|
|
59079
59081
|
return [
|
|
59080
59082
|
state,
|
|
59081
59083
|
useCallback((toEnter) => {
|
|
59082
59084
|
const transitState = (status) => {
|
|
59083
|
-
updateState(status, setState,
|
|
59085
|
+
updateState(status, setState, ref, onChange);
|
|
59084
59086
|
switch (status) {
|
|
59085
|
-
case
|
|
59086
|
-
if (enterTimeout >= 0)
|
|
59087
|
+
case 1:
|
|
59088
|
+
if (enterTimeout >= 0) ref.t = setTimeout(endTransition, enterTimeout);
|
|
59087
59089
|
break;
|
|
59088
|
-
case
|
|
59089
|
-
if (exitTimeout >= 0)
|
|
59090
|
+
case 4:
|
|
59091
|
+
if (exitTimeout >= 0) ref.t = setTimeout(endTransition, exitTimeout);
|
|
59090
59092
|
break;
|
|
59091
|
-
case
|
|
59092
|
-
case
|
|
59093
|
-
|
|
59093
|
+
case 0:
|
|
59094
|
+
case 3:
|
|
59095
|
+
nextTick(() => transitState(status + 1), ref);
|
|
59094
59096
|
break;
|
|
59095
59097
|
}
|
|
59096
59098
|
};
|
|
59097
|
-
const enterStage =
|
|
59099
|
+
const enterStage = ref.s.isEnter;
|
|
59098
59100
|
if (typeof toEnter !== "boolean") toEnter = !enterStage;
|
|
59099
|
-
if (toEnter) !enterStage && transitState(enter ? preEnter ?
|
|
59100
|
-
else enterStage && transitState(exit ? preExit ?
|
|
59101
|
+
if (toEnter) !enterStage && transitState(enter ? preEnter ? 0 : 1 : 2);
|
|
59102
|
+
else enterStage && transitState(exit ? preExit ? 3 : 4 : startOrEnd(unmountOnExit));
|
|
59101
59103
|
}, [
|
|
59104
|
+
ref,
|
|
59102
59105
|
endTransition,
|
|
59103
59106
|
onChange,
|
|
59104
59107
|
enter,
|
|
@@ -62693,20 +62696,25 @@ const regexpCache = new Map();
|
|
|
62693
62696
|
const sanitizeArray = (input, inputName) => {
|
|
62694
62697
|
if (!Array.isArray(input)) {
|
|
62695
62698
|
switch (typeof input) {
|
|
62696
|
-
case 'string':
|
|
62699
|
+
case 'string': {
|
|
62697
62700
|
input = [input];
|
|
62698
62701
|
break;
|
|
62699
|
-
|
|
62702
|
+
}
|
|
62703
|
+
|
|
62704
|
+
case 'undefined': {
|
|
62700
62705
|
input = [];
|
|
62701
62706
|
break;
|
|
62702
|
-
|
|
62707
|
+
}
|
|
62708
|
+
|
|
62709
|
+
default: {
|
|
62703
62710
|
throw new TypeError(`Expected '${inputName}' to be a string or an array, but got a type of '${typeof input}'`);
|
|
62711
|
+
}
|
|
62704
62712
|
}
|
|
62705
62713
|
}
|
|
62706
62714
|
|
|
62707
62715
|
return input.filter(string => {
|
|
62708
62716
|
if (typeof string !== 'string') {
|
|
62709
|
-
if (
|
|
62717
|
+
if (string === undefined) {
|
|
62710
62718
|
return false;
|
|
62711
62719
|
}
|
|
62712
62720
|
|
|
@@ -62723,7 +62731,8 @@ const makeRegexp = (pattern, options) => {
|
|
|
62723
62731
|
...options,
|
|
62724
62732
|
};
|
|
62725
62733
|
|
|
62726
|
-
const
|
|
62734
|
+
const flags = 's' + (options.caseSensitive ? '' : 'i'); // Always dotAll, optionally case-insensitive
|
|
62735
|
+
const cacheKey = pattern + '|' + flags;
|
|
62727
62736
|
|
|
62728
62737
|
if (regexpCache.has(cacheKey)) {
|
|
62729
62738
|
return regexpCache.get(cacheKey);
|
|
@@ -62735,9 +62744,19 @@ const makeRegexp = (pattern, options) => {
|
|
|
62735
62744
|
pattern = pattern.slice(1);
|
|
62736
62745
|
}
|
|
62737
62746
|
|
|
62738
|
-
|
|
62747
|
+
// Handle escapes: first preserve escaped chars, then convert * to wildcards
|
|
62748
|
+
pattern = pattern
|
|
62749
|
+
.replaceAll(String.raw`\*`, '__ESCAPED_STAR__') // \* -> placeholder
|
|
62750
|
+
.replaceAll('\\\\', '__ESCAPED_BACKSLASH__') // \\ -> placeholder
|
|
62751
|
+
.replaceAll(/\\(.)/g, '$1'); // Other escapes like \<space> -> <space>
|
|
62752
|
+
|
|
62753
|
+
pattern = escapeStringRegexp(pattern).replaceAll(String.raw`\*`, '.*'); // * -> .*
|
|
62739
62754
|
|
|
62740
|
-
|
|
62755
|
+
pattern = pattern
|
|
62756
|
+
.replaceAll('__ESCAPED_STAR__', String.raw`\*`) // Restore escaped *
|
|
62757
|
+
.replaceAll('__ESCAPED_BACKSLASH__', '\\\\'); // Restore escaped \
|
|
62758
|
+
|
|
62759
|
+
const regexp = new RegExp(`^${pattern}$`, flags);
|
|
62741
62760
|
regexp.negated = negated;
|
|
62742
62761
|
regexpCache.set(cacheKey, regexp);
|
|
62743
62762
|
|
|
@@ -62754,47 +62773,83 @@ const baseMatcher = (inputs, patterns, options, firstMatchOnly) => {
|
|
|
62754
62773
|
|
|
62755
62774
|
patterns = patterns.map(pattern => makeRegexp(pattern, options));
|
|
62756
62775
|
|
|
62776
|
+
// Partition patterns for faster processing
|
|
62777
|
+
const negatedPatterns = patterns.filter(pattern => pattern.negated);
|
|
62778
|
+
const positivePatterns = patterns.filter(pattern => !pattern.negated);
|
|
62779
|
+
|
|
62757
62780
|
const {allPatterns} = {};
|
|
62758
62781
|
const result = [];
|
|
62759
62782
|
|
|
62760
|
-
for
|
|
62761
|
-
|
|
62762
|
-
//
|
|
62763
|
-
|
|
62764
|
-
|
|
62765
|
-
|
|
62783
|
+
// Special handling for multiple negations with allPatterns and isMatch
|
|
62784
|
+
if (allPatterns && firstMatchOnly && negatedPatterns.length > 1 && positivePatterns.length === 0) {
|
|
62785
|
+
// Multiple negations only: ALL inputs must satisfy constraints (none should match any negation)
|
|
62786
|
+
for (const input of inputs) {
|
|
62787
|
+
for (const pattern of negatedPatterns) {
|
|
62788
|
+
if (pattern.test(input)) {
|
|
62789
|
+
return []; // Any input matching a negation means no match
|
|
62790
|
+
}
|
|
62791
|
+
}
|
|
62792
|
+
}
|
|
62766
62793
|
|
|
62767
|
-
|
|
62768
|
-
|
|
62769
|
-
didFit[index] = true;
|
|
62770
|
-
matches = !pattern.negated;
|
|
62794
|
+
return inputs.slice(0, 1); // All inputs passed negation constraints
|
|
62795
|
+
}
|
|
62771
62796
|
|
|
62772
|
-
|
|
62773
|
-
|
|
62774
|
-
|
|
62797
|
+
for (const input of inputs) {
|
|
62798
|
+
// Check negated patterns first (immediate exclusion)
|
|
62799
|
+
let excludedByNegation = false;
|
|
62800
|
+
for (const pattern of negatedPatterns) {
|
|
62801
|
+
if (pattern.test(input)) {
|
|
62802
|
+
excludedByNegation = true;
|
|
62803
|
+
break;
|
|
62775
62804
|
}
|
|
62776
62805
|
}
|
|
62777
62806
|
|
|
62778
|
-
if (
|
|
62779
|
-
|
|
62780
|
-
|
|
62781
|
-
|
|
62782
|
-
|
|
62783
|
-
|
|
62784
|
-
|
|
62807
|
+
if (excludedByNegation) {
|
|
62808
|
+
continue; // Skip this input
|
|
62809
|
+
}
|
|
62810
|
+
|
|
62811
|
+
// Check positive patterns
|
|
62812
|
+
if (positivePatterns.length === 0) {
|
|
62813
|
+
// No positive patterns - include if no negations matched (already checked above)
|
|
62785
62814
|
result.push(input);
|
|
62815
|
+
} else if (allPatterns) {
|
|
62816
|
+
// AND logic: include if ALL positive patterns match
|
|
62817
|
+
const matchedPositive = Array.from({length: positivePatterns.length}, () => false);
|
|
62818
|
+
for (const [index, pattern] of positivePatterns.entries()) {
|
|
62819
|
+
if (pattern.test(input)) {
|
|
62820
|
+
matchedPositive[index] = true;
|
|
62821
|
+
}
|
|
62822
|
+
}
|
|
62786
62823
|
|
|
62787
|
-
|
|
62788
|
-
|
|
62824
|
+
// All positive patterns must match
|
|
62825
|
+
if (matchedPositive.every(Boolean)) {
|
|
62826
|
+
result.push(input);
|
|
62827
|
+
}
|
|
62828
|
+
} else {
|
|
62829
|
+
// OR logic: include if any positive pattern matches
|
|
62830
|
+
let matchedAny = false;
|
|
62831
|
+
for (const pattern of positivePatterns) {
|
|
62832
|
+
if (pattern.test(input)) {
|
|
62833
|
+
matchedAny = true;
|
|
62834
|
+
break; // Short-circuit on first match
|
|
62835
|
+
}
|
|
62836
|
+
}
|
|
62837
|
+
|
|
62838
|
+
if (matchedAny) {
|
|
62839
|
+
result.push(input);
|
|
62789
62840
|
}
|
|
62790
62841
|
}
|
|
62842
|
+
|
|
62843
|
+
if (result.length > 0) {
|
|
62844
|
+
break;
|
|
62845
|
+
}
|
|
62791
62846
|
}
|
|
62792
62847
|
|
|
62793
62848
|
return result;
|
|
62794
62849
|
};
|
|
62795
62850
|
|
|
62796
62851
|
function isMatch(inputs, patterns, options) {
|
|
62797
|
-
return baseMatcher(inputs, patterns, options).length > 0;
|
|
62852
|
+
return baseMatcher(inputs, patterns, options, true).length > 0;
|
|
62798
62853
|
}
|
|
62799
62854
|
|
|
62800
62855
|
/**
|
|
@@ -63891,9 +63946,57 @@ const GridButton = (colDef, editor) => {
|
|
|
63891
63946
|
});
|
|
63892
63947
|
};
|
|
63893
63948
|
|
|
63949
|
+
const isNode = typeof process !== 'undefined' && process.env.NODE_ENV === 'test';
|
|
63950
|
+
let sharedIntervalId = null;
|
|
63951
|
+
const callbacks = new Set();
|
|
63952
|
+
const startSharedInterval = () => {
|
|
63953
|
+
if (isNode || sharedIntervalId !== null) {
|
|
63954
|
+
return;
|
|
63955
|
+
}
|
|
63956
|
+
sharedIntervalId = setInterval(() => {
|
|
63957
|
+
callbacks.forEach((cb) => {
|
|
63958
|
+
try {
|
|
63959
|
+
cb();
|
|
63960
|
+
}
|
|
63961
|
+
catch (e) {
|
|
63962
|
+
console.error(e);
|
|
63963
|
+
}
|
|
63964
|
+
});
|
|
63965
|
+
}, 100);
|
|
63966
|
+
};
|
|
63967
|
+
const stopSharedInterval = () => {
|
|
63968
|
+
if (sharedIntervalId === null) {
|
|
63969
|
+
return;
|
|
63970
|
+
}
|
|
63971
|
+
clearInterval(sharedIntervalId);
|
|
63972
|
+
sharedIntervalId = null;
|
|
63973
|
+
};
|
|
63974
|
+
/**
|
|
63975
|
+
* Like useInterval, but all callers share a single 100ms interval.
|
|
63976
|
+
* Each callback is isolated in a try/catch so a throwing callback won't prevent others from running.
|
|
63977
|
+
*/
|
|
63978
|
+
const useSharedInterval = (callback) => {
|
|
63979
|
+
const savedCallback = useRef(callback);
|
|
63980
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
63981
|
+
savedCallback.current = callback;
|
|
63982
|
+
}, [callback]);
|
|
63983
|
+
useEffect(() => {
|
|
63984
|
+
const cb = () => savedCallback.current();
|
|
63985
|
+
callbacks.add(cb);
|
|
63986
|
+
startSharedInterval();
|
|
63987
|
+
return () => {
|
|
63988
|
+
callbacks.delete(cb);
|
|
63989
|
+
if (callbacks.size === 0) {
|
|
63990
|
+
stopSharedInterval();
|
|
63991
|
+
}
|
|
63992
|
+
};
|
|
63993
|
+
}, []);
|
|
63994
|
+
};
|
|
63995
|
+
|
|
63894
63996
|
const BooleanCellRenderer = (props) => {
|
|
63895
|
-
const { onValueChange, value, api, node, column, colDef, data } = props;
|
|
63997
|
+
const { onValueChange, value, api, node, column, colDef, data, eGridCell } = props;
|
|
63896
63998
|
const inputRef = useRef(null);
|
|
63999
|
+
const { updatingCells, redrawRows, resetFocusedCellAfterCellEditing, prePopupOps } = useGridContext();
|
|
63897
64000
|
useEffect(() => {
|
|
63898
64001
|
const checkFocus = (event) => {
|
|
63899
64002
|
if (event.rowIndex === node.rowIndex && event.column === column) {
|
|
@@ -63901,34 +64004,62 @@ const BooleanCellRenderer = (props) => {
|
|
|
63901
64004
|
}
|
|
63902
64005
|
};
|
|
63903
64006
|
api.addEventListener('cellFocused', checkFocus);
|
|
63904
|
-
return () =>
|
|
63905
|
-
api.removeEventListener('cellFocused', checkFocus);
|
|
63906
|
-
};
|
|
64007
|
+
return () => void api.removeEventListener('cellFocused', checkFocus);
|
|
63907
64008
|
}, [api, column, node.rowIndex]);
|
|
63908
64009
|
const isDisabled = !fnOrVar(colDef?.editable, props);
|
|
63909
|
-
|
|
64010
|
+
const toggleCheckbox = useCallback(() => {
|
|
64011
|
+
if (!onValueChange) {
|
|
64012
|
+
return;
|
|
64013
|
+
}
|
|
64014
|
+
const params = props?.colDef?.cellEditorParams;
|
|
64015
|
+
if (!params) {
|
|
64016
|
+
return;
|
|
64017
|
+
}
|
|
64018
|
+
const nodes = [];
|
|
64019
|
+
api.forEachNode((n) => {
|
|
64020
|
+
if (n.data.id === data.id) {
|
|
64021
|
+
nodes.push(n);
|
|
64022
|
+
}
|
|
64023
|
+
});
|
|
64024
|
+
prePopupOps();
|
|
64025
|
+
const checked = !value;
|
|
64026
|
+
onValueChange(checked);
|
|
64027
|
+
const field = props.colDef?.field ?? props.colDef?.colId ?? '';
|
|
64028
|
+
const selectedRows = nodes.map((node) => node.data);
|
|
64029
|
+
void updatingCells({ selectedRows, field }, async () => {
|
|
64030
|
+
redrawRows(nodes);
|
|
64031
|
+
return params.onClick({ selectedRows, selectedRowIds: selectedRows.map((r) => r.id), checked });
|
|
64032
|
+
}).finally(() => {
|
|
64033
|
+
resetFocusedCellAfterCellEditing();
|
|
64034
|
+
});
|
|
64035
|
+
}, [
|
|
64036
|
+
api,
|
|
64037
|
+
data.id,
|
|
64038
|
+
onValueChange,
|
|
64039
|
+
prePopupOps,
|
|
64040
|
+
props.colDef?.cellEditorParams,
|
|
64041
|
+
props.colDef?.colId,
|
|
64042
|
+
props.colDef?.field,
|
|
64043
|
+
redrawRows,
|
|
64044
|
+
resetFocusedCellAfterCellEditing,
|
|
64045
|
+
updatingCells,
|
|
64046
|
+
value,
|
|
64047
|
+
]);
|
|
64048
|
+
useSharedInterval(() => {
|
|
64049
|
+
if (isDisabled) {
|
|
64050
|
+
return;
|
|
64051
|
+
}
|
|
64052
|
+
const cell = eGridCell?.querySelector('.ag-cell-focus .grid-edit-boolean input.ag-checkbox-input:not(:disabled)');
|
|
64053
|
+
if (cell && cell.ownerDocument.activeElement !== cell) {
|
|
64054
|
+
cell.focus();
|
|
64055
|
+
}
|
|
64056
|
+
});
|
|
64057
|
+
return (jsx("div", { className: clsx('grid-edit-boolean ag-wrapper ag-input-wrapper ag-checkbox-input-wrapper', {
|
|
63910
64058
|
'ag-checked': props.value,
|
|
63911
64059
|
'ag-disabled': isDisabled,
|
|
63912
64060
|
}), children: jsx("input", { type: "checkbox", className: "ag-input-field-input ag-checkbox-input", disabled: isDisabled, ref: inputRef, checked: value, onChange: () => { }, onClick: (e) => {
|
|
63913
64061
|
e.stopPropagation();
|
|
63914
|
-
|
|
63915
|
-
// if in non-edit mode clickInputWhenContainingCellClicked will click to put it in edit mode
|
|
63916
|
-
if (!onValueChange)
|
|
63917
|
-
return;
|
|
63918
|
-
const params = props?.colDef?.cellEditorParams;
|
|
63919
|
-
if (!params)
|
|
63920
|
-
return;
|
|
63921
|
-
// The data cannot be relied upon if grid changed whilst editing, data will be stale
|
|
63922
|
-
// So I get the data from the node itself which will be up to date.
|
|
63923
|
-
const selectedRows = [];
|
|
63924
|
-
api.forEachNode((n) => {
|
|
63925
|
-
if (n.data.id === data.id) {
|
|
63926
|
-
selectedRows.push(n.data);
|
|
63927
|
-
}
|
|
63928
|
-
});
|
|
63929
|
-
const checked = !value;
|
|
63930
|
-
onValueChange(checked);
|
|
63931
|
-
void params.onClick({ selectedRows, selectedRowIds: selectedRows.map((r) => r.id), checked });
|
|
64062
|
+
toggleCheckbox();
|
|
63932
64063
|
} }) }));
|
|
63933
64064
|
};
|
|
63934
64065
|
const GridEditBoolean = (colDef, editorProps) => {
|
|
@@ -63942,7 +64073,7 @@ const GridEditBoolean = (colDef, editorProps) => {
|
|
|
63942
64073
|
singleClickEdit: true,
|
|
63943
64074
|
resizable: false,
|
|
63944
64075
|
editable: true,
|
|
63945
|
-
cellClass: 'GridCellAlignCenter',
|
|
64076
|
+
cellClass: 'GridCellAlignCenter GridCellEditableWithNoPopup',
|
|
63946
64077
|
headerClass: 'GridHeaderAlignCenter',
|
|
63947
64078
|
...colDef,
|
|
63948
64079
|
});
|
|
@@ -64530,15 +64661,19 @@ const GridContextProvider = (props) => {
|
|
|
64530
64661
|
if (!gridApi) {
|
|
64531
64662
|
return true;
|
|
64532
64663
|
}
|
|
64664
|
+
/**
|
|
64665
|
+
* @returns true if editable with a popup, false if editable without popup, null if not editable
|
|
64666
|
+
*/
|
|
64533
64667
|
const focusedCellIsEditable = () => {
|
|
64534
64668
|
const focusedCell = gridApi.isDestroyed() ? null : gridApi.getFocusedCell();
|
|
64535
64669
|
const nextColumn = focusedCell?.column;
|
|
64536
64670
|
const nextColDef = nextColumn?.getColDef();
|
|
64537
64671
|
const rowNode = focusedCell && gridApi.getDisplayedRowAtIndex(focusedCell?.rowIndex);
|
|
64672
|
+
const popupable = String(nextColDef?.cellClass).indexOf("GridCellEditableWithNoPopup") === -1;
|
|
64538
64673
|
return (!!(rowNode && nextColumn && nextColDef) &&
|
|
64539
64674
|
nextColumn.isCellEditable(rowNode) &&
|
|
64540
64675
|
!nextColDef.cellEditorParams?.preventAutoEdit &&
|
|
64541
|
-
!nextColDef.cellRendererParams?.editAction);
|
|
64676
|
+
!nextColDef.cellRendererParams?.editAction) ? popupable : null;
|
|
64542
64677
|
};
|
|
64543
64678
|
// Just in case I've missed something, we don't want the loop to hang everything
|
|
64544
64679
|
for (let maxIterations = 0; maxIterations < 50; maxIterations++) {
|
|
@@ -64571,7 +64706,10 @@ const GridContextProvider = (props) => {
|
|
|
64571
64706
|
break;
|
|
64572
64707
|
}
|
|
64573
64708
|
}
|
|
64574
|
-
|
|
64709
|
+
// checkbox cells are editable but don't have a popup
|
|
64710
|
+
// we need to end bulk editing and just select the cell
|
|
64711
|
+
const editable = focusedCellIsEditable();
|
|
64712
|
+
if (editable !== null) {
|
|
64575
64713
|
const focusedCell = gridApi.getFocusedCell();
|
|
64576
64714
|
if (focusedCell) {
|
|
64577
64715
|
const rowNode = gridApi.getDisplayedRowAtIndex(focusedCell.rowIndex);
|
|
@@ -64579,8 +64717,15 @@ const GridContextProvider = (props) => {
|
|
|
64579
64717
|
if (rowId == null) {
|
|
64580
64718
|
return false;
|
|
64581
64719
|
}
|
|
64582
|
-
|
|
64583
|
-
|
|
64720
|
+
if (editable) {
|
|
64721
|
+
await startCellEditing({ rowId, colId: focusedCell.column.getColId() });
|
|
64722
|
+
// Continue bulk edit
|
|
64723
|
+
return true;
|
|
64724
|
+
}
|
|
64725
|
+
else {
|
|
64726
|
+
// This will terminate bulk editing as there was no popup editor
|
|
64727
|
+
return false;
|
|
64728
|
+
}
|
|
64584
64729
|
}
|
|
64585
64730
|
}
|
|
64586
64731
|
}
|