@linzjs/step-ag-grid 21.1.4 → 21.2.1
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 +12 -1
- package/dist/src/contexts/GridContext.d.ts +0 -1
- package/dist/src/contexts/GridSubComponentContext.d.ts +0 -1
- package/dist/src/contexts/GridUpdatingContext.d.ts +0 -1
- package/dist/src/react-menu3/components/ControlledMenu.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuDivider.d.ts +0 -1
- package/dist/src/react-menu3/components/MenuItem.d.ts +0 -1
- package/dist/src/react-menu3/contexts/EventHandlersContext.d.ts +0 -1
- package/dist/src/react-menu3/contexts/HoverItemContext.d.ts +0 -1
- package/dist/src/react-menu3/contexts/ItemSettingsContext.d.ts +0 -1
- package/dist/src/react-menu3/contexts/MenuListContext.d.ts +5 -5
- package/dist/src/react-menu3/contexts/MenuListItemContext.d.ts +0 -1
- package/dist/src/react-menu3/contexts/RadioGroupContext.d.ts +2 -3
- package/dist/src/react-menu3/hooks/useMenuState.d.ts +15 -17
- package/dist/src/react-menu3/utils/utils.d.ts +0 -1
- package/dist/step-ag-grid.cjs.js +50 -31
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +50 -31
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +36 -36
- package/src/components/gridFilter/GridFilterQuick.tsx +5 -1
- package/src/contexts/GridContextProvider.tsx +28 -2
- package/src/stories/grid/GridReadOnly.stories.tsx +8 -1
- package/src/styles/Grid.scss +13 -1
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -3126,9 +3126,9 @@ const GridFilterQuick = ({ quickFilterPlaceholder, defaultValue }) => {
|
|
|
3126
3126
|
useEffect(() => {
|
|
3127
3127
|
setQuickFilter(quickFilterValue);
|
|
3128
3128
|
}, [quickFilterValue, setQuickFilter]);
|
|
3129
|
-
return (
|
|
3130
|
-
|
|
3131
|
-
|
|
3129
|
+
return (jsxs("div", { className: "GridFilterQuick-container", children: [jsx("div", { className: "GridFilterQuick-icon", children: jsx(LuiIcon, { name: "ic_search", alt: "Search", size: "md" }) }), jsx("input", { "aria-label": "Search", className: "GridFilterQuick-input", type: "text", placeholder: quickFilterPlaceholder ?? "Search", value: quickFilterValue, onChange: (event) => {
|
|
3130
|
+
setQuickFilterValue(event.target.value);
|
|
3131
|
+
} })] }));
|
|
3132
3132
|
};
|
|
3133
3133
|
|
|
3134
3134
|
const GridFilters = ({ children }) => (jsx("div", { className: "Grid-container-filters", children: children }));
|
|
@@ -4248,43 +4248,42 @@ const GridFormPopoverMenu = (props) => {
|
|
|
4248
4248
|
}, children: jsx("div", { className: "subComponent", children: item.subComponent && jsx(item.subComponent, {}) }) })) }, `${item.label}_subcomponent`))] }, `${item.label}`))))) }) }));
|
|
4249
4249
|
};
|
|
4250
4250
|
|
|
4251
|
+
/**
|
|
4252
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
4253
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
4254
|
+
*/
|
|
4255
|
+
var byteToHex = [];
|
|
4256
|
+
for (var i = 0; i < 256; ++i) {
|
|
4257
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
4258
|
+
}
|
|
4259
|
+
function unsafeStringify(arr, offset = 0) {
|
|
4260
|
+
// Note: Be careful editing this code! It's been tuned for performance
|
|
4261
|
+
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
4262
|
+
//
|
|
4263
|
+
// Note to future-self: No, you can't remove the `toLowerCase()` call.
|
|
4264
|
+
// REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351
|
|
4265
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
4266
|
+
}
|
|
4267
|
+
|
|
4251
4268
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
4252
4269
|
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
4253
4270
|
// generators (like Math.random()).
|
|
4254
|
-
|
|
4255
|
-
|
|
4271
|
+
|
|
4272
|
+
var getRandomValues;
|
|
4273
|
+
var rnds8 = new Uint8Array(16);
|
|
4256
4274
|
function rng() {
|
|
4257
4275
|
// lazy load so that environments that need to polyfill have a chance to do so
|
|
4258
4276
|
if (!getRandomValues) {
|
|
4259
4277
|
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
4260
4278
|
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
4261
|
-
|
|
4262
4279
|
if (!getRandomValues) {
|
|
4263
4280
|
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
4264
4281
|
}
|
|
4265
4282
|
}
|
|
4266
|
-
|
|
4267
4283
|
return getRandomValues(rnds8);
|
|
4268
4284
|
}
|
|
4269
4285
|
|
|
4270
|
-
|
|
4271
|
-
* Convert array of 16 byte values to UUID string format of the form:
|
|
4272
|
-
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
4273
|
-
*/
|
|
4274
|
-
|
|
4275
|
-
const byteToHex = [];
|
|
4276
|
-
|
|
4277
|
-
for (let i = 0; i < 256; ++i) {
|
|
4278
|
-
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
4279
|
-
}
|
|
4280
|
-
|
|
4281
|
-
function unsafeStringify(arr, offset = 0) {
|
|
4282
|
-
// Note: Be careful editing this code! It's been tuned for performance
|
|
4283
|
-
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
4284
|
-
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
4285
|
-
}
|
|
4286
|
-
|
|
4287
|
-
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
4286
|
+
var randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
4288
4287
|
var native = {
|
|
4289
4288
|
randomUUID
|
|
4290
4289
|
};
|
|
@@ -4293,13 +4292,12 @@ function v4(options, buf, offset) {
|
|
|
4293
4292
|
if (native.randomUUID && !buf && !options) {
|
|
4294
4293
|
return native.randomUUID();
|
|
4295
4294
|
}
|
|
4296
|
-
|
|
4297
4295
|
options = options || {};
|
|
4298
|
-
|
|
4296
|
+
var rnds = options.random || (options.rng || rng)();
|
|
4299
4297
|
|
|
4298
|
+
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
4300
4299
|
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
4301
|
-
rnds[8] = rnds[8] & 0x3f | 0x80;
|
|
4302
|
-
|
|
4300
|
+
rnds[8] = rnds[8] & 0x3f | 0x80;
|
|
4303
4301
|
return unsafeStringify(rnds);
|
|
4304
4302
|
}
|
|
4305
4303
|
|
|
@@ -4578,13 +4576,18 @@ const GridContextProvider = (props) => {
|
|
|
4578
4576
|
const { modifyUpdating, checkUpdating } = useContext(GridUpdatingContext);
|
|
4579
4577
|
const [gridApi, setGridApi] = useState();
|
|
4580
4578
|
const [gridReady, setGridReady] = useState(false);
|
|
4581
|
-
const [quickFilter,
|
|
4579
|
+
const [quickFilter, _setQuickFilter] = useState("");
|
|
4582
4580
|
const [invisibleColumnIds, _setInvisibleColumnIds] = useState();
|
|
4583
4581
|
const testId = useRef();
|
|
4584
4582
|
const idsBeforeUpdate = useRef([]);
|
|
4585
4583
|
const prePopupFocusedCell = useRef();
|
|
4586
4584
|
const [externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync] = useState(false);
|
|
4587
4585
|
const externalFilters = useRef([]);
|
|
4586
|
+
const setQuickFilter = useCallback((filter) => {
|
|
4587
|
+
// If we don't clear the focused cell focus switches back to grid when typing in the quick filter input
|
|
4588
|
+
gridApi?.clearFocusedCell();
|
|
4589
|
+
_setQuickFilter(filter);
|
|
4590
|
+
}, [gridApi]);
|
|
4588
4591
|
/**
|
|
4589
4592
|
* Make extra sure the GridCellFillerColId never gets added to invisibleColumnIds as it's dynamically determined
|
|
4590
4593
|
*/
|
|
@@ -5020,7 +5023,23 @@ const GridContextProvider = (props) => {
|
|
|
5020
5023
|
}
|
|
5021
5024
|
}, []);
|
|
5022
5025
|
const onFilterChanged = useMemo(() => debounce(() => {
|
|
5023
|
-
|
|
5026
|
+
// This is terrible, but there's no other way for me to check whether a filter has changed the grid
|
|
5027
|
+
const getDisplayedRowsHash = () => {
|
|
5028
|
+
const arr = [];
|
|
5029
|
+
gridApi?.forEachNodeAfterFilter((rowNode) => {
|
|
5030
|
+
arr.push(rowNode.id);
|
|
5031
|
+
});
|
|
5032
|
+
return arr.join("|");
|
|
5033
|
+
};
|
|
5034
|
+
if (gridApi) {
|
|
5035
|
+
const hasFocusedCell = gridApi.getFocusedCell();
|
|
5036
|
+
const preHash = hasFocusedCell && getDisplayedRowsHash();
|
|
5037
|
+
gridApi.onFilterChanged();
|
|
5038
|
+
const postHash = hasFocusedCell && getDisplayedRowsHash();
|
|
5039
|
+
// Ag-grid has a bug where if a focused cell comes into view after a filter the filter loses focus
|
|
5040
|
+
// So the focus is cleared to prevent this
|
|
5041
|
+
preHash !== postHash && gridApi.clearFocusedCell();
|
|
5042
|
+
}
|
|
5024
5043
|
}, 200), [gridApi]);
|
|
5025
5044
|
const addExternalFilter = (filter) => {
|
|
5026
5045
|
externalFilters.current.push(filter);
|