@linzjs/step-ag-grid 2.4.10 → 2.5.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@linzjs/step-ag-grid",
3
3
  "repository": "github:linz/step-ag-grid.git",
4
4
  "license": "MIT",
5
- "version": "2.4.10",
5
+ "version": "2.5.0",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -256,11 +256,13 @@ export const GridFormDropDown = <RowType extends GridBaseRow, ValueType>(
256
256
  }
257
257
  setSubComponentValues(localSubComponentValues);
258
258
  },
259
- keyDown: (key: string) => {
259
+ keyDown: (key: string, event: KeyboardEvent<HTMLInputElement>) => {
260
260
  const subComponentItem = subComponentValues.find(
261
261
  ({ optionValue }) => optionValue === item.value,
262
262
  );
263
263
  if ((key === "Enter" || key === "Tab") && subComponentItem) {
264
+ event.preventDefault();
265
+ event.stopPropagation();
264
266
  return selectItemHandler(
265
267
  item.value as ValueType,
266
268
  subComponentItem.subComponentValue,
@@ -1,10 +1,10 @@
1
- import { useState } from "react";
1
+ import { useState, KeyboardEvent } from "react";
2
2
  import { TextInputFormatted } from "../../lui/TextInputFormatted";
3
3
  import "../../styles/GridFormSubComponentTextInput.scss";
4
4
 
5
5
  export interface GridFormSubComponentTextInput {
6
6
  setValue: (value: string) => void;
7
- keyDown: (key: string) => void;
7
+ keyDown: (key: string, event: KeyboardEvent<HTMLInputElement>) => void;
8
8
  placeholder?: string;
9
9
  className?: string;
10
10
  customHelpText?: string;
@@ -40,7 +40,9 @@ export const GridFormSubComponentTextInput = ({
40
40
  setInputValue(value);
41
41
  }}
42
42
  inputProps={{
43
- onKeyDown: (k: any) => keyDown(k.key),
43
+ onKeyDown: (e) => {
44
+ return keyDown(e.key, e);
45
+ },
44
46
  placeholder: placeholderText,
45
47
  onMouseEnter: (e) => {
46
48
  if (document.activeElement != e.currentTarget) {
@@ -1,12 +1,20 @@
1
1
  import "./TextInputFormatted.scss";
2
2
 
3
- import { ChangeEventHandler, DetailedHTMLProps, InputHTMLAttributes } from "react";
3
+ import {
4
+ ChangeEventHandler,
5
+ DetailedHTMLProps,
6
+ FocusEventHandler,
7
+ InputHTMLAttributes,
8
+ MouseEventHandler,
9
+ } from "react";
4
10
 
5
11
  import clsx from "clsx";
6
12
  import { LuiIcon } from "@linzjs/lui";
7
13
 
8
14
  export interface LuiTextInputProps {
9
15
  onChange?: ChangeEventHandler<HTMLInputElement>;
16
+ onFocus?: FocusEventHandler<HTMLInputElement>;
17
+ onClick?: MouseEventHandler<HTMLInputElement>;
10
18
  inputProps?: DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
11
19
  error?: string | boolean | null;
12
20
  warning?: string | boolean | null;
@@ -38,6 +46,8 @@ export const TextInputFormatted = (props: LuiTextInputProps): JSX.Element => {
38
46
  spellCheck={true}
39
47
  defaultValue={props.value}
40
48
  onChange={props.onChange}
49
+ onFocus={props.onFocus}
50
+ onClick={props.onClick}
41
51
  {...props.inputProps}
42
52
  />
43
53
  <span className={"LuiTextInput-formatted"}>{props.formatted}</span>