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