@linzjs/step-ag-grid 21.1.4 → 21.2.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 CHANGED
@@ -367,16 +367,27 @@
367
367
  flex: 1;
368
368
  }
369
369
 
370
+ .GridFilterQuick-icon {
371
+ position: absolute;
372
+ margin: 8px;
373
+ pointer-events: none;
374
+ fill: #6b6966;
375
+ }
376
+
370
377
  .GridFilterQuick-input {
371
378
  width: 100%;
372
379
  height: 40px;
373
380
  min-height: 40px;
374
381
  border: 0.06rem solid #beb9b4;
375
382
  border-radius: 3px;
376
- padding-left: 0.75rem;
383
+ padding-left: 36px;
377
384
  padding-right: 0.75rem;
378
385
  font-family: "Open Sans", system-ui, sans-serif;
379
386
  }
387
+ .GridFilterQuick-input::placeholder {
388
+ color: #6b6966;
389
+ font-style: italic;
390
+ }
380
391
 
381
392
  .Grid-popoverContainer {
382
393
  padding: 0.375rem 0.75rem;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ColDef, GridApi, IRowNode } from "ag-grid-community";
3
2
  import { CsvExportParams } from "ag-grid-community";
4
3
  import { ColDefT, GridBaseRow } from "../components";
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface GridSubComponentContextType {
3
2
  value: any;
4
3
  data: any;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export type GridUpdatingContextType = {
3
2
  checkUpdating: (fields: string | string[], id: number | string) => boolean;
4
3
  modifyUpdating: (fields: string | string[], ids: (number | string)[], fn: () => void | Promise<void>) => Promise<void>;
@@ -4,5 +4,5 @@ export declare const ControlledMenuFr: ({ "aria-label": ariaLabel, className, co
4
4
  saveButtonRef?: MutableRefObject<HTMLButtonElement | null>;
5
5
  }, externalRef: ForwardedRef<HTMLUListElement>) => import("react/jsx-runtime").JSX.Element | null;
6
6
  export declare const ControlledMenu: import("react").ForwardRefExoticComponent<Omit<ControlledMenuProps & {
7
- saveButtonRef?: MutableRefObject<HTMLButtonElement | null> | undefined;
7
+ saveButtonRef?: MutableRefObject<HTMLButtonElement | null>;
8
8
  }, "ref"> & import("react").RefAttributes<HTMLUListElement>>;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import { BaseProps } from "../types";
3
2
  export declare const MenuDivider: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<BaseProps<undefined>, "ref"> & import("react").RefAttributes<HTMLLIElement>>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { BaseProps, ClickEvent, EventHandler, Hoverable, MenuItemTypeProp, RenderProp } from "../types";
3
2
  import { withHoveringResultProps } from "../utils/withHovering";
4
3
  export type MenuItemModifiers = Readonly<{
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { RMEvent } from "../utils";
3
2
  export interface EventHandlersContextType {
4
3
  handleClose?: () => void;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const HoverItemContext: import("react").Context<HTMLDivElement | HTMLLIElement | ((prevItem: HTMLDivElement | HTMLLIElement) => HTMLDivElement | HTMLLIElement | undefined) | undefined>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const ItemSettingsContext: import("react").Context<{
3
2
  submenuCloseDelay: number;
4
3
  submenuOpenDelay: number;
@@ -1,9 +1,9 @@
1
1
  import { MutableRefObject } from "react";
2
2
  import { MenuDirection, MenuOverflow } from "../types";
3
3
  export declare const MenuListContext: import("react").Context<{
4
- overflow?: MenuOverflow | undefined;
5
- overflowAmt?: number | undefined;
6
- parentMenuRef?: MutableRefObject<any> | undefined;
7
- parentDir?: MenuDirection | undefined;
8
- reposSubmenu?: boolean | undefined;
4
+ overflow?: MenuOverflow;
5
+ overflowAmt?: number;
6
+ parentMenuRef?: MutableRefObject<any>;
7
+ parentDir?: MenuDirection;
8
+ reposSubmenu?: boolean;
9
9
  }>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { FocusPosition } from "../types";
3
2
  interface MenuListItemContextType {
4
3
  isParentOpen?: boolean;
@@ -1,7 +1,6 @@
1
- /// <reference types="react" />
2
1
  import { EventHandler, RadioChangeEvent } from "../types";
3
2
  export declare const RadioGroupContext: import("react").Context<{
4
3
  value?: any;
5
- name?: string | undefined;
6
- onRadioChange?: EventHandler<RadioChangeEvent> | undefined;
4
+ name?: string;
5
+ onRadioChange?: EventHandler<RadioChangeEvent>;
7
6
  }>;
@@ -2,22 +2,20 @@ import { MenuState, MenuStateOptions } from "../types";
2
2
  /**
3
3
  * A custom Hook which helps manage the states of `ControlledMenu`.
4
4
  */
5
- export declare const useMenuState: (props?: MenuStateOptions) => [
6
- {
7
- /**
8
- * Menu state which should be forwarded to `ControlledMenu`.
9
- */
10
- state?: MenuState;
11
- /**
12
- * Stop transition animation. This function value should be forwarded to `ControlledMenu`.
13
- */
14
- endTransition: () => void;
15
- },
5
+ export declare const useMenuState: (props?: MenuStateOptions) => [{
16
6
  /**
17
- * Open or close menu.
18
- *
19
- * - If no parameter is supplied, this function will toggle state between open and close phases.
20
- * - You can set a boolean parameter to explicitly switch into one of the two phases.
7
+ * Menu state which should be forwarded to `ControlledMenu`.
21
8
  */
22
- (open?: boolean) => void
23
- ];
9
+ state?: MenuState;
10
+ /**
11
+ * Stop transition animation. This function value should be forwarded to `ControlledMenu`.
12
+ */
13
+ endTransition: () => void;
14
+ },
15
+ /**
16
+ * Open or close menu.
17
+ *
18
+ * - If no parameter is supplied, this function will toggle state between open and close phases.
19
+ * - You can set a boolean parameter to explicitly switch into one of the two phases.
20
+ */
21
+ (open?: boolean) => void];
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { unstable_batchedUpdates } from "react-dom";
3
2
  import { MenuButtonProps } from "../components/MenuButton";
4
3
  import { MenuState, MenuStateOptions } from "../types";
@@ -3128,9 +3128,9 @@ const GridFilterQuick = ({ quickFilterPlaceholder, defaultValue }) => {
3128
3128
  React.useEffect(() => {
3129
3129
  setQuickFilter(quickFilterValue);
3130
3130
  }, [quickFilterValue, setQuickFilter]);
3131
- return (jsxRuntime.jsx("div", { className: "GridFilterQuick-container", children: jsxRuntime.jsx("input", { "aria-label": "Search", className: "GridFilterQuick-input", type: "text", placeholder: quickFilterPlaceholder ?? "Search...", value: quickFilterValue, onChange: (event) => {
3132
- setQuickFilterValue(event.target.value);
3133
- } }) }));
3131
+ return (jsxRuntime.jsxs("div", { className: "GridFilterQuick-container", children: [jsxRuntime.jsx("div", { className: "GridFilterQuick-icon", children: jsxRuntime.jsx(lui.LuiIcon, { name: "ic_search", alt: "Search", size: "md" }) }), jsxRuntime.jsx("input", { "aria-label": "Search", className: "GridFilterQuick-input", type: "text", placeholder: quickFilterPlaceholder ?? "Search", value: quickFilterValue, onChange: (event) => {
3132
+ setQuickFilterValue(event.target.value);
3133
+ } })] }));
3134
3134
  };
3135
3135
 
3136
3136
  const GridFilters = ({ children }) => (jsxRuntime.jsx("div", { className: "Grid-container-filters", children: children }));
@@ -4250,43 +4250,42 @@ const GridFormPopoverMenu = (props) => {
4250
4250
  }, children: jsxRuntime.jsx("div", { className: "subComponent", children: item.subComponent && jsxRuntime.jsx(item.subComponent, {}) }) })) }, `${item.label}_subcomponent`))] }, `${item.label}`))))) }) }));
