@linzjs/step-ag-grid 13.0.0 → 13.1.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/README.md +36 -1
- package/dist/GridTheme.scss +2 -2
- package/dist/index.css +26 -2
- package/dist/src/components/Grid.d.ts +1 -0
- package/dist/src/components/GridCell.d.ts +1 -1
- package/dist/src/components/gridFilter/GridFilterColumnsToggle.d.ts +5 -0
- package/dist/src/components/gridFilter/GridFilterHeaderIconButton.d.ts +11 -0
- package/dist/src/components/gridFilter/index.d.ts +3 -0
- package/dist/src/components/{GridFilter.d.ts → gridFilter/useGridFilter.d.ts} +2 -2
- package/dist/src/components/index.d.ts +0 -1
- package/dist/src/contexts/GridContext.d.ts +8 -3
- package/dist/src/contexts/GridContextProvider.d.ts +1 -1
- package/dist/step-ag-grid.esm.js +395 -228
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +13 -6
- package/src/components/GridCell.tsx +1 -1
- package/src/components/gridFilter/GridFilterButtons.tsx +2 -2
- package/src/components/gridFilter/GridFilterColumnsToggle.tsx +141 -0
- package/src/components/gridFilter/GridFilterHeaderIconButton.tsx +33 -0
- package/src/components/gridFilter/GridFilterQuick.tsx +2 -2
- package/src/components/gridFilter/index.ts +3 -0
- package/src/components/{GridFilter.ts → gridFilter/useGridFilter.ts} +2 -2
- package/src/components/index.ts +0 -1
- package/src/contexts/GridContext.tsx +26 -5
- package/src/contexts/GridContextProvider.tsx +94 -29
- package/src/contexts/GridPopoverContextProvider.tsx +4 -3
- package/src/stories/grid/GridReadOnly.stories.tsx +13 -6
- package/src/styles/Grid.scss +18 -2
- package/src/styles/GridFilterColumnsToggle.scss +4 -0
- package/src/styles/GridFilterHeaderIconButton.scss +3 -0
- package/src/styles/GridTheme.scss +2 -2
- package/src/styles/index.scss +3 -0
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { LuiMiniSpinner, LuiIcon,
|
|
2
|
+
import { LuiMiniSpinner, LuiIcon, LuiButton, LuiCheckboxInput, LuiButtonGroup } from '@linzjs/lui';
|
|
3
3
|
import { AgGridReact } from 'ag-grid-react';
|
|
4
|
-
import { negate, isEmpty, xorBy, last, difference, sortBy, findIndex, debounce, partition, omit, pick, groupBy, fromPairs, toPairs, delay, defer as defer$1, remove, castArray, flatten, isEqual } from 'lodash-es';
|
|
4
|
+
import { negate, isEmpty, xorBy, last, difference, sortBy, findIndex, debounce, partition, omit, pick, groupBy, fromPairs, toPairs, delay, defer as defer$1, compact, remove, castArray, flatten, isEqual } from 'lodash-es';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { createContext, useContext, useRef, useCallback, useState, useEffect, useMemo, forwardRef, useLayoutEffect, memo, useReducer, cloneElement, useImperativeHandle, Fragment as Fragment$1 } from 'react';
|
|
7
7
|
import ReactDOM, { unstable_batchedUpdates, flushSync, createPortal } from 'react-dom';
|
|
@@ -129,12 +129,20 @@ function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else i
|
|
|
129
129
|
|
|
130
130
|
var GridContext = createContext({
|
|
131
131
|
gridReady: false,
|
|
132
|
+
getColumns: function () {
|
|
133
|
+
console.error("no context provider for getColumns");
|
|
134
|
+
return [];
|
|
135
|
+
},
|
|
136
|
+
invisibleColumnIds: [],
|
|
137
|
+
setInvisibleColumnIds: function () {
|
|
138
|
+
console.error("no context provider for setInvisibleColumnIds");
|
|
139
|
+
},
|
|
132
140
|
prePopupOps: function () {
|
|
133
141
|
console.error("no context provider for prePopupOps");
|
|
134
142
|
},
|
|
135
143
|
externallySelectedItemsAreInSync: false,
|
|
136
|
-
|
|
137
|
-
console.error("no context provider for
|
|
144
|
+
setApis: function () {
|
|
145
|
+
console.error("no context provider for setApis");
|
|
138
146
|
},
|
|
139
147
|
setQuickFilter: function () {
|
|
140
148
|
console.error("no context provider for setQuickFilter");
|
|
@@ -146,10 +154,18 @@ var GridContext = createContext({
|
|
|
146
154
|
console.error("no context provider for getSelectedRows");
|
|
147
155
|
return [];
|
|
148
156
|
},
|
|
157
|
+
getFilteredSelectedRows: function () {
|
|
158
|
+
console.error("no context provider for getFilteredSelectedRows");
|
|
159
|
+
return [];
|
|
160
|
+
},
|
|
149
161
|
getSelectedRowIds: function () {
|
|
150
162
|
console.error("no context provider for getSelectedRowIds");
|
|
151
163
|
return [];
|
|
152
164
|
},
|
|
165
|
+
getFilteredSelectedRowIds: function () {
|
|
166
|
+
console.error("no context provider for getFilteredSelectedRowIds");
|
|
167
|
+
return [];
|
|
168
|
+
},
|
|
153
169
|
selectRowsDiff: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
154
170
|
return __generator(this, function (_a) {
|
|
155
171
|
console.error("no context provider for selectRowsDiff");
|
|
@@ -481,7 +497,7 @@ var GridHeaderSelect = function (_a) {
|
|
|
481
497
|
*/
|
|
482
498
|
var Grid = function (params) {
|
|
483
499
|
var _a, _b, _c, _d;
|
|
484
|
-
var _e = useContext(GridContext), gridReady = _e.gridReady,
|
|
500
|
+
var _e = useContext(GridContext), gridReady = _e.gridReady, setApis = _e.setApis, prePopupOps = _e.prePopupOps, ensureRowVisible = _e.ensureRowVisible, selectRowsById = _e.selectRowsById, focusByRowById = _e.focusByRowById, ensureSelectedRowIsVisible = _e.ensureSelectedRowIsVisible, sizeColumnsToFit = _e.sizeColumnsToFit, externallySelectedItemsAreInSync = _e.externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync = _e.setExternallySelectedItemsAreInSync, isExternalFilterPresent = _e.isExternalFilterPresent, doesExternalFilterPass = _e.doesExternalFilterPass;
|
|
485
501
|
var checkUpdating = useContext(GridUpdatingContext).checkUpdating;
|
|
486
502
|
var lastSelectedIds = useRef([]);
|
|
487
503
|
var _f = useState(false), staleGrid = _f[0], setStaleGrid = _f[1];
|
|
@@ -624,15 +640,19 @@ var Grid = function (params) {
|
|
|
624
640
|
clickSelectorCheckboxWhenContainingCellClicked,
|
|
625
641
|
]);
|
|
626
642
|
var onGridReady = useCallback(function (event) {
|
|
627
|
-
|
|
643
|
+
setApis(event.api, event.columnApi, params["data-testid"]);
|
|
628
644
|
synchroniseExternallySelectedItemsToGrid();
|
|
629
|
-
}, [
|
|
645
|
+
}, [setApis, synchroniseExternallySelectedItemsToGrid]);
|
|
630
646
|
var noRowsOverlayComponent = useCallback(function (event) {
|
|
631
|
-
var _a, _b;
|
|
647
|
+
var _a, _b, _c;
|
|
632
648
|
var hasData = ((_b = (_a = params.rowData) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
|
|
633
649
|
var hasFilteredData = event.api.getDisplayedRowCount() > 0;
|
|
634
|
-
return (jsx("span", { children: !hasData
|
|
635
|
-
|
|
650
|
+
return (jsx("span", { children: !hasData
|
|
651
|
+
? (_c = params.noRowsOverlayText) !== null && _c !== void 0 ? _c : "There are currently no rows"
|
|
652
|
+
: !hasFilteredData
|
|
653
|
+
? "All rows have been filtered"
|
|
654
|
+
: "" }));
|
|
655
|
+
}, [params.noRowsOverlayText, (_b = params.rowData) === null || _b === void 0 ? void 0 : _b.length]);
|
|
636
656
|
var onModelUpdated = useCallback(function (event) {
|
|
637
657
|
event.api.getDisplayedRowCount() === 0 ? event.api.showNoRowsOverlay() : event.api.hideOverlay();
|
|
638
658
|
}, []);
|
|
@@ -719,7 +739,7 @@ var useGridPopoverContext = function () {
|
|
|
719
739
|
var GridPopoverContextProvider = function (_a) {
|
|
720
740
|
var _b, _c, _d;
|
|
721
741
|
var props = _a.props, children = _a.children;
|
|
722
|
-
var _e = useContext(GridContext),
|
|
742
|
+
var _e = useContext(GridContext), getFilteredSelectedRows = _e.getFilteredSelectedRows, updatingCells = _e.updatingCells;
|
|
723
743
|
var anchorRef = useRef(props.eGridCell);
|
|
724
744
|
var hasSaved = useRef(false);
|
|
725
745
|
var _f = useState(false), saving = _f[0], setSaving = _f[1];
|
|
@@ -727,7 +747,9 @@ var GridPopoverContextProvider = function (_a) {
|
|
|
727
747
|
var cellEditorParams = colDef.cellEditorParams;
|
|
728
748
|
var multiEdit = (_b = cellEditorParams === null || cellEditorParams === void 0 ? void 0 : cellEditorParams.multiEdit) !== null && _b !== void 0 ? _b : false;
|
|
729
749
|
// Then item that is clicked on will always be first in the list
|
|
730
|
-
var selectedRows = useMemo(function () {
|
|
750
|
+
var selectedRows = useMemo(function () {
|
|
751
|
+
return multiEdit ? sortBy(getFilteredSelectedRows(), function (row) { return row.id !== props.data.id; }) : [props.data];
|
|
752
|
+
}, [getFilteredSelectedRows, multiEdit, props.data]);
|
|
731
753
|
var field = (_d = (_c = props.colDef) === null || _c === void 0 ? void 0 : _c.field) !== null && _d !== void 0 ? _d : "";
|
|
732
754
|
var updateValue = useCallback(function (saveFn, tabDirection) { return __awaiter(void 0, void 0, void 0, function () {
|
|
733
755
|
var _a;
|
|
@@ -892,201 +914,11 @@ var GridCellMultiEditor = function (props, cellEditorSelector) {
|
|
|
892
914
|
} }, props), { cellRenderer: GridCellRenderer, cellRendererParams: __assign({ originalCellRenderer: props.cellRenderer }, props.cellRendererParams) });
|
|
893
915
|
};
|
|
894
916
|
|
|
895
|
-
var
|
|
896
|
-
var _a =
|
|
897
|
-
|
|
898
|
-
var thisFilter = filter;
|
|
899
|
-
thisFilter && addExternalFilter(thisFilter);
|
|
900
|
-
return function () {
|
|
901
|
-
thisFilter && removeExternalFilter(thisFilter);
|
|
902
|
-
};
|
|
903
|
-
}, [addExternalFilter, filter, removeExternalFilter]);
|
|
904
|
-
};
|
|
905
|
-
|
|
906
|
-
var GridFilterButtons = function (_a) {
|
|
907
|
-
var _b;
|
|
908
|
-
var className = _a.className, luiButtonProps = _a.luiButtonProps, options = _a.options;
|
|
909
|
-
// Select defaultSelected option, otherwise first option. If no options select none.
|
|
910
|
-
var _c = useState((_b = options.find(function (option) { return option.defaultSelected; })) !== null && _b !== void 0 ? _b : options[0]), selectedOption = _c[0], setSelectedOption = _c[1];
|
|
911
|
-
var filter = useMemo(function () { return selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.filter; }, [selectedOption]);
|
|
912
|
-
useGridFilter(filter);
|
|
913
|
-
return (jsx("div", __assign({ className: clsx("lui-margin-top-xxs lui-margin-bottom-xxs", className) }, { children: jsx(LuiButtonGroup, { children: options.map(function (option, index) { return (jsx(LuiButton, __assign({}, luiButtonProps, { className: clsx("lui-button lui-button-secondary", (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) === option.label && "lui-button-active", luiButtonProps === null || luiButtonProps === void 0 ? void 0 : luiButtonProps.className), onClick: function () { return setSelectedOption(option); } }, { children: option.label }), "".concat(index))); }) }) })));
|
|
914
|
-
};
|
|
915
|
-
|
|
916
|
-
var GridFilterQuick = function (_a) {
|
|
917
|
-
var quickFilterPlaceholder = _a.quickFilterPlaceholder, defaultValue = _a.defaultValue;
|
|
918
|
-
var setQuickFilter = useContext(GridContext).setQuickFilter;
|
|
919
|
-
var _b = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : ""), quickFilterValue = _b[0], setQuickFilterValue = _b[1];
|
|
920
|
-
useEffect(function () {
|
|
921
|
-
setQuickFilter(quickFilterValue);
|
|
922
|
-
}, [quickFilterValue, setQuickFilter]);
|
|
923
|
-
return (jsx("input", { "aria-label": "Search", className: "lui-margin-top-xxs lui-margin-bottom-xxs Grid-quickFilterBox", type: "text", placeholder: quickFilterPlaceholder !== null && quickFilterPlaceholder !== void 0 ? quickFilterPlaceholder : "Search...", value: quickFilterValue, onChange: function (event) {
|
|
924
|
-
setQuickFilterValue(event.target.value);
|
|
925
|
-
} }));
|
|
926
|
-
};
|
|
927
|
-
|
|
928
|
-
var GridFilters = function (_a) {
|
|
929
|
-
var children = _a.children;
|
|
930
|
-
return jsx("div", __assign({ className: "Grid-container-filters" }, { children: children }));
|
|
931
|
-
};
|
|
932
|
-
|
|
933
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
934
|
-
|
|
935
|
-
function getDefaultExportFromCjs (x) {
|
|
936
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
function getAugmentedNamespace(n) {
|
|
940
|
-
if (n.__esModule) return n;
|
|
941
|
-
var f = n.default;
|
|
942
|
-
if (typeof f == "function") {
|
|
943
|
-
var a = function a () {
|
|
944
|
-
if (this instanceof a) {
|
|
945
|
-
var args = [null];
|
|
946
|
-
args.push.apply(args, arguments);
|
|
947
|
-
var Ctor = Function.bind.apply(f, args);
|
|
948
|
-
return new Ctor();
|
|
949
|
-
}
|
|
950
|
-
return f.apply(this, arguments);
|
|
951
|
-
};
|
|
952
|
-
a.prototype = f.prototype;
|
|
953
|
-
} else a = {};
|
|
954
|
-
Object.defineProperty(a, '__esModule', {value: true});
|
|
955
|
-
Object.keys(n).forEach(function (k) {
|
|
956
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
957
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
958
|
-
enumerable: true,
|
|
959
|
-
get: function () {
|
|
960
|
-
return n[k];
|
|
961
|
-
}
|
|
962
|
-
});
|
|
963
|
-
});
|
|
964
|
-
return a;
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
/* global setTimeout, clearTimeout */
|
|
968
|
-
|
|
969
|
-
var dist$1 = function debounce(fn) {
|
|
970
|
-
var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
971
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
972
|
-
|
|
973
|
-
var lastCallAt = void 0;
|
|
974
|
-
var deferred = void 0;
|
|
975
|
-
var timer = void 0;
|
|
976
|
-
var pendingArgs = [];
|
|
977
|
-
return function debounced() {
|
|
978
|
-
var currentWait = getWait(wait);
|
|
979
|
-
var currentTime = new Date().getTime();
|
|
980
|
-
|
|
981
|
-
var isCold = !lastCallAt || currentTime - lastCallAt > currentWait;
|
|
982
|
-
|
|
983
|
-
lastCallAt = currentTime;
|
|
984
|
-
|
|
985
|
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
986
|
-
args[_key] = arguments[_key];
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
if (isCold && options.leading) {
|
|
990
|
-
return options.accumulate ? Promise.resolve(fn.call(this, [args])).then(function (result) {
|
|
991
|
-
return result[0];
|
|
992
|
-
}) : Promise.resolve(fn.call.apply(fn, [this].concat(args)));
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
if (deferred) {
|
|
996
|
-
clearTimeout(timer);
|
|
997
|
-
} else {
|
|
998
|
-
deferred = defer();
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
pendingArgs.push(args);
|
|
1002
|
-
timer = setTimeout(flush.bind(this), currentWait);
|
|
1003
|
-
|
|
1004
|
-
if (options.accumulate) {
|
|
1005
|
-
var argsIndex = pendingArgs.length - 1;
|
|
1006
|
-
return deferred.promise.then(function (results) {
|
|
1007
|
-
return results[argsIndex];
|
|
1008
|
-
});
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
return deferred.promise;
|
|
1012
|
-
};
|
|
1013
|
-
|
|
1014
|
-
function flush() {
|
|
1015
|
-
var thisDeferred = deferred;
|
|
1016
|
-
clearTimeout(timer);
|
|
1017
|
-
|
|
1018
|
-
Promise.resolve(options.accumulate ? fn.call(this, pendingArgs) : fn.apply(this, pendingArgs[pendingArgs.length - 1])).then(thisDeferred.resolve, thisDeferred.reject);
|
|
1019
|
-
|
|
1020
|
-
pendingArgs = [];
|
|
1021
|
-
deferred = null;
|
|
1022
|
-
}
|
|
1023
|
-
};
|
|
1024
|
-
|
|
1025
|
-
function getWait(wait) {
|
|
1026
|
-
return typeof wait === 'function' ? wait() : wait;
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
function defer() {
|
|
1030
|
-
var deferred = {};
|
|
1031
|
-
deferred.promise = new Promise(function (resolve, reject) {
|
|
1032
|
-
deferred.resolve = resolve;
|
|
1033
|
-
deferred.reject = reject;
|
|
1034
|
-
});
|
|
1035
|
-
return deferred;
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
var GridSubComponentContext = createContext({
|
|
1039
|
-
value: "GridSubComponentContext value no context",
|
|
1040
|
-
data: {},
|
|
1041
|
-
setValue: function () {
|
|
1042
|
-
console.error("GridSubComponentContext setValue no context");
|
|
1043
|
-
},
|
|
1044
|
-
setValid: function () {
|
|
1045
|
-
console.error("GridSubComponentContext setValid no context");
|
|
1046
|
-
},
|
|
1047
|
-
triggerSave: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1048
|
-
return __generator(this, function (_a) {
|
|
1049
|
-
console.error("GridSubComponentContext triggerSave no context");
|
|
1050
|
-
return [2 /*return*/];
|
|
1051
|
-
});
|
|
1052
|
-
}); },
|
|
1053
|
-
context: null
|
|
917
|
+
var GridFilterHeaderIconButton = forwardRef(function columnsButton(_a, ref) {
|
|
918
|
+
var icon = _a.icon, title = _a.title, onClick = _a.onClick, buttonProps = _a.buttonProps, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? "md" : _c;
|
|
919
|
+
return (jsx(LuiButton, __assign({}, buttonProps, { type: "button", level: "tertiary", className: "GridFilterHeaderIconButton lui-button-icon-only", ref: ref, "aria-label": title, title: title, onClick: onClick, disabled: disabled }, { children: jsx(LuiIcon, { name: icon, alt: "Menu", size: size }) })));
|
|
1054
920
|
});
|
|
1055
921
|
|
|
1056
|
-
function styleInject(css, ref) {
|
|
1057
|
-
if ( ref === void 0 ) ref = {};
|
|
1058
|
-
var insertAt = ref.insertAt;
|
|
1059
|
-
|
|
1060
|
-
if (!css || typeof document === 'undefined') { return; }
|
|
1061
|
-
|
|
1062
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
1063
|
-
var style = document.createElement('style');
|
|
1064
|
-
style.type = 'text/css';
|
|
1065
|
-
|
|
1066
|
-
if (insertAt === 'top') {
|
|
1067
|
-
if (head.firstChild) {
|
|
1068
|
-
head.insertBefore(style, head.firstChild);
|
|
1069
|
-
} else {
|
|
1070
|
-
head.appendChild(style);
|
|
1071
|
-
}
|
|
1072
|
-
} else {
|
|
1073
|
-
head.appendChild(style);
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
if (style.styleSheet) {
|
|
1077
|
-
style.styleSheet.cssText = css;
|
|
1078
|
-
} else {
|
|
1079
|
-
style.appendChild(document.createTextNode(css));
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
var css_248z$2 = ".helpText{color:#6b6966;font-size:.75rem;font-weight:400}";
|
|
1084
|
-
styleInject(css_248z$2);
|
|
1085
|
-
|
|
1086
|
-
var FormError = function (props) {
|
|
1087
|
-
return (jsxs(Fragment, { children: [props.error && (jsx("span", __assign({ className: "LuiTextInput-error", style: { paddingLeft: 0 } }, { children: props.error }))), props.helpText && !props.error && jsx("span", __assign({ className: "helpText" }, { children: props.helpText }))] }));
|
|
1088
|
-
};
|
|
1089
|
-
|
|
1090
922
|
// Generate className following BEM methodology: http://getbem.com/naming/
|
|
1091
923
|
// Modifier value can be one of the following types: boolean, string, undefined
|
|
1092
924
|
var useBEM = function (_a) {
|
|
@@ -2919,6 +2751,288 @@ var MenuRadioGroupFr = function (_a, externalRef) {
|
|
|
2919
2751
|
};
|
|
2920
2752
|
var MenuRadioGroup = forwardRef(MenuRadioGroupFr);
|
|
2921
2753
|
|
|
2754
|
+
var GridFilterColumnsToggle = function (_a) {
|
|
2755
|
+
var _b = _a.saveState, saveState = _b === void 0 ? true : _b;
|
|
2756
|
+
var _c = useState(false), loaded = _c[0], setLoaded = _c[1];
|
|
2757
|
+
var _d = useContext(GridContext), getColumns = _d.getColumns, invisibleColumnIds = _d.invisibleColumnIds, setInvisibleColumnIds = _d.setInvisibleColumnIds;
|
|
2758
|
+
var columnStorageKey = useMemo(function () {
|
|
2759
|
+
return isEmpty(getColumns())
|
|
2760
|
+
? null // Grid hasn't been initialised yet
|
|
2761
|
+
: "stepAgGrid_invisibleColumnIds_" +
|
|
2762
|
+
getColumns()
|
|
2763
|
+
.map(function (col) { return col.colId || ""; })
|
|
2764
|
+
.join("_");
|
|
2765
|
+
}, [getColumns]);
|
|
2766
|
+
// Load state on start
|
|
2767
|
+
useEffect(function () {
|
|
2768
|
+
if (!columnStorageKey || loaded)
|
|
2769
|
+
return;
|
|
2770
|
+
if (saveState) {
|
|
2771
|
+
try {
|
|
2772
|
+
var stored = window.localStorage.getItem(columnStorageKey);
|
|
2773
|
+
var invisibleIds = JSON.parse(stored !== null && stored !== void 0 ? stored : "[]");
|
|
2774
|
+
if (!Array.isArray(invisibleIds)) {
|
|
2775
|
+
console.error("stored invisible ids not an array: ".concat(stored));
|
|
2776
|
+
}
|
|
2777
|
+
else if (!invisibleIds.every(function (id) { return typeof id === "string"; })) {
|
|
2778
|
+
console.error("stored invisible ids not strings: ".concat(stored));
|
|
2779
|
+
}
|
|
2780
|
+
else {
|
|
2781
|
+
invisibleIds && setInvisibleColumnIds(invisibleIds);
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
catch (ex) {
|
|
2785
|
+
console.error(ex);
|
|
2786
|
+
}
|
|
2787
|
+
setLoaded(true);
|
|
2788
|
+
}
|
|
2789
|
+
}, [columnStorageKey, loaded, saveState, setInvisibleColumnIds]);
|
|
2790
|
+
// Save state on column visibility change
|
|
2791
|
+
useEffect(function () {
|
|
2792
|
+
loaded &&
|
|
2793
|
+
columnStorageKey &&
|
|
2794
|
+
saveState &&
|
|
2795
|
+
window.localStorage.setItem(columnStorageKey, JSON.stringify(invisibleColumnIds));
|
|
2796
|
+
}, [columnStorageKey, invisibleColumnIds, loaded, saveState]);
|
|
2797
|
+
var toggleColumn = useCallback(function (colId) {
|
|
2798
|
+
if (!colId)
|
|
2799
|
+
return;
|
|
2800
|
+
setInvisibleColumnIds(invisibleColumnIds.includes(colId)
|
|
2801
|
+
? invisibleColumnIds.filter(function (id) { return id !== colId; })
|
|
2802
|
+
: __spreadArray(__spreadArray([], invisibleColumnIds, true), [colId], false));
|
|
2803
|
+
}, [invisibleColumnIds, setInvisibleColumnIds]);
|
|
2804
|
+
var resetColumns = function () {
|
|
2805
|
+
setInvisibleColumnIds([]);
|
|
2806
|
+
};
|
|
2807
|
+
var numericRegExp = /^\d+$/;
|
|
2808
|
+
var isNonManageableColumn = function (col) {
|
|
2809
|
+
return col.lockVisible || col.colId == null || numericRegExp.test(col.colId);
|
|
2810
|
+
};
|
|
2811
|
+
return (jsxs(Menu, __assign({ menuButton: jsx(GridFilterHeaderIconButton, { icon: "ic_columns", title: "Column visibility" }), menuClassName: "step-ag-grid-react-menu", portal: true, unmountOnClose: true }, { children: [jsx("div", __assign({ className: "GridFilterColumnsToggle-container" }, { children: getColumns()
|
|
2812
|
+
.filter(function (col) { return !!col.headerName; })
|
|
2813
|
+
.map(function (col) {
|
|
2814
|
+
var _a, _b;
|
|
2815
|
+
return (jsx(MenuItem, __assign({ disabled: col.lockVisible, onClick: function (e) {
|
|
2816
|
+
// Global react-menu MenuItem handler handles tabs
|
|
2817
|
+
if (e.key !== "Tab") {
|
|
2818
|
+
e.keepOpen = true;
|
|
2819
|
+
if (e.key !== "Enter") {
|
|
2820
|
+
toggleColumn(col.colId);
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
} }, { children: jsx(LuiCheckboxInput, { isChecked: !invisibleColumnIds.includes((_a = col.colId) !== null && _a !== void 0 ? _a : ""), value: "".concat(col.colId), label: (_b = col.headerName) !== null && _b !== void 0 ? _b : "", isDisabled: isNonManageableColumn(col), inputProps: {
|
|
2824
|
+
onClick: function (e) {
|
|
2825
|
+
// Click is handled by MenuItem onClick so keyboard events work
|
|
2826
|
+
e.preventDefault();
|
|
2827
|
+
e.stopPropagation();
|
|
2828
|
+
}
|
|
2829
|
+
}, onChange: function () {
|
|
2830
|
+
/*Do nothing, change handled by menuItem*/
|
|
2831
|
+
} }) }), col.colId));
|
|
2832
|
+
}) })), jsx(MenuDivider, {}, "$$divider_reset_columns"), jsxs(MenuItem, __assign({ onClick: function (e) {
|
|
2833
|
+
// Global react-menu MenuItem handler handles tabs
|
|
2834
|
+
if (e.key !== "Tab") {
|
|
2835
|
+
e.keepOpen = e.key !== "Enter";
|
|
2836
|
+
resetColumns();
|
|
2837
|
+
}
|
|
2838
|
+
} }, { children: [jsx(LuiIcon, { name: "ic_regenerate", alt: "Reset columns", size: "md", className: "MenuItem-icon" }), "Reset columns"] }), "$$reset_columns")] })));
|
|
2839
|
+
};
|
|
2840
|
+
|
|
2841
|
+
var useGridFilter = function (filter) {
|
|
2842
|
+
var _a = useContext(GridContext), addExternalFilter = _a.addExternalFilter, removeExternalFilter = _a.removeExternalFilter;
|
|
2843
|
+
useEffect(function () {
|
|
2844
|
+
var thisFilter = filter;
|
|
2845
|
+
thisFilter && addExternalFilter(thisFilter);
|
|
2846
|
+
return function () {
|
|
2847
|
+
thisFilter && removeExternalFilter(thisFilter);
|
|
2848
|
+
};
|
|
2849
|
+
}, [addExternalFilter, filter, removeExternalFilter]);
|
|
2850
|
+
};
|
|
2851
|
+
|
|
2852
|
+
var GridFilterButtons = function (_a) {
|
|
2853
|
+
var _b;
|
|
2854
|
+
var className = _a.className, luiButtonProps = _a.luiButtonProps, options = _a.options;
|
|
2855
|
+
// Select defaultSelected option, otherwise first option. If no options select none.
|
|
2856
|
+
var _c = useState((_b = options.find(function (option) { return option.defaultSelected; })) !== null && _b !== void 0 ? _b : options[0]), selectedOption = _c[0], setSelectedOption = _c[1];
|
|
2857
|
+
var filter = useMemo(function () { return selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.filter; }, [selectedOption]);
|
|
2858
|
+
useGridFilter(filter);
|
|
2859
|
+
return (jsx("div", __assign({ className: clsx(className, "flex-col-center") }, { children: jsx(LuiButtonGroup, { children: options.map(function (option, index) { return (jsx(LuiButton, __assign({}, luiButtonProps, { className: clsx("lui-button lui-button-secondary", (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) === option.label && "lui-button-active", luiButtonProps === null || luiButtonProps === void 0 ? void 0 : luiButtonProps.className), onClick: function () { return setSelectedOption(option); } }, { children: option.label }), "".concat(index))); }) }) })));
|
|
2860
|
+
};
|
|
2861
|
+
|
|
2862
|
+
var GridFilterQuick = function (_a) {
|
|
2863
|
+
var quickFilterPlaceholder = _a.quickFilterPlaceholder, defaultValue = _a.defaultValue;
|
|
2864
|
+
var setQuickFilter = useContext(GridContext).setQuickFilter;
|
|
2865
|
+
var _b = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : ""), quickFilterValue = _b[0], setQuickFilterValue = _b[1];
|
|
2866
|
+
useEffect(function () {
|
|
2867
|
+
setQuickFilter(quickFilterValue);
|
|
2868
|
+
}, [quickFilterValue, setQuickFilter]);
|
|
2869
|
+
return (jsx("input", { "aria-label": "Search", className: "Grid-quickFilterBox", type: "text", placeholder: quickFilterPlaceholder !== null && quickFilterPlaceholder !== void 0 ? quickFilterPlaceholder : "Search...", value: quickFilterValue, onChange: function (event) {
|
|
2870
|
+
setQuickFilterValue(event.target.value);
|
|
2871
|
+
} }));
|
|
2872
|
+
};
|
|
2873
|
+
|
|
2874
|
+
var GridFilters = function (_a) {
|
|
2875
|
+
var children = _a.children;
|
|
2876
|
+
return jsx("div", __assign({ className: "Grid-container-filters" }, { children: children }));
|
|
2877
|
+
};
|
|
2878
|
+
|
|
2879
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2880
|
+
|
|
2881
|
+
function getDefaultExportFromCjs (x) {
|
|
2882
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
function getAugmentedNamespace(n) {
|
|
2886
|
+
if (n.__esModule) return n;
|
|
2887
|
+
var f = n.default;
|
|
2888
|
+
if (typeof f == "function") {
|
|
2889
|
+
var a = function a () {
|
|
2890
|
+
if (this instanceof a) {
|
|
2891
|
+
var args = [null];
|
|
2892
|
+
args.push.apply(args, arguments);
|
|
2893
|
+
var Ctor = Function.bind.apply(f, args);
|
|
2894
|
+
return new Ctor();
|
|
2895
|
+
}
|
|
2896
|
+
return f.apply(this, arguments);
|
|
2897
|
+
};
|
|
2898
|
+
a.prototype = f.prototype;
|
|
2899
|
+
} else a = {};
|
|
2900
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
2901
|
+
Object.keys(n).forEach(function (k) {
|
|
2902
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
2903
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
2904
|
+
enumerable: true,
|
|
2905
|
+
get: function () {
|
|
2906
|
+
return n[k];
|
|
2907
|
+
}
|
|
2908
|
+
});
|
|
2909
|
+
});
|
|
2910
|
+
return a;
|
|
2911
|
+
}
|
|
2912
|
+
|
|
2913
|
+
/* global setTimeout, clearTimeout */
|
|
2914
|
+
|
|
2915
|
+
var dist$1 = function debounce(fn) {
|
|
2916
|
+
var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
2917
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
2918
|
+
|
|
2919
|
+
var lastCallAt = void 0;
|
|
2920
|
+
var deferred = void 0;
|
|
2921
|
+
var timer = void 0;
|
|
2922
|
+
var pendingArgs = [];
|
|
2923
|
+
return function debounced() {
|
|
2924
|
+
var currentWait = getWait(wait);
|
|
2925
|
+
var currentTime = new Date().getTime();
|
|
2926
|
+
|
|
2927
|
+
var isCold = !lastCallAt || currentTime - lastCallAt > currentWait;
|
|
2928
|
+
|
|
2929
|
+
lastCallAt = currentTime;
|
|
2930
|
+
|
|
2931
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
2932
|
+
args[_key] = arguments[_key];
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2935
|
+
if (isCold && options.leading) {
|
|
2936
|
+
return options.accumulate ? Promise.resolve(fn.call(this, [args])).then(function (result) {
|
|
2937
|
+
return result[0];
|
|
2938
|
+
}) : Promise.resolve(fn.call.apply(fn, [this].concat(args)));
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
if (deferred) {
|
|
2942
|
+
clearTimeout(timer);
|
|
2943
|
+
} else {
|
|
2944
|
+
deferred = defer();
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2947
|
+
pendingArgs.push(args);
|
|
2948
|
+
timer = setTimeout(flush.bind(this), currentWait);
|
|
2949
|
+
|
|
2950
|
+
if (options.accumulate) {
|
|
2951
|
+
var argsIndex = pendingArgs.length - 1;
|
|
2952
|
+
return deferred.promise.then(function (results) {
|
|
2953
|
+
return results[argsIndex];
|
|
2954
|
+
});
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2957
|
+
return deferred.promise;
|
|
2958
|
+
};
|
|
2959
|
+
|
|
2960
|
+
function flush() {
|
|
2961
|
+
var thisDeferred = deferred;
|
|
2962
|
+
clearTimeout(timer);
|
|
2963
|
+
|
|
2964
|
+
Promise.resolve(options.accumulate ? fn.call(this, pendingArgs) : fn.apply(this, pendingArgs[pendingArgs.length - 1])).then(thisDeferred.resolve, thisDeferred.reject);
|
|
2965
|
+
|
|
2966
|
+
pendingArgs = [];
|
|
2967
|
+
deferred = null;
|
|
2968
|
+
}
|
|
2969
|
+
};
|
|
2970
|
+
|
|
2971
|
+
function getWait(wait) {
|
|
2972
|
+
return typeof wait === 'function' ? wait() : wait;
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
function defer() {
|
|
2976
|
+
var deferred = {};
|
|
2977
|
+
deferred.promise = new Promise(function (resolve, reject) {
|
|
2978
|
+
deferred.resolve = resolve;
|
|
2979
|
+
deferred.reject = reject;
|
|
2980
|
+
});
|
|
2981
|
+
return deferred;
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2984
|
+
var GridSubComponentContext = createContext({
|
|
2985
|
+
value: "GridSubComponentContext value no context",
|
|
2986
|
+
data: {},
|
|
2987
|
+
setValue: function () {
|
|
2988
|
+
console.error("GridSubComponentContext setValue no context");
|
|
2989
|
+
},
|
|
2990
|
+
setValid: function () {
|
|
2991
|
+
console.error("GridSubComponentContext setValid no context");
|
|
2992
|
+
},
|
|
2993
|
+
triggerSave: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2994
|
+
return __generator(this, function (_a) {
|
|
2995
|
+
console.error("GridSubComponentContext triggerSave no context");
|
|
2996
|
+
return [2 /*return*/];
|
|
2997
|
+
});
|
|
2998
|
+
}); },
|
|
2999
|
+
context: null
|
|
3000
|
+
});
|
|
3001
|
+
|
|
3002
|
+
function styleInject(css, ref) {
|
|
3003
|
+
if ( ref === void 0 ) ref = {};
|
|
3004
|
+
var insertAt = ref.insertAt;
|
|
3005
|
+
|
|
3006
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
3007
|
+
|
|
3008
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
3009
|
+
var style = document.createElement('style');
|
|
3010
|
+
style.type = 'text/css';
|
|
3011
|
+
|
|
3012
|
+
if (insertAt === 'top') {
|
|
3013
|
+
if (head.firstChild) {
|
|
3014
|
+
head.insertBefore(style, head.firstChild);
|
|
3015
|
+
} else {
|
|
3016
|
+
head.appendChild(style);
|
|
3017
|
+
}
|
|
3018
|
+
} else {
|
|
3019
|
+
head.appendChild(style);
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
if (style.styleSheet) {
|
|
3023
|
+
style.styleSheet.cssText = css;
|
|
3024
|
+
} else {
|
|
3025
|
+
style.appendChild(document.createTextNode(css));
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
|
|
3029
|
+
var css_248z$2 = ".helpText{color:#6b6966;font-size:.75rem;font-weight:400}";
|
|
3030
|
+
styleInject(css_248z$2);
|
|
3031
|
+
|
|
3032
|
+
var FormError = function (props) {
|
|
3033
|
+
return (jsxs(Fragment, { children: [props.error && (jsx("span", __assign({ className: "LuiTextInput-error", style: { paddingLeft: 0 } }, { children: props.error }))), props.helpText && !props.error && jsx("span", __assign({ className: "helpText" }, { children: props.helpText }))] }));
|
|
3034
|
+
};
|
|
3035
|
+
|
|
2922
3036
|
function escapeStringRegexp(string) {
|
|
2923
3037
|
if (typeof string !== 'string') {
|
|
2924
3038
|
throw new TypeError('Expected a string');
|
|
@@ -4204,12 +4318,15 @@ var GridWrapper = function (_a) {
|
|
|
4204
4318
|
*/
|
|
4205
4319
|
var GridContextProvider = function (props) {
|
|
4206
4320
|
var modifyUpdating = useContext(GridUpdatingContext).modifyUpdating;
|
|
4207
|
-
var _a = useState(), gridApi = _a[0],
|
|
4208
|
-
var _b = useState(
|
|
4209
|
-
var _c = useState(
|
|
4321
|
+
var _a = useState(), gridApi = _a[0], setGridApi = _a[1];
|
|
4322
|
+
var _b = useState(), columnApi = _b[0], setColumnApi = _b[1];
|
|
4323
|
+
var _c = useState(false), gridReady = _c[0], setGridReady = _c[1];
|
|
4324
|
+
var _d = useState(""), quickFilter = _d[0], setQuickFilter = _d[1];
|
|
4325
|
+
var _e = useState([]), invisibleColumnIds = _e[0], setInvisibleColumnIds = _e[1];
|
|
4326
|
+
var testId = useRef();
|
|
4210
4327
|
var idsBeforeUpdate = useRef([]);
|
|
4211
4328
|
var prePopupFocusedCell = useRef();
|
|
4212
|
-
var
|
|
4329
|
+
var _f = useState(false), externallySelectedItemsAreInSync = _f[0], setExternallySelectedItemsAreInSync = _f[1];
|
|
4213
4330
|
var externalFilters = useRef([]);
|
|
4214
4331
|
/**
|
|
4215
4332
|
* Set quick filter directly on grid, based on previously save quickFilter state.
|
|
@@ -4217,14 +4334,6 @@ var GridContextProvider = function (props) {
|
|
|
4217
4334
|
useEffect(function () {
|
|
4218
4335
|
gridApi === null || gridApi === void 0 ? void 0 : gridApi.setQuickFilter(quickFilter);
|
|
4219
4336
|
}, [gridApi, quickFilter]);
|
|
4220
|
-
/**
|
|
4221
|
-
* Set the grid api when the grid is ready.
|
|
4222
|
-
*/
|
|
4223
|
-
var setGridApi = useCallback(function (gridApi) {
|
|
4224
|
-
_setGridApi(gridApi);
|
|
4225
|
-
gridApi === null || gridApi === void 0 ? void 0 : gridApi.setQuickFilter(quickFilter);
|
|
4226
|
-
setGridReady(!!gridApi);
|
|
4227
|
-
}, [quickFilter]);
|
|
4228
4337
|
/**
|
|
4229
4338
|
* Wraps things that require gridApi in common handling, for when gridApi not present.
|
|
4230
4339
|
*
|
|
@@ -4237,6 +4346,46 @@ var GridContextProvider = function (props) {
|
|
|
4237
4346
|
}
|
|
4238
4347
|
return gridApi ? hasApiFn(gridApi) : noApiFn();
|
|
4239
4348
|
}, [gridApi]);
|
|
4349
|
+
/**
|
|
4350
|
+
* Scroll row into view by Id.
|
|
4351
|
+
*
|
|
4352
|
+
* @param id Id to scroll into view
|
|
4353
|
+
* @return true if row is found, else false
|
|
4354
|
+
*/
|
|
4355
|
+
var ensureRowVisible = useCallback(function (id) {
|
|
4356
|
+
return gridApiOp(function (gridApi) {
|
|
4357
|
+
var node = gridApi.getRowNode("".concat(id));
|
|
4358
|
+
if (!node)
|
|
4359
|
+
return false;
|
|
4360
|
+
gridApi.ensureNodeVisible(node);
|
|
4361
|
+
return true;
|
|
4362
|
+
});
|
|
4363
|
+
}, [gridApiOp]);
|
|
4364
|
+
/**
|
|
4365
|
+
* Set the grid api when the grid is ready.
|
|
4366
|
+
*/
|
|
4367
|
+
var setApis = useCallback(function (gridApi, columnApi, dataTestId) {
|
|
4368
|
+
testId.current = dataTestId;
|
|
4369
|
+
setGridApi(gridApi);
|
|
4370
|
+
setColumnApi(columnApi);
|
|
4371
|
+
gridApi === null || gridApi === void 0 ? void 0 : gridApi.setQuickFilter(quickFilter);
|
|
4372
|
+
setGridReady(!!gridApi);
|
|
4373
|
+
}, [quickFilter]);
|
|
4374
|
+
/**
|
|
4375
|
+
* Expose scrollRowIntoView for playwright tests.
|
|
4376
|
+
*/
|
|
4377
|
+
useEffect(function () {
|
|
4378
|
+
var globalSupport = window.__stepAgGrid || (window.__stepAgGrid = { grids: {} });
|
|
4379
|
+
if (testId.current) {
|
|
4380
|
+
globalSupport.grids[testId.current] = {
|
|
4381
|
+
scrollRowIntoViewById: function (rowId) {
|
|
4382
|
+
if (!ensureRowVisible(rowId)) {
|
|
4383
|
+
throw "scrollRowIntoView failed on grid '".concat(testId.current, "' as row with id: '").concat(rowId, "' was not found");
|
|
4384
|
+
}
|
|
4385
|
+
}
|
|
4386
|
+
};
|
|
4387
|
+
}
|
|
4388
|
+
}, [ensureRowVisible]);
|
|
4240
4389
|
/**
|
|
4241
4390
|
* Before a popup record the currently focused cell.
|
|
4242
4391
|
*/
|
|
@@ -4390,19 +4539,21 @@ var GridContextProvider = function (props) {
|
|
|
4390
4539
|
var getSelectedRows = useCallback(function () {
|
|
4391
4540
|
return gridApiOp(function (gridApi) { return gridApi.getSelectedRows(); }, function () { return []; });
|
|
4392
4541
|
}, [gridApiOp]);
|
|
4542
|
+
var getFilteredSelectedRows = useCallback(function () {
|
|
4543
|
+
return gridApiOp(function (gridApi) {
|
|
4544
|
+
var rowData = [];
|
|
4545
|
+
gridApi.forEachNodeAfterFilter(function (node) {
|
|
4546
|
+
if (node.isSelected())
|
|
4547
|
+
rowData.push(node.data);
|
|
4548
|
+
});
|
|
4549
|
+
return rowData;
|
|
4550
|
+
});
|
|
4551
|
+
}, [gridApiOp]);
|
|
4393
4552
|
var getSelectedRowIds = useCallback(function () { return getSelectedRows().map(function (row) { return row.id; }); }, [getSelectedRows]);
|
|
4553
|
+
var getFilteredSelectedRowIds = useCallback(function () { return getFilteredSelectedRows().map(function (row) { return row.id; }); }, [getFilteredSelectedRows]);
|
|
4394
4554
|
var editingCells = useCallback(function () {
|
|
4395
4555
|
return gridApiOp(function (gridApi) { return isNotEmpty(gridApi.getEditingCells()); }, function () { return false; });
|
|
4396
4556
|
}, [gridApiOp]);
|
|
4397
|
-
var ensureRowVisible = useCallback(function (id) {
|
|
4398
|
-
return gridApiOp(function (gridApi) {
|
|
4399
|
-
var node = gridApi.getRowNode("".concat(id));
|
|
4400
|
-
if (!node)
|
|
4401
|
-
return false;
|
|
4402
|
-
gridApi.ensureNodeVisible(node);
|
|
4403
|
-
return true;
|
|
4404
|
-
});
|
|
4405
|
-
}, [gridApiOp]);
|
|
4406
4557
|
/**
|
|
4407
4558
|
* Scroll last selected row into view on grid sort change
|
|
4408
4559
|
*/
|
|
@@ -4541,10 +4692,24 @@ var GridContextProvider = function (props) {
|
|
|
4541
4692
|
var doesExternalFilterPass = function (node) {
|
|
4542
4693
|
return externalFilters.current.every(function (filter) { return filter(node.data, node); });
|
|
4543
4694
|
};
|
|
4695
|
+
var getColumns = useCallback(function () { var _a; return (_a = gridApi === null || gridApi === void 0 ? void 0 : gridApi.getColumnDefs()) !== null && _a !== void 0 ? _a : []; }, [gridApi]);
|
|
4696
|
+
useEffect(function () {
|
|
4697
|
+
if (columnApi) {
|
|
4698
|
+
// show all columns that aren't invisible
|
|
4699
|
+
columnApi.setColumnsVisible(compact(getColumns()
|
|
4700
|
+
.filter(function (col) { return !col.lockVisible && col.colId && !invisibleColumnIds.includes(col.colId); })
|
|
4701
|
+
.map(function (col) { return col.colId; })), true);
|
|
4702
|
+
// hide all invisible columns
|
|
4703
|
+
columnApi.setColumnsVisible(invisibleColumnIds, false);
|
|
4704
|
+
}
|
|
4705
|
+
}, [invisibleColumnIds, columnApi, getColumns]);
|
|
4544
4706
|
return (jsx(GridContext.Provider, __assign({ value: {
|
|
4707
|
+
getColumns: getColumns,
|
|
4708
|
+
invisibleColumnIds: invisibleColumnIds,
|
|
4709
|
+
setInvisibleColumnIds: setInvisibleColumnIds,
|
|
4545
4710
|
gridReady: gridReady,
|
|
4546
4711
|
prePopupOps: prePopupOps,
|
|
4547
|
-
|
|
4712
|
+
setApis: setApis,
|
|
4548
4713
|
setQuickFilter: setQuickFilter,
|
|
4549
4714
|
selectRowsById: selectRowsById,
|
|
4550
4715
|
selectRowsDiff: selectRowsDiff,
|
|
@@ -4554,7 +4719,9 @@ var GridContextProvider = function (props) {
|
|
|
4554
4719
|
flashRowsDiff: flashRowsDiff,
|
|
4555
4720
|
focusByRowById: focusByRowById,
|
|
4556
4721
|
getSelectedRows: getSelectedRows,
|
|
4722
|
+
getFilteredSelectedRows: getFilteredSelectedRows,
|
|
4557
4723
|
getSelectedRowIds: getSelectedRowIds,
|
|
4724
|
+
getFilteredSelectedRowIds: getFilteredSelectedRowIds,
|
|
4558
4725
|
editingCells: editingCells,
|
|
4559
4726
|
ensureRowVisible: ensureRowVisible,
|
|
4560
4727
|
ensureSelectedRowIsVisible: ensureSelectedRowIsVisible,
|
|
@@ -24836,5 +25003,5 @@ var clickActionButton = function (text, container) { return __awaiter(void 0, vo
|
|
|
24836
25003
|
});
|
|
24837
25004
|
}); };
|
|
24838
25005
|
|
|
24839
|
-
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFilterButtons, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditBearingCorrectionEditorParams, GridPopoverEditBearingEditorParams, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, GridWrapper, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, closePopover, convertDDToDMS, countRows, deselectRow, editCell, findActionButton, findCell, findCellContains, findMenuOption, findMultiSelectOption, findOpenPopover, findParentWithClass, findRow, fnOrVar, generateFilterGetter, getMultiSelectOptions, hasParentClass, isCellReadOnly, isFloat, isNotEmpty, openAndClickMenuOption, openAndFindMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, suppressCellKeyboardEvents, typeInputByLabel, typeInputByPlaceholder, typeOnlyInput, typeOtherInput, typeOtherTextArea, useDeferredPromise, useGenerateOrDefaultId, useGridContext, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, validateMenuOptions, wait$2 as wait };
|
|
25006
|
+
export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFilterButtons, GridFilterColumnsToggle, GridFilterHeaderIconButton, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditBearingCorrectionEditorParams, GridPopoverEditBearingEditorParams, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, GridWrapper, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, closePopover, convertDDToDMS, countRows, deselectRow, editCell, findActionButton, findCell, findCellContains, findMenuOption, findMultiSelectOption, findOpenPopover, findParentWithClass, findRow, fnOrVar, generateFilterGetter, getMultiSelectOptions, hasParentClass, isCellReadOnly, isFloat, isNotEmpty, openAndClickMenuOption, openAndFindMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, suppressCellKeyboardEvents, typeInputByLabel, typeInputByPlaceholder, typeOnlyInput, typeOtherInput, typeOtherTextArea, useDeferredPromise, useGenerateOrDefaultId, useGridContext, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, validateMenuOptions, wait$2 as wait };
|
|
24840
25007
|
//# sourceMappingURL=step-ag-grid.esm.js.map
|