4251
4251
  };
4252
4252
 
4253
+ /**
4254
+ * Convert array of 16 byte values to UUID string format of the form:
4255
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
4256
+ */
4257
+ var byteToHex = [];
4258
+ for (var i = 0; i < 256; ++i) {
4259
+ byteToHex.push((i + 0x100).toString(16).slice(1));
4260
+ }
4261
+ function unsafeStringify(arr, offset = 0) {
4262
+ // Note: Be careful editing this code! It's been tuned for performance
4263
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
4264
+ //
4265
+ // Note to future-self: No, you can't remove the `toLowerCase()` call.
4266
+ // REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351
4267
+ 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();
4268
+ }
4269
+
4253
4270
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
4254
4271
  // require the crypto API and do not support built-in fallback to lower quality random number
4255
4272
  // generators (like Math.random()).
4256
- let getRandomValues;
4257
- const rnds8 = new Uint8Array(16);
4273
+
4274
+ var getRandomValues;
4275
+ var rnds8 = new Uint8Array(16);
4258
4276
  function rng() {
4259
4277
  // lazy load so that environments that need to polyfill have a chance to do so
4260
4278
  if (!getRandomValues) {
4261
4279
  // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
4262
4280
  getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
4263
-
4264
4281
  if (!getRandomValues) {
4265
4282
  throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
4266
4283
  }
4267
4284
  }
4268
-
4269
4285
  return getRandomValues(rnds8);
4270
4286
  }
4271
4287
 
4272
- /**
4273
- * Convert array of 16 byte values to UUID string format of the form:
4274
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
4275
- */
4276
-
4277
- const byteToHex = [];
4278
-
4279
- for (let i = 0; i < 256; ++i) {
4280
- byteToHex.push((i + 0x100).toString(16).slice(1));
4281
- }
4282
-
4283
- function unsafeStringify(arr, offset = 0) {
4284
- // Note: Be careful editing this code! It's been tuned for performance
4285
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
4286
- 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]];
4287
- }
4288
-
4289
- const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
4288
+ var randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
4290
4289
  var native = {
4291
4290
  randomUUID
4292
4291
  };
@@ -4295,13 +4294,12 @@ function v4(options, buf, offset) {
4295
4294
  if (native.randomUUID && !buf && !options) {
4296
4295
  return native.randomUUID();
4297
4296
  }
4298
-
4299
4297
  options = options || {};
4300
- const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
4298
+ var rnds = options.random || (options.rng || rng)();
4301
4299
 
4300
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
4302
4301
  rnds[6] = rnds[6] & 0x0f | 0x40;
4303
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
4304
-
4302
+ rnds[8] = rnds[8] & 0x3f | 0x80;
4305
4303
  return unsafeStringify(rnds);
4306
4304
  }
4307
4305
 
@@ -4580,13 +4578,18 @@ const GridContextProvider = (props) => {
4580
4578
  const { modifyUpdating, checkUpdating } = React.useContext(GridUpdatingContext);
4581
4579
  const [gridApi, setGridApi] = React.useState();
4582
4580
  const [gridReady, setGridReady] = React.useState(false);
4583
- const [quickFilter, setQuickFilter] = React.useState("");
4581
+ const [quickFilter, _setQuickFilter] = React.useState("");
4584
4582
  const [invisibleColumnIds, _setInvisibleColumnIds] = React.useState();
4585
4583
  const testId = React.useRef();
4586
4584
  const idsBeforeUpdate = React.useRef([]);
4587
4585
  const prePopupFocusedCell = React.useRef();
4588
4586
  const [externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync] = React.useState(false);
4589
4587
  const externalFilters = React.useRef([]);
4588
+ const setQuickFilter = React.useCallback((filter) => {
4589
+ // If we don't clear the focused cell focus switches back to grid when typing in the quick filter input
4590
+ gridApi?.clearFocusedCell();
4591
+ _setQuickFilter(filter);
4592
+ }, [gridApi]);
4590
4593
  /**
4591
4594
  * Make extra sure the GridCellFillerColId never gets added to invisibleColumnIds as it's dynamically determined
4592
4595
  */